aclocal.m4 revision ffe57424
1ffe57424Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*- 217ca54c3Smrg 3ffe57424Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 417ca54c3Smrg 517ca54c3Smrg# This file is free software; the Free Software Foundation 617ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 717ca54c3Smrg# with or without modifications, as long as this notice is preserved. 817ca54c3Smrg 917ca54c3Smrg# This program is distributed in the hope that it will be useful, 1017ca54c3Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without 1117ca54c3Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A 1217ca54c3Smrg# PARTICULAR PURPOSE. 1317ca54c3Smrg 1417ca54c3Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) 1517ca54c3Smrgm4_ifndef([AC_AUTOCONF_VERSION], 1617ca54c3Smrg [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl 17ffe57424Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, 18ffe57424Smrg[m4_warning([this file was generated for autoconf 2.71. 1917ca54c3SmrgYou have another version of autoconf. It may work, but is not guaranteed to. 2017ca54c3SmrgIf you have problems, you may need to regenerate the build system entirely. 2117ca54c3SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])]) 2217ca54c3Smrg 2317ca54c3Smrg# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- 2417ca54c3Smrg# serial 11 (pkg-config-0.29.1) 2517ca54c3Smrg 2617ca54c3Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>. 2717ca54c3Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com> 2817ca54c3Smrgdnl 2917ca54c3Smrgdnl This program is free software; you can redistribute it and/or modify 3017ca54c3Smrgdnl it under the terms of the GNU General Public License as published by 3117ca54c3Smrgdnl the Free Software Foundation; either version 2 of the License, or 3217ca54c3Smrgdnl (at your option) any later version. 3317ca54c3Smrgdnl 3417ca54c3Smrgdnl This program is distributed in the hope that it will be useful, but 3517ca54c3Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of 3617ca54c3Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 3717ca54c3Smrgdnl General Public License for more details. 3817ca54c3Smrgdnl 3917ca54c3Smrgdnl You should have received a copy of the GNU General Public License 4017ca54c3Smrgdnl along with this program; if not, write to the Free Software 4117ca54c3Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 4217ca54c3Smrgdnl 02111-1307, USA. 4317ca54c3Smrgdnl 4417ca54c3Smrgdnl As a special exception to the GNU General Public License, if you 4517ca54c3Smrgdnl distribute this file as part of a program that contains a 4617ca54c3Smrgdnl configuration script generated by Autoconf, you may include it under 4717ca54c3Smrgdnl the same distribution terms that you use for the rest of that 4817ca54c3Smrgdnl program. 4917ca54c3Smrg 5017ca54c3Smrgdnl PKG_PREREQ(MIN-VERSION) 5117ca54c3Smrgdnl ----------------------- 5217ca54c3Smrgdnl Since: 0.29 5317ca54c3Smrgdnl 5417ca54c3Smrgdnl Verify that the version of the pkg-config macros are at least 5517ca54c3Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's 5617ca54c3Smrgdnl installed version of pkg-config, this checks the developer's version 5717ca54c3Smrgdnl of pkg.m4 when generating configure. 5817ca54c3Smrgdnl 5917ca54c3Smrgdnl To ensure that this macro is defined, also add: 6017ca54c3Smrgdnl m4_ifndef([PKG_PREREQ], 6117ca54c3Smrgdnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) 6217ca54c3Smrgdnl 6317ca54c3Smrgdnl See the "Since" comment for each macro you use to see what version 6417ca54c3Smrgdnl of the macros you require. 6517ca54c3Smrgm4_defun([PKG_PREREQ], 6617ca54c3Smrg[m4_define([PKG_MACROS_VERSION], [0.29.1]) 6717ca54c3Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, 6817ca54c3Smrg [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) 6917ca54c3Smrg])dnl PKG_PREREQ 7017ca54c3Smrg 7117ca54c3Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) 7217ca54c3Smrgdnl ---------------------------------- 7317ca54c3Smrgdnl Since: 0.16 7417ca54c3Smrgdnl 7517ca54c3Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to 7617ca54c3Smrgdnl first found in the path. Checks that the version of pkg-config found 7717ca54c3Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is 7817ca54c3Smrgdnl used since that's the first version where most current features of 7917ca54c3Smrgdnl pkg-config existed. 8017ca54c3SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG], 8117ca54c3Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) 8217ca54c3Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) 8317ca54c3Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) 8417ca54c3SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) 8517ca54c3SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) 8617ca54c3SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) 8717ca54c3Smrg 8817ca54c3Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then 8917ca54c3Smrg AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) 9017ca54c3Smrgfi 9117ca54c3Smrgif test -n "$PKG_CONFIG"; then 9217ca54c3Smrg _pkg_min_version=m4_default([$1], [0.9.0]) 9317ca54c3Smrg AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) 9417ca54c3Smrg if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then 9517ca54c3Smrg AC_MSG_RESULT([yes]) 9617ca54c3Smrg else 9717ca54c3Smrg AC_MSG_RESULT([no]) 9817ca54c3Smrg PKG_CONFIG="" 9917ca54c3Smrg fi 10017ca54c3Smrgfi[]dnl 10117ca54c3Smrg])dnl PKG_PROG_PKG_CONFIG 10217ca54c3Smrg 10317ca54c3Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 10417ca54c3Smrgdnl ------------------------------------------------------------------- 10517ca54c3Smrgdnl Since: 0.18 10617ca54c3Smrgdnl 10717ca54c3Smrgdnl Check to see whether a particular set of modules exists. Similar to 10817ca54c3Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors. 10917ca54c3Smrgdnl 11017ca54c3Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 11117ca54c3Smrgdnl only at the first occurence in configure.ac, so if the first place 11217ca54c3Smrgdnl it's called might be skipped (such as if it is within an "if", you 11317ca54c3Smrgdnl have to call PKG_CHECK_EXISTS manually 11417ca54c3SmrgAC_DEFUN([PKG_CHECK_EXISTS], 11517ca54c3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 11617ca54c3Smrgif test -n "$PKG_CONFIG" && \ 11717ca54c3Smrg AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then 11817ca54c3Smrg m4_default([$2], [:]) 11917ca54c3Smrgm4_ifvaln([$3], [else 12017ca54c3Smrg $3])dnl 12117ca54c3Smrgfi]) 12217ca54c3Smrg 12317ca54c3Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) 12417ca54c3Smrgdnl --------------------------------------------- 12517ca54c3Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting 12617ca54c3Smrgdnl pkg_failed based on the result. 12717ca54c3Smrgm4_define([_PKG_CONFIG], 12817ca54c3Smrg[if test -n "$$1"; then 12917ca54c3Smrg pkg_cv_[]$1="$$1" 13017ca54c3Smrg elif test -n "$PKG_CONFIG"; then 13117ca54c3Smrg PKG_CHECK_EXISTS([$3], 13217ca54c3Smrg [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` 13317ca54c3Smrg test "x$?" != "x0" && pkg_failed=yes ], 13417ca54c3Smrg [pkg_failed=yes]) 13517ca54c3Smrg else 13617ca54c3Smrg pkg_failed=untried 13717ca54c3Smrgfi[]dnl 13817ca54c3Smrg])dnl _PKG_CONFIG 13917ca54c3Smrg 14017ca54c3Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED 14117ca54c3Smrgdnl --------------------------- 14217ca54c3Smrgdnl Internal check to see if pkg-config supports short errors. 14317ca54c3SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], 14417ca54c3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 14517ca54c3Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then 14617ca54c3Smrg _pkg_short_errors_supported=yes 14717ca54c3Smrgelse 14817ca54c3Smrg _pkg_short_errors_supported=no 14917ca54c3Smrgfi[]dnl 15017ca54c3Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED 15117ca54c3Smrg 15217ca54c3Smrg 15317ca54c3Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], 15417ca54c3Smrgdnl [ACTION-IF-NOT-FOUND]) 15517ca54c3Smrgdnl -------------------------------------------------------------- 15617ca54c3Smrgdnl Since: 0.4.0 15717ca54c3Smrgdnl 15817ca54c3Smrgdnl Note that if there is a possibility the first call to 15917ca54c3Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an 16017ca54c3Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac 16117ca54c3SmrgAC_DEFUN([PKG_CHECK_MODULES], 16217ca54c3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 16317ca54c3SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl 16417ca54c3SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl 16517ca54c3Smrg 16617ca54c3Smrgpkg_failed=no 16717ca54c3SmrgAC_MSG_CHECKING([for $1]) 16817ca54c3Smrg 16917ca54c3Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) 17017ca54c3Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2]) 17117ca54c3Smrg 17217ca54c3Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS 17317ca54c3Smrgand $1[]_LIBS to avoid the need to call pkg-config. 17417ca54c3SmrgSee the pkg-config man page for more details.]) 17517ca54c3Smrg 17617ca54c3Smrgif test $pkg_failed = yes; then 17717ca54c3Smrg AC_MSG_RESULT([no]) 17817ca54c3Smrg _PKG_SHORT_ERRORS_SUPPORTED 17917ca54c3Smrg if test $_pkg_short_errors_supported = yes; then 18017ca54c3Smrg $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` 18117ca54c3Smrg else 18217ca54c3Smrg $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` 18317ca54c3Smrg fi 18417ca54c3Smrg # Put the nasty error message in config.log where it belongs 18517ca54c3Smrg echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD 18617ca54c3Smrg 18717ca54c3Smrg m4_default([$4], [AC_MSG_ERROR( 18817ca54c3Smrg[Package requirements ($2) were not met: 18917ca54c3Smrg 19017ca54c3Smrg$$1_PKG_ERRORS 19117ca54c3Smrg 19217ca54c3SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you 19317ca54c3Smrginstalled software in a non-standard prefix. 19417ca54c3Smrg 19517ca54c3Smrg_PKG_TEXT])[]dnl 19617ca54c3Smrg ]) 19717ca54c3Smrgelif test $pkg_failed = untried; then 19817ca54c3Smrg AC_MSG_RESULT([no]) 19917ca54c3Smrg m4_default([$4], [AC_MSG_FAILURE( 20017ca54c3Smrg[The pkg-config script could not be found or is too old. Make sure it 20117ca54c3Smrgis in your PATH or set the PKG_CONFIG environment variable to the full 20217ca54c3Smrgpath to pkg-config. 20317ca54c3Smrg 20417ca54c3Smrg_PKG_TEXT 20517ca54c3Smrg 20617ca54c3SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl 20717ca54c3Smrg ]) 20817ca54c3Smrgelse 20917ca54c3Smrg $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS 21017ca54c3Smrg $1[]_LIBS=$pkg_cv_[]$1[]_LIBS 21117ca54c3Smrg AC_MSG_RESULT([yes]) 21217ca54c3Smrg $3 21317ca54c3Smrgfi[]dnl 21417ca54c3Smrg])dnl PKG_CHECK_MODULES 21517ca54c3Smrg 21617ca54c3Smrg 21717ca54c3Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], 21817ca54c3Smrgdnl [ACTION-IF-NOT-FOUND]) 21917ca54c3Smrgdnl --------------------------------------------------------------------- 22017ca54c3Smrgdnl Since: 0.29 22117ca54c3Smrgdnl 22217ca54c3Smrgdnl Checks for existence of MODULES and gathers its build flags with 22317ca54c3Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags 22417ca54c3Smrgdnl and VARIABLE-PREFIX_LIBS from --libs. 22517ca54c3Smrgdnl 22617ca54c3Smrgdnl Note that if there is a possibility the first call to 22717ca54c3Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to 22817ca54c3Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your 22917ca54c3Smrgdnl configure.ac. 23017ca54c3SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC], 23117ca54c3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 23217ca54c3Smrg_save_PKG_CONFIG=$PKG_CONFIG 23317ca54c3SmrgPKG_CONFIG="$PKG_CONFIG --static" 23417ca54c3SmrgPKG_CHECK_MODULES($@) 23517ca54c3SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl 23617ca54c3Smrg])dnl PKG_CHECK_MODULES_STATIC 23717ca54c3Smrg 23817ca54c3Smrg 23917ca54c3Smrgdnl PKG_INSTALLDIR([DIRECTORY]) 24017ca54c3Smrgdnl ------------------------- 24117ca54c3Smrgdnl Since: 0.27 24217ca54c3Smrgdnl 24317ca54c3Smrgdnl Substitutes the variable pkgconfigdir as the location where a module 24417ca54c3Smrgdnl should install pkg-config .pc files. By default the directory is 24517ca54c3Smrgdnl $libdir/pkgconfig, but the default can be changed by passing 24617ca54c3Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir 24717ca54c3Smrgdnl parameter. 24817ca54c3SmrgAC_DEFUN([PKG_INSTALLDIR], 24917ca54c3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) 25017ca54c3Smrgm4_pushdef([pkg_description], 25117ca54c3Smrg [pkg-config installation directory @<:@]pkg_default[@:>@]) 25217ca54c3SmrgAC_ARG_WITH([pkgconfigdir], 25317ca54c3Smrg [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, 25417ca54c3Smrg [with_pkgconfigdir=]pkg_default) 25517ca54c3SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) 25617ca54c3Smrgm4_popdef([pkg_default]) 25717ca54c3Smrgm4_popdef([pkg_description]) 25817ca54c3Smrg])dnl PKG_INSTALLDIR 25917ca54c3Smrg 26017ca54c3Smrg 26117ca54c3Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) 26217ca54c3Smrgdnl -------------------------------- 26317ca54c3Smrgdnl Since: 0.27 26417ca54c3Smrgdnl 26517ca54c3Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a 26617ca54c3Smrgdnl module should install arch-independent pkg-config .pc files. By 26717ca54c3Smrgdnl default the directory is $datadir/pkgconfig, but the default can be 26817ca54c3Smrgdnl changed by passing DIRECTORY. The user can override through the 26917ca54c3Smrgdnl --with-noarch-pkgconfigdir parameter. 27017ca54c3SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR], 27117ca54c3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) 27217ca54c3Smrgm4_pushdef([pkg_description], 27317ca54c3Smrg [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) 27417ca54c3SmrgAC_ARG_WITH([noarch-pkgconfigdir], 27517ca54c3Smrg [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, 27617ca54c3Smrg [with_noarch_pkgconfigdir=]pkg_default) 27717ca54c3SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) 27817ca54c3Smrgm4_popdef([pkg_default]) 27917ca54c3Smrgm4_popdef([pkg_description]) 28017ca54c3Smrg])dnl PKG_NOARCH_INSTALLDIR 28117ca54c3Smrg 28217ca54c3Smrg 28317ca54c3Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, 28417ca54c3Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 28517ca54c3Smrgdnl ------------------------------------------- 28617ca54c3Smrgdnl Since: 0.28 28717ca54c3Smrgdnl 28817ca54c3Smrgdnl Retrieves the value of the pkg-config variable for the given module. 28917ca54c3SmrgAC_DEFUN([PKG_CHECK_VAR], 29017ca54c3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 29117ca54c3SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl 29217ca54c3Smrg 29317ca54c3Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2]) 29417ca54c3SmrgAS_VAR_COPY([$1], [pkg_cv_][$1]) 29517ca54c3Smrg 29617ca54c3SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl 29717ca54c3Smrg])dnl PKG_CHECK_VAR 29817ca54c3Smrg 29917ca54c3Smrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, 30017ca54c3Smrgdnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], 30117ca54c3Smrgdnl [DESCRIPTION], [DEFAULT]) 30217ca54c3Smrgdnl ------------------------------------------ 30317ca54c3Smrgdnl 30417ca54c3Smrgdnl Prepare a "--with-" configure option using the lowercase 30517ca54c3Smrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and 30617ca54c3Smrgdnl PKG_CHECK_MODULES in a single macro. 30717ca54c3SmrgAC_DEFUN([PKG_WITH_MODULES], 30817ca54c3Smrg[ 30917ca54c3Smrgm4_pushdef([with_arg], m4_tolower([$1])) 31017ca54c3Smrg 31117ca54c3Smrgm4_pushdef([description], 31217ca54c3Smrg [m4_default([$5], [build with ]with_arg[ support])]) 31317ca54c3Smrg 31417ca54c3Smrgm4_pushdef([def_arg], [m4_default([$6], [auto])]) 31517ca54c3Smrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) 31617ca54c3Smrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) 31717ca54c3Smrg 31817ca54c3Smrgm4_case(def_arg, 31917ca54c3Smrg [yes],[m4_pushdef([with_without], [--without-]with_arg)], 32017ca54c3Smrg [m4_pushdef([with_without],[--with-]with_arg)]) 32117ca54c3Smrg 32217ca54c3SmrgAC_ARG_WITH(with_arg, 32317ca54c3Smrg AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, 32417ca54c3Smrg [AS_TR_SH([with_]with_arg)=def_arg]) 32517ca54c3Smrg 32617ca54c3SmrgAS_CASE([$AS_TR_SH([with_]with_arg)], 32717ca54c3Smrg [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], 32817ca54c3Smrg [auto],[PKG_CHECK_MODULES([$1],[$2], 32917ca54c3Smrg [m4_n([def_action_if_found]) $3], 33017ca54c3Smrg [m4_n([def_action_if_not_found]) $4])]) 33117ca54c3Smrg 33217ca54c3Smrgm4_popdef([with_arg]) 33317ca54c3Smrgm4_popdef([description]) 33417ca54c3Smrgm4_popdef([def_arg]) 33517ca54c3Smrg 33617ca54c3Smrg])dnl PKG_WITH_MODULES 33717ca54c3Smrg 33817ca54c3Smrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, 33917ca54c3Smrgdnl [DESCRIPTION], [DEFAULT]) 34017ca54c3Smrgdnl ----------------------------------------------- 34117ca54c3Smrgdnl 34217ca54c3Smrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES 34317ca54c3Smrgdnl check._[VARIABLE-PREFIX] is exported as make variable. 34417ca54c3SmrgAC_DEFUN([PKG_HAVE_WITH_MODULES], 34517ca54c3Smrg[ 34617ca54c3SmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) 34717ca54c3Smrg 34817ca54c3SmrgAM_CONDITIONAL([HAVE_][$1], 34917ca54c3Smrg [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) 35017ca54c3Smrg])dnl PKG_HAVE_WITH_MODULES 35117ca54c3Smrg 35217ca54c3Smrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, 35317ca54c3Smrgdnl [DESCRIPTION], [DEFAULT]) 35417ca54c3Smrgdnl ------------------------------------------------------ 35517ca54c3Smrgdnl 35617ca54c3Smrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after 35717ca54c3Smrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make 35817ca54c3Smrgdnl and preprocessor variable. 35917ca54c3SmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], 36017ca54c3Smrg[ 36117ca54c3SmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) 36217ca54c3Smrg 36317ca54c3SmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], 36417ca54c3Smrg [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) 36517ca54c3Smrg])dnl PKG_HAVE_DEFINE_WITH_MODULES 36617ca54c3Smrg 36717ca54c3Smrgdnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. 36817ca54c3Smrgdnl 369ffe57424Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. 37017ca54c3Smrgdnl 37117ca54c3Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a 37217ca54c3Smrgdnl copy of this software and associated documentation files (the "Software"), 37317ca54c3Smrgdnl to deal in the Software without restriction, including without limitation 37417ca54c3Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense, 37517ca54c3Smrgdnl and/or sell copies of the Software, and to permit persons to whom the 37617ca54c3Smrgdnl Software is furnished to do so, subject to the following conditions: 37717ca54c3Smrgdnl 37817ca54c3Smrgdnl The above copyright notice and this permission notice (including the next 37917ca54c3Smrgdnl paragraph) shall be included in all copies or substantial portions of the 38017ca54c3Smrgdnl Software. 38117ca54c3Smrgdnl 38217ca54c3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 38317ca54c3Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 38417ca54c3Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 38517ca54c3Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 38617ca54c3Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 38717ca54c3Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 38817ca54c3Smrgdnl DEALINGS IN THE SOFTWARE. 38917ca54c3Smrg 39017ca54c3Smrg# XORG_MACROS_VERSION(required-version) 39117ca54c3Smrg# ------------------------------------- 39217ca54c3Smrg# Minimum version: 1.1.0 39317ca54c3Smrg# 39417ca54c3Smrg# If you're using a macro added in Version 1.1 or newer, include this in 39517ca54c3Smrg# your configure.ac with the minimum required version, such as: 39617ca54c3Smrg# XORG_MACROS_VERSION(1.1) 39717ca54c3Smrg# 39817ca54c3Smrg# To ensure that this macro is defined, also add: 39917ca54c3Smrg# m4_ifndef([XORG_MACROS_VERSION], 40017ca54c3Smrg# [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])]) 40117ca54c3Smrg# 40217ca54c3Smrg# 40317ca54c3Smrg# See the "minimum version" comment for each macro you use to see what 40417ca54c3Smrg# version you require. 40517ca54c3Smrgm4_defun([XORG_MACROS_VERSION],[ 406ffe57424Smrgm4_define([vers_have], [1.19.3]) 40717ca54c3Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) 40817ca54c3Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) 40917ca54c3Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,, 41017ca54c3Smrg [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])]) 41117ca54c3Smrgm4_if(m4_version_compare(vers_have, [$1]), -1, 41217ca54c3Smrg [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])]) 41317ca54c3Smrgm4_undefine([vers_have]) 41417ca54c3Smrgm4_undefine([maj_have]) 41517ca54c3Smrgm4_undefine([maj_needed]) 41617ca54c3Smrg]) # XORG_MACROS_VERSION 41717ca54c3Smrg 41817ca54c3Smrg# XORG_PROG_RAWCPP() 41917ca54c3Smrg# ------------------ 42017ca54c3Smrg# Minimum version: 1.0.0 42117ca54c3Smrg# 42217ca54c3Smrg# Find cpp program and necessary flags for use in pre-processing text files 42317ca54c3Smrg# such as man pages and config files 42417ca54c3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[ 42517ca54c3SmrgAC_REQUIRE([AC_PROG_CPP]) 426ffe57424SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}], 42717ca54c3Smrg [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib]) 42817ca54c3Smrg 42917ca54c3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined, 43017ca54c3Smrg# which is not the best choice for supporting other OS'es, but covers most 43117ca54c3Smrg# of the ones we need for now. 43217ca54c3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef]) 43317ca54c3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])]) 43417ca54c3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then 43517ca54c3Smrg AC_MSG_RESULT([no]) 43617ca54c3Smrgelse 43717ca54c3Smrg if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then 43817ca54c3Smrg RAWCPPFLAGS=-undef 43917ca54c3Smrg AC_MSG_RESULT([yes]) 44017ca54c3Smrg # under Cygwin unix is still defined even with -undef 44117ca54c3Smrg elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then 44217ca54c3Smrg RAWCPPFLAGS="-undef -ansi" 44317ca54c3Smrg AC_MSG_RESULT([yes, with -ansi]) 44417ca54c3Smrg else 44517ca54c3Smrg AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef. I don't know what to do.]) 44617ca54c3Smrg fi 44717ca54c3Smrgfi 44817ca54c3Smrgrm -f conftest.$ac_ext 44917ca54c3Smrg 45017ca54c3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional]) 45117ca54c3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve "whitespace"?]])]) 45217ca54c3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then 45317ca54c3Smrg AC_MSG_RESULT([no]) 45417ca54c3Smrgelse 45517ca54c3Smrg if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then 45617ca54c3Smrg TRADITIONALCPPFLAGS="-traditional" 45717ca54c3Smrg RAWCPPFLAGS="${RAWCPPFLAGS} -traditional" 45817ca54c3Smrg AC_MSG_RESULT([yes]) 45917ca54c3Smrg else 46017ca54c3Smrg AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional. I don't know what to do.]) 46117ca54c3Smrg fi 46217ca54c3Smrgfi 46317ca54c3Smrgrm -f conftest.$ac_ext 46417ca54c3SmrgAC_SUBST(RAWCPPFLAGS) 46517ca54c3SmrgAC_SUBST(TRADITIONALCPPFLAGS) 46617ca54c3Smrg]) # XORG_PROG_RAWCPP 46717ca54c3Smrg 46817ca54c3Smrg# XORG_MANPAGE_SECTIONS() 46917ca54c3Smrg# ----------------------- 47017ca54c3Smrg# Minimum version: 1.0.0 47117ca54c3Smrg# 47217ca54c3Smrg# Determine which sections man pages go in for the different man page types 47317ca54c3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files. 47417ca54c3Smrg# Not sure if there's any better way than just hardcoding by OS name. 47517ca54c3Smrg# Override default settings by setting environment variables 47617ca54c3Smrg# Added MAN_SUBSTS in version 1.8 47717ca54c3Smrg# Added AC_PROG_SED in version 1.8 47817ca54c3Smrg 47917ca54c3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[ 48017ca54c3SmrgAC_REQUIRE([AC_CANONICAL_HOST]) 48117ca54c3SmrgAC_REQUIRE([AC_PROG_SED]) 48217ca54c3Smrg 483ffe57424Smrgcase $host_os in 484ffe57424Smrg solaris*) 485ffe57424Smrg # Solaris 2.0 - 11.3 use SysV man page section numbers, so we 486ffe57424Smrg # check for a man page file found in later versions that use 487ffe57424Smrg # traditional section numbers instead 488ffe57424Smrg AC_CHECK_FILE([/usr/share/man/man7/attributes.7], 489ffe57424Smrg [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true]) 490ffe57424Smrg ;; 491ffe57424Smrg *) SYSV_MAN_SECTIONS=false ;; 492ffe57424Smrgesac 493ffe57424Smrg 49417ca54c3Smrgif test x$APP_MAN_SUFFIX = x ; then 49517ca54c3Smrg APP_MAN_SUFFIX=1 49617ca54c3Smrgfi 49717ca54c3Smrgif test x$APP_MAN_DIR = x ; then 49817ca54c3Smrg APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)' 49917ca54c3Smrgfi 50017ca54c3Smrg 50117ca54c3Smrgif test x$LIB_MAN_SUFFIX = x ; then 50217ca54c3Smrg LIB_MAN_SUFFIX=3 50317ca54c3Smrgfi 50417ca54c3Smrgif test x$LIB_MAN_DIR = x ; then 50517ca54c3Smrg LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)' 50617ca54c3Smrgfi 50717ca54c3Smrg 50817ca54c3Smrgif test x$FILE_MAN_SUFFIX = x ; then 509ffe57424Smrg case $SYSV_MAN_SECTIONS in 510ffe57424Smrg true) FILE_MAN_SUFFIX=4 ;; 511ffe57424Smrg *) FILE_MAN_SUFFIX=5 ;; 51217ca54c3Smrg esac 51317ca54c3Smrgfi 51417ca54c3Smrgif test x$FILE_MAN_DIR = x ; then 51517ca54c3Smrg FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)' 51617ca54c3Smrgfi 51717ca54c3Smrg 51817ca54c3Smrgif test x$MISC_MAN_SUFFIX = x ; then 519ffe57424Smrg case $SYSV_MAN_SECTIONS in 520ffe57424Smrg true) MISC_MAN_SUFFIX=5 ;; 521ffe57424Smrg *) MISC_MAN_SUFFIX=7 ;; 52217ca54c3Smrg esac 52317ca54c3Smrgfi 52417ca54c3Smrgif test x$MISC_MAN_DIR = x ; then 52517ca54c3Smrg MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)' 52617ca54c3Smrgfi 52717ca54c3Smrg 52817ca54c3Smrgif test x$DRIVER_MAN_SUFFIX = x ; then 529ffe57424Smrg case $SYSV_MAN_SECTIONS in 530ffe57424Smrg true) DRIVER_MAN_SUFFIX=7 ;; 531ffe57424Smrg *) DRIVER_MAN_SUFFIX=4 ;; 53217ca54c3Smrg esac 53317ca54c3Smrgfi 53417ca54c3Smrgif test x$DRIVER_MAN_DIR = x ; then 53517ca54c3Smrg DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)' 53617ca54c3Smrgfi 53717ca54c3Smrg 53817ca54c3Smrgif test x$ADMIN_MAN_SUFFIX = x ; then 539ffe57424Smrg case $SYSV_MAN_SECTIONS in 540ffe57424Smrg true) ADMIN_MAN_SUFFIX=1m ;; 541ffe57424Smrg *) ADMIN_MAN_SUFFIX=8 ;; 54217ca54c3Smrg esac 54317ca54c3Smrgfi 54417ca54c3Smrgif test x$ADMIN_MAN_DIR = x ; then 54517ca54c3Smrg ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)' 54617ca54c3Smrgfi 54717ca54c3Smrg 54817ca54c3Smrg 54917ca54c3SmrgAC_SUBST([APP_MAN_SUFFIX]) 55017ca54c3SmrgAC_SUBST([LIB_MAN_SUFFIX]) 55117ca54c3SmrgAC_SUBST([FILE_MAN_SUFFIX]) 55217ca54c3SmrgAC_SUBST([MISC_MAN_SUFFIX]) 55317ca54c3SmrgAC_SUBST([DRIVER_MAN_SUFFIX]) 55417ca54c3SmrgAC_SUBST([ADMIN_MAN_SUFFIX]) 55517ca54c3SmrgAC_SUBST([APP_MAN_DIR]) 55617ca54c3SmrgAC_SUBST([LIB_MAN_DIR]) 55717ca54c3SmrgAC_SUBST([FILE_MAN_DIR]) 55817ca54c3SmrgAC_SUBST([MISC_MAN_DIR]) 55917ca54c3SmrgAC_SUBST([DRIVER_MAN_DIR]) 56017ca54c3SmrgAC_SUBST([ADMIN_MAN_DIR]) 56117ca54c3Smrg 56217ca54c3SmrgXORG_MAN_PAGE="X Version 11" 56317ca54c3SmrgAC_SUBST([XORG_MAN_PAGE]) 56417ca54c3SmrgMAN_SUBSTS="\ 56517ca54c3Smrg -e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \ 56617ca54c3Smrg -e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \ 56717ca54c3Smrg -e 's|__xservername__|Xorg|g' \ 56817ca54c3Smrg -e 's|__xconfigfile__|xorg.conf|g' \ 56917ca54c3Smrg -e 's|__projectroot__|\$(prefix)|g' \ 57017ca54c3Smrg -e 's|__apploaddir__|\$(appdefaultdir)|g' \ 57117ca54c3Smrg -e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \ 57217ca54c3Smrg -e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \ 57317ca54c3Smrg -e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \ 57417ca54c3Smrg -e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \ 57517ca54c3Smrg -e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \ 57617ca54c3Smrg -e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'" 57717ca54c3SmrgAC_SUBST([MAN_SUBSTS]) 57817ca54c3Smrg 57917ca54c3Smrg]) # XORG_MANPAGE_SECTIONS 58017ca54c3Smrg 58117ca54c3Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION]) 58217ca54c3Smrg# ------------------------ 58317ca54c3Smrg# Minimum version: 1.7.0 58417ca54c3Smrg# 58517ca54c3Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent 58617ca54c3Smrg# provided by xorg-sgml-doctools, if installed. 58717ca54c3SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[ 58817ca54c3SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])]) 58917ca54c3SmrgXORG_SGML_PATH= 59017ca54c3SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])], 59117ca54c3Smrg [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`], 59217ca54c3Smrg [m4_ifval([$1],[:], 59317ca54c3Smrg [if test x"$cross_compiling" != x"yes" ; then 59417ca54c3Smrg AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent], 59517ca54c3Smrg [XORG_SGML_PATH=$prefix/share/sgml]) 59617ca54c3Smrg fi]) 59717ca54c3Smrg ]) 59817ca54c3Smrg 59917ca54c3Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing 60017ca54c3Smrg# the path and the name of the doc stylesheet 60117ca54c3Smrgif test "x$XORG_SGML_PATH" != "x" ; then 60217ca54c3Smrg AC_MSG_RESULT([$XORG_SGML_PATH]) 60317ca54c3Smrg STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11 60417ca54c3Smrg XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl 60517ca54c3Smrgelse 60617ca54c3Smrg AC_MSG_RESULT([no]) 60717ca54c3Smrgfi 60817ca54c3Smrg 60917ca54c3SmrgAC_SUBST(XORG_SGML_PATH) 61017ca54c3SmrgAC_SUBST(STYLESHEET_SRCDIR) 61117ca54c3SmrgAC_SUBST(XSL_STYLESHEET) 61217ca54c3SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"]) 61317ca54c3Smrg]) # XORG_CHECK_SGML_DOCTOOLS 61417ca54c3Smrg 61517ca54c3Smrg# XORG_CHECK_LINUXDOC 61617ca54c3Smrg# ------------------- 61717ca54c3Smrg# Minimum version: 1.0.0 61817ca54c3Smrg# 61917ca54c3Smrg# Defines the variable MAKE_TEXT if the necessary tools and 62017ca54c3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt. 62117ca54c3Smrg# Whether or not the necessary tools and files are found can be checked 62217ca54c3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC" 62317ca54c3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[ 62417ca54c3SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS]) 62517ca54c3SmrgAC_REQUIRE([XORG_WITH_PS2PDF]) 62617ca54c3Smrg 62717ca54c3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc) 62817ca54c3Smrg 62917ca54c3SmrgAC_MSG_CHECKING([whether to build documentation]) 63017ca54c3Smrg 63117ca54c3Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then 63217ca54c3Smrg BUILDDOC=yes 63317ca54c3Smrgelse 63417ca54c3Smrg BUILDDOC=no 63517ca54c3Smrgfi 63617ca54c3Smrg 63717ca54c3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes]) 63817ca54c3Smrg 63917ca54c3SmrgAC_MSG_RESULT([$BUILDDOC]) 64017ca54c3Smrg 64117ca54c3SmrgAC_MSG_CHECKING([whether to build pdf documentation]) 64217ca54c3Smrg 64317ca54c3Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then 64417ca54c3Smrg BUILDPDFDOC=yes 64517ca54c3Smrgelse 64617ca54c3Smrg BUILDPDFDOC=no 64717ca54c3Smrgfi 64817ca54c3Smrg 64917ca54c3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes]) 65017ca54c3Smrg 65117ca54c3SmrgAC_MSG_RESULT([$BUILDPDFDOC]) 65217ca54c3Smrg 65317ca54c3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f" 65417ca54c3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps" 65517ca54c3SmrgMAKE_PDF="$PS2PDF" 65617ca54c3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B html --split=0" 65717ca54c3Smrg 65817ca54c3SmrgAC_SUBST(MAKE_TEXT) 65917ca54c3SmrgAC_SUBST(MAKE_PS) 66017ca54c3SmrgAC_SUBST(MAKE_PDF) 66117ca54c3SmrgAC_SUBST(MAKE_HTML) 66217ca54c3Smrg]) # XORG_CHECK_LINUXDOC 66317ca54c3Smrg 66417ca54c3Smrg# XORG_CHECK_DOCBOOK 66517ca54c3Smrg# ------------------- 66617ca54c3Smrg# Minimum version: 1.0.0 66717ca54c3Smrg# 66817ca54c3Smrg# Checks for the ability to build output formats from SGML DocBook source. 66917ca54c3Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC" 67017ca54c3Smrg# indicates whether the necessary tools and files are found and, if set, 67117ca54c3Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx. 67217ca54c3SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[ 67317ca54c3SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS]) 67417ca54c3Smrg 67517ca54c3SmrgBUILDTXTDOC=no 67617ca54c3SmrgBUILDPDFDOC=no 67717ca54c3SmrgBUILDPSDOC=no 67817ca54c3SmrgBUILDHTMLDOC=no 67917ca54c3Smrg 68017ca54c3SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps) 68117ca54c3SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf) 68217ca54c3SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html) 68317ca54c3SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt) 68417ca54c3Smrg 68517ca54c3SmrgAC_MSG_CHECKING([whether to build text documentation]) 68617ca54c3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x && 68717ca54c3Smrg test x$BUILD_TXTDOC != xno; then 68817ca54c3Smrg BUILDTXTDOC=yes 68917ca54c3Smrgfi 69017ca54c3SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes]) 69117ca54c3SmrgAC_MSG_RESULT([$BUILDTXTDOC]) 69217ca54c3Smrg 69317ca54c3SmrgAC_MSG_CHECKING([whether to build PDF documentation]) 69417ca54c3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x && 69517ca54c3Smrg test x$BUILD_PDFDOC != xno; then 69617ca54c3Smrg BUILDPDFDOC=yes 69717ca54c3Smrgfi 69817ca54c3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes]) 69917ca54c3SmrgAC_MSG_RESULT([$BUILDPDFDOC]) 70017ca54c3Smrg 70117ca54c3SmrgAC_MSG_CHECKING([whether to build PostScript documentation]) 70217ca54c3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x && 70317ca54c3Smrg test x$BUILD_PSDOC != xno; then 70417ca54c3Smrg BUILDPSDOC=yes 70517ca54c3Smrgfi 70617ca54c3SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes]) 70717ca54c3SmrgAC_MSG_RESULT([$BUILDPSDOC]) 70817ca54c3Smrg 70917ca54c3SmrgAC_MSG_CHECKING([whether to build HTML documentation]) 71017ca54c3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x && 71117ca54c3Smrg test x$BUILD_HTMLDOC != xno; then 71217ca54c3Smrg BUILDHTMLDOC=yes 71317ca54c3Smrgfi 71417ca54c3SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes]) 71517ca54c3SmrgAC_MSG_RESULT([$BUILDHTMLDOC]) 71617ca54c3Smrg 71717ca54c3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT" 71817ca54c3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS" 71917ca54c3SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF" 72017ca54c3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML" 72117ca54c3Smrg 72217ca54c3SmrgAC_SUBST(MAKE_TEXT) 72317ca54c3SmrgAC_SUBST(MAKE_PS) 72417ca54c3SmrgAC_SUBST(MAKE_PDF) 72517ca54c3SmrgAC_SUBST(MAKE_HTML) 72617ca54c3Smrg]) # XORG_CHECK_DOCBOOK 72717ca54c3Smrg 72817ca54c3Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT]) 72917ca54c3Smrg# ---------------- 73017ca54c3Smrg# Minimum version: 1.5.0 73117ca54c3Smrg# Minimum version for optional DEFAULT argument: 1.11.0 73217ca54c3Smrg# 73317ca54c3Smrg# Documentation tools are not always available on all platforms and sometimes 73417ca54c3Smrg# not at the appropriate level. This macro enables a module to test for the 73517ca54c3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with 73617ca54c3Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions 73717ca54c3Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified, 73817ca54c3Smrg# --with-xmlto assumes 'auto'. 73917ca54c3Smrg# 74017ca54c3Smrg# Interface to module: 74117ca54c3Smrg# HAVE_XMLTO: used in makefiles to conditionally generate documentation 74217ca54c3Smrg# XMLTO: returns the path of the xmlto program found 74317ca54c3Smrg# returns the path set by the user in the environment 74417ca54c3Smrg# --with-xmlto: 'yes' user instructs the module to use xmlto 74517ca54c3Smrg# 'no' user instructs the module not to use xmlto 74617ca54c3Smrg# 74717ca54c3Smrg# Added in version 1.10.0 74817ca54c3Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation 74917ca54c3Smrg# xmlto for text output requires either lynx, links, or w3m browsers 75017ca54c3Smrg# 75117ca54c3Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path. 75217ca54c3Smrg# 75317ca54c3SmrgAC_DEFUN([XORG_WITH_XMLTO],[ 75417ca54c3SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command]) 75517ca54c3Smrgm4_define([_defopt], m4_default([$2], [auto])) 75617ca54c3SmrgAC_ARG_WITH(xmlto, 75717ca54c3Smrg AS_HELP_STRING([--with-xmlto], 75817ca54c3Smrg [Use xmlto to regenerate documentation (default: ]_defopt[)]), 75917ca54c3Smrg [use_xmlto=$withval], [use_xmlto=]_defopt) 76017ca54c3Smrgm4_undefine([_defopt]) 76117ca54c3Smrg 76217ca54c3Smrgif test "x$use_xmlto" = x"auto"; then 76317ca54c3Smrg AC_PATH_PROG([XMLTO], [xmlto]) 76417ca54c3Smrg if test "x$XMLTO" = "x"; then 76517ca54c3Smrg AC_MSG_WARN([xmlto not found - documentation targets will be skipped]) 76617ca54c3Smrg have_xmlto=no 76717ca54c3Smrg else 76817ca54c3Smrg have_xmlto=yes 76917ca54c3Smrg fi 77017ca54c3Smrgelif test "x$use_xmlto" = x"yes" ; then 77117ca54c3Smrg AC_PATH_PROG([XMLTO], [xmlto]) 77217ca54c3Smrg if test "x$XMLTO" = "x"; then 77317ca54c3Smrg AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH]) 77417ca54c3Smrg fi 77517ca54c3Smrg have_xmlto=yes 77617ca54c3Smrgelif test "x$use_xmlto" = x"no" ; then 77717ca54c3Smrg if test "x$XMLTO" != "x"; then 77817ca54c3Smrg AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified]) 77917ca54c3Smrg fi 78017ca54c3Smrg have_xmlto=no 78117ca54c3Smrgelse 78217ca54c3Smrg AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no']) 78317ca54c3Smrgfi 78417ca54c3Smrg 78517ca54c3Smrg# Test for a minimum version of xmlto, if provided. 78617ca54c3Smrgm4_ifval([$1], 78717ca54c3Smrg[if test "$have_xmlto" = yes; then 78817ca54c3Smrg # scrape the xmlto version 78917ca54c3Smrg AC_MSG_CHECKING([the xmlto version]) 79017ca54c3Smrg xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3` 79117ca54c3Smrg AC_MSG_RESULT([$xmlto_version]) 79217ca54c3Smrg AS_VERSION_COMPARE([$xmlto_version], [$1], 79317ca54c3Smrg [if test "x$use_xmlto" = xauto; then 79417ca54c3Smrg AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed]) 79517ca54c3Smrg have_xmlto=no 79617ca54c3Smrg else 79717ca54c3Smrg AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed]) 79817ca54c3Smrg fi]) 79917ca54c3Smrgfi]) 80017ca54c3Smrg 80117ca54c3Smrg# Test for the ability of xmlto to generate a text target 802ea1d6981Smrg# 803ea1d6981Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the 804ea1d6981Smrg# following test for empty XML docbook files. 805ea1d6981Smrg# For compatibility reasons use the following empty XML docbook file and if 806ea1d6981Smrg# it fails try it again with a non-empty XML file. 80717ca54c3Smrghave_xmlto_text=no 80817ca54c3Smrgcat > conftest.xml << "EOF" 80917ca54c3SmrgEOF 81017ca54c3SmrgAS_IF([test "$have_xmlto" = yes], 81117ca54c3Smrg [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1], 81217ca54c3Smrg [have_xmlto_text=yes], 813ea1d6981Smrg [# Try it again with a non-empty XML file. 814ea1d6981Smrg cat > conftest.xml << "EOF" 815ea1d6981Smrg<x></x> 816ea1d6981SmrgEOF 817ea1d6981Smrg AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1], 818ea1d6981Smrg [have_xmlto_text=yes], 819ea1d6981Smrg [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])]) 82017ca54c3Smrgrm -f conftest.xml 82117ca54c3SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes]) 82217ca54c3SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes]) 82317ca54c3Smrg]) # XORG_WITH_XMLTO 82417ca54c3Smrg 82517ca54c3Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT]) 82617ca54c3Smrg# -------------------------------------------- 82717ca54c3Smrg# Minimum version: 1.12.0 82817ca54c3Smrg# Minimum version for optional DEFAULT argument: 1.12.0 82917ca54c3Smrg# 83017ca54c3Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative, 83117ca54c3Smrg# XML-based language used for the transformation of XML documents. 83217ca54c3Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents. 83317ca54c3Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML. 83417ca54c3Smrg# The XSLT processor is often used as a standalone tool for transformations. 83517ca54c3Smrg# It should not be assumed that this tool is used only to work with documnetation. 83617ca54c3Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'. 83717ca54c3Smrg# 83817ca54c3Smrg# Interface to module: 83917ca54c3Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation 84017ca54c3Smrg# XSLTPROC: returns the path of the xsltproc program found 84117ca54c3Smrg# returns the path set by the user in the environment 84217ca54c3Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc 84317ca54c3Smrg# 'no' user instructs the module not to use xsltproc 84417ca54c3Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no 84517ca54c3Smrg# 84617ca54c3Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path. 84717ca54c3Smrg# 84817ca54c3SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[ 84917ca54c3SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command]) 85017ca54c3Smrg# Preserves the interface, should it be implemented later 85117ca54c3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])]) 85217ca54c3Smrgm4_define([_defopt], m4_default([$2], [auto])) 85317ca54c3SmrgAC_ARG_WITH(xsltproc, 85417ca54c3Smrg AS_HELP_STRING([--with-xsltproc], 85517ca54c3Smrg [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]), 85617ca54c3Smrg [use_xsltproc=$withval], [use_xsltproc=]_defopt) 85717ca54c3Smrgm4_undefine([_defopt]) 85817ca54c3Smrg 85917ca54c3Smrgif test "x$use_xsltproc" = x"auto"; then 86017ca54c3Smrg AC_PATH_PROG([XSLTPROC], [xsltproc]) 86117ca54c3Smrg if test "x$XSLTPROC" = "x"; then 86217ca54c3Smrg AC_MSG_WARN([xsltproc not found - cannot transform XML documents]) 86317ca54c3Smrg have_xsltproc=no 86417ca54c3Smrg else 86517ca54c3Smrg have_xsltproc=yes 86617ca54c3Smrg fi 86717ca54c3Smrgelif test "x$use_xsltproc" = x"yes" ; then 86817ca54c3Smrg AC_PATH_PROG([XSLTPROC], [xsltproc]) 86917ca54c3Smrg if test "x$XSLTPROC" = "x"; then 87017ca54c3Smrg AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH]) 87117ca54c3Smrg fi 87217ca54c3Smrg have_xsltproc=yes 87317ca54c3Smrgelif test "x$use_xsltproc" = x"no" ; then 87417ca54c3Smrg if test "x$XSLTPROC" != "x"; then 87517ca54c3Smrg AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified]) 87617ca54c3Smrg fi 87717ca54c3Smrg have_xsltproc=no 87817ca54c3Smrgelse 87917ca54c3Smrg AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no']) 88017ca54c3Smrgfi 88117ca54c3Smrg 88217ca54c3SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes]) 88317ca54c3Smrg]) # XORG_WITH_XSLTPROC 88417ca54c3Smrg 88517ca54c3Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT]) 88617ca54c3Smrg# ---------------------------------------- 88717ca54c3Smrg# Minimum version: 1.15.0 88817ca54c3Smrg# 88917ca54c3Smrg# PERL (Practical Extraction and Report Language) is a language optimized for 89017ca54c3Smrg# scanning arbitrary text files, extracting information from those text files, 89117ca54c3Smrg# and printing reports based on that information. 89217ca54c3Smrg# 89317ca54c3Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'. 89417ca54c3Smrg# 89517ca54c3Smrg# Interface to module: 89617ca54c3Smrg# HAVE_PERL: used in makefiles to conditionally scan text files 89717ca54c3Smrg# PERL: returns the path of the perl program found 89817ca54c3Smrg# returns the path set by the user in the environment 89917ca54c3Smrg# --with-perl: 'yes' user instructs the module to use perl 90017ca54c3Smrg# 'no' user instructs the module not to use perl 90117ca54c3Smrg# have_perl: returns yes if perl found in PATH or no 90217ca54c3Smrg# 90317ca54c3Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path. 90417ca54c3Smrg# 90517ca54c3SmrgAC_DEFUN([XORG_WITH_PERL],[ 90617ca54c3SmrgAC_ARG_VAR([PERL], [Path to perl command]) 90717ca54c3Smrg# Preserves the interface, should it be implemented later 90817ca54c3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])]) 90917ca54c3Smrgm4_define([_defopt], m4_default([$2], [auto])) 91017ca54c3SmrgAC_ARG_WITH(perl, 91117ca54c3Smrg AS_HELP_STRING([--with-perl], 91217ca54c3Smrg [Use perl for extracting information from files (default: ]_defopt[)]), 91317ca54c3Smrg [use_perl=$withval], [use_perl=]_defopt) 91417ca54c3Smrgm4_undefine([_defopt]) 91517ca54c3Smrg 91617ca54c3Smrgif test "x$use_perl" = x"auto"; then 91717ca54c3Smrg AC_PATH_PROG([PERL], [perl]) 91817ca54c3Smrg if test "x$PERL" = "x"; then 91917ca54c3Smrg AC_MSG_WARN([perl not found - cannot extract information and report]) 92017ca54c3Smrg have_perl=no 92117ca54c3Smrg else 92217ca54c3Smrg have_perl=yes 92317ca54c3Smrg fi 92417ca54c3Smrgelif test "x$use_perl" = x"yes" ; then 92517ca54c3Smrg AC_PATH_PROG([PERL], [perl]) 92617ca54c3Smrg if test "x$PERL" = "x"; then 92717ca54c3Smrg AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH]) 92817ca54c3Smrg fi 92917ca54c3Smrg have_perl=yes 93017ca54c3Smrgelif test "x$use_perl" = x"no" ; then 93117ca54c3Smrg if test "x$PERL" != "x"; then 93217ca54c3Smrg AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified]) 93317ca54c3Smrg fi 93417ca54c3Smrg have_perl=no 93517ca54c3Smrgelse 93617ca54c3Smrg AC_MSG_ERROR([--with-perl expects 'yes' or 'no']) 93717ca54c3Smrgfi 93817ca54c3Smrg 93917ca54c3SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes]) 94017ca54c3Smrg]) # XORG_WITH_PERL 94117ca54c3Smrg 94217ca54c3Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT]) 94317ca54c3Smrg# ---------------- 94417ca54c3Smrg# Minimum version: 1.5.0 94517ca54c3Smrg# Minimum version for optional DEFAULT argument: 1.11.0 94617ca54c3Smrg# 94717ca54c3Smrg# Documentation tools are not always available on all platforms and sometimes 94817ca54c3Smrg# not at the appropriate level. This macro enables a module to test for the 94917ca54c3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with 95017ca54c3Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions 95117ca54c3Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified, 95217ca54c3Smrg# --with-asciidoc assumes 'auto'. 95317ca54c3Smrg# 95417ca54c3Smrg# Interface to module: 95517ca54c3Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation 95617ca54c3Smrg# ASCIIDOC: returns the path of the asciidoc program found 95717ca54c3Smrg# returns the path set by the user in the environment 95817ca54c3Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc 95917ca54c3Smrg# 'no' user instructs the module not to use asciidoc 96017ca54c3Smrg# 96117ca54c3Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path. 96217ca54c3Smrg# 96317ca54c3SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[ 96417ca54c3SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command]) 96517ca54c3Smrgm4_define([_defopt], m4_default([$2], [auto])) 96617ca54c3SmrgAC_ARG_WITH(asciidoc, 96717ca54c3Smrg AS_HELP_STRING([--with-asciidoc], 96817ca54c3Smrg [Use asciidoc to regenerate documentation (default: ]_defopt[)]), 96917ca54c3Smrg [use_asciidoc=$withval], [use_asciidoc=]_defopt) 97017ca54c3Smrgm4_undefine([_defopt]) 97117ca54c3Smrg 97217ca54c3Smrgif test "x$use_asciidoc" = x"auto"; then 97317ca54c3Smrg AC_PATH_PROG([ASCIIDOC], [asciidoc]) 97417ca54c3Smrg if test "x$ASCIIDOC" = "x"; then 97517ca54c3Smrg AC_MSG_WARN([asciidoc not found - documentation targets will be skipped]) 97617ca54c3Smrg have_asciidoc=no 97717ca54c3Smrg else 97817ca54c3Smrg have_asciidoc=yes 97917ca54c3Smrg fi 98017ca54c3Smrgelif test "x$use_asciidoc" = x"yes" ; then 98117ca54c3Smrg AC_PATH_PROG([ASCIIDOC], [asciidoc]) 98217ca54c3Smrg if test "x$ASCIIDOC" = "x"; then 98317ca54c3Smrg AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH]) 98417ca54c3Smrg fi 98517ca54c3Smrg have_asciidoc=yes 98617ca54c3Smrgelif test "x$use_asciidoc" = x"no" ; then 98717ca54c3Smrg if test "x$ASCIIDOC" != "x"; then 98817ca54c3Smrg AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified]) 98917ca54c3Smrg fi 99017ca54c3Smrg have_asciidoc=no 99117ca54c3Smrgelse 99217ca54c3Smrg AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no']) 99317ca54c3Smrgfi 99417ca54c3Smrgm4_ifval([$1], 99517ca54c3Smrg[if test "$have_asciidoc" = yes; then 99617ca54c3Smrg # scrape the asciidoc version 99717ca54c3Smrg AC_MSG_CHECKING([the asciidoc version]) 99817ca54c3Smrg asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2` 99917ca54c3Smrg AC_MSG_RESULT([$asciidoc_version]) 100017ca54c3Smrg AS_VERSION_COMPARE([$asciidoc_version], [$1], 100117ca54c3Smrg [if test "x$use_asciidoc" = xauto; then 100217ca54c3Smrg AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed]) 100317ca54c3Smrg have_asciidoc=no 100417ca54c3Smrg else 100517ca54c3Smrg AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed]) 100617ca54c3Smrg fi]) 100717ca54c3Smrgfi]) 100817ca54c3SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes]) 100917ca54c3Smrg]) # XORG_WITH_ASCIIDOC 101017ca54c3Smrg 101117ca54c3Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT]) 101217ca54c3Smrg# ------------------------------------------- 101317ca54c3Smrg# Minimum version: 1.5.0 101417ca54c3Smrg# Minimum version for optional DEFAULT argument: 1.11.0 101517ca54c3Smrg# Minimum version for optional DOT checking: 1.18.0 101617ca54c3Smrg# 101717ca54c3Smrg# Documentation tools are not always available on all platforms and sometimes 101817ca54c3Smrg# not at the appropriate level. This macro enables a module to test for the 101917ca54c3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with 102017ca54c3Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions 102117ca54c3Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified, 102217ca54c3Smrg# --with-doxygen assumes 'auto'. 102317ca54c3Smrg# 102417ca54c3Smrg# Interface to module: 102517ca54c3Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation 102617ca54c3Smrg# DOXYGEN: returns the path of the doxygen program found 102717ca54c3Smrg# returns the path set by the user in the environment 102817ca54c3Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen 102917ca54c3Smrg# 'no' user instructs the module not to use doxygen 103017ca54c3Smrg# 103117ca54c3Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path. 103217ca54c3Smrg# 103317ca54c3SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[ 103417ca54c3SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command]) 103517ca54c3SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility]) 103617ca54c3Smrgm4_define([_defopt], m4_default([$2], [auto])) 103717ca54c3SmrgAC_ARG_WITH(doxygen, 103817ca54c3Smrg AS_HELP_STRING([--with-doxygen], 103917ca54c3Smrg [Use doxygen to regenerate documentation (default: ]_defopt[)]), 104017ca54c3Smrg [use_doxygen=$withval], [use_doxygen=]_defopt) 104117ca54c3Smrgm4_undefine([_defopt]) 104217ca54c3Smrg 104317ca54c3Smrgif test "x$use_doxygen" = x"auto"; then 104417ca54c3Smrg AC_PATH_PROG([DOXYGEN], [doxygen]) 104517ca54c3Smrg if test "x$DOXYGEN" = "x"; then 104617ca54c3Smrg AC_MSG_WARN([doxygen not found - documentation targets will be skipped]) 104717ca54c3Smrg have_doxygen=no 104817ca54c3Smrg else 104917ca54c3Smrg have_doxygen=yes 105017ca54c3Smrg fi 105117ca54c3Smrgelif test "x$use_doxygen" = x"yes" ; then 105217ca54c3Smrg AC_PATH_PROG([DOXYGEN], [doxygen]) 105317ca54c3Smrg if test "x$DOXYGEN" = "x"; then 105417ca54c3Smrg AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH]) 105517ca54c3Smrg fi 105617ca54c3Smrg have_doxygen=yes 105717ca54c3Smrgelif test "x$use_doxygen" = x"no" ; then 105817ca54c3Smrg if test "x$DOXYGEN" != "x"; then 105917ca54c3Smrg AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified]) 106017ca54c3Smrg fi 106117ca54c3Smrg have_doxygen=no 106217ca54c3Smrgelse 106317ca54c3Smrg AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no']) 106417ca54c3Smrgfi 106517ca54c3Smrgm4_ifval([$1], 106617ca54c3Smrg[if test "$have_doxygen" = yes; then 106717ca54c3Smrg # scrape the doxygen version 106817ca54c3Smrg AC_MSG_CHECKING([the doxygen version]) 106917ca54c3Smrg doxygen_version=`$DOXYGEN --version 2>/dev/null` 107017ca54c3Smrg AC_MSG_RESULT([$doxygen_version]) 107117ca54c3Smrg AS_VERSION_COMPARE([$doxygen_version], [$1], 107217ca54c3Smrg [if test "x$use_doxygen" = xauto; then 107317ca54c3Smrg AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed]) 107417ca54c3Smrg have_doxygen=no 107517ca54c3Smrg else 107617ca54c3Smrg AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed]) 107717ca54c3Smrg fi]) 107817ca54c3Smrgfi]) 107917ca54c3Smrg 108017ca54c3Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory 108117ca54c3Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file: 108217ca54c3Smrgdnl HAVE_DOT = @HAVE_DOT@ 108317ca54c3SmrgHAVE_DOT=no 108417ca54c3Smrgif test "x$have_doxygen" = "xyes"; then 108517ca54c3Smrg AC_PATH_PROG([DOT], [dot]) 108617ca54c3Smrg if test "x$DOT" != "x"; then 108717ca54c3Smrg HAVE_DOT=yes 108817ca54c3Smrg fi 108917ca54c3Smrgfi 109017ca54c3Smrg 109117ca54c3SmrgAC_SUBST([HAVE_DOT]) 109217ca54c3SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"]) 109317ca54c3SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes]) 109417ca54c3Smrg]) # XORG_WITH_DOXYGEN 109517ca54c3Smrg 109617ca54c3Smrg# XORG_WITH_GROFF([DEFAULT]) 109717ca54c3Smrg# ---------------- 109817ca54c3Smrg# Minimum version: 1.6.0 109917ca54c3Smrg# Minimum version for optional DEFAULT argument: 1.11.0 110017ca54c3Smrg# 110117ca54c3Smrg# Documentation tools are not always available on all platforms and sometimes 110217ca54c3Smrg# not at the appropriate level. This macro enables a module to test for the 110317ca54c3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with 110417ca54c3Smrg# the --with-groff option, it allows maximum flexibilty in making decisions 110517ca54c3Smrg# as whether or not to use the groff package. When DEFAULT is not specified, 110617ca54c3Smrg# --with-groff assumes 'auto'. 110717ca54c3Smrg# 110817ca54c3Smrg# Interface to module: 110917ca54c3Smrg# HAVE_GROFF: used in makefiles to conditionally generate documentation 111017ca54c3Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package 111117ca54c3Smrg# HAVE_GROFF_MS: the -ms macros package 111217ca54c3Smrg# GROFF: returns the path of the groff program found 111317ca54c3Smrg# returns the path set by the user in the environment 111417ca54c3Smrg# --with-groff: 'yes' user instructs the module to use groff 111517ca54c3Smrg# 'no' user instructs the module not to use groff 111617ca54c3Smrg# 111717ca54c3Smrg# Added in version 1.9.0: 111817ca54c3Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format: 111917ca54c3Smrg# pnmcut pnmcrop pnmtopng pnmtops from the netpbm package. 112017ca54c3Smrg# psselect from the psutils package. 112117ca54c3Smrg# the ghostcript package. Refer to the grohtml man pages 112217ca54c3Smrg# 112317ca54c3Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path. 112417ca54c3Smrg# 112517ca54c3Smrg# OS and distros often splits groff in a basic and full package, the former 112617ca54c3Smrg# having the groff program and the later having devices, fonts and macros 112717ca54c3Smrg# Checking for the groff executable is not enough. 112817ca54c3Smrg# 112917ca54c3Smrg# If macros are missing, we cannot assume that groff is useless, so we don't 113017ca54c3Smrg# unset HAVE_GROFF or GROFF env variables. 113117ca54c3Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false. 113217ca54c3Smrg# 113317ca54c3SmrgAC_DEFUN([XORG_WITH_GROFF],[ 113417ca54c3SmrgAC_ARG_VAR([GROFF], [Path to groff command]) 113517ca54c3Smrgm4_define([_defopt], m4_default([$1], [auto])) 113617ca54c3SmrgAC_ARG_WITH(groff, 113717ca54c3Smrg AS_HELP_STRING([--with-groff], 113817ca54c3Smrg [Use groff to regenerate documentation (default: ]_defopt[)]), 113917ca54c3Smrg [use_groff=$withval], [use_groff=]_defopt) 114017ca54c3Smrgm4_undefine([_defopt]) 114117ca54c3Smrg 114217ca54c3Smrgif test "x$use_groff" = x"auto"; then 114317ca54c3Smrg AC_PATH_PROG([GROFF], [groff]) 114417ca54c3Smrg if test "x$GROFF" = "x"; then 114517ca54c3Smrg AC_MSG_WARN([groff not found - documentation targets will be skipped]) 114617ca54c3Smrg have_groff=no 114717ca54c3Smrg else 114817ca54c3Smrg have_groff=yes 114917ca54c3Smrg fi 115017ca54c3Smrgelif test "x$use_groff" = x"yes" ; then 115117ca54c3Smrg AC_PATH_PROG([GROFF], [groff]) 115217ca54c3Smrg if test "x$GROFF" = "x"; then 115317ca54c3Smrg AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH]) 115417ca54c3Smrg fi 115517ca54c3Smrg have_groff=yes 115617ca54c3Smrgelif test "x$use_groff" = x"no" ; then 115717ca54c3Smrg if test "x$GROFF" != "x"; then 115817ca54c3Smrg AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified]) 115917ca54c3Smrg fi 116017ca54c3Smrg have_groff=no 116117ca54c3Smrgelse 116217ca54c3Smrg AC_MSG_ERROR([--with-groff expects 'yes' or 'no']) 116317ca54c3Smrgfi 116417ca54c3Smrg 116517ca54c3Smrg# We have groff, test for the presence of the macro packages 116617ca54c3Smrgif test "x$have_groff" = x"yes"; then 116717ca54c3Smrg AC_MSG_CHECKING([for ${GROFF} -ms macros]) 116817ca54c3Smrg if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then 116917ca54c3Smrg groff_ms_works=yes 117017ca54c3Smrg else 117117ca54c3Smrg groff_ms_works=no 117217ca54c3Smrg fi 117317ca54c3Smrg AC_MSG_RESULT([$groff_ms_works]) 117417ca54c3Smrg AC_MSG_CHECKING([for ${GROFF} -mm macros]) 117517ca54c3Smrg if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then 117617ca54c3Smrg groff_mm_works=yes 117717ca54c3Smrg else 117817ca54c3Smrg groff_mm_works=no 117917ca54c3Smrg fi 118017ca54c3Smrg AC_MSG_RESULT([$groff_mm_works]) 118117ca54c3Smrgfi 118217ca54c3Smrg 118317ca54c3Smrg# We have groff, test for HTML dependencies, one command per package 118417ca54c3Smrgif test "x$have_groff" = x"yes"; then 118517ca54c3Smrg AC_PATH_PROGS(GS_PATH, [gs gswin32c]) 118617ca54c3Smrg AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng]) 118717ca54c3Smrg AC_PATH_PROG(PSSELECT_PATH, [psselect]) 118817ca54c3Smrg if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then 118917ca54c3Smrg have_groff_html=yes 119017ca54c3Smrg else 119117ca54c3Smrg have_groff_html=no 119217ca54c3Smrg AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages]) 119317ca54c3Smrg fi 119417ca54c3Smrgfi 119517ca54c3Smrg 119617ca54c3Smrg# Set Automake conditionals for Makefiles 119717ca54c3SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes]) 119817ca54c3SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes]) 119917ca54c3SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes]) 120017ca54c3SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes]) 120117ca54c3Smrg]) # XORG_WITH_GROFF 120217ca54c3Smrg 120317ca54c3Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT]) 120417ca54c3Smrg# --------------------------------------- 120517ca54c3Smrg# Minimum version: 1.6.0 120617ca54c3Smrg# Minimum version for optional DEFAULT argument: 1.11.0 120717ca54c3Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0 120817ca54c3Smrg# 120917ca54c3Smrg# Documentation tools are not always available on all platforms and sometimes 121017ca54c3Smrg# not at the appropriate level. This macro enables a module to test for the 121117ca54c3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with 121217ca54c3Smrg# the --with-fop option, it allows maximum flexibilty in making decisions 121317ca54c3Smrg# as whether or not to use the fop package. When DEFAULT is not specified, 121417ca54c3Smrg# --with-fop assumes 'auto'. 121517ca54c3Smrg# 121617ca54c3Smrg# Interface to module: 121717ca54c3Smrg# HAVE_FOP: used in makefiles to conditionally generate documentation 121817ca54c3Smrg# FOP: returns the path of the fop program found 121917ca54c3Smrg# returns the path set by the user in the environment 122017ca54c3Smrg# --with-fop: 'yes' user instructs the module to use fop 122117ca54c3Smrg# 'no' user instructs the module not to use fop 122217ca54c3Smrg# 122317ca54c3Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path. 122417ca54c3Smrg# 122517ca54c3SmrgAC_DEFUN([XORG_WITH_FOP],[ 122617ca54c3SmrgAC_ARG_VAR([FOP], [Path to fop command]) 122717ca54c3Smrgm4_define([_defopt], m4_default([$2], [auto])) 122817ca54c3SmrgAC_ARG_WITH(fop, 122917ca54c3Smrg AS_HELP_STRING([--with-fop], 123017ca54c3Smrg [Use fop to regenerate documentation (default: ]_defopt[)]), 123117ca54c3Smrg [use_fop=$withval], [use_fop=]_defopt) 123217ca54c3Smrgm4_undefine([_defopt]) 123317ca54c3Smrg 123417ca54c3Smrgif test "x$use_fop" = x"auto"; then 123517ca54c3Smrg AC_PATH_PROG([FOP], [fop]) 123617ca54c3Smrg if test "x$FOP" = "x"; then 123717ca54c3Smrg AC_MSG_WARN([fop not found - documentation targets will be skipped]) 123817ca54c3Smrg have_fop=no 123917ca54c3Smrg else 124017ca54c3Smrg have_fop=yes 124117ca54c3Smrg fi 124217ca54c3Smrgelif test "x$use_fop" = x"yes" ; then 124317ca54c3Smrg AC_PATH_PROG([FOP], [fop]) 124417ca54c3Smrg if test "x$FOP" = "x"; then 124517ca54c3Smrg AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH]) 124617ca54c3Smrg fi 124717ca54c3Smrg have_fop=yes 124817ca54c3Smrgelif test "x$use_fop" = x"no" ; then 124917ca54c3Smrg if test "x$FOP" != "x"; then 125017ca54c3Smrg AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified]) 125117ca54c3Smrg fi 125217ca54c3Smrg have_fop=no 125317ca54c3Smrgelse 125417ca54c3Smrg AC_MSG_ERROR([--with-fop expects 'yes' or 'no']) 125517ca54c3Smrgfi 125617ca54c3Smrg 125717ca54c3Smrg# Test for a minimum version of fop, if provided. 125817ca54c3Smrgm4_ifval([$1], 125917ca54c3Smrg[if test "$have_fop" = yes; then 126017ca54c3Smrg # scrape the fop version 126117ca54c3Smrg AC_MSG_CHECKING([for fop minimum version]) 126217ca54c3Smrg fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3` 126317ca54c3Smrg AC_MSG_RESULT([$fop_version]) 126417ca54c3Smrg AS_VERSION_COMPARE([$fop_version], [$1], 126517ca54c3Smrg [if test "x$use_fop" = xauto; then 126617ca54c3Smrg AC_MSG_WARN([fop version $fop_version found, but $1 needed]) 126717ca54c3Smrg have_fop=no 126817ca54c3Smrg else 126917ca54c3Smrg AC_MSG_ERROR([fop version $fop_version found, but $1 needed]) 127017ca54c3Smrg fi]) 127117ca54c3Smrgfi]) 127217ca54c3SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes]) 127317ca54c3Smrg]) # XORG_WITH_FOP 127417ca54c3Smrg 127517ca54c3Smrg# XORG_WITH_M4([MIN-VERSION]) 127617ca54c3Smrg# --------------------------- 127717ca54c3Smrg# Minimum version: 1.19.0 127817ca54c3Smrg# 127917ca54c3Smrg# This macro attempts to locate an m4 macro processor which supports 128017ca54c3Smrg# -I option and is only useful for modules relying on M4 in order to 128117ca54c3Smrg# expand macros in source code files. 128217ca54c3Smrg# 128317ca54c3Smrg# Interface to module: 128417ca54c3Smrg# M4: returns the path of the m4 program found 128517ca54c3Smrg# returns the path set by the user in the environment 128617ca54c3Smrg# 128717ca54c3SmrgAC_DEFUN([XORG_WITH_M4], [ 128817ca54c3SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4], 128917ca54c3Smrg [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4], 129017ca54c3Smrg [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \ 129117ca54c3Smrg ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]], 129217ca54c3Smrg [AC_MSG_ERROR([could not find m4 that supports -I option])], 129317ca54c3Smrg [$PATH:/usr/gnu/bin])]) 129417ca54c3Smrg 129517ca54c3SmrgAC_SUBST([M4], [$ac_cv_path_M4]) 129617ca54c3Smrg]) # XORG_WITH_M4 129717ca54c3Smrg 129817ca54c3Smrg# XORG_WITH_PS2PDF([DEFAULT]) 129917ca54c3Smrg# ---------------- 130017ca54c3Smrg# Minimum version: 1.6.0 130117ca54c3Smrg# Minimum version for optional DEFAULT argument: 1.11.0 130217ca54c3Smrg# 130317ca54c3Smrg# Documentation tools are not always available on all platforms and sometimes 130417ca54c3Smrg# not at the appropriate level. This macro enables a module to test for the 130517ca54c3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with 130617ca54c3Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions 130717ca54c3Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified, 130817ca54c3Smrg# --with-ps2pdf assumes 'auto'. 130917ca54c3Smrg# 131017ca54c3Smrg# Interface to module: 131117ca54c3Smrg# HAVE_PS2PDF: used in makefiles to conditionally generate documentation 131217ca54c3Smrg# PS2PDF: returns the path of the ps2pdf program found 131317ca54c3Smrg# returns the path set by the user in the environment 131417ca54c3Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf 131517ca54c3Smrg# 'no' user instructs the module not to use ps2pdf 131617ca54c3Smrg# 131717ca54c3Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path. 131817ca54c3Smrg# 131917ca54c3SmrgAC_DEFUN([XORG_WITH_PS2PDF],[ 132017ca54c3SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command]) 132117ca54c3Smrgm4_define([_defopt], m4_default([$1], [auto])) 132217ca54c3SmrgAC_ARG_WITH(ps2pdf, 132317ca54c3Smrg AS_HELP_STRING([--with-ps2pdf], 132417ca54c3Smrg [Use ps2pdf to regenerate documentation (default: ]_defopt[)]), 132517ca54c3Smrg [use_ps2pdf=$withval], [use_ps2pdf=]_defopt) 132617ca54c3Smrgm4_undefine([_defopt]) 132717ca54c3Smrg 132817ca54c3Smrgif test "x$use_ps2pdf" = x"auto"; then 132917ca54c3Smrg AC_PATH_PROG([PS2PDF], [ps2pdf]) 133017ca54c3Smrg if test "x$PS2PDF" = "x"; then 133117ca54c3Smrg AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped]) 133217ca54c3Smrg have_ps2pdf=no 133317ca54c3Smrg else 133417ca54c3Smrg have_ps2pdf=yes 133517ca54c3Smrg fi 133617ca54c3Smrgelif test "x$use_ps2pdf" = x"yes" ; then 133717ca54c3Smrg AC_PATH_PROG([PS2PDF], [ps2pdf]) 133817ca54c3Smrg if test "x$PS2PDF" = "x"; then 133917ca54c3Smrg AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH]) 134017ca54c3Smrg fi 134117ca54c3Smrg have_ps2pdf=yes 134217ca54c3Smrgelif test "x$use_ps2pdf" = x"no" ; then 134317ca54c3Smrg if test "x$PS2PDF" != "x"; then 134417ca54c3Smrg AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified]) 134517ca54c3Smrg fi 134617ca54c3Smrg have_ps2pdf=no 134717ca54c3Smrgelse 134817ca54c3Smrg AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no']) 134917ca54c3Smrgfi 135017ca54c3SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes]) 135117ca54c3Smrg]) # XORG_WITH_PS2PDF 135217ca54c3Smrg 135317ca54c3Smrg# XORG_ENABLE_DOCS (enable_docs=yes) 135417ca54c3Smrg# ---------------- 135517ca54c3Smrg# Minimum version: 1.6.0 135617ca54c3Smrg# 135717ca54c3Smrg# Documentation tools are not always available on all platforms and sometimes 135817ca54c3Smrg# not at the appropriate level. This macro enables a builder to skip all 135917ca54c3Smrg# documentation targets except traditional man pages. 136017ca54c3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides 136117ca54c3Smrg# maximum flexibilty in controlling documentation building. 136217ca54c3Smrg# Refer to: 136317ca54c3Smrg# XORG_WITH_XMLTO --with-xmlto 136417ca54c3Smrg# XORG_WITH_ASCIIDOC --with-asciidoc 136517ca54c3Smrg# XORG_WITH_DOXYGEN --with-doxygen 136617ca54c3Smrg# XORG_WITH_FOP --with-fop 136717ca54c3Smrg# XORG_WITH_GROFF --with-groff 136817ca54c3Smrg# XORG_WITH_PS2PDF --with-ps2pdf 136917ca54c3Smrg# 137017ca54c3Smrg# Interface to module: 137117ca54c3Smrg# ENABLE_DOCS: used in makefiles to conditionally generate documentation 137217ca54c3Smrg# --enable-docs: 'yes' user instructs the module to generate docs 137317ca54c3Smrg# 'no' user instructs the module not to generate docs 137417ca54c3Smrg# parm1: specify the default value, yes or no. 137517ca54c3Smrg# 137617ca54c3SmrgAC_DEFUN([XORG_ENABLE_DOCS],[ 137717ca54c3Smrgm4_define([docs_default], m4_default([$1], [yes])) 137817ca54c3SmrgAC_ARG_ENABLE(docs, 137917ca54c3Smrg AS_HELP_STRING([--enable-docs], 138017ca54c3Smrg [Enable building the documentation (default: ]docs_default[)]), 138117ca54c3Smrg [build_docs=$enableval], [build_docs=]docs_default) 138217ca54c3Smrgm4_undefine([docs_default]) 138317ca54c3SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes]) 138417ca54c3SmrgAC_MSG_CHECKING([whether to build documentation]) 138517ca54c3SmrgAC_MSG_RESULT([$build_docs]) 138617ca54c3Smrg]) # XORG_ENABLE_DOCS 138717ca54c3Smrg 138817ca54c3Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes) 138917ca54c3Smrg# ---------------- 139017ca54c3Smrg# Minimum version: 1.6.0 139117ca54c3Smrg# 139217ca54c3Smrg# This macro enables a builder to skip all developer documentation. 139317ca54c3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides 139417ca54c3Smrg# maximum flexibilty in controlling documentation building. 139517ca54c3Smrg# Refer to: 139617ca54c3Smrg# XORG_WITH_XMLTO --with-xmlto 139717ca54c3Smrg# XORG_WITH_ASCIIDOC --with-asciidoc 139817ca54c3Smrg# XORG_WITH_DOXYGEN --with-doxygen 139917ca54c3Smrg# XORG_WITH_FOP --with-fop 140017ca54c3Smrg# XORG_WITH_GROFF --with-groff 140117ca54c3Smrg# XORG_WITH_PS2PDF --with-ps2pdf 140217ca54c3Smrg# 140317ca54c3Smrg# Interface to module: 140417ca54c3Smrg# ENABLE_DEVEL_DOCS: used in makefiles to conditionally generate developer docs 140517ca54c3Smrg# --enable-devel-docs: 'yes' user instructs the module to generate developer docs 140617ca54c3Smrg# 'no' user instructs the module not to generate developer docs 140717ca54c3Smrg# parm1: specify the default value, yes or no. 140817ca54c3Smrg# 140917ca54c3SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[ 141017ca54c3Smrgm4_define([devel_default], m4_default([$1], [yes])) 141117ca54c3SmrgAC_ARG_ENABLE(devel-docs, 141217ca54c3Smrg AS_HELP_STRING([--enable-devel-docs], 141317ca54c3Smrg [Enable building the developer documentation (default: ]devel_default[)]), 141417ca54c3Smrg [build_devel_docs=$enableval], [build_devel_docs=]devel_default) 141517ca54c3Smrgm4_undefine([devel_default]) 141617ca54c3SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes]) 141717ca54c3SmrgAC_MSG_CHECKING([whether to build developer documentation]) 141817ca54c3SmrgAC_MSG_RESULT([$build_devel_docs]) 141917ca54c3Smrg]) # XORG_ENABLE_DEVEL_DOCS 142017ca54c3Smrg 142117ca54c3Smrg# XORG_ENABLE_SPECS (enable_specs=yes) 142217ca54c3Smrg# ---------------- 142317ca54c3Smrg# Minimum version: 1.6.0 142417ca54c3Smrg# 142517ca54c3Smrg# This macro enables a builder to skip all functional specification targets. 142617ca54c3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides 142717ca54c3Smrg# maximum flexibilty in controlling documentation building. 142817ca54c3Smrg# Refer to: 142917ca54c3Smrg# XORG_WITH_XMLTO --with-xmlto 143017ca54c3Smrg# XORG_WITH_ASCIIDOC --with-asciidoc 143117ca54c3Smrg# XORG_WITH_DOXYGEN --with-doxygen 143217ca54c3Smrg# XORG_WITH_FOP --with-fop 143317ca54c3Smrg# XORG_WITH_GROFF --with-groff 143417ca54c3Smrg# XORG_WITH_PS2PDF --with-ps2pdf 143517ca54c3Smrg# 143617ca54c3Smrg# Interface to module: 143717ca54c3Smrg# ENABLE_SPECS: used in makefiles to conditionally generate specs 143817ca54c3Smrg# --enable-specs: 'yes' user instructs the module to generate specs 143917ca54c3Smrg# 'no' user instructs the module not to generate specs 144017ca54c3Smrg# parm1: specify the default value, yes or no. 144117ca54c3Smrg# 144217ca54c3SmrgAC_DEFUN([XORG_ENABLE_SPECS],[ 144317ca54c3Smrgm4_define([spec_default], m4_default([$1], [yes])) 144417ca54c3SmrgAC_ARG_ENABLE(specs, 144517ca54c3Smrg AS_HELP_STRING([--enable-specs], 144617ca54c3Smrg [Enable building the specs (default: ]spec_default[)]), 144717ca54c3Smrg [build_specs=$enableval], [build_specs=]spec_default) 144817ca54c3Smrgm4_undefine([spec_default]) 144917ca54c3SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes]) 145017ca54c3SmrgAC_MSG_CHECKING([whether to build functional specifications]) 145117ca54c3SmrgAC_MSG_RESULT([$build_specs]) 145217ca54c3Smrg]) # XORG_ENABLE_SPECS 145317ca54c3Smrg 145417ca54c3Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto) 145517ca54c3Smrg# ---------------------------------------------- 145617ca54c3Smrg# Minimum version: 1.13.0 145717ca54c3Smrg# 145817ca54c3Smrg# This macro enables a builder to enable/disable unit testing 145917ca54c3Smrg# It makes no assumption about the test cases implementation 146017ca54c3Smrg# Test cases may or may not use Automake "Support for test suites" 146117ca54c3Smrg# They may or may not use the software utility library GLib 146217ca54c3Smrg# 146317ca54c3Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL 146417ca54c3Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib. 146517ca54c3Smrg# The variable enable_unit_tests is used by other macros in this file. 146617ca54c3Smrg# 146717ca54c3Smrg# Interface to module: 146817ca54c3Smrg# ENABLE_UNIT_TESTS: used in makefiles to conditionally build tests 146917ca54c3Smrg# enable_unit_tests: used in configure.ac for additional configuration 147017ca54c3Smrg# --enable-unit-tests: 'yes' user instructs the module to build tests 147117ca54c3Smrg# 'no' user instructs the module not to build tests 147217ca54c3Smrg# parm1: specify the default value, yes or no. 147317ca54c3Smrg# 147417ca54c3SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[ 147517ca54c3SmrgAC_BEFORE([$0], [XORG_WITH_GLIB]) 147617ca54c3SmrgAC_BEFORE([$0], [XORG_LD_WRAP]) 147717ca54c3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS]) 147817ca54c3Smrgm4_define([_defopt], m4_default([$1], [auto])) 147917ca54c3SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests], 148017ca54c3Smrg [Enable building unit test cases (default: ]_defopt[)]), 148117ca54c3Smrg [enable_unit_tests=$enableval], [enable_unit_tests=]_defopt) 148217ca54c3Smrgm4_undefine([_defopt]) 148317ca54c3SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno]) 148417ca54c3SmrgAC_MSG_CHECKING([whether to build unit test cases]) 148517ca54c3SmrgAC_MSG_RESULT([$enable_unit_tests]) 148617ca54c3Smrg]) # XORG_ENABLE_UNIT_TESTS 148717ca54c3Smrg 148817ca54c3Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto) 148917ca54c3Smrg# ------------------------------------------------------ 149017ca54c3Smrg# Minimum version: 1.17.0 149117ca54c3Smrg# 149217ca54c3Smrg# This macro enables a builder to enable/disable integration testing 149317ca54c3Smrg# It makes no assumption about the test cases' implementation 149417ca54c3Smrg# Test cases may or may not use Automake "Support for test suites" 149517ca54c3Smrg# 149617ca54c3Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support 149717ca54c3Smrg# usually requires less dependencies and may be built and run under less 149817ca54c3Smrg# stringent environments than integration tests. 149917ca54c3Smrg# 150017ca54c3Smrg# Interface to module: 150117ca54c3Smrg# ENABLE_INTEGRATION_TESTS: used in makefiles to conditionally build tests 150217ca54c3Smrg# enable_integration_tests: used in configure.ac for additional configuration 150317ca54c3Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests 150417ca54c3Smrg# 'no' user instructs the module not to build tests 150517ca54c3Smrg# parm1: specify the default value, yes or no. 150617ca54c3Smrg# 150717ca54c3SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[ 150817ca54c3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS]) 150917ca54c3Smrgm4_define([_defopt], m4_default([$1], [auto])) 151017ca54c3SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests], 151117ca54c3Smrg [Enable building integration test cases (default: ]_defopt[)]), 151217ca54c3Smrg [enable_integration_tests=$enableval], 151317ca54c3Smrg [enable_integration_tests=]_defopt) 151417ca54c3Smrgm4_undefine([_defopt]) 151517ca54c3SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS], 151617ca54c3Smrg [test "x$enable_integration_tests" != xno]) 151717ca54c3SmrgAC_MSG_CHECKING([whether to build unit test cases]) 151817ca54c3SmrgAC_MSG_RESULT([$enable_integration_tests]) 151917ca54c3Smrg]) # XORG_ENABLE_INTEGRATION_TESTS 152017ca54c3Smrg 152117ca54c3Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT]) 152217ca54c3Smrg# ---------------------------------------- 152317ca54c3Smrg# Minimum version: 1.13.0 152417ca54c3Smrg# 152517ca54c3Smrg# GLib is a library which provides advanced data structures and functions. 152617ca54c3Smrg# This macro enables a module to test for the presence of Glib. 152717ca54c3Smrg# 152817ca54c3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing. 152917ca54c3Smrg# Otherwise the value of $enable_unit_tests is blank. 153017ca54c3Smrg# 153117ca54c3Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit 153217ca54c3Smrg# test support usually requires less dependencies and may be built and run under 153317ca54c3Smrg# less stringent environments than integration tests. 153417ca54c3Smrg# 153517ca54c3Smrg# Interface to module: 153617ca54c3Smrg# HAVE_GLIB: used in makefiles to conditionally build targets 153717ca54c3Smrg# with_glib: used in configure.ac to know if GLib has been found 153817ca54c3Smrg# --with-glib: 'yes' user instructs the module to use glib 153917ca54c3Smrg# 'no' user instructs the module not to use glib 154017ca54c3Smrg# 154117ca54c3SmrgAC_DEFUN([XORG_WITH_GLIB],[ 154217ca54c3SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG]) 154317ca54c3Smrgm4_define([_defopt], m4_default([$2], [auto])) 154417ca54c3SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib], 154517ca54c3Smrg [Use GLib library for unit testing (default: ]_defopt[)]), 154617ca54c3Smrg [with_glib=$withval], [with_glib=]_defopt) 154717ca54c3Smrgm4_undefine([_defopt]) 154817ca54c3Smrg 154917ca54c3Smrghave_glib=no 155017ca54c3Smrg# Do not probe GLib if user explicitly disabled unit testing 155117ca54c3Smrgif test "x$enable_unit_tests" != x"no"; then 155217ca54c3Smrg # Do not probe GLib if user explicitly disabled it 155317ca54c3Smrg if test "x$with_glib" != x"no"; then 155417ca54c3Smrg m4_ifval( 155517ca54c3Smrg [$1], 155617ca54c3Smrg [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])], 155717ca54c3Smrg [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])] 155817ca54c3Smrg ) 155917ca54c3Smrg fi 156017ca54c3Smrgfi 156117ca54c3Smrg 156217ca54c3Smrg# Not having GLib when unit testing has been explicitly requested is an error 156317ca54c3Smrgif test "x$enable_unit_tests" = x"yes"; then 156417ca54c3Smrg if test "x$have_glib" = x"no"; then 156517ca54c3Smrg AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found]) 156617ca54c3Smrg fi 156717ca54c3Smrgfi 156817ca54c3Smrg 156917ca54c3Smrg# Having unit testing disabled when GLib has been explicitly requested is an error 157017ca54c3Smrgif test "x$enable_unit_tests" = x"no"; then 157117ca54c3Smrg if test "x$with_glib" = x"yes"; then 157217ca54c3Smrg AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found]) 157317ca54c3Smrg fi 157417ca54c3Smrgfi 157517ca54c3Smrg 157617ca54c3Smrg# Not having GLib when it has been explicitly requested is an error 157717ca54c3Smrgif test "x$with_glib" = x"yes"; then 157817ca54c3Smrg if test "x$have_glib" = x"no"; then 157917ca54c3Smrg AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found]) 158017ca54c3Smrg fi 158117ca54c3Smrgfi 158217ca54c3Smrg 158317ca54c3SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes]) 158417ca54c3Smrg]) # XORG_WITH_GLIB 158517ca54c3Smrg 158617ca54c3Smrg# XORG_LD_WRAP([required|optional]) 158717ca54c3Smrg# --------------------------------- 158817ca54c3Smrg# Minimum version: 1.13.0 158917ca54c3Smrg# 159017ca54c3Smrg# Check if linker supports -wrap, passed via compiler flags 159117ca54c3Smrg# 159217ca54c3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing. 159317ca54c3Smrg# Otherwise the value of $enable_unit_tests is blank. 159417ca54c3Smrg# 159517ca54c3Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior 159617ca54c3Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not 159717ca54c3Smrg# available, an argument of "optional" allows use when some unit tests require 159817ca54c3Smrg# ld -wrap and others do not. 159917ca54c3Smrg# 160017ca54c3SmrgAC_DEFUN([XORG_LD_WRAP],[ 160117ca54c3SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no], 160217ca54c3Smrg [AC_LANG_PROGRAM([#include <stdlib.h> 160317ca54c3Smrg void __wrap_exit(int status) { return; }], 160417ca54c3Smrg [exit(0);])]) 160517ca54c3Smrg# Not having ld wrap when unit testing has been explicitly requested is an error 160617ca54c3Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then 160717ca54c3Smrg if test "x$have_ld_wrap" = x"no"; then 160817ca54c3Smrg AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available]) 160917ca54c3Smrg fi 161017ca54c3Smrgfi 161117ca54c3SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes]) 161217ca54c3Smrg# 161317ca54c3Smrg]) # XORG_LD_WRAP 161417ca54c3Smrg 161517ca54c3Smrg# XORG_CHECK_LINKER_FLAGS 161617ca54c3Smrg# ----------------------- 161717ca54c3Smrg# SYNOPSIS 161817ca54c3Smrg# 161917ca54c3Smrg# XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE]) 162017ca54c3Smrg# 162117ca54c3Smrg# DESCRIPTION 162217ca54c3Smrg# 162317ca54c3Smrg# Check whether the given linker FLAGS work with the current language's 162417ca54c3Smrg# linker, or whether they give an error. 162517ca54c3Smrg# 162617ca54c3Smrg# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on 162717ca54c3Smrg# success/failure. 162817ca54c3Smrg# 162917ca54c3Smrg# PROGRAM-SOURCE is the program source to link with, if needed 163017ca54c3Smrg# 163117ca54c3Smrg# NOTE: Based on AX_CHECK_COMPILER_FLAGS. 163217ca54c3Smrg# 163317ca54c3Smrg# LICENSE 163417ca54c3Smrg# 163517ca54c3Smrg# Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org> 163617ca54c3Smrg# Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu> 163717ca54c3Smrg# Copyright (c) 2009 Matteo Frigo 163817ca54c3Smrg# 163917ca54c3Smrg# This program is free software: you can redistribute it and/or modify it 164017ca54c3Smrg# under the terms of the GNU General Public License as published by the 164117ca54c3Smrg# Free Software Foundation, either version 3 of the License, or (at your 164217ca54c3Smrg# option) any later version. 164317ca54c3Smrg# 164417ca54c3Smrg# This program is distributed in the hope that it will be useful, but 164517ca54c3Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 164617ca54c3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 164717ca54c3Smrg# Public License for more details. 164817ca54c3Smrg# 164917ca54c3Smrg# You should have received a copy of the GNU General Public License along 165017ca54c3Smrg# with this program. If not, see <http://www.gnu.org/licenses/>. 165117ca54c3Smrg# 165217ca54c3Smrg# As a special exception, the respective Autoconf Macro's copyright owner 165317ca54c3Smrg# gives unlimited permission to copy, distribute and modify the configure 165417ca54c3Smrg# scripts that are the output of Autoconf when processing the Macro. You 165517ca54c3Smrg# need not follow the terms of the GNU General Public License when using 165617ca54c3Smrg# or distributing such scripts, even though portions of the text of the 165717ca54c3Smrg# Macro appear in them. The GNU General Public License (GPL) does govern 165817ca54c3Smrg# all other use of the material that constitutes the Autoconf Macro. 165917ca54c3Smrg# 166017ca54c3Smrg# This special exception to the GPL applies to versions of the Autoconf 166117ca54c3Smrg# Macro released by the Autoconf Archive. When you make and distribute a 166217ca54c3Smrg# modified version of the Autoconf Macro, you may extend this special 166317ca54c3Smrg# exception to the GPL to apply to your modified version as well.# 166417ca54c3SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS], 166517ca54c3Smrg[AC_MSG_CHECKING([whether the linker accepts $1]) 166617ca54c3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: 166717ca54c3SmrgAS_LITERAL_IF([$1], 166817ca54c3Smrg [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [ 166917ca54c3Smrg ax_save_FLAGS=$LDFLAGS 167017ca54c3Smrg LDFLAGS="$1" 167117ca54c3Smrg AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])], 167217ca54c3Smrg AS_TR_SH(xorg_cv_linker_flags_[$1])=yes, 167317ca54c3Smrg AS_TR_SH(xorg_cv_linker_flags_[$1])=no) 167417ca54c3Smrg LDFLAGS=$ax_save_FLAGS])], 167517ca54c3Smrg [ax_save_FLAGS=$LDFLAGS 167617ca54c3Smrg LDFLAGS="$1" 167717ca54c3Smrg AC_LINK_IFELSE([AC_LANG_PROGRAM()], 167817ca54c3Smrg eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes, 167917ca54c3Smrg eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no) 168017ca54c3Smrg LDFLAGS=$ax_save_FLAGS]) 168117ca54c3Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1]) 168217ca54c3SmrgAC_MSG_RESULT($xorg_check_linker_flags) 168317ca54c3Smrgif test "x$xorg_check_linker_flags" = xyes; then 168417ca54c3Smrg m4_default([$2], :) 168517ca54c3Smrgelse 168617ca54c3Smrg m4_default([$3], :) 168717ca54c3Smrgfi 168817ca54c3Smrg]) # XORG_CHECK_LINKER_FLAGS 168917ca54c3Smrg 169017ca54c3Smrg# XORG_MEMORY_CHECK_FLAGS 169117ca54c3Smrg# ----------------------- 169217ca54c3Smrg# Minimum version: 1.16.0 169317ca54c3Smrg# 169417ca54c3Smrg# This macro attempts to find appropriate memory checking functionality 169517ca54c3Smrg# for various platforms which unit testing code may use to catch various 169617ca54c3Smrg# forms of memory allocation and access errors in testing. 169717ca54c3Smrg# 169817ca54c3Smrg# Interface to module: 169917ca54c3Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging 170017ca54c3Smrg# Usually added to TESTS_ENVIRONMENT in Makefile.am 170117ca54c3Smrg# 170217ca54c3Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim. 170317ca54c3Smrg# 170417ca54c3SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[ 170517ca54c3Smrg 170617ca54c3SmrgAC_REQUIRE([AC_CANONICAL_HOST]) 170717ca54c3SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV], 170817ca54c3Smrg [Environment variables to enable memory checking in tests]) 170917ca54c3Smrg 171017ca54c3Smrg# Check for different types of support on different platforms 171117ca54c3Smrgcase $host_os in 171217ca54c3Smrg solaris*) 171317ca54c3Smrg AC_CHECK_LIB([umem], [umem_alloc], 171417ca54c3Smrg [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default']) 171517ca54c3Smrg ;; 171617ca54c3Smrg *-gnu*) # GNU libc - Value is used as a single byte bit pattern, 171717ca54c3Smrg # both directly and inverted, so should not be 0 or 255. 171817ca54c3Smrg malloc_debug_env='MALLOC_PERTURB_=15' 171917ca54c3Smrg ;; 172017ca54c3Smrg darwin*) 172117ca54c3Smrg malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib' 172217ca54c3Smrg ;; 172317ca54c3Smrg *bsd*) 172417ca54c3Smrg malloc_debug_env='MallocPreScribble=1 MallocScribble=1' 172517ca54c3Smrg ;; 172617ca54c3Smrgesac 172717ca54c3Smrg 172817ca54c3Smrg# User supplied flags override default flags 172917ca54c3Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then 173017ca54c3Smrg malloc_debug_env="$XORG_MALLOC_DEBUG_ENV" 173117ca54c3Smrgfi 173217ca54c3Smrg 173317ca54c3SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env]) 173417ca54c3Smrg]) # XORG_WITH_LINT 173517ca54c3Smrg 173617ca54c3Smrg# XORG_CHECK_MALLOC_ZERO 173717ca54c3Smrg# ---------------------- 173817ca54c3Smrg# Minimum version: 1.0.0 173917ca54c3Smrg# 174017ca54c3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if 174117ca54c3Smrg# malloc(0) returns NULL. Packages should add one of these cflags to 174217ca54c3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. 174317ca54c3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[ 174417ca54c3SmrgAC_ARG_ENABLE(malloc0returnsnull, 174517ca54c3Smrg AS_HELP_STRING([--enable-malloc0returnsnull], 174617ca54c3Smrg [malloc(0) returns NULL (default: auto)]), 174717ca54c3Smrg [MALLOC_ZERO_RETURNS_NULL=$enableval], 174817ca54c3Smrg [MALLOC_ZERO_RETURNS_NULL=auto]) 174917ca54c3Smrg 175017ca54c3SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL]) 175117ca54c3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then 175217ca54c3SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null], 175317ca54c3Smrg [AC_RUN_IFELSE([AC_LANG_PROGRAM([ 175417ca54c3Smrg#include <stdlib.h> 175517ca54c3Smrg],[ 175617ca54c3Smrg char *m0, *r0, *c0, *p; 175717ca54c3Smrg m0 = malloc(0); 175817ca54c3Smrg p = malloc(10); 175917ca54c3Smrg r0 = realloc(p,0); 176017ca54c3Smrg c0 = calloc(0,10); 176117ca54c3Smrg exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); 176217ca54c3Smrg])], 176317ca54c3Smrg [xorg_cv_malloc0_returns_null=yes], 176417ca54c3Smrg [xorg_cv_malloc0_returns_null=no])]) 176517ca54c3SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null 176617ca54c3Smrgfi 176717ca54c3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) 176817ca54c3Smrg 176917ca54c3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then 177017ca54c3Smrg MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL" 177117ca54c3Smrg XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS 177217ca54c3Smrg XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC" 177317ca54c3Smrgelse 177417ca54c3Smrg MALLOC_ZERO_CFLAGS="" 177517ca54c3Smrg XMALLOC_ZERO_CFLAGS="" 177617ca54c3Smrg XTMALLOC_ZERO_CFLAGS="" 177717ca54c3Smrgfi 177817ca54c3Smrg 177917ca54c3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS]) 178017ca54c3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS]) 178117ca54c3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS]) 178217ca54c3Smrg]) # XORG_CHECK_MALLOC_ZERO 178317ca54c3Smrg 178417ca54c3Smrg# XORG_WITH_LINT() 178517ca54c3Smrg# ---------------- 178617ca54c3Smrg# Minimum version: 1.1.0 178717ca54c3Smrg# 178817ca54c3Smrg# This macro enables the use of a tool that flags some suspicious and 178917ca54c3Smrg# non-portable constructs (likely to be bugs) in C language source code. 179017ca54c3Smrg# It will attempt to locate the tool and use appropriate options. 179117ca54c3Smrg# There are various lint type tools on different platforms. 179217ca54c3Smrg# 179317ca54c3Smrg# Interface to module: 179417ca54c3Smrg# LINT: returns the path to the tool found on the platform 179517ca54c3Smrg# or the value set to LINT on the configure cmd line 179617ca54c3Smrg# also an Automake conditional 179717ca54c3Smrg# LINT_FLAGS: an Automake variable with appropriate flags 179817ca54c3Smrg# 179917ca54c3Smrg# --with-lint: 'yes' user instructs the module to use lint 180017ca54c3Smrg# 'no' user instructs the module not to use lint (default) 180117ca54c3Smrg# 180217ca54c3Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path. 180317ca54c3Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim. 180417ca54c3Smrg# 180517ca54c3SmrgAC_DEFUN([XORG_WITH_LINT],[ 180617ca54c3Smrg 180717ca54c3SmrgAC_ARG_VAR([LINT], [Path to a lint-style command]) 180817ca54c3SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command]) 180917ca54c3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint], 181017ca54c3Smrg [Use a lint-style source code checker (default: disabled)])], 181117ca54c3Smrg [use_lint=$withval], [use_lint=no]) 181217ca54c3Smrg 181317ca54c3Smrg# Obtain platform specific info like program name and options 181417ca54c3Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris 181517ca54c3Smrgcase $host_os in 181617ca54c3Smrg *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*) 181717ca54c3Smrg lint_name=splint 181817ca54c3Smrg lint_options="-badflag" 181917ca54c3Smrg ;; 182017ca54c3Smrg *freebsd* | *netbsd*) 182117ca54c3Smrg lint_name=lint 182217ca54c3Smrg lint_options="-u -b" 182317ca54c3Smrg ;; 182417ca54c3Smrg *solaris*) 182517ca54c3Smrg lint_name=lint 182617ca54c3Smrg lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2" 182717ca54c3Smrg ;; 182817ca54c3Smrgesac 182917ca54c3Smrg 183017ca54c3Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user) 183117ca54c3Smrgif test "x$use_lint" = x"yes" ; then 183217ca54c3Smrg AC_PATH_PROG([LINT], [$lint_name]) 183317ca54c3Smrg if test "x$LINT" = "x"; then 183417ca54c3Smrg AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH]) 183517ca54c3Smrg fi 183617ca54c3Smrgelif test "x$use_lint" = x"no" ; then 183717ca54c3Smrg if test "x$LINT" != "x"; then 183817ca54c3Smrg AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified]) 183917ca54c3Smrg fi 184017ca54c3Smrgelse 184117ca54c3Smrg AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.]) 184217ca54c3Smrgfi 184317ca54c3Smrg 184417ca54c3Smrg# User supplied flags override default flags 184517ca54c3Smrgif test "x$LINT_FLAGS" != "x"; then 184617ca54c3Smrg lint_options=$LINT_FLAGS 184717ca54c3Smrgfi 184817ca54c3Smrg 184917ca54c3SmrgAC_SUBST([LINT_FLAGS],[$lint_options]) 185017ca54c3SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x]) 185117ca54c3Smrg 185217ca54c3Smrg]) # XORG_WITH_LINT 185317ca54c3Smrg 185417ca54c3Smrg# XORG_LINT_LIBRARY(LIBNAME) 185517ca54c3Smrg# -------------------------- 185617ca54c3Smrg# Minimum version: 1.1.0 185717ca54c3Smrg# 185817ca54c3Smrg# Sets up flags for building lint libraries for checking programs that call 185917ca54c3Smrg# functions in the library. 186017ca54c3Smrg# 186117ca54c3Smrg# Interface to module: 186217ca54c3Smrg# LINTLIB - Automake variable with the name of lint library file to make 186317ca54c3Smrg# MAKE_LINT_LIB - Automake conditional 186417ca54c3Smrg# 186517ca54c3Smrg# --enable-lint-library: - 'yes' user instructs the module to created a lint library 186617ca54c3Smrg# - 'no' user instructs the module not to create a lint library (default) 186717ca54c3Smrg 186817ca54c3SmrgAC_DEFUN([XORG_LINT_LIBRARY],[ 186917ca54c3SmrgAC_REQUIRE([XORG_WITH_LINT]) 187017ca54c3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library], 187117ca54c3Smrg [Create lint library (default: disabled)])], 187217ca54c3Smrg [make_lint_lib=$enableval], [make_lint_lib=no]) 187317ca54c3Smrg 187417ca54c3Smrgif test "x$make_lint_lib" = x"yes" ; then 187517ca54c3Smrg LINTLIB=llib-l$1.ln 187617ca54c3Smrg if test "x$LINT" = "x"; then 187717ca54c3Smrg AC_MSG_ERROR([Cannot make lint library without --with-lint]) 187817ca54c3Smrg fi 187917ca54c3Smrgelif test "x$make_lint_lib" != x"no" ; then 188017ca54c3Smrg AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.]) 188117ca54c3Smrgfi 188217ca54c3Smrg 188317ca54c3SmrgAC_SUBST(LINTLIB) 188417ca54c3SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno]) 188517ca54c3Smrg 188617ca54c3Smrg]) # XORG_LINT_LIBRARY 188717ca54c3Smrg 188817ca54c3Smrg# XORG_COMPILER_BRAND 188917ca54c3Smrg# ------------------- 189017ca54c3Smrg# Minimum version: 1.14.0 189117ca54c3Smrg# 189217ca54c3Smrg# Checks for various brands of compilers and sets flags as appropriate: 189317ca54c3Smrg# GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes" 189417ca54c3Smrg# GNU g++ - relies on AC_PROG_CXX to set GXX to "yes" 189517ca54c3Smrg# clang compiler - sets CLANGCC to "yes" 189617ca54c3Smrg# Intel compiler - sets INTELCC to "yes" 189717ca54c3Smrg# Sun/Oracle Solaris Studio cc - sets SUNCC to "yes" 189817ca54c3Smrg# 189917ca54c3SmrgAC_DEFUN([XORG_COMPILER_BRAND], [ 190017ca54c3SmrgAC_LANG_CASE( 190117ca54c3Smrg [C], [ 190217ca54c3Smrg AC_REQUIRE([AC_PROG_CC_C99]) 190317ca54c3Smrg ], 190417ca54c3Smrg [C++], [ 190517ca54c3Smrg AC_REQUIRE([AC_PROG_CXX]) 190617ca54c3Smrg ] 190717ca54c3Smrg) 190817ca54c3SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"]) 190917ca54c3SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) 191017ca54c3SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) 191117ca54c3Smrg]) # XORG_COMPILER_BRAND 191217ca54c3Smrg 191317ca54c3Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...]) 191417ca54c3Smrg# --------------- 191517ca54c3Smrg# Minimum version: 1.16.0 191617ca54c3Smrg# 191717ca54c3Smrg# Test if the compiler works when passed the given flag as a command line argument. 191817ca54c3Smrg# If it succeeds, the flag is appeneded to the given variable. If not, it tries the 191917ca54c3Smrg# next flag in the list until there are no more options. 192017ca54c3Smrg# 192117ca54c3Smrg# Note that this does not guarantee that the compiler supports the flag as some 192217ca54c3Smrg# compilers will simply ignore arguments that they do not understand, but we do 192317ca54c3Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and 192417ca54c3Smrg# -Werror=unused-command-line-argument 192517ca54c3Smrg# 192617ca54c3SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [ 192717ca54c3Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])]) 192817ca54c3Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])]) 192917ca54c3Smrg 193017ca54c3SmrgAC_LANG_COMPILER_REQUIRE 193117ca54c3Smrg 193217ca54c3SmrgAC_LANG_CASE( 193317ca54c3Smrg [C], [ 193417ca54c3Smrg AC_REQUIRE([AC_PROG_CC_C99]) 193517ca54c3Smrg define([PREFIX], [C]) 193617ca54c3Smrg define([CACHE_PREFIX], [cc]) 193717ca54c3Smrg define([COMPILER], [$CC]) 193817ca54c3Smrg ], 193917ca54c3Smrg [C++], [ 194017ca54c3Smrg define([PREFIX], [CXX]) 194117ca54c3Smrg define([CACHE_PREFIX], [cxx]) 194217ca54c3Smrg define([COMPILER], [$CXX]) 194317ca54c3Smrg ] 194417ca54c3Smrg) 194517ca54c3Smrg 194617ca54c3Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]" 194717ca54c3Smrg 194817ca54c3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then 194917ca54c3Smrg PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" 195017ca54c3Smrg AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option], 195117ca54c3Smrg [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option], 195217ca54c3Smrg AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], 195317ca54c3Smrg [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes], 195417ca54c3Smrg [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no])) 195517ca54c3Smrg [xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option] 195617ca54c3Smrg PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]" 195717ca54c3Smrgfi 195817ca54c3Smrg 195917ca54c3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then 196017ca54c3Smrg if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then 196117ca54c3Smrg PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" 196217ca54c3Smrg fi 196317ca54c3Smrg PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" 196417ca54c3Smrg AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument], 196517ca54c3Smrg [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument], 196617ca54c3Smrg AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], 196717ca54c3Smrg [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes], 196817ca54c3Smrg [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no])) 196917ca54c3Smrg [xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument] 197017ca54c3Smrg PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]" 197117ca54c3Smrgfi 197217ca54c3Smrg 197317ca54c3Smrgfound="no" 197417ca54c3Smrgm4_foreach([flag], m4_cdr($@), [ 197517ca54c3Smrg if test $found = "no" ; then 197617ca54c3Smrg if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then 197717ca54c3Smrg PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" 197817ca54c3Smrg fi 197917ca54c3Smrg 198017ca54c3Smrg if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then 198117ca54c3Smrg PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" 198217ca54c3Smrg fi 198317ca54c3Smrg 198417ca54c3Smrg PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag[" 198517ca54c3Smrg 198617ca54c3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname 198717ca54c3Smrg AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[]) 198817ca54c3Smrg cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[]) 198917ca54c3Smrg AC_CACHE_VAL($cacheid, 199017ca54c3Smrg [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])], 199117ca54c3Smrg [eval $cacheid=yes], 199217ca54c3Smrg [eval $cacheid=no])]) 199317ca54c3Smrg 199417ca54c3Smrg PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]" 199517ca54c3Smrg 199617ca54c3Smrg eval supported=\$$cacheid 199717ca54c3Smrg AC_MSG_RESULT([$supported]) 199817ca54c3Smrg if test "$supported" = "yes" ; then 199917ca54c3Smrg $1="$$1 ]flag[" 200017ca54c3Smrg found="yes" 200117ca54c3Smrg fi 200217ca54c3Smrg fi 200317ca54c3Smrg]) 200417ca54c3Smrg]) # XORG_TESTSET_CFLAG 200517ca54c3Smrg 200617ca54c3Smrg# XORG_COMPILER_FLAGS 200717ca54c3Smrg# --------------- 200817ca54c3Smrg# Minimum version: 1.16.0 200917ca54c3Smrg# 201017ca54c3Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line 201117ca54c3Smrg# arguments supported by the selected compiler which do NOT alter the generated 201217ca54c3Smrg# code. These arguments will cause the compiler to print various warnings 201317ca54c3Smrg# during compilation AND turn a conservative set of warnings into errors. 201417ca54c3Smrg# 201517ca54c3Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in 201617ca54c3Smrg# future versions of util-macros as options are added to new compilers. 201717ca54c3Smrg# 201817ca54c3SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [ 201917ca54c3SmrgAC_REQUIRE([XORG_COMPILER_BRAND]) 202017ca54c3Smrg 202117ca54c3SmrgAC_ARG_ENABLE(selective-werror, 202217ca54c3Smrg AS_HELP_STRING([--disable-selective-werror], 202317ca54c3Smrg [Turn off selective compiler errors. (default: enabled)]), 202417ca54c3Smrg [SELECTIVE_WERROR=$enableval], 202517ca54c3Smrg [SELECTIVE_WERROR=yes]) 202617ca54c3Smrg 202717ca54c3SmrgAC_LANG_CASE( 202817ca54c3Smrg [C], [ 202917ca54c3Smrg define([PREFIX], [C]) 203017ca54c3Smrg ], 203117ca54c3Smrg [C++], [ 203217ca54c3Smrg define([PREFIX], [CXX]) 203317ca54c3Smrg ] 203417ca54c3Smrg) 203517ca54c3Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG 203617ca54c3Smrgif test "x$SUNCC" = "xyes"; then 203717ca54c3Smrg [BASE_]PREFIX[FLAGS]="-v" 203817ca54c3Smrgelse 203917ca54c3Smrg [BASE_]PREFIX[FLAGS]="" 204017ca54c3Smrgfi 204117ca54c3Smrg 204217ca54c3Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS 204317ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall]) 204417ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith]) 204517ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations]) 204617ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat]) 204717ca54c3Smrg 204817ca54c3SmrgAC_LANG_CASE( 204917ca54c3Smrg [C], [ 205017ca54c3Smrg XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes]) 205117ca54c3Smrg XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes]) 205217ca54c3Smrg XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs]) 205317ca54c3Smrg XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast]) 205417ca54c3Smrg XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd]) 205517ca54c3Smrg XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement]) 205617ca54c3Smrg ] 205717ca54c3Smrg) 205817ca54c3Smrg 205917ca54c3Smrg# This chunk adds additional warnings that could catch undesired effects. 206017ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused]) 206117ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized]) 206217ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow]) 206317ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn]) 206417ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute]) 206517ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) 206617ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) 206717ca54c3Smrg 206817ca54c3Smrg# These are currently disabled because they are noisy. They will be enabled 206917ca54c3Smrg# in the future once the codebase is sufficiently modernized to silence 207017ca54c3Smrg# them. For now, I don't want them to drown out the other warnings. 207117ca54c3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) 207217ca54c3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) 207317ca54c3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) 207417ca54c3Smrg 207517ca54c3Smrg# Turn some warnings into errors, so we don't accidently get successful builds 207617ca54c3Smrg# when there are problems that should be fixed. 207717ca54c3Smrg 207817ca54c3Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then 207917ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED]) 208017ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull]) 208117ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self]) 208217ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main]) 208317ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces]) 208417ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point]) 208517ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT]) 208617ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs]) 208717ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds]) 208817ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings]) 208917ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address]) 209017ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION]) 209117ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION 209217ca54c3Smrgelse 209317ca54c3SmrgAC_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]) 209417ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit]) 209517ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull]) 209617ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self]) 209717ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain]) 209817ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces]) 209917ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point]) 210017ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type]) 210117ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs]) 210217ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds]) 210317ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings]) 210417ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress]) 210517ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast]) 210617ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast]) 210717ca54c3Smrgfi 210817ca54c3Smrg 210917ca54c3SmrgAC_SUBST([BASE_]PREFIX[FLAGS]) 211017ca54c3Smrg]) # XORG_COMPILER_FLAGS 211117ca54c3Smrg 211217ca54c3Smrg# XORG_CWARNFLAGS 211317ca54c3Smrg# --------------- 211417ca54c3Smrg# Minimum version: 1.2.0 211517ca54c3Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead) 211617ca54c3Smrg# 211717ca54c3Smrg# Defines CWARNFLAGS to enable C compiler warnings. 211817ca54c3Smrg# 211917ca54c3Smrg# This function is deprecated because it defines -fno-strict-aliasing 212017ca54c3Smrg# which alters the code generated by the compiler. If -fno-strict-aliasing 212117ca54c3Smrg# is needed, then it should be added explicitly in the module when 212217ca54c3Smrg# it is updated to use BASE_CFLAGS. 212317ca54c3Smrg# 212417ca54c3SmrgAC_DEFUN([XORG_CWARNFLAGS], [ 212517ca54c3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS]) 212617ca54c3SmrgAC_REQUIRE([XORG_COMPILER_BRAND]) 212717ca54c3SmrgAC_LANG_CASE( 212817ca54c3Smrg [C], [ 212917ca54c3Smrg CWARNFLAGS="$BASE_CFLAGS" 213017ca54c3Smrg if test "x$GCC" = xyes ; then 213117ca54c3Smrg CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing" 213217ca54c3Smrg fi 213317ca54c3Smrg AC_SUBST(CWARNFLAGS) 213417ca54c3Smrg ] 213517ca54c3Smrg) 213617ca54c3Smrg]) # XORG_CWARNFLAGS 213717ca54c3Smrg 213817ca54c3Smrg# XORG_STRICT_OPTION 213917ca54c3Smrg# ----------------------- 214017ca54c3Smrg# Minimum version: 1.3.0 214117ca54c3Smrg# 214217ca54c3Smrg# Add configure option to enable strict compilation flags, such as treating 214317ca54c3Smrg# warnings as fatal errors. 214417ca54c3Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to 214517ca54c3Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS. 214617ca54c3Smrg# 214717ca54c3Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or 214817ca54c3Smrg# when strict compilation is unconditionally desired. 214917ca54c3SmrgAC_DEFUN([XORG_STRICT_OPTION], [ 215017ca54c3SmrgAC_REQUIRE([XORG_CWARNFLAGS]) 215117ca54c3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS]) 215217ca54c3Smrg 215317ca54c3SmrgAC_ARG_ENABLE(strict-compilation, 215417ca54c3Smrg AS_HELP_STRING([--enable-strict-compilation], 215517ca54c3Smrg [Enable all warnings from compiler and make them errors (default: disabled)]), 215617ca54c3Smrg [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) 215717ca54c3Smrg 215817ca54c3SmrgAC_LANG_CASE( 215917ca54c3Smrg [C], [ 216017ca54c3Smrg define([PREFIX], [C]) 216117ca54c3Smrg ], 216217ca54c3Smrg [C++], [ 216317ca54c3Smrg define([PREFIX], [CXX]) 216417ca54c3Smrg ] 216517ca54c3Smrg) 216617ca54c3Smrg 216717ca54c3Smrg[STRICT_]PREFIX[FLAGS]="" 216817ca54c3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic]) 216917ca54c3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn]) 217017ca54c3Smrg 217117ca54c3Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not 217217ca54c3Smrg# activate it with -Werror, so we add it here explicitly. 217317ca54c3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes]) 217417ca54c3Smrg 217517ca54c3Smrgif test "x$STRICT_COMPILE" = "xyes"; then 217617ca54c3Smrg [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]" 217717ca54c3Smrg AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"]) 217817ca54c3Smrgfi 217917ca54c3SmrgAC_SUBST([STRICT_]PREFIX[FLAGS]) 218017ca54c3SmrgAC_SUBST([BASE_]PREFIX[FLAGS]) 218117ca54c3SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS])) 218217ca54c3Smrg]) # XORG_STRICT_OPTION 218317ca54c3Smrg 218417ca54c3Smrg# XORG_DEFAULT_OPTIONS 218517ca54c3Smrg# -------------------- 218617ca54c3Smrg# Minimum version: 1.3.0 218717ca54c3Smrg# 218817ca54c3Smrg# Defines default options for X.Org modules. 218917ca54c3Smrg# 219017ca54c3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [ 219117ca54c3SmrgAC_REQUIRE([AC_PROG_INSTALL]) 219217ca54c3SmrgXORG_COMPILER_FLAGS 219317ca54c3SmrgXORG_CWARNFLAGS 219417ca54c3SmrgXORG_STRICT_OPTION 219517ca54c3SmrgXORG_RELEASE_VERSION 219617ca54c3SmrgXORG_CHANGELOG 219717ca54c3SmrgXORG_INSTALL 219817ca54c3SmrgXORG_MANPAGE_SECTIONS 219917ca54c3Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], 220017ca54c3Smrg [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) 220117ca54c3Smrg]) # XORG_DEFAULT_OPTIONS 220217ca54c3Smrg 220317ca54c3Smrg# XORG_INSTALL() 220417ca54c3Smrg# ---------------- 220517ca54c3Smrg# Minimum version: 1.4.0 220617ca54c3Smrg# 220717ca54c3Smrg# Defines the variable INSTALL_CMD as the command to copy 220817ca54c3Smrg# INSTALL from $prefix/share/util-macros. 220917ca54c3Smrg# 221017ca54c3SmrgAC_DEFUN([XORG_INSTALL], [ 221117ca54c3SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG]) 221217ca54c3Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros` 221317ca54c3SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \ 221417ca54c3Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \ 2215ffe57424Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \ 2216ffe57424Smrgtouch \$(top_srcdir)/INSTALL; \ 2217ffe57424Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))" 221817ca54c3SmrgAC_SUBST([INSTALL_CMD]) 221917ca54c3Smrg]) # XORG_INSTALL 222017ca54c3Smrgdnl Copyright 2005 Red Hat, Inc 222117ca54c3Smrgdnl 222217ca54c3Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its 222317ca54c3Smrgdnl documentation for any purpose is hereby granted without fee, provided that 222417ca54c3Smrgdnl the above copyright notice appear in all copies and that both that 222517ca54c3Smrgdnl copyright notice and this permission notice appear in supporting 222617ca54c3Smrgdnl documentation. 222717ca54c3Smrgdnl 222817ca54c3Smrgdnl The above copyright notice and this permission notice shall be included 222917ca54c3Smrgdnl in all copies or substantial portions of the Software. 223017ca54c3Smrgdnl 223117ca54c3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 223217ca54c3Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 223317ca54c3Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 223417ca54c3Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 223517ca54c3Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 223617ca54c3Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 223717ca54c3Smrgdnl OTHER DEALINGS IN THE SOFTWARE. 223817ca54c3Smrgdnl 223917ca54c3Smrgdnl Except as contained in this notice, the name of the copyright holders shall 224017ca54c3Smrgdnl not be used in advertising or otherwise to promote the sale, use or 224117ca54c3Smrgdnl other dealings in this Software without prior written authorization 224217ca54c3Smrgdnl from the copyright holders. 224317ca54c3Smrgdnl 224417ca54c3Smrg 224517ca54c3Smrg# XORG_RELEASE_VERSION 224617ca54c3Smrg# -------------------- 224717ca54c3Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use. 224817ca54c3Smrg 224917ca54c3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[ 225017ca54c3Smrg AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR], 225117ca54c3Smrg [`echo $PACKAGE_VERSION | cut -d . -f 1`], 225217ca54c3Smrg [Major version of this package]) 225317ca54c3Smrg PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1` 225417ca54c3Smrg if test "x$PVM" = "x"; then 225517ca54c3Smrg PVM="0" 225617ca54c3Smrg fi 225717ca54c3Smrg AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR], 225817ca54c3Smrg [$PVM], 225917ca54c3Smrg [Minor version of this package]) 226017ca54c3Smrg PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1` 226117ca54c3Smrg if test "x$PVP" = "x"; then 226217ca54c3Smrg PVP="0" 226317ca54c3Smrg fi 226417ca54c3Smrg AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL], 226517ca54c3Smrg [$PVP], 226617ca54c3Smrg [Patch version of this package]) 226717ca54c3Smrg]) 226817ca54c3Smrg 226917ca54c3Smrg# XORG_CHANGELOG() 227017ca54c3Smrg# ---------------- 227117ca54c3Smrg# Minimum version: 1.2.0 227217ca54c3Smrg# 227317ca54c3Smrg# Defines the variable CHANGELOG_CMD as the command to generate 227417ca54c3Smrg# ChangeLog from git. 227517ca54c3Smrg# 227617ca54c3Smrg# 227717ca54c3SmrgAC_DEFUN([XORG_CHANGELOG], [ 2278ffe57424SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \ 227917ca54c3Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \ 2280ffe57424Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \ 2281ffe57424Smrgtouch \$(top_srcdir)/ChangeLog; \ 2282ffe57424Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))" 228317ca54c3SmrgAC_SUBST([CHANGELOG_CMD]) 228417ca54c3Smrg]) # XORG_CHANGELOG 228517ca54c3Smrg 2286ffe57424Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc. 228717ca54c3Smrg# 228817ca54c3Smrg# This file is free software; the Free Software Foundation 228917ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 229017ca54c3Smrg# with or without modifications, as long as this notice is preserved. 229117ca54c3Smrg 229217ca54c3Smrg# AM_AUTOMAKE_VERSION(VERSION) 229317ca54c3Smrg# ---------------------------- 229417ca54c3Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been 229517ca54c3Smrg# generated from the m4 files accompanying Automake X.Y. 229617ca54c3Smrg# (This private macro should not be called outside this file.) 229717ca54c3SmrgAC_DEFUN([AM_AUTOMAKE_VERSION], 2298ea1d6981Smrg[am__api_version='1.16' 229917ca54c3Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to 230017ca54c3Smrgdnl require some minimum version. Point them to the right macro. 2301ffe57424Smrgm4_if([$1], [1.16.5], [], 230217ca54c3Smrg [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl 230317ca54c3Smrg]) 230417ca54c3Smrg 230517ca54c3Smrg# _AM_AUTOCONF_VERSION(VERSION) 230617ca54c3Smrg# ----------------------------- 230717ca54c3Smrg# aclocal traces this macro to find the Autoconf version. 230817ca54c3Smrg# This is a private macro too. Using m4_define simplifies 230917ca54c3Smrg# the logic in aclocal, which can simply ignore this definition. 231017ca54c3Smrgm4_define([_AM_AUTOCONF_VERSION], []) 231117ca54c3Smrg 231217ca54c3Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION 231317ca54c3Smrg# ------------------------------- 231417ca54c3Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. 231517ca54c3Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. 231617ca54c3SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], 2317ffe57424Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl 231817ca54c3Smrgm4_ifndef([AC_AUTOCONF_VERSION], 231917ca54c3Smrg [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl 232017ca54c3Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) 232117ca54c3Smrg 232217ca54c3Smrg# AM_AUX_DIR_EXPAND -*- Autoconf -*- 232317ca54c3Smrg 2324ffe57424Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc. 232517ca54c3Smrg# 232617ca54c3Smrg# This file is free software; the Free Software Foundation 232717ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 232817ca54c3Smrg# with or without modifications, as long as this notice is preserved. 232917ca54c3Smrg 233017ca54c3Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets 233117ca54c3Smrg# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to 233217ca54c3Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'. 233317ca54c3Smrg# 233417ca54c3Smrg# Of course, Automake must honor this variable whenever it calls a 233517ca54c3Smrg# tool from the auxiliary directory. The problem is that $srcdir (and 233617ca54c3Smrg# therefore $ac_aux_dir as well) can be either absolute or relative, 233717ca54c3Smrg# depending on how configure is run. This is pretty annoying, since 233817ca54c3Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top 233917ca54c3Smrg# source directory, any form will work fine, but in subdirectories a 234017ca54c3Smrg# relative path needs to be adjusted first. 234117ca54c3Smrg# 234217ca54c3Smrg# $ac_aux_dir/missing 234317ca54c3Smrg# fails when called from a subdirectory if $ac_aux_dir is relative 234417ca54c3Smrg# $top_srcdir/$ac_aux_dir/missing 234517ca54c3Smrg# fails if $ac_aux_dir is absolute, 234617ca54c3Smrg# fails when called from a subdirectory in a VPATH build with 234717ca54c3Smrg# a relative $ac_aux_dir 234817ca54c3Smrg# 234917ca54c3Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir 235017ca54c3Smrg# are both prefixed by $srcdir. In an in-source build this is usually 235117ca54c3Smrg# harmless because $srcdir is '.', but things will broke when you 235217ca54c3Smrg# start a VPATH build or use an absolute $srcdir. 235317ca54c3Smrg# 235417ca54c3Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, 235517ca54c3Smrg# iff we strip the leading $srcdir from $ac_aux_dir. That would be: 235617ca54c3Smrg# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` 235717ca54c3Smrg# and then we would define $MISSING as 235817ca54c3Smrg# MISSING="\${SHELL} $am_aux_dir/missing" 235917ca54c3Smrg# This will work as long as MISSING is not called from configure, because 236017ca54c3Smrg# unfortunately $(top_srcdir) has no meaning in configure. 236117ca54c3Smrg# However there are other variables, like CC, which are often used in 236217ca54c3Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir. 236317ca54c3Smrg# 236417ca54c3Smrg# Another solution, used here, is to always expand $ac_aux_dir to an 236517ca54c3Smrg# absolute PATH. The drawback is that using absolute paths prevent a 236617ca54c3Smrg# configured tree to be moved without reconfiguration. 236717ca54c3Smrg 236817ca54c3SmrgAC_DEFUN([AM_AUX_DIR_EXPAND], 236917ca54c3Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl 237017ca54c3Smrg# Expand $ac_aux_dir to an absolute path. 237117ca54c3Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd` 237217ca54c3Smrg]) 237317ca54c3Smrg 237417ca54c3Smrg# AM_CONDITIONAL -*- Autoconf -*- 237517ca54c3Smrg 2376ffe57424Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc. 237717ca54c3Smrg# 237817ca54c3Smrg# This file is free software; the Free Software Foundation 237917ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 238017ca54c3Smrg# with or without modifications, as long as this notice is preserved. 238117ca54c3Smrg 238217ca54c3Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION) 238317ca54c3Smrg# ------------------------------------- 238417ca54c3Smrg# Define a conditional. 238517ca54c3SmrgAC_DEFUN([AM_CONDITIONAL], 238617ca54c3Smrg[AC_PREREQ([2.52])dnl 238717ca54c3Smrg m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], 238817ca54c3Smrg [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl 238917ca54c3SmrgAC_SUBST([$1_TRUE])dnl 239017ca54c3SmrgAC_SUBST([$1_FALSE])dnl 239117ca54c3Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl 239217ca54c3Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl 239317ca54c3Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl 239417ca54c3Smrgif $2; then 239517ca54c3Smrg $1_TRUE= 239617ca54c3Smrg $1_FALSE='#' 239717ca54c3Smrgelse 239817ca54c3Smrg $1_TRUE='#' 239917ca54c3Smrg $1_FALSE= 240017ca54c3Smrgfi 240117ca54c3SmrgAC_CONFIG_COMMANDS_PRE( 240217ca54c3Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then 240317ca54c3Smrg AC_MSG_ERROR([[conditional "$1" was never defined. 240417ca54c3SmrgUsually this means the macro was only invoked conditionally.]]) 240517ca54c3Smrgfi])]) 240617ca54c3Smrg 2407ffe57424Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc. 240817ca54c3Smrg# 240917ca54c3Smrg# This file is free software; the Free Software Foundation 241017ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 241117ca54c3Smrg# with or without modifications, as long as this notice is preserved. 241217ca54c3Smrg 241317ca54c3Smrg 241417ca54c3Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be 241517ca54c3Smrg# written in clear, in which case automake, when reading aclocal.m4, 241617ca54c3Smrg# will think it sees a *use*, and therefore will trigger all it's 241717ca54c3Smrg# C support machinery. Also note that it means that autoscan, seeing 241817ca54c3Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use... 241917ca54c3Smrg 242017ca54c3Smrg 242117ca54c3Smrg# _AM_DEPENDENCIES(NAME) 242217ca54c3Smrg# ---------------------- 242317ca54c3Smrg# See how the compiler implements dependency checking. 242417ca54c3Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". 242517ca54c3Smrg# We try a few techniques and use that to set a single cache variable. 242617ca54c3Smrg# 242717ca54c3Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was 242817ca54c3Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular 242917ca54c3Smrg# dependency, and given that the user is not expected to run this macro, 243017ca54c3Smrg# just rely on AC_PROG_CC. 243117ca54c3SmrgAC_DEFUN([_AM_DEPENDENCIES], 243217ca54c3Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl 243317ca54c3SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl 243417ca54c3SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl 243517ca54c3SmrgAC_REQUIRE([AM_DEP_TRACK])dnl 243617ca54c3Smrg 243717ca54c3Smrgm4_if([$1], [CC], [depcc="$CC" am_compiler_list=], 243817ca54c3Smrg [$1], [CXX], [depcc="$CXX" am_compiler_list=], 243917ca54c3Smrg [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], 244017ca54c3Smrg [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], 244117ca54c3Smrg [$1], [UPC], [depcc="$UPC" am_compiler_list=], 244217ca54c3Smrg [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], 244317ca54c3Smrg [depcc="$$1" am_compiler_list=]) 244417ca54c3Smrg 244517ca54c3SmrgAC_CACHE_CHECK([dependency style of $depcc], 244617ca54c3Smrg [am_cv_$1_dependencies_compiler_type], 244717ca54c3Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then 244817ca54c3Smrg # We make a subdir and do the tests there. Otherwise we can end up 244917ca54c3Smrg # making bogus files that we don't know about and never remove. For 245017ca54c3Smrg # instance it was reported that on HP-UX the gcc test will end up 245117ca54c3Smrg # making a dummy file named 'D' -- because '-MD' means "put the output 245217ca54c3Smrg # in D". 245317ca54c3Smrg rm -rf conftest.dir 245417ca54c3Smrg mkdir conftest.dir 245517ca54c3Smrg # Copy depcomp to subdir because otherwise we won't find it if we're 245617ca54c3Smrg # using a relative directory. 245717ca54c3Smrg cp "$am_depcomp" conftest.dir 245817ca54c3Smrg cd conftest.dir 245917ca54c3Smrg # We will build objects and dependencies in a subdirectory because 246017ca54c3Smrg # it helps to detect inapplicable dependency modes. For instance 246117ca54c3Smrg # both Tru64's cc and ICC support -MD to output dependencies as a 246217ca54c3Smrg # side effect of compilation, but ICC will put the dependencies in 246317ca54c3Smrg # the current directory while Tru64 will put them in the object 246417ca54c3Smrg # directory. 246517ca54c3Smrg mkdir sub 246617ca54c3Smrg 246717ca54c3Smrg am_cv_$1_dependencies_compiler_type=none 246817ca54c3Smrg if test "$am_compiler_list" = ""; then 246917ca54c3Smrg am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` 247017ca54c3Smrg fi 247117ca54c3Smrg am__universal=false 247217ca54c3Smrg m4_case([$1], [CC], 247317ca54c3Smrg [case " $depcc " in #( 247417ca54c3Smrg *\ -arch\ *\ -arch\ *) am__universal=true ;; 247517ca54c3Smrg esac], 247617ca54c3Smrg [CXX], 247717ca54c3Smrg [case " $depcc " in #( 247817ca54c3Smrg *\ -arch\ *\ -arch\ *) am__universal=true ;; 247917ca54c3Smrg esac]) 248017ca54c3Smrg 248117ca54c3Smrg for depmode in $am_compiler_list; do 248217ca54c3Smrg # Setup a source with many dependencies, because some compilers 248317ca54c3Smrg # like to wrap large dependency lists on column 80 (with \), and 248417ca54c3Smrg # we should not choose a depcomp mode which is confused by this. 248517ca54c3Smrg # 248617ca54c3Smrg # We need to recreate these files for each test, as the compiler may 248717ca54c3Smrg # overwrite some of them when testing with obscure command lines. 248817ca54c3Smrg # This happens at least with the AIX C compiler. 248917ca54c3Smrg : > sub/conftest.c 249017ca54c3Smrg for i in 1 2 3 4 5 6; do 249117ca54c3Smrg echo '#include "conftst'$i'.h"' >> sub/conftest.c 249217ca54c3Smrg # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with 249317ca54c3Smrg # Solaris 10 /bin/sh. 249417ca54c3Smrg echo '/* dummy */' > sub/conftst$i.h 249517ca54c3Smrg done 249617ca54c3Smrg echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf 249717ca54c3Smrg 249817ca54c3Smrg # We check with '-c' and '-o' for the sake of the "dashmstdout" 249917ca54c3Smrg # mode. It turns out that the SunPro C++ compiler does not properly 250017ca54c3Smrg # handle '-M -o', and we need to detect this. Also, some Intel 250117ca54c3Smrg # versions had trouble with output in subdirs. 250217ca54c3Smrg am__obj=sub/conftest.${OBJEXT-o} 250317ca54c3Smrg am__minus_obj="-o $am__obj" 250417ca54c3Smrg case $depmode in 250517ca54c3Smrg gcc) 250617ca54c3Smrg # This depmode causes a compiler race in universal mode. 250717ca54c3Smrg test "$am__universal" = false || continue 250817ca54c3Smrg ;; 250917ca54c3Smrg nosideeffect) 251017ca54c3Smrg # After this tag, mechanisms are not by side-effect, so they'll 251117ca54c3Smrg # only be used when explicitly requested. 251217ca54c3Smrg if test "x$enable_dependency_tracking" = xyes; then 251317ca54c3Smrg continue 251417ca54c3Smrg else 251517ca54c3Smrg break 251617ca54c3Smrg fi 251717ca54c3Smrg ;; 251817ca54c3Smrg msvc7 | msvc7msys | msvisualcpp | msvcmsys) 251917ca54c3Smrg # This compiler won't grok '-c -o', but also, the minuso test has 252017ca54c3Smrg # not run yet. These depmodes are late enough in the game, and 252117ca54c3Smrg # so weak that their functioning should not be impacted. 252217ca54c3Smrg am__obj=conftest.${OBJEXT-o} 252317ca54c3Smrg am__minus_obj= 252417ca54c3Smrg ;; 252517ca54c3Smrg none) break ;; 252617ca54c3Smrg esac 252717ca54c3Smrg if depmode=$depmode \ 252817ca54c3Smrg source=sub/conftest.c object=$am__obj \ 252917ca54c3Smrg depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ 253017ca54c3Smrg $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ 253117ca54c3Smrg >/dev/null 2>conftest.err && 253217ca54c3Smrg grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && 253317ca54c3Smrg grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && 253417ca54c3Smrg grep $am__obj sub/conftest.Po > /dev/null 2>&1 && 253517ca54c3Smrg ${MAKE-make} -s -f confmf > /dev/null 2>&1; then 253617ca54c3Smrg # icc doesn't choke on unknown options, it will just issue warnings 253717ca54c3Smrg # or remarks (even with -Werror). So we grep stderr for any message 253817ca54c3Smrg # that says an option was ignored or not supported. 253917ca54c3Smrg # When given -MP, icc 7.0 and 7.1 complain thusly: 254017ca54c3Smrg # icc: Command line warning: ignoring option '-M'; no argument required 254117ca54c3Smrg # The diagnosis changed in icc 8.0: 254217ca54c3Smrg # icc: Command line remark: option '-MP' not supported 254317ca54c3Smrg if (grep 'ignoring option' conftest.err || 254417ca54c3Smrg grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else 254517ca54c3Smrg am_cv_$1_dependencies_compiler_type=$depmode 254617ca54c3Smrg break 254717ca54c3Smrg fi 254817ca54c3Smrg fi 254917ca54c3Smrg done 255017ca54c3Smrg 255117ca54c3Smrg cd .. 255217ca54c3Smrg rm -rf conftest.dir 255317ca54c3Smrgelse 255417ca54c3Smrg am_cv_$1_dependencies_compiler_type=none 255517ca54c3Smrgfi 255617ca54c3Smrg]) 255717ca54c3SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) 255817ca54c3SmrgAM_CONDITIONAL([am__fastdep$1], [ 255917ca54c3Smrg test "x$enable_dependency_tracking" != xno \ 256017ca54c3Smrg && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) 256117ca54c3Smrg]) 256217ca54c3Smrg 256317ca54c3Smrg 256417ca54c3Smrg# AM_SET_DEPDIR 256517ca54c3Smrg# ------------- 256617ca54c3Smrg# Choose a directory name for dependency files. 256717ca54c3Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES. 256817ca54c3SmrgAC_DEFUN([AM_SET_DEPDIR], 256917ca54c3Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl 257017ca54c3SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl 257117ca54c3Smrg]) 257217ca54c3Smrg 257317ca54c3Smrg 257417ca54c3Smrg# AM_DEP_TRACK 257517ca54c3Smrg# ------------ 257617ca54c3SmrgAC_DEFUN([AM_DEP_TRACK], 257717ca54c3Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl 257817ca54c3SmrgAS_HELP_STRING( 257917ca54c3Smrg [--enable-dependency-tracking], 258017ca54c3Smrg [do not reject slow dependency extractors]) 258117ca54c3SmrgAS_HELP_STRING( 258217ca54c3Smrg [--disable-dependency-tracking], 258317ca54c3Smrg [speeds up one-time build])]) 258417ca54c3Smrgif test "x$enable_dependency_tracking" != xno; then 258517ca54c3Smrg am_depcomp="$ac_aux_dir/depcomp" 258617ca54c3Smrg AMDEPBACKSLASH='\' 258717ca54c3Smrg am__nodep='_no' 258817ca54c3Smrgfi 258917ca54c3SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) 259017ca54c3SmrgAC_SUBST([AMDEPBACKSLASH])dnl 259117ca54c3Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl 259217ca54c3SmrgAC_SUBST([am__nodep])dnl 259317ca54c3Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl 259417ca54c3Smrg]) 259517ca54c3Smrg 259617ca54c3Smrg# Generate code to set up dependency tracking. -*- Autoconf -*- 259717ca54c3Smrg 2598ffe57424Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc. 259917ca54c3Smrg# 260017ca54c3Smrg# This file is free software; the Free Software Foundation 260117ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 260217ca54c3Smrg# with or without modifications, as long as this notice is preserved. 260317ca54c3Smrg 260417ca54c3Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS 260517ca54c3Smrg# ------------------------------ 260617ca54c3SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], 260717ca54c3Smrg[{ 260817ca54c3Smrg # Older Autoconf quotes --file arguments for eval, but not when files 260917ca54c3Smrg # are listed without --file. Let's play safe and only enable the eval 261017ca54c3Smrg # if we detect the quoting. 2611ea1d6981Smrg # TODO: see whether this extra hack can be removed once we start 2612ea1d6981Smrg # requiring Autoconf 2.70 or later. 2613ea1d6981Smrg AS_CASE([$CONFIG_FILES], 2614ea1d6981Smrg [*\'*], [eval set x "$CONFIG_FILES"], 2615ea1d6981Smrg [*], [set x $CONFIG_FILES]) 261617ca54c3Smrg shift 2617ea1d6981Smrg # Used to flag and report bootstrapping failures. 2618ea1d6981Smrg am_rc=0 2619ea1d6981Smrg for am_mf 262017ca54c3Smrg do 262117ca54c3Smrg # Strip MF so we end up with the name of the file. 2622ea1d6981Smrg am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` 2623ea1d6981Smrg # Check whether this is an Automake generated Makefile which includes 2624ea1d6981Smrg # dependency-tracking related rules and includes. 2625ea1d6981Smrg # Grep'ing the whole file directly is not great: AIX grep has a line 262617ca54c3Smrg # limit of 2048, but all sed's we know have understand at least 4000. 2627ea1d6981Smrg sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ 2628ea1d6981Smrg || continue 2629ea1d6981Smrg am_dirpart=`AS_DIRNAME(["$am_mf"])` 2630ea1d6981Smrg am_filepart=`AS_BASENAME(["$am_mf"])` 2631ea1d6981Smrg AM_RUN_LOG([cd "$am_dirpart" \ 2632ea1d6981Smrg && sed -e '/# am--include-marker/d' "$am_filepart" \ 2633ea1d6981Smrg | $MAKE -f - am--depfiles]) || am_rc=$? 263417ca54c3Smrg done 2635ea1d6981Smrg if test $am_rc -ne 0; then 2636ea1d6981Smrg AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments 2637ffe57424Smrg for automatic dependency tracking. If GNU make was not used, consider 2638ffe57424Smrg re-running the configure script with MAKE="gmake" (or whatever is 2639ffe57424Smrg necessary). You can also try re-running configure with the 2640ea1d6981Smrg '--disable-dependency-tracking' option to at least be able to build 2641ea1d6981Smrg the package (albeit without support for automatic dependency tracking).]) 2642ea1d6981Smrg fi 2643ea1d6981Smrg AS_UNSET([am_dirpart]) 2644ea1d6981Smrg AS_UNSET([am_filepart]) 2645ea1d6981Smrg AS_UNSET([am_mf]) 2646ea1d6981Smrg AS_UNSET([am_rc]) 2647ea1d6981Smrg rm -f conftest-deps.mk 264817ca54c3Smrg} 264917ca54c3Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS 265017ca54c3Smrg 265117ca54c3Smrg 265217ca54c3Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS 265317ca54c3Smrg# ----------------------------- 265417ca54c3Smrg# This macro should only be invoked once -- use via AC_REQUIRE. 265517ca54c3Smrg# 2656ea1d6981Smrg# This code is only required when automatic dependency tracking is enabled. 2657ea1d6981Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in 2658ea1d6981Smrg# order to bootstrap the dependency handling code. 265917ca54c3SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], 266017ca54c3Smrg[AC_CONFIG_COMMANDS([depfiles], 266117ca54c3Smrg [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], 2662ea1d6981Smrg [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) 266317ca54c3Smrg 266417ca54c3Smrg# Do all the work for Automake. -*- Autoconf -*- 266517ca54c3Smrg 2666ffe57424Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 266717ca54c3Smrg# 266817ca54c3Smrg# This file is free software; the Free Software Foundation 266917ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 267017ca54c3Smrg# with or without modifications, as long as this notice is preserved. 267117ca54c3Smrg 267217ca54c3Smrg# This macro actually does too much. Some checks are only needed if 267317ca54c3Smrg# your package does certain things. But this isn't really a big deal. 267417ca54c3Smrg 267517ca54c3Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. 267617ca54c3Smrgm4_define([AC_PROG_CC], 267717ca54c3Smrgm4_defn([AC_PROG_CC]) 267817ca54c3Smrg[_AM_PROG_CC_C_O 267917ca54c3Smrg]) 268017ca54c3Smrg 268117ca54c3Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) 268217ca54c3Smrg# AM_INIT_AUTOMAKE([OPTIONS]) 268317ca54c3Smrg# ----------------------------------------------- 268417ca54c3Smrg# The call with PACKAGE and VERSION arguments is the old style 268517ca54c3Smrg# call (pre autoconf-2.50), which is being phased out. PACKAGE 268617ca54c3Smrg# and VERSION should now be passed to AC_INIT and removed from 268717ca54c3Smrg# the call to AM_INIT_AUTOMAKE. 268817ca54c3Smrg# We support both call styles for the transition. After 268917ca54c3Smrg# the next Automake release, Autoconf can make the AC_INIT 269017ca54c3Smrg# arguments mandatory, and then we can depend on a new Autoconf 269117ca54c3Smrg# release and drop the old call support. 269217ca54c3SmrgAC_DEFUN([AM_INIT_AUTOMAKE], 269317ca54c3Smrg[AC_PREREQ([2.65])dnl 2694ffe57424Smrgm4_ifdef([_$0_ALREADY_INIT], 2695ffe57424Smrg [m4_fatal([$0 expanded multiple times 2696ffe57424Smrg]m4_defn([_$0_ALREADY_INIT]))], 2697ffe57424Smrg [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl 269817ca54c3Smrgdnl Autoconf wants to disallow AM_ names. We explicitly allow 269917ca54c3Smrgdnl the ones we care about. 270017ca54c3Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl 270117ca54c3SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl 270217ca54c3SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl 270317ca54c3Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then 270417ca54c3Smrg # Use -I$(srcdir) only when $(srcdir) != ., so that make's output 270517ca54c3Smrg # is not polluted with repeated "-I." 270617ca54c3Smrg AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl 270717ca54c3Smrg # test to see if srcdir already configured 270817ca54c3Smrg if test -f $srcdir/config.status; then 270917ca54c3Smrg AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) 271017ca54c3Smrg fi 271117ca54c3Smrgfi 271217ca54c3Smrg 271317ca54c3Smrg# test whether we have cygpath 271417ca54c3Smrgif test -z "$CYGPATH_W"; then 271517ca54c3Smrg if (cygpath --version) >/dev/null 2>/dev/null; then 271617ca54c3Smrg CYGPATH_W='cygpath -w' 271717ca54c3Smrg else 271817ca54c3Smrg CYGPATH_W=echo 271917ca54c3Smrg fi 272017ca54c3Smrgfi 272117ca54c3SmrgAC_SUBST([CYGPATH_W]) 272217ca54c3Smrg 272317ca54c3Smrg# Define the identity of the package. 272417ca54c3Smrgdnl Distinguish between old-style and new-style calls. 272517ca54c3Smrgm4_ifval([$2], 272617ca54c3Smrg[AC_DIAGNOSE([obsolete], 272717ca54c3Smrg [$0: two- and three-arguments forms are deprecated.]) 272817ca54c3Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl 272917ca54c3Smrg AC_SUBST([PACKAGE], [$1])dnl 273017ca54c3Smrg AC_SUBST([VERSION], [$2])], 273117ca54c3Smrg[_AM_SET_OPTIONS([$1])dnl 273217ca54c3Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. 273317ca54c3Smrgm4_if( 2734ffe57424Smrg m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), 273517ca54c3Smrg [ok:ok],, 273617ca54c3Smrg [m4_fatal([AC_INIT should be called with package and version arguments])])dnl 273717ca54c3Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl 273817ca54c3Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl 273917ca54c3Smrg 274017ca54c3Smrg_AM_IF_OPTION([no-define],, 274117ca54c3Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) 274217ca54c3Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl 274317ca54c3Smrg 274417ca54c3Smrg# Some tools Automake needs. 274517ca54c3SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl 274617ca54c3SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl 274717ca54c3SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) 274817ca54c3SmrgAM_MISSING_PROG([AUTOCONF], [autoconf]) 274917ca54c3SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) 275017ca54c3SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader]) 275117ca54c3SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo]) 275217ca54c3SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl 275317ca54c3SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl 275417ca54c3SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl 275517ca54c3Smrg# For better backward compatibility. To be removed once Automake 1.9.x 275617ca54c3Smrg# dies out for good. For more background, see: 2757ea1d6981Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> 2758ea1d6981Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> 275917ca54c3SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)']) 276017ca54c3Smrg# We need awk for the "check" target (and possibly the TAP driver). The 276117ca54c3Smrg# system "awk" is bad on some platforms. 276217ca54c3SmrgAC_REQUIRE([AC_PROG_AWK])dnl 276317ca54c3SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl 276417ca54c3SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl 276517ca54c3Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], 276617ca54c3Smrg [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], 276717ca54c3Smrg [_AM_PROG_TAR([v7])])]) 276817ca54c3Smrg_AM_IF_OPTION([no-dependencies],, 276917ca54c3Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC], 277017ca54c3Smrg [_AM_DEPENDENCIES([CC])], 277117ca54c3Smrg [m4_define([AC_PROG_CC], 277217ca54c3Smrg m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl 277317ca54c3SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX], 277417ca54c3Smrg [_AM_DEPENDENCIES([CXX])], 277517ca54c3Smrg [m4_define([AC_PROG_CXX], 277617ca54c3Smrg m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl 277717ca54c3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC], 277817ca54c3Smrg [_AM_DEPENDENCIES([OBJC])], 277917ca54c3Smrg [m4_define([AC_PROG_OBJC], 278017ca54c3Smrg m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl 278117ca54c3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX], 278217ca54c3Smrg [_AM_DEPENDENCIES([OBJCXX])], 278317ca54c3Smrg [m4_define([AC_PROG_OBJCXX], 278417ca54c3Smrg m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl 278517ca54c3Smrg]) 2786ffe57424Smrg# Variables for tags utilities; see am/tags.am 2787ffe57424Smrgif test -z "$CTAGS"; then 2788ffe57424Smrg CTAGS=ctags 2789ffe57424Smrgfi 2790ffe57424SmrgAC_SUBST([CTAGS]) 2791ffe57424Smrgif test -z "$ETAGS"; then 2792ffe57424Smrg ETAGS=etags 2793ffe57424Smrgfi 2794ffe57424SmrgAC_SUBST([ETAGS]) 2795ffe57424Smrgif test -z "$CSCOPE"; then 2796ffe57424Smrg CSCOPE=cscope 2797ffe57424Smrgfi 2798ffe57424SmrgAC_SUBST([CSCOPE]) 2799ffe57424Smrg 280017ca54c3SmrgAC_REQUIRE([AM_SILENT_RULES])dnl 280117ca54c3Smrgdnl The testsuite driver may need to know about EXEEXT, so add the 280217ca54c3Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This 280317ca54c3Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. 280417ca54c3SmrgAC_CONFIG_COMMANDS_PRE(dnl 280517ca54c3Smrg[m4_provide_if([_AM_COMPILER_EXEEXT], 280617ca54c3Smrg [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl 280717ca54c3Smrg 280817ca54c3Smrg# POSIX will say in a future version that running "rm -f" with no argument 280917ca54c3Smrg# is OK; and we want to be able to make that assumption in our Makefile 281017ca54c3Smrg# recipes. So use an aggressive probe to check that the usage we want is 281117ca54c3Smrg# actually supported "in the wild" to an acceptable degree. 281217ca54c3Smrg# See automake bug#10828. 281317ca54c3Smrg# To make any issue more visible, cause the running configure to be aborted 281417ca54c3Smrg# by default if the 'rm' program in use doesn't match our expectations; the 281517ca54c3Smrg# user can still override this though. 281617ca54c3Smrgif rm -f && rm -fr && rm -rf; then : OK; else 281717ca54c3Smrg cat >&2 <<'END' 281817ca54c3SmrgOops! 281917ca54c3Smrg 282017ca54c3SmrgYour 'rm' program seems unable to run without file operands specified 282117ca54c3Smrgon the command line, even when the '-f' option is present. This is contrary 282217ca54c3Smrgto the behaviour of most rm programs out there, and not conforming with 282317ca54c3Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> 282417ca54c3Smrg 282517ca54c3SmrgPlease tell bug-automake@gnu.org about your system, including the value 282617ca54c3Smrgof your $PATH and any error possibly output before this message. This 282717ca54c3Smrgcan help us improve future automake versions. 282817ca54c3Smrg 282917ca54c3SmrgEND 283017ca54c3Smrg if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then 283117ca54c3Smrg echo 'Configuration will proceed anyway, since you have set the' >&2 283217ca54c3Smrg echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 283317ca54c3Smrg echo >&2 283417ca54c3Smrg else 283517ca54c3Smrg cat >&2 <<'END' 283617ca54c3SmrgAborting the configuration process, to ensure you take notice of the issue. 283717ca54c3Smrg 283817ca54c3SmrgYou can download and install GNU coreutils to get an 'rm' implementation 2839ea1d6981Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>. 284017ca54c3Smrg 284117ca54c3SmrgIf you want to complete the configuration process using your problematic 284217ca54c3Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM 284317ca54c3Smrgto "yes", and re-run configure. 284417ca54c3Smrg 284517ca54c3SmrgEND 284617ca54c3Smrg AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) 284717ca54c3Smrg fi 284817ca54c3Smrgfi 284917ca54c3Smrgdnl The trailing newline in this macro's definition is deliberate, for 285017ca54c3Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments 285117ca54c3Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. 285217ca54c3Smrg]) 285317ca54c3Smrg 285417ca54c3Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not 285517ca54c3Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further 285617ca54c3Smrgdnl mangled by Autoconf and run in a shell conditional statement. 285717ca54c3Smrgm4_define([_AC_COMPILER_EXEEXT], 285817ca54c3Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) 285917ca54c3Smrg 286017ca54c3Smrg# When config.status generates a header, we must update the stamp-h file. 286117ca54c3Smrg# This file resides in the same directory as the config header 286217ca54c3Smrg# that is generated. The stamp files are numbered to have different names. 286317ca54c3Smrg 286417ca54c3Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the 286517ca54c3Smrg# loop where config.status creates the headers, so we can generate 286617ca54c3Smrg# our stamp files there. 286717ca54c3SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], 286817ca54c3Smrg[# Compute $1's index in $config_headers. 286917ca54c3Smrg_am_arg=$1 287017ca54c3Smrg_am_stamp_count=1 287117ca54c3Smrgfor _am_header in $config_headers :; do 287217ca54c3Smrg case $_am_header in 287317ca54c3Smrg $_am_arg | $_am_arg:* ) 287417ca54c3Smrg break ;; 287517ca54c3Smrg * ) 287617ca54c3Smrg _am_stamp_count=`expr $_am_stamp_count + 1` ;; 287717ca54c3Smrg esac 287817ca54c3Smrgdone 287917ca54c3Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) 288017ca54c3Smrg 2881ffe57424Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc. 288217ca54c3Smrg# 288317ca54c3Smrg# This file is free software; the Free Software Foundation 288417ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 288517ca54c3Smrg# with or without modifications, as long as this notice is preserved. 288617ca54c3Smrg 288717ca54c3Smrg# AM_PROG_INSTALL_SH 288817ca54c3Smrg# ------------------ 288917ca54c3Smrg# Define $install_sh. 289017ca54c3SmrgAC_DEFUN([AM_PROG_INSTALL_SH], 289117ca54c3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl 289217ca54c3Smrgif test x"${install_sh+set}" != xset; then 289317ca54c3Smrg case $am_aux_dir in 289417ca54c3Smrg *\ * | *\ *) 289517ca54c3Smrg install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; 289617ca54c3Smrg *) 289717ca54c3Smrg install_sh="\${SHELL} $am_aux_dir/install-sh" 289817ca54c3Smrg esac 289917ca54c3Smrgfi 290017ca54c3SmrgAC_SUBST([install_sh])]) 290117ca54c3Smrg 2902ffe57424Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc. 290317ca54c3Smrg# 290417ca54c3Smrg# This file is free software; the Free Software Foundation 290517ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 290617ca54c3Smrg# with or without modifications, as long as this notice is preserved. 290717ca54c3Smrg 290817ca54c3Smrg# Check whether the underlying file-system supports filenames 290917ca54c3Smrg# with a leading dot. For instance MS-DOS doesn't. 291017ca54c3SmrgAC_DEFUN([AM_SET_LEADING_DOT], 291117ca54c3Smrg[rm -rf .tst 2>/dev/null 291217ca54c3Smrgmkdir .tst 2>/dev/null 291317ca54c3Smrgif test -d .tst; then 291417ca54c3Smrg am__leading_dot=. 291517ca54c3Smrgelse 291617ca54c3Smrg am__leading_dot=_ 291717ca54c3Smrgfi 291817ca54c3Smrgrmdir .tst 2>/dev/null 291917ca54c3SmrgAC_SUBST([am__leading_dot])]) 292017ca54c3Smrg 292117ca54c3Smrg# Check to see how 'make' treats includes. -*- Autoconf -*- 292217ca54c3Smrg 2923ffe57424Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc. 292417ca54c3Smrg# 292517ca54c3Smrg# This file is free software; the Free Software Foundation 292617ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 292717ca54c3Smrg# with or without modifications, as long as this notice is preserved. 292817ca54c3Smrg 292917ca54c3Smrg# AM_MAKE_INCLUDE() 293017ca54c3Smrg# ----------------- 2931ea1d6981Smrg# Check whether make has an 'include' directive that can support all 2932ea1d6981Smrg# the idioms we need for our automatic dependency tracking code. 293317ca54c3SmrgAC_DEFUN([AM_MAKE_INCLUDE], 2934ea1d6981Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) 2935ea1d6981Smrgcat > confinc.mk << 'END' 293617ca54c3Smrgam__doit: 2937ea1d6981Smrg @echo this is the am__doit target >confinc.out 293817ca54c3Smrg.PHONY: am__doit 293917ca54c3SmrgEND 294017ca54c3Smrgam__include="#" 294117ca54c3Smrgam__quote= 2942ea1d6981Smrg# BSD make does it like this. 2943ea1d6981Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD 2944ea1d6981Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this. 2945ea1d6981Smrgecho 'include confinc.mk # ignored' > confmf.GNU 2946ea1d6981Smrg_am_result=no 2947ea1d6981Smrgfor s in GNU BSD; do 2948ea1d6981Smrg AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) 2949ea1d6981Smrg AS_CASE([$?:`cat confinc.out 2>/dev/null`], 2950ea1d6981Smrg ['0:this is the am__doit target'], 2951ea1d6981Smrg [AS_CASE([$s], 2952ea1d6981Smrg [BSD], [am__include='.include' am__quote='"'], 2953ea1d6981Smrg [am__include='include' am__quote=''])]) 2954ea1d6981Smrg if test "$am__include" != "#"; then 2955ea1d6981Smrg _am_result="yes ($s style)" 2956ea1d6981Smrg break 2957ea1d6981Smrg fi 2958ea1d6981Smrgdone 2959ea1d6981Smrgrm -f confinc.* confmf.* 2960ea1d6981SmrgAC_MSG_RESULT([${_am_result}]) 2961ea1d6981SmrgAC_SUBST([am__include])]) 2962ea1d6981SmrgAC_SUBST([am__quote])]) 296317ca54c3Smrg 296417ca54c3Smrg# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- 296517ca54c3Smrg 2966ffe57424Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc. 296717ca54c3Smrg# 296817ca54c3Smrg# This file is free software; the Free Software Foundation 296917ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 297017ca54c3Smrg# with or without modifications, as long as this notice is preserved. 297117ca54c3Smrg 297217ca54c3Smrg# AM_MISSING_PROG(NAME, PROGRAM) 297317ca54c3Smrg# ------------------------------ 297417ca54c3SmrgAC_DEFUN([AM_MISSING_PROG], 297517ca54c3Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN]) 297617ca54c3Smrg$1=${$1-"${am_missing_run}$2"} 297717ca54c3SmrgAC_SUBST($1)]) 297817ca54c3Smrg 297917ca54c3Smrg# AM_MISSING_HAS_RUN 298017ca54c3Smrg# ------------------ 298117ca54c3Smrg# Define MISSING if not defined so far and test if it is modern enough. 298217ca54c3Smrg# If it is, set am_missing_run to use it, otherwise, to nothing. 298317ca54c3SmrgAC_DEFUN([AM_MISSING_HAS_RUN], 298417ca54c3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl 298517ca54c3SmrgAC_REQUIRE_AUX_FILE([missing])dnl 298617ca54c3Smrgif test x"${MISSING+set}" != xset; then 2987ffe57424Smrg MISSING="\${SHELL} '$am_aux_dir/missing'" 298817ca54c3Smrgfi 298917ca54c3Smrg# Use eval to expand $SHELL 299017ca54c3Smrgif eval "$MISSING --is-lightweight"; then 299117ca54c3Smrg am_missing_run="$MISSING " 299217ca54c3Smrgelse 299317ca54c3Smrg am_missing_run= 299417ca54c3Smrg AC_MSG_WARN(['missing' script is too old or missing]) 299517ca54c3Smrgfi 299617ca54c3Smrg]) 299717ca54c3Smrg 299817ca54c3Smrg# Helper functions for option handling. -*- Autoconf -*- 299917ca54c3Smrg 3000ffe57424Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc. 300117ca54c3Smrg# 300217ca54c3Smrg# This file is free software; the Free Software Foundation 300317ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 300417ca54c3Smrg# with or without modifications, as long as this notice is preserved. 300517ca54c3Smrg 300617ca54c3Smrg# _AM_MANGLE_OPTION(NAME) 300717ca54c3Smrg# ----------------------- 300817ca54c3SmrgAC_DEFUN([_AM_MANGLE_OPTION], 300917ca54c3Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) 301017ca54c3Smrg 301117ca54c3Smrg# _AM_SET_OPTION(NAME) 301217ca54c3Smrg# -------------------- 301317ca54c3Smrg# Set option NAME. Presently that only means defining a flag for this option. 301417ca54c3SmrgAC_DEFUN([_AM_SET_OPTION], 301517ca54c3Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) 301617ca54c3Smrg 301717ca54c3Smrg# _AM_SET_OPTIONS(OPTIONS) 301817ca54c3Smrg# ------------------------ 301917ca54c3Smrg# OPTIONS is a space-separated list of Automake options. 302017ca54c3SmrgAC_DEFUN([_AM_SET_OPTIONS], 302117ca54c3Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) 302217ca54c3Smrg 302317ca54c3Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) 302417ca54c3Smrg# ------------------------------------------- 302517ca54c3Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 302617ca54c3SmrgAC_DEFUN([_AM_IF_OPTION], 302717ca54c3Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) 302817ca54c3Smrg 3029ffe57424Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc. 303017ca54c3Smrg# 303117ca54c3Smrg# This file is free software; the Free Software Foundation 303217ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 303317ca54c3Smrg# with or without modifications, as long as this notice is preserved. 303417ca54c3Smrg 303517ca54c3Smrg# _AM_PROG_CC_C_O 303617ca54c3Smrg# --------------- 303717ca54c3Smrg# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC 303817ca54c3Smrg# to automatically call this. 303917ca54c3SmrgAC_DEFUN([_AM_PROG_CC_C_O], 304017ca54c3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl 304117ca54c3SmrgAC_REQUIRE_AUX_FILE([compile])dnl 304217ca54c3SmrgAC_LANG_PUSH([C])dnl 304317ca54c3SmrgAC_CACHE_CHECK( 304417ca54c3Smrg [whether $CC understands -c and -o together], 304517ca54c3Smrg [am_cv_prog_cc_c_o], 304617ca54c3Smrg [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) 304717ca54c3Smrg # Make sure it works both with $CC and with simple cc. 304817ca54c3Smrg # Following AC_PROG_CC_C_O, we do the test twice because some 304917ca54c3Smrg # compilers refuse to overwrite an existing .o file with -o, 305017ca54c3Smrg # though they will create one. 305117ca54c3Smrg am_cv_prog_cc_c_o=yes 305217ca54c3Smrg for am_i in 1 2; do 305317ca54c3Smrg if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ 305417ca54c3Smrg && test -f conftest2.$ac_objext; then 305517ca54c3Smrg : OK 305617ca54c3Smrg else 305717ca54c3Smrg am_cv_prog_cc_c_o=no 305817ca54c3Smrg break 305917ca54c3Smrg fi 306017ca54c3Smrg done 306117ca54c3Smrg rm -f core conftest* 306217ca54c3Smrg unset am_i]) 306317ca54c3Smrgif test "$am_cv_prog_cc_c_o" != yes; then 306417ca54c3Smrg # Losing compiler, so override with the script. 306517ca54c3Smrg # FIXME: It is wrong to rewrite CC. 306617ca54c3Smrg # But if we don't then we get into trouble of one sort or another. 306717ca54c3Smrg # A longer-term fix would be to have automake use am__CC in this case, 306817ca54c3Smrg # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" 306917ca54c3Smrg CC="$am_aux_dir/compile $CC" 307017ca54c3Smrgfi 307117ca54c3SmrgAC_LANG_POP([C])]) 307217ca54c3Smrg 307317ca54c3Smrg# For backward compatibility. 307417ca54c3SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) 307517ca54c3Smrg 3076ffe57424Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc. 30775395ea76Smrg# 30785395ea76Smrg# This file is free software; the Free Software Foundation 30795395ea76Smrg# gives unlimited permission to copy and/or distribute it, 30805395ea76Smrg# with or without modifications, as long as this notice is preserved. 30815395ea76Smrg 30825395ea76Smrg 30835395ea76Smrg# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 30845395ea76Smrg# --------------------------------------------------------------------------- 30855395ea76Smrg# Adds support for distributing Python modules and packages. To 30865395ea76Smrg# install modules, copy them to $(pythondir), using the python_PYTHON 30875395ea76Smrg# automake variable. To install a package with the same name as the 30885395ea76Smrg# automake package, install to $(pkgpythondir), or use the 30895395ea76Smrg# pkgpython_PYTHON automake variable. 30905395ea76Smrg# 30915395ea76Smrg# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as 30925395ea76Smrg# locations to install python extension modules (shared libraries). 30935395ea76Smrg# Another macro is required to find the appropriate flags to compile 30945395ea76Smrg# extension modules. 30955395ea76Smrg# 30965395ea76Smrg# If your package is configured with a different prefix to python, 30975395ea76Smrg# users will have to add the install directory to the PYTHONPATH 30985395ea76Smrg# environment variable, or create a .pth file (see the python 30995395ea76Smrg# documentation for details). 31005395ea76Smrg# 31015395ea76Smrg# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will 31025395ea76Smrg# cause an error if the version of python installed on the system 31035395ea76Smrg# doesn't meet the requirement. MINIMUM-VERSION should consist of 31045395ea76Smrg# numbers and dots only. 31055395ea76SmrgAC_DEFUN([AM_PATH_PYTHON], 31065395ea76Smrg [ 31075395ea76Smrg dnl Find a Python interpreter. Python versions prior to 2.0 are not 31085395ea76Smrg dnl supported. (2.0 was released on October 16, 2000). 31095395ea76Smrg m4_define_default([_AM_PYTHON_INTERPRETER_LIST], 31105395ea76Smrg[python python2 python3 dnl 31115395ea76Smrg python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl 31125395ea76Smrg python3.2 python3.1 python3.0 dnl 31135395ea76Smrg python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl 31145395ea76Smrg python2.0]) 31155395ea76Smrg 31165395ea76Smrg AC_ARG_VAR([PYTHON], [the Python interpreter]) 31175395ea76Smrg 31185395ea76Smrg m4_if([$1],[],[ 31195395ea76Smrg dnl No version check is needed. 31205395ea76Smrg # Find any Python interpreter. 31215395ea76Smrg if test -z "$PYTHON"; then 31225395ea76Smrg AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) 31235395ea76Smrg fi 31245395ea76Smrg am_display_PYTHON=python 31255395ea76Smrg ], [ 31265395ea76Smrg dnl A version check is needed. 31275395ea76Smrg if test -n "$PYTHON"; then 31285395ea76Smrg # If the user set $PYTHON, use it and don't search something else. 31295395ea76Smrg AC_MSG_CHECKING([whether $PYTHON version is >= $1]) 31305395ea76Smrg AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], 31315395ea76Smrg [AC_MSG_RESULT([yes])], 31325395ea76Smrg [AC_MSG_RESULT([no]) 31335395ea76Smrg AC_MSG_ERROR([Python interpreter is too old])]) 31345395ea76Smrg am_display_PYTHON=$PYTHON 31355395ea76Smrg else 31365395ea76Smrg # Otherwise, try each interpreter until we find one that satisfies 31375395ea76Smrg # VERSION. 31385395ea76Smrg AC_CACHE_CHECK([for a Python interpreter with version >= $1], 31395395ea76Smrg [am_cv_pathless_PYTHON],[ 31405395ea76Smrg for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do 31415395ea76Smrg test "$am_cv_pathless_PYTHON" = none && break 31425395ea76Smrg AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) 31435395ea76Smrg done]) 31445395ea76Smrg # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. 31455395ea76Smrg if test "$am_cv_pathless_PYTHON" = none; then 31465395ea76Smrg PYTHON=: 31475395ea76Smrg else 31485395ea76Smrg AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) 31495395ea76Smrg fi 31505395ea76Smrg am_display_PYTHON=$am_cv_pathless_PYTHON 31515395ea76Smrg fi 31525395ea76Smrg ]) 31535395ea76Smrg 31545395ea76Smrg if test "$PYTHON" = :; then 3155ffe57424Smrg dnl Run any user-specified action, or abort. 31565395ea76Smrg m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) 31575395ea76Smrg else 31585395ea76Smrg 3159ffe57424Smrg dnl Query Python for its version number. Although site.py simply uses 3160ffe57424Smrg dnl sys.version[:3], printing that failed with Python 3.10, since the 3161ffe57424Smrg dnl trailing zero was eliminated. So now we output just the major 3162ffe57424Smrg dnl and minor version numbers, as numbers. Apparently the tertiary 3163ffe57424Smrg dnl version is not of interest. 3164ffe57424Smrg dnl 31655395ea76Smrg AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], 3166ffe57424Smrg [am_cv_python_version=`$PYTHON -c "import sys; print ('%u.%u' % sys.version_info[[:2]])"`]) 31675395ea76Smrg AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) 31685395ea76Smrg 3169ffe57424Smrg dnl At times, e.g., when building shared libraries, you may want 31705395ea76Smrg dnl to know which OS platform Python thinks this is. 3171ffe57424Smrg dnl 31725395ea76Smrg AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], 31735395ea76Smrg [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) 31745395ea76Smrg AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) 31755395ea76Smrg 3176ffe57424Smrg dnl emacs-page 3177ffe57424Smrg dnl If --with-python-sys-prefix is given, use the values of sys.prefix 3178ffe57424Smrg dnl and sys.exec_prefix for the corresponding values of PYTHON_PREFIX 3179ffe57424Smrg dnl and PYTHON_EXEC_PREFIX. Otherwise, use the GNU ${prefix} and 3180ffe57424Smrg dnl ${exec_prefix} variables. 3181ffe57424Smrg dnl 3182ffe57424Smrg dnl The two are made distinct variables so they can be overridden if 3183ffe57424Smrg dnl need be, although general consensus is that you shouldn't need 3184ffe57424Smrg dnl this separation. 3185ffe57424Smrg dnl 3186ffe57424Smrg dnl Also allow directly setting the prefixes via configure options, 3187ffe57424Smrg dnl overriding any default. 3188ffe57424Smrg dnl 3189ffe57424Smrg if test "x$prefix" = xNONE; then 3190ffe57424Smrg am__usable_prefix=$ac_default_prefix 3191ffe57424Smrg else 3192ffe57424Smrg am__usable_prefix=$prefix 3193ffe57424Smrg fi 3194ffe57424Smrg 3195ffe57424Smrg # Allow user to request using sys.* values from Python, 3196ffe57424Smrg # instead of the GNU $prefix values. 3197ffe57424Smrg AC_ARG_WITH([python-sys-prefix], 3198ffe57424Smrg [AS_HELP_STRING([--with-python-sys-prefix], 3199ffe57424Smrg [use Python's sys.prefix and sys.exec_prefix values])], 3200ffe57424Smrg [am_use_python_sys=:], 3201ffe57424Smrg [am_use_python_sys=false]) 3202ffe57424Smrg 3203ffe57424Smrg # Allow user to override whatever the default Python prefix is. 3204ffe57424Smrg AC_ARG_WITH([python_prefix], 3205ffe57424Smrg [AS_HELP_STRING([--with-python_prefix], 3206ffe57424Smrg [override the default PYTHON_PREFIX])], 3207ffe57424Smrg [am_python_prefix_subst=$withval 3208ffe57424Smrg am_cv_python_prefix=$withval 3209ffe57424Smrg AC_MSG_CHECKING([for explicit $am_display_PYTHON prefix]) 3210ffe57424Smrg AC_MSG_RESULT([$am_cv_python_prefix])], 3211ffe57424Smrg [ 3212ffe57424Smrg if $am_use_python_sys; then 3213ffe57424Smrg # using python sys.prefix value, not GNU 3214ffe57424Smrg AC_CACHE_CHECK([for python default $am_display_PYTHON prefix], 3215ffe57424Smrg [am_cv_python_prefix], 3216ffe57424Smrg [am_cv_python_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`]) 3217ffe57424Smrg 3218ffe57424Smrg dnl If sys.prefix is a subdir of $prefix, replace the literal value of 3219ffe57424Smrg dnl $prefix with a variable reference so it can be overridden. 3220ffe57424Smrg case $am_cv_python_prefix in 3221ffe57424Smrg $am__usable_prefix*) 3222ffe57424Smrg am__strip_prefix=`echo "$am__usable_prefix" | sed 's|.|.|g'` 3223ffe57424Smrg am_python_prefix_subst=`echo "$am_cv_python_prefix" | sed "s,^$am__strip_prefix,\\${prefix},"` 3224ffe57424Smrg ;; 3225ffe57424Smrg *) 3226ffe57424Smrg am_python_prefix_subst=$am_cv_python_prefix 3227ffe57424Smrg ;; 3228ffe57424Smrg esac 3229ffe57424Smrg else # using GNU prefix value, not python sys.prefix 3230ffe57424Smrg am_python_prefix_subst='${prefix}' 3231ffe57424Smrg am_python_prefix=$am_python_prefix_subst 3232ffe57424Smrg AC_MSG_CHECKING([for GNU default $am_display_PYTHON prefix]) 3233ffe57424Smrg AC_MSG_RESULT([$am_python_prefix]) 3234ffe57424Smrg fi]) 3235ffe57424Smrg # Substituting python_prefix_subst value. 3236ffe57424Smrg AC_SUBST([PYTHON_PREFIX], [$am_python_prefix_subst]) 3237ffe57424Smrg 3238ffe57424Smrg # emacs-page Now do it all over again for Python exec_prefix, but with yet 3239ffe57424Smrg # another conditional: fall back to regular prefix if that was specified. 3240ffe57424Smrg AC_ARG_WITH([python_exec_prefix], 3241ffe57424Smrg [AS_HELP_STRING([--with-python_exec_prefix], 3242ffe57424Smrg [override the default PYTHON_EXEC_PREFIX])], 3243ffe57424Smrg [am_python_exec_prefix_subst=$withval 3244ffe57424Smrg am_cv_python_exec_prefix=$withval 3245ffe57424Smrg AC_MSG_CHECKING([for explicit $am_display_PYTHON exec_prefix]) 3246ffe57424Smrg AC_MSG_RESULT([$am_cv_python_exec_prefix])], 3247ffe57424Smrg [ 3248ffe57424Smrg # no explicit --with-python_exec_prefix, but if 3249ffe57424Smrg # --with-python_prefix was given, use its value for python_exec_prefix too. 3250ffe57424Smrg AS_IF([test -n "$with_python_prefix"], 3251ffe57424Smrg [am_python_exec_prefix_subst=$with_python_prefix 3252ffe57424Smrg am_cv_python_exec_prefix=$with_python_prefix 3253ffe57424Smrg AC_MSG_CHECKING([for python_prefix-given $am_display_PYTHON exec_prefix]) 3254ffe57424Smrg AC_MSG_RESULT([$am_cv_python_exec_prefix])], 3255ffe57424Smrg [ 3256ffe57424Smrg # Set am__usable_exec_prefix whether using GNU or Python values, 3257ffe57424Smrg # since we use that variable for pyexecdir. 3258ffe57424Smrg if test "x$exec_prefix" = xNONE; then 3259ffe57424Smrg am__usable_exec_prefix=$am__usable_prefix 3260ffe57424Smrg else 3261ffe57424Smrg am__usable_exec_prefix=$exec_prefix 3262ffe57424Smrg fi 3263ffe57424Smrg # 3264ffe57424Smrg if $am_use_python_sys; then # using python sys.exec_prefix, not GNU 3265ffe57424Smrg AC_CACHE_CHECK([for python default $am_display_PYTHON exec_prefix], 3266ffe57424Smrg [am_cv_python_exec_prefix], 3267ffe57424Smrg [am_cv_python_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`]) 3268ffe57424Smrg dnl If sys.exec_prefix is a subdir of $exec_prefix, replace the 3269ffe57424Smrg dnl literal value of $exec_prefix with a variable reference so it can 3270ffe57424Smrg dnl be overridden. 3271ffe57424Smrg case $am_cv_python_exec_prefix in 3272ffe57424Smrg $am__usable_exec_prefix*) 3273ffe57424Smrg am__strip_prefix=`echo "$am__usable_exec_prefix" | sed 's|.|.|g'` 3274ffe57424Smrg am_python_exec_prefix_subst=`echo "$am_cv_python_exec_prefix" | sed "s,^$am__strip_prefix,\\${exec_prefix},"` 3275ffe57424Smrg ;; 3276ffe57424Smrg *) 3277ffe57424Smrg am_python_exec_prefix_subst=$am_cv_python_exec_prefix 3278ffe57424Smrg ;; 3279ffe57424Smrg esac 3280ffe57424Smrg else # using GNU $exec_prefix, not python sys.exec_prefix 3281ffe57424Smrg am_python_exec_prefix_subst='${exec_prefix}' 3282ffe57424Smrg am_python_exec_prefix=$am_python_exec_prefix_subst 3283ffe57424Smrg AC_MSG_CHECKING([for GNU default $am_display_PYTHON exec_prefix]) 3284ffe57424Smrg AC_MSG_RESULT([$am_python_exec_prefix]) 3285ffe57424Smrg fi])]) 3286ffe57424Smrg # Substituting python_exec_prefix_subst. 3287ffe57424Smrg AC_SUBST([PYTHON_EXEC_PREFIX], [$am_python_exec_prefix_subst]) 3288ffe57424Smrg 3289ffe57424Smrg # Factor out some code duplication into this shell variable. 32905395ea76Smrg am_python_setup_sysconfig="\ 32915395ea76Smrgimport sys 32925395ea76Smrg# Prefer sysconfig over distutils.sysconfig, for better compatibility 32935395ea76Smrg# with python 3.x. See automake bug#10227. 32945395ea76Smrgtry: 32955395ea76Smrg import sysconfig 32965395ea76Smrgexcept ImportError: 32975395ea76Smrg can_use_sysconfig = 0 32985395ea76Smrgelse: 32995395ea76Smrg can_use_sysconfig = 1 33005395ea76Smrg# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: 33015395ea76Smrg# <https://github.com/pypa/virtualenv/issues/118> 33025395ea76Smrgtry: 33035395ea76Smrg from platform import python_implementation 33045395ea76Smrg if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7': 33055395ea76Smrg can_use_sysconfig = 0 33065395ea76Smrgexcept ImportError: 33075395ea76Smrg pass" 33085395ea76Smrg 3309ffe57424Smrg dnl emacs-page Set up 4 directories: 33105395ea76Smrg 3311ffe57424Smrg dnl 1. pythondir: where to install python scripts. This is the 3312ffe57424Smrg dnl site-packages directory, not the python standard library 3313ffe57424Smrg dnl directory like in previous automake betas. This behavior 3314ffe57424Smrg dnl is more consistent with lispdir.m4 for example. 33155395ea76Smrg dnl Query distutils for this directory. 3316ffe57424Smrg dnl 3317ffe57424Smrg AC_CACHE_CHECK([for $am_display_PYTHON script directory (pythondir)], 3318ffe57424Smrg [am_cv_python_pythondir], 3319ffe57424Smrg [if test "x$am_cv_python_prefix" = x; then 3320ffe57424Smrg am_py_prefix=$am__usable_prefix 3321ffe57424Smrg else 3322ffe57424Smrg am_py_prefix=$am_cv_python_prefix 3323ffe57424Smrg fi 3324ffe57424Smrg am_cv_python_pythondir=`$PYTHON -c " 33255395ea76Smrg$am_python_setup_sysconfig 33265395ea76Smrgif can_use_sysconfig: 3327ffe57424Smrg sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) 33285395ea76Smrgelse: 3329ffe57424Smrg from distutils import sysconfig 3330ffe57424Smrg sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') 33315395ea76Smrgsys.stdout.write(sitedir)"` 3332ffe57424Smrg # 3333ffe57424Smrg case $am_cv_python_pythondir in 3334ffe57424Smrg $am_py_prefix*) 3335ffe57424Smrg am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` 3336ffe57424Smrg am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,\\${PYTHON_PREFIX},"` 3337ffe57424Smrg ;; 3338ffe57424Smrg *) 3339ffe57424Smrg case $am_py_prefix in 3340ffe57424Smrg /usr|/System*) ;; 3341ffe57424Smrg *) am_cv_python_pythondir="\${PYTHON_PREFIX}/lib/python$PYTHON_VERSION/site-packages" 3342ffe57424Smrg ;; 33435395ea76Smrg esac 3344ffe57424Smrg ;; 3345ffe57424Smrg esac 3346ffe57424Smrg ]) 33475395ea76Smrg AC_SUBST([pythondir], [$am_cv_python_pythondir]) 33485395ea76Smrg 3349ffe57424Smrg dnl 2. pkgpythondir: $PACKAGE directory under pythondir. Was 3350ffe57424Smrg dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is 3351ffe57424Smrg dnl more consistent with the rest of automake. 3352ffe57424Smrg dnl 33535395ea76Smrg AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) 33545395ea76Smrg 3355ffe57424Smrg dnl 3. pyexecdir: directory for installing python extension modules 3356ffe57424Smrg dnl (shared libraries). 33575395ea76Smrg dnl Query distutils for this directory. 3358ffe57424Smrg dnl 3359ffe57424Smrg AC_CACHE_CHECK([for $am_display_PYTHON extension module directory (pyexecdir)], 3360ffe57424Smrg [am_cv_python_pyexecdir], 3361ffe57424Smrg [if test "x$am_cv_python_exec_prefix" = x; then 3362ffe57424Smrg am_py_exec_prefix=$am__usable_exec_prefix 3363ffe57424Smrg else 3364ffe57424Smrg am_py_exec_prefix=$am_cv_python_exec_prefix 3365ffe57424Smrg fi 3366ffe57424Smrg am_cv_python_pyexecdir=`$PYTHON -c " 33675395ea76Smrg$am_python_setup_sysconfig 33685395ea76Smrgif can_use_sysconfig: 3369ffe57424Smrg sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_exec_prefix'}) 33705395ea76Smrgelse: 3371ffe57424Smrg from distutils import sysconfig 3372ffe57424Smrg sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix') 33735395ea76Smrgsys.stdout.write(sitedir)"` 3374ffe57424Smrg # 3375ffe57424Smrg case $am_cv_python_pyexecdir in 3376ffe57424Smrg $am_py_exec_prefix*) 3377ffe57424Smrg am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` 3378ffe57424Smrg am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,\\${PYTHON_EXEC_PREFIX},"` 3379ffe57424Smrg ;; 3380ffe57424Smrg *) 3381ffe57424Smrg case $am_py_exec_prefix in 3382ffe57424Smrg /usr|/System*) ;; 3383ffe57424Smrg *) am_cv_python_pyexecdir="\${PYTHON_EXEC_PREFIX}/lib/python$PYTHON_VERSION/site-packages" 3384ffe57424Smrg ;; 33855395ea76Smrg esac 3386ffe57424Smrg ;; 3387ffe57424Smrg esac 3388ffe57424Smrg ]) 33895395ea76Smrg AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) 33905395ea76Smrg 3391ffe57424Smrg dnl 4. pkgpyexecdir: $(pyexecdir)/$(PACKAGE) 3392ffe57424Smrg dnl 33935395ea76Smrg AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) 33945395ea76Smrg 33955395ea76Smrg dnl Run any user-specified action. 33965395ea76Smrg $2 33975395ea76Smrg fi 33985395ea76Smrg]) 33995395ea76Smrg 34005395ea76Smrg 34015395ea76Smrg# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) 34025395ea76Smrg# --------------------------------------------------------------------------- 34035395ea76Smrg# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. 34045395ea76Smrg# Run ACTION-IF-FALSE otherwise. 34055395ea76Smrg# This test uses sys.hexversion instead of the string equivalent (first 34065395ea76Smrg# word of sys.version), in order to cope with versions such as 2.2c1. 34075395ea76Smrg# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). 34085395ea76SmrgAC_DEFUN([AM_PYTHON_CHECK_VERSION], 34095395ea76Smrg [prog="import sys 34105395ea76Smrg# split strings by '.' and convert to numeric. Append some zeros 34115395ea76Smrg# because we need at least 4 digits for the hex conversion. 34125395ea76Smrg# map returns an iterator in Python 3.0 and a list in 2.x 34135395ea76Smrgminver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] 34145395ea76Smrgminverhex = 0 34155395ea76Smrg# xrange is not present in Python 3.0 and range returns an iterator 34165395ea76Smrgfor i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] 34175395ea76Smrgsys.exit(sys.hexversion < minverhex)" 34185395ea76Smrg AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) 34195395ea76Smrg 3420ffe57424Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc. 342117ca54c3Smrg# 342217ca54c3Smrg# This file is free software; the Free Software Foundation 342317ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 342417ca54c3Smrg# with or without modifications, as long as this notice is preserved. 342517ca54c3Smrg 342617ca54c3Smrg# AM_RUN_LOG(COMMAND) 342717ca54c3Smrg# ------------------- 342817ca54c3Smrg# Run COMMAND, save the exit status in ac_status, and log it. 342917ca54c3Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) 343017ca54c3SmrgAC_DEFUN([AM_RUN_LOG], 343117ca54c3Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD 343217ca54c3Smrg ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD 343317ca54c3Smrg ac_status=$? 343417ca54c3Smrg echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD 343517ca54c3Smrg (exit $ac_status); }]) 343617ca54c3Smrg 343717ca54c3Smrg# Check to make sure that the build environment is sane. -*- Autoconf -*- 343817ca54c3Smrg 3439ffe57424Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 344017ca54c3Smrg# 344117ca54c3Smrg# This file is free software; the Free Software Foundation 344217ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 344317ca54c3Smrg# with or without modifications, as long as this notice is preserved. 344417ca54c3Smrg 344517ca54c3Smrg# AM_SANITY_CHECK 344617ca54c3Smrg# --------------- 344717ca54c3SmrgAC_DEFUN([AM_SANITY_CHECK], 344817ca54c3Smrg[AC_MSG_CHECKING([whether build environment is sane]) 344917ca54c3Smrg# Reject unsafe characters in $srcdir or the absolute working directory 345017ca54c3Smrg# name. Accept space and tab only in the latter. 345117ca54c3Smrgam_lf=' 345217ca54c3Smrg' 345317ca54c3Smrgcase `pwd` in 345417ca54c3Smrg *[[\\\"\#\$\&\'\`$am_lf]]*) 345517ca54c3Smrg AC_MSG_ERROR([unsafe absolute working directory name]);; 345617ca54c3Smrgesac 345717ca54c3Smrgcase $srcdir in 345817ca54c3Smrg *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) 345917ca54c3Smrg AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; 346017ca54c3Smrgesac 346117ca54c3Smrg 346217ca54c3Smrg# Do 'set' in a subshell so we don't clobber the current shell's 346317ca54c3Smrg# arguments. Must try -L first in case configure is actually a 346417ca54c3Smrg# symlink; some systems play weird games with the mod time of symlinks 346517ca54c3Smrg# (eg FreeBSD returns the mod time of the symlink's containing 346617ca54c3Smrg# directory). 346717ca54c3Smrgif ( 346817ca54c3Smrg am_has_slept=no 346917ca54c3Smrg for am_try in 1 2; do 347017ca54c3Smrg echo "timestamp, slept: $am_has_slept" > conftest.file 347117ca54c3Smrg set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` 347217ca54c3Smrg if test "$[*]" = "X"; then 347317ca54c3Smrg # -L didn't work. 347417ca54c3Smrg set X `ls -t "$srcdir/configure" conftest.file` 347517ca54c3Smrg fi 347617ca54c3Smrg if test "$[*]" != "X $srcdir/configure conftest.file" \ 347717ca54c3Smrg && test "$[*]" != "X conftest.file $srcdir/configure"; then 347817ca54c3Smrg 347917ca54c3Smrg # If neither matched, then we have a broken ls. This can happen 348017ca54c3Smrg # if, for instance, CONFIG_SHELL is bash and it inherits a 348117ca54c3Smrg # broken ls alias from the environment. This has actually 348217ca54c3Smrg # happened. Such a system could not be considered "sane". 348317ca54c3Smrg AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken 348417ca54c3Smrg alias in your environment]) 348517ca54c3Smrg fi 348617ca54c3Smrg if test "$[2]" = conftest.file || test $am_try -eq 2; then 348717ca54c3Smrg break 348817ca54c3Smrg fi 348917ca54c3Smrg # Just in case. 349017ca54c3Smrg sleep 1 349117ca54c3Smrg am_has_slept=yes 349217ca54c3Smrg done 349317ca54c3Smrg test "$[2]" = conftest.file 349417ca54c3Smrg ) 349517ca54c3Smrgthen 349617ca54c3Smrg # Ok. 349717ca54c3Smrg : 349817ca54c3Smrgelse 349917ca54c3Smrg AC_MSG_ERROR([newly created file is older than distributed files! 350017ca54c3SmrgCheck your system clock]) 350117ca54c3Smrgfi 350217ca54c3SmrgAC_MSG_RESULT([yes]) 350317ca54c3Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and 350417ca54c3Smrg# generated files are strictly newer. 350517ca54c3Smrgam_sleep_pid= 350617ca54c3Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then 350717ca54c3Smrg ( sleep 1 ) & 350817ca54c3Smrg am_sleep_pid=$! 350917ca54c3Smrgfi 351017ca54c3SmrgAC_CONFIG_COMMANDS_PRE( 351117ca54c3Smrg [AC_MSG_CHECKING([that generated files are newer than configure]) 351217ca54c3Smrg if test -n "$am_sleep_pid"; then 351317ca54c3Smrg # Hide warnings about reused PIDs. 351417ca54c3Smrg wait $am_sleep_pid 2>/dev/null 351517ca54c3Smrg fi 351617ca54c3Smrg AC_MSG_RESULT([done])]) 351717ca54c3Smrgrm -f conftest.file 351817ca54c3Smrg]) 351917ca54c3Smrg 3520ffe57424Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc. 352117ca54c3Smrg# 352217ca54c3Smrg# This file is free software; the Free Software Foundation 352317ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 352417ca54c3Smrg# with or without modifications, as long as this notice is preserved. 352517ca54c3Smrg 352617ca54c3Smrg# AM_SILENT_RULES([DEFAULT]) 352717ca54c3Smrg# -------------------------- 352817ca54c3Smrg# Enable less verbose build rules; with the default set to DEFAULT 352917ca54c3Smrg# ("yes" being less verbose, "no" or empty being verbose). 353017ca54c3SmrgAC_DEFUN([AM_SILENT_RULES], 353117ca54c3Smrg[AC_ARG_ENABLE([silent-rules], [dnl 353217ca54c3SmrgAS_HELP_STRING( 353317ca54c3Smrg [--enable-silent-rules], 353417ca54c3Smrg [less verbose build output (undo: "make V=1")]) 353517ca54c3SmrgAS_HELP_STRING( 353617ca54c3Smrg [--disable-silent-rules], 353717ca54c3Smrg [verbose build output (undo: "make V=0")])dnl 353817ca54c3Smrg]) 353917ca54c3Smrgcase $enable_silent_rules in @%:@ ((( 354017ca54c3Smrg yes) AM_DEFAULT_VERBOSITY=0;; 354117ca54c3Smrg no) AM_DEFAULT_VERBOSITY=1;; 354217ca54c3Smrg *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; 354317ca54c3Smrgesac 354417ca54c3Smrgdnl 354517ca54c3Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep) 354617ca54c3Smrgdnl do not support nested variable expansions. 354717ca54c3Smrgdnl See automake bug#9928 and bug#10237. 354817ca54c3Smrgam_make=${MAKE-make} 354917ca54c3SmrgAC_CACHE_CHECK([whether $am_make supports nested variables], 355017ca54c3Smrg [am_cv_make_support_nested_variables], 355117ca54c3Smrg [if AS_ECHO([['TRUE=$(BAR$(V)) 355217ca54c3SmrgBAR0=false 355317ca54c3SmrgBAR1=true 355417ca54c3SmrgV=1 355517ca54c3Smrgam__doit: 355617ca54c3Smrg @$(TRUE) 355717ca54c3Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then 355817ca54c3Smrg am_cv_make_support_nested_variables=yes 355917ca54c3Smrgelse 356017ca54c3Smrg am_cv_make_support_nested_variables=no 356117ca54c3Smrgfi]) 356217ca54c3Smrgif test $am_cv_make_support_nested_variables = yes; then 356317ca54c3Smrg dnl Using '$V' instead of '$(V)' breaks IRIX make. 356417ca54c3Smrg AM_V='$(V)' 356517ca54c3Smrg AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' 356617ca54c3Smrgelse 356717ca54c3Smrg AM_V=$AM_DEFAULT_VERBOSITY 356817ca54c3Smrg AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY 356917ca54c3Smrgfi 357017ca54c3SmrgAC_SUBST([AM_V])dnl 357117ca54c3SmrgAM_SUBST_NOTMAKE([AM_V])dnl 357217ca54c3SmrgAC_SUBST([AM_DEFAULT_V])dnl 357317ca54c3SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl 357417ca54c3SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl 357517ca54c3SmrgAM_BACKSLASH='\' 357617ca54c3SmrgAC_SUBST([AM_BACKSLASH])dnl 357717ca54c3Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl 357817ca54c3Smrg]) 357917ca54c3Smrg 3580ffe57424Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc. 358117ca54c3Smrg# 358217ca54c3Smrg# This file is free software; the Free Software Foundation 358317ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 358417ca54c3Smrg# with or without modifications, as long as this notice is preserved. 358517ca54c3Smrg 358617ca54c3Smrg# AM_PROG_INSTALL_STRIP 358717ca54c3Smrg# --------------------- 358817ca54c3Smrg# One issue with vendor 'install' (even GNU) is that you can't 358917ca54c3Smrg# specify the program used to strip binaries. This is especially 359017ca54c3Smrg# annoying in cross-compiling environments, where the build's strip 359117ca54c3Smrg# is unlikely to handle the host's binaries. 359217ca54c3Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we 359317ca54c3Smrg# always use install-sh in "make install-strip", and initialize 359417ca54c3Smrg# STRIPPROG with the value of the STRIP variable (set by the user). 359517ca54c3SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP], 359617ca54c3Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl 359717ca54c3Smrg# Installed binaries are usually stripped using 'strip' when the user 359817ca54c3Smrg# run "make install-strip". However 'strip' might not be the right 359917ca54c3Smrg# tool to use in cross-compilation environments, therefore Automake 360017ca54c3Smrg# will honor the 'STRIP' environment variable to overrule this program. 360117ca54c3Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'. 360217ca54c3Smrgif test "$cross_compiling" != no; then 360317ca54c3Smrg AC_CHECK_TOOL([STRIP], [strip], :) 360417ca54c3Smrgfi 360517ca54c3SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" 360617ca54c3SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])]) 360717ca54c3Smrg 3608ffe57424Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc. 360917ca54c3Smrg# 361017ca54c3Smrg# This file is free software; the Free Software Foundation 361117ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 361217ca54c3Smrg# with or without modifications, as long as this notice is preserved. 361317ca54c3Smrg 361417ca54c3Smrg# _AM_SUBST_NOTMAKE(VARIABLE) 361517ca54c3Smrg# --------------------------- 361617ca54c3Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. 361717ca54c3Smrg# This macro is traced by Automake. 361817ca54c3SmrgAC_DEFUN([_AM_SUBST_NOTMAKE]) 361917ca54c3Smrg 362017ca54c3Smrg# AM_SUBST_NOTMAKE(VARIABLE) 362117ca54c3Smrg# -------------------------- 362217ca54c3Smrg# Public sister of _AM_SUBST_NOTMAKE. 362317ca54c3SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) 362417ca54c3Smrg 362517ca54c3Smrg# Check how to create a tarball. -*- Autoconf -*- 362617ca54c3Smrg 3627ffe57424Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc. 362817ca54c3Smrg# 362917ca54c3Smrg# This file is free software; the Free Software Foundation 363017ca54c3Smrg# gives unlimited permission to copy and/or distribute it, 363117ca54c3Smrg# with or without modifications, as long as this notice is preserved. 363217ca54c3Smrg 363317ca54c3Smrg# _AM_PROG_TAR(FORMAT) 363417ca54c3Smrg# -------------------- 363517ca54c3Smrg# Check how to create a tarball in format FORMAT. 363617ca54c3Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'. 363717ca54c3Smrg# 363817ca54c3Smrg# Substitute a variable $(am__tar) that is a command 363917ca54c3Smrg# writing to stdout a FORMAT-tarball containing the directory 364017ca54c3Smrg# $tardir. 364117ca54c3Smrg# tardir=directory && $(am__tar) > result.tar 364217ca54c3Smrg# 364317ca54c3Smrg# Substitute a variable $(am__untar) that extract such 364417ca54c3Smrg# a tarball read from stdin. 364517ca54c3Smrg# $(am__untar) < result.tar 364617ca54c3Smrg# 364717ca54c3SmrgAC_DEFUN([_AM_PROG_TAR], 364817ca54c3Smrg[# Always define AMTAR for backward compatibility. Yes, it's still used 364917ca54c3Smrg# in the wild :-( We should find a proper way to deprecate it ... 365017ca54c3SmrgAC_SUBST([AMTAR], ['$${TAR-tar}']) 365117ca54c3Smrg 365217ca54c3Smrg# We'll loop over all known methods to create a tar archive until one works. 365317ca54c3Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' 365417ca54c3Smrg 365517ca54c3Smrgm4_if([$1], [v7], 365617ca54c3Smrg [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], 365717ca54c3Smrg 365817ca54c3Smrg [m4_case([$1], 365917ca54c3Smrg [ustar], 366017ca54c3Smrg [# The POSIX 1988 'ustar' format is defined with fixed-size fields. 366117ca54c3Smrg # There is notably a 21 bits limit for the UID and the GID. In fact, 366217ca54c3Smrg # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 366317ca54c3Smrg # and bug#13588). 366417ca54c3Smrg am_max_uid=2097151 # 2^21 - 1 366517ca54c3Smrg am_max_gid=$am_max_uid 366617ca54c3Smrg # The $UID and $GID variables are not portable, so we need to resort 366717ca54c3Smrg # to the POSIX-mandated id(1) utility. Errors in the 'id' calls 366817ca54c3Smrg # below are definitely unexpected, so allow the users to see them 366917ca54c3Smrg # (that is, avoid stderr redirection). 367017ca54c3Smrg am_uid=`id -u || echo unknown` 367117ca54c3Smrg am_gid=`id -g || echo unknown` 367217ca54c3Smrg AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) 367317ca54c3Smrg if test $am_uid -le $am_max_uid; then 367417ca54c3Smrg AC_MSG_RESULT([yes]) 367517ca54c3Smrg else 367617ca54c3Smrg AC_MSG_RESULT([no]) 367717ca54c3Smrg _am_tools=none 367817ca54c3Smrg fi 367917ca54c3Smrg AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) 368017ca54c3Smrg if test $am_gid -le $am_max_gid; then 368117ca54c3Smrg AC_MSG_RESULT([yes]) 368217ca54c3Smrg else 368317ca54c3Smrg AC_MSG_RESULT([no]) 368417ca54c3Smrg _am_tools=none 368517ca54c3Smrg fi], 368617ca54c3Smrg 368717ca54c3Smrg [pax], 368817ca54c3Smrg [], 368917ca54c3Smrg 369017ca54c3Smrg [m4_fatal([Unknown tar format])]) 369117ca54c3Smrg 369217ca54c3Smrg AC_MSG_CHECKING([how to create a $1 tar archive]) 369317ca54c3Smrg 369417ca54c3Smrg # Go ahead even if we have the value already cached. We do so because we 369517ca54c3Smrg # need to set the values for the 'am__tar' and 'am__untar' variables. 369617ca54c3Smrg _am_tools=${am_cv_prog_tar_$1-$_am_tools} 369717ca54c3Smrg 369817ca54c3Smrg for _am_tool in $_am_tools; do 369917ca54c3Smrg case $_am_tool in 370017ca54c3Smrg gnutar) 370117ca54c3Smrg for _am_tar in tar gnutar gtar; do 370217ca54c3Smrg AM_RUN_LOG([$_am_tar --version]) && break 370317ca54c3Smrg done 370417ca54c3Smrg am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' 370517ca54c3Smrg am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' 370617ca54c3Smrg am__untar="$_am_tar -xf -" 370717ca54c3Smrg ;; 370817ca54c3Smrg plaintar) 370917ca54c3Smrg # Must skip GNU tar: if it does not support --format= it doesn't create 371017ca54c3Smrg # ustar tarball either. 371117ca54c3Smrg (tar --version) >/dev/null 2>&1 && continue 371217ca54c3Smrg am__tar='tar chf - "$$tardir"' 371317ca54c3Smrg am__tar_='tar chf - "$tardir"' 371417ca54c3Smrg am__untar='tar xf -' 371517ca54c3Smrg ;; 371617ca54c3Smrg pax) 371717ca54c3Smrg am__tar='pax -L -x $1 -w "$$tardir"' 371817ca54c3Smrg am__tar_='pax -L -x $1 -w "$tardir"' 371917ca54c3Smrg am__untar='pax -r' 372017ca54c3Smrg ;; 372117ca54c3Smrg cpio) 372217ca54c3Smrg am__tar='find "$$tardir" -print | cpio -o -H $1 -L' 372317ca54c3Smrg am__tar_='find "$tardir" -print | cpio -o -H $1 -L' 372417ca54c3Smrg am__untar='cpio -i -H $1 -d' 372517ca54c3Smrg ;; 372617ca54c3Smrg none) 372717ca54c3Smrg am__tar=false 372817ca54c3Smrg am__tar_=false 372917ca54c3Smrg am__untar=false 373017ca54c3Smrg ;; 373117ca54c3Smrg esac 373217ca54c3Smrg 373317ca54c3Smrg # If the value was cached, stop now. We just wanted to have am__tar 373417ca54c3Smrg # and am__untar set. 373517ca54c3Smrg test -n "${am_cv_prog_tar_$1}" && break 373617ca54c3Smrg 373717ca54c3Smrg # tar/untar a dummy directory, and stop if the command works. 373817ca54c3Smrg rm -rf conftest.dir 373917ca54c3Smrg mkdir conftest.dir 374017ca54c3Smrg echo GrepMe > conftest.dir/file 374117ca54c3Smrg AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) 374217ca54c3Smrg rm -rf conftest.dir 374317ca54c3Smrg if test -s conftest.tar; then 374417ca54c3Smrg AM_RUN_LOG([$am__untar <conftest.tar]) 374517ca54c3Smrg AM_RUN_LOG([cat conftest.dir/file]) 374617ca54c3Smrg grep GrepMe conftest.dir/file >/dev/null 2>&1 && break 374717ca54c3Smrg fi 374817ca54c3Smrg done 374917ca54c3Smrg rm -rf conftest.dir 375017ca54c3Smrg 375117ca54c3Smrg AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) 375217ca54c3Smrg AC_MSG_RESULT([$am_cv_prog_tar_$1])]) 375317ca54c3Smrg 375417ca54c3SmrgAC_SUBST([am__tar]) 375517ca54c3SmrgAC_SUBST([am__untar]) 375617ca54c3Smrg]) # _AM_PROG_TAR 375717ca54c3Smrg 3758