aclocal.m4 revision 6c3c2bce
16c3c2bceSmrg# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
28abc0ccfSmrg
36c3c2bceSmrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
47a0395d0Smrg
57a0395d0Smrg# This file is free software; the Free Software Foundation
67a0395d0Smrg# gives unlimited permission to copy and/or distribute it,
77a0395d0Smrg# with or without modifications, as long as this notice is preserved.
87a0395d0Smrg
97a0395d0Smrg# This program is distributed in the hope that it will be useful,
107a0395d0Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
117a0395d0Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
127a0395d0Smrg# PARTICULAR PURPOSE.
137a0395d0Smrg
149a011757Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
157a0395d0Smrgm4_ifndef([AC_AUTOCONF_VERSION],
167a0395d0Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
178abc0ccfSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
188abc0ccfSmrg[m4_warning([this file was generated for autoconf 2.69.
197a0395d0SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
207a0395d0SmrgIf you have problems, you may need to regenerate the build system entirely.
218abc0ccfSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
227a0395d0Smrg
236c3c2bceSmrg# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
246c3c2bceSmrg# serial 11 (pkg-config-0.29.1)
257a0395d0Smrg
266c3c2bceSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
276c3c2bceSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
286c3c2bceSmrgdnl
296c3c2bceSmrgdnl This program is free software; you can redistribute it and/or modify
306c3c2bceSmrgdnl it under the terms of the GNU General Public License as published by
316c3c2bceSmrgdnl the Free Software Foundation; either version 2 of the License, or
326c3c2bceSmrgdnl (at your option) any later version.
336c3c2bceSmrgdnl
346c3c2bceSmrgdnl This program is distributed in the hope that it will be useful, but
356c3c2bceSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
366c3c2bceSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376c3c2bceSmrgdnl General Public License for more details.
386c3c2bceSmrgdnl
396c3c2bceSmrgdnl You should have received a copy of the GNU General Public License
406c3c2bceSmrgdnl along with this program; if not, write to the Free Software
416c3c2bceSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
426c3c2bceSmrgdnl 02111-1307, USA.
436c3c2bceSmrgdnl
446c3c2bceSmrgdnl As a special exception to the GNU General Public License, if you
456c3c2bceSmrgdnl distribute this file as part of a program that contains a
466c3c2bceSmrgdnl configuration script generated by Autoconf, you may include it under
476c3c2bceSmrgdnl the same distribution terms that you use for the rest of that
486c3c2bceSmrgdnl program.
496c3c2bceSmrg
506c3c2bceSmrgdnl PKG_PREREQ(MIN-VERSION)
516c3c2bceSmrgdnl -----------------------
526c3c2bceSmrgdnl Since: 0.29
536c3c2bceSmrgdnl
546c3c2bceSmrgdnl Verify that the version of the pkg-config macros are at least
556c3c2bceSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
566c3c2bceSmrgdnl installed version of pkg-config, this checks the developer's version
576c3c2bceSmrgdnl of pkg.m4 when generating configure.
586c3c2bceSmrgdnl
596c3c2bceSmrgdnl To ensure that this macro is defined, also add:
606c3c2bceSmrgdnl m4_ifndef([PKG_PREREQ],
616c3c2bceSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
626c3c2bceSmrgdnl
636c3c2bceSmrgdnl See the "Since" comment for each macro you use to see what version
646c3c2bceSmrgdnl of the macros you require.
656c3c2bceSmrgm4_defun([PKG_PREREQ],
666c3c2bceSmrg[m4_define([PKG_MACROS_VERSION], [0.29.1])
676c3c2bceSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
686c3c2bceSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
696c3c2bceSmrg])dnl PKG_PREREQ
706c3c2bceSmrg
716c3c2bceSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
726c3c2bceSmrgdnl ----------------------------------
736c3c2bceSmrgdnl Since: 0.16
746c3c2bceSmrgdnl
756c3c2bceSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
766c3c2bceSmrgdnl first found in the path. Checks that the version of pkg-config found
776c3c2bceSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
786c3c2bceSmrgdnl used since that's the first version where most current features of
796c3c2bceSmrgdnl pkg-config existed.
808abc0ccfSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
818abc0ccfSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
828abc0ccfSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
838abc0ccfSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
848abc0ccfSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
858abc0ccfSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
868abc0ccfSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
877a0395d0Smrg
888abc0ccfSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
898abc0ccfSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
908abc0ccfSmrgfi
918abc0ccfSmrgif test -n "$PKG_CONFIG"; then
928abc0ccfSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
938abc0ccfSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
948abc0ccfSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
958abc0ccfSmrg		AC_MSG_RESULT([yes])
968abc0ccfSmrg	else
978abc0ccfSmrg		AC_MSG_RESULT([no])
988abc0ccfSmrg		PKG_CONFIG=""
998abc0ccfSmrg	fi
1008abc0ccfSmrgfi[]dnl
1016c3c2bceSmrg])dnl PKG_PROG_PKG_CONFIG
1027a0395d0Smrg
1036c3c2bceSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1046c3c2bceSmrgdnl -------------------------------------------------------------------
1056c3c2bceSmrgdnl Since: 0.18
1066c3c2bceSmrgdnl
1076c3c2bceSmrgdnl Check to see whether a particular set of modules exists. Similar to
1086c3c2bceSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1096c3c2bceSmrgdnl
1106c3c2bceSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1116c3c2bceSmrgdnl only at the first occurence in configure.ac, so if the first place
1126c3c2bceSmrgdnl it's called might be skipped (such as if it is within an "if", you
1136c3c2bceSmrgdnl have to call PKG_CHECK_EXISTS manually
1148abc0ccfSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1158abc0ccfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1168abc0ccfSmrgif test -n "$PKG_CONFIG" && \
1178abc0ccfSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1188abc0ccfSmrg  m4_default([$2], [:])
1198abc0ccfSmrgm4_ifvaln([$3], [else
1208abc0ccfSmrg  $3])dnl
1218abc0ccfSmrgfi])
1227a0395d0Smrg
1236c3c2bceSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1246c3c2bceSmrgdnl ---------------------------------------------
1256c3c2bceSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1266c3c2bceSmrgdnl pkg_failed based on the result.
1278abc0ccfSmrgm4_define([_PKG_CONFIG],
1288abc0ccfSmrg[if test -n "$$1"; then
1298abc0ccfSmrg    pkg_cv_[]$1="$$1"
1308abc0ccfSmrg elif test -n "$PKG_CONFIG"; then
1318abc0ccfSmrg    PKG_CHECK_EXISTS([$3],
1328abc0ccfSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1338abc0ccfSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1348abc0ccfSmrg		     [pkg_failed=yes])
1358abc0ccfSmrg else
1368abc0ccfSmrg    pkg_failed=untried
1378abc0ccfSmrgfi[]dnl
1386c3c2bceSmrg])dnl _PKG_CONFIG
1397a0395d0Smrg
1406c3c2bceSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1416c3c2bceSmrgdnl ---------------------------
1426c3c2bceSmrgdnl Internal check to see if pkg-config supports short errors.
1438abc0ccfSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1448abc0ccfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1458abc0ccfSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1468abc0ccfSmrg        _pkg_short_errors_supported=yes
1478abc0ccfSmrgelse
1488abc0ccfSmrg        _pkg_short_errors_supported=no
1498abc0ccfSmrgfi[]dnl
1506c3c2bceSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1517a0395d0Smrg
1528abc0ccfSmrg
1536c3c2bceSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1546c3c2bceSmrgdnl   [ACTION-IF-NOT-FOUND])
1556c3c2bceSmrgdnl --------------------------------------------------------------
1566c3c2bceSmrgdnl Since: 0.4.0
1576c3c2bceSmrgdnl
1586c3c2bceSmrgdnl Note that if there is a possibility the first call to
1596c3c2bceSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1606c3c2bceSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1618abc0ccfSmrgAC_DEFUN([PKG_CHECK_MODULES],
1628abc0ccfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1638abc0ccfSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1648abc0ccfSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1657a0395d0Smrg
1668abc0ccfSmrgpkg_failed=no
1678abc0ccfSmrgAC_MSG_CHECKING([for $1])
1687a0395d0Smrg
1698abc0ccfSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1708abc0ccfSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1717a0395d0Smrg
1728abc0ccfSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1738abc0ccfSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1748abc0ccfSmrgSee the pkg-config man page for more details.])
1757a0395d0Smrg
1768abc0ccfSmrgif test $pkg_failed = yes; then
1778abc0ccfSmrg   	AC_MSG_RESULT([no])
1788abc0ccfSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1798abc0ccfSmrg        if test $_pkg_short_errors_supported = yes; then
1808abc0ccfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1818abc0ccfSmrg        else 
1828abc0ccfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1838abc0ccfSmrg        fi
1848abc0ccfSmrg	# Put the nasty error message in config.log where it belongs
1858abc0ccfSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1867a0395d0Smrg
1878abc0ccfSmrg	m4_default([$4], [AC_MSG_ERROR(
1888abc0ccfSmrg[Package requirements ($2) were not met:
1897a0395d0Smrg
1908abc0ccfSmrg$$1_PKG_ERRORS
1917a0395d0Smrg
1928abc0ccfSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1938abc0ccfSmrginstalled software in a non-standard prefix.
1947a0395d0Smrg
1958abc0ccfSmrg_PKG_TEXT])[]dnl
1968abc0ccfSmrg        ])
1978abc0ccfSmrgelif test $pkg_failed = untried; then
1988abc0ccfSmrg     	AC_MSG_RESULT([no])
1998abc0ccfSmrg	m4_default([$4], [AC_MSG_FAILURE(
2008abc0ccfSmrg[The pkg-config script could not be found or is too old.  Make sure it
2018abc0ccfSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
2028abc0ccfSmrgpath to pkg-config.
2037a0395d0Smrg
2048abc0ccfSmrg_PKG_TEXT
2057a0395d0Smrg
2068abc0ccfSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2078abc0ccfSmrg        ])
2088abc0ccfSmrgelse
2098abc0ccfSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2108abc0ccfSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2118abc0ccfSmrg        AC_MSG_RESULT([yes])
2128abc0ccfSmrg	$3
2138abc0ccfSmrgfi[]dnl
2146c3c2bceSmrg])dnl PKG_CHECK_MODULES
2157a0395d0Smrg
2167a0395d0Smrg
2176c3c2bceSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2186c3c2bceSmrgdnl   [ACTION-IF-NOT-FOUND])
2196c3c2bceSmrgdnl ---------------------------------------------------------------------
2206c3c2bceSmrgdnl Since: 0.29
2216c3c2bceSmrgdnl
2226c3c2bceSmrgdnl Checks for existence of MODULES and gathers its build flags with
2236c3c2bceSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2246c3c2bceSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2256c3c2bceSmrgdnl
2266c3c2bceSmrgdnl Note that if there is a possibility the first call to
2276c3c2bceSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2286c3c2bceSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2296c3c2bceSmrgdnl configure.ac.
2306c3c2bceSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2316c3c2bceSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2326c3c2bceSmrg_save_PKG_CONFIG=$PKG_CONFIG
2336c3c2bceSmrgPKG_CONFIG="$PKG_CONFIG --static"
2346c3c2bceSmrgPKG_CHECK_MODULES($@)
2356c3c2bceSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2366c3c2bceSmrg])dnl PKG_CHECK_MODULES_STATIC
2376c3c2bceSmrg
2386c3c2bceSmrg
2396c3c2bceSmrgdnl PKG_INSTALLDIR([DIRECTORY])
2406c3c2bceSmrgdnl -------------------------
2416c3c2bceSmrgdnl Since: 0.27
2426c3c2bceSmrgdnl
2436c3c2bceSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
2446c3c2bceSmrgdnl should install pkg-config .pc files. By default the directory is
2456c3c2bceSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
2466c3c2bceSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2476c3c2bceSmrgdnl parameter.
2488abc0ccfSmrgAC_DEFUN([PKG_INSTALLDIR],
2498abc0ccfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2508abc0ccfSmrgm4_pushdef([pkg_description],
2518abc0ccfSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2528abc0ccfSmrgAC_ARG_WITH([pkgconfigdir],
2538abc0ccfSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2548abc0ccfSmrg    [with_pkgconfigdir=]pkg_default)
2558abc0ccfSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2568abc0ccfSmrgm4_popdef([pkg_default])
2578abc0ccfSmrgm4_popdef([pkg_description])
2586c3c2bceSmrg])dnl PKG_INSTALLDIR
2598abc0ccfSmrg
2608abc0ccfSmrg
2616c3c2bceSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2626c3c2bceSmrgdnl --------------------------------
2636c3c2bceSmrgdnl Since: 0.27
2646c3c2bceSmrgdnl
2656c3c2bceSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2666c3c2bceSmrgdnl module should install arch-independent pkg-config .pc files. By
2676c3c2bceSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
2686c3c2bceSmrgdnl changed by passing DIRECTORY. The user can override through the
2696c3c2bceSmrgdnl --with-noarch-pkgconfigdir parameter.
2708abc0ccfSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2718abc0ccfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2728abc0ccfSmrgm4_pushdef([pkg_description],
2738abc0ccfSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2748abc0ccfSmrgAC_ARG_WITH([noarch-pkgconfigdir],
2758abc0ccfSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2768abc0ccfSmrg    [with_noarch_pkgconfigdir=]pkg_default)
2778abc0ccfSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2788abc0ccfSmrgm4_popdef([pkg_default])
2798abc0ccfSmrgm4_popdef([pkg_description])
2806c3c2bceSmrg])dnl PKG_NOARCH_INSTALLDIR
2817a0395d0Smrg
2829a011757Smrg
2836c3c2bceSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2846c3c2bceSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2856c3c2bceSmrgdnl -------------------------------------------
2866c3c2bceSmrgdnl Since: 0.28
2876c3c2bceSmrgdnl
2886c3c2bceSmrgdnl Retrieves the value of the pkg-config variable for the given module.
2899a011757SmrgAC_DEFUN([PKG_CHECK_VAR],
2909a011757Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2919a011757SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2929a011757Smrg
2939a011757Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2949a011757SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2959a011757Smrg
2969a011757SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2976c3c2bceSmrg])dnl PKG_CHECK_VAR
2986c3c2bceSmrg
2996c3c2bceSmrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3006c3c2bceSmrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
3016c3c2bceSmrgdnl   [DESCRIPTION], [DEFAULT])
3026c3c2bceSmrgdnl ------------------------------------------
3036c3c2bceSmrgdnl
3046c3c2bceSmrgdnl Prepare a "--with-" configure option using the lowercase
3056c3c2bceSmrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
3066c3c2bceSmrgdnl PKG_CHECK_MODULES in a single macro.
3076c3c2bceSmrgAC_DEFUN([PKG_WITH_MODULES],
3086c3c2bceSmrg[
3096c3c2bceSmrgm4_pushdef([with_arg], m4_tolower([$1]))
3106c3c2bceSmrg
3116c3c2bceSmrgm4_pushdef([description],
3126c3c2bceSmrg           [m4_default([$5], [build with ]with_arg[ support])])
3136c3c2bceSmrg
3146c3c2bceSmrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
3156c3c2bceSmrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
3166c3c2bceSmrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
3176c3c2bceSmrg
3186c3c2bceSmrgm4_case(def_arg,
3196c3c2bceSmrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
3206c3c2bceSmrg            [m4_pushdef([with_without],[--with-]with_arg)])
3216c3c2bceSmrg
3226c3c2bceSmrgAC_ARG_WITH(with_arg,
3236c3c2bceSmrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
3246c3c2bceSmrg    [AS_TR_SH([with_]with_arg)=def_arg])
3256c3c2bceSmrg
3266c3c2bceSmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
3276c3c2bceSmrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
3286c3c2bceSmrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
3296c3c2bceSmrg                                        [m4_n([def_action_if_found]) $3],
3306c3c2bceSmrg                                        [m4_n([def_action_if_not_found]) $4])])
3316c3c2bceSmrg
3326c3c2bceSmrgm4_popdef([with_arg])
3336c3c2bceSmrgm4_popdef([description])
3346c3c2bceSmrgm4_popdef([def_arg])
3356c3c2bceSmrg
3366c3c2bceSmrg])dnl PKG_WITH_MODULES
3376c3c2bceSmrg
3386c3c2bceSmrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3396c3c2bceSmrgdnl   [DESCRIPTION], [DEFAULT])
3406c3c2bceSmrgdnl -----------------------------------------------
3416c3c2bceSmrgdnl
3426c3c2bceSmrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
3436c3c2bceSmrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
3446c3c2bceSmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
3456c3c2bceSmrg[
3466c3c2bceSmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
3476c3c2bceSmrg
3486c3c2bceSmrgAM_CONDITIONAL([HAVE_][$1],
3496c3c2bceSmrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
3506c3c2bceSmrg])dnl PKG_HAVE_WITH_MODULES
3516c3c2bceSmrg
3526c3c2bceSmrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3536c3c2bceSmrgdnl   [DESCRIPTION], [DEFAULT])
3546c3c2bceSmrgdnl ------------------------------------------------------
3556c3c2bceSmrgdnl
3566c3c2bceSmrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
3576c3c2bceSmrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
3586c3c2bceSmrgdnl and preprocessor variable.
3596c3c2bceSmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
3606c3c2bceSmrg[
3616c3c2bceSmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
3626c3c2bceSmrg
3636c3c2bceSmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
3646c3c2bceSmrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
3656c3c2bceSmrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
3669a011757Smrg
3678abc0ccfSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3688abc0ccfSmrgdnl
36940c5344fSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
37040c5344fSmrgdnl
3718abc0ccfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3728abc0ccfSmrgdnl copy of this software and associated documentation files (the "Software"),
3738abc0ccfSmrgdnl to deal in the Software without restriction, including without limitation
3748abc0ccfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3758abc0ccfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
3768abc0ccfSmrgdnl Software is furnished to do so, subject to the following conditions:
3778abc0ccfSmrgdnl
3788abc0ccfSmrgdnl The above copyright notice and this permission notice (including the next
3798abc0ccfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
3808abc0ccfSmrgdnl Software.
3818abc0ccfSmrgdnl
3828abc0ccfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3838abc0ccfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3848abc0ccfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3858abc0ccfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3868abc0ccfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3878abc0ccfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3888abc0ccfSmrgdnl DEALINGS IN THE SOFTWARE.
3897a0395d0Smrg
3908abc0ccfSmrg# XORG_MACROS_VERSION(required-version)
3918abc0ccfSmrg# -------------------------------------
3928abc0ccfSmrg# Minimum version: 1.1.0
3938abc0ccfSmrg#
3948abc0ccfSmrg# If you're using a macro added in Version 1.1 or newer, include this in
3958abc0ccfSmrg# your configure.ac with the minimum required version, such as:
3968abc0ccfSmrg# XORG_MACROS_VERSION(1.1)
3978abc0ccfSmrg#
3988abc0ccfSmrg# To ensure that this macro is defined, also add:
3998abc0ccfSmrg# m4_ifndef([XORG_MACROS_VERSION],
4008abc0ccfSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
4018abc0ccfSmrg#
4028abc0ccfSmrg#
40340c5344fSmrg# See the "minimum version" comment for each macro you use to see what
4048abc0ccfSmrg# version you require.
4058abc0ccfSmrgm4_defun([XORG_MACROS_VERSION],[
4066c3c2bceSmrgm4_define([vers_have], [1.19.2])
4078abc0ccfSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
4088abc0ccfSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
4098abc0ccfSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
4108abc0ccfSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
4118abc0ccfSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
4128abc0ccfSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
4138abc0ccfSmrgm4_undefine([vers_have])
4148abc0ccfSmrgm4_undefine([maj_have])
4158abc0ccfSmrgm4_undefine([maj_needed])
4168abc0ccfSmrg]) # XORG_MACROS_VERSION
4177a0395d0Smrg
4188abc0ccfSmrg# XORG_PROG_RAWCPP()
4198abc0ccfSmrg# ------------------
4208abc0ccfSmrg# Minimum version: 1.0.0
4218abc0ccfSmrg#
4228abc0ccfSmrg# Find cpp program and necessary flags for use in pre-processing text files
4238abc0ccfSmrg# such as man pages and config files
4248abc0ccfSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
4258abc0ccfSmrgAC_REQUIRE([AC_PROG_CPP])
42640c5344fSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
4278abc0ccfSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
4287a0395d0Smrg
4298abc0ccfSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
4308abc0ccfSmrg# which is not the best choice for supporting other OS'es, but covers most
4318abc0ccfSmrg# of the ones we need for now.
4328abc0ccfSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
4338abc0ccfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
4348abc0ccfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4358abc0ccfSmrg	AC_MSG_RESULT([no])
4367366012aSmrgelse
4378abc0ccfSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4388abc0ccfSmrg		RAWCPPFLAGS=-undef
4398abc0ccfSmrg		AC_MSG_RESULT([yes])
4408abc0ccfSmrg	# under Cygwin unix is still defined even with -undef
4418abc0ccfSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4428abc0ccfSmrg		RAWCPPFLAGS="-undef -ansi"
4438abc0ccfSmrg		AC_MSG_RESULT([yes, with -ansi])
4448abc0ccfSmrg	else
4458abc0ccfSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
4468abc0ccfSmrg	fi
4477a0395d0Smrgfi
4488abc0ccfSmrgrm -f conftest.$ac_ext
4497a0395d0Smrg
4508abc0ccfSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
4518abc0ccfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
4528abc0ccfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
4538abc0ccfSmrg	AC_MSG_RESULT([no])
4548abc0ccfSmrgelse
4558abc0ccfSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
45640c5344fSmrg		TRADITIONALCPPFLAGS="-traditional"
4578abc0ccfSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
4588abc0ccfSmrg		AC_MSG_RESULT([yes])
4598abc0ccfSmrg	else
4608abc0ccfSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
4618abc0ccfSmrg	fi
4628abc0ccfSmrgfi
4638abc0ccfSmrgrm -f conftest.$ac_ext
4648abc0ccfSmrgAC_SUBST(RAWCPPFLAGS)
46540c5344fSmrgAC_SUBST(TRADITIONALCPPFLAGS)
4668abc0ccfSmrg]) # XORG_PROG_RAWCPP
4677a0395d0Smrg
4688abc0ccfSmrg# XORG_MANPAGE_SECTIONS()
4698abc0ccfSmrg# -----------------------
4708abc0ccfSmrg# Minimum version: 1.0.0
4718abc0ccfSmrg#
4728abc0ccfSmrg# Determine which sections man pages go in for the different man page types
4738abc0ccfSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4748abc0ccfSmrg# Not sure if there's any better way than just hardcoding by OS name.
4758abc0ccfSmrg# Override default settings by setting environment variables
4768abc0ccfSmrg# Added MAN_SUBSTS in version 1.8
4778abc0ccfSmrg# Added AC_PROG_SED in version 1.8
4787a0395d0Smrg
4798abc0ccfSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4808abc0ccfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
4818abc0ccfSmrgAC_REQUIRE([AC_PROG_SED])
4827a0395d0Smrg
4836c3c2bceSmrgcase $host_os in
4846c3c2bceSmrg    solaris*)
4856c3c2bceSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
4866c3c2bceSmrg        # check for a man page file found in later versions that use
4876c3c2bceSmrg        # traditional section numbers instead
4886c3c2bceSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
4896c3c2bceSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
4906c3c2bceSmrg        ;;
4916c3c2bceSmrg    *) SYSV_MAN_SECTIONS=false ;;
4926c3c2bceSmrgesac
4936c3c2bceSmrg
4948abc0ccfSmrgif test x$APP_MAN_SUFFIX = x    ; then
4958abc0ccfSmrg    APP_MAN_SUFFIX=1
4968abc0ccfSmrgfi
4978abc0ccfSmrgif test x$APP_MAN_DIR = x    ; then
4988abc0ccfSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
4997a0395d0Smrgfi
5007a0395d0Smrg
5018abc0ccfSmrgif test x$LIB_MAN_SUFFIX = x    ; then
5028abc0ccfSmrg    LIB_MAN_SUFFIX=3
5038abc0ccfSmrgfi
5048abc0ccfSmrgif test x$LIB_MAN_DIR = x    ; then
5058abc0ccfSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
5068abc0ccfSmrgfi
5077a0395d0Smrg
5088abc0ccfSmrgif test x$FILE_MAN_SUFFIX = x    ; then
5096c3c2bceSmrg    case $SYSV_MAN_SECTIONS in
5106c3c2bceSmrg	true)				FILE_MAN_SUFFIX=4  ;;
51140c5344fSmrg	*)				FILE_MAN_SUFFIX=5  ;;
5128abc0ccfSmrg    esac
5138abc0ccfSmrgfi
5148abc0ccfSmrgif test x$FILE_MAN_DIR = x    ; then
5158abc0ccfSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
5168abc0ccfSmrgfi
5177a0395d0Smrg
5188abc0ccfSmrgif test x$MISC_MAN_SUFFIX = x    ; then
5196c3c2bceSmrg    case $SYSV_MAN_SECTIONS in
5206c3c2bceSmrg	true)				MISC_MAN_SUFFIX=5  ;;
52140c5344fSmrg	*)				MISC_MAN_SUFFIX=7  ;;
5228abc0ccfSmrg    esac
5238abc0ccfSmrgfi
5248abc0ccfSmrgif test x$MISC_MAN_DIR = x    ; then
5258abc0ccfSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
5268abc0ccfSmrgfi
5277a0395d0Smrg
5288abc0ccfSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
5296c3c2bceSmrg    case $SYSV_MAN_SECTIONS in
5306c3c2bceSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
53140c5344fSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
5328abc0ccfSmrg    esac
5338abc0ccfSmrgfi
5348abc0ccfSmrgif test x$DRIVER_MAN_DIR = x    ; then
5358abc0ccfSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
5368abc0ccfSmrgfi
5378abc0ccfSmrg
5388abc0ccfSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
5396c3c2bceSmrg    case $SYSV_MAN_SECTIONS in
5406c3c2bceSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
54140c5344fSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
5428abc0ccfSmrg    esac
5438abc0ccfSmrgfi
5448abc0ccfSmrgif test x$ADMIN_MAN_DIR = x    ; then
5458abc0ccfSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
5468abc0ccfSmrgfi
5477366012aSmrg
5487366012aSmrg
5498abc0ccfSmrgAC_SUBST([APP_MAN_SUFFIX])
5508abc0ccfSmrgAC_SUBST([LIB_MAN_SUFFIX])
5518abc0ccfSmrgAC_SUBST([FILE_MAN_SUFFIX])
5528abc0ccfSmrgAC_SUBST([MISC_MAN_SUFFIX])
5538abc0ccfSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
5548abc0ccfSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
5558abc0ccfSmrgAC_SUBST([APP_MAN_DIR])
5568abc0ccfSmrgAC_SUBST([LIB_MAN_DIR])
5578abc0ccfSmrgAC_SUBST([FILE_MAN_DIR])
5588abc0ccfSmrgAC_SUBST([MISC_MAN_DIR])
5598abc0ccfSmrgAC_SUBST([DRIVER_MAN_DIR])
5608abc0ccfSmrgAC_SUBST([ADMIN_MAN_DIR])
5618abc0ccfSmrg
5628abc0ccfSmrgXORG_MAN_PAGE="X Version 11"
5638abc0ccfSmrgAC_SUBST([XORG_MAN_PAGE])
5648abc0ccfSmrgMAN_SUBSTS="\
5658abc0ccfSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5668abc0ccfSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5678abc0ccfSmrg	-e 's|__xservername__|Xorg|g' \
5688abc0ccfSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
5698abc0ccfSmrg	-e 's|__projectroot__|\$(prefix)|g' \
5708abc0ccfSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
5718abc0ccfSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
5728abc0ccfSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
5738abc0ccfSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
5748abc0ccfSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5758abc0ccfSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5768abc0ccfSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5778abc0ccfSmrgAC_SUBST([MAN_SUBSTS])
5788abc0ccfSmrg
5798abc0ccfSmrg]) # XORG_MANPAGE_SECTIONS
5808abc0ccfSmrg
5818abc0ccfSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5828abc0ccfSmrg# ------------------------
5838abc0ccfSmrg# Minimum version: 1.7.0
5847a0395d0Smrg#
5858abc0ccfSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5868abc0ccfSmrg# provided by xorg-sgml-doctools, if installed.
5878abc0ccfSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5888abc0ccfSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5898abc0ccfSmrgXORG_SGML_PATH=
5908abc0ccfSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5918abc0ccfSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5928abc0ccfSmrg    [m4_ifval([$1],[:],
5938abc0ccfSmrg        [if test x"$cross_compiling" != x"yes" ; then
5948abc0ccfSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5958abc0ccfSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5968abc0ccfSmrg         fi])
5978abc0ccfSmrg    ])
5987a0395d0Smrg
5998abc0ccfSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
6008abc0ccfSmrg# the path and the name of the doc stylesheet
6018abc0ccfSmrgif test "x$XORG_SGML_PATH" != "x" ; then
6028abc0ccfSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
6038abc0ccfSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
6048abc0ccfSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
6058abc0ccfSmrgelse
6068abc0ccfSmrg   AC_MSG_RESULT([no])
6078abc0ccfSmrgfi
6088abc0ccfSmrg
6098abc0ccfSmrgAC_SUBST(XORG_SGML_PATH)
6108abc0ccfSmrgAC_SUBST(STYLESHEET_SRCDIR)
6118abc0ccfSmrgAC_SUBST(XSL_STYLESHEET)
6128abc0ccfSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
6138abc0ccfSmrg]) # XORG_CHECK_SGML_DOCTOOLS
6147a0395d0Smrg
6158abc0ccfSmrg# XORG_CHECK_LINUXDOC
6168abc0ccfSmrg# -------------------
6178abc0ccfSmrg# Minimum version: 1.0.0
6187366012aSmrg#
6198abc0ccfSmrg# Defines the variable MAKE_TEXT if the necessary tools and
6208abc0ccfSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
6218abc0ccfSmrg# Whether or not the necessary tools and files are found can be checked
6228abc0ccfSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
6238abc0ccfSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
6248abc0ccfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6258abc0ccfSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
6267a0395d0Smrg
6278abc0ccfSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
6287a0395d0Smrg
6298abc0ccfSmrgAC_MSG_CHECKING([whether to build documentation])
6307a0395d0Smrg
6318abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
6328abc0ccfSmrg   BUILDDOC=yes
6338abc0ccfSmrgelse
6348abc0ccfSmrg   BUILDDOC=no
6357a0395d0Smrgfi
6367a0395d0Smrg
6378abc0ccfSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
6387a0395d0Smrg
6398abc0ccfSmrgAC_MSG_RESULT([$BUILDDOC])
6407a0395d0Smrg
6418abc0ccfSmrgAC_MSG_CHECKING([whether to build pdf documentation])
6427a0395d0Smrg
6438abc0ccfSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
6448abc0ccfSmrg   BUILDPDFDOC=yes
6458abc0ccfSmrgelse
6468abc0ccfSmrg   BUILDPDFDOC=no
6478abc0ccfSmrgfi
6487a0395d0Smrg
6498abc0ccfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6507a0395d0Smrg
6518abc0ccfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
6527a0395d0Smrg
6538abc0ccfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
6548abc0ccfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
6558abc0ccfSmrgMAKE_PDF="$PS2PDF"
6568abc0ccfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
6577a0395d0Smrg
6588abc0ccfSmrgAC_SUBST(MAKE_TEXT)
6598abc0ccfSmrgAC_SUBST(MAKE_PS)
6608abc0ccfSmrgAC_SUBST(MAKE_PDF)
6618abc0ccfSmrgAC_SUBST(MAKE_HTML)
6628abc0ccfSmrg]) # XORG_CHECK_LINUXDOC
6637a0395d0Smrg
6648abc0ccfSmrg# XORG_CHECK_DOCBOOK
6658abc0ccfSmrg# -------------------
6668abc0ccfSmrg# Minimum version: 1.0.0
6677366012aSmrg#
6688abc0ccfSmrg# Checks for the ability to build output formats from SGML DocBook source.
6698abc0ccfSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
6708abc0ccfSmrg# indicates whether the necessary tools and files are found and, if set,
6718abc0ccfSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
6728abc0ccfSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
6738abc0ccfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6747a0395d0Smrg
6758abc0ccfSmrgBUILDTXTDOC=no
6768abc0ccfSmrgBUILDPDFDOC=no
6778abc0ccfSmrgBUILDPSDOC=no
6788abc0ccfSmrgBUILDHTMLDOC=no
6797a0395d0Smrg
6808abc0ccfSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6818abc0ccfSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6828abc0ccfSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6838abc0ccfSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
6847a0395d0Smrg
6858abc0ccfSmrgAC_MSG_CHECKING([whether to build text documentation])
6868abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6878abc0ccfSmrg   test x$BUILD_TXTDOC != xno; then
6888abc0ccfSmrg	BUILDTXTDOC=yes
6897366012aSmrgfi
6908abc0ccfSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6918abc0ccfSmrgAC_MSG_RESULT([$BUILDTXTDOC])
6927366012aSmrg
6938abc0ccfSmrgAC_MSG_CHECKING([whether to build PDF documentation])
6948abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6958abc0ccfSmrg   test x$BUILD_PDFDOC != xno; then
6968abc0ccfSmrg	BUILDPDFDOC=yes
6978abc0ccfSmrgfi
6988abc0ccfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6998abc0ccfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
7007a0395d0Smrg
7018abc0ccfSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
7028abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
7038abc0ccfSmrg   test x$BUILD_PSDOC != xno; then
7048abc0ccfSmrg	BUILDPSDOC=yes
7058abc0ccfSmrgfi
7068abc0ccfSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
7078abc0ccfSmrgAC_MSG_RESULT([$BUILDPSDOC])
7087a0395d0Smrg
7098abc0ccfSmrgAC_MSG_CHECKING([whether to build HTML documentation])
7108abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
7118abc0ccfSmrg   test x$BUILD_HTMLDOC != xno; then
7128abc0ccfSmrg	BUILDHTMLDOC=yes
7138abc0ccfSmrgfi
7148abc0ccfSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
7158abc0ccfSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
7167a0395d0Smrg
7178abc0ccfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
7188abc0ccfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
7198abc0ccfSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
7208abc0ccfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
7217a0395d0Smrg
7228abc0ccfSmrgAC_SUBST(MAKE_TEXT)
7238abc0ccfSmrgAC_SUBST(MAKE_PS)
7248abc0ccfSmrgAC_SUBST(MAKE_PDF)
7258abc0ccfSmrgAC_SUBST(MAKE_HTML)
7268abc0ccfSmrg]) # XORG_CHECK_DOCBOOK
7277366012aSmrg
7288abc0ccfSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
7298abc0ccfSmrg# ----------------
7308abc0ccfSmrg# Minimum version: 1.5.0
7318abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
7327a0395d0Smrg#
7338abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
7348abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
7358abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
7368abc0ccfSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
7378abc0ccfSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
7388abc0ccfSmrg# --with-xmlto assumes 'auto'.
7397a0395d0Smrg#
7408abc0ccfSmrg# Interface to module:
7418abc0ccfSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
7428abc0ccfSmrg# XMLTO:	returns the path of the xmlto program found
7438abc0ccfSmrg#		returns the path set by the user in the environment
7448abc0ccfSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
7458abc0ccfSmrg#		'no' user instructs the module not to use xmlto
7468abc0ccfSmrg#
7478abc0ccfSmrg# Added in version 1.10.0
7488abc0ccfSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
7498abc0ccfSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
7508abc0ccfSmrg#
7518abc0ccfSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
7528abc0ccfSmrg#
7538abc0ccfSmrgAC_DEFUN([XORG_WITH_XMLTO],[
7548abc0ccfSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
7558abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
7568abc0ccfSmrgAC_ARG_WITH(xmlto,
7578abc0ccfSmrg	AS_HELP_STRING([--with-xmlto],
7588abc0ccfSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
7598abc0ccfSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
7608abc0ccfSmrgm4_undefine([_defopt])
7617366012aSmrg
7628abc0ccfSmrgif test "x$use_xmlto" = x"auto"; then
7638abc0ccfSmrg   AC_PATH_PROG([XMLTO], [xmlto])
7648abc0ccfSmrg   if test "x$XMLTO" = "x"; then
7658abc0ccfSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
7668abc0ccfSmrg	have_xmlto=no
7678abc0ccfSmrg   else
7688abc0ccfSmrg        have_xmlto=yes
7698abc0ccfSmrg   fi
7708abc0ccfSmrgelif test "x$use_xmlto" = x"yes" ; then
7718abc0ccfSmrg   AC_PATH_PROG([XMLTO], [xmlto])
7728abc0ccfSmrg   if test "x$XMLTO" = "x"; then
7738abc0ccfSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
7748abc0ccfSmrg   fi
7758abc0ccfSmrg   have_xmlto=yes
7768abc0ccfSmrgelif test "x$use_xmlto" = x"no" ; then
7778abc0ccfSmrg   if test "x$XMLTO" != "x"; then
7788abc0ccfSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7798abc0ccfSmrg   fi
7808abc0ccfSmrg   have_xmlto=no
7817366012aSmrgelse
7828abc0ccfSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7837a0395d0Smrgfi
7847a0395d0Smrg
7858abc0ccfSmrg# Test for a minimum version of xmlto, if provided.
7868abc0ccfSmrgm4_ifval([$1],
7878abc0ccfSmrg[if test "$have_xmlto" = yes; then
7888abc0ccfSmrg    # scrape the xmlto version
7898abc0ccfSmrg    AC_MSG_CHECKING([the xmlto version])
7908abc0ccfSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7918abc0ccfSmrg    AC_MSG_RESULT([$xmlto_version])
7928abc0ccfSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7938abc0ccfSmrg        [if test "x$use_xmlto" = xauto; then
7948abc0ccfSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7958abc0ccfSmrg            have_xmlto=no
7968abc0ccfSmrg        else
7978abc0ccfSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7988abc0ccfSmrg        fi])
7998abc0ccfSmrgfi])
8007a0395d0Smrg
8018abc0ccfSmrg# Test for the ability of xmlto to generate a text target
80240c5344fSmrg#
80340c5344fSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
80440c5344fSmrg# following test for empty XML docbook files.
80540c5344fSmrg# For compatibility reasons use the following empty XML docbook file and if
80640c5344fSmrg# it fails try it again with a non-empty XML file.
8078abc0ccfSmrghave_xmlto_text=no
8088abc0ccfSmrgcat > conftest.xml << "EOF"
8098abc0ccfSmrgEOF
8108abc0ccfSmrgAS_IF([test "$have_xmlto" = yes],
8118abc0ccfSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
8128abc0ccfSmrg             [have_xmlto_text=yes],
81340c5344fSmrg             [# Try it again with a non-empty XML file.
81440c5344fSmrg              cat > conftest.xml << "EOF"
81540c5344fSmrg<x></x>
81640c5344fSmrgEOF
81740c5344fSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
81840c5344fSmrg                    [have_xmlto_text=yes],
81940c5344fSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
8208abc0ccfSmrgrm -f conftest.xml
8218abc0ccfSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
8228abc0ccfSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
8238abc0ccfSmrg]) # XORG_WITH_XMLTO
8247a0395d0Smrg
8258abc0ccfSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
8268abc0ccfSmrg# --------------------------------------------
8278abc0ccfSmrg# Minimum version: 1.12.0
8288abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.12.0
8297366012aSmrg#
8308abc0ccfSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
8318abc0ccfSmrg# XML-based language used for the transformation of XML documents.
8328abc0ccfSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
8338abc0ccfSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
8348abc0ccfSmrg# The XSLT processor is often used as a standalone tool for transformations.
8358abc0ccfSmrg# It should not be assumed that this tool is used only to work with documnetation.
8368abc0ccfSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
8378abc0ccfSmrg#
8388abc0ccfSmrg# Interface to module:
8398abc0ccfSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
8408abc0ccfSmrg# XSLTPROC:	 returns the path of the xsltproc program found
8418abc0ccfSmrg#		 returns the path set by the user in the environment
8428abc0ccfSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
8438abc0ccfSmrg#		  'no' user instructs the module not to use xsltproc
8448abc0ccfSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
8458abc0ccfSmrg#
8468abc0ccfSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
8478abc0ccfSmrg#
8488abc0ccfSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
8498abc0ccfSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
8508abc0ccfSmrg# Preserves the interface, should it be implemented later
8518abc0ccfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
8528abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
8538abc0ccfSmrgAC_ARG_WITH(xsltproc,
8548abc0ccfSmrg	AS_HELP_STRING([--with-xsltproc],
8558abc0ccfSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
8568abc0ccfSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
8578abc0ccfSmrgm4_undefine([_defopt])
8587366012aSmrg
8598abc0ccfSmrgif test "x$use_xsltproc" = x"auto"; then
8608abc0ccfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8618abc0ccfSmrg   if test "x$XSLTPROC" = "x"; then
8628abc0ccfSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
8638abc0ccfSmrg	have_xsltproc=no
8648abc0ccfSmrg   else
8658abc0ccfSmrg        have_xsltproc=yes
8667366012aSmrg   fi
8678abc0ccfSmrgelif test "x$use_xsltproc" = x"yes" ; then
8688abc0ccfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8698abc0ccfSmrg   if test "x$XSLTPROC" = "x"; then
8708abc0ccfSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
8717366012aSmrg   fi
8728abc0ccfSmrg   have_xsltproc=yes
8738abc0ccfSmrgelif test "x$use_xsltproc" = x"no" ; then
8748abc0ccfSmrg   if test "x$XSLTPROC" != "x"; then
8758abc0ccfSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8768abc0ccfSmrg   fi
8778abc0ccfSmrg   have_xsltproc=no
8787366012aSmrgelse
8798abc0ccfSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8807366012aSmrgfi
8817a0395d0Smrg
8828abc0ccfSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8838abc0ccfSmrg]) # XORG_WITH_XSLTPROC
8847a0395d0Smrg
8858abc0ccfSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8868abc0ccfSmrg# ----------------------------------------
8878abc0ccfSmrg# Minimum version: 1.15.0
8887a0395d0Smrg#
8898abc0ccfSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
8908abc0ccfSmrg# scanning arbitrary text files, extracting information from those text files,
8918abc0ccfSmrg# and printing reports based on that information.
8927366012aSmrg#
8938abc0ccfSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8948abc0ccfSmrg#
8958abc0ccfSmrg# Interface to module:
8968abc0ccfSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
8978abc0ccfSmrg# PERL:	     returns the path of the perl program found
8988abc0ccfSmrg#	     returns the path set by the user in the environment
8998abc0ccfSmrg# --with-perl: 'yes' user instructs the module to use perl
9008abc0ccfSmrg#	       'no' user instructs the module not to use perl
9018abc0ccfSmrg# have_perl: returns yes if perl found in PATH or no
9028abc0ccfSmrg#
9038abc0ccfSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
9048abc0ccfSmrg#
9058abc0ccfSmrgAC_DEFUN([XORG_WITH_PERL],[
9068abc0ccfSmrgAC_ARG_VAR([PERL], [Path to perl command])
9078abc0ccfSmrg# Preserves the interface, should it be implemented later
9088abc0ccfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
9098abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
9108abc0ccfSmrgAC_ARG_WITH(perl,
9118abc0ccfSmrg	AS_HELP_STRING([--with-perl],
9128abc0ccfSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
9138abc0ccfSmrg	   [use_perl=$withval], [use_perl=]_defopt)
9148abc0ccfSmrgm4_undefine([_defopt])
9157a0395d0Smrg
9168abc0ccfSmrgif test "x$use_perl" = x"auto"; then
9178abc0ccfSmrg   AC_PATH_PROG([PERL], [perl])
9188abc0ccfSmrg   if test "x$PERL" = "x"; then
9198abc0ccfSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
9208abc0ccfSmrg	have_perl=no
9218abc0ccfSmrg   else
9228abc0ccfSmrg        have_perl=yes
9238abc0ccfSmrg   fi
9248abc0ccfSmrgelif test "x$use_perl" = x"yes" ; then
9258abc0ccfSmrg   AC_PATH_PROG([PERL], [perl])
9268abc0ccfSmrg   if test "x$PERL" = "x"; then
9278abc0ccfSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
9288abc0ccfSmrg   fi
9298abc0ccfSmrg   have_perl=yes
9308abc0ccfSmrgelif test "x$use_perl" = x"no" ; then
9318abc0ccfSmrg   if test "x$PERL" != "x"; then
9328abc0ccfSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
9338abc0ccfSmrg   fi
9348abc0ccfSmrg   have_perl=no
9358abc0ccfSmrgelse
9368abc0ccfSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
9378abc0ccfSmrgfi
9387366012aSmrg
9398abc0ccfSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
9408abc0ccfSmrg]) # XORG_WITH_PERL
9417366012aSmrg
9428abc0ccfSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
9438abc0ccfSmrg# ----------------
9448abc0ccfSmrg# Minimum version: 1.5.0
9458abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
9467a0395d0Smrg#
9478abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
9488abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
9498abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
9508abc0ccfSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
9518abc0ccfSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
9528abc0ccfSmrg# --with-asciidoc assumes 'auto'.
9537a0395d0Smrg#
9548abc0ccfSmrg# Interface to module:
9558abc0ccfSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
9568abc0ccfSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
9578abc0ccfSmrg#		 returns the path set by the user in the environment
9588abc0ccfSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
9598abc0ccfSmrg#		  'no' user instructs the module not to use asciidoc
9607a0395d0Smrg#
9618abc0ccfSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
9628abc0ccfSmrg#
9638abc0ccfSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
9648abc0ccfSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
9658abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
9668abc0ccfSmrgAC_ARG_WITH(asciidoc,
9678abc0ccfSmrg	AS_HELP_STRING([--with-asciidoc],
9688abc0ccfSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
9698abc0ccfSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
9708abc0ccfSmrgm4_undefine([_defopt])
9717366012aSmrg
9728abc0ccfSmrgif test "x$use_asciidoc" = x"auto"; then
9738abc0ccfSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9748abc0ccfSmrg   if test "x$ASCIIDOC" = "x"; then
9758abc0ccfSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9768abc0ccfSmrg	have_asciidoc=no
9778abc0ccfSmrg   else
9788abc0ccfSmrg        have_asciidoc=yes
9798abc0ccfSmrg   fi
9808abc0ccfSmrgelif test "x$use_asciidoc" = x"yes" ; then
9818abc0ccfSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9828abc0ccfSmrg   if test "x$ASCIIDOC" = "x"; then
9838abc0ccfSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9848abc0ccfSmrg   fi
9858abc0ccfSmrg   have_asciidoc=yes
9868abc0ccfSmrgelif test "x$use_asciidoc" = x"no" ; then
9878abc0ccfSmrg   if test "x$ASCIIDOC" != "x"; then
9888abc0ccfSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9898abc0ccfSmrg   fi
9908abc0ccfSmrg   have_asciidoc=no
9918abc0ccfSmrgelse
9928abc0ccfSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9938abc0ccfSmrgfi
9948abc0ccfSmrgm4_ifval([$1],
9958abc0ccfSmrg[if test "$have_asciidoc" = yes; then
9968abc0ccfSmrg    # scrape the asciidoc version
9978abc0ccfSmrg    AC_MSG_CHECKING([the asciidoc version])
9988abc0ccfSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9998abc0ccfSmrg    AC_MSG_RESULT([$asciidoc_version])
10008abc0ccfSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
10018abc0ccfSmrg        [if test "x$use_asciidoc" = xauto; then
10028abc0ccfSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
10038abc0ccfSmrg            have_asciidoc=no
10048abc0ccfSmrg        else
10058abc0ccfSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
10068abc0ccfSmrg        fi])
10078abc0ccfSmrgfi])
10088abc0ccfSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
10098abc0ccfSmrg]) # XORG_WITH_ASCIIDOC
10107366012aSmrg
10118abc0ccfSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
101240c5344fSmrg# -------------------------------------------
10138abc0ccfSmrg# Minimum version: 1.5.0
10148abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
101540c5344fSmrg# Minimum version for optional DOT checking: 1.18.0
10162852888eSmrg#
10178abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
10188abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
10198abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
10208abc0ccfSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
10218abc0ccfSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
10228abc0ccfSmrg# --with-doxygen assumes 'auto'.
10232852888eSmrg#
10248abc0ccfSmrg# Interface to module:
10258abc0ccfSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
10268abc0ccfSmrg# DOXYGEN:	 returns the path of the doxygen program found
10278abc0ccfSmrg#		 returns the path set by the user in the environment
10288abc0ccfSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
10298abc0ccfSmrg#		  'no' user instructs the module not to use doxygen
10302852888eSmrg#
10318abc0ccfSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
10322852888eSmrg#
10338abc0ccfSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
10348abc0ccfSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
103540c5344fSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
10368abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
10378abc0ccfSmrgAC_ARG_WITH(doxygen,
10388abc0ccfSmrg	AS_HELP_STRING([--with-doxygen],
10398abc0ccfSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
10408abc0ccfSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
10418abc0ccfSmrgm4_undefine([_defopt])
10422852888eSmrg
10438abc0ccfSmrgif test "x$use_doxygen" = x"auto"; then
10448abc0ccfSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10458abc0ccfSmrg   if test "x$DOXYGEN" = "x"; then
10468abc0ccfSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
10478abc0ccfSmrg	have_doxygen=no
10488abc0ccfSmrg   else
10498abc0ccfSmrg        have_doxygen=yes
10508abc0ccfSmrg   fi
10518abc0ccfSmrgelif test "x$use_doxygen" = x"yes" ; then
10528abc0ccfSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10538abc0ccfSmrg   if test "x$DOXYGEN" = "x"; then
10548abc0ccfSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
10558abc0ccfSmrg   fi
10568abc0ccfSmrg   have_doxygen=yes
10578abc0ccfSmrgelif test "x$use_doxygen" = x"no" ; then
10588abc0ccfSmrg   if test "x$DOXYGEN" != "x"; then
10598abc0ccfSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
10608abc0ccfSmrg   fi
10618abc0ccfSmrg   have_doxygen=no
10628abc0ccfSmrgelse
10638abc0ccfSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
10642852888eSmrgfi
10658abc0ccfSmrgm4_ifval([$1],
10668abc0ccfSmrg[if test "$have_doxygen" = yes; then
10678abc0ccfSmrg    # scrape the doxygen version
10688abc0ccfSmrg    AC_MSG_CHECKING([the doxygen version])
10698abc0ccfSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
10708abc0ccfSmrg    AC_MSG_RESULT([$doxygen_version])
10718abc0ccfSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
10728abc0ccfSmrg        [if test "x$use_doxygen" = xauto; then
10738abc0ccfSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
10748abc0ccfSmrg            have_doxygen=no
10758abc0ccfSmrg        else
10768abc0ccfSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10778abc0ccfSmrg        fi])
10788abc0ccfSmrgfi])
107940c5344fSmrg
108040c5344fSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
108140c5344fSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
108240c5344fSmrgdnl 	HAVE_DOT = @HAVE_DOT@
108340c5344fSmrgHAVE_DOT=no
108440c5344fSmrgif test "x$have_doxygen" = "xyes"; then
108540c5344fSmrg  AC_PATH_PROG([DOT], [dot])
108640c5344fSmrg    if test "x$DOT" != "x"; then
108740c5344fSmrg      HAVE_DOT=yes
108840c5344fSmrg    fi
108940c5344fSmrgfi
109040c5344fSmrg
109140c5344fSmrgAC_SUBST([HAVE_DOT])
109240c5344fSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10938abc0ccfSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10948abc0ccfSmrg]) # XORG_WITH_DOXYGEN
10952852888eSmrg
10968abc0ccfSmrg# XORG_WITH_GROFF([DEFAULT])
10978abc0ccfSmrg# ----------------
10988abc0ccfSmrg# Minimum version: 1.6.0
10998abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
11002852888eSmrg#
11018abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
11028abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
11038abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
11048abc0ccfSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
11058abc0ccfSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
11068abc0ccfSmrg# --with-groff assumes 'auto'.
11072852888eSmrg#
11088abc0ccfSmrg# Interface to module:
11098abc0ccfSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
11108abc0ccfSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
11118abc0ccfSmrg# HAVE_GROFF_MS: the -ms macros package
11128abc0ccfSmrg# GROFF:	 returns the path of the groff program found
11138abc0ccfSmrg#		 returns the path set by the user in the environment
11148abc0ccfSmrg# --with-groff:	 'yes' user instructs the module to use groff
11158abc0ccfSmrg#		 'no' user instructs the module not to use groff
111696402570Smrg#
11178abc0ccfSmrg# Added in version 1.9.0:
11188abc0ccfSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
11198abc0ccfSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
11208abc0ccfSmrg#		   psselect from the psutils package.
11218abc0ccfSmrg#		   the ghostcript package. Refer to the grohtml man pages
11222852888eSmrg#
11238abc0ccfSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
11242852888eSmrg#
11258abc0ccfSmrg# OS and distros often splits groff in a basic and full package, the former
11268abc0ccfSmrg# having the groff program and the later having devices, fonts and macros
11278abc0ccfSmrg# Checking for the groff executable is not enough.
11282852888eSmrg#
11298abc0ccfSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
11308abc0ccfSmrg# unset HAVE_GROFF or GROFF env variables.
11318abc0ccfSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
11322852888eSmrg#
11338abc0ccfSmrgAC_DEFUN([XORG_WITH_GROFF],[
11348abc0ccfSmrgAC_ARG_VAR([GROFF], [Path to groff command])
11358abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
11368abc0ccfSmrgAC_ARG_WITH(groff,
11378abc0ccfSmrg	AS_HELP_STRING([--with-groff],
11388abc0ccfSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
11398abc0ccfSmrg	   [use_groff=$withval], [use_groff=]_defopt)
11408abc0ccfSmrgm4_undefine([_defopt])
11412852888eSmrg
11428abc0ccfSmrgif test "x$use_groff" = x"auto"; then
11438abc0ccfSmrg   AC_PATH_PROG([GROFF], [groff])
11448abc0ccfSmrg   if test "x$GROFF" = "x"; then
11458abc0ccfSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
11468abc0ccfSmrg	have_groff=no
11478abc0ccfSmrg   else
11488abc0ccfSmrg        have_groff=yes
11498abc0ccfSmrg   fi
11508abc0ccfSmrgelif test "x$use_groff" = x"yes" ; then
11518abc0ccfSmrg   AC_PATH_PROG([GROFF], [groff])
11528abc0ccfSmrg   if test "x$GROFF" = "x"; then
11538abc0ccfSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
11548abc0ccfSmrg   fi
11558abc0ccfSmrg   have_groff=yes
11568abc0ccfSmrgelif test "x$use_groff" = x"no" ; then
11578abc0ccfSmrg   if test "x$GROFF" != "x"; then
11588abc0ccfSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
11598abc0ccfSmrg   fi
11608abc0ccfSmrg   have_groff=no
11618abc0ccfSmrgelse
11628abc0ccfSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
11638abc0ccfSmrgfi
11642852888eSmrg
11658abc0ccfSmrg# We have groff, test for the presence of the macro packages
11668abc0ccfSmrgif test "x$have_groff" = x"yes"; then
11678abc0ccfSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
11688abc0ccfSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
11698abc0ccfSmrg        groff_ms_works=yes
11708abc0ccfSmrg    else
11718abc0ccfSmrg        groff_ms_works=no
11728abc0ccfSmrg    fi
11738abc0ccfSmrg    AC_MSG_RESULT([$groff_ms_works])
11748abc0ccfSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11758abc0ccfSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11768abc0ccfSmrg        groff_mm_works=yes
11778abc0ccfSmrg    else
11788abc0ccfSmrg        groff_mm_works=no
11798abc0ccfSmrg    fi
11808abc0ccfSmrg    AC_MSG_RESULT([$groff_mm_works])
11818abc0ccfSmrgfi
11822852888eSmrg
11838abc0ccfSmrg# We have groff, test for HTML dependencies, one command per package
11848abc0ccfSmrgif test "x$have_groff" = x"yes"; then
11858abc0ccfSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11868abc0ccfSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11878abc0ccfSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11888abc0ccfSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11898abc0ccfSmrg      have_groff_html=yes
11908abc0ccfSmrg   else
11918abc0ccfSmrg      have_groff_html=no
11928abc0ccfSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11938abc0ccfSmrg   fi
11948abc0ccfSmrgfi
11952852888eSmrg
11968abc0ccfSmrg# Set Automake conditionals for Makefiles
11978abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11988abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11998abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
12008abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
12018abc0ccfSmrg]) # XORG_WITH_GROFF
12027366012aSmrg
12038abc0ccfSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
12048abc0ccfSmrg# ---------------------------------------
12058abc0ccfSmrg# Minimum version: 1.6.0
12068abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
12078abc0ccfSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
12087a0395d0Smrg#
12098abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
12108abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
12118abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
12128abc0ccfSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
12138abc0ccfSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
12148abc0ccfSmrg# --with-fop assumes 'auto'.
12157a0395d0Smrg#
12168abc0ccfSmrg# Interface to module:
12178abc0ccfSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
12188abc0ccfSmrg# FOP:	 	returns the path of the fop program found
12198abc0ccfSmrg#		returns the path set by the user in the environment
12208abc0ccfSmrg# --with-fop: 	'yes' user instructs the module to use fop
12218abc0ccfSmrg#		'no' user instructs the module not to use fop
12227a0395d0Smrg#
12238abc0ccfSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
12247a0395d0Smrg#
12258abc0ccfSmrgAC_DEFUN([XORG_WITH_FOP],[
12268abc0ccfSmrgAC_ARG_VAR([FOP], [Path to fop command])
12278abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
12288abc0ccfSmrgAC_ARG_WITH(fop,
12298abc0ccfSmrg	AS_HELP_STRING([--with-fop],
12308abc0ccfSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
12318abc0ccfSmrg	   [use_fop=$withval], [use_fop=]_defopt)
12328abc0ccfSmrgm4_undefine([_defopt])
12337a0395d0Smrg
12348abc0ccfSmrgif test "x$use_fop" = x"auto"; then
12358abc0ccfSmrg   AC_PATH_PROG([FOP], [fop])
12368abc0ccfSmrg   if test "x$FOP" = "x"; then
12378abc0ccfSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
12388abc0ccfSmrg	have_fop=no
12398abc0ccfSmrg   else
12408abc0ccfSmrg        have_fop=yes
12418abc0ccfSmrg   fi
12428abc0ccfSmrgelif test "x$use_fop" = x"yes" ; then
12438abc0ccfSmrg   AC_PATH_PROG([FOP], [fop])
12448abc0ccfSmrg   if test "x$FOP" = "x"; then
12458abc0ccfSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
12468abc0ccfSmrg   fi
12478abc0ccfSmrg   have_fop=yes
12488abc0ccfSmrgelif test "x$use_fop" = x"no" ; then
12498abc0ccfSmrg   if test "x$FOP" != "x"; then
12508abc0ccfSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
12518abc0ccfSmrg   fi
12528abc0ccfSmrg   have_fop=no
12537366012aSmrgelse
12548abc0ccfSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
12557a0395d0Smrgfi
12567a0395d0Smrg
12578abc0ccfSmrg# Test for a minimum version of fop, if provided.
12588abc0ccfSmrgm4_ifval([$1],
12598abc0ccfSmrg[if test "$have_fop" = yes; then
12608abc0ccfSmrg    # scrape the fop version
12618abc0ccfSmrg    AC_MSG_CHECKING([for fop minimum version])
12628abc0ccfSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
12638abc0ccfSmrg    AC_MSG_RESULT([$fop_version])
12648abc0ccfSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
12658abc0ccfSmrg        [if test "x$use_fop" = xauto; then
12668abc0ccfSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
12678abc0ccfSmrg            have_fop=no
12688abc0ccfSmrg        else
12698abc0ccfSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
12708abc0ccfSmrg        fi])
12718abc0ccfSmrgfi])
12728abc0ccfSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
12738abc0ccfSmrg]) # XORG_WITH_FOP
12747a0395d0Smrg
127540c5344fSmrg# XORG_WITH_M4([MIN-VERSION])
127640c5344fSmrg# ---------------------------
127740c5344fSmrg# Minimum version: 1.19.0
127840c5344fSmrg#
127940c5344fSmrg# This macro attempts to locate an m4 macro processor which supports
128040c5344fSmrg# -I option and is only useful for modules relying on M4 in order to
128140c5344fSmrg# expand macros in source code files.
128240c5344fSmrg#
128340c5344fSmrg# Interface to module:
128440c5344fSmrg# M4:	 	returns the path of the m4 program found
128540c5344fSmrg#		returns the path set by the user in the environment
128640c5344fSmrg#
128740c5344fSmrgAC_DEFUN([XORG_WITH_M4], [
128840c5344fSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
128940c5344fSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
129040c5344fSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
129140c5344fSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
129240c5344fSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
129340c5344fSmrg   [$PATH:/usr/gnu/bin])])
129440c5344fSmrg
129540c5344fSmrgAC_SUBST([M4], [$ac_cv_path_M4])
129640c5344fSmrg]) # XORG_WITH_M4
129740c5344fSmrg
12988abc0ccfSmrg# XORG_WITH_PS2PDF([DEFAULT])
12998abc0ccfSmrg# ----------------
13008abc0ccfSmrg# Minimum version: 1.6.0
13018abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
13022adc0320Smrg#
13038abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
13048abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
13058abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
13068abc0ccfSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
13078abc0ccfSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
13088abc0ccfSmrg# --with-ps2pdf assumes 'auto'.
13097a0395d0Smrg#
13108abc0ccfSmrg# Interface to module:
13118abc0ccfSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
13128abc0ccfSmrg# PS2PDF:	returns the path of the ps2pdf program found
13138abc0ccfSmrg#		returns the path set by the user in the environment
13148abc0ccfSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
13158abc0ccfSmrg#		 'no' user instructs the module not to use ps2pdf
13168abc0ccfSmrg#
13178abc0ccfSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
13188abc0ccfSmrg#
13198abc0ccfSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
13208abc0ccfSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
13218abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
13228abc0ccfSmrgAC_ARG_WITH(ps2pdf,
13238abc0ccfSmrg	AS_HELP_STRING([--with-ps2pdf],
13248abc0ccfSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
13258abc0ccfSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
13268abc0ccfSmrgm4_undefine([_defopt])
13277a0395d0Smrg
13288abc0ccfSmrgif test "x$use_ps2pdf" = x"auto"; then
13298abc0ccfSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13308abc0ccfSmrg   if test "x$PS2PDF" = "x"; then
13318abc0ccfSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
13328abc0ccfSmrg	have_ps2pdf=no
13338abc0ccfSmrg   else
13348abc0ccfSmrg        have_ps2pdf=yes
13358abc0ccfSmrg   fi
13368abc0ccfSmrgelif test "x$use_ps2pdf" = x"yes" ; then
13378abc0ccfSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13388abc0ccfSmrg   if test "x$PS2PDF" = "x"; then
13398abc0ccfSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
13408abc0ccfSmrg   fi
13418abc0ccfSmrg   have_ps2pdf=yes
13428abc0ccfSmrgelif test "x$use_ps2pdf" = x"no" ; then
13438abc0ccfSmrg   if test "x$PS2PDF" != "x"; then
13448abc0ccfSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
13458abc0ccfSmrg   fi
13468abc0ccfSmrg   have_ps2pdf=no
13477366012aSmrgelse
13488abc0ccfSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
13497366012aSmrgfi
13508abc0ccfSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
13518abc0ccfSmrg]) # XORG_WITH_PS2PDF
13527a0395d0Smrg
13538abc0ccfSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
13542adc0320Smrg# ----------------
13558abc0ccfSmrg# Minimum version: 1.6.0
13562adc0320Smrg#
13572adc0320Smrg# Documentation tools are not always available on all platforms and sometimes
13588abc0ccfSmrg# not at the appropriate level. This macro enables a builder to skip all
13598abc0ccfSmrg# documentation targets except traditional man pages.
13608abc0ccfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13618abc0ccfSmrg# maximum flexibilty in controlling documentation building.
13628abc0ccfSmrg# Refer to:
13638abc0ccfSmrg# XORG_WITH_XMLTO         --with-xmlto
13648abc0ccfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13658abc0ccfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
13668abc0ccfSmrg# XORG_WITH_FOP           --with-fop
13678abc0ccfSmrg# XORG_WITH_GROFF         --with-groff
13688abc0ccfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
13692adc0320Smrg#
13702adc0320Smrg# Interface to module:
13718abc0ccfSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
13728abc0ccfSmrg# --enable-docs: 'yes' user instructs the module to generate docs
13738abc0ccfSmrg#		 'no' user instructs the module not to generate docs
13748abc0ccfSmrg# parm1:	specify the default value, yes or no.
13752adc0320Smrg#
13768abc0ccfSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13778abc0ccfSmrgm4_define([docs_default], m4_default([$1], [yes]))
13788abc0ccfSmrgAC_ARG_ENABLE(docs,
13798abc0ccfSmrg	AS_HELP_STRING([--enable-docs],
13808abc0ccfSmrg	   [Enable building the documentation (default: ]docs_default[)]),
13818abc0ccfSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
13828abc0ccfSmrgm4_undefine([docs_default])
13838abc0ccfSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13848abc0ccfSmrgAC_MSG_CHECKING([whether to build documentation])
13858abc0ccfSmrgAC_MSG_RESULT([$build_docs])
13868abc0ccfSmrg]) # XORG_ENABLE_DOCS
13872adc0320Smrg
13888abc0ccfSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13898abc0ccfSmrg# ----------------
13908abc0ccfSmrg# Minimum version: 1.6.0
13912852888eSmrg#
13928abc0ccfSmrg# This macro enables a builder to skip all developer documentation.
13938abc0ccfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13948abc0ccfSmrg# maximum flexibilty in controlling documentation building.
13958abc0ccfSmrg# Refer to:
13968abc0ccfSmrg# XORG_WITH_XMLTO         --with-xmlto
13978abc0ccfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13988abc0ccfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
13998abc0ccfSmrg# XORG_WITH_FOP           --with-fop
14008abc0ccfSmrg# XORG_WITH_GROFF         --with-groff
14018abc0ccfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
14022852888eSmrg#
14032852888eSmrg# Interface to module:
14048abc0ccfSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
14058abc0ccfSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
14068abc0ccfSmrg#			'no' user instructs the module not to generate developer docs
14078abc0ccfSmrg# parm1:		specify the default value, yes or no.
14082852888eSmrg#
14098abc0ccfSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
14108abc0ccfSmrgm4_define([devel_default], m4_default([$1], [yes]))
14118abc0ccfSmrgAC_ARG_ENABLE(devel-docs,
14128abc0ccfSmrg	AS_HELP_STRING([--enable-devel-docs],
14138abc0ccfSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
14148abc0ccfSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
14158abc0ccfSmrgm4_undefine([devel_default])
14168abc0ccfSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
14178abc0ccfSmrgAC_MSG_CHECKING([whether to build developer documentation])
14188abc0ccfSmrgAC_MSG_RESULT([$build_devel_docs])
14198abc0ccfSmrg]) # XORG_ENABLE_DEVEL_DOCS
14202852888eSmrg
14218abc0ccfSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
14228abc0ccfSmrg# ----------------
14238abc0ccfSmrg# Minimum version: 1.6.0
14248abc0ccfSmrg#
14258abc0ccfSmrg# This macro enables a builder to skip all functional specification targets.
14268abc0ccfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
14278abc0ccfSmrg# maximum flexibilty in controlling documentation building.
14288abc0ccfSmrg# Refer to:
14298abc0ccfSmrg# XORG_WITH_XMLTO         --with-xmlto
14308abc0ccfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
14318abc0ccfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
14328abc0ccfSmrg# XORG_WITH_FOP           --with-fop
14338abc0ccfSmrg# XORG_WITH_GROFF         --with-groff
14348abc0ccfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
14358abc0ccfSmrg#
14368abc0ccfSmrg# Interface to module:
14378abc0ccfSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
14388abc0ccfSmrg# --enable-specs:	'yes' user instructs the module to generate specs
14398abc0ccfSmrg#			'no' user instructs the module not to generate specs
14408abc0ccfSmrg# parm1:		specify the default value, yes or no.
14418abc0ccfSmrg#
14428abc0ccfSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
14438abc0ccfSmrgm4_define([spec_default], m4_default([$1], [yes]))
14448abc0ccfSmrgAC_ARG_ENABLE(specs,
14458abc0ccfSmrg	AS_HELP_STRING([--enable-specs],
14468abc0ccfSmrg	   [Enable building the specs (default: ]spec_default[)]),
14478abc0ccfSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
14488abc0ccfSmrgm4_undefine([spec_default])
14498abc0ccfSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
14508abc0ccfSmrgAC_MSG_CHECKING([whether to build functional specifications])
14518abc0ccfSmrgAC_MSG_RESULT([$build_specs])
14528abc0ccfSmrg]) # XORG_ENABLE_SPECS
14532852888eSmrg
14548abc0ccfSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
14558abc0ccfSmrg# ----------------------------------------------
14568abc0ccfSmrg# Minimum version: 1.13.0
145796402570Smrg#
14588abc0ccfSmrg# This macro enables a builder to enable/disable unit testing
14598abc0ccfSmrg# It makes no assumption about the test cases implementation
14608abc0ccfSmrg# Test cases may or may not use Automake "Support for test suites"
14618abc0ccfSmrg# They may or may not use the software utility library GLib
146296402570Smrg#
14638abc0ccfSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
14648abc0ccfSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
14658abc0ccfSmrg# The variable enable_unit_tests is used by other macros in this file.
146696402570Smrg#
146796402570Smrg# Interface to module:
14688abc0ccfSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
14698abc0ccfSmrg# enable_unit_tests:    used in configure.ac for additional configuration
14708abc0ccfSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
14718abc0ccfSmrg#			'no' user instructs the module not to build tests
14728abc0ccfSmrg# parm1:		specify the default value, yes or no.
147396402570Smrg#
14748abc0ccfSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14758abc0ccfSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14768abc0ccfSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14778abc0ccfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14788abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
14798abc0ccfSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14808abc0ccfSmrg	[Enable building unit test cases (default: ]_defopt[)]),
14818abc0ccfSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
148296402570Smrgm4_undefine([_defopt])
14838abc0ccfSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14848abc0ccfSmrgAC_MSG_CHECKING([whether to build unit test cases])
14858abc0ccfSmrgAC_MSG_RESULT([$enable_unit_tests])
14868abc0ccfSmrg]) # XORG_ENABLE_UNIT_TESTS
148796402570Smrg
14888abc0ccfSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14898abc0ccfSmrg# ------------------------------------------------------
14908abc0ccfSmrg# Minimum version: 1.17.0
14912adc0320Smrg#
14928abc0ccfSmrg# This macro enables a builder to enable/disable integration testing
14938abc0ccfSmrg# It makes no assumption about the test cases' implementation
14948abc0ccfSmrg# Test cases may or may not use Automake "Support for test suites"
14952adc0320Smrg#
14968abc0ccfSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14978abc0ccfSmrg# usually requires less dependencies and may be built and run under less
14988abc0ccfSmrg# stringent environments than integration tests.
14992adc0320Smrg#
15008abc0ccfSmrg# Interface to module:
15018abc0ccfSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
15028abc0ccfSmrg# enable_integration_tests:   used in configure.ac for additional configuration
15038abc0ccfSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
15048abc0ccfSmrg#                             'no' user instructs the module not to build tests
15058abc0ccfSmrg# parm1:                      specify the default value, yes or no.
15062adc0320Smrg#
15078abc0ccfSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
15088abc0ccfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
15098abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
15108abc0ccfSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
15118abc0ccfSmrg	[Enable building integration test cases (default: ]_defopt[)]),
15128abc0ccfSmrg	[enable_integration_tests=$enableval],
15138abc0ccfSmrg	[enable_integration_tests=]_defopt)
15142852888eSmrgm4_undefine([_defopt])
15158abc0ccfSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
15168abc0ccfSmrg	[test "x$enable_integration_tests" != xno])
15178abc0ccfSmrgAC_MSG_CHECKING([whether to build unit test cases])
15188abc0ccfSmrgAC_MSG_RESULT([$enable_integration_tests])
15198abc0ccfSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
15202adc0320Smrg
15218abc0ccfSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
15228abc0ccfSmrg# ----------------------------------------
15238abc0ccfSmrg# Minimum version: 1.13.0
15242adc0320Smrg#
15258abc0ccfSmrg# GLib is a library which provides advanced data structures and functions.
15268abc0ccfSmrg# This macro enables a module to test for the presence of Glib.
15272adc0320Smrg#
15288abc0ccfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
15298abc0ccfSmrg# Otherwise the value of $enable_unit_tests is blank.
15302adc0320Smrg#
15318abc0ccfSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
15328abc0ccfSmrg# test support usually requires less dependencies and may be built and run under
15338abc0ccfSmrg# less stringent environments than integration tests.
15342adc0320Smrg#
15352adc0320Smrg# Interface to module:
15368abc0ccfSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
15378abc0ccfSmrg# with_glib: used in configure.ac to know if GLib has been found
15388abc0ccfSmrg# --with-glib:	'yes' user instructs the module to use glib
15398abc0ccfSmrg#		'no' user instructs the module not to use glib
15402adc0320Smrg#
15418abc0ccfSmrgAC_DEFUN([XORG_WITH_GLIB],[
15428abc0ccfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
15438abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
15448abc0ccfSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
15458abc0ccfSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
15468abc0ccfSmrg	[with_glib=$withval], [with_glib=]_defopt)
15472852888eSmrgm4_undefine([_defopt])
15482adc0320Smrg
15498abc0ccfSmrghave_glib=no
15508abc0ccfSmrg# Do not probe GLib if user explicitly disabled unit testing
15518abc0ccfSmrgif test "x$enable_unit_tests" != x"no"; then
15528abc0ccfSmrg  # Do not probe GLib if user explicitly disabled it
15538abc0ccfSmrg  if test "x$with_glib" != x"no"; then
15548abc0ccfSmrg    m4_ifval(
15558abc0ccfSmrg      [$1],
15568abc0ccfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
15578abc0ccfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
15588abc0ccfSmrg    )
15598abc0ccfSmrg  fi
15602adc0320Smrgfi
15612adc0320Smrg
15628abc0ccfSmrg# Not having GLib when unit testing has been explicitly requested is an error
15638abc0ccfSmrgif test "x$enable_unit_tests" = x"yes"; then
15648abc0ccfSmrg  if test "x$have_glib" = x"no"; then
15658abc0ccfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15668abc0ccfSmrg  fi
15672adc0320Smrgfi
15682adc0320Smrg
15698abc0ccfSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
15708abc0ccfSmrgif test "x$enable_unit_tests" = x"no"; then
15718abc0ccfSmrg  if test "x$with_glib" = x"yes"; then
15728abc0ccfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15738abc0ccfSmrg  fi
15742adc0320Smrgfi
15752adc0320Smrg
15768abc0ccfSmrg# Not having GLib when it has been explicitly requested is an error
15778abc0ccfSmrgif test "x$with_glib" = x"yes"; then
15788abc0ccfSmrg  if test "x$have_glib" = x"no"; then
15798abc0ccfSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15808abc0ccfSmrg  fi
15818abc0ccfSmrgfi
15822adc0320Smrg
15838abc0ccfSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15848abc0ccfSmrg]) # XORG_WITH_GLIB
15858abc0ccfSmrg
15868abc0ccfSmrg# XORG_LD_WRAP([required|optional])
15878abc0ccfSmrg# ---------------------------------
15888abc0ccfSmrg# Minimum version: 1.13.0
15892adc0320Smrg#
15908abc0ccfSmrg# Check if linker supports -wrap, passed via compiler flags
15912adc0320Smrg#
15928abc0ccfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15938abc0ccfSmrg# Otherwise the value of $enable_unit_tests is blank.
15942adc0320Smrg#
15958abc0ccfSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15968abc0ccfSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15978abc0ccfSmrg# available, an argument of "optional" allows use when some unit tests require
15988abc0ccfSmrg# ld -wrap and others do not.
15992adc0320Smrg#
16008abc0ccfSmrgAC_DEFUN([XORG_LD_WRAP],[
16018abc0ccfSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
16028abc0ccfSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
16038abc0ccfSmrg                      void __wrap_exit(int status) { return; }],
16048abc0ccfSmrg                     [exit(0);])])
16058abc0ccfSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
16068abc0ccfSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
16078abc0ccfSmrg  if test "x$have_ld_wrap" = x"no"; then
16088abc0ccfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
16098abc0ccfSmrg  fi
16102adc0320Smrgfi
16118abc0ccfSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
16128abc0ccfSmrg#
16138abc0ccfSmrg]) # XORG_LD_WRAP
161496402570Smrg
16158abc0ccfSmrg# XORG_CHECK_LINKER_FLAGS
16168abc0ccfSmrg# -----------------------
16178abc0ccfSmrg# SYNOPSIS
16182adc0320Smrg#
16198abc0ccfSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
16202adc0320Smrg#
16218abc0ccfSmrg# DESCRIPTION
16222adc0320Smrg#
16238abc0ccfSmrg#   Check whether the given linker FLAGS work with the current language's
16248abc0ccfSmrg#   linker, or whether they give an error.
16252adc0320Smrg#
16268abc0ccfSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
16278abc0ccfSmrg#   success/failure.
16282adc0320Smrg#
16298abc0ccfSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
16302adc0320Smrg#
16318abc0ccfSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
16322adc0320Smrg#
16338abc0ccfSmrg# LICENSE
16342adc0320Smrg#
16358abc0ccfSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
16368abc0ccfSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
16378abc0ccfSmrg#   Copyright (c) 2009 Matteo Frigo
16382adc0320Smrg#
16398abc0ccfSmrg#   This program is free software: you can redistribute it and/or modify it
16408abc0ccfSmrg#   under the terms of the GNU General Public License as published by the
16418abc0ccfSmrg#   Free Software Foundation, either version 3 of the License, or (at your
16428abc0ccfSmrg#   option) any later version.
16432adc0320Smrg#
16448abc0ccfSmrg#   This program is distributed in the hope that it will be useful, but
16458abc0ccfSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
16468abc0ccfSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16478abc0ccfSmrg#   Public License for more details.
16482adc0320Smrg#
16498abc0ccfSmrg#   You should have received a copy of the GNU General Public License along
16508abc0ccfSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
16512adc0320Smrg#
16528abc0ccfSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
16538abc0ccfSmrg#   gives unlimited permission to copy, distribute and modify the configure
16548abc0ccfSmrg#   scripts that are the output of Autoconf when processing the Macro. You
16558abc0ccfSmrg#   need not follow the terms of the GNU General Public License when using
16568abc0ccfSmrg#   or distributing such scripts, even though portions of the text of the
16578abc0ccfSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
16588abc0ccfSmrg#   all other use of the material that constitutes the Autoconf Macro.
16592adc0320Smrg#
16608abc0ccfSmrg#   This special exception to the GPL applies to versions of the Autoconf
16618abc0ccfSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
16628abc0ccfSmrg#   modified version of the Autoconf Macro, you may extend this special
16638abc0ccfSmrg#   exception to the GPL to apply to your modified version as well.#
16648abc0ccfSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
16658abc0ccfSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
16668abc0ccfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
16678abc0ccfSmrgAS_LITERAL_IF([$1],
16688abc0ccfSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
16698abc0ccfSmrg      ax_save_FLAGS=$LDFLAGS
16708abc0ccfSmrg      LDFLAGS="$1"
16718abc0ccfSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
16728abc0ccfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16738abc0ccfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16748abc0ccfSmrg      LDFLAGS=$ax_save_FLAGS])],
16758abc0ccfSmrg  [ax_save_FLAGS=$LDFLAGS
16768abc0ccfSmrg   LDFLAGS="$1"
16778abc0ccfSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16788abc0ccfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16798abc0ccfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16808abc0ccfSmrg   LDFLAGS=$ax_save_FLAGS])
16818abc0ccfSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16828abc0ccfSmrgAC_MSG_RESULT($xorg_check_linker_flags)
16838abc0ccfSmrgif test "x$xorg_check_linker_flags" = xyes; then
16848abc0ccfSmrg	m4_default([$2], :)
16858abc0ccfSmrgelse
16868abc0ccfSmrg	m4_default([$3], :)
16878abc0ccfSmrgfi
16888abc0ccfSmrg]) # XORG_CHECK_LINKER_FLAGS
16892adc0320Smrg
16908abc0ccfSmrg# XORG_MEMORY_CHECK_FLAGS
16918abc0ccfSmrg# -----------------------
16928abc0ccfSmrg# Minimum version: 1.16.0
16932852888eSmrg#
16948abc0ccfSmrg# This macro attempts to find appropriate memory checking functionality
16958abc0ccfSmrg# for various platforms which unit testing code may use to catch various
16968abc0ccfSmrg# forms of memory allocation and access errors in testing.
16972852888eSmrg#
16982852888eSmrg# Interface to module:
16998abc0ccfSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
17008abc0ccfSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
17012852888eSmrg#
17028abc0ccfSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
170396402570Smrg#
17048abc0ccfSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
17058abc0ccfSmrg
17068abc0ccfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
17078abc0ccfSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
17088abc0ccfSmrg           [Environment variables to enable memory checking in tests])
17098abc0ccfSmrg
17108abc0ccfSmrg# Check for different types of support on different platforms
17118abc0ccfSmrgcase $host_os in
17128abc0ccfSmrg    solaris*)
17138abc0ccfSmrg        AC_CHECK_LIB([umem], [umem_alloc],
17148abc0ccfSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
17158abc0ccfSmrg        ;;
17168abc0ccfSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
17178abc0ccfSmrg        # both directly and inverted, so should not be 0 or 255.
17188abc0ccfSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
17198abc0ccfSmrg        ;;
17208abc0ccfSmrg    darwin*)
17218abc0ccfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
17228abc0ccfSmrg        ;;
17238abc0ccfSmrg    *bsd*)
17248abc0ccfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
17258abc0ccfSmrg        ;;
17268abc0ccfSmrgesac
17278abc0ccfSmrg
17288abc0ccfSmrg# User supplied flags override default flags
17298abc0ccfSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
17308abc0ccfSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
17318abc0ccfSmrgfi
17328abc0ccfSmrg
17338abc0ccfSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
17348abc0ccfSmrg]) # XORG_WITH_LINT
17358abc0ccfSmrg
17368abc0ccfSmrg# XORG_CHECK_MALLOC_ZERO
17378abc0ccfSmrg# ----------------------
17388abc0ccfSmrg# Minimum version: 1.0.0
173996402570Smrg#
17408abc0ccfSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
17418abc0ccfSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
17428abc0ccfSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
17438abc0ccfSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
17448abc0ccfSmrgAC_ARG_ENABLE(malloc0returnsnull,
17458abc0ccfSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
17468abc0ccfSmrg		       [malloc(0) returns NULL (default: auto)]),
17478abc0ccfSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
17488abc0ccfSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
17498abc0ccfSmrg
17508abc0ccfSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
17518abc0ccfSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
175240c5344fSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
175340c5344fSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
17548abc0ccfSmrg#include <stdlib.h>
17558abc0ccfSmrg],[
17568abc0ccfSmrg    char *m0, *r0, *c0, *p;
17578abc0ccfSmrg    m0 = malloc(0);
17588abc0ccfSmrg    p = malloc(10);
17598abc0ccfSmrg    r0 = realloc(p,0);
17608abc0ccfSmrg    c0 = calloc(0,10);
17618abc0ccfSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
17628abc0ccfSmrg])],
176340c5344fSmrg		[xorg_cv_malloc0_returns_null=yes],
176440c5344fSmrg		[xorg_cv_malloc0_returns_null=no])])
176540c5344fSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
17668abc0ccfSmrgfi
17678abc0ccfSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
17688abc0ccfSmrg
17698abc0ccfSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
17708abc0ccfSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
17718abc0ccfSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
17728abc0ccfSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
17738abc0ccfSmrgelse
17748abc0ccfSmrg	MALLOC_ZERO_CFLAGS=""
17758abc0ccfSmrg	XMALLOC_ZERO_CFLAGS=""
17768abc0ccfSmrg	XTMALLOC_ZERO_CFLAGS=""
17778abc0ccfSmrgfi
17788abc0ccfSmrg
17798abc0ccfSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17808abc0ccfSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17818abc0ccfSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17828abc0ccfSmrg]) # XORG_CHECK_MALLOC_ZERO
17838abc0ccfSmrg
17848abc0ccfSmrg# XORG_WITH_LINT()
17858abc0ccfSmrg# ----------------
17868abc0ccfSmrg# Minimum version: 1.1.0
17878abc0ccfSmrg#
17888abc0ccfSmrg# This macro enables the use of a tool that flags some suspicious and
17898abc0ccfSmrg# non-portable constructs (likely to be bugs) in C language source code.
17908abc0ccfSmrg# It will attempt to locate the tool and use appropriate options.
17918abc0ccfSmrg# There are various lint type tools on different platforms.
179296402570Smrg#
179396402570Smrg# Interface to module:
17948abc0ccfSmrg# LINT:		returns the path to the tool found on the platform
17958abc0ccfSmrg#		or the value set to LINT on the configure cmd line
17968abc0ccfSmrg#		also an Automake conditional
17978abc0ccfSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
17988abc0ccfSmrg#
17998abc0ccfSmrg# --with-lint:	'yes' user instructs the module to use lint
18008abc0ccfSmrg#		'no' user instructs the module not to use lint (default)
18018abc0ccfSmrg#
18028abc0ccfSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
18038abc0ccfSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
18048abc0ccfSmrg#
18058abc0ccfSmrgAC_DEFUN([XORG_WITH_LINT],[
18068abc0ccfSmrg
18078abc0ccfSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
18088abc0ccfSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
18098abc0ccfSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
18108abc0ccfSmrg		[Use a lint-style source code checker (default: disabled)])],
18118abc0ccfSmrg		[use_lint=$withval], [use_lint=no])
18128abc0ccfSmrg
18138abc0ccfSmrg# Obtain platform specific info like program name and options
18148abc0ccfSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
18158abc0ccfSmrgcase $host_os in
18168abc0ccfSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
18178abc0ccfSmrg	lint_name=splint
18188abc0ccfSmrg	lint_options="-badflag"
18198abc0ccfSmrg	;;
18208abc0ccfSmrg  *freebsd* | *netbsd*)
18218abc0ccfSmrg	lint_name=lint
18228abc0ccfSmrg	lint_options="-u -b"
18238abc0ccfSmrg	;;
18248abc0ccfSmrg  *solaris*)
18258abc0ccfSmrg	lint_name=lint
18268abc0ccfSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
18278abc0ccfSmrg	;;
18288abc0ccfSmrgesac
18298abc0ccfSmrg
18308abc0ccfSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
18318abc0ccfSmrgif test "x$use_lint" = x"yes" ; then
18328abc0ccfSmrg   AC_PATH_PROG([LINT], [$lint_name])
18338abc0ccfSmrg   if test "x$LINT" = "x"; then
18348abc0ccfSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
18358abc0ccfSmrg   fi
18368abc0ccfSmrgelif test "x$use_lint" = x"no" ; then
18378abc0ccfSmrg   if test "x$LINT" != "x"; then
18388abc0ccfSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
18398abc0ccfSmrg   fi
18408abc0ccfSmrgelse
18418abc0ccfSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
18428abc0ccfSmrgfi
18438abc0ccfSmrg
18448abc0ccfSmrg# User supplied flags override default flags
18458abc0ccfSmrgif test "x$LINT_FLAGS" != "x"; then
18468abc0ccfSmrg   lint_options=$LINT_FLAGS
18478abc0ccfSmrgfi
18488abc0ccfSmrg
18498abc0ccfSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
18508abc0ccfSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
18518abc0ccfSmrg
18528abc0ccfSmrg]) # XORG_WITH_LINT
18538abc0ccfSmrg
18548abc0ccfSmrg# XORG_LINT_LIBRARY(LIBNAME)
18558abc0ccfSmrg# --------------------------
18568abc0ccfSmrg# Minimum version: 1.1.0
18578abc0ccfSmrg#
18588abc0ccfSmrg# Sets up flags for building lint libraries for checking programs that call
18598abc0ccfSmrg# functions in the library.
18608abc0ccfSmrg#
18618abc0ccfSmrg# Interface to module:
18628abc0ccfSmrg# LINTLIB		- Automake variable with the name of lint library file to make
18638abc0ccfSmrg# MAKE_LINT_LIB		- Automake conditional
18648abc0ccfSmrg#
18658abc0ccfSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
18668abc0ccfSmrg#			  - 'no' user instructs the module not to create a lint library (default)
18678abc0ccfSmrg
18688abc0ccfSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
18698abc0ccfSmrgAC_REQUIRE([XORG_WITH_LINT])
18708abc0ccfSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
18718abc0ccfSmrg	[Create lint library (default: disabled)])],
18728abc0ccfSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
18738abc0ccfSmrg
18748abc0ccfSmrgif test "x$make_lint_lib" = x"yes" ; then
18758abc0ccfSmrg   LINTLIB=llib-l$1.ln
18768abc0ccfSmrg   if test "x$LINT" = "x"; then
18778abc0ccfSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18788abc0ccfSmrg   fi
18798abc0ccfSmrgelif test "x$make_lint_lib" != x"no" ; then
18808abc0ccfSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
18818abc0ccfSmrgfi
18828abc0ccfSmrg
18838abc0ccfSmrgAC_SUBST(LINTLIB)
18848abc0ccfSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
18858abc0ccfSmrg
18868abc0ccfSmrg]) # XORG_LINT_LIBRARY
18878abc0ccfSmrg
18888abc0ccfSmrg# XORG_COMPILER_BRAND
18898abc0ccfSmrg# -------------------
18908abc0ccfSmrg# Minimum version: 1.14.0
18918abc0ccfSmrg#
18928abc0ccfSmrg# Checks for various brands of compilers and sets flags as appropriate:
18938abc0ccfSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18948abc0ccfSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18958abc0ccfSmrg#   clang compiler - sets CLANGCC to "yes"
18968abc0ccfSmrg#   Intel compiler - sets INTELCC to "yes"
18978abc0ccfSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18988abc0ccfSmrg#
18998abc0ccfSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
19008abc0ccfSmrgAC_LANG_CASE(
19018abc0ccfSmrg	[C], [
19028abc0ccfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
19038abc0ccfSmrg	],
19048abc0ccfSmrg	[C++], [
19058abc0ccfSmrg		AC_REQUIRE([AC_PROG_CXX])
19068abc0ccfSmrg	]
19078abc0ccfSmrg)
19088abc0ccfSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
19098abc0ccfSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
19108abc0ccfSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
19118abc0ccfSmrg]) # XORG_COMPILER_BRAND
19128abc0ccfSmrg
19138abc0ccfSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
19148abc0ccfSmrg# ---------------
19158abc0ccfSmrg# Minimum version: 1.16.0
19168abc0ccfSmrg#
19178abc0ccfSmrg# Test if the compiler works when passed the given flag as a command line argument.
19188abc0ccfSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
19198abc0ccfSmrg# next flag in the list until there are no more options.
19208abc0ccfSmrg#
19218abc0ccfSmrg# Note that this does not guarantee that the compiler supports the flag as some
19228abc0ccfSmrg# compilers will simply ignore arguments that they do not understand, but we do
19238abc0ccfSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
19248abc0ccfSmrg# -Werror=unused-command-line-argument
19258abc0ccfSmrg#
19268abc0ccfSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
19278abc0ccfSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19288abc0ccfSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19298abc0ccfSmrg
19308abc0ccfSmrgAC_LANG_COMPILER_REQUIRE
19318abc0ccfSmrg
19328abc0ccfSmrgAC_LANG_CASE(
19338abc0ccfSmrg	[C], [
19348abc0ccfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
19358abc0ccfSmrg		define([PREFIX], [C])
19368abc0ccfSmrg		define([CACHE_PREFIX], [cc])
19378abc0ccfSmrg		define([COMPILER], [$CC])
19388abc0ccfSmrg	],
19398abc0ccfSmrg	[C++], [
19408abc0ccfSmrg		define([PREFIX], [CXX])
19418abc0ccfSmrg		define([CACHE_PREFIX], [cxx])
19428abc0ccfSmrg		define([COMPILER], [$CXX])
19438abc0ccfSmrg	]
19448abc0ccfSmrg)
19458abc0ccfSmrg
19468abc0ccfSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
19478abc0ccfSmrg
19488abc0ccfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
19498abc0ccfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19508abc0ccfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
19518abc0ccfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
19528abc0ccfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19538abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
19548abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
19558abc0ccfSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
19568abc0ccfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19578abc0ccfSmrgfi
19588abc0ccfSmrg
19598abc0ccfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
19608abc0ccfSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
19618abc0ccfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19628abc0ccfSmrg	fi
19638abc0ccfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19648abc0ccfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
19658abc0ccfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
19668abc0ccfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19678abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
19688abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
19698abc0ccfSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
19708abc0ccfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19718abc0ccfSmrgfi
19728abc0ccfSmrg
19738abc0ccfSmrgfound="no"
19748abc0ccfSmrgm4_foreach([flag], m4_cdr($@), [
19758abc0ccfSmrg	if test $found = "no" ; then
197640c5344fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19778abc0ccfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19788abc0ccfSmrg		fi
19798abc0ccfSmrg
198040c5344fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19818abc0ccfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19828abc0ccfSmrg		fi
19838abc0ccfSmrg
19848abc0ccfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19858abc0ccfSmrg
19868abc0ccfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
198740c5344fSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19888abc0ccfSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19898abc0ccfSmrg		AC_CACHE_VAL($cacheid,
19908abc0ccfSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19918abc0ccfSmrg					     [eval $cacheid=yes],
19928abc0ccfSmrg					     [eval $cacheid=no])])
19938abc0ccfSmrg
19948abc0ccfSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19958abc0ccfSmrg
19968abc0ccfSmrg		eval supported=\$$cacheid
19978abc0ccfSmrg		AC_MSG_RESULT([$supported])
19988abc0ccfSmrg		if test "$supported" = "yes" ; then
19998abc0ccfSmrg			$1="$$1 ]flag["
20008abc0ccfSmrg			found="yes"
20018abc0ccfSmrg		fi
20028abc0ccfSmrg	fi
20038abc0ccfSmrg])
20048abc0ccfSmrg]) # XORG_TESTSET_CFLAG
20058abc0ccfSmrg
20068abc0ccfSmrg# XORG_COMPILER_FLAGS
20078abc0ccfSmrg# ---------------
20088abc0ccfSmrg# Minimum version: 1.16.0
20098abc0ccfSmrg#
20108abc0ccfSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
20118abc0ccfSmrg# arguments supported by the selected compiler which do NOT alter the generated
20128abc0ccfSmrg# code.  These arguments will cause the compiler to print various warnings
20138abc0ccfSmrg# during compilation AND turn a conservative set of warnings into errors.
20148abc0ccfSmrg#
20158abc0ccfSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
20168abc0ccfSmrg# future versions of util-macros as options are added to new compilers.
20178abc0ccfSmrg#
20188abc0ccfSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
20198abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
20208abc0ccfSmrg
20218abc0ccfSmrgAC_ARG_ENABLE(selective-werror,
20228abc0ccfSmrg              AS_HELP_STRING([--disable-selective-werror],
20238abc0ccfSmrg                             [Turn off selective compiler errors. (default: enabled)]),
20248abc0ccfSmrg              [SELECTIVE_WERROR=$enableval],
20258abc0ccfSmrg              [SELECTIVE_WERROR=yes])
20268abc0ccfSmrg
20278abc0ccfSmrgAC_LANG_CASE(
20288abc0ccfSmrg        [C], [
20298abc0ccfSmrg                define([PREFIX], [C])
20308abc0ccfSmrg        ],
20318abc0ccfSmrg        [C++], [
20328abc0ccfSmrg                define([PREFIX], [CXX])
20338abc0ccfSmrg        ]
20348abc0ccfSmrg)
20358abc0ccfSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
20368abc0ccfSmrgif test "x$SUNCC" = "xyes"; then
20378abc0ccfSmrg    [BASE_]PREFIX[FLAGS]="-v"
20388abc0ccfSmrgelse
20398abc0ccfSmrg    [BASE_]PREFIX[FLAGS]=""
20408abc0ccfSmrgfi
20418abc0ccfSmrg
20428abc0ccfSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
20438abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
20448abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
20458abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
20468abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
20478abc0ccfSmrg
20488abc0ccfSmrgAC_LANG_CASE(
20498abc0ccfSmrg	[C], [
20508abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
20518abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
20528abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
20538abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
205440c5344fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
20558abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
20568abc0ccfSmrg	]
20578abc0ccfSmrg)
20588abc0ccfSmrg
20598abc0ccfSmrg# This chunk adds additional warnings that could catch undesired effects.
20608abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
20618abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
20628abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
20638abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
20648abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
20658abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
206640c5344fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
20678abc0ccfSmrg
20688abc0ccfSmrg# These are currently disabled because they are noisy.  They will be enabled
20698abc0ccfSmrg# in the future once the codebase is sufficiently modernized to silence
20708abc0ccfSmrg# them.  For now, I don't want them to drown out the other warnings.
20718abc0ccfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
20728abc0ccfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
207340c5344fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
20748abc0ccfSmrg
20758abc0ccfSmrg# Turn some warnings into errors, so we don't accidently get successful builds
20768abc0ccfSmrg# when there are problems that should be fixed.
20778abc0ccfSmrg
20788abc0ccfSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20798abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20808abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20818abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20828abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20838abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20848abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20858abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20868abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20878abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20888abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20898abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20908abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20918abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
20928abc0ccfSmrgelse
20938abc0ccfSmrgAC_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])
20948abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20958abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20968abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20978abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20988abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20998abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
21008abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
21018abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
21028abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
21038abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
21048abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
21058abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
21068abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
21078abc0ccfSmrgfi
21088abc0ccfSmrg
21098abc0ccfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21108abc0ccfSmrg]) # XORG_COMPILER_FLAGS
21118abc0ccfSmrg
21128abc0ccfSmrg# XORG_CWARNFLAGS
21138abc0ccfSmrg# ---------------
21148abc0ccfSmrg# Minimum version: 1.2.0
21158abc0ccfSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
21168abc0ccfSmrg#
21178abc0ccfSmrg# Defines CWARNFLAGS to enable C compiler warnings.
21188abc0ccfSmrg#
21198abc0ccfSmrg# This function is deprecated because it defines -fno-strict-aliasing
21208abc0ccfSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
21218abc0ccfSmrg# is needed, then it should be added explicitly in the module when
21228abc0ccfSmrg# it is updated to use BASE_CFLAGS.
21238abc0ccfSmrg#
21248abc0ccfSmrgAC_DEFUN([XORG_CWARNFLAGS], [
21258abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21268abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
21278abc0ccfSmrgAC_LANG_CASE(
21288abc0ccfSmrg	[C], [
21298abc0ccfSmrg		CWARNFLAGS="$BASE_CFLAGS"
21308abc0ccfSmrg		if  test "x$GCC" = xyes ; then
21318abc0ccfSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
21328abc0ccfSmrg		fi
21338abc0ccfSmrg		AC_SUBST(CWARNFLAGS)
21348abc0ccfSmrg	]
21358abc0ccfSmrg)
21368abc0ccfSmrg]) # XORG_CWARNFLAGS
21378abc0ccfSmrg
21388abc0ccfSmrg# XORG_STRICT_OPTION
21398abc0ccfSmrg# -----------------------
21408abc0ccfSmrg# Minimum version: 1.3.0
21418abc0ccfSmrg#
21428abc0ccfSmrg# Add configure option to enable strict compilation flags, such as treating
21438abc0ccfSmrg# warnings as fatal errors.
21448abc0ccfSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
21458abc0ccfSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
21468abc0ccfSmrg#
21478abc0ccfSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
21488abc0ccfSmrg# when strict compilation is unconditionally desired.
21498abc0ccfSmrgAC_DEFUN([XORG_STRICT_OPTION], [
21508abc0ccfSmrgAC_REQUIRE([XORG_CWARNFLAGS])
21518abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21528abc0ccfSmrg
21538abc0ccfSmrgAC_ARG_ENABLE(strict-compilation,
21548abc0ccfSmrg			  AS_HELP_STRING([--enable-strict-compilation],
21558abc0ccfSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
21568abc0ccfSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
21578abc0ccfSmrg
21588abc0ccfSmrgAC_LANG_CASE(
21598abc0ccfSmrg        [C], [
21608abc0ccfSmrg                define([PREFIX], [C])
21618abc0ccfSmrg        ],
21628abc0ccfSmrg        [C++], [
21638abc0ccfSmrg                define([PREFIX], [CXX])
21648abc0ccfSmrg        ]
21658abc0ccfSmrg)
21668abc0ccfSmrg
21678abc0ccfSmrg[STRICT_]PREFIX[FLAGS]=""
21688abc0ccfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
21698abc0ccfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
21708abc0ccfSmrg
21718abc0ccfSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
21728abc0ccfSmrg# activate it with -Werror, so we add it here explicitly.
21738abc0ccfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
21748abc0ccfSmrg
21758abc0ccfSmrgif test "x$STRICT_COMPILE" = "xyes"; then
21768abc0ccfSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21778abc0ccfSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21788abc0ccfSmrgfi
21798abc0ccfSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21808abc0ccfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21818abc0ccfSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21828abc0ccfSmrg]) # XORG_STRICT_OPTION
21838abc0ccfSmrg
21848abc0ccfSmrg# XORG_DEFAULT_OPTIONS
21858abc0ccfSmrg# --------------------
21868abc0ccfSmrg# Minimum version: 1.3.0
21878abc0ccfSmrg#
21888abc0ccfSmrg# Defines default options for X.Org modules.
21898abc0ccfSmrg#
21908abc0ccfSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21918abc0ccfSmrgAC_REQUIRE([AC_PROG_INSTALL])
21928abc0ccfSmrgXORG_COMPILER_FLAGS
21938abc0ccfSmrgXORG_CWARNFLAGS
21948abc0ccfSmrgXORG_STRICT_OPTION
21958abc0ccfSmrgXORG_RELEASE_VERSION
21968abc0ccfSmrgXORG_CHANGELOG
21978abc0ccfSmrgXORG_INSTALL
21988abc0ccfSmrgXORG_MANPAGE_SECTIONS
21998abc0ccfSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
22008abc0ccfSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
22018abc0ccfSmrg]) # XORG_DEFAULT_OPTIONS
22028abc0ccfSmrg
22038abc0ccfSmrg# XORG_INSTALL()
22048abc0ccfSmrg# ----------------
22058abc0ccfSmrg# Minimum version: 1.4.0
22068abc0ccfSmrg#
22078abc0ccfSmrg# Defines the variable INSTALL_CMD as the command to copy
22088abc0ccfSmrg# INSTALL from $prefix/share/util-macros.
22098abc0ccfSmrg#
22108abc0ccfSmrgAC_DEFUN([XORG_INSTALL], [
22118abc0ccfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
22128abc0ccfSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
22138abc0ccfSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
22148abc0ccfSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
22156c3c2bceSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
22166c3c2bceSmrgtouch \$(top_srcdir)/INSTALL; \
22176c3c2bceSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
22188abc0ccfSmrgAC_SUBST([INSTALL_CMD])
22198abc0ccfSmrg]) # XORG_INSTALL
22208abc0ccfSmrgdnl Copyright 2005 Red Hat, Inc
22218abc0ccfSmrgdnl
22228abc0ccfSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
22238abc0ccfSmrgdnl documentation for any purpose is hereby granted without fee, provided that
22248abc0ccfSmrgdnl the above copyright notice appear in all copies and that both that
22258abc0ccfSmrgdnl copyright notice and this permission notice appear in supporting
22268abc0ccfSmrgdnl documentation.
22278abc0ccfSmrgdnl
22288abc0ccfSmrgdnl The above copyright notice and this permission notice shall be included
22298abc0ccfSmrgdnl in all copies or substantial portions of the Software.
22308abc0ccfSmrgdnl
22318abc0ccfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22328abc0ccfSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22338abc0ccfSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22348abc0ccfSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
22358abc0ccfSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22368abc0ccfSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22378abc0ccfSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
22388abc0ccfSmrgdnl
22398abc0ccfSmrgdnl Except as contained in this notice, the name of the copyright holders shall
22408abc0ccfSmrgdnl not be used in advertising or otherwise to promote the sale, use or
22418abc0ccfSmrgdnl other dealings in this Software without prior written authorization
22428abc0ccfSmrgdnl from the copyright holders.
22438abc0ccfSmrgdnl
22448abc0ccfSmrg
22458abc0ccfSmrg# XORG_RELEASE_VERSION
22468abc0ccfSmrg# --------------------
22478abc0ccfSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
224840c5344fSmrg
22498abc0ccfSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
22508abc0ccfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
22518abc0ccfSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
22528abc0ccfSmrg		[Major version of this package])
22538abc0ccfSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
22548abc0ccfSmrg	if test "x$PVM" = "x"; then
22558abc0ccfSmrg		PVM="0"
22568abc0ccfSmrg	fi
22578abc0ccfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
22588abc0ccfSmrg		[$PVM],
22598abc0ccfSmrg		[Minor version of this package])
22608abc0ccfSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
22618abc0ccfSmrg	if test "x$PVP" = "x"; then
22628abc0ccfSmrg		PVP="0"
22638abc0ccfSmrg	fi
22648abc0ccfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
22658abc0ccfSmrg		[$PVP],
22668abc0ccfSmrg		[Patch version of this package])
22678abc0ccfSmrg])
22688abc0ccfSmrg
22698abc0ccfSmrg# XORG_CHANGELOG()
22708abc0ccfSmrg# ----------------
22718abc0ccfSmrg# Minimum version: 1.2.0
22728abc0ccfSmrg#
22738abc0ccfSmrg# Defines the variable CHANGELOG_CMD as the command to generate
22748abc0ccfSmrg# ChangeLog from git.
22758abc0ccfSmrg#
22768abc0ccfSmrg#
22778abc0ccfSmrgAC_DEFUN([XORG_CHANGELOG], [
22786c3c2bceSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
22798abc0ccfSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22806c3c2bceSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
22816c3c2bceSmrgtouch \$(top_srcdir)/ChangeLog; \
22826c3c2bceSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
22838abc0ccfSmrgAC_SUBST([CHANGELOG_CMD])
22848abc0ccfSmrg]) # XORG_CHANGELOG
22858abc0ccfSmrg
22868abc0ccfSmrgdnl
22878abc0ccfSmrgdnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
22888abc0ccfSmrgdnl
22898abc0ccfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
22908abc0ccfSmrgdnl copy of this software and associated documentation files (the "Software"),
22918abc0ccfSmrgdnl to deal in the Software without restriction, including without limitation
22928abc0ccfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
22938abc0ccfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
22948abc0ccfSmrgdnl Software is furnished to do so, subject to the following conditions:
22958abc0ccfSmrgdnl
22968abc0ccfSmrgdnl The above copyright notice and this permission notice (including the next
22978abc0ccfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
22988abc0ccfSmrgdnl Software.
22998abc0ccfSmrgdnl
23008abc0ccfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23018abc0ccfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23028abc0ccfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
23038abc0ccfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23048abc0ccfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23058abc0ccfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23068abc0ccfSmrgdnl DEALINGS IN THE SOFTWARE.
23078abc0ccfSmrgdnl
23088abc0ccfSmrg
23098abc0ccfSmrg# XTRANS_TCP_FLAGS()
23108abc0ccfSmrg# ------------------
23118abc0ccfSmrg# Find needed libraries for TCP sockets, and check for IPv6 support
23128abc0ccfSmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
23138abc0ccfSmrg # SVR4 hides these in libraries other than libc
23148abc0ccfSmrg AC_SEARCH_LIBS(socket, [socket])
23158abc0ccfSmrg AC_SEARCH_LIBS(gethostbyname, [nsl])
23168abc0ccfSmrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
23179a011757Smrg   AC_CHECK_LIB([ws2_32],[main])
23188abc0ccfSmrg fi
23198abc0ccfSmrg
23208abc0ccfSmrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
23218abc0ccfSmrg AC_ARG_ENABLE(ipv6,
23229a011757Smrg	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
23238abc0ccfSmrg	[IPV6CONN=$enableval],
23248abc0ccfSmrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
23258abc0ccfSmrg AC_MSG_CHECKING([if IPv6 support should be built])
23268abc0ccfSmrg if test "$IPV6CONN" = "yes"; then
23278abc0ccfSmrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
23288abc0ccfSmrg fi
23298abc0ccfSmrg AC_MSG_RESULT($IPV6CONN)
23308abc0ccfSmrg
23318abc0ccfSmrg # 4.3BSD-Reno added a new member to struct sockaddr_in
23328abc0ccfSmrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
23338abc0ccfSmrg	AC_DEFINE([BSD44SOCKETS],1,
23348abc0ccfSmrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
23358abc0ccfSmrg#include <sys/types.h>
23368abc0ccfSmrg#include <sys/socket.h>
23378abc0ccfSmrg#include <netinet/in.h>
23388abc0ccfSmrg ])
23398abc0ccfSmrg
23408abc0ccfSmrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
23418abc0ccfSmrg AC_CHECK_TYPES([socklen_t], [], [], [
23428abc0ccfSmrgAC_INCLUDES_DEFAULT
23438abc0ccfSmrg#include <sys/socket.h>])
23448abc0ccfSmrg
23459a011757Smrg # XPG4v2/UNIX95 added msg_control - check to see if we need to define
23469a011757Smrg # _XOPEN_SOURCE to get it (such as on Solaris)
23479a011757Smrg AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
23489a011757Smrg                 [
23499a011757SmrgAC_INCLUDES_DEFAULT
23509a011757Smrg#include <sys/socket.h>
23519a011757Smrg                 ])
23529a011757Smrg # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
23539a011757Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
23549a011757Smrg     unset ac_cv_member_struct_msghdr_msg_control
23559a011757Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
23569a011757Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
23579a011757Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [600],
23589a011757Smrg                       [Defined if needed to expose struct msghdr.msg_control])
23599a011757Smrg                     ], [], [
23609a011757Smrg#define _XOPEN_SOURCE 600
23619a011757SmrgAC_INCLUDES_DEFAULT
23629a011757Smrg#include <sys/socket.h>
23639a011757Smrg                     ])
23649a011757Smrg fi
23659a011757Smrg # If that didn't work, fall back to XPG5/UNIX98 with C89
23669a011757Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
23679a011757Smrg     unset ac_cv_member_struct_msghdr_msg_control
23689a011757Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
23699a011757Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
23709a011757Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [500],
23719a011757Smrg                       [Defined if needed to expose struct msghdr.msg_control])
23729a011757Smrg                     ], [], [
23739a011757Smrg#define _XOPEN_SOURCE 500
23749a011757SmrgAC_INCLUDES_DEFAULT
23759a011757Smrg#include <sys/socket.h>
23769a011757Smrg                     ])
23779a011757Smrg fi
23789a011757Smrg
23799a011757Smrg
23808abc0ccfSmrg]) # XTRANS_TCP_FLAGS
23818abc0ccfSmrg
23828abc0ccfSmrg# XTRANS_CONNECTION_FLAGS()
23838abc0ccfSmrg# -------------------------
23848abc0ccfSmrg# Standard checks for which Xtrans transports to use by the Xorg packages
23858abc0ccfSmrg# that use Xtrans functions
23868abc0ccfSmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
23878abc0ccfSmrg AC_REQUIRE([AC_CANONICAL_HOST])
23888abc0ccfSmrg [case $host_os in
23898abc0ccfSmrg	mingw*)	unixdef="no"   ;;
23908abc0ccfSmrg	*)	unixdef="yes"  ;;
23918abc0ccfSmrg esac]
23928abc0ccfSmrg AC_ARG_ENABLE(unix-transport,
23939a011757Smrg	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
23948abc0ccfSmrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
23958abc0ccfSmrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
23968abc0ccfSmrg if test "$UNIXCONN" = "yes"; then
23978abc0ccfSmrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
23988abc0ccfSmrg fi
23998abc0ccfSmrg AC_MSG_RESULT($UNIXCONN)
24008abc0ccfSmrg AC_ARG_ENABLE(tcp-transport,
24019a011757Smrg	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
24028abc0ccfSmrg	[TCPCONN=$enableval], [TCPCONN=yes])
24038abc0ccfSmrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
24048abc0ccfSmrg AC_MSG_RESULT($TCPCONN)
24058abc0ccfSmrg if test "$TCPCONN" = "yes"; then
24068abc0ccfSmrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
24078abc0ccfSmrg	XTRANS_TCP_FLAGS
24088abc0ccfSmrg fi
24098abc0ccfSmrg [case $host_os in
24108abc0ccfSmrg	solaris*|sco*|sysv4*)	localdef="yes" ;;
24118abc0ccfSmrg	*)			localdef="no"  ;;
24128abc0ccfSmrg esac]
24138abc0ccfSmrg AC_ARG_ENABLE(local-transport,
24149a011757Smrg	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
24158abc0ccfSmrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
24168abc0ccfSmrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
24178abc0ccfSmrg AC_MSG_RESULT($LOCALCONN)
24188abc0ccfSmrg if test "$LOCALCONN" = "yes"; then
24198abc0ccfSmrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
24208abc0ccfSmrg fi
24218abc0ccfSmrg
24228abc0ccfSmrg]) # XTRANS_CONNECTION_FLAGS
24238abc0ccfSmrg
24248abc0ccfSmrg
24258abc0ccfSmrg# XTRANS_SECURE_RPC_FLAGS()
24268abc0ccfSmrg# -------------------------
24278abc0ccfSmrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
24288abc0ccfSmrg# so that any necessary networking libraries are already found
24298abc0ccfSmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
24308abc0ccfSmrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
24318abc0ccfSmrg AC_ARG_ENABLE(secure-rpc,
24329a011757Smrg	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
24338abc0ccfSmrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
24348abc0ccfSmrg
24358abc0ccfSmrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
24368abc0ccfSmrg	FOUND_SECURE_RPC="no"
24378abc0ccfSmrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
24388abc0ccfSmrg			[FOUND_SECURE_RPC="yes"])
24398abc0ccfSmrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
24408abc0ccfSmrg		if test "x$SECURE_RPC" = "xyes" ; then
24418abc0ccfSmrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
24428abc0ccfSmrg		fi
24438abc0ccfSmrg		SECURE_RPC="no"
24448abc0ccfSmrg	else
24458abc0ccfSmrg		dnl FreeBSD keeps getsecretkey in librpcsvc
24468abc0ccfSmrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
24478abc0ccfSmrg		SECURE_RPC="yes"
24488abc0ccfSmrg	fi
24498abc0ccfSmrg fi
24508abc0ccfSmrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
24518abc0ccfSmrg if test "x$SECURE_RPC" = "xyes" ; then
24528abc0ccfSmrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
24538abc0ccfSmrg fi
24548abc0ccfSmrg AC_MSG_RESULT($SECURE_RPC)
24558abc0ccfSmrg]) # XTRANS_SECURE_RPC_FLAGS
24568abc0ccfSmrg
24578abc0ccfSmrg
24586c3c2bceSmrg# Copyright (C) 2002-2018 Free Software Foundation, Inc.
24598abc0ccfSmrg#
24608abc0ccfSmrg# This file is free software; the Free Software Foundation
24618abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
24628abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
24638abc0ccfSmrg
24648abc0ccfSmrg# AM_AUTOMAKE_VERSION(VERSION)
24658abc0ccfSmrg# ----------------------------
24668abc0ccfSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
24678abc0ccfSmrg# generated from the m4 files accompanying Automake X.Y.
24688abc0ccfSmrg# (This private macro should not be called outside this file.)
24698abc0ccfSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
24706c3c2bceSmrg[am__api_version='1.16'
24718abc0ccfSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
24728abc0ccfSmrgdnl require some minimum version.  Point them to the right macro.
24736c3c2bceSmrgm4_if([$1], [1.16.1], [],
24748abc0ccfSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
24758abc0ccfSmrg])
24768abc0ccfSmrg
24778abc0ccfSmrg# _AM_AUTOCONF_VERSION(VERSION)
24788abc0ccfSmrg# -----------------------------
24798abc0ccfSmrg# aclocal traces this macro to find the Autoconf version.
24808abc0ccfSmrg# This is a private macro too.  Using m4_define simplifies
24818abc0ccfSmrg# the logic in aclocal, which can simply ignore this definition.
24828abc0ccfSmrgm4_define([_AM_AUTOCONF_VERSION], [])
24838abc0ccfSmrg
24848abc0ccfSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
24858abc0ccfSmrg# -------------------------------
24868abc0ccfSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
24878abc0ccfSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
24888abc0ccfSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
24896c3c2bceSmrg[AM_AUTOMAKE_VERSION([1.16.1])dnl
24908abc0ccfSmrgm4_ifndef([AC_AUTOCONF_VERSION],
24918abc0ccfSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
24928abc0ccfSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
24938abc0ccfSmrg
24948abc0ccfSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
24958abc0ccfSmrg
24966c3c2bceSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
249796402570Smrg#
24988abc0ccfSmrg# This file is free software; the Free Software Foundation
24998abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
25008abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
250196402570Smrg
25028abc0ccfSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
25038abc0ccfSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
25048abc0ccfSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
25052852888eSmrg#
25068abc0ccfSmrg# Of course, Automake must honor this variable whenever it calls a
25078abc0ccfSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
25088abc0ccfSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
25098abc0ccfSmrg# depending on how configure is run.  This is pretty annoying, since
25108abc0ccfSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
25118abc0ccfSmrg# source directory, any form will work fine, but in subdirectories a
25128abc0ccfSmrg# relative path needs to be adjusted first.
25132852888eSmrg#
25148abc0ccfSmrg# $ac_aux_dir/missing
25158abc0ccfSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
25168abc0ccfSmrg# $top_srcdir/$ac_aux_dir/missing
25178abc0ccfSmrg#    fails if $ac_aux_dir is absolute,
25188abc0ccfSmrg#    fails when called from a subdirectory in a VPATH build with
25198abc0ccfSmrg#          a relative $ac_aux_dir
25202852888eSmrg#
25218abc0ccfSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
25228abc0ccfSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
25238abc0ccfSmrg# harmless because $srcdir is '.', but things will broke when you
25248abc0ccfSmrg# start a VPATH build or use an absolute $srcdir.
252596402570Smrg#
25268abc0ccfSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
25278abc0ccfSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
25288abc0ccfSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
25298abc0ccfSmrg# and then we would define $MISSING as
25308abc0ccfSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
25318abc0ccfSmrg# This will work as long as MISSING is not called from configure, because
25328abc0ccfSmrg# unfortunately $(top_srcdir) has no meaning in configure.
25338abc0ccfSmrg# However there are other variables, like CC, which are often used in
25348abc0ccfSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
25352852888eSmrg#
25368abc0ccfSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
25378abc0ccfSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
25388abc0ccfSmrg# configured tree to be moved without reconfiguration.
25392852888eSmrg
25408abc0ccfSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
254140c5344fSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
254240c5344fSmrg# Expand $ac_aux_dir to an absolute path.
254340c5344fSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
25448abc0ccfSmrg])
25452852888eSmrg
25468abc0ccfSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
25472852888eSmrg
25486c3c2bceSmrg# Copyright (C) 1997-2018 Free Software Foundation, Inc.
25498abc0ccfSmrg#
25508abc0ccfSmrg# This file is free software; the Free Software Foundation
25518abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
25528abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
25532852888eSmrg
25548abc0ccfSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
25558abc0ccfSmrg# -------------------------------------
25568abc0ccfSmrg# Define a conditional.
25578abc0ccfSmrgAC_DEFUN([AM_CONDITIONAL],
25588abc0ccfSmrg[AC_PREREQ([2.52])dnl
25598abc0ccfSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
25608abc0ccfSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
25618abc0ccfSmrgAC_SUBST([$1_TRUE])dnl
25628abc0ccfSmrgAC_SUBST([$1_FALSE])dnl
25638abc0ccfSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
25648abc0ccfSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
25658abc0ccfSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
25668abc0ccfSmrgif $2; then
25678abc0ccfSmrg  $1_TRUE=
25688abc0ccfSmrg  $1_FALSE='#'
25698abc0ccfSmrgelse
25708abc0ccfSmrg  $1_TRUE='#'
25718abc0ccfSmrg  $1_FALSE=
25728abc0ccfSmrgfi
25738abc0ccfSmrgAC_CONFIG_COMMANDS_PRE(
25748abc0ccfSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
25758abc0ccfSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
25768abc0ccfSmrgUsually this means the macro was only invoked conditionally.]])
25778abc0ccfSmrgfi])])
25782852888eSmrg
25796c3c2bceSmrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
25802852888eSmrg#
25818abc0ccfSmrg# This file is free software; the Free Software Foundation
25828abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
25838abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
25848abc0ccfSmrg
25858abc0ccfSmrg
25868abc0ccfSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
25878abc0ccfSmrg# written in clear, in which case automake, when reading aclocal.m4,
25888abc0ccfSmrg# will think it sees a *use*, and therefore will trigger all it's
25898abc0ccfSmrg# C support machinery.  Also note that it means that autoscan, seeing
25908abc0ccfSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
25918abc0ccfSmrg
25928abc0ccfSmrg
25938abc0ccfSmrg# _AM_DEPENDENCIES(NAME)
25948abc0ccfSmrg# ----------------------
25958abc0ccfSmrg# See how the compiler implements dependency checking.
25968abc0ccfSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
25978abc0ccfSmrg# We try a few techniques and use that to set a single cache variable.
259896402570Smrg#
25998abc0ccfSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
26008abc0ccfSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
26018abc0ccfSmrg# dependency, and given that the user is not expected to run this macro,
26028abc0ccfSmrg# just rely on AC_PROG_CC.
26038abc0ccfSmrgAC_DEFUN([_AM_DEPENDENCIES],
26048abc0ccfSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
26058abc0ccfSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
26068abc0ccfSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
26078abc0ccfSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
26088abc0ccfSmrg
26098abc0ccfSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
26108abc0ccfSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
26118abc0ccfSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
26128abc0ccfSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
26138abc0ccfSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
26148abc0ccfSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
26158abc0ccfSmrg                    [depcc="$$1"   am_compiler_list=])
26168abc0ccfSmrg
26178abc0ccfSmrgAC_CACHE_CHECK([dependency style of $depcc],
26188abc0ccfSmrg               [am_cv_$1_dependencies_compiler_type],
26198abc0ccfSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
26208abc0ccfSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
26218abc0ccfSmrg  # making bogus files that we don't know about and never remove.  For
26228abc0ccfSmrg  # instance it was reported that on HP-UX the gcc test will end up
26238abc0ccfSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
26248abc0ccfSmrg  # in D".
26258abc0ccfSmrg  rm -rf conftest.dir
26268abc0ccfSmrg  mkdir conftest.dir
26278abc0ccfSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
26288abc0ccfSmrg  # using a relative directory.
26298abc0ccfSmrg  cp "$am_depcomp" conftest.dir
26308abc0ccfSmrg  cd conftest.dir
26318abc0ccfSmrg  # We will build objects and dependencies in a subdirectory because
26328abc0ccfSmrg  # it helps to detect inapplicable dependency modes.  For instance
26338abc0ccfSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
26348abc0ccfSmrg  # side effect of compilation, but ICC will put the dependencies in
26358abc0ccfSmrg  # the current directory while Tru64 will put them in the object
26368abc0ccfSmrg  # directory.
26378abc0ccfSmrg  mkdir sub
26388abc0ccfSmrg
26398abc0ccfSmrg  am_cv_$1_dependencies_compiler_type=none
26408abc0ccfSmrg  if test "$am_compiler_list" = ""; then
26418abc0ccfSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
26422852888eSmrg  fi
26438abc0ccfSmrg  am__universal=false
26448abc0ccfSmrg  m4_case([$1], [CC],
26458abc0ccfSmrg    [case " $depcc " in #(
26468abc0ccfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
26478abc0ccfSmrg     esac],
26488abc0ccfSmrg    [CXX],
26498abc0ccfSmrg    [case " $depcc " in #(
26508abc0ccfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
26518abc0ccfSmrg     esac])
26528abc0ccfSmrg
26538abc0ccfSmrg  for depmode in $am_compiler_list; do
26548abc0ccfSmrg    # Setup a source with many dependencies, because some compilers
26558abc0ccfSmrg    # like to wrap large dependency lists on column 80 (with \), and
26568abc0ccfSmrg    # we should not choose a depcomp mode which is confused by this.
26578abc0ccfSmrg    #
26588abc0ccfSmrg    # We need to recreate these files for each test, as the compiler may
26598abc0ccfSmrg    # overwrite some of them when testing with obscure command lines.
26608abc0ccfSmrg    # This happens at least with the AIX C compiler.
26618abc0ccfSmrg    : > sub/conftest.c
26628abc0ccfSmrg    for i in 1 2 3 4 5 6; do
26638abc0ccfSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
26648abc0ccfSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
26658abc0ccfSmrg      # Solaris 10 /bin/sh.
26668abc0ccfSmrg      echo '/* dummy */' > sub/conftst$i.h
26678abc0ccfSmrg    done
26688abc0ccfSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
26698abc0ccfSmrg
26708abc0ccfSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
26718abc0ccfSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
26728abc0ccfSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
26738abc0ccfSmrg    # versions had trouble with output in subdirs.
26748abc0ccfSmrg    am__obj=sub/conftest.${OBJEXT-o}
26758abc0ccfSmrg    am__minus_obj="-o $am__obj"
26768abc0ccfSmrg    case $depmode in
26778abc0ccfSmrg    gcc)
26788abc0ccfSmrg      # This depmode causes a compiler race in universal mode.
26798abc0ccfSmrg      test "$am__universal" = false || continue
26808abc0ccfSmrg      ;;
26818abc0ccfSmrg    nosideeffect)
26828abc0ccfSmrg      # After this tag, mechanisms are not by side-effect, so they'll
26838abc0ccfSmrg      # only be used when explicitly requested.
26848abc0ccfSmrg      if test "x$enable_dependency_tracking" = xyes; then
26858abc0ccfSmrg	continue
26868abc0ccfSmrg      else
26878abc0ccfSmrg	break
26888abc0ccfSmrg      fi
26898abc0ccfSmrg      ;;
26908abc0ccfSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
26918abc0ccfSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
26928abc0ccfSmrg      # not run yet.  These depmodes are late enough in the game, and
26938abc0ccfSmrg      # so weak that their functioning should not be impacted.
26948abc0ccfSmrg      am__obj=conftest.${OBJEXT-o}
26958abc0ccfSmrg      am__minus_obj=
26968abc0ccfSmrg      ;;
26978abc0ccfSmrg    none) break ;;
26988abc0ccfSmrg    esac
26998abc0ccfSmrg    if depmode=$depmode \
27008abc0ccfSmrg       source=sub/conftest.c object=$am__obj \
27018abc0ccfSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
27028abc0ccfSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
27038abc0ccfSmrg         >/dev/null 2>conftest.err &&
27048abc0ccfSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27058abc0ccfSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27068abc0ccfSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27078abc0ccfSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27088abc0ccfSmrg      # icc doesn't choke on unknown options, it will just issue warnings
27098abc0ccfSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
27108abc0ccfSmrg      # that says an option was ignored or not supported.
27118abc0ccfSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27128abc0ccfSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27138abc0ccfSmrg      # The diagnosis changed in icc 8.0:
27148abc0ccfSmrg      #   icc: Command line remark: option '-MP' not supported
27158abc0ccfSmrg      if (grep 'ignoring option' conftest.err ||
27168abc0ccfSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
27178abc0ccfSmrg        am_cv_$1_dependencies_compiler_type=$depmode
27188abc0ccfSmrg        break
27198abc0ccfSmrg      fi
27208abc0ccfSmrg    fi
27218abc0ccfSmrg  done
27222852888eSmrg
27238abc0ccfSmrg  cd ..
27248abc0ccfSmrg  rm -rf conftest.dir
27252852888eSmrgelse
27268abc0ccfSmrg  am_cv_$1_dependencies_compiler_type=none
27272852888eSmrgfi
27288abc0ccfSmrg])
27298abc0ccfSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
27308abc0ccfSmrgAM_CONDITIONAL([am__fastdep$1], [
27318abc0ccfSmrg  test "x$enable_dependency_tracking" != xno \
27328abc0ccfSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
27338abc0ccfSmrg])
27342852888eSmrg
273596402570Smrg
27368abc0ccfSmrg# AM_SET_DEPDIR
27378abc0ccfSmrg# -------------
27388abc0ccfSmrg# Choose a directory name for dependency files.
27398abc0ccfSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
27408abc0ccfSmrgAC_DEFUN([AM_SET_DEPDIR],
27418abc0ccfSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
27428abc0ccfSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
27438abc0ccfSmrg])
274496402570Smrg
274596402570Smrg
27468abc0ccfSmrg# AM_DEP_TRACK
27478abc0ccfSmrg# ------------
27488abc0ccfSmrgAC_DEFUN([AM_DEP_TRACK],
27498abc0ccfSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
27508abc0ccfSmrgAS_HELP_STRING(
27518abc0ccfSmrg  [--enable-dependency-tracking],
27528abc0ccfSmrg  [do not reject slow dependency extractors])
27538abc0ccfSmrgAS_HELP_STRING(
27548abc0ccfSmrg  [--disable-dependency-tracking],
27558abc0ccfSmrg  [speeds up one-time build])])
27568abc0ccfSmrgif test "x$enable_dependency_tracking" != xno; then
27578abc0ccfSmrg  am_depcomp="$ac_aux_dir/depcomp"
27588abc0ccfSmrg  AMDEPBACKSLASH='\'
27598abc0ccfSmrg  am__nodep='_no'
276096402570Smrgfi
27618abc0ccfSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
27628abc0ccfSmrgAC_SUBST([AMDEPBACKSLASH])dnl
27638abc0ccfSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
27648abc0ccfSmrgAC_SUBST([am__nodep])dnl
27658abc0ccfSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
27668abc0ccfSmrg])
276796402570Smrg
27688abc0ccfSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
276996402570Smrg
27706c3c2bceSmrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
27717a0395d0Smrg#
27728abc0ccfSmrg# This file is free software; the Free Software Foundation
27738abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
27748abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
27757a0395d0Smrg
27768abc0ccfSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
27778abc0ccfSmrg# ------------------------------
27788abc0ccfSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
27798abc0ccfSmrg[{
27809a011757Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
27818abc0ccfSmrg  # are listed without --file.  Let's play safe and only enable the eval
27828abc0ccfSmrg  # if we detect the quoting.
27836c3c2bceSmrg  # TODO: see whether this extra hack can be removed once we start
27846c3c2bceSmrg  # requiring Autoconf 2.70 or later.
27856c3c2bceSmrg  AS_CASE([$CONFIG_FILES],
27866c3c2bceSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
27876c3c2bceSmrg          [*], [set x $CONFIG_FILES])
27888abc0ccfSmrg  shift
27896c3c2bceSmrg  # Used to flag and report bootstrapping failures.
27906c3c2bceSmrg  am_rc=0
27916c3c2bceSmrg  for am_mf
27928abc0ccfSmrg  do
27938abc0ccfSmrg    # Strip MF so we end up with the name of the file.
27946c3c2bceSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
27956c3c2bceSmrg    # Check whether this is an Automake generated Makefile which includes
27966c3c2bceSmrg    # dependency-tracking related rules and includes.
27976c3c2bceSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
27988abc0ccfSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
27996c3c2bceSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
28006c3c2bceSmrg      || continue
28016c3c2bceSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
28026c3c2bceSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
28036c3c2bceSmrg    AM_RUN_LOG([cd "$am_dirpart" \
28046c3c2bceSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
28056c3c2bceSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
28068abc0ccfSmrg  done
28076c3c2bceSmrg  if test $am_rc -ne 0; then
28086c3c2bceSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
28096c3c2bceSmrg    for automatic dependency tracking.  Try re-running configure with the
28106c3c2bceSmrg    '--disable-dependency-tracking' option to at least be able to build
28116c3c2bceSmrg    the package (albeit without support for automatic dependency tracking).])
28126c3c2bceSmrg  fi
28136c3c2bceSmrg  AS_UNSET([am_dirpart])
28146c3c2bceSmrg  AS_UNSET([am_filepart])
28156c3c2bceSmrg  AS_UNSET([am_mf])
28166c3c2bceSmrg  AS_UNSET([am_rc])
28176c3c2bceSmrg  rm -f conftest-deps.mk
28188abc0ccfSmrg}
28198abc0ccfSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
28207a0395d0Smrg
28217a0395d0Smrg
28228abc0ccfSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
28238abc0ccfSmrg# -----------------------------
28248abc0ccfSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
28252adc0320Smrg#
28266c3c2bceSmrg# This code is only required when automatic dependency tracking is enabled.
28276c3c2bceSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
28286c3c2bceSmrg# order to bootstrap the dependency handling code.
28298abc0ccfSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
28308abc0ccfSmrg[AC_CONFIG_COMMANDS([depfiles],
28318abc0ccfSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
28326c3c2bceSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
28338abc0ccfSmrg
28348abc0ccfSmrg# Do all the work for Automake.                             -*- Autoconf -*-
28358abc0ccfSmrg
28366c3c2bceSmrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
28377366012aSmrg#
28388abc0ccfSmrg# This file is free software; the Free Software Foundation
28398abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
28408abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
28417a0395d0Smrg
28428abc0ccfSmrg# This macro actually does too much.  Some checks are only needed if
28438abc0ccfSmrg# your package does certain things.  But this isn't really a big deal.
28442adc0320Smrg
284540c5344fSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
284640c5344fSmrgm4_define([AC_PROG_CC],
284740c5344fSmrgm4_defn([AC_PROG_CC])
284840c5344fSmrg[_AM_PROG_CC_C_O
284940c5344fSmrg])
285040c5344fSmrg
28518abc0ccfSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
28528abc0ccfSmrg# AM_INIT_AUTOMAKE([OPTIONS])
28538abc0ccfSmrg# -----------------------------------------------
28548abc0ccfSmrg# The call with PACKAGE and VERSION arguments is the old style
28558abc0ccfSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
28568abc0ccfSmrg# and VERSION should now be passed to AC_INIT and removed from
28578abc0ccfSmrg# the call to AM_INIT_AUTOMAKE.
28588abc0ccfSmrg# We support both call styles for the transition.  After
28598abc0ccfSmrg# the next Automake release, Autoconf can make the AC_INIT
28608abc0ccfSmrg# arguments mandatory, and then we can depend on a new Autoconf
28618abc0ccfSmrg# release and drop the old call support.
28628abc0ccfSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
28639a011757Smrg[AC_PREREQ([2.65])dnl
28648abc0ccfSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
28658abc0ccfSmrgdnl the ones we care about.
28668abc0ccfSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
28678abc0ccfSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
28688abc0ccfSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
28698abc0ccfSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
28708abc0ccfSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
28718abc0ccfSmrg  # is not polluted with repeated "-I."
28728abc0ccfSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
28738abc0ccfSmrg  # test to see if srcdir already configured
28748abc0ccfSmrg  if test -f $srcdir/config.status; then
28758abc0ccfSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
28768abc0ccfSmrg  fi
28777366012aSmrgfi
28782adc0320Smrg
28798abc0ccfSmrg# test whether we have cygpath
28808abc0ccfSmrgif test -z "$CYGPATH_W"; then
28818abc0ccfSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
28828abc0ccfSmrg    CYGPATH_W='cygpath -w'
28838abc0ccfSmrg  else
28848abc0ccfSmrg    CYGPATH_W=echo
28858abc0ccfSmrg  fi
28867366012aSmrgfi
28878abc0ccfSmrgAC_SUBST([CYGPATH_W])
28887a0395d0Smrg
28898abc0ccfSmrg# Define the identity of the package.
28908abc0ccfSmrgdnl Distinguish between old-style and new-style calls.
28918abc0ccfSmrgm4_ifval([$2],
28928abc0ccfSmrg[AC_DIAGNOSE([obsolete],
28939a011757Smrg             [$0: two- and three-arguments forms are deprecated.])
28948abc0ccfSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
28958abc0ccfSmrg AC_SUBST([PACKAGE], [$1])dnl
28968abc0ccfSmrg AC_SUBST([VERSION], [$2])],
28978abc0ccfSmrg[_AM_SET_OPTIONS([$1])dnl
28988abc0ccfSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
28998abc0ccfSmrgm4_if(
29008abc0ccfSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
29018abc0ccfSmrg  [ok:ok],,
29028abc0ccfSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
29038abc0ccfSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
29048abc0ccfSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
29052adc0320Smrg
29068abc0ccfSmrg_AM_IF_OPTION([no-define],,
29078abc0ccfSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
29088abc0ccfSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
29092adc0320Smrg
29108abc0ccfSmrg# Some tools Automake needs.
29118abc0ccfSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
29128abc0ccfSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
29138abc0ccfSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
29148abc0ccfSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
29158abc0ccfSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
29168abc0ccfSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
29178abc0ccfSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
29188abc0ccfSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
29198abc0ccfSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
29208abc0ccfSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
29218abc0ccfSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
29228abc0ccfSmrg# dies out for good.  For more background, see:
29236c3c2bceSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
29246c3c2bceSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
29258abc0ccfSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
292640c5344fSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
292740c5344fSmrg# system "awk" is bad on some platforms.
29288abc0ccfSmrgAC_REQUIRE([AC_PROG_AWK])dnl
29298abc0ccfSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
29308abc0ccfSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
29318abc0ccfSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
29328abc0ccfSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
29338abc0ccfSmrg			     [_AM_PROG_TAR([v7])])])
29348abc0ccfSmrg_AM_IF_OPTION([no-dependencies],,
29358abc0ccfSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
29368abc0ccfSmrg		  [_AM_DEPENDENCIES([CC])],
29378abc0ccfSmrg		  [m4_define([AC_PROG_CC],
29388abc0ccfSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
29398abc0ccfSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
29408abc0ccfSmrg		  [_AM_DEPENDENCIES([CXX])],
29418abc0ccfSmrg		  [m4_define([AC_PROG_CXX],
29428abc0ccfSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
29438abc0ccfSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
29448abc0ccfSmrg		  [_AM_DEPENDENCIES([OBJC])],
29458abc0ccfSmrg		  [m4_define([AC_PROG_OBJC],
29468abc0ccfSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
29479a011757SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
29488abc0ccfSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
29498abc0ccfSmrg		  [m4_define([AC_PROG_OBJCXX],
29509a011757Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
29518abc0ccfSmrg])
29529a011757SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
29539a011757Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
29549a011757Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
29559a011757Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
29568abc0ccfSmrgAC_CONFIG_COMMANDS_PRE(dnl
29578abc0ccfSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
29588abc0ccfSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
295940c5344fSmrg
296040c5344fSmrg# POSIX will say in a future version that running "rm -f" with no argument
296140c5344fSmrg# is OK; and we want to be able to make that assumption in our Makefile
296240c5344fSmrg# recipes.  So use an aggressive probe to check that the usage we want is
296340c5344fSmrg# actually supported "in the wild" to an acceptable degree.
296440c5344fSmrg# See automake bug#10828.
296540c5344fSmrg# To make any issue more visible, cause the running configure to be aborted
296640c5344fSmrg# by default if the 'rm' program in use doesn't match our expectations; the
296740c5344fSmrg# user can still override this though.
296840c5344fSmrgif rm -f && rm -fr && rm -rf; then : OK; else
296940c5344fSmrg  cat >&2 <<'END'
297040c5344fSmrgOops!
297140c5344fSmrg
297240c5344fSmrgYour 'rm' program seems unable to run without file operands specified
297340c5344fSmrgon the command line, even when the '-f' option is present.  This is contrary
297440c5344fSmrgto the behaviour of most rm programs out there, and not conforming with
297540c5344fSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
297640c5344fSmrg
297740c5344fSmrgPlease tell bug-automake@gnu.org about your system, including the value
297840c5344fSmrgof your $PATH and any error possibly output before this message.  This
297940c5344fSmrgcan help us improve future automake versions.
298040c5344fSmrg
298140c5344fSmrgEND
298240c5344fSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
298340c5344fSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
298440c5344fSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
298540c5344fSmrg    echo >&2
298640c5344fSmrg  else
298740c5344fSmrg    cat >&2 <<'END'
298840c5344fSmrgAborting the configuration process, to ensure you take notice of the issue.
298940c5344fSmrg
299040c5344fSmrgYou can download and install GNU coreutils to get an 'rm' implementation
29916c3c2bceSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
299240c5344fSmrg
299340c5344fSmrgIf you want to complete the configuration process using your problematic
299440c5344fSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
299540c5344fSmrgto "yes", and re-run configure.
299640c5344fSmrg
299740c5344fSmrgEND
299840c5344fSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
299940c5344fSmrg  fi
300040c5344fSmrgfi
300140c5344fSmrgdnl The trailing newline in this macro's definition is deliberate, for
300240c5344fSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
300340c5344fSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
30048abc0ccfSmrg])
30057a0395d0Smrg
30068abc0ccfSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
30078abc0ccfSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
30088abc0ccfSmrgdnl mangled by Autoconf and run in a shell conditional statement.
30098abc0ccfSmrgm4_define([_AC_COMPILER_EXEEXT],
30108abc0ccfSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
30117a0395d0Smrg
30128abc0ccfSmrg# When config.status generates a header, we must update the stamp-h file.
30138abc0ccfSmrg# This file resides in the same directory as the config header
30148abc0ccfSmrg# that is generated.  The stamp files are numbered to have different names.
301596402570Smrg
30168abc0ccfSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
30178abc0ccfSmrg# loop where config.status creates the headers, so we can generate
30188abc0ccfSmrg# our stamp files there.
30198abc0ccfSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
30208abc0ccfSmrg[# Compute $1's index in $config_headers.
30218abc0ccfSmrg_am_arg=$1
30228abc0ccfSmrg_am_stamp_count=1
30238abc0ccfSmrgfor _am_header in $config_headers :; do
30248abc0ccfSmrg  case $_am_header in
30258abc0ccfSmrg    $_am_arg | $_am_arg:* )
30268abc0ccfSmrg      break ;;
30278abc0ccfSmrg    * )
30288abc0ccfSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
30298abc0ccfSmrg  esac
30308abc0ccfSmrgdone
30318abc0ccfSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
303296402570Smrg
30336c3c2bceSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
30348abc0ccfSmrg#
30358abc0ccfSmrg# This file is free software; the Free Software Foundation
30368abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
30378abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
303896402570Smrg
30398abc0ccfSmrg# AM_PROG_INSTALL_SH
30408abc0ccfSmrg# ------------------
30418abc0ccfSmrg# Define $install_sh.
30428abc0ccfSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
30438abc0ccfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
304440c5344fSmrgif test x"${install_sh+set}" != xset; then
30458abc0ccfSmrg  case $am_aux_dir in
30468abc0ccfSmrg  *\ * | *\	*)
30478abc0ccfSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
30488abc0ccfSmrg  *)
30498abc0ccfSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
30508abc0ccfSmrg  esac
305196402570Smrgfi
30528abc0ccfSmrgAC_SUBST([install_sh])])
305396402570Smrg
30546c3c2bceSmrg# Copyright (C) 2003-2018 Free Software Foundation, Inc.
30558abc0ccfSmrg#
30568abc0ccfSmrg# This file is free software; the Free Software Foundation
30578abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
30588abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
30598abc0ccfSmrg
30608abc0ccfSmrg# Check whether the underlying file-system supports filenames
30618abc0ccfSmrg# with a leading dot.  For instance MS-DOS doesn't.
30628abc0ccfSmrgAC_DEFUN([AM_SET_LEADING_DOT],
30638abc0ccfSmrg[rm -rf .tst 2>/dev/null
30648abc0ccfSmrgmkdir .tst 2>/dev/null
30658abc0ccfSmrgif test -d .tst; then
30668abc0ccfSmrg  am__leading_dot=.
30678abc0ccfSmrgelse
30688abc0ccfSmrg  am__leading_dot=_
306996402570Smrgfi
30708abc0ccfSmrgrmdir .tst 2>/dev/null
30718abc0ccfSmrgAC_SUBST([am__leading_dot])])
307296402570Smrg
30738abc0ccfSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
307496402570Smrg
30756c3c2bceSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
307696402570Smrg#
30778abc0ccfSmrg# This file is free software; the Free Software Foundation
30788abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
30798abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
308096402570Smrg
30818abc0ccfSmrg# AM_MAKE_INCLUDE()
30828abc0ccfSmrg# -----------------
30836c3c2bceSmrg# Check whether make has an 'include' directive that can support all
30846c3c2bceSmrg# the idioms we need for our automatic dependency tracking code.
30858abc0ccfSmrgAC_DEFUN([AM_MAKE_INCLUDE],
30866c3c2bceSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
30876c3c2bceSmrgcat > confinc.mk << 'END'
30888abc0ccfSmrgam__doit:
30896c3c2bceSmrg	@echo this is the am__doit target >confinc.out
30908abc0ccfSmrg.PHONY: am__doit
30918abc0ccfSmrgEND
30928abc0ccfSmrgam__include="#"
30938abc0ccfSmrgam__quote=
30946c3c2bceSmrg# BSD make does it like this.
30956c3c2bceSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
30966c3c2bceSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
30976c3c2bceSmrgecho 'include confinc.mk # ignored' > confmf.GNU
30986c3c2bceSmrg_am_result=no
30996c3c2bceSmrgfor s in GNU BSD; do
31006c3c2bceSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
31016c3c2bceSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
31026c3c2bceSmrg      ['0:this is the am__doit target'],
31036c3c2bceSmrg      [AS_CASE([$s],
31046c3c2bceSmrg          [BSD], [am__include='.include' am__quote='"'],
31056c3c2bceSmrg          [am__include='include' am__quote=''])])
31066c3c2bceSmrg  if test "$am__include" != "#"; then
31076c3c2bceSmrg    _am_result="yes ($s style)"
31086c3c2bceSmrg    break
31096c3c2bceSmrg  fi
31106c3c2bceSmrgdone
31116c3c2bceSmrgrm -f confinc.* confmf.*
31126c3c2bceSmrgAC_MSG_RESULT([${_am_result}])
31136c3c2bceSmrgAC_SUBST([am__include])])
31146c3c2bceSmrgAC_SUBST([am__quote])])
311596402570Smrg
31168abc0ccfSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
311796402570Smrg
31186c3c2bceSmrg# Copyright (C) 1997-2018 Free Software Foundation, Inc.
31198abc0ccfSmrg#
31208abc0ccfSmrg# This file is free software; the Free Software Foundation
31218abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
31228abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
312396402570Smrg
31248abc0ccfSmrg# AM_MISSING_PROG(NAME, PROGRAM)
31258abc0ccfSmrg# ------------------------------
31268abc0ccfSmrgAC_DEFUN([AM_MISSING_PROG],
31278abc0ccfSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
31288abc0ccfSmrg$1=${$1-"${am_missing_run}$2"}
31298abc0ccfSmrgAC_SUBST($1)])
313096402570Smrg
31318abc0ccfSmrg# AM_MISSING_HAS_RUN
31328abc0ccfSmrg# ------------------
31339a011757Smrg# Define MISSING if not defined so far and test if it is modern enough.
31349a011757Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
31358abc0ccfSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
31368abc0ccfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
31378abc0ccfSmrgAC_REQUIRE_AUX_FILE([missing])dnl
31388abc0ccfSmrgif test x"${MISSING+set}" != xset; then
31398abc0ccfSmrg  case $am_aux_dir in
31408abc0ccfSmrg  *\ * | *\	*)
31418abc0ccfSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
31428abc0ccfSmrg  *)
31438abc0ccfSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
31448abc0ccfSmrg  esac
31458abc0ccfSmrgfi
31468abc0ccfSmrg# Use eval to expand $SHELL
31479a011757Smrgif eval "$MISSING --is-lightweight"; then
31489a011757Smrg  am_missing_run="$MISSING "
314996402570Smrgelse
31508abc0ccfSmrg  am_missing_run=
31518abc0ccfSmrg  AC_MSG_WARN(['missing' script is too old or missing])
315296402570Smrgfi
31538abc0ccfSmrg])
315496402570Smrg
31558abc0ccfSmrg# Helper functions for option handling.                     -*- Autoconf -*-
315696402570Smrg
31576c3c2bceSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
31587366012aSmrg#
31598abc0ccfSmrg# This file is free software; the Free Software Foundation
31608abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
31618abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
31627366012aSmrg
31638abc0ccfSmrg# _AM_MANGLE_OPTION(NAME)
31647366012aSmrg# -----------------------
31658abc0ccfSmrgAC_DEFUN([_AM_MANGLE_OPTION],
31668abc0ccfSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
31677366012aSmrg
31688abc0ccfSmrg# _AM_SET_OPTION(NAME)
31698abc0ccfSmrg# --------------------
31708abc0ccfSmrg# Set option NAME.  Presently that only means defining a flag for this option.
31718abc0ccfSmrgAC_DEFUN([_AM_SET_OPTION],
31728abc0ccfSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
317396402570Smrg
31748abc0ccfSmrg# _AM_SET_OPTIONS(OPTIONS)
31758abc0ccfSmrg# ------------------------
31768abc0ccfSmrg# OPTIONS is a space-separated list of Automake options.
31778abc0ccfSmrgAC_DEFUN([_AM_SET_OPTIONS],
31788abc0ccfSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
317996402570Smrg
31808abc0ccfSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
31818abc0ccfSmrg# -------------------------------------------
31828abc0ccfSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
31838abc0ccfSmrgAC_DEFUN([_AM_IF_OPTION],
31848abc0ccfSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
318596402570Smrg
31866c3c2bceSmrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
318740c5344fSmrg#
318840c5344fSmrg# This file is free software; the Free Software Foundation
318940c5344fSmrg# gives unlimited permission to copy and/or distribute it,
319040c5344fSmrg# with or without modifications, as long as this notice is preserved.
319140c5344fSmrg
319240c5344fSmrg# _AM_PROG_CC_C_O
319340c5344fSmrg# ---------------
319440c5344fSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
319540c5344fSmrg# to automatically call this.
319640c5344fSmrgAC_DEFUN([_AM_PROG_CC_C_O],
319740c5344fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
319840c5344fSmrgAC_REQUIRE_AUX_FILE([compile])dnl
319940c5344fSmrgAC_LANG_PUSH([C])dnl
320040c5344fSmrgAC_CACHE_CHECK(
320140c5344fSmrg  [whether $CC understands -c and -o together],
320240c5344fSmrg  [am_cv_prog_cc_c_o],
320340c5344fSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
320440c5344fSmrg  # Make sure it works both with $CC and with simple cc.
320540c5344fSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
320640c5344fSmrg  # compilers refuse to overwrite an existing .o file with -o,
320740c5344fSmrg  # though they will create one.
320840c5344fSmrg  am_cv_prog_cc_c_o=yes
320940c5344fSmrg  for am_i in 1 2; do
321040c5344fSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
321140c5344fSmrg         && test -f conftest2.$ac_objext; then
321240c5344fSmrg      : OK
321340c5344fSmrg    else
321440c5344fSmrg      am_cv_prog_cc_c_o=no
321540c5344fSmrg      break
321640c5344fSmrg    fi
321740c5344fSmrg  done
321840c5344fSmrg  rm -f core conftest*
321940c5344fSmrg  unset am_i])
322040c5344fSmrgif test "$am_cv_prog_cc_c_o" != yes; then
322140c5344fSmrg   # Losing compiler, so override with the script.
322240c5344fSmrg   # FIXME: It is wrong to rewrite CC.
322340c5344fSmrg   # But if we don't then we get into trouble of one sort or another.
322440c5344fSmrg   # A longer-term fix would be to have automake use am__CC in this case,
322540c5344fSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
322640c5344fSmrg   CC="$am_aux_dir/compile $CC"
322740c5344fSmrgfi
322840c5344fSmrgAC_LANG_POP([C])])
322940c5344fSmrg
323040c5344fSmrg# For backward compatibility.
323140c5344fSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
323240c5344fSmrg
32336c3c2bceSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
323440c5344fSmrg#
323540c5344fSmrg# This file is free software; the Free Software Foundation
323640c5344fSmrg# gives unlimited permission to copy and/or distribute it,
323740c5344fSmrg# with or without modifications, as long as this notice is preserved.
323840c5344fSmrg
323940c5344fSmrg# AM_RUN_LOG(COMMAND)
324040c5344fSmrg# -------------------
324140c5344fSmrg# Run COMMAND, save the exit status in ac_status, and log it.
324240c5344fSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
324340c5344fSmrgAC_DEFUN([AM_RUN_LOG],
324440c5344fSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
324540c5344fSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
324640c5344fSmrg   ac_status=$?
324740c5344fSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
324840c5344fSmrg   (exit $ac_status); }])
324940c5344fSmrg
32508abc0ccfSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
325196402570Smrg
32526c3c2bceSmrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
32538abc0ccfSmrg#
32548abc0ccfSmrg# This file is free software; the Free Software Foundation
32558abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
32568abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
32578abc0ccfSmrg
32588abc0ccfSmrg# AM_SANITY_CHECK
32598abc0ccfSmrg# ---------------
32608abc0ccfSmrgAC_DEFUN([AM_SANITY_CHECK],
32618abc0ccfSmrg[AC_MSG_CHECKING([whether build environment is sane])
32628abc0ccfSmrg# Reject unsafe characters in $srcdir or the absolute working directory
32638abc0ccfSmrg# name.  Accept space and tab only in the latter.
32648abc0ccfSmrgam_lf='
32658abc0ccfSmrg'
32668abc0ccfSmrgcase `pwd` in
32678abc0ccfSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
32688abc0ccfSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
32698abc0ccfSmrgesac
32708abc0ccfSmrgcase $srcdir in
32718abc0ccfSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
32728abc0ccfSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
32738abc0ccfSmrgesac
32748abc0ccfSmrg
32758abc0ccfSmrg# Do 'set' in a subshell so we don't clobber the current shell's
32768abc0ccfSmrg# arguments.  Must try -L first in case configure is actually a
32778abc0ccfSmrg# symlink; some systems play weird games with the mod time of symlinks
32788abc0ccfSmrg# (eg FreeBSD returns the mod time of the symlink's containing
32798abc0ccfSmrg# directory).
32808abc0ccfSmrgif (
32818abc0ccfSmrg   am_has_slept=no
32828abc0ccfSmrg   for am_try in 1 2; do
32838abc0ccfSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
32848abc0ccfSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
32858abc0ccfSmrg     if test "$[*]" = "X"; then
32868abc0ccfSmrg	# -L didn't work.
32878abc0ccfSmrg	set X `ls -t "$srcdir/configure" conftest.file`
32888abc0ccfSmrg     fi
32898abc0ccfSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
32908abc0ccfSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
32918abc0ccfSmrg
32928abc0ccfSmrg	# If neither matched, then we have a broken ls.  This can happen
32938abc0ccfSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
32948abc0ccfSmrg	# broken ls alias from the environment.  This has actually
32958abc0ccfSmrg	# happened.  Such a system could not be considered "sane".
32968abc0ccfSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
32978abc0ccfSmrg  alias in your environment])
32988abc0ccfSmrg     fi
32998abc0ccfSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
33008abc0ccfSmrg       break
33018abc0ccfSmrg     fi
33028abc0ccfSmrg     # Just in case.
33038abc0ccfSmrg     sleep 1
33048abc0ccfSmrg     am_has_slept=yes
33058abc0ccfSmrg   done
33068abc0ccfSmrg   test "$[2]" = conftest.file
33078abc0ccfSmrg   )
33088abc0ccfSmrgthen
33098abc0ccfSmrg   # Ok.
33108abc0ccfSmrg   :
33118abc0ccfSmrgelse
33128abc0ccfSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
33138abc0ccfSmrgCheck your system clock])
33147a0395d0Smrgfi
33158abc0ccfSmrgAC_MSG_RESULT([yes])
33168abc0ccfSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
33178abc0ccfSmrg# generated files are strictly newer.
33188abc0ccfSmrgam_sleep_pid=
33198abc0ccfSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
33208abc0ccfSmrg  ( sleep 1 ) &
33218abc0ccfSmrg  am_sleep_pid=$!
33228abc0ccfSmrgfi
33238abc0ccfSmrgAC_CONFIG_COMMANDS_PRE(
33248abc0ccfSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
33258abc0ccfSmrg   if test -n "$am_sleep_pid"; then
33268abc0ccfSmrg     # Hide warnings about reused PIDs.
33278abc0ccfSmrg     wait $am_sleep_pid 2>/dev/null
33288abc0ccfSmrg   fi
33298abc0ccfSmrg   AC_MSG_RESULT([done])])
33308abc0ccfSmrgrm -f conftest.file
33318abc0ccfSmrg])
33327366012aSmrg
33336c3c2bceSmrg# Copyright (C) 2009-2018 Free Software Foundation, Inc.
33347366012aSmrg#
33358abc0ccfSmrg# This file is free software; the Free Software Foundation
33368abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
33378abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
33382adc0320Smrg
33398abc0ccfSmrg# AM_SILENT_RULES([DEFAULT])
33408abc0ccfSmrg# --------------------------
33418abc0ccfSmrg# Enable less verbose build rules; with the default set to DEFAULT
33428abc0ccfSmrg# ("yes" being less verbose, "no" or empty being verbose).
33438abc0ccfSmrgAC_DEFUN([AM_SILENT_RULES],
33448abc0ccfSmrg[AC_ARG_ENABLE([silent-rules], [dnl
33458abc0ccfSmrgAS_HELP_STRING(
33468abc0ccfSmrg  [--enable-silent-rules],
33478abc0ccfSmrg  [less verbose build output (undo: "make V=1")])
33488abc0ccfSmrgAS_HELP_STRING(
33498abc0ccfSmrg  [--disable-silent-rules],
33508abc0ccfSmrg  [verbose build output (undo: "make V=0")])dnl
33518abc0ccfSmrg])
33528abc0ccfSmrgcase $enable_silent_rules in @%:@ (((
33538abc0ccfSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
33548abc0ccfSmrg   no) AM_DEFAULT_VERBOSITY=1;;
33558abc0ccfSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
33568abc0ccfSmrgesac
33578abc0ccfSmrgdnl
33588abc0ccfSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
33598abc0ccfSmrgdnl do not support nested variable expansions.
33608abc0ccfSmrgdnl See automake bug#9928 and bug#10237.
33618abc0ccfSmrgam_make=${MAKE-make}
33628abc0ccfSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
33638abc0ccfSmrg   [am_cv_make_support_nested_variables],
33648abc0ccfSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
33658abc0ccfSmrgBAR0=false
33668abc0ccfSmrgBAR1=true
33678abc0ccfSmrgV=1
33688abc0ccfSmrgam__doit:
33698abc0ccfSmrg	@$(TRUE)
33708abc0ccfSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
33718abc0ccfSmrg  am_cv_make_support_nested_variables=yes
33728abc0ccfSmrgelse
33738abc0ccfSmrg  am_cv_make_support_nested_variables=no
33748abc0ccfSmrgfi])
33758abc0ccfSmrgif test $am_cv_make_support_nested_variables = yes; then
33768abc0ccfSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
33778abc0ccfSmrg  AM_V='$(V)'
33788abc0ccfSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
33798abc0ccfSmrgelse
33808abc0ccfSmrg  AM_V=$AM_DEFAULT_VERBOSITY
33818abc0ccfSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
33828abc0ccfSmrgfi
33838abc0ccfSmrgAC_SUBST([AM_V])dnl
33848abc0ccfSmrgAM_SUBST_NOTMAKE([AM_V])dnl
33858abc0ccfSmrgAC_SUBST([AM_DEFAULT_V])dnl
33868abc0ccfSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
33878abc0ccfSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
33888abc0ccfSmrgAM_BACKSLASH='\'
33898abc0ccfSmrgAC_SUBST([AM_BACKSLASH])dnl
33908abc0ccfSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
33917a0395d0Smrg])
33927a0395d0Smrg
33936c3c2bceSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
33947366012aSmrg#
33958abc0ccfSmrg# This file is free software; the Free Software Foundation
33968abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
33978abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
33987a0395d0Smrg
33998abc0ccfSmrg# AM_PROG_INSTALL_STRIP
34008abc0ccfSmrg# ---------------------
34018abc0ccfSmrg# One issue with vendor 'install' (even GNU) is that you can't
34028abc0ccfSmrg# specify the program used to strip binaries.  This is especially
34038abc0ccfSmrg# annoying in cross-compiling environments, where the build's strip
34048abc0ccfSmrg# is unlikely to handle the host's binaries.
34058abc0ccfSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
34068abc0ccfSmrg# always use install-sh in "make install-strip", and initialize
34078abc0ccfSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
34088abc0ccfSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
34098abc0ccfSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
34108abc0ccfSmrg# Installed binaries are usually stripped using 'strip' when the user
34118abc0ccfSmrg# run "make install-strip".  However 'strip' might not be the right
34128abc0ccfSmrg# tool to use in cross-compilation environments, therefore Automake
34138abc0ccfSmrg# will honor the 'STRIP' environment variable to overrule this program.
34148abc0ccfSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
34158abc0ccfSmrgif test "$cross_compiling" != no; then
34168abc0ccfSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
34178abc0ccfSmrgfi
34188abc0ccfSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
34198abc0ccfSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
34207a0395d0Smrg
34216c3c2bceSmrg# Copyright (C) 2006-2018 Free Software Foundation, Inc.
34228abc0ccfSmrg#
34238abc0ccfSmrg# This file is free software; the Free Software Foundation
34248abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
34258abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
34267a0395d0Smrg
34278abc0ccfSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
34288abc0ccfSmrg# ---------------------------
34298abc0ccfSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
34308abc0ccfSmrg# This macro is traced by Automake.
34318abc0ccfSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
343296402570Smrg
34338abc0ccfSmrg# AM_SUBST_NOTMAKE(VARIABLE)
34348abc0ccfSmrg# --------------------------
34358abc0ccfSmrg# Public sister of _AM_SUBST_NOTMAKE.
34368abc0ccfSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
34377a0395d0Smrg
34388abc0ccfSmrg# Check how to create a tarball.                            -*- Autoconf -*-
343996402570Smrg
34406c3c2bceSmrg# Copyright (C) 2004-2018 Free Software Foundation, Inc.
34418abc0ccfSmrg#
34428abc0ccfSmrg# This file is free software; the Free Software Foundation
34438abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
34448abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
34457a0395d0Smrg
34468abc0ccfSmrg# _AM_PROG_TAR(FORMAT)
34478abc0ccfSmrg# --------------------
34488abc0ccfSmrg# Check how to create a tarball in format FORMAT.
34498abc0ccfSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
34508abc0ccfSmrg#
34518abc0ccfSmrg# Substitute a variable $(am__tar) that is a command
34528abc0ccfSmrg# writing to stdout a FORMAT-tarball containing the directory
34538abc0ccfSmrg# $tardir.
34548abc0ccfSmrg#     tardir=directory && $(am__tar) > result.tar
34558abc0ccfSmrg#
34568abc0ccfSmrg# Substitute a variable $(am__untar) that extract such
34578abc0ccfSmrg# a tarball read from stdin.
34588abc0ccfSmrg#     $(am__untar) < result.tar
34599a011757Smrg#
34608abc0ccfSmrgAC_DEFUN([_AM_PROG_TAR],
34618abc0ccfSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
34628abc0ccfSmrg# in the wild :-(  We should find a proper way to deprecate it ...
34638abc0ccfSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
34649a011757Smrg
34659a011757Smrg# We'll loop over all known methods to create a tar archive until one works.
34668abc0ccfSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
34677a0395d0Smrg
34689a011757Smrgm4_if([$1], [v7],
34699a011757Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
34709a011757Smrg
34719a011757Smrg  [m4_case([$1],
34729a011757Smrg    [ustar],
34739a011757Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
34749a011757Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
34759a011757Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
34769a011757Smrg      # and bug#13588).
34779a011757Smrg      am_max_uid=2097151 # 2^21 - 1
34789a011757Smrg      am_max_gid=$am_max_uid
34799a011757Smrg      # The $UID and $GID variables are not portable, so we need to resort
34809a011757Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
34819a011757Smrg      # below are definitely unexpected, so allow the users to see them
34829a011757Smrg      # (that is, avoid stderr redirection).
34839a011757Smrg      am_uid=`id -u || echo unknown`
34849a011757Smrg      am_gid=`id -g || echo unknown`
34859a011757Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
34869a011757Smrg      if test $am_uid -le $am_max_uid; then
34879a011757Smrg         AC_MSG_RESULT([yes])
34889a011757Smrg      else
34899a011757Smrg         AC_MSG_RESULT([no])
34909a011757Smrg         _am_tools=none
34919a011757Smrg      fi
34929a011757Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
34939a011757Smrg      if test $am_gid -le $am_max_gid; then
34949a011757Smrg         AC_MSG_RESULT([yes])
34959a011757Smrg      else
34969a011757Smrg        AC_MSG_RESULT([no])
34979a011757Smrg        _am_tools=none
34989a011757Smrg      fi],
34999a011757Smrg
35009a011757Smrg  [pax],
35019a011757Smrg    [],
35029a011757Smrg
35039a011757Smrg  [m4_fatal([Unknown tar format])])
35049a011757Smrg
35059a011757Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
35069a011757Smrg
35079a011757Smrg  # Go ahead even if we have the value already cached.  We do so because we
35089a011757Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
35099a011757Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
35109a011757Smrg
35119a011757Smrg  for _am_tool in $_am_tools; do
35129a011757Smrg    case $_am_tool in
35139a011757Smrg    gnutar)
35149a011757Smrg      for _am_tar in tar gnutar gtar; do
35159a011757Smrg        AM_RUN_LOG([$_am_tar --version]) && break
35169a011757Smrg      done
35179a011757Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
35189a011757Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
35199a011757Smrg      am__untar="$_am_tar -xf -"
35209a011757Smrg      ;;
35219a011757Smrg    plaintar)
35229a011757Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
35239a011757Smrg      # ustar tarball either.
35249a011757Smrg      (tar --version) >/dev/null 2>&1 && continue
35259a011757Smrg      am__tar='tar chf - "$$tardir"'
35269a011757Smrg      am__tar_='tar chf - "$tardir"'
35279a011757Smrg      am__untar='tar xf -'
35289a011757Smrg      ;;
35299a011757Smrg    pax)
35309a011757Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
35319a011757Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
35329a011757Smrg      am__untar='pax -r'
35339a011757Smrg      ;;
35349a011757Smrg    cpio)
35359a011757Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
35369a011757Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
35379a011757Smrg      am__untar='cpio -i -H $1 -d'
35389a011757Smrg      ;;
35399a011757Smrg    none)
35409a011757Smrg      am__tar=false
35419a011757Smrg      am__tar_=false
35429a011757Smrg      am__untar=false
35439a011757Smrg      ;;
35449a011757Smrg    esac
35458abc0ccfSmrg
35469a011757Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
35479a011757Smrg    # and am__untar set.
35489a011757Smrg    test -n "${am_cv_prog_tar_$1}" && break
35499a011757Smrg
35509a011757Smrg    # tar/untar a dummy directory, and stop if the command works.
35519a011757Smrg    rm -rf conftest.dir
35529a011757Smrg    mkdir conftest.dir
35539a011757Smrg    echo GrepMe > conftest.dir/file
35549a011757Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
35559a011757Smrg    rm -rf conftest.dir
35569a011757Smrg    if test -s conftest.tar; then
35579a011757Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
35589a011757Smrg      AM_RUN_LOG([cat conftest.dir/file])
35599a011757Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
35609a011757Smrg    fi
35619a011757Smrg  done
35628abc0ccfSmrg  rm -rf conftest.dir
35637a0395d0Smrg
35649a011757Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
35659a011757Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
35669a011757Smrg
35678abc0ccfSmrgAC_SUBST([am__tar])
35688abc0ccfSmrgAC_SUBST([am__untar])
35698abc0ccfSmrg]) # _AM_PROG_TAR
35707a0395d0Smrg
3571