aclocal.m4 revision ea148d1d
1ea148d1dSmrg# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
26ef05171Smrg
3ea148d1dSmrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
443f32c10Smrg
543f32c10Smrg# This file is free software; the Free Software Foundation
643f32c10Smrg# gives unlimited permission to copy and/or distribute it,
743f32c10Smrg# with or without modifications, as long as this notice is preserved.
843f32c10Smrg
943f32c10Smrg# This program is distributed in the hope that it will be useful,
1043f32c10Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1143f32c10Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1243f32c10Smrg# PARTICULAR PURPOSE.
1343f32c10Smrg
146ef05171Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1543f32c10Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1643f32c10Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
176ef05171Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
186ef05171Smrg[m4_warning([this file was generated for autoconf 2.69.
1943f32c10SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2043f32c10SmrgIf you have problems, you may need to regenerate the build system entirely.
216ef05171SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2243f32c10Smrg
236ef05171Smrg# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
246ef05171Smrg# serial 11 (pkg-config-0.29.1)
2543f32c10Smrg
266ef05171Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
276ef05171Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
286ef05171Smrgdnl
296ef05171Smrgdnl This program is free software; you can redistribute it and/or modify
306ef05171Smrgdnl it under the terms of the GNU General Public License as published by
316ef05171Smrgdnl the Free Software Foundation; either version 2 of the License, or
326ef05171Smrgdnl (at your option) any later version.
336ef05171Smrgdnl
346ef05171Smrgdnl This program is distributed in the hope that it will be useful, but
356ef05171Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
366ef05171Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376ef05171Smrgdnl General Public License for more details.
386ef05171Smrgdnl
396ef05171Smrgdnl You should have received a copy of the GNU General Public License
406ef05171Smrgdnl along with this program; if not, write to the Free Software
416ef05171Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
426ef05171Smrgdnl 02111-1307, USA.
436ef05171Smrgdnl
446ef05171Smrgdnl As a special exception to the GNU General Public License, if you
456ef05171Smrgdnl distribute this file as part of a program that contains a
466ef05171Smrgdnl configuration script generated by Autoconf, you may include it under
476ef05171Smrgdnl the same distribution terms that you use for the rest of that
486ef05171Smrgdnl program.
496ef05171Smrg
506ef05171Smrgdnl PKG_PREREQ(MIN-VERSION)
516ef05171Smrgdnl -----------------------
526ef05171Smrgdnl Since: 0.29
536ef05171Smrgdnl
546ef05171Smrgdnl Verify that the version of the pkg-config macros are at least
556ef05171Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
566ef05171Smrgdnl installed version of pkg-config, this checks the developer's version
576ef05171Smrgdnl of pkg.m4 when generating configure.
586ef05171Smrgdnl
596ef05171Smrgdnl To ensure that this macro is defined, also add:
606ef05171Smrgdnl m4_ifndef([PKG_PREREQ],
616ef05171Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
626ef05171Smrgdnl
636ef05171Smrgdnl See the "Since" comment for each macro you use to see what version
646ef05171Smrgdnl of the macros you require.
656ef05171Smrgm4_defun([PKG_PREREQ],
666ef05171Smrg[m4_define([PKG_MACROS_VERSION], [0.29.1])
676ef05171Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
686ef05171Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
696ef05171Smrg])dnl PKG_PREREQ
706ef05171Smrg
716ef05171Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
726ef05171Smrgdnl ----------------------------------
736ef05171Smrgdnl Since: 0.16
746ef05171Smrgdnl
756ef05171Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
766ef05171Smrgdnl first found in the path. Checks that the version of pkg-config found
776ef05171Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
786ef05171Smrgdnl used since that's the first version where most current features of
796ef05171Smrgdnl pkg-config existed.
8043f32c10SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8143f32c10Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
826ef05171Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
836ef05171Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
846ef05171SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
856ef05171SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
866ef05171SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
876ef05171Smrg
8843f32c10Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8943f32c10Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
9043f32c10Smrgfi
9143f32c10Smrgif test -n "$PKG_CONFIG"; then
9243f32c10Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
9343f32c10Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
9443f32c10Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
9543f32c10Smrg		AC_MSG_RESULT([yes])
9643f32c10Smrg	else
9743f32c10Smrg		AC_MSG_RESULT([no])
9843f32c10Smrg		PKG_CONFIG=""
9943f32c10Smrg	fi
10043f32c10Smrgfi[]dnl
1016ef05171Smrg])dnl PKG_PROG_PKG_CONFIG
10243f32c10Smrg
1036ef05171Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1046ef05171Smrgdnl -------------------------------------------------------------------
1056ef05171Smrgdnl Since: 0.18
1066ef05171Smrgdnl
1076ef05171Smrgdnl Check to see whether a particular set of modules exists. Similar to
1086ef05171Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1096ef05171Smrgdnl
1106ef05171Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1116ef05171Smrgdnl only at the first occurence in configure.ac, so if the first place
1126ef05171Smrgdnl it's called might be skipped (such as if it is within an "if", you
1136ef05171Smrgdnl have to call PKG_CHECK_EXISTS manually
11443f32c10SmrgAC_DEFUN([PKG_CHECK_EXISTS],
11543f32c10Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11643f32c10Smrgif test -n "$PKG_CONFIG" && \
11743f32c10Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1186ef05171Smrg  m4_default([$2], [:])
11943f32c10Smrgm4_ifvaln([$3], [else
12043f32c10Smrg  $3])dnl
12143f32c10Smrgfi])
12243f32c10Smrg
1236ef05171Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1246ef05171Smrgdnl ---------------------------------------------
1256ef05171Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1266ef05171Smrgdnl pkg_failed based on the result.
12743f32c10Smrgm4_define([_PKG_CONFIG],
1286ef05171Smrg[if test -n "$$1"; then
1296ef05171Smrg    pkg_cv_[]$1="$$1"
1306ef05171Smrg elif test -n "$PKG_CONFIG"; then
1316ef05171Smrg    PKG_CHECK_EXISTS([$3],
1326ef05171Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1336ef05171Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1346ef05171Smrg		     [pkg_failed=yes])
1356ef05171Smrg else
1366ef05171Smrg    pkg_failed=untried
13743f32c10Smrgfi[]dnl
1386ef05171Smrg])dnl _PKG_CONFIG
13943f32c10Smrg
1406ef05171Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1416ef05171Smrgdnl ---------------------------
1426ef05171Smrgdnl Internal check to see if pkg-config supports short errors.
14343f32c10SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
14443f32c10Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
14543f32c10Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
14643f32c10Smrg        _pkg_short_errors_supported=yes
14743f32c10Smrgelse
14843f32c10Smrg        _pkg_short_errors_supported=no
14943f32c10Smrgfi[]dnl
1506ef05171Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
15143f32c10Smrg
15243f32c10Smrg
1536ef05171Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1546ef05171Smrgdnl   [ACTION-IF-NOT-FOUND])
1556ef05171Smrgdnl --------------------------------------------------------------
1566ef05171Smrgdnl Since: 0.4.0
1576ef05171Smrgdnl
1586ef05171Smrgdnl Note that if there is a possibility the first call to
1596ef05171Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1606ef05171Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
16143f32c10SmrgAC_DEFUN([PKG_CHECK_MODULES],
16243f32c10Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
16343f32c10SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
16443f32c10SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
16543f32c10Smrg
16643f32c10Smrgpkg_failed=no
16743f32c10SmrgAC_MSG_CHECKING([for $1])
16843f32c10Smrg
16943f32c10Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
17043f32c10Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
17143f32c10Smrg
17243f32c10Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
17343f32c10Smrgand $1[]_LIBS to avoid the need to call pkg-config.
17443f32c10SmrgSee the pkg-config man page for more details.])
17543f32c10Smrg
17643f32c10Smrgif test $pkg_failed = yes; then
1776ef05171Smrg   	AC_MSG_RESULT([no])
17843f32c10Smrg        _PKG_SHORT_ERRORS_SUPPORTED
17943f32c10Smrg        if test $_pkg_short_errors_supported = yes; then
1806ef05171Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
18143f32c10Smrg        else 
1826ef05171Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
18343f32c10Smrg        fi
18443f32c10Smrg	# Put the nasty error message in config.log where it belongs
18543f32c10Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
18643f32c10Smrg
1876ef05171Smrg	m4_default([$4], [AC_MSG_ERROR(
18843f32c10Smrg[Package requirements ($2) were not met:
18943f32c10Smrg
19043f32c10Smrg$$1_PKG_ERRORS
19143f32c10Smrg
19243f32c10SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
19343f32c10Smrginstalled software in a non-standard prefix.
19443f32c10Smrg
1956ef05171Smrg_PKG_TEXT])[]dnl
1966ef05171Smrg        ])
19743f32c10Smrgelif test $pkg_failed = untried; then
1986ef05171Smrg     	AC_MSG_RESULT([no])
1996ef05171Smrg	m4_default([$4], [AC_MSG_FAILURE(
20043f32c10Smrg[The pkg-config script could not be found or is too old.  Make sure it
20143f32c10Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
20243f32c10Smrgpath to pkg-config.
20343f32c10Smrg
20443f32c10Smrg_PKG_TEXT
20543f32c10Smrg
2066ef05171SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2076ef05171Smrg        ])
20843f32c10Smrgelse
20943f32c10Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
21043f32c10Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
21143f32c10Smrg        AC_MSG_RESULT([yes])
2126ef05171Smrg	$3
21343f32c10Smrgfi[]dnl
2146ef05171Smrg])dnl PKG_CHECK_MODULES
2156ef05171Smrg
2166ef05171Smrg
2176ef05171Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2186ef05171Smrgdnl   [ACTION-IF-NOT-FOUND])
2196ef05171Smrgdnl ---------------------------------------------------------------------
2206ef05171Smrgdnl Since: 0.29
2216ef05171Smrgdnl
2226ef05171Smrgdnl Checks for existence of MODULES and gathers its build flags with
2236ef05171Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2246ef05171Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2256ef05171Smrgdnl
2266ef05171Smrgdnl Note that if there is a possibility the first call to
2276ef05171Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2286ef05171Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2296ef05171Smrgdnl configure.ac.
2306ef05171SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2316ef05171Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2326ef05171Smrg_save_PKG_CONFIG=$PKG_CONFIG
2336ef05171SmrgPKG_CONFIG="$PKG_CONFIG --static"
2346ef05171SmrgPKG_CHECK_MODULES($@)
2356ef05171SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2366ef05171Smrg])dnl PKG_CHECK_MODULES_STATIC
23743f32c10Smrg
2386ef05171Smrg
2396ef05171Smrgdnl PKG_INSTALLDIR([DIRECTORY])
2406ef05171Smrgdnl -------------------------
2416ef05171Smrgdnl Since: 0.27
2426ef05171Smrgdnl
2436ef05171Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
2446ef05171Smrgdnl should install pkg-config .pc files. By default the directory is
2456ef05171Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
2466ef05171Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2476ef05171Smrgdnl parameter.
2486ef05171SmrgAC_DEFUN([PKG_INSTALLDIR],
2496ef05171Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2506ef05171Smrgm4_pushdef([pkg_description],
2516ef05171Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2526ef05171SmrgAC_ARG_WITH([pkgconfigdir],
2536ef05171Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2546ef05171Smrg    [with_pkgconfigdir=]pkg_default)
2556ef05171SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2566ef05171Smrgm4_popdef([pkg_default])
2576ef05171Smrgm4_popdef([pkg_description])
2586ef05171Smrg])dnl PKG_INSTALLDIR
2596ef05171Smrg
2606ef05171Smrg
2616ef05171Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2626ef05171Smrgdnl --------------------------------
2636ef05171Smrgdnl Since: 0.27
2646ef05171Smrgdnl
2656ef05171Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2666ef05171Smrgdnl module should install arch-independent pkg-config .pc files. By
2676ef05171Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
2686ef05171Smrgdnl changed by passing DIRECTORY. The user can override through the
2696ef05171Smrgdnl --with-noarch-pkgconfigdir parameter.
2706ef05171SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2716ef05171Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2726ef05171Smrgm4_pushdef([pkg_description],
2736ef05171Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2746ef05171SmrgAC_ARG_WITH([noarch-pkgconfigdir],
2756ef05171Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2766ef05171Smrg    [with_noarch_pkgconfigdir=]pkg_default)
2776ef05171SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2786ef05171Smrgm4_popdef([pkg_default])
2796ef05171Smrgm4_popdef([pkg_description])
2806ef05171Smrg])dnl PKG_NOARCH_INSTALLDIR
2816ef05171Smrg
2826ef05171Smrg
2836ef05171Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2846ef05171Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2856ef05171Smrgdnl -------------------------------------------
2866ef05171Smrgdnl Since: 0.28
2876ef05171Smrgdnl
2886ef05171Smrgdnl Retrieves the value of the pkg-config variable for the given module.
2896ef05171SmrgAC_DEFUN([PKG_CHECK_VAR],
2906ef05171Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2916ef05171SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2926ef05171Smrg
2936ef05171Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2946ef05171SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2956ef05171Smrg
2966ef05171SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2976ef05171Smrg])dnl PKG_CHECK_VAR
2986ef05171Smrg
2996ef05171Smrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3006ef05171Smrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
3016ef05171Smrgdnl   [DESCRIPTION], [DEFAULT])
3026ef05171Smrgdnl ------------------------------------------
3036ef05171Smrgdnl
3046ef05171Smrgdnl Prepare a "--with-" configure option using the lowercase
3056ef05171Smrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
3066ef05171Smrgdnl PKG_CHECK_MODULES in a single macro.
3076ef05171SmrgAC_DEFUN([PKG_WITH_MODULES],
3086ef05171Smrg[
3096ef05171Smrgm4_pushdef([with_arg], m4_tolower([$1]))
3106ef05171Smrg
3116ef05171Smrgm4_pushdef([description],
3126ef05171Smrg           [m4_default([$5], [build with ]with_arg[ support])])
3136ef05171Smrg
3146ef05171Smrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
3156ef05171Smrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
3166ef05171Smrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
3176ef05171Smrg
3186ef05171Smrgm4_case(def_arg,
3196ef05171Smrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
3206ef05171Smrg            [m4_pushdef([with_without],[--with-]with_arg)])
3216ef05171Smrg
3226ef05171SmrgAC_ARG_WITH(with_arg,
3236ef05171Smrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
3246ef05171Smrg    [AS_TR_SH([with_]with_arg)=def_arg])
3256ef05171Smrg
3266ef05171SmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
3276ef05171Smrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
3286ef05171Smrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
3296ef05171Smrg                                        [m4_n([def_action_if_found]) $3],
3306ef05171Smrg                                        [m4_n([def_action_if_not_found]) $4])])
3316ef05171Smrg
3326ef05171Smrgm4_popdef([with_arg])
3336ef05171Smrgm4_popdef([description])
3346ef05171Smrgm4_popdef([def_arg])
3356ef05171Smrg
3366ef05171Smrg])dnl PKG_WITH_MODULES
3376ef05171Smrg
3386ef05171Smrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3396ef05171Smrgdnl   [DESCRIPTION], [DEFAULT])
3406ef05171Smrgdnl -----------------------------------------------
3416ef05171Smrgdnl
3426ef05171Smrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
3436ef05171Smrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
3446ef05171SmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
3456ef05171Smrg[
3466ef05171SmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
3476ef05171Smrg
3486ef05171SmrgAM_CONDITIONAL([HAVE_][$1],
3496ef05171Smrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
3506ef05171Smrg])dnl PKG_HAVE_WITH_MODULES
3516ef05171Smrg
3526ef05171Smrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3536ef05171Smrgdnl   [DESCRIPTION], [DEFAULT])
3546ef05171Smrgdnl ------------------------------------------------------
3556ef05171Smrgdnl
3566ef05171Smrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
3576ef05171Smrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
3586ef05171Smrgdnl and preprocessor variable.
3596ef05171SmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
3606ef05171Smrg[
3616ef05171SmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
3626ef05171Smrg
3636ef05171SmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
3646ef05171Smrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
3656ef05171Smrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
3666ef05171Smrg
3676ef05171Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3686ef05171Smrgdnl
369ea148d1dSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
37043f32c10Smrgdnl
37143f32c10Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3726ef05171Smrgdnl copy of this software and associated documentation files (the "Software"),
3736ef05171Smrgdnl to deal in the Software without restriction, including without limitation
3746ef05171Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3756ef05171Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3766ef05171Smrgdnl Software is furnished to do so, subject to the following conditions:
37743f32c10Smrgdnl
3786ef05171Smrgdnl The above copyright notice and this permission notice (including the next
3796ef05171Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3806ef05171Smrgdnl Software.
38143f32c10Smrgdnl
3826ef05171Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3836ef05171Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3846ef05171Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3856ef05171Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3866ef05171Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3876ef05171Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3886ef05171Smrgdnl DEALINGS IN THE SOFTWARE.
38943f32c10Smrg
39043f32c10Smrg# XORG_MACROS_VERSION(required-version)
39143f32c10Smrg# -------------------------------------
39243f32c10Smrg# Minimum version: 1.1.0
39343f32c10Smrg#
39443f32c10Smrg# If you're using a macro added in Version 1.1 or newer, include this in
39543f32c10Smrg# your configure.ac with the minimum required version, such as:
39643f32c10Smrg# XORG_MACROS_VERSION(1.1)
39743f32c10Smrg#
3986ef05171Smrg# To ensure that this macro is defined, also add:
3996ef05171Smrg# m4_ifndef([XORG_MACROS_VERSION],
4006ef05171Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
40143f32c10Smrg#
40243f32c10Smrg#
4036ef05171Smrg# See the "minimum version" comment for each macro you use to see what
40443f32c10Smrg# version you require.
4056ef05171Smrgm4_defun([XORG_MACROS_VERSION],[
406ea148d1dSmrgm4_define([vers_have], [1.19.2])
4076ef05171Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
4086ef05171Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
4096ef05171Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
4106ef05171Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
4116ef05171Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
4126ef05171Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
4136ef05171Smrgm4_undefine([vers_have])
4146ef05171Smrgm4_undefine([maj_have])
4156ef05171Smrgm4_undefine([maj_needed])
41643f32c10Smrg]) # XORG_MACROS_VERSION
41743f32c10Smrg
41843f32c10Smrg# XORG_PROG_RAWCPP()
41943f32c10Smrg# ------------------
42043f32c10Smrg# Minimum version: 1.0.0
42143f32c10Smrg#
42243f32c10Smrg# Find cpp program and necessary flags for use in pre-processing text files
42343f32c10Smrg# such as man pages and config files
42443f32c10SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
42543f32c10SmrgAC_REQUIRE([AC_PROG_CPP])
4266ef05171SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
42743f32c10Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
42843f32c10Smrg
42943f32c10Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
43043f32c10Smrg# which is not the best choice for supporting other OS'es, but covers most
43143f32c10Smrg# of the ones we need for now.
43243f32c10SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
4336ef05171SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
43443f32c10Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
43543f32c10Smrg	AC_MSG_RESULT([no])
43643f32c10Smrgelse
43743f32c10Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
43843f32c10Smrg		RAWCPPFLAGS=-undef
43943f32c10Smrg		AC_MSG_RESULT([yes])
4406ef05171Smrg	# under Cygwin unix is still defined even with -undef
4416ef05171Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4426ef05171Smrg		RAWCPPFLAGS="-undef -ansi"
4436ef05171Smrg		AC_MSG_RESULT([yes, with -ansi])
44443f32c10Smrg	else
44543f32c10Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
44643f32c10Smrg	fi
44743f32c10Smrgfi
44843f32c10Smrgrm -f conftest.$ac_ext
44943f32c10Smrg
45043f32c10SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
4516ef05171SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
45243f32c10Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
45343f32c10Smrg	AC_MSG_RESULT([no])
45443f32c10Smrgelse
45543f32c10Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
4566ef05171Smrg		TRADITIONALCPPFLAGS="-traditional"
45743f32c10Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
45843f32c10Smrg		AC_MSG_RESULT([yes])
45943f32c10Smrg	else
46043f32c10Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
46143f32c10Smrg	fi
46243f32c10Smrgfi
46343f32c10Smrgrm -f conftest.$ac_ext
46443f32c10SmrgAC_SUBST(RAWCPPFLAGS)
4656ef05171SmrgAC_SUBST(TRADITIONALCPPFLAGS)
46643f32c10Smrg]) # XORG_PROG_RAWCPP
46743f32c10Smrg
46843f32c10Smrg# XORG_MANPAGE_SECTIONS()
46943f32c10Smrg# -----------------------
47043f32c10Smrg# Minimum version: 1.0.0
47143f32c10Smrg#
47243f32c10Smrg# Determine which sections man pages go in for the different man page types
47343f32c10Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
47443f32c10Smrg# Not sure if there's any better way than just hardcoding by OS name.
47543f32c10Smrg# Override default settings by setting environment variables
4766ef05171Smrg# Added MAN_SUBSTS in version 1.8
4776ef05171Smrg# Added AC_PROG_SED in version 1.8
47843f32c10Smrg
47943f32c10SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
48043f32c10SmrgAC_REQUIRE([AC_CANONICAL_HOST])
4816ef05171SmrgAC_REQUIRE([AC_PROG_SED])
48243f32c10Smrg
483ea148d1dSmrgcase $host_os in
484ea148d1dSmrg    solaris*)
485ea148d1dSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
486ea148d1dSmrg        # check for a man page file found in later versions that use
487ea148d1dSmrg        # traditional section numbers instead
488ea148d1dSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
489ea148d1dSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
490ea148d1dSmrg        ;;
491ea148d1dSmrg    *) SYSV_MAN_SECTIONS=false ;;
492ea148d1dSmrgesac
493ea148d1dSmrg
49443f32c10Smrgif test x$APP_MAN_SUFFIX = x    ; then
49543f32c10Smrg    APP_MAN_SUFFIX=1
49643f32c10Smrgfi
49743f32c10Smrgif test x$APP_MAN_DIR = x    ; then
49843f32c10Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
49943f32c10Smrgfi
50043f32c10Smrg
50143f32c10Smrgif test x$LIB_MAN_SUFFIX = x    ; then
50243f32c10Smrg    LIB_MAN_SUFFIX=3
50343f32c10Smrgfi
50443f32c10Smrgif test x$LIB_MAN_DIR = x    ; then
50543f32c10Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
50643f32c10Smrgfi
50743f32c10Smrg
50843f32c10Smrgif test x$FILE_MAN_SUFFIX = x    ; then
509ea148d1dSmrg    case $SYSV_MAN_SECTIONS in
510ea148d1dSmrg	true)				FILE_MAN_SUFFIX=4  ;;
511ea148d1dSmrg	*)				FILE_MAN_SUFFIX=5  ;;
51243f32c10Smrg    esac
51343f32c10Smrgfi
51443f32c10Smrgif test x$FILE_MAN_DIR = x    ; then
51543f32c10Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
51643f32c10Smrgfi
51743f32c10Smrg
51843f32c10Smrgif test x$MISC_MAN_SUFFIX = x    ; then
519ea148d1dSmrg    case $SYSV_MAN_SECTIONS in
520ea148d1dSmrg	true)				MISC_MAN_SUFFIX=5  ;;
521ea148d1dSmrg	*)				MISC_MAN_SUFFIX=7  ;;
52243f32c10Smrg    esac
52343f32c10Smrgfi
52443f32c10Smrgif test x$MISC_MAN_DIR = x    ; then
52543f32c10Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
52643f32c10Smrgfi
52743f32c10Smrg
52843f32c10Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
529ea148d1dSmrg    case $SYSV_MAN_SECTIONS in
530ea148d1dSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
531ea148d1dSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
53243f32c10Smrg    esac
53343f32c10Smrgfi
53443f32c10Smrgif test x$DRIVER_MAN_DIR = x    ; then
53543f32c10Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
53643f32c10Smrgfi
53743f32c10Smrg
53843f32c10Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
539ea148d1dSmrg    case $SYSV_MAN_SECTIONS in
540ea148d1dSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
541ea148d1dSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
54243f32c10Smrg    esac
54343f32c10Smrgfi
54443f32c10Smrgif test x$ADMIN_MAN_DIR = x    ; then
54543f32c10Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
54643f32c10Smrgfi
54743f32c10Smrg
54843f32c10Smrg
54943f32c10SmrgAC_SUBST([APP_MAN_SUFFIX])
55043f32c10SmrgAC_SUBST([LIB_MAN_SUFFIX])
55143f32c10SmrgAC_SUBST([FILE_MAN_SUFFIX])
55243f32c10SmrgAC_SUBST([MISC_MAN_SUFFIX])
55343f32c10SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
55443f32c10SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
55543f32c10SmrgAC_SUBST([APP_MAN_DIR])
55643f32c10SmrgAC_SUBST([LIB_MAN_DIR])
55743f32c10SmrgAC_SUBST([FILE_MAN_DIR])
55843f32c10SmrgAC_SUBST([MISC_MAN_DIR])
55943f32c10SmrgAC_SUBST([DRIVER_MAN_DIR])
56043f32c10SmrgAC_SUBST([ADMIN_MAN_DIR])
5616ef05171Smrg
5626ef05171SmrgXORG_MAN_PAGE="X Version 11"
5636ef05171SmrgAC_SUBST([XORG_MAN_PAGE])
5646ef05171SmrgMAN_SUBSTS="\
5656ef05171Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5666ef05171Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5676ef05171Smrg	-e 's|__xservername__|Xorg|g' \
5686ef05171Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
5696ef05171Smrg	-e 's|__projectroot__|\$(prefix)|g' \
5706ef05171Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
5716ef05171Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
5726ef05171Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
5736ef05171Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
5746ef05171Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5756ef05171Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5766ef05171Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5776ef05171SmrgAC_SUBST([MAN_SUBSTS])
5786ef05171Smrg
57943f32c10Smrg]) # XORG_MANPAGE_SECTIONS
58043f32c10Smrg
5816ef05171Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5826ef05171Smrg# ------------------------
5836ef05171Smrg# Minimum version: 1.7.0
5846ef05171Smrg#
5856ef05171Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5866ef05171Smrg# provided by xorg-sgml-doctools, if installed.
5876ef05171SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5886ef05171SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5896ef05171SmrgXORG_SGML_PATH=
5906ef05171SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5916ef05171Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5926ef05171Smrg    [m4_ifval([$1],[:],
5936ef05171Smrg        [if test x"$cross_compiling" != x"yes" ; then
5946ef05171Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5956ef05171Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5966ef05171Smrg         fi])
5976ef05171Smrg    ])
5986ef05171Smrg
5996ef05171Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
6006ef05171Smrg# the path and the name of the doc stylesheet
6016ef05171Smrgif test "x$XORG_SGML_PATH" != "x" ; then
6026ef05171Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
6036ef05171Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
6046ef05171Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
6056ef05171Smrgelse
6066ef05171Smrg   AC_MSG_RESULT([no])
6076ef05171Smrgfi
6086ef05171Smrg
6096ef05171SmrgAC_SUBST(XORG_SGML_PATH)
6106ef05171SmrgAC_SUBST(STYLESHEET_SRCDIR)
6116ef05171SmrgAC_SUBST(XSL_STYLESHEET)
6126ef05171SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
6136ef05171Smrg]) # XORG_CHECK_SGML_DOCTOOLS
6146ef05171Smrg
61543f32c10Smrg# XORG_CHECK_LINUXDOC
61643f32c10Smrg# -------------------
61743f32c10Smrg# Minimum version: 1.0.0
61843f32c10Smrg#
61943f32c10Smrg# Defines the variable MAKE_TEXT if the necessary tools and
62043f32c10Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
62143f32c10Smrg# Whether or not the necessary tools and files are found can be checked
62243f32c10Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
62343f32c10SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
6246ef05171SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6256ef05171SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
62643f32c10Smrg
62743f32c10SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
62843f32c10Smrg
6296ef05171SmrgAC_MSG_CHECKING([whether to build documentation])
63043f32c10Smrg
6316ef05171Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
63243f32c10Smrg   BUILDDOC=yes
63343f32c10Smrgelse
63443f32c10Smrg   BUILDDOC=no
63543f32c10Smrgfi
63643f32c10Smrg
63743f32c10SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
63843f32c10Smrg
63943f32c10SmrgAC_MSG_RESULT([$BUILDDOC])
64043f32c10Smrg
6416ef05171SmrgAC_MSG_CHECKING([whether to build pdf documentation])
64243f32c10Smrg
6436ef05171Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
64443f32c10Smrg   BUILDPDFDOC=yes
64543f32c10Smrgelse
64643f32c10Smrg   BUILDPDFDOC=no
64743f32c10Smrgfi
64843f32c10Smrg
64943f32c10SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
65043f32c10Smrg
65143f32c10SmrgAC_MSG_RESULT([$BUILDPDFDOC])
65243f32c10Smrg
6536ef05171SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
65443f32c10SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
65543f32c10SmrgMAKE_PDF="$PS2PDF"
65643f32c10SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
65743f32c10Smrg
65843f32c10SmrgAC_SUBST(MAKE_TEXT)
65943f32c10SmrgAC_SUBST(MAKE_PS)
66043f32c10SmrgAC_SUBST(MAKE_PDF)
66143f32c10SmrgAC_SUBST(MAKE_HTML)
66243f32c10Smrg]) # XORG_CHECK_LINUXDOC
66343f32c10Smrg
66443f32c10Smrg# XORG_CHECK_DOCBOOK
66543f32c10Smrg# -------------------
66643f32c10Smrg# Minimum version: 1.0.0
66743f32c10Smrg#
66843f32c10Smrg# Checks for the ability to build output formats from SGML DocBook source.
66943f32c10Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
67043f32c10Smrg# indicates whether the necessary tools and files are found and, if set,
67143f32c10Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
67243f32c10SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
6736ef05171SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6746ef05171Smrg
67543f32c10SmrgBUILDTXTDOC=no
67643f32c10SmrgBUILDPDFDOC=no
67743f32c10SmrgBUILDPSDOC=no
67843f32c10SmrgBUILDHTMLDOC=no
67943f32c10Smrg
68043f32c10SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
68143f32c10SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
68243f32c10SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
68343f32c10SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
68443f32c10Smrg
6856ef05171SmrgAC_MSG_CHECKING([whether to build text documentation])
6866ef05171Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
68743f32c10Smrg   test x$BUILD_TXTDOC != xno; then
68843f32c10Smrg	BUILDTXTDOC=yes
68943f32c10Smrgfi
69043f32c10SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
69143f32c10SmrgAC_MSG_RESULT([$BUILDTXTDOC])
69243f32c10Smrg
6936ef05171SmrgAC_MSG_CHECKING([whether to build PDF documentation])
6946ef05171Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
69543f32c10Smrg   test x$BUILD_PDFDOC != xno; then
69643f32c10Smrg	BUILDPDFDOC=yes
69743f32c10Smrgfi
69843f32c10SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
69943f32c10SmrgAC_MSG_RESULT([$BUILDPDFDOC])
70043f32c10Smrg
7016ef05171SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
7026ef05171Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
70343f32c10Smrg   test x$BUILD_PSDOC != xno; then
70443f32c10Smrg	BUILDPSDOC=yes
70543f32c10Smrgfi
70643f32c10SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
70743f32c10SmrgAC_MSG_RESULT([$BUILDPSDOC])
70843f32c10Smrg
7096ef05171SmrgAC_MSG_CHECKING([whether to build HTML documentation])
7106ef05171Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
71143f32c10Smrg   test x$BUILD_HTMLDOC != xno; then
71243f32c10Smrg	BUILDHTMLDOC=yes
71343f32c10Smrgfi
71443f32c10SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
71543f32c10SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
71643f32c10Smrg
71743f32c10SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
71843f32c10SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
71943f32c10SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
72043f32c10SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
72143f32c10Smrg
72243f32c10SmrgAC_SUBST(MAKE_TEXT)
72343f32c10SmrgAC_SUBST(MAKE_PS)
72443f32c10SmrgAC_SUBST(MAKE_PDF)
72543f32c10SmrgAC_SUBST(MAKE_HTML)
72643f32c10Smrg]) # XORG_CHECK_DOCBOOK
72743f32c10Smrg
7286ef05171Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
7296ef05171Smrg# ----------------
7306ef05171Smrg# Minimum version: 1.5.0
7316ef05171Smrg# Minimum version for optional DEFAULT argument: 1.11.0
7326ef05171Smrg#
7336ef05171Smrg# Documentation tools are not always available on all platforms and sometimes
7346ef05171Smrg# not at the appropriate level. This macro enables a module to test for the
7356ef05171Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
7366ef05171Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
7376ef05171Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
7386ef05171Smrg# --with-xmlto assumes 'auto'.
7396ef05171Smrg#
7406ef05171Smrg# Interface to module:
7416ef05171Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
7426ef05171Smrg# XMLTO:	returns the path of the xmlto program found
7436ef05171Smrg#		returns the path set by the user in the environment
7446ef05171Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
7456ef05171Smrg#		'no' user instructs the module not to use xmlto
7466ef05171Smrg#
7476ef05171Smrg# Added in version 1.10.0
7486ef05171Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
7496ef05171Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
7506ef05171Smrg#
7516ef05171Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
7526ef05171Smrg#
7536ef05171SmrgAC_DEFUN([XORG_WITH_XMLTO],[
7546ef05171SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
7556ef05171Smrgm4_define([_defopt], m4_default([$2], [auto]))
7566ef05171SmrgAC_ARG_WITH(xmlto,
7576ef05171Smrg	AS_HELP_STRING([--with-xmlto],
7586ef05171Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
7596ef05171Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
7606ef05171Smrgm4_undefine([_defopt])
7616ef05171Smrg
7626ef05171Smrgif test "x$use_xmlto" = x"auto"; then
7636ef05171Smrg   AC_PATH_PROG([XMLTO], [xmlto])
7646ef05171Smrg   if test "x$XMLTO" = "x"; then
7656ef05171Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
7666ef05171Smrg	have_xmlto=no
7676ef05171Smrg   else
7686ef05171Smrg        have_xmlto=yes
7696ef05171Smrg   fi
7706ef05171Smrgelif test "x$use_xmlto" = x"yes" ; then
7716ef05171Smrg   AC_PATH_PROG([XMLTO], [xmlto])
7726ef05171Smrg   if test "x$XMLTO" = "x"; then
7736ef05171Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
7746ef05171Smrg   fi
7756ef05171Smrg   have_xmlto=yes
7766ef05171Smrgelif test "x$use_xmlto" = x"no" ; then
7776ef05171Smrg   if test "x$XMLTO" != "x"; then
7786ef05171Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7796ef05171Smrg   fi
7806ef05171Smrg   have_xmlto=no
7816ef05171Smrgelse
7826ef05171Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7836ef05171Smrgfi
7846ef05171Smrg
7856ef05171Smrg# Test for a minimum version of xmlto, if provided.
7866ef05171Smrgm4_ifval([$1],
7876ef05171Smrg[if test "$have_xmlto" = yes; then
7886ef05171Smrg    # scrape the xmlto version
7896ef05171Smrg    AC_MSG_CHECKING([the xmlto version])
7906ef05171Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7916ef05171Smrg    AC_MSG_RESULT([$xmlto_version])
7926ef05171Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7936ef05171Smrg        [if test "x$use_xmlto" = xauto; then
7946ef05171Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7956ef05171Smrg            have_xmlto=no
7966ef05171Smrg        else
7976ef05171Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7986ef05171Smrg        fi])
7996ef05171Smrgfi])
8006ef05171Smrg
8016ef05171Smrg# Test for the ability of xmlto to generate a text target
802ea148d1dSmrg#
803ea148d1dSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
804ea148d1dSmrg# following test for empty XML docbook files.
805ea148d1dSmrg# For compatibility reasons use the following empty XML docbook file and if
806ea148d1dSmrg# it fails try it again with a non-empty XML file.
8076ef05171Smrghave_xmlto_text=no
8086ef05171Smrgcat > conftest.xml << "EOF"
8096ef05171SmrgEOF
8106ef05171SmrgAS_IF([test "$have_xmlto" = yes],
8116ef05171Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
8126ef05171Smrg             [have_xmlto_text=yes],
813ea148d1dSmrg             [# Try it again with a non-empty XML file.
814ea148d1dSmrg              cat > conftest.xml << "EOF"
815ea148d1dSmrg<x></x>
816ea148d1dSmrgEOF
817ea148d1dSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
818ea148d1dSmrg                    [have_xmlto_text=yes],
819ea148d1dSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
8206ef05171Smrgrm -f conftest.xml
8216ef05171SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
8226ef05171SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
8236ef05171Smrg]) # XORG_WITH_XMLTO
8246ef05171Smrg
8256ef05171Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
8266ef05171Smrg# --------------------------------------------
8276ef05171Smrg# Minimum version: 1.12.0
8286ef05171Smrg# Minimum version for optional DEFAULT argument: 1.12.0
8296ef05171Smrg#
8306ef05171Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
8316ef05171Smrg# XML-based language used for the transformation of XML documents.
8326ef05171Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
8336ef05171Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
8346ef05171Smrg# The XSLT processor is often used as a standalone tool for transformations.
8356ef05171Smrg# It should not be assumed that this tool is used only to work with documnetation.
8366ef05171Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
8376ef05171Smrg#
8386ef05171Smrg# Interface to module:
8396ef05171Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
8406ef05171Smrg# XSLTPROC:	 returns the path of the xsltproc program found
8416ef05171Smrg#		 returns the path set by the user in the environment
8426ef05171Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
8436ef05171Smrg#		  'no' user instructs the module not to use xsltproc
8446ef05171Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
8456ef05171Smrg#
8466ef05171Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
8476ef05171Smrg#
8486ef05171SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
8496ef05171SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
8506ef05171Smrg# Preserves the interface, should it be implemented later
8516ef05171Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
8526ef05171Smrgm4_define([_defopt], m4_default([$2], [auto]))
8536ef05171SmrgAC_ARG_WITH(xsltproc,
8546ef05171Smrg	AS_HELP_STRING([--with-xsltproc],
8556ef05171Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
8566ef05171Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
8576ef05171Smrgm4_undefine([_defopt])
8586ef05171Smrg
8596ef05171Smrgif test "x$use_xsltproc" = x"auto"; then
8606ef05171Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8616ef05171Smrg   if test "x$XSLTPROC" = "x"; then
8626ef05171Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
8636ef05171Smrg	have_xsltproc=no
8646ef05171Smrg   else
8656ef05171Smrg        have_xsltproc=yes
8666ef05171Smrg   fi
8676ef05171Smrgelif test "x$use_xsltproc" = x"yes" ; then
8686ef05171Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8696ef05171Smrg   if test "x$XSLTPROC" = "x"; then
8706ef05171Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
8716ef05171Smrg   fi
8726ef05171Smrg   have_xsltproc=yes
8736ef05171Smrgelif test "x$use_xsltproc" = x"no" ; then
8746ef05171Smrg   if test "x$XSLTPROC" != "x"; then
8756ef05171Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8766ef05171Smrg   fi
8776ef05171Smrg   have_xsltproc=no
8786ef05171Smrgelse
8796ef05171Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8806ef05171Smrgfi
8816ef05171Smrg
8826ef05171SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8836ef05171Smrg]) # XORG_WITH_XSLTPROC
8846ef05171Smrg
8856ef05171Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8866ef05171Smrg# ----------------------------------------
8876ef05171Smrg# Minimum version: 1.15.0
8886ef05171Smrg#
8896ef05171Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
8906ef05171Smrg# scanning arbitrary text files, extracting information from those text files,
8916ef05171Smrg# and printing reports based on that information.
8926ef05171Smrg#
8936ef05171Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8946ef05171Smrg#
8956ef05171Smrg# Interface to module:
8966ef05171Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
8976ef05171Smrg# PERL:	     returns the path of the perl program found
8986ef05171Smrg#	     returns the path set by the user in the environment
8996ef05171Smrg# --with-perl: 'yes' user instructs the module to use perl
9006ef05171Smrg#	       'no' user instructs the module not to use perl
9016ef05171Smrg# have_perl: returns yes if perl found in PATH or no
9026ef05171Smrg#
9036ef05171Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
9046ef05171Smrg#
9056ef05171SmrgAC_DEFUN([XORG_WITH_PERL],[
9066ef05171SmrgAC_ARG_VAR([PERL], [Path to perl command])
9076ef05171Smrg# Preserves the interface, should it be implemented later
9086ef05171Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
9096ef05171Smrgm4_define([_defopt], m4_default([$2], [auto]))
9106ef05171SmrgAC_ARG_WITH(perl,
9116ef05171Smrg	AS_HELP_STRING([--with-perl],
9126ef05171Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
9136ef05171Smrg	   [use_perl=$withval], [use_perl=]_defopt)
9146ef05171Smrgm4_undefine([_defopt])
9156ef05171Smrg
9166ef05171Smrgif test "x$use_perl" = x"auto"; then
9176ef05171Smrg   AC_PATH_PROG([PERL], [perl])
9186ef05171Smrg   if test "x$PERL" = "x"; then
9196ef05171Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
9206ef05171Smrg	have_perl=no
9216ef05171Smrg   else
9226ef05171Smrg        have_perl=yes
9236ef05171Smrg   fi
9246ef05171Smrgelif test "x$use_perl" = x"yes" ; then
9256ef05171Smrg   AC_PATH_PROG([PERL], [perl])
9266ef05171Smrg   if test "x$PERL" = "x"; then
9276ef05171Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
9286ef05171Smrg   fi
9296ef05171Smrg   have_perl=yes
9306ef05171Smrgelif test "x$use_perl" = x"no" ; then
9316ef05171Smrg   if test "x$PERL" != "x"; then
9326ef05171Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
9336ef05171Smrg   fi
9346ef05171Smrg   have_perl=no
9356ef05171Smrgelse
9366ef05171Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
9376ef05171Smrgfi
9386ef05171Smrg
9396ef05171SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
9406ef05171Smrg]) # XORG_WITH_PERL
9416ef05171Smrg
9426ef05171Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
9436ef05171Smrg# ----------------
9446ef05171Smrg# Minimum version: 1.5.0
9456ef05171Smrg# Minimum version for optional DEFAULT argument: 1.11.0
9466ef05171Smrg#
9476ef05171Smrg# Documentation tools are not always available on all platforms and sometimes
9486ef05171Smrg# not at the appropriate level. This macro enables a module to test for the
9496ef05171Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
9506ef05171Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
9516ef05171Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
9526ef05171Smrg# --with-asciidoc assumes 'auto'.
9536ef05171Smrg#
9546ef05171Smrg# Interface to module:
9556ef05171Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
9566ef05171Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
9576ef05171Smrg#		 returns the path set by the user in the environment
9586ef05171Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
9596ef05171Smrg#		  'no' user instructs the module not to use asciidoc
9606ef05171Smrg#
9616ef05171Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
9626ef05171Smrg#
9636ef05171SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
9646ef05171SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
9656ef05171Smrgm4_define([_defopt], m4_default([$2], [auto]))
9666ef05171SmrgAC_ARG_WITH(asciidoc,
9676ef05171Smrg	AS_HELP_STRING([--with-asciidoc],
9686ef05171Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
9696ef05171Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
9706ef05171Smrgm4_undefine([_defopt])
9716ef05171Smrg
9726ef05171Smrgif test "x$use_asciidoc" = x"auto"; then
9736ef05171Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9746ef05171Smrg   if test "x$ASCIIDOC" = "x"; then
9756ef05171Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9766ef05171Smrg	have_asciidoc=no
9776ef05171Smrg   else
9786ef05171Smrg        have_asciidoc=yes
9796ef05171Smrg   fi
9806ef05171Smrgelif test "x$use_asciidoc" = x"yes" ; then
9816ef05171Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9826ef05171Smrg   if test "x$ASCIIDOC" = "x"; then
9836ef05171Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9846ef05171Smrg   fi
9856ef05171Smrg   have_asciidoc=yes
9866ef05171Smrgelif test "x$use_asciidoc" = x"no" ; then
9876ef05171Smrg   if test "x$ASCIIDOC" != "x"; then
9886ef05171Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9896ef05171Smrg   fi
9906ef05171Smrg   have_asciidoc=no
9916ef05171Smrgelse
9926ef05171Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9936ef05171Smrgfi
9946ef05171Smrgm4_ifval([$1],
9956ef05171Smrg[if test "$have_asciidoc" = yes; then
9966ef05171Smrg    # scrape the asciidoc version
9976ef05171Smrg    AC_MSG_CHECKING([the asciidoc version])
9986ef05171Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9996ef05171Smrg    AC_MSG_RESULT([$asciidoc_version])
10006ef05171Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
10016ef05171Smrg        [if test "x$use_asciidoc" = xauto; then
10026ef05171Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
10036ef05171Smrg            have_asciidoc=no
10046ef05171Smrg        else
10056ef05171Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
10066ef05171Smrg        fi])
10076ef05171Smrgfi])
10086ef05171SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
10096ef05171Smrg]) # XORG_WITH_ASCIIDOC
10106ef05171Smrg
10116ef05171Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
10126ef05171Smrg# -------------------------------------------
10136ef05171Smrg# Minimum version: 1.5.0
10146ef05171Smrg# Minimum version for optional DEFAULT argument: 1.11.0
10156ef05171Smrg# Minimum version for optional DOT checking: 1.18.0
10166ef05171Smrg#
10176ef05171Smrg# Documentation tools are not always available on all platforms and sometimes
10186ef05171Smrg# not at the appropriate level. This macro enables a module to test for the
10196ef05171Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
10206ef05171Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
10216ef05171Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
10226ef05171Smrg# --with-doxygen assumes 'auto'.
10236ef05171Smrg#
10246ef05171Smrg# Interface to module:
10256ef05171Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
10266ef05171Smrg# DOXYGEN:	 returns the path of the doxygen program found
10276ef05171Smrg#		 returns the path set by the user in the environment
10286ef05171Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
10296ef05171Smrg#		  'no' user instructs the module not to use doxygen
10306ef05171Smrg#
10316ef05171Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
10326ef05171Smrg#
10336ef05171SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
10346ef05171SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
10356ef05171SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
10366ef05171Smrgm4_define([_defopt], m4_default([$2], [auto]))
10376ef05171SmrgAC_ARG_WITH(doxygen,
10386ef05171Smrg	AS_HELP_STRING([--with-doxygen],
10396ef05171Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
10406ef05171Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
10416ef05171Smrgm4_undefine([_defopt])
10426ef05171Smrg
10436ef05171Smrgif test "x$use_doxygen" = x"auto"; then
10446ef05171Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10456ef05171Smrg   if test "x$DOXYGEN" = "x"; then
10466ef05171Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
10476ef05171Smrg	have_doxygen=no
10486ef05171Smrg   else
10496ef05171Smrg        have_doxygen=yes
10506ef05171Smrg   fi
10516ef05171Smrgelif test "x$use_doxygen" = x"yes" ; then
10526ef05171Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10536ef05171Smrg   if test "x$DOXYGEN" = "x"; then
10546ef05171Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
10556ef05171Smrg   fi
10566ef05171Smrg   have_doxygen=yes
10576ef05171Smrgelif test "x$use_doxygen" = x"no" ; then
10586ef05171Smrg   if test "x$DOXYGEN" != "x"; then
10596ef05171Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
10606ef05171Smrg   fi
10616ef05171Smrg   have_doxygen=no
10626ef05171Smrgelse
10636ef05171Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
10646ef05171Smrgfi
10656ef05171Smrgm4_ifval([$1],
10666ef05171Smrg[if test "$have_doxygen" = yes; then
10676ef05171Smrg    # scrape the doxygen version
10686ef05171Smrg    AC_MSG_CHECKING([the doxygen version])
10696ef05171Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
10706ef05171Smrg    AC_MSG_RESULT([$doxygen_version])
10716ef05171Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
10726ef05171Smrg        [if test "x$use_doxygen" = xauto; then
10736ef05171Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
10746ef05171Smrg            have_doxygen=no
10756ef05171Smrg        else
10766ef05171Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10776ef05171Smrg        fi])
10786ef05171Smrgfi])
10796ef05171Smrg
10806ef05171Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10816ef05171Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10826ef05171Smrgdnl 	HAVE_DOT = @HAVE_DOT@
10836ef05171SmrgHAVE_DOT=no
10846ef05171Smrgif test "x$have_doxygen" = "xyes"; then
10856ef05171Smrg  AC_PATH_PROG([DOT], [dot])
10866ef05171Smrg    if test "x$DOT" != "x"; then
10876ef05171Smrg      HAVE_DOT=yes
10886ef05171Smrg    fi
10896ef05171Smrgfi
10906ef05171Smrg
10916ef05171SmrgAC_SUBST([HAVE_DOT])
10926ef05171SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10936ef05171SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10946ef05171Smrg]) # XORG_WITH_DOXYGEN
10956ef05171Smrg
10966ef05171Smrg# XORG_WITH_GROFF([DEFAULT])
10976ef05171Smrg# ----------------
10986ef05171Smrg# Minimum version: 1.6.0
10996ef05171Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11006ef05171Smrg#
11016ef05171Smrg# Documentation tools are not always available on all platforms and sometimes
11026ef05171Smrg# not at the appropriate level. This macro enables a module to test for the
11036ef05171Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
11046ef05171Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
11056ef05171Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
11066ef05171Smrg# --with-groff assumes 'auto'.
11076ef05171Smrg#
11086ef05171Smrg# Interface to module:
11096ef05171Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
11106ef05171Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
11116ef05171Smrg# HAVE_GROFF_MS: the -ms macros package
11126ef05171Smrg# GROFF:	 returns the path of the groff program found
11136ef05171Smrg#		 returns the path set by the user in the environment
11146ef05171Smrg# --with-groff:	 'yes' user instructs the module to use groff
11156ef05171Smrg#		 'no' user instructs the module not to use groff
11166ef05171Smrg#
11176ef05171Smrg# Added in version 1.9.0:
11186ef05171Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
11196ef05171Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
11206ef05171Smrg#		   psselect from the psutils package.
11216ef05171Smrg#		   the ghostcript package. Refer to the grohtml man pages
11226ef05171Smrg#
11236ef05171Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
11246ef05171Smrg#
11256ef05171Smrg# OS and distros often splits groff in a basic and full package, the former
11266ef05171Smrg# having the groff program and the later having devices, fonts and macros
11276ef05171Smrg# Checking for the groff executable is not enough.
11286ef05171Smrg#
11296ef05171Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
11306ef05171Smrg# unset HAVE_GROFF or GROFF env variables.
11316ef05171Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
11326ef05171Smrg#
11336ef05171SmrgAC_DEFUN([XORG_WITH_GROFF],[
11346ef05171SmrgAC_ARG_VAR([GROFF], [Path to groff command])
11356ef05171Smrgm4_define([_defopt], m4_default([$1], [auto]))
11366ef05171SmrgAC_ARG_WITH(groff,
11376ef05171Smrg	AS_HELP_STRING([--with-groff],
11386ef05171Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
11396ef05171Smrg	   [use_groff=$withval], [use_groff=]_defopt)
11406ef05171Smrgm4_undefine([_defopt])
11416ef05171Smrg
11426ef05171Smrgif test "x$use_groff" = x"auto"; then
11436ef05171Smrg   AC_PATH_PROG([GROFF], [groff])
11446ef05171Smrg   if test "x$GROFF" = "x"; then
11456ef05171Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
11466ef05171Smrg	have_groff=no
11476ef05171Smrg   else
11486ef05171Smrg        have_groff=yes
11496ef05171Smrg   fi
11506ef05171Smrgelif test "x$use_groff" = x"yes" ; then
11516ef05171Smrg   AC_PATH_PROG([GROFF], [groff])
11526ef05171Smrg   if test "x$GROFF" = "x"; then
11536ef05171Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
11546ef05171Smrg   fi
11556ef05171Smrg   have_groff=yes
11566ef05171Smrgelif test "x$use_groff" = x"no" ; then
11576ef05171Smrg   if test "x$GROFF" != "x"; then
11586ef05171Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
11596ef05171Smrg   fi
11606ef05171Smrg   have_groff=no
11616ef05171Smrgelse
11626ef05171Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
11636ef05171Smrgfi
11646ef05171Smrg
11656ef05171Smrg# We have groff, test for the presence of the macro packages
11666ef05171Smrgif test "x$have_groff" = x"yes"; then
11676ef05171Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
11686ef05171Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
11696ef05171Smrg        groff_ms_works=yes
11706ef05171Smrg    else
11716ef05171Smrg        groff_ms_works=no
11726ef05171Smrg    fi
11736ef05171Smrg    AC_MSG_RESULT([$groff_ms_works])
11746ef05171Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11756ef05171Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11766ef05171Smrg        groff_mm_works=yes
11776ef05171Smrg    else
11786ef05171Smrg        groff_mm_works=no
11796ef05171Smrg    fi
11806ef05171Smrg    AC_MSG_RESULT([$groff_mm_works])
11816ef05171Smrgfi
11826ef05171Smrg
11836ef05171Smrg# We have groff, test for HTML dependencies, one command per package
11846ef05171Smrgif test "x$have_groff" = x"yes"; then
11856ef05171Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11866ef05171Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11876ef05171Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11886ef05171Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11896ef05171Smrg      have_groff_html=yes
11906ef05171Smrg   else
11916ef05171Smrg      have_groff_html=no
11926ef05171Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11936ef05171Smrg   fi
11946ef05171Smrgfi
11956ef05171Smrg
11966ef05171Smrg# Set Automake conditionals for Makefiles
11976ef05171SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11986ef05171SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11996ef05171SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
12006ef05171SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
12016ef05171Smrg]) # XORG_WITH_GROFF
12026ef05171Smrg
12036ef05171Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
12046ef05171Smrg# ---------------------------------------
12056ef05171Smrg# Minimum version: 1.6.0
12066ef05171Smrg# Minimum version for optional DEFAULT argument: 1.11.0
12076ef05171Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
12086ef05171Smrg#
12096ef05171Smrg# Documentation tools are not always available on all platforms and sometimes
12106ef05171Smrg# not at the appropriate level. This macro enables a module to test for the
12116ef05171Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
12126ef05171Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
12136ef05171Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
12146ef05171Smrg# --with-fop assumes 'auto'.
12156ef05171Smrg#
12166ef05171Smrg# Interface to module:
12176ef05171Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
12186ef05171Smrg# FOP:	 	returns the path of the fop program found
12196ef05171Smrg#		returns the path set by the user in the environment
12206ef05171Smrg# --with-fop: 	'yes' user instructs the module to use fop
12216ef05171Smrg#		'no' user instructs the module not to use fop
12226ef05171Smrg#
12236ef05171Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
12246ef05171Smrg#
12256ef05171SmrgAC_DEFUN([XORG_WITH_FOP],[
12266ef05171SmrgAC_ARG_VAR([FOP], [Path to fop command])
12276ef05171Smrgm4_define([_defopt], m4_default([$2], [auto]))
12286ef05171SmrgAC_ARG_WITH(fop,
12296ef05171Smrg	AS_HELP_STRING([--with-fop],
12306ef05171Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
12316ef05171Smrg	   [use_fop=$withval], [use_fop=]_defopt)
12326ef05171Smrgm4_undefine([_defopt])
12336ef05171Smrg
12346ef05171Smrgif test "x$use_fop" = x"auto"; then
12356ef05171Smrg   AC_PATH_PROG([FOP], [fop])
12366ef05171Smrg   if test "x$FOP" = "x"; then
12376ef05171Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
12386ef05171Smrg	have_fop=no
12396ef05171Smrg   else
12406ef05171Smrg        have_fop=yes
12416ef05171Smrg   fi
12426ef05171Smrgelif test "x$use_fop" = x"yes" ; then
12436ef05171Smrg   AC_PATH_PROG([FOP], [fop])
12446ef05171Smrg   if test "x$FOP" = "x"; then
12456ef05171Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
12466ef05171Smrg   fi
12476ef05171Smrg   have_fop=yes
12486ef05171Smrgelif test "x$use_fop" = x"no" ; then
12496ef05171Smrg   if test "x$FOP" != "x"; then
12506ef05171Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
12516ef05171Smrg   fi
12526ef05171Smrg   have_fop=no
12536ef05171Smrgelse
12546ef05171Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
12556ef05171Smrgfi
12566ef05171Smrg
12576ef05171Smrg# Test for a minimum version of fop, if provided.
12586ef05171Smrgm4_ifval([$1],
12596ef05171Smrg[if test "$have_fop" = yes; then
12606ef05171Smrg    # scrape the fop version
12616ef05171Smrg    AC_MSG_CHECKING([for fop minimum version])
12626ef05171Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
12636ef05171Smrg    AC_MSG_RESULT([$fop_version])
12646ef05171Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
12656ef05171Smrg        [if test "x$use_fop" = xauto; then
12666ef05171Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
12676ef05171Smrg            have_fop=no
12686ef05171Smrg        else
12696ef05171Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
12706ef05171Smrg        fi])
12716ef05171Smrgfi])
12726ef05171SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
12736ef05171Smrg]) # XORG_WITH_FOP
12746ef05171Smrg
12756ef05171Smrg# XORG_WITH_M4([MIN-VERSION])
12766ef05171Smrg# ---------------------------
12776ef05171Smrg# Minimum version: 1.19.0
12786ef05171Smrg#
12796ef05171Smrg# This macro attempts to locate an m4 macro processor which supports
12806ef05171Smrg# -I option and is only useful for modules relying on M4 in order to
12816ef05171Smrg# expand macros in source code files.
12826ef05171Smrg#
12836ef05171Smrg# Interface to module:
12846ef05171Smrg# M4:	 	returns the path of the m4 program found
12856ef05171Smrg#		returns the path set by the user in the environment
12866ef05171Smrg#
12876ef05171SmrgAC_DEFUN([XORG_WITH_M4], [
12886ef05171SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12896ef05171Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12906ef05171Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12916ef05171Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12926ef05171Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12936ef05171Smrg   [$PATH:/usr/gnu/bin])])
12946ef05171Smrg
12956ef05171SmrgAC_SUBST([M4], [$ac_cv_path_M4])
12966ef05171Smrg]) # XORG_WITH_M4
12976ef05171Smrg
12986ef05171Smrg# XORG_WITH_PS2PDF([DEFAULT])
12996ef05171Smrg# ----------------
13006ef05171Smrg# Minimum version: 1.6.0
13016ef05171Smrg# Minimum version for optional DEFAULT argument: 1.11.0
13026ef05171Smrg#
13036ef05171Smrg# Documentation tools are not always available on all platforms and sometimes
13046ef05171Smrg# not at the appropriate level. This macro enables a module to test for the
13056ef05171Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
13066ef05171Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
13076ef05171Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
13086ef05171Smrg# --with-ps2pdf assumes 'auto'.
13096ef05171Smrg#
13106ef05171Smrg# Interface to module:
13116ef05171Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
13126ef05171Smrg# PS2PDF:	returns the path of the ps2pdf program found
13136ef05171Smrg#		returns the path set by the user in the environment
13146ef05171Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
13156ef05171Smrg#		 'no' user instructs the module not to use ps2pdf
13166ef05171Smrg#
13176ef05171Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
13186ef05171Smrg#
13196ef05171SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
13206ef05171SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
13216ef05171Smrgm4_define([_defopt], m4_default([$1], [auto]))
13226ef05171SmrgAC_ARG_WITH(ps2pdf,
13236ef05171Smrg	AS_HELP_STRING([--with-ps2pdf],
13246ef05171Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
13256ef05171Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
13266ef05171Smrgm4_undefine([_defopt])
13276ef05171Smrg
13286ef05171Smrgif test "x$use_ps2pdf" = x"auto"; then
13296ef05171Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13306ef05171Smrg   if test "x$PS2PDF" = "x"; then
13316ef05171Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
13326ef05171Smrg	have_ps2pdf=no
13336ef05171Smrg   else
13346ef05171Smrg        have_ps2pdf=yes
13356ef05171Smrg   fi
13366ef05171Smrgelif test "x$use_ps2pdf" = x"yes" ; then
13376ef05171Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13386ef05171Smrg   if test "x$PS2PDF" = "x"; then
13396ef05171Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
13406ef05171Smrg   fi
13416ef05171Smrg   have_ps2pdf=yes
13426ef05171Smrgelif test "x$use_ps2pdf" = x"no" ; then
13436ef05171Smrg   if test "x$PS2PDF" != "x"; then
13446ef05171Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
13456ef05171Smrg   fi
13466ef05171Smrg   have_ps2pdf=no
13476ef05171Smrgelse
13486ef05171Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
13496ef05171Smrgfi
13506ef05171SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
13516ef05171Smrg]) # XORG_WITH_PS2PDF
13526ef05171Smrg
13536ef05171Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
13546ef05171Smrg# ----------------
13556ef05171Smrg# Minimum version: 1.6.0
13566ef05171Smrg#
13576ef05171Smrg# Documentation tools are not always available on all platforms and sometimes
13586ef05171Smrg# not at the appropriate level. This macro enables a builder to skip all
13596ef05171Smrg# documentation targets except traditional man pages.
13606ef05171Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13616ef05171Smrg# maximum flexibilty in controlling documentation building.
13626ef05171Smrg# Refer to:
13636ef05171Smrg# XORG_WITH_XMLTO         --with-xmlto
13646ef05171Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13656ef05171Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13666ef05171Smrg# XORG_WITH_FOP           --with-fop
13676ef05171Smrg# XORG_WITH_GROFF         --with-groff
13686ef05171Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13696ef05171Smrg#
13706ef05171Smrg# Interface to module:
13716ef05171Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
13726ef05171Smrg# --enable-docs: 'yes' user instructs the module to generate docs
13736ef05171Smrg#		 'no' user instructs the module not to generate docs
13746ef05171Smrg# parm1:	specify the default value, yes or no.
13756ef05171Smrg#
13766ef05171SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13776ef05171Smrgm4_define([docs_default], m4_default([$1], [yes]))
13786ef05171SmrgAC_ARG_ENABLE(docs,
13796ef05171Smrg	AS_HELP_STRING([--enable-docs],
13806ef05171Smrg	   [Enable building the documentation (default: ]docs_default[)]),
13816ef05171Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
13826ef05171Smrgm4_undefine([docs_default])
13836ef05171SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13846ef05171SmrgAC_MSG_CHECKING([whether to build documentation])
13856ef05171SmrgAC_MSG_RESULT([$build_docs])
13866ef05171Smrg]) # XORG_ENABLE_DOCS
13876ef05171Smrg
13886ef05171Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13896ef05171Smrg# ----------------
13906ef05171Smrg# Minimum version: 1.6.0
13916ef05171Smrg#
13926ef05171Smrg# This macro enables a builder to skip all developer documentation.
13936ef05171Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13946ef05171Smrg# maximum flexibilty in controlling documentation building.
13956ef05171Smrg# Refer to:
13966ef05171Smrg# XORG_WITH_XMLTO         --with-xmlto
13976ef05171Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13986ef05171Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13996ef05171Smrg# XORG_WITH_FOP           --with-fop
14006ef05171Smrg# XORG_WITH_GROFF         --with-groff
14016ef05171Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
14026ef05171Smrg#
14036ef05171Smrg# Interface to module:
14046ef05171Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
14056ef05171Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
14066ef05171Smrg#			'no' user instructs the module not to generate developer docs
14076ef05171Smrg# parm1:		specify the default value, yes or no.
14086ef05171Smrg#
14096ef05171SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
14106ef05171Smrgm4_define([devel_default], m4_default([$1], [yes]))
14116ef05171SmrgAC_ARG_ENABLE(devel-docs,
14126ef05171Smrg	AS_HELP_STRING([--enable-devel-docs],
14136ef05171Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
14146ef05171Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
14156ef05171Smrgm4_undefine([devel_default])
14166ef05171SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
14176ef05171SmrgAC_MSG_CHECKING([whether to build developer documentation])
14186ef05171SmrgAC_MSG_RESULT([$build_devel_docs])
14196ef05171Smrg]) # XORG_ENABLE_DEVEL_DOCS
14206ef05171Smrg
14216ef05171Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
14226ef05171Smrg# ----------------
14236ef05171Smrg# Minimum version: 1.6.0
14246ef05171Smrg#
14256ef05171Smrg# This macro enables a builder to skip all functional specification targets.
14266ef05171Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
14276ef05171Smrg# maximum flexibilty in controlling documentation building.
14286ef05171Smrg# Refer to:
14296ef05171Smrg# XORG_WITH_XMLTO         --with-xmlto
14306ef05171Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
14316ef05171Smrg# XORG_WITH_DOXYGEN       --with-doxygen
14326ef05171Smrg# XORG_WITH_FOP           --with-fop
14336ef05171Smrg# XORG_WITH_GROFF         --with-groff
14346ef05171Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
14356ef05171Smrg#
14366ef05171Smrg# Interface to module:
14376ef05171Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
14386ef05171Smrg# --enable-specs:	'yes' user instructs the module to generate specs
14396ef05171Smrg#			'no' user instructs the module not to generate specs
14406ef05171Smrg# parm1:		specify the default value, yes or no.
14416ef05171Smrg#
14426ef05171SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
14436ef05171Smrgm4_define([spec_default], m4_default([$1], [yes]))
14446ef05171SmrgAC_ARG_ENABLE(specs,
14456ef05171Smrg	AS_HELP_STRING([--enable-specs],
14466ef05171Smrg	   [Enable building the specs (default: ]spec_default[)]),
14476ef05171Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
14486ef05171Smrgm4_undefine([spec_default])
14496ef05171SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
14506ef05171SmrgAC_MSG_CHECKING([whether to build functional specifications])
14516ef05171SmrgAC_MSG_RESULT([$build_specs])
14526ef05171Smrg]) # XORG_ENABLE_SPECS
14536ef05171Smrg
14546ef05171Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
14556ef05171Smrg# ----------------------------------------------
14566ef05171Smrg# Minimum version: 1.13.0
14576ef05171Smrg#
14586ef05171Smrg# This macro enables a builder to enable/disable unit testing
14596ef05171Smrg# It makes no assumption about the test cases implementation
14606ef05171Smrg# Test cases may or may not use Automake "Support for test suites"
14616ef05171Smrg# They may or may not use the software utility library GLib
14626ef05171Smrg#
14636ef05171Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
14646ef05171Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
14656ef05171Smrg# The variable enable_unit_tests is used by other macros in this file.
14666ef05171Smrg#
14676ef05171Smrg# Interface to module:
14686ef05171Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
14696ef05171Smrg# enable_unit_tests:    used in configure.ac for additional configuration
14706ef05171Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
14716ef05171Smrg#			'no' user instructs the module not to build tests
14726ef05171Smrg# parm1:		specify the default value, yes or no.
14736ef05171Smrg#
14746ef05171SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14756ef05171SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14766ef05171SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14776ef05171SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14786ef05171Smrgm4_define([_defopt], m4_default([$1], [auto]))
14796ef05171SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14806ef05171Smrg	[Enable building unit test cases (default: ]_defopt[)]),
14816ef05171Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14826ef05171Smrgm4_undefine([_defopt])
14836ef05171SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14846ef05171SmrgAC_MSG_CHECKING([whether to build unit test cases])
14856ef05171SmrgAC_MSG_RESULT([$enable_unit_tests])
14866ef05171Smrg]) # XORG_ENABLE_UNIT_TESTS
14876ef05171Smrg
14886ef05171Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14896ef05171Smrg# ------------------------------------------------------
14906ef05171Smrg# Minimum version: 1.17.0
14916ef05171Smrg#
14926ef05171Smrg# This macro enables a builder to enable/disable integration testing
14936ef05171Smrg# It makes no assumption about the test cases' implementation
14946ef05171Smrg# Test cases may or may not use Automake "Support for test suites"
14956ef05171Smrg#
14966ef05171Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14976ef05171Smrg# usually requires less dependencies and may be built and run under less
14986ef05171Smrg# stringent environments than integration tests.
14996ef05171Smrg#
15006ef05171Smrg# Interface to module:
15016ef05171Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
15026ef05171Smrg# enable_integration_tests:   used in configure.ac for additional configuration
15036ef05171Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
15046ef05171Smrg#                             'no' user instructs the module not to build tests
15056ef05171Smrg# parm1:                      specify the default value, yes or no.
15066ef05171Smrg#
15076ef05171SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
15086ef05171SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
15096ef05171Smrgm4_define([_defopt], m4_default([$1], [auto]))
15106ef05171SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
15116ef05171Smrg	[Enable building integration test cases (default: ]_defopt[)]),
15126ef05171Smrg	[enable_integration_tests=$enableval],
15136ef05171Smrg	[enable_integration_tests=]_defopt)
15146ef05171Smrgm4_undefine([_defopt])
15156ef05171SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
15166ef05171Smrg	[test "x$enable_integration_tests" != xno])
15176ef05171SmrgAC_MSG_CHECKING([whether to build unit test cases])
15186ef05171SmrgAC_MSG_RESULT([$enable_integration_tests])
15196ef05171Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
15206ef05171Smrg
15216ef05171Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
15226ef05171Smrg# ----------------------------------------
15236ef05171Smrg# Minimum version: 1.13.0
15246ef05171Smrg#
15256ef05171Smrg# GLib is a library which provides advanced data structures and functions.
15266ef05171Smrg# This macro enables a module to test for the presence of Glib.
15276ef05171Smrg#
15286ef05171Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
15296ef05171Smrg# Otherwise the value of $enable_unit_tests is blank.
15306ef05171Smrg#
15316ef05171Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
15326ef05171Smrg# test support usually requires less dependencies and may be built and run under
15336ef05171Smrg# less stringent environments than integration tests.
15346ef05171Smrg#
15356ef05171Smrg# Interface to module:
15366ef05171Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
15376ef05171Smrg# with_glib: used in configure.ac to know if GLib has been found
15386ef05171Smrg# --with-glib:	'yes' user instructs the module to use glib
15396ef05171Smrg#		'no' user instructs the module not to use glib
15406ef05171Smrg#
15416ef05171SmrgAC_DEFUN([XORG_WITH_GLIB],[
15426ef05171SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
15436ef05171Smrgm4_define([_defopt], m4_default([$2], [auto]))
15446ef05171SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
15456ef05171Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
15466ef05171Smrg	[with_glib=$withval], [with_glib=]_defopt)
15476ef05171Smrgm4_undefine([_defopt])
15486ef05171Smrg
15496ef05171Smrghave_glib=no
15506ef05171Smrg# Do not probe GLib if user explicitly disabled unit testing
15516ef05171Smrgif test "x$enable_unit_tests" != x"no"; then
15526ef05171Smrg  # Do not probe GLib if user explicitly disabled it
15536ef05171Smrg  if test "x$with_glib" != x"no"; then
15546ef05171Smrg    m4_ifval(
15556ef05171Smrg      [$1],
15566ef05171Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
15576ef05171Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
15586ef05171Smrg    )
15596ef05171Smrg  fi
15606ef05171Smrgfi
15616ef05171Smrg
15626ef05171Smrg# Not having GLib when unit testing has been explicitly requested is an error
15636ef05171Smrgif test "x$enable_unit_tests" = x"yes"; then
15646ef05171Smrg  if test "x$have_glib" = x"no"; then
15656ef05171Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15666ef05171Smrg  fi
15676ef05171Smrgfi
15686ef05171Smrg
15696ef05171Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
15706ef05171Smrgif test "x$enable_unit_tests" = x"no"; then
15716ef05171Smrg  if test "x$with_glib" = x"yes"; then
15726ef05171Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15736ef05171Smrg  fi
15746ef05171Smrgfi
15756ef05171Smrg
15766ef05171Smrg# Not having GLib when it has been explicitly requested is an error
15776ef05171Smrgif test "x$with_glib" = x"yes"; then
15786ef05171Smrg  if test "x$have_glib" = x"no"; then
15796ef05171Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15806ef05171Smrg  fi
15816ef05171Smrgfi
15826ef05171Smrg
15836ef05171SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15846ef05171Smrg]) # XORG_WITH_GLIB
15856ef05171Smrg
15866ef05171Smrg# XORG_LD_WRAP([required|optional])
15876ef05171Smrg# ---------------------------------
15886ef05171Smrg# Minimum version: 1.13.0
15896ef05171Smrg#
15906ef05171Smrg# Check if linker supports -wrap, passed via compiler flags
15916ef05171Smrg#
15926ef05171Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15936ef05171Smrg# Otherwise the value of $enable_unit_tests is blank.
15946ef05171Smrg#
15956ef05171Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15966ef05171Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15976ef05171Smrg# available, an argument of "optional" allows use when some unit tests require
15986ef05171Smrg# ld -wrap and others do not.
15996ef05171Smrg#
16006ef05171SmrgAC_DEFUN([XORG_LD_WRAP],[
16016ef05171SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
16026ef05171Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
16036ef05171Smrg                      void __wrap_exit(int status) { return; }],
16046ef05171Smrg                     [exit(0);])])
16056ef05171Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
16066ef05171Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
16076ef05171Smrg  if test "x$have_ld_wrap" = x"no"; then
16086ef05171Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
16096ef05171Smrg  fi
16106ef05171Smrgfi
16116ef05171SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
16126ef05171Smrg#
16136ef05171Smrg]) # XORG_LD_WRAP
16146ef05171Smrg
16156ef05171Smrg# XORG_CHECK_LINKER_FLAGS
16166ef05171Smrg# -----------------------
16176ef05171Smrg# SYNOPSIS
16186ef05171Smrg#
16196ef05171Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
16206ef05171Smrg#
16216ef05171Smrg# DESCRIPTION
16226ef05171Smrg#
16236ef05171Smrg#   Check whether the given linker FLAGS work with the current language's
16246ef05171Smrg#   linker, or whether they give an error.
16256ef05171Smrg#
16266ef05171Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
16276ef05171Smrg#   success/failure.
16286ef05171Smrg#
16296ef05171Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
16306ef05171Smrg#
16316ef05171Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
16326ef05171Smrg#
16336ef05171Smrg# LICENSE
16346ef05171Smrg#
16356ef05171Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
16366ef05171Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
16376ef05171Smrg#   Copyright (c) 2009 Matteo Frigo
16386ef05171Smrg#
16396ef05171Smrg#   This program is free software: you can redistribute it and/or modify it
16406ef05171Smrg#   under the terms of the GNU General Public License as published by the
16416ef05171Smrg#   Free Software Foundation, either version 3 of the License, or (at your
16426ef05171Smrg#   option) any later version.
16436ef05171Smrg#
16446ef05171Smrg#   This program is distributed in the hope that it will be useful, but
16456ef05171Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
16466ef05171Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16476ef05171Smrg#   Public License for more details.
16486ef05171Smrg#
16496ef05171Smrg#   You should have received a copy of the GNU General Public License along
16506ef05171Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
16516ef05171Smrg#
16526ef05171Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
16536ef05171Smrg#   gives unlimited permission to copy, distribute and modify the configure
16546ef05171Smrg#   scripts that are the output of Autoconf when processing the Macro. You
16556ef05171Smrg#   need not follow the terms of the GNU General Public License when using
16566ef05171Smrg#   or distributing such scripts, even though portions of the text of the
16576ef05171Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
16586ef05171Smrg#   all other use of the material that constitutes the Autoconf Macro.
16596ef05171Smrg#
16606ef05171Smrg#   This special exception to the GPL applies to versions of the Autoconf
16616ef05171Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
16626ef05171Smrg#   modified version of the Autoconf Macro, you may extend this special
16636ef05171Smrg#   exception to the GPL to apply to your modified version as well.#
16646ef05171SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
16656ef05171Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
16666ef05171Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
16676ef05171SmrgAS_LITERAL_IF([$1],
16686ef05171Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
16696ef05171Smrg      ax_save_FLAGS=$LDFLAGS
16706ef05171Smrg      LDFLAGS="$1"
16716ef05171Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
16726ef05171Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16736ef05171Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16746ef05171Smrg      LDFLAGS=$ax_save_FLAGS])],
16756ef05171Smrg  [ax_save_FLAGS=$LDFLAGS
16766ef05171Smrg   LDFLAGS="$1"
16776ef05171Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16786ef05171Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16796ef05171Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16806ef05171Smrg   LDFLAGS=$ax_save_FLAGS])
16816ef05171Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16826ef05171SmrgAC_MSG_RESULT($xorg_check_linker_flags)
16836ef05171Smrgif test "x$xorg_check_linker_flags" = xyes; then
16846ef05171Smrg	m4_default([$2], :)
16856ef05171Smrgelse
16866ef05171Smrg	m4_default([$3], :)
16876ef05171Smrgfi
16886ef05171Smrg]) # XORG_CHECK_LINKER_FLAGS
16896ef05171Smrg
16906ef05171Smrg# XORG_MEMORY_CHECK_FLAGS
16916ef05171Smrg# -----------------------
16926ef05171Smrg# Minimum version: 1.16.0
16936ef05171Smrg#
16946ef05171Smrg# This macro attempts to find appropriate memory checking functionality
16956ef05171Smrg# for various platforms which unit testing code may use to catch various
16966ef05171Smrg# forms of memory allocation and access errors in testing.
16976ef05171Smrg#
16986ef05171Smrg# Interface to module:
16996ef05171Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
17006ef05171Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
17016ef05171Smrg#
17026ef05171Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
17036ef05171Smrg#
17046ef05171SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
17056ef05171Smrg
17066ef05171SmrgAC_REQUIRE([AC_CANONICAL_HOST])
17076ef05171SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
17086ef05171Smrg           [Environment variables to enable memory checking in tests])
17096ef05171Smrg
17106ef05171Smrg# Check for different types of support on different platforms
17116ef05171Smrgcase $host_os in
17126ef05171Smrg    solaris*)
17136ef05171Smrg        AC_CHECK_LIB([umem], [umem_alloc],
17146ef05171Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
17156ef05171Smrg        ;;
17166ef05171Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
17176ef05171Smrg        # both directly and inverted, so should not be 0 or 255.
17186ef05171Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
17196ef05171Smrg        ;;
17206ef05171Smrg    darwin*)
17216ef05171Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
17226ef05171Smrg        ;;
17236ef05171Smrg    *bsd*)
17246ef05171Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
17256ef05171Smrg        ;;
17266ef05171Smrgesac
17276ef05171Smrg
17286ef05171Smrg# User supplied flags override default flags
17296ef05171Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
17306ef05171Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
17316ef05171Smrgfi
17326ef05171Smrg
17336ef05171SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
17346ef05171Smrg]) # XORG_WITH_LINT
17356ef05171Smrg
173643f32c10Smrg# XORG_CHECK_MALLOC_ZERO
173743f32c10Smrg# ----------------------
173843f32c10Smrg# Minimum version: 1.0.0
173943f32c10Smrg#
174043f32c10Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
174143f32c10Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
174243f32c10Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
174343f32c10SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
174443f32c10SmrgAC_ARG_ENABLE(malloc0returnsnull,
17456ef05171Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
174643f32c10Smrg		       [malloc(0) returns NULL (default: auto)]),
174743f32c10Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
174843f32c10Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
174943f32c10Smrg
175043f32c10SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
175143f32c10Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
17526ef05171SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
17536ef05171Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
17546ef05171Smrg#include <stdlib.h>
17556ef05171Smrg],[
175643f32c10Smrg    char *m0, *r0, *c0, *p;
175743f32c10Smrg    m0 = malloc(0);
175843f32c10Smrg    p = malloc(10);
175943f32c10Smrg    r0 = realloc(p,0);
17606ef05171Smrg    c0 = calloc(0,10);
17616ef05171Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
17626ef05171Smrg])],
17636ef05171Smrg		[xorg_cv_malloc0_returns_null=yes],
17646ef05171Smrg		[xorg_cv_malloc0_returns_null=no])])
17656ef05171SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
176643f32c10Smrgfi
176743f32c10SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
176843f32c10Smrg
176943f32c10Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
177043f32c10Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
177143f32c10Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
177243f32c10Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
177343f32c10Smrgelse
177443f32c10Smrg	MALLOC_ZERO_CFLAGS=""
177543f32c10Smrg	XMALLOC_ZERO_CFLAGS=""
177643f32c10Smrg	XTMALLOC_ZERO_CFLAGS=""
177743f32c10Smrgfi
177843f32c10Smrg
177943f32c10SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
178043f32c10SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
178143f32c10SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
178243f32c10Smrg]) # XORG_CHECK_MALLOC_ZERO
178343f32c10Smrg
178443f32c10Smrg# XORG_WITH_LINT()
178543f32c10Smrg# ----------------
178643f32c10Smrg# Minimum version: 1.1.0
178743f32c10Smrg#
17886ef05171Smrg# This macro enables the use of a tool that flags some suspicious and
17896ef05171Smrg# non-portable constructs (likely to be bugs) in C language source code.
17906ef05171Smrg# It will attempt to locate the tool and use appropriate options.
17916ef05171Smrg# There are various lint type tools on different platforms.
17926ef05171Smrg#
17936ef05171Smrg# Interface to module:
17946ef05171Smrg# LINT:		returns the path to the tool found on the platform
17956ef05171Smrg#		or the value set to LINT on the configure cmd line
17966ef05171Smrg#		also an Automake conditional
17976ef05171Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
17986ef05171Smrg#
17996ef05171Smrg# --with-lint:	'yes' user instructs the module to use lint
18006ef05171Smrg#		'no' user instructs the module not to use lint (default)
18016ef05171Smrg#
18026ef05171Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
18036ef05171Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
180443f32c10Smrg#
180543f32c10SmrgAC_DEFUN([XORG_WITH_LINT],[
180643f32c10Smrg
18076ef05171SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
18086ef05171SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
18096ef05171SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
181043f32c10Smrg		[Use a lint-style source code checker (default: disabled)])],
181143f32c10Smrg		[use_lint=$withval], [use_lint=no])
18126ef05171Smrg
18136ef05171Smrg# Obtain platform specific info like program name and options
18146ef05171Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
18156ef05171Smrgcase $host_os in
18166ef05171Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
18176ef05171Smrg	lint_name=splint
18186ef05171Smrg	lint_options="-badflag"
18196ef05171Smrg	;;
18206ef05171Smrg  *freebsd* | *netbsd*)
18216ef05171Smrg	lint_name=lint
18226ef05171Smrg	lint_options="-u -b"
18236ef05171Smrg	;;
18246ef05171Smrg  *solaris*)
18256ef05171Smrg	lint_name=lint
18266ef05171Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
18276ef05171Smrg	;;
18286ef05171Smrgesac
18296ef05171Smrg
18306ef05171Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
18316ef05171Smrgif test "x$use_lint" = x"yes" ; then
18326ef05171Smrg   AC_PATH_PROG([LINT], [$lint_name])
18336ef05171Smrg   if test "x$LINT" = "x"; then
18346ef05171Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
18356ef05171Smrg   fi
18366ef05171Smrgelif test "x$use_lint" = x"no" ; then
18376ef05171Smrg   if test "x$LINT" != "x"; then
18386ef05171Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
18396ef05171Smrg   fi
184043f32c10Smrgelse
18416ef05171Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
18426ef05171Smrgfi
18436ef05171Smrg
18446ef05171Smrg# User supplied flags override default flags
18456ef05171Smrgif test "x$LINT_FLAGS" != "x"; then
18466ef05171Smrg   lint_options=$LINT_FLAGS
184743f32c10Smrgfi
184843f32c10Smrg
18496ef05171SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
18506ef05171SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
185143f32c10Smrg
185243f32c10Smrg]) # XORG_WITH_LINT
185343f32c10Smrg
185443f32c10Smrg# XORG_LINT_LIBRARY(LIBNAME)
185543f32c10Smrg# --------------------------
185643f32c10Smrg# Minimum version: 1.1.0
185743f32c10Smrg#
185843f32c10Smrg# Sets up flags for building lint libraries for checking programs that call
185943f32c10Smrg# functions in the library.
186043f32c10Smrg#
18616ef05171Smrg# Interface to module:
18626ef05171Smrg# LINTLIB		- Automake variable with the name of lint library file to make
18636ef05171Smrg# MAKE_LINT_LIB		- Automake conditional
18646ef05171Smrg#
18656ef05171Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
18666ef05171Smrg#			  - 'no' user instructs the module not to create a lint library (default)
186743f32c10Smrg
186843f32c10SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
186943f32c10SmrgAC_REQUIRE([XORG_WITH_LINT])
18706ef05171SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
187143f32c10Smrg	[Create lint library (default: disabled)])],
187243f32c10Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
18736ef05171Smrg
18746ef05171Smrgif test "x$make_lint_lib" = x"yes" ; then
18756ef05171Smrg   LINTLIB=llib-l$1.ln
18766ef05171Smrg   if test "x$LINT" = "x"; then
18776ef05171Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18786ef05171Smrg   fi
18796ef05171Smrgelif test "x$make_lint_lib" != x"no" ; then
18806ef05171Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
188143f32c10Smrgfi
18826ef05171Smrg
188343f32c10SmrgAC_SUBST(LINTLIB)
188443f32c10SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
188543f32c10Smrg
188643f32c10Smrg]) # XORG_LINT_LIBRARY
188743f32c10Smrg
18886ef05171Smrg# XORG_COMPILER_BRAND
18896ef05171Smrg# -------------------
18906ef05171Smrg# Minimum version: 1.14.0
18916ef05171Smrg#
18926ef05171Smrg# Checks for various brands of compilers and sets flags as appropriate:
18936ef05171Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18946ef05171Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18956ef05171Smrg#   clang compiler - sets CLANGCC to "yes"
18966ef05171Smrg#   Intel compiler - sets INTELCC to "yes"
18976ef05171Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18986ef05171Smrg#
18996ef05171SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
19006ef05171SmrgAC_LANG_CASE(
19016ef05171Smrg	[C], [
19026ef05171Smrg		AC_REQUIRE([AC_PROG_CC_C99])
19036ef05171Smrg	],
19046ef05171Smrg	[C++], [
19056ef05171Smrg		AC_REQUIRE([AC_PROG_CXX])
19066ef05171Smrg	]
19076ef05171Smrg)
19086ef05171SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
19096ef05171SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
19106ef05171SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
19116ef05171Smrg]) # XORG_COMPILER_BRAND
19126ef05171Smrg
19136ef05171Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
19146ef05171Smrg# ---------------
19156ef05171Smrg# Minimum version: 1.16.0
19166ef05171Smrg#
19176ef05171Smrg# Test if the compiler works when passed the given flag as a command line argument.
19186ef05171Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
19196ef05171Smrg# next flag in the list until there are no more options.
19206ef05171Smrg#
19216ef05171Smrg# Note that this does not guarantee that the compiler supports the flag as some
19226ef05171Smrg# compilers will simply ignore arguments that they do not understand, but we do
19236ef05171Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
19246ef05171Smrg# -Werror=unused-command-line-argument
19256ef05171Smrg#
19266ef05171SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
19276ef05171Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19286ef05171Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19296ef05171Smrg
19306ef05171SmrgAC_LANG_COMPILER_REQUIRE
19316ef05171Smrg
19326ef05171SmrgAC_LANG_CASE(
19336ef05171Smrg	[C], [
19346ef05171Smrg		AC_REQUIRE([AC_PROG_CC_C99])
19356ef05171Smrg		define([PREFIX], [C])
19366ef05171Smrg		define([CACHE_PREFIX], [cc])
19376ef05171Smrg		define([COMPILER], [$CC])
19386ef05171Smrg	],
19396ef05171Smrg	[C++], [
19406ef05171Smrg		define([PREFIX], [CXX])
19416ef05171Smrg		define([CACHE_PREFIX], [cxx])
19426ef05171Smrg		define([COMPILER], [$CXX])
19436ef05171Smrg	]
19446ef05171Smrg)
19456ef05171Smrg
19466ef05171Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
19476ef05171Smrg
19486ef05171Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
19496ef05171Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19506ef05171Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
19516ef05171Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
19526ef05171Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19536ef05171Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
19546ef05171Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
19556ef05171Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
19566ef05171Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19576ef05171Smrgfi
19586ef05171Smrg
19596ef05171Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
19606ef05171Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
19616ef05171Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19626ef05171Smrg	fi
19636ef05171Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19646ef05171Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
19656ef05171Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
19666ef05171Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19676ef05171Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
19686ef05171Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
19696ef05171Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
19706ef05171Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19716ef05171Smrgfi
19726ef05171Smrg
19736ef05171Smrgfound="no"
19746ef05171Smrgm4_foreach([flag], m4_cdr($@), [
19756ef05171Smrg	if test $found = "no" ; then
19766ef05171Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19776ef05171Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19786ef05171Smrg		fi
19796ef05171Smrg
19806ef05171Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19816ef05171Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19826ef05171Smrg		fi
19836ef05171Smrg
19846ef05171Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19856ef05171Smrg
19866ef05171Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19876ef05171Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19886ef05171Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19896ef05171Smrg		AC_CACHE_VAL($cacheid,
19906ef05171Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19916ef05171Smrg					     [eval $cacheid=yes],
19926ef05171Smrg					     [eval $cacheid=no])])
19936ef05171Smrg
19946ef05171Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19956ef05171Smrg
19966ef05171Smrg		eval supported=\$$cacheid
19976ef05171Smrg		AC_MSG_RESULT([$supported])
19986ef05171Smrg		if test "$supported" = "yes" ; then
19996ef05171Smrg			$1="$$1 ]flag["
20006ef05171Smrg			found="yes"
20016ef05171Smrg		fi
20026ef05171Smrg	fi
20036ef05171Smrg])
20046ef05171Smrg]) # XORG_TESTSET_CFLAG
20056ef05171Smrg
20066ef05171Smrg# XORG_COMPILER_FLAGS
20076ef05171Smrg# ---------------
20086ef05171Smrg# Minimum version: 1.16.0
20096ef05171Smrg#
20106ef05171Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
20116ef05171Smrg# arguments supported by the selected compiler which do NOT alter the generated
20126ef05171Smrg# code.  These arguments will cause the compiler to print various warnings
20136ef05171Smrg# during compilation AND turn a conservative set of warnings into errors.
20146ef05171Smrg#
20156ef05171Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
20166ef05171Smrg# future versions of util-macros as options are added to new compilers.
20176ef05171Smrg#
20186ef05171SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
20196ef05171SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
20206ef05171Smrg
20216ef05171SmrgAC_ARG_ENABLE(selective-werror,
20226ef05171Smrg              AS_HELP_STRING([--disable-selective-werror],
20236ef05171Smrg                             [Turn off selective compiler errors. (default: enabled)]),
20246ef05171Smrg              [SELECTIVE_WERROR=$enableval],
20256ef05171Smrg              [SELECTIVE_WERROR=yes])
20266ef05171Smrg
20276ef05171SmrgAC_LANG_CASE(
20286ef05171Smrg        [C], [
20296ef05171Smrg                define([PREFIX], [C])
20306ef05171Smrg        ],
20316ef05171Smrg        [C++], [
20326ef05171Smrg                define([PREFIX], [CXX])
20336ef05171Smrg        ]
20346ef05171Smrg)
20356ef05171Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
20366ef05171Smrgif test "x$SUNCC" = "xyes"; then
20376ef05171Smrg    [BASE_]PREFIX[FLAGS]="-v"
20386ef05171Smrgelse
20396ef05171Smrg    [BASE_]PREFIX[FLAGS]=""
20406ef05171Smrgfi
20416ef05171Smrg
20426ef05171Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
20436ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
20446ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
20456ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
20466ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
20476ef05171Smrg
20486ef05171SmrgAC_LANG_CASE(
20496ef05171Smrg	[C], [
20506ef05171Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
20516ef05171Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
20526ef05171Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
20536ef05171Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
20546ef05171Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
20556ef05171Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
20566ef05171Smrg	]
20576ef05171Smrg)
20586ef05171Smrg
20596ef05171Smrg# This chunk adds additional warnings that could catch undesired effects.
20606ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
20616ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
20626ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
20636ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
20646ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
20656ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
20666ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
20676ef05171Smrg
20686ef05171Smrg# These are currently disabled because they are noisy.  They will be enabled
20696ef05171Smrg# in the future once the codebase is sufficiently modernized to silence
20706ef05171Smrg# them.  For now, I don't want them to drown out the other warnings.
20716ef05171Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
20726ef05171Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
20736ef05171Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
20746ef05171Smrg
20756ef05171Smrg# Turn some warnings into errors, so we don't accidently get successful builds
20766ef05171Smrg# when there are problems that should be fixed.
20776ef05171Smrg
20786ef05171Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20796ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20806ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20816ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20826ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20836ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20846ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20856ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20866ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20876ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20886ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20896ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20906ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20916ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
20926ef05171Smrgelse
20936ef05171SmrgAC_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])
20946ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20956ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20966ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20976ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20986ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20996ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
21006ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
21016ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
21026ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
21036ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
21046ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
21056ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
21066ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
21076ef05171Smrgfi
21086ef05171Smrg
21096ef05171SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21106ef05171Smrg]) # XORG_COMPILER_FLAGS
21116ef05171Smrg
21126ef05171Smrg# XORG_CWARNFLAGS
21136ef05171Smrg# ---------------
21146ef05171Smrg# Minimum version: 1.2.0
21156ef05171Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
21166ef05171Smrg#
21176ef05171Smrg# Defines CWARNFLAGS to enable C compiler warnings.
21186ef05171Smrg#
21196ef05171Smrg# This function is deprecated because it defines -fno-strict-aliasing
21206ef05171Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
21216ef05171Smrg# is needed, then it should be added explicitly in the module when
21226ef05171Smrg# it is updated to use BASE_CFLAGS.
21236ef05171Smrg#
21246ef05171SmrgAC_DEFUN([XORG_CWARNFLAGS], [
21256ef05171SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21266ef05171SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
21276ef05171SmrgAC_LANG_CASE(
21286ef05171Smrg	[C], [
21296ef05171Smrg		CWARNFLAGS="$BASE_CFLAGS"
21306ef05171Smrg		if  test "x$GCC" = xyes ; then
21316ef05171Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
21326ef05171Smrg		fi
21336ef05171Smrg		AC_SUBST(CWARNFLAGS)
21346ef05171Smrg	]
21356ef05171Smrg)
21366ef05171Smrg]) # XORG_CWARNFLAGS
21376ef05171Smrg
21386ef05171Smrg# XORG_STRICT_OPTION
21396ef05171Smrg# -----------------------
21406ef05171Smrg# Minimum version: 1.3.0
21416ef05171Smrg#
21426ef05171Smrg# Add configure option to enable strict compilation flags, such as treating
21436ef05171Smrg# warnings as fatal errors.
21446ef05171Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
21456ef05171Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
21466ef05171Smrg#
21476ef05171Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
21486ef05171Smrg# when strict compilation is unconditionally desired.
21496ef05171SmrgAC_DEFUN([XORG_STRICT_OPTION], [
21506ef05171SmrgAC_REQUIRE([XORG_CWARNFLAGS])
21516ef05171SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21526ef05171Smrg
21536ef05171SmrgAC_ARG_ENABLE(strict-compilation,
21546ef05171Smrg			  AS_HELP_STRING([--enable-strict-compilation],
21556ef05171Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
21566ef05171Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
21576ef05171Smrg
21586ef05171SmrgAC_LANG_CASE(
21596ef05171Smrg        [C], [
21606ef05171Smrg                define([PREFIX], [C])
21616ef05171Smrg        ],
21626ef05171Smrg        [C++], [
21636ef05171Smrg                define([PREFIX], [CXX])
21646ef05171Smrg        ]
21656ef05171Smrg)
21666ef05171Smrg
21676ef05171Smrg[STRICT_]PREFIX[FLAGS]=""
21686ef05171SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
21696ef05171SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
21706ef05171Smrg
21716ef05171Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
21726ef05171Smrg# activate it with -Werror, so we add it here explicitly.
21736ef05171SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
21746ef05171Smrg
21756ef05171Smrgif test "x$STRICT_COMPILE" = "xyes"; then
21766ef05171Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21776ef05171Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21786ef05171Smrgfi
21796ef05171SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21806ef05171SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21816ef05171SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21826ef05171Smrg]) # XORG_STRICT_OPTION
21836ef05171Smrg
21846ef05171Smrg# XORG_DEFAULT_OPTIONS
21856ef05171Smrg# --------------------
21866ef05171Smrg# Minimum version: 1.3.0
21876ef05171Smrg#
21886ef05171Smrg# Defines default options for X.Org modules.
21896ef05171Smrg#
21906ef05171SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21916ef05171SmrgAC_REQUIRE([AC_PROG_INSTALL])
21926ef05171SmrgXORG_COMPILER_FLAGS
21936ef05171SmrgXORG_CWARNFLAGS
21946ef05171SmrgXORG_STRICT_OPTION
21956ef05171SmrgXORG_RELEASE_VERSION
21966ef05171SmrgXORG_CHANGELOG
21976ef05171SmrgXORG_INSTALL
21986ef05171SmrgXORG_MANPAGE_SECTIONS
21996ef05171Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
22006ef05171Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
22016ef05171Smrg]) # XORG_DEFAULT_OPTIONS
22026ef05171Smrg
22036ef05171Smrg# XORG_INSTALL()
22046ef05171Smrg# ----------------
22056ef05171Smrg# Minimum version: 1.4.0
22066ef05171Smrg#
22076ef05171Smrg# Defines the variable INSTALL_CMD as the command to copy
22086ef05171Smrg# INSTALL from $prefix/share/util-macros.
22096ef05171Smrg#
22106ef05171SmrgAC_DEFUN([XORG_INSTALL], [
22116ef05171SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
22126ef05171Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
22136ef05171SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
22146ef05171Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2215ea148d1dSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
2216ea148d1dSmrgtouch \$(top_srcdir)/INSTALL; \
2217ea148d1dSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
22186ef05171SmrgAC_SUBST([INSTALL_CMD])
22196ef05171Smrg]) # XORG_INSTALL
222043f32c10Smrgdnl Copyright 2005 Red Hat, Inc
222143f32c10Smrgdnl
222243f32c10Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
222343f32c10Smrgdnl documentation for any purpose is hereby granted without fee, provided that
222443f32c10Smrgdnl the above copyright notice appear in all copies and that both that
222543f32c10Smrgdnl copyright notice and this permission notice appear in supporting
222643f32c10Smrgdnl documentation.
222743f32c10Smrgdnl
222843f32c10Smrgdnl The above copyright notice and this permission notice shall be included
222943f32c10Smrgdnl in all copies or substantial portions of the Software.
223043f32c10Smrgdnl
223143f32c10Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
223243f32c10Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
223343f32c10Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
223443f32c10Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
223543f32c10Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
223643f32c10Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
223743f32c10Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
223843f32c10Smrgdnl
223943f32c10Smrgdnl Except as contained in this notice, the name of the copyright holders shall
224043f32c10Smrgdnl not be used in advertising or otherwise to promote the sale, use or
224143f32c10Smrgdnl other dealings in this Software without prior written authorization
224243f32c10Smrgdnl from the copyright holders.
224343f32c10Smrgdnl
224443f32c10Smrg
224543f32c10Smrg# XORG_RELEASE_VERSION
224643f32c10Smrg# --------------------
22476ef05171Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
22486ef05171Smrg
224943f32c10SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
225043f32c10Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
225143f32c10Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
225243f32c10Smrg		[Major version of this package])
225343f32c10Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
225443f32c10Smrg	if test "x$PVM" = "x"; then
225543f32c10Smrg		PVM="0"
225643f32c10Smrg	fi
225743f32c10Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
225843f32c10Smrg		[$PVM],
225943f32c10Smrg		[Minor version of this package])
226043f32c10Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
226143f32c10Smrg	if test "x$PVP" = "x"; then
226243f32c10Smrg		PVP="0"
226343f32c10Smrg	fi
226443f32c10Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
226543f32c10Smrg		[$PVP],
226643f32c10Smrg		[Patch version of this package])
226743f32c10Smrg])
226843f32c10Smrg
22696ef05171Smrg# XORG_CHANGELOG()
22706ef05171Smrg# ----------------
22716ef05171Smrg# Minimum version: 1.2.0
22726ef05171Smrg#
22736ef05171Smrg# Defines the variable CHANGELOG_CMD as the command to generate
22746ef05171Smrg# ChangeLog from git.
22756ef05171Smrg#
22766ef05171Smrg#
22776ef05171SmrgAC_DEFUN([XORG_CHANGELOG], [
2278ea148d1dSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
22796ef05171Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2280ea148d1dSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
2281ea148d1dSmrgtouch \$(top_srcdir)/ChangeLog; \
2282ea148d1dSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
22836ef05171SmrgAC_SUBST([CHANGELOG_CMD])
22846ef05171Smrg]) # XORG_CHANGELOG
22856ef05171Smrg
2286ea148d1dSmrg# Copyright (C) 2002-2018 Free Software Foundation, Inc.
228743f32c10Smrg#
228843f32c10Smrg# This file is free software; the Free Software Foundation
228943f32c10Smrg# gives unlimited permission to copy and/or distribute it,
229043f32c10Smrg# with or without modifications, as long as this notice is preserved.
229143f32c10Smrg
229243f32c10Smrg# AM_AUTOMAKE_VERSION(VERSION)
229343f32c10Smrg# ----------------------------
229443f32c10Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
229543f32c10Smrg# generated from the m4 files accompanying Automake X.Y.
229643f32c10Smrg# (This private macro should not be called outside this file.)
229743f32c10SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
2298ea148d1dSmrg[am__api_version='1.16'
229943f32c10Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
230043f32c10Smrgdnl require some minimum version.  Point them to the right macro.
2301ea148d1dSmrgm4_if([$1], [1.16.1], [],
230243f32c10Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
230343f32c10Smrg])
230443f32c10Smrg
230543f32c10Smrg# _AM_AUTOCONF_VERSION(VERSION)
230643f32c10Smrg# -----------------------------
230743f32c10Smrg# aclocal traces this macro to find the Autoconf version.
230843f32c10Smrg# This is a private macro too.  Using m4_define simplifies
230943f32c10Smrg# the logic in aclocal, which can simply ignore this definition.
231043f32c10Smrgm4_define([_AM_AUTOCONF_VERSION], [])
231143f32c10Smrg
231243f32c10Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
231343f32c10Smrg# -------------------------------
231443f32c10Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
23156ef05171Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
231643f32c10SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
2317ea148d1dSmrg[AM_AUTOMAKE_VERSION([1.16.1])dnl
231843f32c10Smrgm4_ifndef([AC_AUTOCONF_VERSION],
231943f32c10Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
23206ef05171Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
232143f32c10Smrg
232243f32c10Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
232343f32c10Smrg
2324ea148d1dSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
232543f32c10Smrg#
232643f32c10Smrg# This file is free software; the Free Software Foundation
232743f32c10Smrg# gives unlimited permission to copy and/or distribute it,
232843f32c10Smrg# with or without modifications, as long as this notice is preserved.
232943f32c10Smrg
233043f32c10Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
23316ef05171Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
23326ef05171Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
233343f32c10Smrg#
233443f32c10Smrg# Of course, Automake must honor this variable whenever it calls a
233543f32c10Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
233643f32c10Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
233743f32c10Smrg# depending on how configure is run.  This is pretty annoying, since
233843f32c10Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
233943f32c10Smrg# source directory, any form will work fine, but in subdirectories a
234043f32c10Smrg# relative path needs to be adjusted first.
234143f32c10Smrg#
234243f32c10Smrg# $ac_aux_dir/missing
234343f32c10Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
234443f32c10Smrg# $top_srcdir/$ac_aux_dir/missing
234543f32c10Smrg#    fails if $ac_aux_dir is absolute,
234643f32c10Smrg#    fails when called from a subdirectory in a VPATH build with
234743f32c10Smrg#          a relative $ac_aux_dir
234843f32c10Smrg#
234943f32c10Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
235043f32c10Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
23516ef05171Smrg# harmless because $srcdir is '.', but things will broke when you
235243f32c10Smrg# start a VPATH build or use an absolute $srcdir.
235343f32c10Smrg#
235443f32c10Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
235543f32c10Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
235643f32c10Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
235743f32c10Smrg# and then we would define $MISSING as
235843f32c10Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
235943f32c10Smrg# This will work as long as MISSING is not called from configure, because
236043f32c10Smrg# unfortunately $(top_srcdir) has no meaning in configure.
236143f32c10Smrg# However there are other variables, like CC, which are often used in
236243f32c10Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
236343f32c10Smrg#
236443f32c10Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
236543f32c10Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
236643f32c10Smrg# configured tree to be moved without reconfiguration.
236743f32c10Smrg
236843f32c10SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
23696ef05171Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
23706ef05171Smrg# Expand $ac_aux_dir to an absolute path.
23716ef05171Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
237243f32c10Smrg])
237343f32c10Smrg
237443f32c10Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
237543f32c10Smrg
2376ea148d1dSmrg# Copyright (C) 1997-2018 Free Software Foundation, Inc.
237743f32c10Smrg#
237843f32c10Smrg# This file is free software; the Free Software Foundation
237943f32c10Smrg# gives unlimited permission to copy and/or distribute it,
238043f32c10Smrg# with or without modifications, as long as this notice is preserved.
238143f32c10Smrg
238243f32c10Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
238343f32c10Smrg# -------------------------------------
238443f32c10Smrg# Define a conditional.
238543f32c10SmrgAC_DEFUN([AM_CONDITIONAL],
23866ef05171Smrg[AC_PREREQ([2.52])dnl
23876ef05171Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23886ef05171Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
238943f32c10SmrgAC_SUBST([$1_TRUE])dnl
239043f32c10SmrgAC_SUBST([$1_FALSE])dnl
239143f32c10Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
239243f32c10Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23936ef05171Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
239443f32c10Smrgif $2; then
239543f32c10Smrg  $1_TRUE=
239643f32c10Smrg  $1_FALSE='#'
239743f32c10Smrgelse
239843f32c10Smrg  $1_TRUE='#'
239943f32c10Smrg  $1_FALSE=
240043f32c10Smrgfi
240143f32c10SmrgAC_CONFIG_COMMANDS_PRE(
240243f32c10Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
240343f32c10Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
240443f32c10SmrgUsually this means the macro was only invoked conditionally.]])
240543f32c10Smrgfi])])
240643f32c10Smrg
2407ea148d1dSmrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
240843f32c10Smrg#
240943f32c10Smrg# This file is free software; the Free Software Foundation
241043f32c10Smrg# gives unlimited permission to copy and/or distribute it,
241143f32c10Smrg# with or without modifications, as long as this notice is preserved.
241243f32c10Smrg
241343f32c10Smrg
24146ef05171Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
241543f32c10Smrg# written in clear, in which case automake, when reading aclocal.m4,
241643f32c10Smrg# will think it sees a *use*, and therefore will trigger all it's
241743f32c10Smrg# C support machinery.  Also note that it means that autoscan, seeing
241843f32c10Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
241943f32c10Smrg
242043f32c10Smrg
242143f32c10Smrg# _AM_DEPENDENCIES(NAME)
242243f32c10Smrg# ----------------------
242343f32c10Smrg# See how the compiler implements dependency checking.
24246ef05171Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
242543f32c10Smrg# We try a few techniques and use that to set a single cache variable.
242643f32c10Smrg#
242743f32c10Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
242843f32c10Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
242943f32c10Smrg# dependency, and given that the user is not expected to run this macro,
243043f32c10Smrg# just rely on AC_PROG_CC.
243143f32c10SmrgAC_DEFUN([_AM_DEPENDENCIES],
243243f32c10Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
243343f32c10SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
243443f32c10SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
243543f32c10SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
243643f32c10Smrg
24376ef05171Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
24386ef05171Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
24396ef05171Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
24406ef05171Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
24416ef05171Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
24426ef05171Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
24436ef05171Smrg                    [depcc="$$1"   am_compiler_list=])
244443f32c10Smrg
244543f32c10SmrgAC_CACHE_CHECK([dependency style of $depcc],
244643f32c10Smrg               [am_cv_$1_dependencies_compiler_type],
244743f32c10Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
244843f32c10Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
244943f32c10Smrg  # making bogus files that we don't know about and never remove.  For
245043f32c10Smrg  # instance it was reported that on HP-UX the gcc test will end up
24516ef05171Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
24526ef05171Smrg  # in D".
24536ef05171Smrg  rm -rf conftest.dir
245443f32c10Smrg  mkdir conftest.dir
245543f32c10Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
245643f32c10Smrg  # using a relative directory.
245743f32c10Smrg  cp "$am_depcomp" conftest.dir
245843f32c10Smrg  cd conftest.dir
245943f32c10Smrg  # We will build objects and dependencies in a subdirectory because
246043f32c10Smrg  # it helps to detect inapplicable dependency modes.  For instance
246143f32c10Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
246243f32c10Smrg  # side effect of compilation, but ICC will put the dependencies in
246343f32c10Smrg  # the current directory while Tru64 will put them in the object
246443f32c10Smrg  # directory.
246543f32c10Smrg  mkdir sub
246643f32c10Smrg
246743f32c10Smrg  am_cv_$1_dependencies_compiler_type=none
246843f32c10Smrg  if test "$am_compiler_list" = ""; then
246943f32c10Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
247043f32c10Smrg  fi
24716ef05171Smrg  am__universal=false
24726ef05171Smrg  m4_case([$1], [CC],
24736ef05171Smrg    [case " $depcc " in #(
24746ef05171Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24756ef05171Smrg     esac],
24766ef05171Smrg    [CXX],
24776ef05171Smrg    [case " $depcc " in #(
24786ef05171Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24796ef05171Smrg     esac])
24806ef05171Smrg
248143f32c10Smrg  for depmode in $am_compiler_list; do
248243f32c10Smrg    # Setup a source with many dependencies, because some compilers
248343f32c10Smrg    # like to wrap large dependency lists on column 80 (with \), and
248443f32c10Smrg    # we should not choose a depcomp mode which is confused by this.
248543f32c10Smrg    #
248643f32c10Smrg    # We need to recreate these files for each test, as the compiler may
248743f32c10Smrg    # overwrite some of them when testing with obscure command lines.
248843f32c10Smrg    # This happens at least with the AIX C compiler.
248943f32c10Smrg    : > sub/conftest.c
249043f32c10Smrg    for i in 1 2 3 4 5 6; do
249143f32c10Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24926ef05171Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24936ef05171Smrg      # Solaris 10 /bin/sh.
24946ef05171Smrg      echo '/* dummy */' > sub/conftst$i.h
249543f32c10Smrg    done
249643f32c10Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
249743f32c10Smrg
24986ef05171Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24996ef05171Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
25006ef05171Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
25016ef05171Smrg    # versions had trouble with output in subdirs.
25026ef05171Smrg    am__obj=sub/conftest.${OBJEXT-o}
25036ef05171Smrg    am__minus_obj="-o $am__obj"
250443f32c10Smrg    case $depmode in
25056ef05171Smrg    gcc)
25066ef05171Smrg      # This depmode causes a compiler race in universal mode.
25076ef05171Smrg      test "$am__universal" = false || continue
25086ef05171Smrg      ;;
250943f32c10Smrg    nosideeffect)
25106ef05171Smrg      # After this tag, mechanisms are not by side-effect, so they'll
25116ef05171Smrg      # only be used when explicitly requested.
251243f32c10Smrg      if test "x$enable_dependency_tracking" = xyes; then
251343f32c10Smrg	continue
251443f32c10Smrg      else
251543f32c10Smrg	break
251643f32c10Smrg      fi
251743f32c10Smrg      ;;
25186ef05171Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25196ef05171Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25206ef05171Smrg      # not run yet.  These depmodes are late enough in the game, and
25216ef05171Smrg      # so weak that their functioning should not be impacted.
25226ef05171Smrg      am__obj=conftest.${OBJEXT-o}
25236ef05171Smrg      am__minus_obj=
25246ef05171Smrg      ;;
252543f32c10Smrg    none) break ;;
252643f32c10Smrg    esac
252743f32c10Smrg    if depmode=$depmode \
25286ef05171Smrg       source=sub/conftest.c object=$am__obj \
252943f32c10Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
25306ef05171Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
253143f32c10Smrg         >/dev/null 2>conftest.err &&
253243f32c10Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
253343f32c10Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
25346ef05171Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
253543f32c10Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
253643f32c10Smrg      # icc doesn't choke on unknown options, it will just issue warnings
253743f32c10Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
253843f32c10Smrg      # that says an option was ignored or not supported.
253943f32c10Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
254043f32c10Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
254143f32c10Smrg      # The diagnosis changed in icc 8.0:
254243f32c10Smrg      #   icc: Command line remark: option '-MP' not supported
254343f32c10Smrg      if (grep 'ignoring option' conftest.err ||
254443f32c10Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
254543f32c10Smrg        am_cv_$1_dependencies_compiler_type=$depmode
254643f32c10Smrg        break
254743f32c10Smrg      fi
254843f32c10Smrg    fi
254943f32c10Smrg  done
255043f32c10Smrg
255143f32c10Smrg  cd ..
255243f32c10Smrg  rm -rf conftest.dir
255343f32c10Smrgelse
255443f32c10Smrg  am_cv_$1_dependencies_compiler_type=none
255543f32c10Smrgfi
255643f32c10Smrg])
255743f32c10SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
255843f32c10SmrgAM_CONDITIONAL([am__fastdep$1], [
255943f32c10Smrg  test "x$enable_dependency_tracking" != xno \
256043f32c10Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
256143f32c10Smrg])
256243f32c10Smrg
256343f32c10Smrg
256443f32c10Smrg# AM_SET_DEPDIR
256543f32c10Smrg# -------------
256643f32c10Smrg# Choose a directory name for dependency files.
25676ef05171Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
256843f32c10SmrgAC_DEFUN([AM_SET_DEPDIR],
256943f32c10Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
257043f32c10SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
257143f32c10Smrg])
257243f32c10Smrg
257343f32c10Smrg
257443f32c10Smrg# AM_DEP_TRACK
257543f32c10Smrg# ------------
257643f32c10SmrgAC_DEFUN([AM_DEP_TRACK],
25776ef05171Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25786ef05171SmrgAS_HELP_STRING(
25796ef05171Smrg  [--enable-dependency-tracking],
25806ef05171Smrg  [do not reject slow dependency extractors])
25816ef05171SmrgAS_HELP_STRING(
25826ef05171Smrg  [--disable-dependency-tracking],
25836ef05171Smrg  [speeds up one-time build])])
258443f32c10Smrgif test "x$enable_dependency_tracking" != xno; then
258543f32c10Smrg  am_depcomp="$ac_aux_dir/depcomp"
258643f32c10Smrg  AMDEPBACKSLASH='\'
25876ef05171Smrg  am__nodep='_no'
258843f32c10Smrgfi
258943f32c10SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
259043f32c10SmrgAC_SUBST([AMDEPBACKSLASH])dnl
259143f32c10Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25926ef05171SmrgAC_SUBST([am__nodep])dnl
25936ef05171Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
259443f32c10Smrg])
259543f32c10Smrg
259643f32c10Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
259743f32c10Smrg
2598ea148d1dSmrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
259943f32c10Smrg#
260043f32c10Smrg# This file is free software; the Free Software Foundation
260143f32c10Smrg# gives unlimited permission to copy and/or distribute it,
260243f32c10Smrg# with or without modifications, as long as this notice is preserved.
260343f32c10Smrg
260443f32c10Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
260543f32c10Smrg# ------------------------------
260643f32c10SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
26076ef05171Smrg[{
26086ef05171Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
26096ef05171Smrg  # are listed without --file.  Let's play safe and only enable the eval
26106ef05171Smrg  # if we detect the quoting.
2611ea148d1dSmrg  # TODO: see whether this extra hack can be removed once we start
2612ea148d1dSmrg  # requiring Autoconf 2.70 or later.
2613ea148d1dSmrg  AS_CASE([$CONFIG_FILES],
2614ea148d1dSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
2615ea148d1dSmrg          [*], [set x $CONFIG_FILES])
26166ef05171Smrg  shift
2617ea148d1dSmrg  # Used to flag and report bootstrapping failures.
2618ea148d1dSmrg  am_rc=0
2619ea148d1dSmrg  for am_mf
26206ef05171Smrg  do
26216ef05171Smrg    # Strip MF so we end up with the name of the file.
2622ea148d1dSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
2623ea148d1dSmrg    # Check whether this is an Automake generated Makefile which includes
2624ea148d1dSmrg    # dependency-tracking related rules and includes.
2625ea148d1dSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
26266ef05171Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
2627ea148d1dSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
2628ea148d1dSmrg      || continue
2629ea148d1dSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
2630ea148d1dSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
2631ea148d1dSmrg    AM_RUN_LOG([cd "$am_dirpart" \
2632ea148d1dSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
2633ea148d1dSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
263443f32c10Smrg  done
2635ea148d1dSmrg  if test $am_rc -ne 0; then
2636ea148d1dSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
2637ea148d1dSmrg    for automatic dependency tracking.  Try re-running configure with the
2638ea148d1dSmrg    '--disable-dependency-tracking' option to at least be able to build
2639ea148d1dSmrg    the package (albeit without support for automatic dependency tracking).])
2640ea148d1dSmrg  fi
2641ea148d1dSmrg  AS_UNSET([am_dirpart])
2642ea148d1dSmrg  AS_UNSET([am_filepart])
2643ea148d1dSmrg  AS_UNSET([am_mf])
2644ea148d1dSmrg  AS_UNSET([am_rc])
2645ea148d1dSmrg  rm -f conftest-deps.mk
26466ef05171Smrg}
264743f32c10Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
264843f32c10Smrg
264943f32c10Smrg
265043f32c10Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
265143f32c10Smrg# -----------------------------
265243f32c10Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
265343f32c10Smrg#
2654ea148d1dSmrg# This code is only required when automatic dependency tracking is enabled.
2655ea148d1dSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
2656ea148d1dSmrg# order to bootstrap the dependency handling code.
265743f32c10SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
265843f32c10Smrg[AC_CONFIG_COMMANDS([depfiles],
265943f32c10Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2660ea148d1dSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
266143f32c10Smrg
266243f32c10Smrg# Do all the work for Automake.                             -*- Autoconf -*-
266343f32c10Smrg
2664ea148d1dSmrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
266543f32c10Smrg#
266643f32c10Smrg# This file is free software; the Free Software Foundation
266743f32c10Smrg# gives unlimited permission to copy and/or distribute it,
266843f32c10Smrg# with or without modifications, as long as this notice is preserved.
266943f32c10Smrg
267043f32c10Smrg# This macro actually does too much.  Some checks are only needed if
267143f32c10Smrg# your package does certain things.  But this isn't really a big deal.
267243f32c10Smrg
26736ef05171Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26746ef05171Smrgm4_define([AC_PROG_CC],
26756ef05171Smrgm4_defn([AC_PROG_CC])
26766ef05171Smrg[_AM_PROG_CC_C_O
26776ef05171Smrg])
26786ef05171Smrg
267943f32c10Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
268043f32c10Smrg# AM_INIT_AUTOMAKE([OPTIONS])
268143f32c10Smrg# -----------------------------------------------
268243f32c10Smrg# The call with PACKAGE and VERSION arguments is the old style
268343f32c10Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
268443f32c10Smrg# and VERSION should now be passed to AC_INIT and removed from
268543f32c10Smrg# the call to AM_INIT_AUTOMAKE.
268643f32c10Smrg# We support both call styles for the transition.  After
268743f32c10Smrg# the next Automake release, Autoconf can make the AC_INIT
268843f32c10Smrg# arguments mandatory, and then we can depend on a new Autoconf
268943f32c10Smrg# release and drop the old call support.
269043f32c10SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
26916ef05171Smrg[AC_PREREQ([2.65])dnl
269243f32c10Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
269343f32c10Smrgdnl the ones we care about.
269443f32c10Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
269543f32c10SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
269643f32c10SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
269743f32c10Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
269843f32c10Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
269943f32c10Smrg  # is not polluted with repeated "-I."
270043f32c10Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
270143f32c10Smrg  # test to see if srcdir already configured
270243f32c10Smrg  if test -f $srcdir/config.status; then
270343f32c10Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
270443f32c10Smrg  fi
270543f32c10Smrgfi
270643f32c10Smrg
270743f32c10Smrg# test whether we have cygpath
270843f32c10Smrgif test -z "$CYGPATH_W"; then
270943f32c10Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
271043f32c10Smrg    CYGPATH_W='cygpath -w'
271143f32c10Smrg  else
271243f32c10Smrg    CYGPATH_W=echo
271343f32c10Smrg  fi
271443f32c10Smrgfi
271543f32c10SmrgAC_SUBST([CYGPATH_W])
271643f32c10Smrg
271743f32c10Smrg# Define the identity of the package.
271843f32c10Smrgdnl Distinguish between old-style and new-style calls.
271943f32c10Smrgm4_ifval([$2],
27206ef05171Smrg[AC_DIAGNOSE([obsolete],
27216ef05171Smrg             [$0: two- and three-arguments forms are deprecated.])
27226ef05171Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
272343f32c10Smrg AC_SUBST([PACKAGE], [$1])dnl
272443f32c10Smrg AC_SUBST([VERSION], [$2])],
272543f32c10Smrg[_AM_SET_OPTIONS([$1])dnl
272643f32c10Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
27276ef05171Smrgm4_if(
27286ef05171Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
27296ef05171Smrg  [ok:ok],,
273043f32c10Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
273143f32c10Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
273243f32c10Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
273343f32c10Smrg
273443f32c10Smrg_AM_IF_OPTION([no-define],,
27356ef05171Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
27366ef05171Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
273743f32c10Smrg
273843f32c10Smrg# Some tools Automake needs.
273943f32c10SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
274043f32c10SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
27416ef05171SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
27426ef05171SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
27436ef05171SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
27446ef05171SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
27456ef05171SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
27466ef05171SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
27476ef05171SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
27486ef05171SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
27496ef05171Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
27506ef05171Smrg# dies out for good.  For more background, see:
2751ea148d1dSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2752ea148d1dSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
27536ef05171SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
27546ef05171Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
27556ef05171Smrg# system "awk" is bad on some platforms.
275643f32c10SmrgAC_REQUIRE([AC_PROG_AWK])dnl
275743f32c10SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
275843f32c10SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
275943f32c10Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
27606ef05171Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
27616ef05171Smrg			     [_AM_PROG_TAR([v7])])])
276243f32c10Smrg_AM_IF_OPTION([no-dependencies],,
276343f32c10Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
27646ef05171Smrg		  [_AM_DEPENDENCIES([CC])],
27656ef05171Smrg		  [m4_define([AC_PROG_CC],
27666ef05171Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
276743f32c10SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27686ef05171Smrg		  [_AM_DEPENDENCIES([CXX])],
27696ef05171Smrg		  [m4_define([AC_PROG_CXX],
27706ef05171Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
277143f32c10SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27726ef05171Smrg		  [_AM_DEPENDENCIES([OBJC])],
27736ef05171Smrg		  [m4_define([AC_PROG_OBJC],
27746ef05171Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27756ef05171SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27766ef05171Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
27776ef05171Smrg		  [m4_define([AC_PROG_OBJCXX],
27786ef05171Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
277943f32c10Smrg])
27806ef05171SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
27816ef05171Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
27826ef05171Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
27836ef05171Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
27846ef05171SmrgAC_CONFIG_COMMANDS_PRE(dnl
27856ef05171Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
27866ef05171Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
27876ef05171Smrg
27886ef05171Smrg# POSIX will say in a future version that running "rm -f" with no argument
27896ef05171Smrg# is OK; and we want to be able to make that assumption in our Makefile
27906ef05171Smrg# recipes.  So use an aggressive probe to check that the usage we want is
27916ef05171Smrg# actually supported "in the wild" to an acceptable degree.
27926ef05171Smrg# See automake bug#10828.
27936ef05171Smrg# To make any issue more visible, cause the running configure to be aborted
27946ef05171Smrg# by default if the 'rm' program in use doesn't match our expectations; the
27956ef05171Smrg# user can still override this though.
27966ef05171Smrgif rm -f && rm -fr && rm -rf; then : OK; else
27976ef05171Smrg  cat >&2 <<'END'
27986ef05171SmrgOops!
27996ef05171Smrg
28006ef05171SmrgYour 'rm' program seems unable to run without file operands specified
28016ef05171Smrgon the command line, even when the '-f' option is present.  This is contrary
28026ef05171Smrgto the behaviour of most rm programs out there, and not conforming with
28036ef05171Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
28046ef05171Smrg
28056ef05171SmrgPlease tell bug-automake@gnu.org about your system, including the value
28066ef05171Smrgof your $PATH and any error possibly output before this message.  This
28076ef05171Smrgcan help us improve future automake versions.
28086ef05171Smrg
28096ef05171SmrgEND
28106ef05171Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
28116ef05171Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
28126ef05171Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
28136ef05171Smrg    echo >&2
28146ef05171Smrg  else
28156ef05171Smrg    cat >&2 <<'END'
28166ef05171SmrgAborting the configuration process, to ensure you take notice of the issue.
28176ef05171Smrg
28186ef05171SmrgYou can download and install GNU coreutils to get an 'rm' implementation
2819ea148d1dSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
28206ef05171Smrg
28216ef05171SmrgIf you want to complete the configuration process using your problematic
28226ef05171Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
28236ef05171Smrgto "yes", and re-run configure.
28246ef05171Smrg
28256ef05171SmrgEND
28266ef05171Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
28276ef05171Smrg  fi
28286ef05171Smrgfi
28296ef05171Smrgdnl The trailing newline in this macro's definition is deliberate, for
28306ef05171Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
28316ef05171Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
283243f32c10Smrg])
283343f32c10Smrg
28346ef05171Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
28356ef05171Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
28366ef05171Smrgdnl mangled by Autoconf and run in a shell conditional statement.
28376ef05171Smrgm4_define([_AC_COMPILER_EXEEXT],
28386ef05171Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
283943f32c10Smrg
284043f32c10Smrg# When config.status generates a header, we must update the stamp-h file.
284143f32c10Smrg# This file resides in the same directory as the config header
284243f32c10Smrg# that is generated.  The stamp files are numbered to have different names.
284343f32c10Smrg
284443f32c10Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
284543f32c10Smrg# loop where config.status creates the headers, so we can generate
284643f32c10Smrg# our stamp files there.
284743f32c10SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
284843f32c10Smrg[# Compute $1's index in $config_headers.
284943f32c10Smrg_am_arg=$1
285043f32c10Smrg_am_stamp_count=1
285143f32c10Smrgfor _am_header in $config_headers :; do
285243f32c10Smrg  case $_am_header in
285343f32c10Smrg    $_am_arg | $_am_arg:* )
285443f32c10Smrg      break ;;
285543f32c10Smrg    * )
285643f32c10Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
285743f32c10Smrg  esac
285843f32c10Smrgdone
285943f32c10Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
286043f32c10Smrg
2861ea148d1dSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
286243f32c10Smrg#
286343f32c10Smrg# This file is free software; the Free Software Foundation
286443f32c10Smrg# gives unlimited permission to copy and/or distribute it,
286543f32c10Smrg# with or without modifications, as long as this notice is preserved.
286643f32c10Smrg
286743f32c10Smrg# AM_PROG_INSTALL_SH
286843f32c10Smrg# ------------------
286943f32c10Smrg# Define $install_sh.
287043f32c10SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
287143f32c10Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
28726ef05171Smrgif test x"${install_sh+set}" != xset; then
28736ef05171Smrg  case $am_aux_dir in
28746ef05171Smrg  *\ * | *\	*)
28756ef05171Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
28766ef05171Smrg  *)
28776ef05171Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
28786ef05171Smrg  esac
28796ef05171Smrgfi
28806ef05171SmrgAC_SUBST([install_sh])])
288143f32c10Smrg
2882ea148d1dSmrg# Copyright (C) 2003-2018 Free Software Foundation, Inc.
288343f32c10Smrg#
288443f32c10Smrg# This file is free software; the Free Software Foundation
288543f32c10Smrg# gives unlimited permission to copy and/or distribute it,
288643f32c10Smrg# with or without modifications, as long as this notice is preserved.
288743f32c10Smrg
288843f32c10Smrg# Check whether the underlying file-system supports filenames
288943f32c10Smrg# with a leading dot.  For instance MS-DOS doesn't.
289043f32c10SmrgAC_DEFUN([AM_SET_LEADING_DOT],
289143f32c10Smrg[rm -rf .tst 2>/dev/null
289243f32c10Smrgmkdir .tst 2>/dev/null
289343f32c10Smrgif test -d .tst; then
289443f32c10Smrg  am__leading_dot=.
289543f32c10Smrgelse
289643f32c10Smrg  am__leading_dot=_
289743f32c10Smrgfi
289843f32c10Smrgrmdir .tst 2>/dev/null
289943f32c10SmrgAC_SUBST([am__leading_dot])])
290043f32c10Smrg
290143f32c10Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
290243f32c10Smrg
2903ea148d1dSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
290443f32c10Smrg#
290543f32c10Smrg# This file is free software; the Free Software Foundation
290643f32c10Smrg# gives unlimited permission to copy and/or distribute it,
290743f32c10Smrg# with or without modifications, as long as this notice is preserved.
290843f32c10Smrg
290943f32c10Smrg# AM_MAKE_INCLUDE()
291043f32c10Smrg# -----------------
2911ea148d1dSmrg# Check whether make has an 'include' directive that can support all
2912ea148d1dSmrg# the idioms we need for our automatic dependency tracking code.
291343f32c10SmrgAC_DEFUN([AM_MAKE_INCLUDE],
2914ea148d1dSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
2915ea148d1dSmrgcat > confinc.mk << 'END'
291643f32c10Smrgam__doit:
2917ea148d1dSmrg	@echo this is the am__doit target >confinc.out
291843f32c10Smrg.PHONY: am__doit
291943f32c10SmrgEND
292043f32c10Smrgam__include="#"
292143f32c10Smrgam__quote=
2922ea148d1dSmrg# BSD make does it like this.
2923ea148d1dSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
2924ea148d1dSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
2925ea148d1dSmrgecho 'include confinc.mk # ignored' > confmf.GNU
2926ea148d1dSmrg_am_result=no
2927ea148d1dSmrgfor s in GNU BSD; do
2928ea148d1dSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
2929ea148d1dSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
2930ea148d1dSmrg      ['0:this is the am__doit target'],
2931ea148d1dSmrg      [AS_CASE([$s],
2932ea148d1dSmrg          [BSD], [am__include='.include' am__quote='"'],
2933ea148d1dSmrg          [am__include='include' am__quote=''])])
2934ea148d1dSmrg  if test "$am__include" != "#"; then
2935ea148d1dSmrg    _am_result="yes ($s style)"
2936ea148d1dSmrg    break
2937ea148d1dSmrg  fi
2938ea148d1dSmrgdone
2939ea148d1dSmrgrm -f confinc.* confmf.*
2940ea148d1dSmrgAC_MSG_RESULT([${_am_result}])
2941ea148d1dSmrgAC_SUBST([am__include])])
2942ea148d1dSmrgAC_SUBST([am__quote])])
294343f32c10Smrg
294443f32c10Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
294543f32c10Smrg
2946ea148d1dSmrg# Copyright (C) 1997-2018 Free Software Foundation, Inc.
294743f32c10Smrg#
294843f32c10Smrg# This file is free software; the Free Software Foundation
294943f32c10Smrg# gives unlimited permission to copy and/or distribute it,
295043f32c10Smrg# with or without modifications, as long as this notice is preserved.
295143f32c10Smrg
295243f32c10Smrg# AM_MISSING_PROG(NAME, PROGRAM)
295343f32c10Smrg# ------------------------------
295443f32c10SmrgAC_DEFUN([AM_MISSING_PROG],
295543f32c10Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
295643f32c10Smrg$1=${$1-"${am_missing_run}$2"}
295743f32c10SmrgAC_SUBST($1)])
295843f32c10Smrg
295943f32c10Smrg# AM_MISSING_HAS_RUN
296043f32c10Smrg# ------------------
29616ef05171Smrg# Define MISSING if not defined so far and test if it is modern enough.
29626ef05171Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
296343f32c10SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
296443f32c10Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
296543f32c10SmrgAC_REQUIRE_AUX_FILE([missing])dnl
29666ef05171Smrgif test x"${MISSING+set}" != xset; then
29676ef05171Smrg  case $am_aux_dir in
29686ef05171Smrg  *\ * | *\	*)
29696ef05171Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
29706ef05171Smrg  *)
29716ef05171Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
29726ef05171Smrg  esac
29736ef05171Smrgfi
297443f32c10Smrg# Use eval to expand $SHELL
29756ef05171Smrgif eval "$MISSING --is-lightweight"; then
29766ef05171Smrg  am_missing_run="$MISSING "
297743f32c10Smrgelse
297843f32c10Smrg  am_missing_run=
29796ef05171Smrg  AC_MSG_WARN(['missing' script is too old or missing])
298043f32c10Smrgfi
298143f32c10Smrg])
298243f32c10Smrg
298343f32c10Smrg# Helper functions for option handling.                     -*- Autoconf -*-
298443f32c10Smrg
2985ea148d1dSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
298643f32c10Smrg#
298743f32c10Smrg# This file is free software; the Free Software Foundation
298843f32c10Smrg# gives unlimited permission to copy and/or distribute it,
298943f32c10Smrg# with or without modifications, as long as this notice is preserved.
299043f32c10Smrg
299143f32c10Smrg# _AM_MANGLE_OPTION(NAME)
299243f32c10Smrg# -----------------------
299343f32c10SmrgAC_DEFUN([_AM_MANGLE_OPTION],
299443f32c10Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
299543f32c10Smrg
299643f32c10Smrg# _AM_SET_OPTION(NAME)
29976ef05171Smrg# --------------------
299843f32c10Smrg# Set option NAME.  Presently that only means defining a flag for this option.
299943f32c10SmrgAC_DEFUN([_AM_SET_OPTION],
30006ef05171Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
300143f32c10Smrg
300243f32c10Smrg# _AM_SET_OPTIONS(OPTIONS)
30036ef05171Smrg# ------------------------
300443f32c10Smrg# OPTIONS is a space-separated list of Automake options.
300543f32c10SmrgAC_DEFUN([_AM_SET_OPTIONS],
30066ef05171Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
300743f32c10Smrg
300843f32c10Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
300943f32c10Smrg# -------------------------------------------
301043f32c10Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
301143f32c10SmrgAC_DEFUN([_AM_IF_OPTION],
301243f32c10Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
301343f32c10Smrg
3014ea148d1dSmrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
30156ef05171Smrg#
30166ef05171Smrg# This file is free software; the Free Software Foundation
30176ef05171Smrg# gives unlimited permission to copy and/or distribute it,
30186ef05171Smrg# with or without modifications, as long as this notice is preserved.
30196ef05171Smrg
30206ef05171Smrg# _AM_PROG_CC_C_O
30216ef05171Smrg# ---------------
30226ef05171Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
30236ef05171Smrg# to automatically call this.
30246ef05171SmrgAC_DEFUN([_AM_PROG_CC_C_O],
30256ef05171Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
30266ef05171SmrgAC_REQUIRE_AUX_FILE([compile])dnl
30276ef05171SmrgAC_LANG_PUSH([C])dnl
30286ef05171SmrgAC_CACHE_CHECK(
30296ef05171Smrg  [whether $CC understands -c and -o together],
30306ef05171Smrg  [am_cv_prog_cc_c_o],
30316ef05171Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
30326ef05171Smrg  # Make sure it works both with $CC and with simple cc.
30336ef05171Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
30346ef05171Smrg  # compilers refuse to overwrite an existing .o file with -o,
30356ef05171Smrg  # though they will create one.
30366ef05171Smrg  am_cv_prog_cc_c_o=yes
30376ef05171Smrg  for am_i in 1 2; do
30386ef05171Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
30396ef05171Smrg         && test -f conftest2.$ac_objext; then
30406ef05171Smrg      : OK
30416ef05171Smrg    else
30426ef05171Smrg      am_cv_prog_cc_c_o=no
30436ef05171Smrg      break
30446ef05171Smrg    fi
30456ef05171Smrg  done
30466ef05171Smrg  rm -f core conftest*
30476ef05171Smrg  unset am_i])
30486ef05171Smrgif test "$am_cv_prog_cc_c_o" != yes; then
30496ef05171Smrg   # Losing compiler, so override with the script.
30506ef05171Smrg   # FIXME: It is wrong to rewrite CC.
30516ef05171Smrg   # But if we don't then we get into trouble of one sort or another.
30526ef05171Smrg   # A longer-term fix would be to have automake use am__CC in this case,
30536ef05171Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
30546ef05171Smrg   CC="$am_aux_dir/compile $CC"
30556ef05171Smrgfi
30566ef05171SmrgAC_LANG_POP([C])])
30576ef05171Smrg
30586ef05171Smrg# For backward compatibility.
30596ef05171SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
306043f32c10Smrg
3061ea148d1dSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
306243f32c10Smrg#
306343f32c10Smrg# This file is free software; the Free Software Foundation
306443f32c10Smrg# gives unlimited permission to copy and/or distribute it,
306543f32c10Smrg# with or without modifications, as long as this notice is preserved.
306643f32c10Smrg
30676ef05171Smrg# AM_RUN_LOG(COMMAND)
30686ef05171Smrg# -------------------
30696ef05171Smrg# Run COMMAND, save the exit status in ac_status, and log it.
30706ef05171Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
30716ef05171SmrgAC_DEFUN([AM_RUN_LOG],
30726ef05171Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
30736ef05171Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
30746ef05171Smrg   ac_status=$?
30756ef05171Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
30766ef05171Smrg   (exit $ac_status); }])
30776ef05171Smrg
30786ef05171Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
30796ef05171Smrg
3080ea148d1dSmrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
30816ef05171Smrg#
30826ef05171Smrg# This file is free software; the Free Software Foundation
30836ef05171Smrg# gives unlimited permission to copy and/or distribute it,
30846ef05171Smrg# with or without modifications, as long as this notice is preserved.
308543f32c10Smrg
308643f32c10Smrg# AM_SANITY_CHECK
308743f32c10Smrg# ---------------
308843f32c10SmrgAC_DEFUN([AM_SANITY_CHECK],
308943f32c10Smrg[AC_MSG_CHECKING([whether build environment is sane])
30906ef05171Smrg# Reject unsafe characters in $srcdir or the absolute working directory
30916ef05171Smrg# name.  Accept space and tab only in the latter.
30926ef05171Smrgam_lf='
30936ef05171Smrg'
30946ef05171Smrgcase `pwd` in
30956ef05171Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
30966ef05171Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
30976ef05171Smrgesac
30986ef05171Smrgcase $srcdir in
30996ef05171Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
31006ef05171Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
31016ef05171Smrgesac
31026ef05171Smrg
31036ef05171Smrg# Do 'set' in a subshell so we don't clobber the current shell's
310443f32c10Smrg# arguments.  Must try -L first in case configure is actually a
310543f32c10Smrg# symlink; some systems play weird games with the mod time of symlinks
310643f32c10Smrg# (eg FreeBSD returns the mod time of the symlink's containing
310743f32c10Smrg# directory).
310843f32c10Smrgif (
31096ef05171Smrg   am_has_slept=no
31106ef05171Smrg   for am_try in 1 2; do
31116ef05171Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
31126ef05171Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
31136ef05171Smrg     if test "$[*]" = "X"; then
31146ef05171Smrg	# -L didn't work.
31156ef05171Smrg	set X `ls -t "$srcdir/configure" conftest.file`
31166ef05171Smrg     fi
31176ef05171Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
31186ef05171Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
31196ef05171Smrg
31206ef05171Smrg	# If neither matched, then we have a broken ls.  This can happen
31216ef05171Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
31226ef05171Smrg	# broken ls alias from the environment.  This has actually
31236ef05171Smrg	# happened.  Such a system could not be considered "sane".
31246ef05171Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
31256ef05171Smrg  alias in your environment])
31266ef05171Smrg     fi
31276ef05171Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
31286ef05171Smrg       break
31296ef05171Smrg     fi
31306ef05171Smrg     # Just in case.
31316ef05171Smrg     sleep 1
31326ef05171Smrg     am_has_slept=yes
31336ef05171Smrg   done
313443f32c10Smrg   test "$[2]" = conftest.file
313543f32c10Smrg   )
313643f32c10Smrgthen
313743f32c10Smrg   # Ok.
313843f32c10Smrg   :
313943f32c10Smrgelse
314043f32c10Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
314143f32c10SmrgCheck your system clock])
314243f32c10Smrgfi
31436ef05171SmrgAC_MSG_RESULT([yes])
31446ef05171Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
31456ef05171Smrg# generated files are strictly newer.
31466ef05171Smrgam_sleep_pid=
31476ef05171Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
31486ef05171Smrg  ( sleep 1 ) &
31496ef05171Smrg  am_sleep_pid=$!
31506ef05171Smrgfi
31516ef05171SmrgAC_CONFIG_COMMANDS_PRE(
31526ef05171Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
31536ef05171Smrg   if test -n "$am_sleep_pid"; then
31546ef05171Smrg     # Hide warnings about reused PIDs.
31556ef05171Smrg     wait $am_sleep_pid 2>/dev/null
31566ef05171Smrg   fi
31576ef05171Smrg   AC_MSG_RESULT([done])])
31586ef05171Smrgrm -f conftest.file
31596ef05171Smrg])
316043f32c10Smrg
3161ea148d1dSmrg# Copyright (C) 2009-2018 Free Software Foundation, Inc.
31626ef05171Smrg#
31636ef05171Smrg# This file is free software; the Free Software Foundation
31646ef05171Smrg# gives unlimited permission to copy and/or distribute it,
31656ef05171Smrg# with or without modifications, as long as this notice is preserved.
31666ef05171Smrg
31676ef05171Smrg# AM_SILENT_RULES([DEFAULT])
31686ef05171Smrg# --------------------------
31696ef05171Smrg# Enable less verbose build rules; with the default set to DEFAULT
31706ef05171Smrg# ("yes" being less verbose, "no" or empty being verbose).
31716ef05171SmrgAC_DEFUN([AM_SILENT_RULES],
31726ef05171Smrg[AC_ARG_ENABLE([silent-rules], [dnl
31736ef05171SmrgAS_HELP_STRING(
31746ef05171Smrg  [--enable-silent-rules],
31756ef05171Smrg  [less verbose build output (undo: "make V=1")])
31766ef05171SmrgAS_HELP_STRING(
31776ef05171Smrg  [--disable-silent-rules],
31786ef05171Smrg  [verbose build output (undo: "make V=0")])dnl
31796ef05171Smrg])
31806ef05171Smrgcase $enable_silent_rules in @%:@ (((
31816ef05171Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
31826ef05171Smrg   no) AM_DEFAULT_VERBOSITY=1;;
31836ef05171Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
31846ef05171Smrgesac
31856ef05171Smrgdnl
31866ef05171Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
31876ef05171Smrgdnl do not support nested variable expansions.
31886ef05171Smrgdnl See automake bug#9928 and bug#10237.
31896ef05171Smrgam_make=${MAKE-make}
31906ef05171SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
31916ef05171Smrg   [am_cv_make_support_nested_variables],
31926ef05171Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
31936ef05171SmrgBAR0=false
31946ef05171SmrgBAR1=true
31956ef05171SmrgV=1
31966ef05171Smrgam__doit:
31976ef05171Smrg	@$(TRUE)
31986ef05171Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
31996ef05171Smrg  am_cv_make_support_nested_variables=yes
32006ef05171Smrgelse
32016ef05171Smrg  am_cv_make_support_nested_variables=no
32026ef05171Smrgfi])
32036ef05171Smrgif test $am_cv_make_support_nested_variables = yes; then
32046ef05171Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
32056ef05171Smrg  AM_V='$(V)'
32066ef05171Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
32076ef05171Smrgelse
32086ef05171Smrg  AM_V=$AM_DEFAULT_VERBOSITY
32096ef05171Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
32106ef05171Smrgfi
32116ef05171SmrgAC_SUBST([AM_V])dnl
32126ef05171SmrgAM_SUBST_NOTMAKE([AM_V])dnl
32136ef05171SmrgAC_SUBST([AM_DEFAULT_V])dnl
32146ef05171SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
32156ef05171SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
32166ef05171SmrgAM_BACKSLASH='\'
32176ef05171SmrgAC_SUBST([AM_BACKSLASH])dnl
32186ef05171Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
32196ef05171Smrg])
32206ef05171Smrg
3221ea148d1dSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
322243f32c10Smrg#
322343f32c10Smrg# This file is free software; the Free Software Foundation
322443f32c10Smrg# gives unlimited permission to copy and/or distribute it,
322543f32c10Smrg# with or without modifications, as long as this notice is preserved.
322643f32c10Smrg
322743f32c10Smrg# AM_PROG_INSTALL_STRIP
322843f32c10Smrg# ---------------------
32296ef05171Smrg# One issue with vendor 'install' (even GNU) is that you can't
323043f32c10Smrg# specify the program used to strip binaries.  This is especially
323143f32c10Smrg# annoying in cross-compiling environments, where the build's strip
323243f32c10Smrg# is unlikely to handle the host's binaries.
323343f32c10Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
32346ef05171Smrg# always use install-sh in "make install-strip", and initialize
323543f32c10Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
323643f32c10SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
323743f32c10Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
32386ef05171Smrg# Installed binaries are usually stripped using 'strip' when the user
32396ef05171Smrg# run "make install-strip".  However 'strip' might not be the right
324043f32c10Smrg# tool to use in cross-compilation environments, therefore Automake
32416ef05171Smrg# will honor the 'STRIP' environment variable to overrule this program.
32426ef05171Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
324343f32c10Smrgif test "$cross_compiling" != no; then
324443f32c10Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
324543f32c10Smrgfi
324643f32c10SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
324743f32c10SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
324843f32c10Smrg
3249ea148d1dSmrg# Copyright (C) 2006-2018 Free Software Foundation, Inc.
325043f32c10Smrg#
325143f32c10Smrg# This file is free software; the Free Software Foundation
325243f32c10Smrg# gives unlimited permission to copy and/or distribute it,
325343f32c10Smrg# with or without modifications, as long as this notice is preserved.
325443f32c10Smrg
325543f32c10Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
325643f32c10Smrg# ---------------------------
325743f32c10Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
325843f32c10Smrg# This macro is traced by Automake.
325943f32c10SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
326043f32c10Smrg
32616ef05171Smrg# AM_SUBST_NOTMAKE(VARIABLE)
32626ef05171Smrg# --------------------------
32636ef05171Smrg# Public sister of _AM_SUBST_NOTMAKE.
32646ef05171SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
32656ef05171Smrg
326643f32c10Smrg# Check how to create a tarball.                            -*- Autoconf -*-
326743f32c10Smrg
3268ea148d1dSmrg# Copyright (C) 2004-2018 Free Software Foundation, Inc.
326943f32c10Smrg#
327043f32c10Smrg# This file is free software; the Free Software Foundation
327143f32c10Smrg# gives unlimited permission to copy and/or distribute it,
327243f32c10Smrg# with or without modifications, as long as this notice is preserved.
327343f32c10Smrg
327443f32c10Smrg# _AM_PROG_TAR(FORMAT)
327543f32c10Smrg# --------------------
327643f32c10Smrg# Check how to create a tarball in format FORMAT.
32776ef05171Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
327843f32c10Smrg#
327943f32c10Smrg# Substitute a variable $(am__tar) that is a command
328043f32c10Smrg# writing to stdout a FORMAT-tarball containing the directory
328143f32c10Smrg# $tardir.
328243f32c10Smrg#     tardir=directory && $(am__tar) > result.tar
328343f32c10Smrg#
328443f32c10Smrg# Substitute a variable $(am__untar) that extract such
328543f32c10Smrg# a tarball read from stdin.
328643f32c10Smrg#     $(am__untar) < result.tar
32876ef05171Smrg#
328843f32c10SmrgAC_DEFUN([_AM_PROG_TAR],
32896ef05171Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
32906ef05171Smrg# in the wild :-(  We should find a proper way to deprecate it ...
32916ef05171SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
32926ef05171Smrg
32936ef05171Smrg# We'll loop over all known methods to create a tar archive until one works.
329443f32c10Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
329543f32c10Smrg
32966ef05171Smrgm4_if([$1], [v7],
32976ef05171Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
32986ef05171Smrg
32996ef05171Smrg  [m4_case([$1],
33006ef05171Smrg    [ustar],
33016ef05171Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
33026ef05171Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
33036ef05171Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
33046ef05171Smrg      # and bug#13588).
33056ef05171Smrg      am_max_uid=2097151 # 2^21 - 1
33066ef05171Smrg      am_max_gid=$am_max_uid
33076ef05171Smrg      # The $UID and $GID variables are not portable, so we need to resort
33086ef05171Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
33096ef05171Smrg      # below are definitely unexpected, so allow the users to see them
33106ef05171Smrg      # (that is, avoid stderr redirection).
33116ef05171Smrg      am_uid=`id -u || echo unknown`
33126ef05171Smrg      am_gid=`id -g || echo unknown`
33136ef05171Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
33146ef05171Smrg      if test $am_uid -le $am_max_uid; then
33156ef05171Smrg         AC_MSG_RESULT([yes])
33166ef05171Smrg      else
33176ef05171Smrg         AC_MSG_RESULT([no])
33186ef05171Smrg         _am_tools=none
33196ef05171Smrg      fi
33206ef05171Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
33216ef05171Smrg      if test $am_gid -le $am_max_gid; then
33226ef05171Smrg         AC_MSG_RESULT([yes])
33236ef05171Smrg      else
33246ef05171Smrg        AC_MSG_RESULT([no])
33256ef05171Smrg        _am_tools=none
33266ef05171Smrg      fi],
33276ef05171Smrg
33286ef05171Smrg  [pax],
33296ef05171Smrg    [],
33306ef05171Smrg
33316ef05171Smrg  [m4_fatal([Unknown tar format])])
33326ef05171Smrg
33336ef05171Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
33346ef05171Smrg
33356ef05171Smrg  # Go ahead even if we have the value already cached.  We do so because we
33366ef05171Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
33376ef05171Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
33386ef05171Smrg
33396ef05171Smrg  for _am_tool in $_am_tools; do
33406ef05171Smrg    case $_am_tool in
33416ef05171Smrg    gnutar)
33426ef05171Smrg      for _am_tar in tar gnutar gtar; do
33436ef05171Smrg        AM_RUN_LOG([$_am_tar --version]) && break
33446ef05171Smrg      done
33456ef05171Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
33466ef05171Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
33476ef05171Smrg      am__untar="$_am_tar -xf -"
33486ef05171Smrg      ;;
33496ef05171Smrg    plaintar)
33506ef05171Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
33516ef05171Smrg      # ustar tarball either.
33526ef05171Smrg      (tar --version) >/dev/null 2>&1 && continue
33536ef05171Smrg      am__tar='tar chf - "$$tardir"'
33546ef05171Smrg      am__tar_='tar chf - "$tardir"'
33556ef05171Smrg      am__untar='tar xf -'
33566ef05171Smrg      ;;
33576ef05171Smrg    pax)
33586ef05171Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
33596ef05171Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
33606ef05171Smrg      am__untar='pax -r'
33616ef05171Smrg      ;;
33626ef05171Smrg    cpio)
33636ef05171Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
33646ef05171Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
33656ef05171Smrg      am__untar='cpio -i -H $1 -d'
33666ef05171Smrg      ;;
33676ef05171Smrg    none)
33686ef05171Smrg      am__tar=false
33696ef05171Smrg      am__tar_=false
33706ef05171Smrg      am__untar=false
33716ef05171Smrg      ;;
33726ef05171Smrg    esac
337343f32c10Smrg
33746ef05171Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
33756ef05171Smrg    # and am__untar set.
33766ef05171Smrg    test -n "${am_cv_prog_tar_$1}" && break
33776ef05171Smrg
33786ef05171Smrg    # tar/untar a dummy directory, and stop if the command works.
33796ef05171Smrg    rm -rf conftest.dir
33806ef05171Smrg    mkdir conftest.dir
33816ef05171Smrg    echo GrepMe > conftest.dir/file
33826ef05171Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
33836ef05171Smrg    rm -rf conftest.dir
33846ef05171Smrg    if test -s conftest.tar; then
33856ef05171Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
33866ef05171Smrg      AM_RUN_LOG([cat conftest.dir/file])
33876ef05171Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
33886ef05171Smrg    fi
33896ef05171Smrg  done
339043f32c10Smrg  rm -rf conftest.dir
339143f32c10Smrg
33926ef05171Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
33936ef05171Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
33946ef05171Smrg
339543f32c10SmrgAC_SUBST([am__tar])
339643f32c10SmrgAC_SUBST([am__untar])
339743f32c10Smrg]) # _AM_PROG_TAR
339843f32c10Smrg
3399