aclocal.m4 revision 6ef05171
16ef05171Smrg# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
26ef05171Smrg
36ef05171Smrg# Copyright (C) 1996-2017 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
3696ef05171Smrgdnl Copyright (c) 2005, 2006, 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],[
4066ef05171Smrgm4_define([vers_have], [1.19.0])
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
48343f32c10Smrgif test x$APP_MAN_SUFFIX = x    ; then
48443f32c10Smrg    APP_MAN_SUFFIX=1
48543f32c10Smrgfi
48643f32c10Smrgif test x$APP_MAN_DIR = x    ; then
48743f32c10Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
48843f32c10Smrgfi
48943f32c10Smrg
49043f32c10Smrgif test x$LIB_MAN_SUFFIX = x    ; then
49143f32c10Smrg    LIB_MAN_SUFFIX=3
49243f32c10Smrgfi
49343f32c10Smrgif test x$LIB_MAN_DIR = x    ; then
49443f32c10Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
49543f32c10Smrgfi
49643f32c10Smrg
49743f32c10Smrgif test x$FILE_MAN_SUFFIX = x    ; then
49843f32c10Smrg    case $host_os in
49943f32c10Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
50043f32c10Smrg	*)		FILE_MAN_SUFFIX=5  ;;
50143f32c10Smrg    esac
50243f32c10Smrgfi
50343f32c10Smrgif test x$FILE_MAN_DIR = x    ; then
50443f32c10Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
50543f32c10Smrgfi
50643f32c10Smrg
50743f32c10Smrgif test x$MISC_MAN_SUFFIX = x    ; then
50843f32c10Smrg    case $host_os in
50943f32c10Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
51043f32c10Smrg	*)		MISC_MAN_SUFFIX=7  ;;
51143f32c10Smrg    esac
51243f32c10Smrgfi
51343f32c10Smrgif test x$MISC_MAN_DIR = x    ; then
51443f32c10Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
51543f32c10Smrgfi
51643f32c10Smrg
51743f32c10Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
51843f32c10Smrg    case $host_os in
51943f32c10Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
52043f32c10Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
52143f32c10Smrg    esac
52243f32c10Smrgfi
52343f32c10Smrgif test x$DRIVER_MAN_DIR = x    ; then
52443f32c10Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
52543f32c10Smrgfi
52643f32c10Smrg
52743f32c10Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
52843f32c10Smrg    case $host_os in
52943f32c10Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
53043f32c10Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
53143f32c10Smrg    esac
53243f32c10Smrgfi
53343f32c10Smrgif test x$ADMIN_MAN_DIR = x    ; then
53443f32c10Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
53543f32c10Smrgfi
53643f32c10Smrg
53743f32c10Smrg
53843f32c10SmrgAC_SUBST([APP_MAN_SUFFIX])
53943f32c10SmrgAC_SUBST([LIB_MAN_SUFFIX])
54043f32c10SmrgAC_SUBST([FILE_MAN_SUFFIX])
54143f32c10SmrgAC_SUBST([MISC_MAN_SUFFIX])
54243f32c10SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
54343f32c10SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
54443f32c10SmrgAC_SUBST([APP_MAN_DIR])
54543f32c10SmrgAC_SUBST([LIB_MAN_DIR])
54643f32c10SmrgAC_SUBST([FILE_MAN_DIR])
54743f32c10SmrgAC_SUBST([MISC_MAN_DIR])
54843f32c10SmrgAC_SUBST([DRIVER_MAN_DIR])
54943f32c10SmrgAC_SUBST([ADMIN_MAN_DIR])
5506ef05171Smrg
5516ef05171SmrgXORG_MAN_PAGE="X Version 11"
5526ef05171SmrgAC_SUBST([XORG_MAN_PAGE])
5536ef05171SmrgMAN_SUBSTS="\
5546ef05171Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5556ef05171Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5566ef05171Smrg	-e 's|__xservername__|Xorg|g' \
5576ef05171Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
5586ef05171Smrg	-e 's|__projectroot__|\$(prefix)|g' \
5596ef05171Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
5606ef05171Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
5616ef05171Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
5626ef05171Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
5636ef05171Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5646ef05171Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5656ef05171Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5666ef05171SmrgAC_SUBST([MAN_SUBSTS])
5676ef05171Smrg
56843f32c10Smrg]) # XORG_MANPAGE_SECTIONS
56943f32c10Smrg
5706ef05171Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5716ef05171Smrg# ------------------------
5726ef05171Smrg# Minimum version: 1.7.0
5736ef05171Smrg#
5746ef05171Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5756ef05171Smrg# provided by xorg-sgml-doctools, if installed.
5766ef05171SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5776ef05171SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5786ef05171SmrgXORG_SGML_PATH=
5796ef05171SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5806ef05171Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5816ef05171Smrg    [m4_ifval([$1],[:],
5826ef05171Smrg        [if test x"$cross_compiling" != x"yes" ; then
5836ef05171Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5846ef05171Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5856ef05171Smrg         fi])
5866ef05171Smrg    ])
5876ef05171Smrg
5886ef05171Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
5896ef05171Smrg# the path and the name of the doc stylesheet
5906ef05171Smrgif test "x$XORG_SGML_PATH" != "x" ; then
5916ef05171Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
5926ef05171Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
5936ef05171Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
5946ef05171Smrgelse
5956ef05171Smrg   AC_MSG_RESULT([no])
5966ef05171Smrgfi
5976ef05171Smrg
5986ef05171SmrgAC_SUBST(XORG_SGML_PATH)
5996ef05171SmrgAC_SUBST(STYLESHEET_SRCDIR)
6006ef05171SmrgAC_SUBST(XSL_STYLESHEET)
6016ef05171SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
6026ef05171Smrg]) # XORG_CHECK_SGML_DOCTOOLS
6036ef05171Smrg
60443f32c10Smrg# XORG_CHECK_LINUXDOC
60543f32c10Smrg# -------------------
60643f32c10Smrg# Minimum version: 1.0.0
60743f32c10Smrg#
60843f32c10Smrg# Defines the variable MAKE_TEXT if the necessary tools and
60943f32c10Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
61043f32c10Smrg# Whether or not the necessary tools and files are found can be checked
61143f32c10Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
61243f32c10SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
6136ef05171SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6146ef05171SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
61543f32c10Smrg
61643f32c10SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
61743f32c10Smrg
6186ef05171SmrgAC_MSG_CHECKING([whether to build documentation])
61943f32c10Smrg
6206ef05171Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
62143f32c10Smrg   BUILDDOC=yes
62243f32c10Smrgelse
62343f32c10Smrg   BUILDDOC=no
62443f32c10Smrgfi
62543f32c10Smrg
62643f32c10SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
62743f32c10Smrg
62843f32c10SmrgAC_MSG_RESULT([$BUILDDOC])
62943f32c10Smrg
6306ef05171SmrgAC_MSG_CHECKING([whether to build pdf documentation])
63143f32c10Smrg
6326ef05171Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
63343f32c10Smrg   BUILDPDFDOC=yes
63443f32c10Smrgelse
63543f32c10Smrg   BUILDPDFDOC=no
63643f32c10Smrgfi
63743f32c10Smrg
63843f32c10SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
63943f32c10Smrg
64043f32c10SmrgAC_MSG_RESULT([$BUILDPDFDOC])
64143f32c10Smrg
6426ef05171SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
64343f32c10SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
64443f32c10SmrgMAKE_PDF="$PS2PDF"
64543f32c10SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
64643f32c10Smrg
64743f32c10SmrgAC_SUBST(MAKE_TEXT)
64843f32c10SmrgAC_SUBST(MAKE_PS)
64943f32c10SmrgAC_SUBST(MAKE_PDF)
65043f32c10SmrgAC_SUBST(MAKE_HTML)
65143f32c10Smrg]) # XORG_CHECK_LINUXDOC
65243f32c10Smrg
65343f32c10Smrg# XORG_CHECK_DOCBOOK
65443f32c10Smrg# -------------------
65543f32c10Smrg# Minimum version: 1.0.0
65643f32c10Smrg#
65743f32c10Smrg# Checks for the ability to build output formats from SGML DocBook source.
65843f32c10Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
65943f32c10Smrg# indicates whether the necessary tools and files are found and, if set,
66043f32c10Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
66143f32c10SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
6626ef05171SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6636ef05171Smrg
66443f32c10SmrgBUILDTXTDOC=no
66543f32c10SmrgBUILDPDFDOC=no
66643f32c10SmrgBUILDPSDOC=no
66743f32c10SmrgBUILDHTMLDOC=no
66843f32c10Smrg
66943f32c10SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
67043f32c10SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
67143f32c10SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
67243f32c10SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
67343f32c10Smrg
6746ef05171SmrgAC_MSG_CHECKING([whether to build text documentation])
6756ef05171Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
67643f32c10Smrg   test x$BUILD_TXTDOC != xno; then
67743f32c10Smrg	BUILDTXTDOC=yes
67843f32c10Smrgfi
67943f32c10SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
68043f32c10SmrgAC_MSG_RESULT([$BUILDTXTDOC])
68143f32c10Smrg
6826ef05171SmrgAC_MSG_CHECKING([whether to build PDF documentation])
6836ef05171Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
68443f32c10Smrg   test x$BUILD_PDFDOC != xno; then
68543f32c10Smrg	BUILDPDFDOC=yes
68643f32c10Smrgfi
68743f32c10SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
68843f32c10SmrgAC_MSG_RESULT([$BUILDPDFDOC])
68943f32c10Smrg
6906ef05171SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
6916ef05171Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
69243f32c10Smrg   test x$BUILD_PSDOC != xno; then
69343f32c10Smrg	BUILDPSDOC=yes
69443f32c10Smrgfi
69543f32c10SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
69643f32c10SmrgAC_MSG_RESULT([$BUILDPSDOC])
69743f32c10Smrg
6986ef05171SmrgAC_MSG_CHECKING([whether to build HTML documentation])
6996ef05171Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
70043f32c10Smrg   test x$BUILD_HTMLDOC != xno; then
70143f32c10Smrg	BUILDHTMLDOC=yes
70243f32c10Smrgfi
70343f32c10SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
70443f32c10SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
70543f32c10Smrg
70643f32c10SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
70743f32c10SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
70843f32c10SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
70943f32c10SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
71043f32c10Smrg
71143f32c10SmrgAC_SUBST(MAKE_TEXT)
71243f32c10SmrgAC_SUBST(MAKE_PS)
71343f32c10SmrgAC_SUBST(MAKE_PDF)
71443f32c10SmrgAC_SUBST(MAKE_HTML)
71543f32c10Smrg]) # XORG_CHECK_DOCBOOK
71643f32c10Smrg
7176ef05171Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
7186ef05171Smrg# ----------------
7196ef05171Smrg# Minimum version: 1.5.0
7206ef05171Smrg# Minimum version for optional DEFAULT argument: 1.11.0
7216ef05171Smrg#
7226ef05171Smrg# Documentation tools are not always available on all platforms and sometimes
7236ef05171Smrg# not at the appropriate level. This macro enables a module to test for the
7246ef05171Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
7256ef05171Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
7266ef05171Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
7276ef05171Smrg# --with-xmlto assumes 'auto'.
7286ef05171Smrg#
7296ef05171Smrg# Interface to module:
7306ef05171Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
7316ef05171Smrg# XMLTO:	returns the path of the xmlto program found
7326ef05171Smrg#		returns the path set by the user in the environment
7336ef05171Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
7346ef05171Smrg#		'no' user instructs the module not to use xmlto
7356ef05171Smrg#
7366ef05171Smrg# Added in version 1.10.0
7376ef05171Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
7386ef05171Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
7396ef05171Smrg#
7406ef05171Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
7416ef05171Smrg#
7426ef05171SmrgAC_DEFUN([XORG_WITH_XMLTO],[
7436ef05171SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
7446ef05171Smrgm4_define([_defopt], m4_default([$2], [auto]))
7456ef05171SmrgAC_ARG_WITH(xmlto,
7466ef05171Smrg	AS_HELP_STRING([--with-xmlto],
7476ef05171Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
7486ef05171Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
7496ef05171Smrgm4_undefine([_defopt])
7506ef05171Smrg
7516ef05171Smrgif test "x$use_xmlto" = x"auto"; then
7526ef05171Smrg   AC_PATH_PROG([XMLTO], [xmlto])
7536ef05171Smrg   if test "x$XMLTO" = "x"; then
7546ef05171Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
7556ef05171Smrg	have_xmlto=no
7566ef05171Smrg   else
7576ef05171Smrg        have_xmlto=yes
7586ef05171Smrg   fi
7596ef05171Smrgelif test "x$use_xmlto" = x"yes" ; then
7606ef05171Smrg   AC_PATH_PROG([XMLTO], [xmlto])
7616ef05171Smrg   if test "x$XMLTO" = "x"; then
7626ef05171Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
7636ef05171Smrg   fi
7646ef05171Smrg   have_xmlto=yes
7656ef05171Smrgelif test "x$use_xmlto" = x"no" ; then
7666ef05171Smrg   if test "x$XMLTO" != "x"; then
7676ef05171Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7686ef05171Smrg   fi
7696ef05171Smrg   have_xmlto=no
7706ef05171Smrgelse
7716ef05171Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7726ef05171Smrgfi
7736ef05171Smrg
7746ef05171Smrg# Test for a minimum version of xmlto, if provided.
7756ef05171Smrgm4_ifval([$1],
7766ef05171Smrg[if test "$have_xmlto" = yes; then
7776ef05171Smrg    # scrape the xmlto version
7786ef05171Smrg    AC_MSG_CHECKING([the xmlto version])
7796ef05171Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7806ef05171Smrg    AC_MSG_RESULT([$xmlto_version])
7816ef05171Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7826ef05171Smrg        [if test "x$use_xmlto" = xauto; then
7836ef05171Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7846ef05171Smrg            have_xmlto=no
7856ef05171Smrg        else
7866ef05171Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7876ef05171Smrg        fi])
7886ef05171Smrgfi])
7896ef05171Smrg
7906ef05171Smrg# Test for the ability of xmlto to generate a text target
7916ef05171Smrghave_xmlto_text=no
7926ef05171Smrgcat > conftest.xml << "EOF"
7936ef05171SmrgEOF
7946ef05171SmrgAS_IF([test "$have_xmlto" = yes],
7956ef05171Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7966ef05171Smrg             [have_xmlto_text=yes],
7976ef05171Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
7986ef05171Smrgrm -f conftest.xml
7996ef05171SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
8006ef05171SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
8016ef05171Smrg]) # XORG_WITH_XMLTO
8026ef05171Smrg
8036ef05171Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
8046ef05171Smrg# --------------------------------------------
8056ef05171Smrg# Minimum version: 1.12.0
8066ef05171Smrg# Minimum version for optional DEFAULT argument: 1.12.0
8076ef05171Smrg#
8086ef05171Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
8096ef05171Smrg# XML-based language used for the transformation of XML documents.
8106ef05171Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
8116ef05171Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
8126ef05171Smrg# The XSLT processor is often used as a standalone tool for transformations.
8136ef05171Smrg# It should not be assumed that this tool is used only to work with documnetation.
8146ef05171Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
8156ef05171Smrg#
8166ef05171Smrg# Interface to module:
8176ef05171Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
8186ef05171Smrg# XSLTPROC:	 returns the path of the xsltproc program found
8196ef05171Smrg#		 returns the path set by the user in the environment
8206ef05171Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
8216ef05171Smrg#		  'no' user instructs the module not to use xsltproc
8226ef05171Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
8236ef05171Smrg#
8246ef05171Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
8256ef05171Smrg#
8266ef05171SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
8276ef05171SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
8286ef05171Smrg# Preserves the interface, should it be implemented later
8296ef05171Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
8306ef05171Smrgm4_define([_defopt], m4_default([$2], [auto]))
8316ef05171SmrgAC_ARG_WITH(xsltproc,
8326ef05171Smrg	AS_HELP_STRING([--with-xsltproc],
8336ef05171Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
8346ef05171Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
8356ef05171Smrgm4_undefine([_defopt])
8366ef05171Smrg
8376ef05171Smrgif test "x$use_xsltproc" = x"auto"; then
8386ef05171Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8396ef05171Smrg   if test "x$XSLTPROC" = "x"; then
8406ef05171Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
8416ef05171Smrg	have_xsltproc=no
8426ef05171Smrg   else
8436ef05171Smrg        have_xsltproc=yes
8446ef05171Smrg   fi
8456ef05171Smrgelif test "x$use_xsltproc" = x"yes" ; then
8466ef05171Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8476ef05171Smrg   if test "x$XSLTPROC" = "x"; then
8486ef05171Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
8496ef05171Smrg   fi
8506ef05171Smrg   have_xsltproc=yes
8516ef05171Smrgelif test "x$use_xsltproc" = x"no" ; then
8526ef05171Smrg   if test "x$XSLTPROC" != "x"; then
8536ef05171Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8546ef05171Smrg   fi
8556ef05171Smrg   have_xsltproc=no
8566ef05171Smrgelse
8576ef05171Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8586ef05171Smrgfi
8596ef05171Smrg
8606ef05171SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8616ef05171Smrg]) # XORG_WITH_XSLTPROC
8626ef05171Smrg
8636ef05171Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8646ef05171Smrg# ----------------------------------------
8656ef05171Smrg# Minimum version: 1.15.0
8666ef05171Smrg#
8676ef05171Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
8686ef05171Smrg# scanning arbitrary text files, extracting information from those text files,
8696ef05171Smrg# and printing reports based on that information.
8706ef05171Smrg#
8716ef05171Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8726ef05171Smrg#
8736ef05171Smrg# Interface to module:
8746ef05171Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
8756ef05171Smrg# PERL:	     returns the path of the perl program found
8766ef05171Smrg#	     returns the path set by the user in the environment
8776ef05171Smrg# --with-perl: 'yes' user instructs the module to use perl
8786ef05171Smrg#	       'no' user instructs the module not to use perl
8796ef05171Smrg# have_perl: returns yes if perl found in PATH or no
8806ef05171Smrg#
8816ef05171Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
8826ef05171Smrg#
8836ef05171SmrgAC_DEFUN([XORG_WITH_PERL],[
8846ef05171SmrgAC_ARG_VAR([PERL], [Path to perl command])
8856ef05171Smrg# Preserves the interface, should it be implemented later
8866ef05171Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
8876ef05171Smrgm4_define([_defopt], m4_default([$2], [auto]))
8886ef05171SmrgAC_ARG_WITH(perl,
8896ef05171Smrg	AS_HELP_STRING([--with-perl],
8906ef05171Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
8916ef05171Smrg	   [use_perl=$withval], [use_perl=]_defopt)
8926ef05171Smrgm4_undefine([_defopt])
8936ef05171Smrg
8946ef05171Smrgif test "x$use_perl" = x"auto"; then
8956ef05171Smrg   AC_PATH_PROG([PERL], [perl])
8966ef05171Smrg   if test "x$PERL" = "x"; then
8976ef05171Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
8986ef05171Smrg	have_perl=no
8996ef05171Smrg   else
9006ef05171Smrg        have_perl=yes
9016ef05171Smrg   fi
9026ef05171Smrgelif test "x$use_perl" = x"yes" ; then
9036ef05171Smrg   AC_PATH_PROG([PERL], [perl])
9046ef05171Smrg   if test "x$PERL" = "x"; then
9056ef05171Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
9066ef05171Smrg   fi
9076ef05171Smrg   have_perl=yes
9086ef05171Smrgelif test "x$use_perl" = x"no" ; then
9096ef05171Smrg   if test "x$PERL" != "x"; then
9106ef05171Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
9116ef05171Smrg   fi
9126ef05171Smrg   have_perl=no
9136ef05171Smrgelse
9146ef05171Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
9156ef05171Smrgfi
9166ef05171Smrg
9176ef05171SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
9186ef05171Smrg]) # XORG_WITH_PERL
9196ef05171Smrg
9206ef05171Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
9216ef05171Smrg# ----------------
9226ef05171Smrg# Minimum version: 1.5.0
9236ef05171Smrg# Minimum version for optional DEFAULT argument: 1.11.0
9246ef05171Smrg#
9256ef05171Smrg# Documentation tools are not always available on all platforms and sometimes
9266ef05171Smrg# not at the appropriate level. This macro enables a module to test for the
9276ef05171Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
9286ef05171Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
9296ef05171Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
9306ef05171Smrg# --with-asciidoc assumes 'auto'.
9316ef05171Smrg#
9326ef05171Smrg# Interface to module:
9336ef05171Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
9346ef05171Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
9356ef05171Smrg#		 returns the path set by the user in the environment
9366ef05171Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
9376ef05171Smrg#		  'no' user instructs the module not to use asciidoc
9386ef05171Smrg#
9396ef05171Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
9406ef05171Smrg#
9416ef05171SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
9426ef05171SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
9436ef05171Smrgm4_define([_defopt], m4_default([$2], [auto]))
9446ef05171SmrgAC_ARG_WITH(asciidoc,
9456ef05171Smrg	AS_HELP_STRING([--with-asciidoc],
9466ef05171Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
9476ef05171Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
9486ef05171Smrgm4_undefine([_defopt])
9496ef05171Smrg
9506ef05171Smrgif test "x$use_asciidoc" = x"auto"; then
9516ef05171Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9526ef05171Smrg   if test "x$ASCIIDOC" = "x"; then
9536ef05171Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9546ef05171Smrg	have_asciidoc=no
9556ef05171Smrg   else
9566ef05171Smrg        have_asciidoc=yes
9576ef05171Smrg   fi
9586ef05171Smrgelif test "x$use_asciidoc" = x"yes" ; then
9596ef05171Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9606ef05171Smrg   if test "x$ASCIIDOC" = "x"; then
9616ef05171Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9626ef05171Smrg   fi
9636ef05171Smrg   have_asciidoc=yes
9646ef05171Smrgelif test "x$use_asciidoc" = x"no" ; then
9656ef05171Smrg   if test "x$ASCIIDOC" != "x"; then
9666ef05171Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9676ef05171Smrg   fi
9686ef05171Smrg   have_asciidoc=no
9696ef05171Smrgelse
9706ef05171Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9716ef05171Smrgfi
9726ef05171Smrgm4_ifval([$1],
9736ef05171Smrg[if test "$have_asciidoc" = yes; then
9746ef05171Smrg    # scrape the asciidoc version
9756ef05171Smrg    AC_MSG_CHECKING([the asciidoc version])
9766ef05171Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9776ef05171Smrg    AC_MSG_RESULT([$asciidoc_version])
9786ef05171Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
9796ef05171Smrg        [if test "x$use_asciidoc" = xauto; then
9806ef05171Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
9816ef05171Smrg            have_asciidoc=no
9826ef05171Smrg        else
9836ef05171Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
9846ef05171Smrg        fi])
9856ef05171Smrgfi])
9866ef05171SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
9876ef05171Smrg]) # XORG_WITH_ASCIIDOC
9886ef05171Smrg
9896ef05171Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
9906ef05171Smrg# -------------------------------------------
9916ef05171Smrg# Minimum version: 1.5.0
9926ef05171Smrg# Minimum version for optional DEFAULT argument: 1.11.0
9936ef05171Smrg# Minimum version for optional DOT checking: 1.18.0
9946ef05171Smrg#
9956ef05171Smrg# Documentation tools are not always available on all platforms and sometimes
9966ef05171Smrg# not at the appropriate level. This macro enables a module to test for the
9976ef05171Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
9986ef05171Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
9996ef05171Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
10006ef05171Smrg# --with-doxygen assumes 'auto'.
10016ef05171Smrg#
10026ef05171Smrg# Interface to module:
10036ef05171Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
10046ef05171Smrg# DOXYGEN:	 returns the path of the doxygen program found
10056ef05171Smrg#		 returns the path set by the user in the environment
10066ef05171Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
10076ef05171Smrg#		  'no' user instructs the module not to use doxygen
10086ef05171Smrg#
10096ef05171Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
10106ef05171Smrg#
10116ef05171SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
10126ef05171SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
10136ef05171SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
10146ef05171Smrgm4_define([_defopt], m4_default([$2], [auto]))
10156ef05171SmrgAC_ARG_WITH(doxygen,
10166ef05171Smrg	AS_HELP_STRING([--with-doxygen],
10176ef05171Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
10186ef05171Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
10196ef05171Smrgm4_undefine([_defopt])
10206ef05171Smrg
10216ef05171Smrgif test "x$use_doxygen" = x"auto"; then
10226ef05171Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10236ef05171Smrg   if test "x$DOXYGEN" = "x"; then
10246ef05171Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
10256ef05171Smrg	have_doxygen=no
10266ef05171Smrg   else
10276ef05171Smrg        have_doxygen=yes
10286ef05171Smrg   fi
10296ef05171Smrgelif test "x$use_doxygen" = x"yes" ; then
10306ef05171Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10316ef05171Smrg   if test "x$DOXYGEN" = "x"; then
10326ef05171Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
10336ef05171Smrg   fi
10346ef05171Smrg   have_doxygen=yes
10356ef05171Smrgelif test "x$use_doxygen" = x"no" ; then
10366ef05171Smrg   if test "x$DOXYGEN" != "x"; then
10376ef05171Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
10386ef05171Smrg   fi
10396ef05171Smrg   have_doxygen=no
10406ef05171Smrgelse
10416ef05171Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
10426ef05171Smrgfi
10436ef05171Smrgm4_ifval([$1],
10446ef05171Smrg[if test "$have_doxygen" = yes; then
10456ef05171Smrg    # scrape the doxygen version
10466ef05171Smrg    AC_MSG_CHECKING([the doxygen version])
10476ef05171Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
10486ef05171Smrg    AC_MSG_RESULT([$doxygen_version])
10496ef05171Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
10506ef05171Smrg        [if test "x$use_doxygen" = xauto; then
10516ef05171Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
10526ef05171Smrg            have_doxygen=no
10536ef05171Smrg        else
10546ef05171Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10556ef05171Smrg        fi])
10566ef05171Smrgfi])
10576ef05171Smrg
10586ef05171Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10596ef05171Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10606ef05171Smrgdnl 	HAVE_DOT = @HAVE_DOT@
10616ef05171SmrgHAVE_DOT=no
10626ef05171Smrgif test "x$have_doxygen" = "xyes"; then
10636ef05171Smrg  AC_PATH_PROG([DOT], [dot])
10646ef05171Smrg    if test "x$DOT" != "x"; then
10656ef05171Smrg      HAVE_DOT=yes
10666ef05171Smrg    fi
10676ef05171Smrgfi
10686ef05171Smrg
10696ef05171SmrgAC_SUBST([HAVE_DOT])
10706ef05171SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10716ef05171SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10726ef05171Smrg]) # XORG_WITH_DOXYGEN
10736ef05171Smrg
10746ef05171Smrg# XORG_WITH_GROFF([DEFAULT])
10756ef05171Smrg# ----------------
10766ef05171Smrg# Minimum version: 1.6.0
10776ef05171Smrg# Minimum version for optional DEFAULT argument: 1.11.0
10786ef05171Smrg#
10796ef05171Smrg# Documentation tools are not always available on all platforms and sometimes
10806ef05171Smrg# not at the appropriate level. This macro enables a module to test for the
10816ef05171Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
10826ef05171Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
10836ef05171Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
10846ef05171Smrg# --with-groff assumes 'auto'.
10856ef05171Smrg#
10866ef05171Smrg# Interface to module:
10876ef05171Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
10886ef05171Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
10896ef05171Smrg# HAVE_GROFF_MS: the -ms macros package
10906ef05171Smrg# GROFF:	 returns the path of the groff program found
10916ef05171Smrg#		 returns the path set by the user in the environment
10926ef05171Smrg# --with-groff:	 'yes' user instructs the module to use groff
10936ef05171Smrg#		 'no' user instructs the module not to use groff
10946ef05171Smrg#
10956ef05171Smrg# Added in version 1.9.0:
10966ef05171Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
10976ef05171Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
10986ef05171Smrg#		   psselect from the psutils package.
10996ef05171Smrg#		   the ghostcript package. Refer to the grohtml man pages
11006ef05171Smrg#
11016ef05171Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
11026ef05171Smrg#
11036ef05171Smrg# OS and distros often splits groff in a basic and full package, the former
11046ef05171Smrg# having the groff program and the later having devices, fonts and macros
11056ef05171Smrg# Checking for the groff executable is not enough.
11066ef05171Smrg#
11076ef05171Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
11086ef05171Smrg# unset HAVE_GROFF or GROFF env variables.
11096ef05171Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
11106ef05171Smrg#
11116ef05171SmrgAC_DEFUN([XORG_WITH_GROFF],[
11126ef05171SmrgAC_ARG_VAR([GROFF], [Path to groff command])
11136ef05171Smrgm4_define([_defopt], m4_default([$1], [auto]))
11146ef05171SmrgAC_ARG_WITH(groff,
11156ef05171Smrg	AS_HELP_STRING([--with-groff],
11166ef05171Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
11176ef05171Smrg	   [use_groff=$withval], [use_groff=]_defopt)
11186ef05171Smrgm4_undefine([_defopt])
11196ef05171Smrg
11206ef05171Smrgif test "x$use_groff" = x"auto"; then
11216ef05171Smrg   AC_PATH_PROG([GROFF], [groff])
11226ef05171Smrg   if test "x$GROFF" = "x"; then
11236ef05171Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
11246ef05171Smrg	have_groff=no
11256ef05171Smrg   else
11266ef05171Smrg        have_groff=yes
11276ef05171Smrg   fi
11286ef05171Smrgelif test "x$use_groff" = x"yes" ; then
11296ef05171Smrg   AC_PATH_PROG([GROFF], [groff])
11306ef05171Smrg   if test "x$GROFF" = "x"; then
11316ef05171Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
11326ef05171Smrg   fi
11336ef05171Smrg   have_groff=yes
11346ef05171Smrgelif test "x$use_groff" = x"no" ; then
11356ef05171Smrg   if test "x$GROFF" != "x"; then
11366ef05171Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
11376ef05171Smrg   fi
11386ef05171Smrg   have_groff=no
11396ef05171Smrgelse
11406ef05171Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
11416ef05171Smrgfi
11426ef05171Smrg
11436ef05171Smrg# We have groff, test for the presence of the macro packages
11446ef05171Smrgif test "x$have_groff" = x"yes"; then
11456ef05171Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
11466ef05171Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
11476ef05171Smrg        groff_ms_works=yes
11486ef05171Smrg    else
11496ef05171Smrg        groff_ms_works=no
11506ef05171Smrg    fi
11516ef05171Smrg    AC_MSG_RESULT([$groff_ms_works])
11526ef05171Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11536ef05171Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11546ef05171Smrg        groff_mm_works=yes
11556ef05171Smrg    else
11566ef05171Smrg        groff_mm_works=no
11576ef05171Smrg    fi
11586ef05171Smrg    AC_MSG_RESULT([$groff_mm_works])
11596ef05171Smrgfi
11606ef05171Smrg
11616ef05171Smrg# We have groff, test for HTML dependencies, one command per package
11626ef05171Smrgif test "x$have_groff" = x"yes"; then
11636ef05171Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11646ef05171Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11656ef05171Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11666ef05171Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11676ef05171Smrg      have_groff_html=yes
11686ef05171Smrg   else
11696ef05171Smrg      have_groff_html=no
11706ef05171Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11716ef05171Smrg   fi
11726ef05171Smrgfi
11736ef05171Smrg
11746ef05171Smrg# Set Automake conditionals for Makefiles
11756ef05171SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11766ef05171SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11776ef05171SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
11786ef05171SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
11796ef05171Smrg]) # XORG_WITH_GROFF
11806ef05171Smrg
11816ef05171Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
11826ef05171Smrg# ---------------------------------------
11836ef05171Smrg# Minimum version: 1.6.0
11846ef05171Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11856ef05171Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
11866ef05171Smrg#
11876ef05171Smrg# Documentation tools are not always available on all platforms and sometimes
11886ef05171Smrg# not at the appropriate level. This macro enables a module to test for the
11896ef05171Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
11906ef05171Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
11916ef05171Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
11926ef05171Smrg# --with-fop assumes 'auto'.
11936ef05171Smrg#
11946ef05171Smrg# Interface to module:
11956ef05171Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
11966ef05171Smrg# FOP:	 	returns the path of the fop program found
11976ef05171Smrg#		returns the path set by the user in the environment
11986ef05171Smrg# --with-fop: 	'yes' user instructs the module to use fop
11996ef05171Smrg#		'no' user instructs the module not to use fop
12006ef05171Smrg#
12016ef05171Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
12026ef05171Smrg#
12036ef05171SmrgAC_DEFUN([XORG_WITH_FOP],[
12046ef05171SmrgAC_ARG_VAR([FOP], [Path to fop command])
12056ef05171Smrgm4_define([_defopt], m4_default([$2], [auto]))
12066ef05171SmrgAC_ARG_WITH(fop,
12076ef05171Smrg	AS_HELP_STRING([--with-fop],
12086ef05171Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
12096ef05171Smrg	   [use_fop=$withval], [use_fop=]_defopt)
12106ef05171Smrgm4_undefine([_defopt])
12116ef05171Smrg
12126ef05171Smrgif test "x$use_fop" = x"auto"; then
12136ef05171Smrg   AC_PATH_PROG([FOP], [fop])
12146ef05171Smrg   if test "x$FOP" = "x"; then
12156ef05171Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
12166ef05171Smrg	have_fop=no
12176ef05171Smrg   else
12186ef05171Smrg        have_fop=yes
12196ef05171Smrg   fi
12206ef05171Smrgelif test "x$use_fop" = x"yes" ; then
12216ef05171Smrg   AC_PATH_PROG([FOP], [fop])
12226ef05171Smrg   if test "x$FOP" = "x"; then
12236ef05171Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
12246ef05171Smrg   fi
12256ef05171Smrg   have_fop=yes
12266ef05171Smrgelif test "x$use_fop" = x"no" ; then
12276ef05171Smrg   if test "x$FOP" != "x"; then
12286ef05171Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
12296ef05171Smrg   fi
12306ef05171Smrg   have_fop=no
12316ef05171Smrgelse
12326ef05171Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
12336ef05171Smrgfi
12346ef05171Smrg
12356ef05171Smrg# Test for a minimum version of fop, if provided.
12366ef05171Smrgm4_ifval([$1],
12376ef05171Smrg[if test "$have_fop" = yes; then
12386ef05171Smrg    # scrape the fop version
12396ef05171Smrg    AC_MSG_CHECKING([for fop minimum version])
12406ef05171Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
12416ef05171Smrg    AC_MSG_RESULT([$fop_version])
12426ef05171Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
12436ef05171Smrg        [if test "x$use_fop" = xauto; then
12446ef05171Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
12456ef05171Smrg            have_fop=no
12466ef05171Smrg        else
12476ef05171Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
12486ef05171Smrg        fi])
12496ef05171Smrgfi])
12506ef05171SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
12516ef05171Smrg]) # XORG_WITH_FOP
12526ef05171Smrg
12536ef05171Smrg# XORG_WITH_M4([MIN-VERSION])
12546ef05171Smrg# ---------------------------
12556ef05171Smrg# Minimum version: 1.19.0
12566ef05171Smrg#
12576ef05171Smrg# This macro attempts to locate an m4 macro processor which supports
12586ef05171Smrg# -I option and is only useful for modules relying on M4 in order to
12596ef05171Smrg# expand macros in source code files.
12606ef05171Smrg#
12616ef05171Smrg# Interface to module:
12626ef05171Smrg# M4:	 	returns the path of the m4 program found
12636ef05171Smrg#		returns the path set by the user in the environment
12646ef05171Smrg#
12656ef05171SmrgAC_DEFUN([XORG_WITH_M4], [
12666ef05171SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12676ef05171Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12686ef05171Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12696ef05171Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12706ef05171Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12716ef05171Smrg   [$PATH:/usr/gnu/bin])])
12726ef05171Smrg
12736ef05171SmrgAC_SUBST([M4], [$ac_cv_path_M4])
12746ef05171Smrg]) # XORG_WITH_M4
12756ef05171Smrg
12766ef05171Smrg# XORG_WITH_PS2PDF([DEFAULT])
12776ef05171Smrg# ----------------
12786ef05171Smrg# Minimum version: 1.6.0
12796ef05171Smrg# Minimum version for optional DEFAULT argument: 1.11.0
12806ef05171Smrg#
12816ef05171Smrg# Documentation tools are not always available on all platforms and sometimes
12826ef05171Smrg# not at the appropriate level. This macro enables a module to test for the
12836ef05171Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
12846ef05171Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
12856ef05171Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
12866ef05171Smrg# --with-ps2pdf assumes 'auto'.
12876ef05171Smrg#
12886ef05171Smrg# Interface to module:
12896ef05171Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
12906ef05171Smrg# PS2PDF:	returns the path of the ps2pdf program found
12916ef05171Smrg#		returns the path set by the user in the environment
12926ef05171Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
12936ef05171Smrg#		 'no' user instructs the module not to use ps2pdf
12946ef05171Smrg#
12956ef05171Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
12966ef05171Smrg#
12976ef05171SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
12986ef05171SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
12996ef05171Smrgm4_define([_defopt], m4_default([$1], [auto]))
13006ef05171SmrgAC_ARG_WITH(ps2pdf,
13016ef05171Smrg	AS_HELP_STRING([--with-ps2pdf],
13026ef05171Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
13036ef05171Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
13046ef05171Smrgm4_undefine([_defopt])
13056ef05171Smrg
13066ef05171Smrgif test "x$use_ps2pdf" = x"auto"; then
13076ef05171Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13086ef05171Smrg   if test "x$PS2PDF" = "x"; then
13096ef05171Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
13106ef05171Smrg	have_ps2pdf=no
13116ef05171Smrg   else
13126ef05171Smrg        have_ps2pdf=yes
13136ef05171Smrg   fi
13146ef05171Smrgelif test "x$use_ps2pdf" = x"yes" ; then
13156ef05171Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13166ef05171Smrg   if test "x$PS2PDF" = "x"; then
13176ef05171Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
13186ef05171Smrg   fi
13196ef05171Smrg   have_ps2pdf=yes
13206ef05171Smrgelif test "x$use_ps2pdf" = x"no" ; then
13216ef05171Smrg   if test "x$PS2PDF" != "x"; then
13226ef05171Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
13236ef05171Smrg   fi
13246ef05171Smrg   have_ps2pdf=no
13256ef05171Smrgelse
13266ef05171Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
13276ef05171Smrgfi
13286ef05171SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
13296ef05171Smrg]) # XORG_WITH_PS2PDF
13306ef05171Smrg
13316ef05171Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
13326ef05171Smrg# ----------------
13336ef05171Smrg# Minimum version: 1.6.0
13346ef05171Smrg#
13356ef05171Smrg# Documentation tools are not always available on all platforms and sometimes
13366ef05171Smrg# not at the appropriate level. This macro enables a builder to skip all
13376ef05171Smrg# documentation targets except traditional man pages.
13386ef05171Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13396ef05171Smrg# maximum flexibilty in controlling documentation building.
13406ef05171Smrg# Refer to:
13416ef05171Smrg# XORG_WITH_XMLTO         --with-xmlto
13426ef05171Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13436ef05171Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13446ef05171Smrg# XORG_WITH_FOP           --with-fop
13456ef05171Smrg# XORG_WITH_GROFF         --with-groff
13466ef05171Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13476ef05171Smrg#
13486ef05171Smrg# Interface to module:
13496ef05171Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
13506ef05171Smrg# --enable-docs: 'yes' user instructs the module to generate docs
13516ef05171Smrg#		 'no' user instructs the module not to generate docs
13526ef05171Smrg# parm1:	specify the default value, yes or no.
13536ef05171Smrg#
13546ef05171SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13556ef05171Smrgm4_define([docs_default], m4_default([$1], [yes]))
13566ef05171SmrgAC_ARG_ENABLE(docs,
13576ef05171Smrg	AS_HELP_STRING([--enable-docs],
13586ef05171Smrg	   [Enable building the documentation (default: ]docs_default[)]),
13596ef05171Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
13606ef05171Smrgm4_undefine([docs_default])
13616ef05171SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13626ef05171SmrgAC_MSG_CHECKING([whether to build documentation])
13636ef05171SmrgAC_MSG_RESULT([$build_docs])
13646ef05171Smrg]) # XORG_ENABLE_DOCS
13656ef05171Smrg
13666ef05171Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13676ef05171Smrg# ----------------
13686ef05171Smrg# Minimum version: 1.6.0
13696ef05171Smrg#
13706ef05171Smrg# This macro enables a builder to skip all developer documentation.
13716ef05171Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13726ef05171Smrg# maximum flexibilty in controlling documentation building.
13736ef05171Smrg# Refer to:
13746ef05171Smrg# XORG_WITH_XMLTO         --with-xmlto
13756ef05171Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13766ef05171Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13776ef05171Smrg# XORG_WITH_FOP           --with-fop
13786ef05171Smrg# XORG_WITH_GROFF         --with-groff
13796ef05171Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13806ef05171Smrg#
13816ef05171Smrg# Interface to module:
13826ef05171Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
13836ef05171Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
13846ef05171Smrg#			'no' user instructs the module not to generate developer docs
13856ef05171Smrg# parm1:		specify the default value, yes or no.
13866ef05171Smrg#
13876ef05171SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
13886ef05171Smrgm4_define([devel_default], m4_default([$1], [yes]))
13896ef05171SmrgAC_ARG_ENABLE(devel-docs,
13906ef05171Smrg	AS_HELP_STRING([--enable-devel-docs],
13916ef05171Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
13926ef05171Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
13936ef05171Smrgm4_undefine([devel_default])
13946ef05171SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
13956ef05171SmrgAC_MSG_CHECKING([whether to build developer documentation])
13966ef05171SmrgAC_MSG_RESULT([$build_devel_docs])
13976ef05171Smrg]) # XORG_ENABLE_DEVEL_DOCS
13986ef05171Smrg
13996ef05171Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
14006ef05171Smrg# ----------------
14016ef05171Smrg# Minimum version: 1.6.0
14026ef05171Smrg#
14036ef05171Smrg# This macro enables a builder to skip all functional specification targets.
14046ef05171Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
14056ef05171Smrg# maximum flexibilty in controlling documentation building.
14066ef05171Smrg# Refer to:
14076ef05171Smrg# XORG_WITH_XMLTO         --with-xmlto
14086ef05171Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
14096ef05171Smrg# XORG_WITH_DOXYGEN       --with-doxygen
14106ef05171Smrg# XORG_WITH_FOP           --with-fop
14116ef05171Smrg# XORG_WITH_GROFF         --with-groff
14126ef05171Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
14136ef05171Smrg#
14146ef05171Smrg# Interface to module:
14156ef05171Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
14166ef05171Smrg# --enable-specs:	'yes' user instructs the module to generate specs
14176ef05171Smrg#			'no' user instructs the module not to generate specs
14186ef05171Smrg# parm1:		specify the default value, yes or no.
14196ef05171Smrg#
14206ef05171SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
14216ef05171Smrgm4_define([spec_default], m4_default([$1], [yes]))
14226ef05171SmrgAC_ARG_ENABLE(specs,
14236ef05171Smrg	AS_HELP_STRING([--enable-specs],
14246ef05171Smrg	   [Enable building the specs (default: ]spec_default[)]),
14256ef05171Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
14266ef05171Smrgm4_undefine([spec_default])
14276ef05171SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
14286ef05171SmrgAC_MSG_CHECKING([whether to build functional specifications])
14296ef05171SmrgAC_MSG_RESULT([$build_specs])
14306ef05171Smrg]) # XORG_ENABLE_SPECS
14316ef05171Smrg
14326ef05171Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
14336ef05171Smrg# ----------------------------------------------
14346ef05171Smrg# Minimum version: 1.13.0
14356ef05171Smrg#
14366ef05171Smrg# This macro enables a builder to enable/disable unit testing
14376ef05171Smrg# It makes no assumption about the test cases implementation
14386ef05171Smrg# Test cases may or may not use Automake "Support for test suites"
14396ef05171Smrg# They may or may not use the software utility library GLib
14406ef05171Smrg#
14416ef05171Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
14426ef05171Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
14436ef05171Smrg# The variable enable_unit_tests is used by other macros in this file.
14446ef05171Smrg#
14456ef05171Smrg# Interface to module:
14466ef05171Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
14476ef05171Smrg# enable_unit_tests:    used in configure.ac for additional configuration
14486ef05171Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
14496ef05171Smrg#			'no' user instructs the module not to build tests
14506ef05171Smrg# parm1:		specify the default value, yes or no.
14516ef05171Smrg#
14526ef05171SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14536ef05171SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14546ef05171SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14556ef05171SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14566ef05171Smrgm4_define([_defopt], m4_default([$1], [auto]))
14576ef05171SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14586ef05171Smrg	[Enable building unit test cases (default: ]_defopt[)]),
14596ef05171Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14606ef05171Smrgm4_undefine([_defopt])
14616ef05171SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14626ef05171SmrgAC_MSG_CHECKING([whether to build unit test cases])
14636ef05171SmrgAC_MSG_RESULT([$enable_unit_tests])
14646ef05171Smrg]) # XORG_ENABLE_UNIT_TESTS
14656ef05171Smrg
14666ef05171Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14676ef05171Smrg# ------------------------------------------------------
14686ef05171Smrg# Minimum version: 1.17.0
14696ef05171Smrg#
14706ef05171Smrg# This macro enables a builder to enable/disable integration testing
14716ef05171Smrg# It makes no assumption about the test cases' implementation
14726ef05171Smrg# Test cases may or may not use Automake "Support for test suites"
14736ef05171Smrg#
14746ef05171Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14756ef05171Smrg# usually requires less dependencies and may be built and run under less
14766ef05171Smrg# stringent environments than integration tests.
14776ef05171Smrg#
14786ef05171Smrg# Interface to module:
14796ef05171Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
14806ef05171Smrg# enable_integration_tests:   used in configure.ac for additional configuration
14816ef05171Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
14826ef05171Smrg#                             'no' user instructs the module not to build tests
14836ef05171Smrg# parm1:                      specify the default value, yes or no.
14846ef05171Smrg#
14856ef05171SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
14866ef05171SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14876ef05171Smrgm4_define([_defopt], m4_default([$1], [auto]))
14886ef05171SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
14896ef05171Smrg	[Enable building integration test cases (default: ]_defopt[)]),
14906ef05171Smrg	[enable_integration_tests=$enableval],
14916ef05171Smrg	[enable_integration_tests=]_defopt)
14926ef05171Smrgm4_undefine([_defopt])
14936ef05171SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
14946ef05171Smrg	[test "x$enable_integration_tests" != xno])
14956ef05171SmrgAC_MSG_CHECKING([whether to build unit test cases])
14966ef05171SmrgAC_MSG_RESULT([$enable_integration_tests])
14976ef05171Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
14986ef05171Smrg
14996ef05171Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
15006ef05171Smrg# ----------------------------------------
15016ef05171Smrg# Minimum version: 1.13.0
15026ef05171Smrg#
15036ef05171Smrg# GLib is a library which provides advanced data structures and functions.
15046ef05171Smrg# This macro enables a module to test for the presence of Glib.
15056ef05171Smrg#
15066ef05171Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
15076ef05171Smrg# Otherwise the value of $enable_unit_tests is blank.
15086ef05171Smrg#
15096ef05171Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
15106ef05171Smrg# test support usually requires less dependencies and may be built and run under
15116ef05171Smrg# less stringent environments than integration tests.
15126ef05171Smrg#
15136ef05171Smrg# Interface to module:
15146ef05171Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
15156ef05171Smrg# with_glib: used in configure.ac to know if GLib has been found
15166ef05171Smrg# --with-glib:	'yes' user instructs the module to use glib
15176ef05171Smrg#		'no' user instructs the module not to use glib
15186ef05171Smrg#
15196ef05171SmrgAC_DEFUN([XORG_WITH_GLIB],[
15206ef05171SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
15216ef05171Smrgm4_define([_defopt], m4_default([$2], [auto]))
15226ef05171SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
15236ef05171Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
15246ef05171Smrg	[with_glib=$withval], [with_glib=]_defopt)
15256ef05171Smrgm4_undefine([_defopt])
15266ef05171Smrg
15276ef05171Smrghave_glib=no
15286ef05171Smrg# Do not probe GLib if user explicitly disabled unit testing
15296ef05171Smrgif test "x$enable_unit_tests" != x"no"; then
15306ef05171Smrg  # Do not probe GLib if user explicitly disabled it
15316ef05171Smrg  if test "x$with_glib" != x"no"; then
15326ef05171Smrg    m4_ifval(
15336ef05171Smrg      [$1],
15346ef05171Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
15356ef05171Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
15366ef05171Smrg    )
15376ef05171Smrg  fi
15386ef05171Smrgfi
15396ef05171Smrg
15406ef05171Smrg# Not having GLib when unit testing has been explicitly requested is an error
15416ef05171Smrgif test "x$enable_unit_tests" = x"yes"; then
15426ef05171Smrg  if test "x$have_glib" = x"no"; then
15436ef05171Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15446ef05171Smrg  fi
15456ef05171Smrgfi
15466ef05171Smrg
15476ef05171Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
15486ef05171Smrgif test "x$enable_unit_tests" = x"no"; then
15496ef05171Smrg  if test "x$with_glib" = x"yes"; then
15506ef05171Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15516ef05171Smrg  fi
15526ef05171Smrgfi
15536ef05171Smrg
15546ef05171Smrg# Not having GLib when it has been explicitly requested is an error
15556ef05171Smrgif test "x$with_glib" = x"yes"; then
15566ef05171Smrg  if test "x$have_glib" = x"no"; then
15576ef05171Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15586ef05171Smrg  fi
15596ef05171Smrgfi
15606ef05171Smrg
15616ef05171SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15626ef05171Smrg]) # XORG_WITH_GLIB
15636ef05171Smrg
15646ef05171Smrg# XORG_LD_WRAP([required|optional])
15656ef05171Smrg# ---------------------------------
15666ef05171Smrg# Minimum version: 1.13.0
15676ef05171Smrg#
15686ef05171Smrg# Check if linker supports -wrap, passed via compiler flags
15696ef05171Smrg#
15706ef05171Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15716ef05171Smrg# Otherwise the value of $enable_unit_tests is blank.
15726ef05171Smrg#
15736ef05171Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15746ef05171Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15756ef05171Smrg# available, an argument of "optional" allows use when some unit tests require
15766ef05171Smrg# ld -wrap and others do not.
15776ef05171Smrg#
15786ef05171SmrgAC_DEFUN([XORG_LD_WRAP],[
15796ef05171SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
15806ef05171Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
15816ef05171Smrg                      void __wrap_exit(int status) { return; }],
15826ef05171Smrg                     [exit(0);])])
15836ef05171Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
15846ef05171Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
15856ef05171Smrg  if test "x$have_ld_wrap" = x"no"; then
15866ef05171Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
15876ef05171Smrg  fi
15886ef05171Smrgfi
15896ef05171SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
15906ef05171Smrg#
15916ef05171Smrg]) # XORG_LD_WRAP
15926ef05171Smrg
15936ef05171Smrg# XORG_CHECK_LINKER_FLAGS
15946ef05171Smrg# -----------------------
15956ef05171Smrg# SYNOPSIS
15966ef05171Smrg#
15976ef05171Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
15986ef05171Smrg#
15996ef05171Smrg# DESCRIPTION
16006ef05171Smrg#
16016ef05171Smrg#   Check whether the given linker FLAGS work with the current language's
16026ef05171Smrg#   linker, or whether they give an error.
16036ef05171Smrg#
16046ef05171Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
16056ef05171Smrg#   success/failure.
16066ef05171Smrg#
16076ef05171Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
16086ef05171Smrg#
16096ef05171Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
16106ef05171Smrg#
16116ef05171Smrg# LICENSE
16126ef05171Smrg#
16136ef05171Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
16146ef05171Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
16156ef05171Smrg#   Copyright (c) 2009 Matteo Frigo
16166ef05171Smrg#
16176ef05171Smrg#   This program is free software: you can redistribute it and/or modify it
16186ef05171Smrg#   under the terms of the GNU General Public License as published by the
16196ef05171Smrg#   Free Software Foundation, either version 3 of the License, or (at your
16206ef05171Smrg#   option) any later version.
16216ef05171Smrg#
16226ef05171Smrg#   This program is distributed in the hope that it will be useful, but
16236ef05171Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
16246ef05171Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16256ef05171Smrg#   Public License for more details.
16266ef05171Smrg#
16276ef05171Smrg#   You should have received a copy of the GNU General Public License along
16286ef05171Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
16296ef05171Smrg#
16306ef05171Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
16316ef05171Smrg#   gives unlimited permission to copy, distribute and modify the configure
16326ef05171Smrg#   scripts that are the output of Autoconf when processing the Macro. You
16336ef05171Smrg#   need not follow the terms of the GNU General Public License when using
16346ef05171Smrg#   or distributing such scripts, even though portions of the text of the
16356ef05171Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
16366ef05171Smrg#   all other use of the material that constitutes the Autoconf Macro.
16376ef05171Smrg#
16386ef05171Smrg#   This special exception to the GPL applies to versions of the Autoconf
16396ef05171Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
16406ef05171Smrg#   modified version of the Autoconf Macro, you may extend this special
16416ef05171Smrg#   exception to the GPL to apply to your modified version as well.#
16426ef05171SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
16436ef05171Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
16446ef05171Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
16456ef05171SmrgAS_LITERAL_IF([$1],
16466ef05171Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
16476ef05171Smrg      ax_save_FLAGS=$LDFLAGS
16486ef05171Smrg      LDFLAGS="$1"
16496ef05171Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
16506ef05171Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16516ef05171Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16526ef05171Smrg      LDFLAGS=$ax_save_FLAGS])],
16536ef05171Smrg  [ax_save_FLAGS=$LDFLAGS
16546ef05171Smrg   LDFLAGS="$1"
16556ef05171Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16566ef05171Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16576ef05171Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16586ef05171Smrg   LDFLAGS=$ax_save_FLAGS])
16596ef05171Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16606ef05171SmrgAC_MSG_RESULT($xorg_check_linker_flags)
16616ef05171Smrgif test "x$xorg_check_linker_flags" = xyes; then
16626ef05171Smrg	m4_default([$2], :)
16636ef05171Smrgelse
16646ef05171Smrg	m4_default([$3], :)
16656ef05171Smrgfi
16666ef05171Smrg]) # XORG_CHECK_LINKER_FLAGS
16676ef05171Smrg
16686ef05171Smrg# XORG_MEMORY_CHECK_FLAGS
16696ef05171Smrg# -----------------------
16706ef05171Smrg# Minimum version: 1.16.0
16716ef05171Smrg#
16726ef05171Smrg# This macro attempts to find appropriate memory checking functionality
16736ef05171Smrg# for various platforms which unit testing code may use to catch various
16746ef05171Smrg# forms of memory allocation and access errors in testing.
16756ef05171Smrg#
16766ef05171Smrg# Interface to module:
16776ef05171Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
16786ef05171Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
16796ef05171Smrg#
16806ef05171Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
16816ef05171Smrg#
16826ef05171SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
16836ef05171Smrg
16846ef05171SmrgAC_REQUIRE([AC_CANONICAL_HOST])
16856ef05171SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
16866ef05171Smrg           [Environment variables to enable memory checking in tests])
16876ef05171Smrg
16886ef05171Smrg# Check for different types of support on different platforms
16896ef05171Smrgcase $host_os in
16906ef05171Smrg    solaris*)
16916ef05171Smrg        AC_CHECK_LIB([umem], [umem_alloc],
16926ef05171Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
16936ef05171Smrg        ;;
16946ef05171Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
16956ef05171Smrg        # both directly and inverted, so should not be 0 or 255.
16966ef05171Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
16976ef05171Smrg        ;;
16986ef05171Smrg    darwin*)
16996ef05171Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
17006ef05171Smrg        ;;
17016ef05171Smrg    *bsd*)
17026ef05171Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
17036ef05171Smrg        ;;
17046ef05171Smrgesac
17056ef05171Smrg
17066ef05171Smrg# User supplied flags override default flags
17076ef05171Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
17086ef05171Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
17096ef05171Smrgfi
17106ef05171Smrg
17116ef05171SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
17126ef05171Smrg]) # XORG_WITH_LINT
17136ef05171Smrg
171443f32c10Smrg# XORG_CHECK_MALLOC_ZERO
171543f32c10Smrg# ----------------------
171643f32c10Smrg# Minimum version: 1.0.0
171743f32c10Smrg#
171843f32c10Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
171943f32c10Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
172043f32c10Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
172143f32c10SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
172243f32c10SmrgAC_ARG_ENABLE(malloc0returnsnull,
17236ef05171Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
172443f32c10Smrg		       [malloc(0) returns NULL (default: auto)]),
172543f32c10Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
172643f32c10Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
172743f32c10Smrg
172843f32c10SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
172943f32c10Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
17306ef05171SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
17316ef05171Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
17326ef05171Smrg#include <stdlib.h>
17336ef05171Smrg],[
173443f32c10Smrg    char *m0, *r0, *c0, *p;
173543f32c10Smrg    m0 = malloc(0);
173643f32c10Smrg    p = malloc(10);
173743f32c10Smrg    r0 = realloc(p,0);
17386ef05171Smrg    c0 = calloc(0,10);
17396ef05171Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
17406ef05171Smrg])],
17416ef05171Smrg		[xorg_cv_malloc0_returns_null=yes],
17426ef05171Smrg		[xorg_cv_malloc0_returns_null=no])])
17436ef05171SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
174443f32c10Smrgfi
174543f32c10SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
174643f32c10Smrg
174743f32c10Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
174843f32c10Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
174943f32c10Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
175043f32c10Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
175143f32c10Smrgelse
175243f32c10Smrg	MALLOC_ZERO_CFLAGS=""
175343f32c10Smrg	XMALLOC_ZERO_CFLAGS=""
175443f32c10Smrg	XTMALLOC_ZERO_CFLAGS=""
175543f32c10Smrgfi
175643f32c10Smrg
175743f32c10SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
175843f32c10SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
175943f32c10SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
176043f32c10Smrg]) # XORG_CHECK_MALLOC_ZERO
176143f32c10Smrg
176243f32c10Smrg# XORG_WITH_LINT()
176343f32c10Smrg# ----------------
176443f32c10Smrg# Minimum version: 1.1.0
176543f32c10Smrg#
17666ef05171Smrg# This macro enables the use of a tool that flags some suspicious and
17676ef05171Smrg# non-portable constructs (likely to be bugs) in C language source code.
17686ef05171Smrg# It will attempt to locate the tool and use appropriate options.
17696ef05171Smrg# There are various lint type tools on different platforms.
17706ef05171Smrg#
17716ef05171Smrg# Interface to module:
17726ef05171Smrg# LINT:		returns the path to the tool found on the platform
17736ef05171Smrg#		or the value set to LINT on the configure cmd line
17746ef05171Smrg#		also an Automake conditional
17756ef05171Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
17766ef05171Smrg#
17776ef05171Smrg# --with-lint:	'yes' user instructs the module to use lint
17786ef05171Smrg#		'no' user instructs the module not to use lint (default)
17796ef05171Smrg#
17806ef05171Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
17816ef05171Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
178243f32c10Smrg#
178343f32c10SmrgAC_DEFUN([XORG_WITH_LINT],[
178443f32c10Smrg
17856ef05171SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
17866ef05171SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
17876ef05171SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
178843f32c10Smrg		[Use a lint-style source code checker (default: disabled)])],
178943f32c10Smrg		[use_lint=$withval], [use_lint=no])
17906ef05171Smrg
17916ef05171Smrg# Obtain platform specific info like program name and options
17926ef05171Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
17936ef05171Smrgcase $host_os in
17946ef05171Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
17956ef05171Smrg	lint_name=splint
17966ef05171Smrg	lint_options="-badflag"
17976ef05171Smrg	;;
17986ef05171Smrg  *freebsd* | *netbsd*)
17996ef05171Smrg	lint_name=lint
18006ef05171Smrg	lint_options="-u -b"
18016ef05171Smrg	;;
18026ef05171Smrg  *solaris*)
18036ef05171Smrg	lint_name=lint
18046ef05171Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
18056ef05171Smrg	;;
18066ef05171Smrgesac
18076ef05171Smrg
18086ef05171Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
18096ef05171Smrgif test "x$use_lint" = x"yes" ; then
18106ef05171Smrg   AC_PATH_PROG([LINT], [$lint_name])
18116ef05171Smrg   if test "x$LINT" = "x"; then
18126ef05171Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
18136ef05171Smrg   fi
18146ef05171Smrgelif test "x$use_lint" = x"no" ; then
18156ef05171Smrg   if test "x$LINT" != "x"; then
18166ef05171Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
18176ef05171Smrg   fi
181843f32c10Smrgelse
18196ef05171Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
18206ef05171Smrgfi
18216ef05171Smrg
18226ef05171Smrg# User supplied flags override default flags
18236ef05171Smrgif test "x$LINT_FLAGS" != "x"; then
18246ef05171Smrg   lint_options=$LINT_FLAGS
182543f32c10Smrgfi
182643f32c10Smrg
18276ef05171SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
18286ef05171SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
182943f32c10Smrg
183043f32c10Smrg]) # XORG_WITH_LINT
183143f32c10Smrg
183243f32c10Smrg# XORG_LINT_LIBRARY(LIBNAME)
183343f32c10Smrg# --------------------------
183443f32c10Smrg# Minimum version: 1.1.0
183543f32c10Smrg#
183643f32c10Smrg# Sets up flags for building lint libraries for checking programs that call
183743f32c10Smrg# functions in the library.
183843f32c10Smrg#
18396ef05171Smrg# Interface to module:
18406ef05171Smrg# LINTLIB		- Automake variable with the name of lint library file to make
18416ef05171Smrg# MAKE_LINT_LIB		- Automake conditional
18426ef05171Smrg#
18436ef05171Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
18446ef05171Smrg#			  - 'no' user instructs the module not to create a lint library (default)
184543f32c10Smrg
184643f32c10SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
184743f32c10SmrgAC_REQUIRE([XORG_WITH_LINT])
18486ef05171SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
184943f32c10Smrg	[Create lint library (default: disabled)])],
185043f32c10Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
18516ef05171Smrg
18526ef05171Smrgif test "x$make_lint_lib" = x"yes" ; then
18536ef05171Smrg   LINTLIB=llib-l$1.ln
18546ef05171Smrg   if test "x$LINT" = "x"; then
18556ef05171Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18566ef05171Smrg   fi
18576ef05171Smrgelif test "x$make_lint_lib" != x"no" ; then
18586ef05171Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
185943f32c10Smrgfi
18606ef05171Smrg
186143f32c10SmrgAC_SUBST(LINTLIB)
186243f32c10SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
186343f32c10Smrg
186443f32c10Smrg]) # XORG_LINT_LIBRARY
186543f32c10Smrg
18666ef05171Smrg# XORG_COMPILER_BRAND
18676ef05171Smrg# -------------------
18686ef05171Smrg# Minimum version: 1.14.0
18696ef05171Smrg#
18706ef05171Smrg# Checks for various brands of compilers and sets flags as appropriate:
18716ef05171Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18726ef05171Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18736ef05171Smrg#   clang compiler - sets CLANGCC to "yes"
18746ef05171Smrg#   Intel compiler - sets INTELCC to "yes"
18756ef05171Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18766ef05171Smrg#
18776ef05171SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
18786ef05171SmrgAC_LANG_CASE(
18796ef05171Smrg	[C], [
18806ef05171Smrg		AC_REQUIRE([AC_PROG_CC_C99])
18816ef05171Smrg	],
18826ef05171Smrg	[C++], [
18836ef05171Smrg		AC_REQUIRE([AC_PROG_CXX])
18846ef05171Smrg	]
18856ef05171Smrg)
18866ef05171SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
18876ef05171SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
18886ef05171SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
18896ef05171Smrg]) # XORG_COMPILER_BRAND
18906ef05171Smrg
18916ef05171Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
18926ef05171Smrg# ---------------
18936ef05171Smrg# Minimum version: 1.16.0
18946ef05171Smrg#
18956ef05171Smrg# Test if the compiler works when passed the given flag as a command line argument.
18966ef05171Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
18976ef05171Smrg# next flag in the list until there are no more options.
18986ef05171Smrg#
18996ef05171Smrg# Note that this does not guarantee that the compiler supports the flag as some
19006ef05171Smrg# compilers will simply ignore arguments that they do not understand, but we do
19016ef05171Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
19026ef05171Smrg# -Werror=unused-command-line-argument
19036ef05171Smrg#
19046ef05171SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
19056ef05171Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19066ef05171Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19076ef05171Smrg
19086ef05171SmrgAC_LANG_COMPILER_REQUIRE
19096ef05171Smrg
19106ef05171SmrgAC_LANG_CASE(
19116ef05171Smrg	[C], [
19126ef05171Smrg		AC_REQUIRE([AC_PROG_CC_C99])
19136ef05171Smrg		define([PREFIX], [C])
19146ef05171Smrg		define([CACHE_PREFIX], [cc])
19156ef05171Smrg		define([COMPILER], [$CC])
19166ef05171Smrg	],
19176ef05171Smrg	[C++], [
19186ef05171Smrg		define([PREFIX], [CXX])
19196ef05171Smrg		define([CACHE_PREFIX], [cxx])
19206ef05171Smrg		define([COMPILER], [$CXX])
19216ef05171Smrg	]
19226ef05171Smrg)
19236ef05171Smrg
19246ef05171Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
19256ef05171Smrg
19266ef05171Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
19276ef05171Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19286ef05171Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
19296ef05171Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
19306ef05171Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19316ef05171Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
19326ef05171Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
19336ef05171Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
19346ef05171Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19356ef05171Smrgfi
19366ef05171Smrg
19376ef05171Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
19386ef05171Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
19396ef05171Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19406ef05171Smrg	fi
19416ef05171Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19426ef05171Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
19436ef05171Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
19446ef05171Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19456ef05171Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
19466ef05171Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
19476ef05171Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
19486ef05171Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19496ef05171Smrgfi
19506ef05171Smrg
19516ef05171Smrgfound="no"
19526ef05171Smrgm4_foreach([flag], m4_cdr($@), [
19536ef05171Smrg	if test $found = "no" ; then
19546ef05171Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19556ef05171Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19566ef05171Smrg		fi
19576ef05171Smrg
19586ef05171Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19596ef05171Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19606ef05171Smrg		fi
19616ef05171Smrg
19626ef05171Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19636ef05171Smrg
19646ef05171Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19656ef05171Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19666ef05171Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19676ef05171Smrg		AC_CACHE_VAL($cacheid,
19686ef05171Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19696ef05171Smrg					     [eval $cacheid=yes],
19706ef05171Smrg					     [eval $cacheid=no])])
19716ef05171Smrg
19726ef05171Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19736ef05171Smrg
19746ef05171Smrg		eval supported=\$$cacheid
19756ef05171Smrg		AC_MSG_RESULT([$supported])
19766ef05171Smrg		if test "$supported" = "yes" ; then
19776ef05171Smrg			$1="$$1 ]flag["
19786ef05171Smrg			found="yes"
19796ef05171Smrg		fi
19806ef05171Smrg	fi
19816ef05171Smrg])
19826ef05171Smrg]) # XORG_TESTSET_CFLAG
19836ef05171Smrg
19846ef05171Smrg# XORG_COMPILER_FLAGS
19856ef05171Smrg# ---------------
19866ef05171Smrg# Minimum version: 1.16.0
19876ef05171Smrg#
19886ef05171Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
19896ef05171Smrg# arguments supported by the selected compiler which do NOT alter the generated
19906ef05171Smrg# code.  These arguments will cause the compiler to print various warnings
19916ef05171Smrg# during compilation AND turn a conservative set of warnings into errors.
19926ef05171Smrg#
19936ef05171Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
19946ef05171Smrg# future versions of util-macros as options are added to new compilers.
19956ef05171Smrg#
19966ef05171SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
19976ef05171SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
19986ef05171Smrg
19996ef05171SmrgAC_ARG_ENABLE(selective-werror,
20006ef05171Smrg              AS_HELP_STRING([--disable-selective-werror],
20016ef05171Smrg                             [Turn off selective compiler errors. (default: enabled)]),
20026ef05171Smrg              [SELECTIVE_WERROR=$enableval],
20036ef05171Smrg              [SELECTIVE_WERROR=yes])
20046ef05171Smrg
20056ef05171SmrgAC_LANG_CASE(
20066ef05171Smrg        [C], [
20076ef05171Smrg                define([PREFIX], [C])
20086ef05171Smrg        ],
20096ef05171Smrg        [C++], [
20106ef05171Smrg                define([PREFIX], [CXX])
20116ef05171Smrg        ]
20126ef05171Smrg)
20136ef05171Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
20146ef05171Smrgif test "x$SUNCC" = "xyes"; then
20156ef05171Smrg    [BASE_]PREFIX[FLAGS]="-v"
20166ef05171Smrgelse
20176ef05171Smrg    [BASE_]PREFIX[FLAGS]=""
20186ef05171Smrgfi
20196ef05171Smrg
20206ef05171Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
20216ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
20226ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
20236ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
20246ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
20256ef05171Smrg
20266ef05171SmrgAC_LANG_CASE(
20276ef05171Smrg	[C], [
20286ef05171Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
20296ef05171Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
20306ef05171Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
20316ef05171Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
20326ef05171Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
20336ef05171Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
20346ef05171Smrg	]
20356ef05171Smrg)
20366ef05171Smrg
20376ef05171Smrg# This chunk adds additional warnings that could catch undesired effects.
20386ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
20396ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
20406ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
20416ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
20426ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
20436ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
20446ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
20456ef05171Smrg
20466ef05171Smrg# These are currently disabled because they are noisy.  They will be enabled
20476ef05171Smrg# in the future once the codebase is sufficiently modernized to silence
20486ef05171Smrg# them.  For now, I don't want them to drown out the other warnings.
20496ef05171Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
20506ef05171Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
20516ef05171Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
20526ef05171Smrg
20536ef05171Smrg# Turn some warnings into errors, so we don't accidently get successful builds
20546ef05171Smrg# when there are problems that should be fixed.
20556ef05171Smrg
20566ef05171Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20576ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20586ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20596ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20606ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20616ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20626ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20636ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20646ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20656ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20666ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20676ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20686ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20696ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
20706ef05171Smrgelse
20716ef05171SmrgAC_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])
20726ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20736ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20746ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20756ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20766ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20776ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
20786ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
20796ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
20806ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
20816ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
20826ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
20836ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
20846ef05171SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
20856ef05171Smrgfi
20866ef05171Smrg
20876ef05171SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
20886ef05171Smrg]) # XORG_COMPILER_FLAGS
20896ef05171Smrg
20906ef05171Smrg# XORG_CWARNFLAGS
20916ef05171Smrg# ---------------
20926ef05171Smrg# Minimum version: 1.2.0
20936ef05171Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
20946ef05171Smrg#
20956ef05171Smrg# Defines CWARNFLAGS to enable C compiler warnings.
20966ef05171Smrg#
20976ef05171Smrg# This function is deprecated because it defines -fno-strict-aliasing
20986ef05171Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
20996ef05171Smrg# is needed, then it should be added explicitly in the module when
21006ef05171Smrg# it is updated to use BASE_CFLAGS.
21016ef05171Smrg#
21026ef05171SmrgAC_DEFUN([XORG_CWARNFLAGS], [
21036ef05171SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21046ef05171SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
21056ef05171SmrgAC_LANG_CASE(
21066ef05171Smrg	[C], [
21076ef05171Smrg		CWARNFLAGS="$BASE_CFLAGS"
21086ef05171Smrg		if  test "x$GCC" = xyes ; then
21096ef05171Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
21106ef05171Smrg		fi
21116ef05171Smrg		AC_SUBST(CWARNFLAGS)
21126ef05171Smrg	]
21136ef05171Smrg)
21146ef05171Smrg]) # XORG_CWARNFLAGS
21156ef05171Smrg
21166ef05171Smrg# XORG_STRICT_OPTION
21176ef05171Smrg# -----------------------
21186ef05171Smrg# Minimum version: 1.3.0
21196ef05171Smrg#
21206ef05171Smrg# Add configure option to enable strict compilation flags, such as treating
21216ef05171Smrg# warnings as fatal errors.
21226ef05171Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
21236ef05171Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
21246ef05171Smrg#
21256ef05171Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
21266ef05171Smrg# when strict compilation is unconditionally desired.
21276ef05171SmrgAC_DEFUN([XORG_STRICT_OPTION], [
21286ef05171SmrgAC_REQUIRE([XORG_CWARNFLAGS])
21296ef05171SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21306ef05171Smrg
21316ef05171SmrgAC_ARG_ENABLE(strict-compilation,
21326ef05171Smrg			  AS_HELP_STRING([--enable-strict-compilation],
21336ef05171Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
21346ef05171Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
21356ef05171Smrg
21366ef05171SmrgAC_LANG_CASE(
21376ef05171Smrg        [C], [
21386ef05171Smrg                define([PREFIX], [C])
21396ef05171Smrg        ],
21406ef05171Smrg        [C++], [
21416ef05171Smrg                define([PREFIX], [CXX])
21426ef05171Smrg        ]
21436ef05171Smrg)
21446ef05171Smrg
21456ef05171Smrg[STRICT_]PREFIX[FLAGS]=""
21466ef05171SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
21476ef05171SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
21486ef05171Smrg
21496ef05171Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
21506ef05171Smrg# activate it with -Werror, so we add it here explicitly.
21516ef05171SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
21526ef05171Smrg
21536ef05171Smrgif test "x$STRICT_COMPILE" = "xyes"; then
21546ef05171Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21556ef05171Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21566ef05171Smrgfi
21576ef05171SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21586ef05171SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21596ef05171SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21606ef05171Smrg]) # XORG_STRICT_OPTION
21616ef05171Smrg
21626ef05171Smrg# XORG_DEFAULT_OPTIONS
21636ef05171Smrg# --------------------
21646ef05171Smrg# Minimum version: 1.3.0
21656ef05171Smrg#
21666ef05171Smrg# Defines default options for X.Org modules.
21676ef05171Smrg#
21686ef05171SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21696ef05171SmrgAC_REQUIRE([AC_PROG_INSTALL])
21706ef05171SmrgXORG_COMPILER_FLAGS
21716ef05171SmrgXORG_CWARNFLAGS
21726ef05171SmrgXORG_STRICT_OPTION
21736ef05171SmrgXORG_RELEASE_VERSION
21746ef05171SmrgXORG_CHANGELOG
21756ef05171SmrgXORG_INSTALL
21766ef05171SmrgXORG_MANPAGE_SECTIONS
21776ef05171Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
21786ef05171Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
21796ef05171Smrg]) # XORG_DEFAULT_OPTIONS
21806ef05171Smrg
21816ef05171Smrg# XORG_INSTALL()
21826ef05171Smrg# ----------------
21836ef05171Smrg# Minimum version: 1.4.0
21846ef05171Smrg#
21856ef05171Smrg# Defines the variable INSTALL_CMD as the command to copy
21866ef05171Smrg# INSTALL from $prefix/share/util-macros.
21876ef05171Smrg#
21886ef05171SmrgAC_DEFUN([XORG_INSTALL], [
21896ef05171SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
21906ef05171Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
21916ef05171SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
21926ef05171Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
21936ef05171Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
21946ef05171Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
21956ef05171SmrgAC_SUBST([INSTALL_CMD])
21966ef05171Smrg]) # XORG_INSTALL
219743f32c10Smrgdnl Copyright 2005 Red Hat, Inc
219843f32c10Smrgdnl
219943f32c10Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
220043f32c10Smrgdnl documentation for any purpose is hereby granted without fee, provided that
220143f32c10Smrgdnl the above copyright notice appear in all copies and that both that
220243f32c10Smrgdnl copyright notice and this permission notice appear in supporting
220343f32c10Smrgdnl documentation.
220443f32c10Smrgdnl
220543f32c10Smrgdnl The above copyright notice and this permission notice shall be included
220643f32c10Smrgdnl in all copies or substantial portions of the Software.
220743f32c10Smrgdnl
220843f32c10Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
220943f32c10Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
221043f32c10Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
221143f32c10Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
221243f32c10Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
221343f32c10Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
221443f32c10Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
221543f32c10Smrgdnl
221643f32c10Smrgdnl Except as contained in this notice, the name of the copyright holders shall
221743f32c10Smrgdnl not be used in advertising or otherwise to promote the sale, use or
221843f32c10Smrgdnl other dealings in this Software without prior written authorization
221943f32c10Smrgdnl from the copyright holders.
222043f32c10Smrgdnl
222143f32c10Smrg
222243f32c10Smrg# XORG_RELEASE_VERSION
222343f32c10Smrg# --------------------
22246ef05171Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
22256ef05171Smrg
222643f32c10SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
222743f32c10Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
222843f32c10Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
222943f32c10Smrg		[Major version of this package])
223043f32c10Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
223143f32c10Smrg	if test "x$PVM" = "x"; then
223243f32c10Smrg		PVM="0"
223343f32c10Smrg	fi
223443f32c10Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
223543f32c10Smrg		[$PVM],
223643f32c10Smrg		[Minor version of this package])
223743f32c10Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
223843f32c10Smrg	if test "x$PVP" = "x"; then
223943f32c10Smrg		PVP="0"
224043f32c10Smrg	fi
224143f32c10Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
224243f32c10Smrg		[$PVP],
224343f32c10Smrg		[Patch version of this package])
224443f32c10Smrg])
224543f32c10Smrg
22466ef05171Smrg# XORG_CHANGELOG()
22476ef05171Smrg# ----------------
22486ef05171Smrg# Minimum version: 1.2.0
22496ef05171Smrg#
22506ef05171Smrg# Defines the variable CHANGELOG_CMD as the command to generate
22516ef05171Smrg# ChangeLog from git.
22526ef05171Smrg#
22536ef05171Smrg#
22546ef05171SmrgAC_DEFUN([XORG_CHANGELOG], [
22556ef05171SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
22566ef05171Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22576ef05171Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
22586ef05171Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
22596ef05171SmrgAC_SUBST([CHANGELOG_CMD])
22606ef05171Smrg]) # XORG_CHANGELOG
22616ef05171Smrg
22626ef05171Smrg# Copyright (C) 2002-2017 Free Software Foundation, Inc.
226343f32c10Smrg#
226443f32c10Smrg# This file is free software; the Free Software Foundation
226543f32c10Smrg# gives unlimited permission to copy and/or distribute it,
226643f32c10Smrg# with or without modifications, as long as this notice is preserved.
226743f32c10Smrg
226843f32c10Smrg# AM_AUTOMAKE_VERSION(VERSION)
226943f32c10Smrg# ----------------------------
227043f32c10Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
227143f32c10Smrg# generated from the m4 files accompanying Automake X.Y.
227243f32c10Smrg# (This private macro should not be called outside this file.)
227343f32c10SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
22746ef05171Smrg[am__api_version='1.15'
227543f32c10Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
227643f32c10Smrgdnl require some minimum version.  Point them to the right macro.
22776ef05171Smrgm4_if([$1], [1.15.1], [],
227843f32c10Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
227943f32c10Smrg])
228043f32c10Smrg
228143f32c10Smrg# _AM_AUTOCONF_VERSION(VERSION)
228243f32c10Smrg# -----------------------------
228343f32c10Smrg# aclocal traces this macro to find the Autoconf version.
228443f32c10Smrg# This is a private macro too.  Using m4_define simplifies
228543f32c10Smrg# the logic in aclocal, which can simply ignore this definition.
228643f32c10Smrgm4_define([_AM_AUTOCONF_VERSION], [])
228743f32c10Smrg
228843f32c10Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
228943f32c10Smrg# -------------------------------
229043f32c10Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
22916ef05171Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
229243f32c10SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
22936ef05171Smrg[AM_AUTOMAKE_VERSION([1.15.1])dnl
229443f32c10Smrgm4_ifndef([AC_AUTOCONF_VERSION],
229543f32c10Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
22966ef05171Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
229743f32c10Smrg
229843f32c10Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
229943f32c10Smrg
23006ef05171Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
230143f32c10Smrg#
230243f32c10Smrg# This file is free software; the Free Software Foundation
230343f32c10Smrg# gives unlimited permission to copy and/or distribute it,
230443f32c10Smrg# with or without modifications, as long as this notice is preserved.
230543f32c10Smrg
230643f32c10Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
23076ef05171Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
23086ef05171Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
230943f32c10Smrg#
231043f32c10Smrg# Of course, Automake must honor this variable whenever it calls a
231143f32c10Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
231243f32c10Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
231343f32c10Smrg# depending on how configure is run.  This is pretty annoying, since
231443f32c10Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
231543f32c10Smrg# source directory, any form will work fine, but in subdirectories a
231643f32c10Smrg# relative path needs to be adjusted first.
231743f32c10Smrg#
231843f32c10Smrg# $ac_aux_dir/missing
231943f32c10Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
232043f32c10Smrg# $top_srcdir/$ac_aux_dir/missing
232143f32c10Smrg#    fails if $ac_aux_dir is absolute,
232243f32c10Smrg#    fails when called from a subdirectory in a VPATH build with
232343f32c10Smrg#          a relative $ac_aux_dir
232443f32c10Smrg#
232543f32c10Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
232643f32c10Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
23276ef05171Smrg# harmless because $srcdir is '.', but things will broke when you
232843f32c10Smrg# start a VPATH build or use an absolute $srcdir.
232943f32c10Smrg#
233043f32c10Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
233143f32c10Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
233243f32c10Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
233343f32c10Smrg# and then we would define $MISSING as
233443f32c10Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
233543f32c10Smrg# This will work as long as MISSING is not called from configure, because
233643f32c10Smrg# unfortunately $(top_srcdir) has no meaning in configure.
233743f32c10Smrg# However there are other variables, like CC, which are often used in
233843f32c10Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
233943f32c10Smrg#
234043f32c10Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
234143f32c10Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
234243f32c10Smrg# configured tree to be moved without reconfiguration.
234343f32c10Smrg
234443f32c10SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
23456ef05171Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
23466ef05171Smrg# Expand $ac_aux_dir to an absolute path.
23476ef05171Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
234843f32c10Smrg])
234943f32c10Smrg
235043f32c10Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
235143f32c10Smrg
23526ef05171Smrg# Copyright (C) 1997-2017 Free Software Foundation, Inc.
235343f32c10Smrg#
235443f32c10Smrg# This file is free software; the Free Software Foundation
235543f32c10Smrg# gives unlimited permission to copy and/or distribute it,
235643f32c10Smrg# with or without modifications, as long as this notice is preserved.
235743f32c10Smrg
235843f32c10Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
235943f32c10Smrg# -------------------------------------
236043f32c10Smrg# Define a conditional.
236143f32c10SmrgAC_DEFUN([AM_CONDITIONAL],
23626ef05171Smrg[AC_PREREQ([2.52])dnl
23636ef05171Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23646ef05171Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
236543f32c10SmrgAC_SUBST([$1_TRUE])dnl
236643f32c10SmrgAC_SUBST([$1_FALSE])dnl
236743f32c10Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
236843f32c10Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23696ef05171Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
237043f32c10Smrgif $2; then
237143f32c10Smrg  $1_TRUE=
237243f32c10Smrg  $1_FALSE='#'
237343f32c10Smrgelse
237443f32c10Smrg  $1_TRUE='#'
237543f32c10Smrg  $1_FALSE=
237643f32c10Smrgfi
237743f32c10SmrgAC_CONFIG_COMMANDS_PRE(
237843f32c10Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
237943f32c10Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
238043f32c10SmrgUsually this means the macro was only invoked conditionally.]])
238143f32c10Smrgfi])])
238243f32c10Smrg
23836ef05171Smrg# Copyright (C) 1999-2017 Free Software Foundation, Inc.
238443f32c10Smrg#
238543f32c10Smrg# This file is free software; the Free Software Foundation
238643f32c10Smrg# gives unlimited permission to copy and/or distribute it,
238743f32c10Smrg# with or without modifications, as long as this notice is preserved.
238843f32c10Smrg
238943f32c10Smrg
23906ef05171Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
239143f32c10Smrg# written in clear, in which case automake, when reading aclocal.m4,
239243f32c10Smrg# will think it sees a *use*, and therefore will trigger all it's
239343f32c10Smrg# C support machinery.  Also note that it means that autoscan, seeing
239443f32c10Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
239543f32c10Smrg
239643f32c10Smrg
239743f32c10Smrg# _AM_DEPENDENCIES(NAME)
239843f32c10Smrg# ----------------------
239943f32c10Smrg# See how the compiler implements dependency checking.
24006ef05171Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
240143f32c10Smrg# We try a few techniques and use that to set a single cache variable.
240243f32c10Smrg#
240343f32c10Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
240443f32c10Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
240543f32c10Smrg# dependency, and given that the user is not expected to run this macro,
240643f32c10Smrg# just rely on AC_PROG_CC.
240743f32c10SmrgAC_DEFUN([_AM_DEPENDENCIES],
240843f32c10Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
240943f32c10SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
241043f32c10SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
241143f32c10SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
241243f32c10Smrg
24136ef05171Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
24146ef05171Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
24156ef05171Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
24166ef05171Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
24176ef05171Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
24186ef05171Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
24196ef05171Smrg                    [depcc="$$1"   am_compiler_list=])
242043f32c10Smrg
242143f32c10SmrgAC_CACHE_CHECK([dependency style of $depcc],
242243f32c10Smrg               [am_cv_$1_dependencies_compiler_type],
242343f32c10Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
242443f32c10Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
242543f32c10Smrg  # making bogus files that we don't know about and never remove.  For
242643f32c10Smrg  # instance it was reported that on HP-UX the gcc test will end up
24276ef05171Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
24286ef05171Smrg  # in D".
24296ef05171Smrg  rm -rf conftest.dir
243043f32c10Smrg  mkdir conftest.dir
243143f32c10Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
243243f32c10Smrg  # using a relative directory.
243343f32c10Smrg  cp "$am_depcomp" conftest.dir
243443f32c10Smrg  cd conftest.dir
243543f32c10Smrg  # We will build objects and dependencies in a subdirectory because
243643f32c10Smrg  # it helps to detect inapplicable dependency modes.  For instance
243743f32c10Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
243843f32c10Smrg  # side effect of compilation, but ICC will put the dependencies in
243943f32c10Smrg  # the current directory while Tru64 will put them in the object
244043f32c10Smrg  # directory.
244143f32c10Smrg  mkdir sub
244243f32c10Smrg
244343f32c10Smrg  am_cv_$1_dependencies_compiler_type=none
244443f32c10Smrg  if test "$am_compiler_list" = ""; then
244543f32c10Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
244643f32c10Smrg  fi
24476ef05171Smrg  am__universal=false
24486ef05171Smrg  m4_case([$1], [CC],
24496ef05171Smrg    [case " $depcc " in #(
24506ef05171Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24516ef05171Smrg     esac],
24526ef05171Smrg    [CXX],
24536ef05171Smrg    [case " $depcc " in #(
24546ef05171Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24556ef05171Smrg     esac])
24566ef05171Smrg
245743f32c10Smrg  for depmode in $am_compiler_list; do
245843f32c10Smrg    # Setup a source with many dependencies, because some compilers
245943f32c10Smrg    # like to wrap large dependency lists on column 80 (with \), and
246043f32c10Smrg    # we should not choose a depcomp mode which is confused by this.
246143f32c10Smrg    #
246243f32c10Smrg    # We need to recreate these files for each test, as the compiler may
246343f32c10Smrg    # overwrite some of them when testing with obscure command lines.
246443f32c10Smrg    # This happens at least with the AIX C compiler.
246543f32c10Smrg    : > sub/conftest.c
246643f32c10Smrg    for i in 1 2 3 4 5 6; do
246743f32c10Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24686ef05171Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24696ef05171Smrg      # Solaris 10 /bin/sh.
24706ef05171Smrg      echo '/* dummy */' > sub/conftst$i.h
247143f32c10Smrg    done
247243f32c10Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
247343f32c10Smrg
24746ef05171Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24756ef05171Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24766ef05171Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
24776ef05171Smrg    # versions had trouble with output in subdirs.
24786ef05171Smrg    am__obj=sub/conftest.${OBJEXT-o}
24796ef05171Smrg    am__minus_obj="-o $am__obj"
248043f32c10Smrg    case $depmode in
24816ef05171Smrg    gcc)
24826ef05171Smrg      # This depmode causes a compiler race in universal mode.
24836ef05171Smrg      test "$am__universal" = false || continue
24846ef05171Smrg      ;;
248543f32c10Smrg    nosideeffect)
24866ef05171Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24876ef05171Smrg      # only be used when explicitly requested.
248843f32c10Smrg      if test "x$enable_dependency_tracking" = xyes; then
248943f32c10Smrg	continue
249043f32c10Smrg      else
249143f32c10Smrg	break
249243f32c10Smrg      fi
249343f32c10Smrg      ;;
24946ef05171Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
24956ef05171Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
24966ef05171Smrg      # not run yet.  These depmodes are late enough in the game, and
24976ef05171Smrg      # so weak that their functioning should not be impacted.
24986ef05171Smrg      am__obj=conftest.${OBJEXT-o}
24996ef05171Smrg      am__minus_obj=
25006ef05171Smrg      ;;
250143f32c10Smrg    none) break ;;
250243f32c10Smrg    esac
250343f32c10Smrg    if depmode=$depmode \
25046ef05171Smrg       source=sub/conftest.c object=$am__obj \
250543f32c10Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
25066ef05171Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
250743f32c10Smrg         >/dev/null 2>conftest.err &&
250843f32c10Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
250943f32c10Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
25106ef05171Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
251143f32c10Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
251243f32c10Smrg      # icc doesn't choke on unknown options, it will just issue warnings
251343f32c10Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
251443f32c10Smrg      # that says an option was ignored or not supported.
251543f32c10Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
251643f32c10Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
251743f32c10Smrg      # The diagnosis changed in icc 8.0:
251843f32c10Smrg      #   icc: Command line remark: option '-MP' not supported
251943f32c10Smrg      if (grep 'ignoring option' conftest.err ||
252043f32c10Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
252143f32c10Smrg        am_cv_$1_dependencies_compiler_type=$depmode
252243f32c10Smrg        break
252343f32c10Smrg      fi
252443f32c10Smrg    fi
252543f32c10Smrg  done
252643f32c10Smrg
252743f32c10Smrg  cd ..
252843f32c10Smrg  rm -rf conftest.dir
252943f32c10Smrgelse
253043f32c10Smrg  am_cv_$1_dependencies_compiler_type=none
253143f32c10Smrgfi
253243f32c10Smrg])
253343f32c10SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
253443f32c10SmrgAM_CONDITIONAL([am__fastdep$1], [
253543f32c10Smrg  test "x$enable_dependency_tracking" != xno \
253643f32c10Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
253743f32c10Smrg])
253843f32c10Smrg
253943f32c10Smrg
254043f32c10Smrg# AM_SET_DEPDIR
254143f32c10Smrg# -------------
254243f32c10Smrg# Choose a directory name for dependency files.
25436ef05171Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
254443f32c10SmrgAC_DEFUN([AM_SET_DEPDIR],
254543f32c10Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
254643f32c10SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
254743f32c10Smrg])
254843f32c10Smrg
254943f32c10Smrg
255043f32c10Smrg# AM_DEP_TRACK
255143f32c10Smrg# ------------
255243f32c10SmrgAC_DEFUN([AM_DEP_TRACK],
25536ef05171Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25546ef05171SmrgAS_HELP_STRING(
25556ef05171Smrg  [--enable-dependency-tracking],
25566ef05171Smrg  [do not reject slow dependency extractors])
25576ef05171SmrgAS_HELP_STRING(
25586ef05171Smrg  [--disable-dependency-tracking],
25596ef05171Smrg  [speeds up one-time build])])
256043f32c10Smrgif test "x$enable_dependency_tracking" != xno; then
256143f32c10Smrg  am_depcomp="$ac_aux_dir/depcomp"
256243f32c10Smrg  AMDEPBACKSLASH='\'
25636ef05171Smrg  am__nodep='_no'
256443f32c10Smrgfi
256543f32c10SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
256643f32c10SmrgAC_SUBST([AMDEPBACKSLASH])dnl
256743f32c10Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25686ef05171SmrgAC_SUBST([am__nodep])dnl
25696ef05171Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
257043f32c10Smrg])
257143f32c10Smrg
257243f32c10Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
257343f32c10Smrg
25746ef05171Smrg# Copyright (C) 1999-2017 Free Software Foundation, Inc.
257543f32c10Smrg#
257643f32c10Smrg# This file is free software; the Free Software Foundation
257743f32c10Smrg# gives unlimited permission to copy and/or distribute it,
257843f32c10Smrg# with or without modifications, as long as this notice is preserved.
257943f32c10Smrg
258043f32c10Smrg
258143f32c10Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
258243f32c10Smrg# ------------------------------
258343f32c10SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
25846ef05171Smrg[{
25856ef05171Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
25866ef05171Smrg  # are listed without --file.  Let's play safe and only enable the eval
25876ef05171Smrg  # if we detect the quoting.
25886ef05171Smrg  case $CONFIG_FILES in
25896ef05171Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
25906ef05171Smrg  *)   set x $CONFIG_FILES ;;
25916ef05171Smrg  esac
25926ef05171Smrg  shift
25936ef05171Smrg  for mf
25946ef05171Smrg  do
25956ef05171Smrg    # Strip MF so we end up with the name of the file.
25966ef05171Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
25976ef05171Smrg    # Check whether this is an Automake generated Makefile or not.
25986ef05171Smrg    # We used to match only the files named 'Makefile.in', but
25996ef05171Smrg    # some people rename them; so instead we look at the file content.
26006ef05171Smrg    # Grep'ing the first line is not enough: some people post-process
26016ef05171Smrg    # each Makefile.in and add a new line on top of each file to say so.
26026ef05171Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
26036ef05171Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
26046ef05171Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
26056ef05171Smrg      dirpart=`AS_DIRNAME("$mf")`
26066ef05171Smrg    else
26076ef05171Smrg      continue
26086ef05171Smrg    fi
26096ef05171Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
26106ef05171Smrg    # from the Makefile without running 'make'.
26116ef05171Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
26126ef05171Smrg    test -z "$DEPDIR" && continue
26136ef05171Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
26146ef05171Smrg    test -z "$am__include" && continue
26156ef05171Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
26166ef05171Smrg    # Find all dependency output files, they are included files with
26176ef05171Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
26186ef05171Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
26196ef05171Smrg    # expansion.
26206ef05171Smrg    for file in `sed -n "
26216ef05171Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
26226ef05171Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
26236ef05171Smrg      # Make sure the directory exists.
26246ef05171Smrg      test -f "$dirpart/$file" && continue
26256ef05171Smrg      fdir=`AS_DIRNAME(["$file"])`
26266ef05171Smrg      AS_MKDIR_P([$dirpart/$fdir])
26276ef05171Smrg      # echo "creating $dirpart/$file"
26286ef05171Smrg      echo '# dummy' > "$dirpart/$file"
26296ef05171Smrg    done
263043f32c10Smrg  done
26316ef05171Smrg}
263243f32c10Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
263343f32c10Smrg
263443f32c10Smrg
263543f32c10Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
263643f32c10Smrg# -----------------------------
263743f32c10Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
263843f32c10Smrg#
263943f32c10Smrg# This code is only required when automatic dependency tracking
26406ef05171Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
264143f32c10Smrg# need in order to bootstrap the dependency handling code.
264243f32c10SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
264343f32c10Smrg[AC_CONFIG_COMMANDS([depfiles],
264443f32c10Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
264543f32c10Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
264643f32c10Smrg])
264743f32c10Smrg
264843f32c10Smrg# Do all the work for Automake.                             -*- Autoconf -*-
264943f32c10Smrg
26506ef05171Smrg# Copyright (C) 1996-2017 Free Software Foundation, Inc.
265143f32c10Smrg#
265243f32c10Smrg# This file is free software; the Free Software Foundation
265343f32c10Smrg# gives unlimited permission to copy and/or distribute it,
265443f32c10Smrg# with or without modifications, as long as this notice is preserved.
265543f32c10Smrg
265643f32c10Smrg# This macro actually does too much.  Some checks are only needed if
265743f32c10Smrg# your package does certain things.  But this isn't really a big deal.
265843f32c10Smrg
26596ef05171Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26606ef05171Smrgm4_define([AC_PROG_CC],
26616ef05171Smrgm4_defn([AC_PROG_CC])
26626ef05171Smrg[_AM_PROG_CC_C_O
26636ef05171Smrg])
26646ef05171Smrg
266543f32c10Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
266643f32c10Smrg# AM_INIT_AUTOMAKE([OPTIONS])
266743f32c10Smrg# -----------------------------------------------
266843f32c10Smrg# The call with PACKAGE and VERSION arguments is the old style
266943f32c10Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
267043f32c10Smrg# and VERSION should now be passed to AC_INIT and removed from
267143f32c10Smrg# the call to AM_INIT_AUTOMAKE.
267243f32c10Smrg# We support both call styles for the transition.  After
267343f32c10Smrg# the next Automake release, Autoconf can make the AC_INIT
267443f32c10Smrg# arguments mandatory, and then we can depend on a new Autoconf
267543f32c10Smrg# release and drop the old call support.
267643f32c10SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
26776ef05171Smrg[AC_PREREQ([2.65])dnl
267843f32c10Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
267943f32c10Smrgdnl the ones we care about.
268043f32c10Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
268143f32c10SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
268243f32c10SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
268343f32c10Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
268443f32c10Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
268543f32c10Smrg  # is not polluted with repeated "-I."
268643f32c10Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
268743f32c10Smrg  # test to see if srcdir already configured
268843f32c10Smrg  if test -f $srcdir/config.status; then
268943f32c10Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
269043f32c10Smrg  fi
269143f32c10Smrgfi
269243f32c10Smrg
269343f32c10Smrg# test whether we have cygpath
269443f32c10Smrgif test -z "$CYGPATH_W"; then
269543f32c10Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
269643f32c10Smrg    CYGPATH_W='cygpath -w'
269743f32c10Smrg  else
269843f32c10Smrg    CYGPATH_W=echo
269943f32c10Smrg  fi
270043f32c10Smrgfi
270143f32c10SmrgAC_SUBST([CYGPATH_W])
270243f32c10Smrg
270343f32c10Smrg# Define the identity of the package.
270443f32c10Smrgdnl Distinguish between old-style and new-style calls.
270543f32c10Smrgm4_ifval([$2],
27066ef05171Smrg[AC_DIAGNOSE([obsolete],
27076ef05171Smrg             [$0: two- and three-arguments forms are deprecated.])
27086ef05171Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
270943f32c10Smrg AC_SUBST([PACKAGE], [$1])dnl
271043f32c10Smrg AC_SUBST([VERSION], [$2])],
271143f32c10Smrg[_AM_SET_OPTIONS([$1])dnl
271243f32c10Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
27136ef05171Smrgm4_if(
27146ef05171Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
27156ef05171Smrg  [ok:ok],,
271643f32c10Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
271743f32c10Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
271843f32c10Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
271943f32c10Smrg
272043f32c10Smrg_AM_IF_OPTION([no-define],,
27216ef05171Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
27226ef05171Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
272343f32c10Smrg
272443f32c10Smrg# Some tools Automake needs.
272543f32c10SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
272643f32c10SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
27276ef05171SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
27286ef05171SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
27296ef05171SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
27306ef05171SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
27316ef05171SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
27326ef05171SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
27336ef05171SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
27346ef05171SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
27356ef05171Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
27366ef05171Smrg# dies out for good.  For more background, see:
27376ef05171Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
27386ef05171Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
27396ef05171SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
27406ef05171Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
27416ef05171Smrg# system "awk" is bad on some platforms.
274243f32c10SmrgAC_REQUIRE([AC_PROG_AWK])dnl
274343f32c10SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
274443f32c10SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
274543f32c10Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
27466ef05171Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
27476ef05171Smrg			     [_AM_PROG_TAR([v7])])])
274843f32c10Smrg_AM_IF_OPTION([no-dependencies],,
274943f32c10Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
27506ef05171Smrg		  [_AM_DEPENDENCIES([CC])],
27516ef05171Smrg		  [m4_define([AC_PROG_CC],
27526ef05171Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
275343f32c10SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27546ef05171Smrg		  [_AM_DEPENDENCIES([CXX])],
27556ef05171Smrg		  [m4_define([AC_PROG_CXX],
27566ef05171Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
275743f32c10SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27586ef05171Smrg		  [_AM_DEPENDENCIES([OBJC])],
27596ef05171Smrg		  [m4_define([AC_PROG_OBJC],
27606ef05171Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27616ef05171SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27626ef05171Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
27636ef05171Smrg		  [m4_define([AC_PROG_OBJCXX],
27646ef05171Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
276543f32c10Smrg])
27666ef05171SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
27676ef05171Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
27686ef05171Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
27696ef05171Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
27706ef05171SmrgAC_CONFIG_COMMANDS_PRE(dnl
27716ef05171Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
27726ef05171Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
27736ef05171Smrg
27746ef05171Smrg# POSIX will say in a future version that running "rm -f" with no argument
27756ef05171Smrg# is OK; and we want to be able to make that assumption in our Makefile
27766ef05171Smrg# recipes.  So use an aggressive probe to check that the usage we want is
27776ef05171Smrg# actually supported "in the wild" to an acceptable degree.
27786ef05171Smrg# See automake bug#10828.
27796ef05171Smrg# To make any issue more visible, cause the running configure to be aborted
27806ef05171Smrg# by default if the 'rm' program in use doesn't match our expectations; the
27816ef05171Smrg# user can still override this though.
27826ef05171Smrgif rm -f && rm -fr && rm -rf; then : OK; else
27836ef05171Smrg  cat >&2 <<'END'
27846ef05171SmrgOops!
27856ef05171Smrg
27866ef05171SmrgYour 'rm' program seems unable to run without file operands specified
27876ef05171Smrgon the command line, even when the '-f' option is present.  This is contrary
27886ef05171Smrgto the behaviour of most rm programs out there, and not conforming with
27896ef05171Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
27906ef05171Smrg
27916ef05171SmrgPlease tell bug-automake@gnu.org about your system, including the value
27926ef05171Smrgof your $PATH and any error possibly output before this message.  This
27936ef05171Smrgcan help us improve future automake versions.
27946ef05171Smrg
27956ef05171SmrgEND
27966ef05171Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
27976ef05171Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
27986ef05171Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
27996ef05171Smrg    echo >&2
28006ef05171Smrg  else
28016ef05171Smrg    cat >&2 <<'END'
28026ef05171SmrgAborting the configuration process, to ensure you take notice of the issue.
28036ef05171Smrg
28046ef05171SmrgYou can download and install GNU coreutils to get an 'rm' implementation
28056ef05171Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
28066ef05171Smrg
28076ef05171SmrgIf you want to complete the configuration process using your problematic
28086ef05171Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
28096ef05171Smrgto "yes", and re-run configure.
28106ef05171Smrg
28116ef05171SmrgEND
28126ef05171Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
28136ef05171Smrg  fi
28146ef05171Smrgfi
28156ef05171Smrgdnl The trailing newline in this macro's definition is deliberate, for
28166ef05171Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
28176ef05171Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
281843f32c10Smrg])
281943f32c10Smrg
28206ef05171Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
28216ef05171Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
28226ef05171Smrgdnl mangled by Autoconf and run in a shell conditional statement.
28236ef05171Smrgm4_define([_AC_COMPILER_EXEEXT],
28246ef05171Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
282543f32c10Smrg
282643f32c10Smrg# When config.status generates a header, we must update the stamp-h file.
282743f32c10Smrg# This file resides in the same directory as the config header
282843f32c10Smrg# that is generated.  The stamp files are numbered to have different names.
282943f32c10Smrg
283043f32c10Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
283143f32c10Smrg# loop where config.status creates the headers, so we can generate
283243f32c10Smrg# our stamp files there.
283343f32c10SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
283443f32c10Smrg[# Compute $1's index in $config_headers.
283543f32c10Smrg_am_arg=$1
283643f32c10Smrg_am_stamp_count=1
283743f32c10Smrgfor _am_header in $config_headers :; do
283843f32c10Smrg  case $_am_header in
283943f32c10Smrg    $_am_arg | $_am_arg:* )
284043f32c10Smrg      break ;;
284143f32c10Smrg    * )
284243f32c10Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
284343f32c10Smrg  esac
284443f32c10Smrgdone
284543f32c10Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
284643f32c10Smrg
28476ef05171Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
284843f32c10Smrg#
284943f32c10Smrg# This file is free software; the Free Software Foundation
285043f32c10Smrg# gives unlimited permission to copy and/or distribute it,
285143f32c10Smrg# with or without modifications, as long as this notice is preserved.
285243f32c10Smrg
285343f32c10Smrg# AM_PROG_INSTALL_SH
285443f32c10Smrg# ------------------
285543f32c10Smrg# Define $install_sh.
285643f32c10SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
285743f32c10Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
28586ef05171Smrgif test x"${install_sh+set}" != xset; then
28596ef05171Smrg  case $am_aux_dir in
28606ef05171Smrg  *\ * | *\	*)
28616ef05171Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
28626ef05171Smrg  *)
28636ef05171Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
28646ef05171Smrg  esac
28656ef05171Smrgfi
28666ef05171SmrgAC_SUBST([install_sh])])
286743f32c10Smrg
28686ef05171Smrg# Copyright (C) 2003-2017 Free Software Foundation, Inc.
286943f32c10Smrg#
287043f32c10Smrg# This file is free software; the Free Software Foundation
287143f32c10Smrg# gives unlimited permission to copy and/or distribute it,
287243f32c10Smrg# with or without modifications, as long as this notice is preserved.
287343f32c10Smrg
287443f32c10Smrg# Check whether the underlying file-system supports filenames
287543f32c10Smrg# with a leading dot.  For instance MS-DOS doesn't.
287643f32c10SmrgAC_DEFUN([AM_SET_LEADING_DOT],
287743f32c10Smrg[rm -rf .tst 2>/dev/null
287843f32c10Smrgmkdir .tst 2>/dev/null
287943f32c10Smrgif test -d .tst; then
288043f32c10Smrg  am__leading_dot=.
288143f32c10Smrgelse
288243f32c10Smrg  am__leading_dot=_
288343f32c10Smrgfi
288443f32c10Smrgrmdir .tst 2>/dev/null
288543f32c10SmrgAC_SUBST([am__leading_dot])])
288643f32c10Smrg
288743f32c10Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
288843f32c10Smrg
28896ef05171Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
289043f32c10Smrg#
289143f32c10Smrg# This file is free software; the Free Software Foundation
289243f32c10Smrg# gives unlimited permission to copy and/or distribute it,
289343f32c10Smrg# with or without modifications, as long as this notice is preserved.
289443f32c10Smrg
289543f32c10Smrg# AM_MAKE_INCLUDE()
289643f32c10Smrg# -----------------
289743f32c10Smrg# Check to see how make treats includes.
289843f32c10SmrgAC_DEFUN([AM_MAKE_INCLUDE],
289943f32c10Smrg[am_make=${MAKE-make}
290043f32c10Smrgcat > confinc << 'END'
290143f32c10Smrgam__doit:
29026ef05171Smrg	@echo this is the am__doit target
290343f32c10Smrg.PHONY: am__doit
290443f32c10SmrgEND
290543f32c10Smrg# If we don't find an include directive, just comment out the code.
290643f32c10SmrgAC_MSG_CHECKING([for style of include used by $am_make])
290743f32c10Smrgam__include="#"
290843f32c10Smrgam__quote=
290943f32c10Smrg_am_result=none
291043f32c10Smrg# First try GNU make style include.
291143f32c10Smrgecho "include confinc" > confmf
29126ef05171Smrg# Ignore all kinds of additional output from 'make'.
29136ef05171Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
29146ef05171Smrg*the\ am__doit\ target*)
29156ef05171Smrg  am__include=include
29166ef05171Smrg  am__quote=
29176ef05171Smrg  _am_result=GNU
29186ef05171Smrg  ;;
29196ef05171Smrgesac
292043f32c10Smrg# Now try BSD make style include.
292143f32c10Smrgif test "$am__include" = "#"; then
292243f32c10Smrg   echo '.include "confinc"' > confmf
29236ef05171Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
29246ef05171Smrg   *the\ am__doit\ target*)
29256ef05171Smrg     am__include=.include
29266ef05171Smrg     am__quote="\""
29276ef05171Smrg     _am_result=BSD
29286ef05171Smrg     ;;
29296ef05171Smrg   esac
293043f32c10Smrgfi
293143f32c10SmrgAC_SUBST([am__include])
293243f32c10SmrgAC_SUBST([am__quote])
293343f32c10SmrgAC_MSG_RESULT([$_am_result])
293443f32c10Smrgrm -f confinc confmf
293543f32c10Smrg])
293643f32c10Smrg
293743f32c10Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
293843f32c10Smrg
29396ef05171Smrg# Copyright (C) 1997-2017 Free Software Foundation, Inc.
294043f32c10Smrg#
294143f32c10Smrg# This file is free software; the Free Software Foundation
294243f32c10Smrg# gives unlimited permission to copy and/or distribute it,
294343f32c10Smrg# with or without modifications, as long as this notice is preserved.
294443f32c10Smrg
294543f32c10Smrg# AM_MISSING_PROG(NAME, PROGRAM)
294643f32c10Smrg# ------------------------------
294743f32c10SmrgAC_DEFUN([AM_MISSING_PROG],
294843f32c10Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
294943f32c10Smrg$1=${$1-"${am_missing_run}$2"}
295043f32c10SmrgAC_SUBST($1)])
295143f32c10Smrg
295243f32c10Smrg# AM_MISSING_HAS_RUN
295343f32c10Smrg# ------------------
29546ef05171Smrg# Define MISSING if not defined so far and test if it is modern enough.
29556ef05171Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
295643f32c10SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
295743f32c10Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
295843f32c10SmrgAC_REQUIRE_AUX_FILE([missing])dnl
29596ef05171Smrgif test x"${MISSING+set}" != xset; then
29606ef05171Smrg  case $am_aux_dir in
29616ef05171Smrg  *\ * | *\	*)
29626ef05171Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
29636ef05171Smrg  *)
29646ef05171Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
29656ef05171Smrg  esac
29666ef05171Smrgfi
296743f32c10Smrg# Use eval to expand $SHELL
29686ef05171Smrgif eval "$MISSING --is-lightweight"; then
29696ef05171Smrg  am_missing_run="$MISSING "
297043f32c10Smrgelse
297143f32c10Smrg  am_missing_run=
29726ef05171Smrg  AC_MSG_WARN(['missing' script is too old or missing])
297343f32c10Smrgfi
297443f32c10Smrg])
297543f32c10Smrg
297643f32c10Smrg# Helper functions for option handling.                     -*- Autoconf -*-
297743f32c10Smrg
29786ef05171Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
297943f32c10Smrg#
298043f32c10Smrg# This file is free software; the Free Software Foundation
298143f32c10Smrg# gives unlimited permission to copy and/or distribute it,
298243f32c10Smrg# with or without modifications, as long as this notice is preserved.
298343f32c10Smrg
298443f32c10Smrg# _AM_MANGLE_OPTION(NAME)
298543f32c10Smrg# -----------------------
298643f32c10SmrgAC_DEFUN([_AM_MANGLE_OPTION],
298743f32c10Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
298843f32c10Smrg
298943f32c10Smrg# _AM_SET_OPTION(NAME)
29906ef05171Smrg# --------------------
299143f32c10Smrg# Set option NAME.  Presently that only means defining a flag for this option.
299243f32c10SmrgAC_DEFUN([_AM_SET_OPTION],
29936ef05171Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
299443f32c10Smrg
299543f32c10Smrg# _AM_SET_OPTIONS(OPTIONS)
29966ef05171Smrg# ------------------------
299743f32c10Smrg# OPTIONS is a space-separated list of Automake options.
299843f32c10SmrgAC_DEFUN([_AM_SET_OPTIONS],
29996ef05171Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
300043f32c10Smrg
300143f32c10Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
300243f32c10Smrg# -------------------------------------------
300343f32c10Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
300443f32c10SmrgAC_DEFUN([_AM_IF_OPTION],
300543f32c10Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
300643f32c10Smrg
30076ef05171Smrg# Copyright (C) 1999-2017 Free Software Foundation, Inc.
30086ef05171Smrg#
30096ef05171Smrg# This file is free software; the Free Software Foundation
30106ef05171Smrg# gives unlimited permission to copy and/or distribute it,
30116ef05171Smrg# with or without modifications, as long as this notice is preserved.
30126ef05171Smrg
30136ef05171Smrg# _AM_PROG_CC_C_O
30146ef05171Smrg# ---------------
30156ef05171Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
30166ef05171Smrg# to automatically call this.
30176ef05171SmrgAC_DEFUN([_AM_PROG_CC_C_O],
30186ef05171Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
30196ef05171SmrgAC_REQUIRE_AUX_FILE([compile])dnl
30206ef05171SmrgAC_LANG_PUSH([C])dnl
30216ef05171SmrgAC_CACHE_CHECK(
30226ef05171Smrg  [whether $CC understands -c and -o together],
30236ef05171Smrg  [am_cv_prog_cc_c_o],
30246ef05171Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
30256ef05171Smrg  # Make sure it works both with $CC and with simple cc.
30266ef05171Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
30276ef05171Smrg  # compilers refuse to overwrite an existing .o file with -o,
30286ef05171Smrg  # though they will create one.
30296ef05171Smrg  am_cv_prog_cc_c_o=yes
30306ef05171Smrg  for am_i in 1 2; do
30316ef05171Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
30326ef05171Smrg         && test -f conftest2.$ac_objext; then
30336ef05171Smrg      : OK
30346ef05171Smrg    else
30356ef05171Smrg      am_cv_prog_cc_c_o=no
30366ef05171Smrg      break
30376ef05171Smrg    fi
30386ef05171Smrg  done
30396ef05171Smrg  rm -f core conftest*
30406ef05171Smrg  unset am_i])
30416ef05171Smrgif test "$am_cv_prog_cc_c_o" != yes; then
30426ef05171Smrg   # Losing compiler, so override with the script.
30436ef05171Smrg   # FIXME: It is wrong to rewrite CC.
30446ef05171Smrg   # But if we don't then we get into trouble of one sort or another.
30456ef05171Smrg   # A longer-term fix would be to have automake use am__CC in this case,
30466ef05171Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
30476ef05171Smrg   CC="$am_aux_dir/compile $CC"
30486ef05171Smrgfi
30496ef05171SmrgAC_LANG_POP([C])])
30506ef05171Smrg
30516ef05171Smrg# For backward compatibility.
30526ef05171SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
305343f32c10Smrg
30546ef05171Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
305543f32c10Smrg#
305643f32c10Smrg# This file is free software; the Free Software Foundation
305743f32c10Smrg# gives unlimited permission to copy and/or distribute it,
305843f32c10Smrg# with or without modifications, as long as this notice is preserved.
305943f32c10Smrg
30606ef05171Smrg# AM_RUN_LOG(COMMAND)
30616ef05171Smrg# -------------------
30626ef05171Smrg# Run COMMAND, save the exit status in ac_status, and log it.
30636ef05171Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
30646ef05171SmrgAC_DEFUN([AM_RUN_LOG],
30656ef05171Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
30666ef05171Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
30676ef05171Smrg   ac_status=$?
30686ef05171Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
30696ef05171Smrg   (exit $ac_status); }])
30706ef05171Smrg
30716ef05171Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
30726ef05171Smrg
30736ef05171Smrg# Copyright (C) 1996-2017 Free Software Foundation, Inc.
30746ef05171Smrg#
30756ef05171Smrg# This file is free software; the Free Software Foundation
30766ef05171Smrg# gives unlimited permission to copy and/or distribute it,
30776ef05171Smrg# with or without modifications, as long as this notice is preserved.
307843f32c10Smrg
307943f32c10Smrg# AM_SANITY_CHECK
308043f32c10Smrg# ---------------
308143f32c10SmrgAC_DEFUN([AM_SANITY_CHECK],
308243f32c10Smrg[AC_MSG_CHECKING([whether build environment is sane])
30836ef05171Smrg# Reject unsafe characters in $srcdir or the absolute working directory
30846ef05171Smrg# name.  Accept space and tab only in the latter.
30856ef05171Smrgam_lf='
30866ef05171Smrg'
30876ef05171Smrgcase `pwd` in
30886ef05171Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
30896ef05171Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
30906ef05171Smrgesac
30916ef05171Smrgcase $srcdir in
30926ef05171Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
30936ef05171Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
30946ef05171Smrgesac
30956ef05171Smrg
30966ef05171Smrg# Do 'set' in a subshell so we don't clobber the current shell's
309743f32c10Smrg# arguments.  Must try -L first in case configure is actually a
309843f32c10Smrg# symlink; some systems play weird games with the mod time of symlinks
309943f32c10Smrg# (eg FreeBSD returns the mod time of the symlink's containing
310043f32c10Smrg# directory).
310143f32c10Smrgif (
31026ef05171Smrg   am_has_slept=no
31036ef05171Smrg   for am_try in 1 2; do
31046ef05171Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
31056ef05171Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
31066ef05171Smrg     if test "$[*]" = "X"; then
31076ef05171Smrg	# -L didn't work.
31086ef05171Smrg	set X `ls -t "$srcdir/configure" conftest.file`
31096ef05171Smrg     fi
31106ef05171Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
31116ef05171Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
31126ef05171Smrg
31136ef05171Smrg	# If neither matched, then we have a broken ls.  This can happen
31146ef05171Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
31156ef05171Smrg	# broken ls alias from the environment.  This has actually
31166ef05171Smrg	# happened.  Such a system could not be considered "sane".
31176ef05171Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
31186ef05171Smrg  alias in your environment])
31196ef05171Smrg     fi
31206ef05171Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
31216ef05171Smrg       break
31226ef05171Smrg     fi
31236ef05171Smrg     # Just in case.
31246ef05171Smrg     sleep 1
31256ef05171Smrg     am_has_slept=yes
31266ef05171Smrg   done
312743f32c10Smrg   test "$[2]" = conftest.file
312843f32c10Smrg   )
312943f32c10Smrgthen
313043f32c10Smrg   # Ok.
313143f32c10Smrg   :
313243f32c10Smrgelse
313343f32c10Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
313443f32c10SmrgCheck your system clock])
313543f32c10Smrgfi
31366ef05171SmrgAC_MSG_RESULT([yes])
31376ef05171Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
31386ef05171Smrg# generated files are strictly newer.
31396ef05171Smrgam_sleep_pid=
31406ef05171Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
31416ef05171Smrg  ( sleep 1 ) &
31426ef05171Smrg  am_sleep_pid=$!
31436ef05171Smrgfi
31446ef05171SmrgAC_CONFIG_COMMANDS_PRE(
31456ef05171Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
31466ef05171Smrg   if test -n "$am_sleep_pid"; then
31476ef05171Smrg     # Hide warnings about reused PIDs.
31486ef05171Smrg     wait $am_sleep_pid 2>/dev/null
31496ef05171Smrg   fi
31506ef05171Smrg   AC_MSG_RESULT([done])])
31516ef05171Smrgrm -f conftest.file
31526ef05171Smrg])
315343f32c10Smrg
31546ef05171Smrg# Copyright (C) 2009-2017 Free Software Foundation, Inc.
31556ef05171Smrg#
31566ef05171Smrg# This file is free software; the Free Software Foundation
31576ef05171Smrg# gives unlimited permission to copy and/or distribute it,
31586ef05171Smrg# with or without modifications, as long as this notice is preserved.
31596ef05171Smrg
31606ef05171Smrg# AM_SILENT_RULES([DEFAULT])
31616ef05171Smrg# --------------------------
31626ef05171Smrg# Enable less verbose build rules; with the default set to DEFAULT
31636ef05171Smrg# ("yes" being less verbose, "no" or empty being verbose).
31646ef05171SmrgAC_DEFUN([AM_SILENT_RULES],
31656ef05171Smrg[AC_ARG_ENABLE([silent-rules], [dnl
31666ef05171SmrgAS_HELP_STRING(
31676ef05171Smrg  [--enable-silent-rules],
31686ef05171Smrg  [less verbose build output (undo: "make V=1")])
31696ef05171SmrgAS_HELP_STRING(
31706ef05171Smrg  [--disable-silent-rules],
31716ef05171Smrg  [verbose build output (undo: "make V=0")])dnl
31726ef05171Smrg])
31736ef05171Smrgcase $enable_silent_rules in @%:@ (((
31746ef05171Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
31756ef05171Smrg   no) AM_DEFAULT_VERBOSITY=1;;
31766ef05171Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
31776ef05171Smrgesac
31786ef05171Smrgdnl
31796ef05171Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
31806ef05171Smrgdnl do not support nested variable expansions.
31816ef05171Smrgdnl See automake bug#9928 and bug#10237.
31826ef05171Smrgam_make=${MAKE-make}
31836ef05171SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
31846ef05171Smrg   [am_cv_make_support_nested_variables],
31856ef05171Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
31866ef05171SmrgBAR0=false
31876ef05171SmrgBAR1=true
31886ef05171SmrgV=1
31896ef05171Smrgam__doit:
31906ef05171Smrg	@$(TRUE)
31916ef05171Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
31926ef05171Smrg  am_cv_make_support_nested_variables=yes
31936ef05171Smrgelse
31946ef05171Smrg  am_cv_make_support_nested_variables=no
31956ef05171Smrgfi])
31966ef05171Smrgif test $am_cv_make_support_nested_variables = yes; then
31976ef05171Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
31986ef05171Smrg  AM_V='$(V)'
31996ef05171Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
32006ef05171Smrgelse
32016ef05171Smrg  AM_V=$AM_DEFAULT_VERBOSITY
32026ef05171Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
32036ef05171Smrgfi
32046ef05171SmrgAC_SUBST([AM_V])dnl
32056ef05171SmrgAM_SUBST_NOTMAKE([AM_V])dnl
32066ef05171SmrgAC_SUBST([AM_DEFAULT_V])dnl
32076ef05171SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
32086ef05171SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
32096ef05171SmrgAM_BACKSLASH='\'
32106ef05171SmrgAC_SUBST([AM_BACKSLASH])dnl
32116ef05171Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
32126ef05171Smrg])
32136ef05171Smrg
32146ef05171Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
321543f32c10Smrg#
321643f32c10Smrg# This file is free software; the Free Software Foundation
321743f32c10Smrg# gives unlimited permission to copy and/or distribute it,
321843f32c10Smrg# with or without modifications, as long as this notice is preserved.
321943f32c10Smrg
322043f32c10Smrg# AM_PROG_INSTALL_STRIP
322143f32c10Smrg# ---------------------
32226ef05171Smrg# One issue with vendor 'install' (even GNU) is that you can't
322343f32c10Smrg# specify the program used to strip binaries.  This is especially
322443f32c10Smrg# annoying in cross-compiling environments, where the build's strip
322543f32c10Smrg# is unlikely to handle the host's binaries.
322643f32c10Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
32276ef05171Smrg# always use install-sh in "make install-strip", and initialize
322843f32c10Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
322943f32c10SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
323043f32c10Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
32316ef05171Smrg# Installed binaries are usually stripped using 'strip' when the user
32326ef05171Smrg# run "make install-strip".  However 'strip' might not be the right
323343f32c10Smrg# tool to use in cross-compilation environments, therefore Automake
32346ef05171Smrg# will honor the 'STRIP' environment variable to overrule this program.
32356ef05171Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
323643f32c10Smrgif test "$cross_compiling" != no; then
323743f32c10Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
323843f32c10Smrgfi
323943f32c10SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
324043f32c10SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
324143f32c10Smrg
32426ef05171Smrg# Copyright (C) 2006-2017 Free Software Foundation, Inc.
324343f32c10Smrg#
324443f32c10Smrg# This file is free software; the Free Software Foundation
324543f32c10Smrg# gives unlimited permission to copy and/or distribute it,
324643f32c10Smrg# with or without modifications, as long as this notice is preserved.
324743f32c10Smrg
324843f32c10Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
324943f32c10Smrg# ---------------------------
325043f32c10Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
325143f32c10Smrg# This macro is traced by Automake.
325243f32c10SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
325343f32c10Smrg
32546ef05171Smrg# AM_SUBST_NOTMAKE(VARIABLE)
32556ef05171Smrg# --------------------------
32566ef05171Smrg# Public sister of _AM_SUBST_NOTMAKE.
32576ef05171SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
32586ef05171Smrg
325943f32c10Smrg# Check how to create a tarball.                            -*- Autoconf -*-
326043f32c10Smrg
32616ef05171Smrg# Copyright (C) 2004-2017 Free Software Foundation, Inc.
326243f32c10Smrg#
326343f32c10Smrg# This file is free software; the Free Software Foundation
326443f32c10Smrg# gives unlimited permission to copy and/or distribute it,
326543f32c10Smrg# with or without modifications, as long as this notice is preserved.
326643f32c10Smrg
326743f32c10Smrg# _AM_PROG_TAR(FORMAT)
326843f32c10Smrg# --------------------
326943f32c10Smrg# Check how to create a tarball in format FORMAT.
32706ef05171Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
327143f32c10Smrg#
327243f32c10Smrg# Substitute a variable $(am__tar) that is a command
327343f32c10Smrg# writing to stdout a FORMAT-tarball containing the directory
327443f32c10Smrg# $tardir.
327543f32c10Smrg#     tardir=directory && $(am__tar) > result.tar
327643f32c10Smrg#
327743f32c10Smrg# Substitute a variable $(am__untar) that extract such
327843f32c10Smrg# a tarball read from stdin.
327943f32c10Smrg#     $(am__untar) < result.tar
32806ef05171Smrg#
328143f32c10SmrgAC_DEFUN([_AM_PROG_TAR],
32826ef05171Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
32836ef05171Smrg# in the wild :-(  We should find a proper way to deprecate it ...
32846ef05171SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
32856ef05171Smrg
32866ef05171Smrg# We'll loop over all known methods to create a tar archive until one works.
328743f32c10Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
328843f32c10Smrg
32896ef05171Smrgm4_if([$1], [v7],
32906ef05171Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
32916ef05171Smrg
32926ef05171Smrg  [m4_case([$1],
32936ef05171Smrg    [ustar],
32946ef05171Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
32956ef05171Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
32966ef05171Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
32976ef05171Smrg      # and bug#13588).
32986ef05171Smrg      am_max_uid=2097151 # 2^21 - 1
32996ef05171Smrg      am_max_gid=$am_max_uid
33006ef05171Smrg      # The $UID and $GID variables are not portable, so we need to resort
33016ef05171Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
33026ef05171Smrg      # below are definitely unexpected, so allow the users to see them
33036ef05171Smrg      # (that is, avoid stderr redirection).
33046ef05171Smrg      am_uid=`id -u || echo unknown`
33056ef05171Smrg      am_gid=`id -g || echo unknown`
33066ef05171Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
33076ef05171Smrg      if test $am_uid -le $am_max_uid; then
33086ef05171Smrg         AC_MSG_RESULT([yes])
33096ef05171Smrg      else
33106ef05171Smrg         AC_MSG_RESULT([no])
33116ef05171Smrg         _am_tools=none
33126ef05171Smrg      fi
33136ef05171Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
33146ef05171Smrg      if test $am_gid -le $am_max_gid; then
33156ef05171Smrg         AC_MSG_RESULT([yes])
33166ef05171Smrg      else
33176ef05171Smrg        AC_MSG_RESULT([no])
33186ef05171Smrg        _am_tools=none
33196ef05171Smrg      fi],
33206ef05171Smrg
33216ef05171Smrg  [pax],
33226ef05171Smrg    [],
33236ef05171Smrg
33246ef05171Smrg  [m4_fatal([Unknown tar format])])
33256ef05171Smrg
33266ef05171Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
33276ef05171Smrg
33286ef05171Smrg  # Go ahead even if we have the value already cached.  We do so because we
33296ef05171Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
33306ef05171Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
33316ef05171Smrg
33326ef05171Smrg  for _am_tool in $_am_tools; do
33336ef05171Smrg    case $_am_tool in
33346ef05171Smrg    gnutar)
33356ef05171Smrg      for _am_tar in tar gnutar gtar; do
33366ef05171Smrg        AM_RUN_LOG([$_am_tar --version]) && break
33376ef05171Smrg      done
33386ef05171Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
33396ef05171Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
33406ef05171Smrg      am__untar="$_am_tar -xf -"
33416ef05171Smrg      ;;
33426ef05171Smrg    plaintar)
33436ef05171Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
33446ef05171Smrg      # ustar tarball either.
33456ef05171Smrg      (tar --version) >/dev/null 2>&1 && continue
33466ef05171Smrg      am__tar='tar chf - "$$tardir"'
33476ef05171Smrg      am__tar_='tar chf - "$tardir"'
33486ef05171Smrg      am__untar='tar xf -'
33496ef05171Smrg      ;;
33506ef05171Smrg    pax)
33516ef05171Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
33526ef05171Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
33536ef05171Smrg      am__untar='pax -r'
33546ef05171Smrg      ;;
33556ef05171Smrg    cpio)
33566ef05171Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
33576ef05171Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
33586ef05171Smrg      am__untar='cpio -i -H $1 -d'
33596ef05171Smrg      ;;
33606ef05171Smrg    none)
33616ef05171Smrg      am__tar=false
33626ef05171Smrg      am__tar_=false
33636ef05171Smrg      am__untar=false
33646ef05171Smrg      ;;
33656ef05171Smrg    esac
336643f32c10Smrg
33676ef05171Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
33686ef05171Smrg    # and am__untar set.
33696ef05171Smrg    test -n "${am_cv_prog_tar_$1}" && break
33706ef05171Smrg
33716ef05171Smrg    # tar/untar a dummy directory, and stop if the command works.
33726ef05171Smrg    rm -rf conftest.dir
33736ef05171Smrg    mkdir conftest.dir
33746ef05171Smrg    echo GrepMe > conftest.dir/file
33756ef05171Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
33766ef05171Smrg    rm -rf conftest.dir
33776ef05171Smrg    if test -s conftest.tar; then
33786ef05171Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
33796ef05171Smrg      AM_RUN_LOG([cat conftest.dir/file])
33806ef05171Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
33816ef05171Smrg    fi
33826ef05171Smrg  done
338343f32c10Smrg  rm -rf conftest.dir
338443f32c10Smrg
33856ef05171Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
33866ef05171Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
33876ef05171Smrg
338843f32c10SmrgAC_SUBST([am__tar])
338943f32c10SmrgAC_SUBST([am__untar])
339043f32c10Smrg]) # _AM_PROG_TAR
339143f32c10Smrg
3392