aclocal.m4 revision e8340fab
1e8340fabSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*- 2e1670675Smrg 3e8340fabSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 4129be1b7Smrg 5129be1b7Smrg# This file is free software; the Free Software Foundation 6129be1b7Smrg# gives unlimited permission to copy and/or distribute it, 7129be1b7Smrg# with or without modifications, as long as this notice is preserved. 8129be1b7Smrg 9129be1b7Smrg# This program is distributed in the hope that it will be useful, 10129be1b7Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without 11129be1b7Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A 12129be1b7Smrg# PARTICULAR PURPOSE. 13129be1b7Smrg 14e1670675Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) 15a9a39c43Smrgm4_ifndef([AC_AUTOCONF_VERSION], 16a9a39c43Smrg [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl 17e8340fabSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, 18e8340fabSmrg[m4_warning([this file was generated for autoconf 2.71. 19a9a39c43SmrgYou have another version of autoconf. It may work, but is not guaranteed to. 20a9a39c43SmrgIf you have problems, you may need to regenerate the build system entirely. 21e1670675SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])]) 22129be1b7Smrg 23e8340fabSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc. 24e8340fabSmrg# 25e8340fabSmrg# This file is free software; the Free Software Foundation 26e8340fabSmrg# gives unlimited permission to copy and/or distribute it, 27e8340fabSmrg# with or without modifications, as long as this notice is preserved. 28129be1b7Smrg 29e8340fabSmrg# AM_AUTOMAKE_VERSION(VERSION) 30e8340fabSmrg# ---------------------------- 31e8340fabSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been 32e8340fabSmrg# generated from the m4 files accompanying Automake X.Y. 33e8340fabSmrg# (This private macro should not be called outside this file.) 34e8340fabSmrgAC_DEFUN([AM_AUTOMAKE_VERSION], 35e8340fabSmrg[am__api_version='1.16' 36e8340fabSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to 37e8340fabSmrgdnl require some minimum version. Point them to the right macro. 38e8340fabSmrgm4_if([$1], [1.16.5], [], 39e8340fabSmrg [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl 40e8340fabSmrg]) 41129be1b7Smrg 42e8340fabSmrg# _AM_AUTOCONF_VERSION(VERSION) 43e8340fabSmrg# ----------------------------- 44e8340fabSmrg# aclocal traces this macro to find the Autoconf version. 45e8340fabSmrg# This is a private macro too. Using m4_define simplifies 46e8340fabSmrg# the logic in aclocal, which can simply ignore this definition. 47e8340fabSmrgm4_define([_AM_AUTOCONF_VERSION], []) 48129be1b7Smrg 49e8340fabSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION 50e8340fabSmrg# ------------------------------- 51e8340fabSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. 52e8340fabSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. 53e8340fabSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], 54e8340fabSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl 55e8340fabSmrgm4_ifndef([AC_AUTOCONF_VERSION], 56e8340fabSmrg [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl 57e8340fabSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) 58129be1b7Smrg 59e8340fabSmrg# AM_AUX_DIR_EXPAND -*- Autoconf -*- 60129be1b7Smrg 61e8340fabSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc. 62e8340fabSmrg# 63e8340fabSmrg# This file is free software; the Free Software Foundation 64e8340fabSmrg# gives unlimited permission to copy and/or distribute it, 65e8340fabSmrg# with or without modifications, as long as this notice is preserved. 66129be1b7Smrg 67e8340fabSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets 68e8340fabSmrg# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to 69e8340fabSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'. 70e8340fabSmrg# 71e8340fabSmrg# Of course, Automake must honor this variable whenever it calls a 72e8340fabSmrg# tool from the auxiliary directory. The problem is that $srcdir (and 73e8340fabSmrg# therefore $ac_aux_dir as well) can be either absolute or relative, 74e8340fabSmrg# depending on how configure is run. This is pretty annoying, since 75e8340fabSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top 76e8340fabSmrg# source directory, any form will work fine, but in subdirectories a 77e8340fabSmrg# relative path needs to be adjusted first. 78e8340fabSmrg# 79e8340fabSmrg# $ac_aux_dir/missing 80e8340fabSmrg# fails when called from a subdirectory if $ac_aux_dir is relative 81e8340fabSmrg# $top_srcdir/$ac_aux_dir/missing 82e8340fabSmrg# fails if $ac_aux_dir is absolute, 83e8340fabSmrg# fails when called from a subdirectory in a VPATH build with 84e8340fabSmrg# a relative $ac_aux_dir 85e8340fabSmrg# 86e8340fabSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir 87e8340fabSmrg# are both prefixed by $srcdir. In an in-source build this is usually 88e8340fabSmrg# harmless because $srcdir is '.', but things will broke when you 89e8340fabSmrg# start a VPATH build or use an absolute $srcdir. 90e8340fabSmrg# 91e8340fabSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, 92e8340fabSmrg# iff we strip the leading $srcdir from $ac_aux_dir. That would be: 93e8340fabSmrg# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` 94e8340fabSmrg# and then we would define $MISSING as 95e8340fabSmrg# MISSING="\${SHELL} $am_aux_dir/missing" 96e8340fabSmrg# This will work as long as MISSING is not called from configure, because 97e8340fabSmrg# unfortunately $(top_srcdir) has no meaning in configure. 98e8340fabSmrg# However there are other variables, like CC, which are often used in 99e8340fabSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir. 100e8340fabSmrg# 101e8340fabSmrg# Another solution, used here, is to always expand $ac_aux_dir to an 102e8340fabSmrg# absolute PATH. The drawback is that using absolute paths prevent a 103e8340fabSmrg# configured tree to be moved without reconfiguration. 104129be1b7Smrg 105e8340fabSmrgAC_DEFUN([AM_AUX_DIR_EXPAND], 106e8340fabSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl 107e8340fabSmrg# Expand $ac_aux_dir to an absolute path. 108e8340fabSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd` 109e8340fabSmrg]) 110129be1b7Smrg 111e8340fabSmrg# Do all the work for Automake. -*- Autoconf -*- 112129be1b7Smrg 113e8340fabSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 114e8340fabSmrg# 115e8340fabSmrg# This file is free software; the Free Software Foundation 116e8340fabSmrg# gives unlimited permission to copy and/or distribute it, 117e8340fabSmrg# with or without modifications, as long as this notice is preserved. 118129be1b7Smrg 119e8340fabSmrg# This macro actually does too much. Some checks are only needed if 120e8340fabSmrg# your package does certain things. But this isn't really a big deal. 121129be1b7Smrg 122e8340fabSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. 123e8340fabSmrgm4_define([AC_PROG_CC], 124e8340fabSmrgm4_defn([AC_PROG_CC]) 125e8340fabSmrg[_AM_PROG_CC_C_O 126e8340fabSmrg]) 127129be1b7Smrg 128e8340fabSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) 129e8340fabSmrg# AM_INIT_AUTOMAKE([OPTIONS]) 130e8340fabSmrg# ----------------------------------------------- 131e8340fabSmrg# The call with PACKAGE and VERSION arguments is the old style 132e8340fabSmrg# call (pre autoconf-2.50), which is being phased out. PACKAGE 133e8340fabSmrg# and VERSION should now be passed to AC_INIT and removed from 134e8340fabSmrg# the call to AM_INIT_AUTOMAKE. 135e8340fabSmrg# We support both call styles for the transition. After 136e8340fabSmrg# the next Automake release, Autoconf can make the AC_INIT 137e8340fabSmrg# arguments mandatory, and then we can depend on a new Autoconf 138e8340fabSmrg# release and drop the old call support. 139e8340fabSmrgAC_DEFUN([AM_INIT_AUTOMAKE], 140e8340fabSmrg[AC_PREREQ([2.65])dnl 141e8340fabSmrgm4_ifdef([_$0_ALREADY_INIT], 142e8340fabSmrg [m4_fatal([$0 expanded multiple times 143e8340fabSmrg]m4_defn([_$0_ALREADY_INIT]))], 144e8340fabSmrg [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl 145e8340fabSmrgdnl Autoconf wants to disallow AM_ names. We explicitly allow 146e8340fabSmrgdnl the ones we care about. 147e8340fabSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl 148e8340fabSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl 149e8340fabSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl 150e8340fabSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then 151e8340fabSmrg # Use -I$(srcdir) only when $(srcdir) != ., so that make's output 152e8340fabSmrg # is not polluted with repeated "-I." 153e8340fabSmrg AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl 154e8340fabSmrg # test to see if srcdir already configured 155e8340fabSmrg if test -f $srcdir/config.status; then 156e8340fabSmrg AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) 157e8340fabSmrg fi 158e8340fabSmrgfi 159129be1b7Smrg 160e8340fabSmrg# test whether we have cygpath 161e8340fabSmrgif test -z "$CYGPATH_W"; then 162e8340fabSmrg if (cygpath --version) >/dev/null 2>/dev/null; then 163e8340fabSmrg CYGPATH_W='cygpath -w' 164e8340fabSmrg else 165e8340fabSmrg CYGPATH_W=echo 166e8340fabSmrg fi 167e8340fabSmrgfi 168e8340fabSmrgAC_SUBST([CYGPATH_W]) 169129be1b7Smrg 170e8340fabSmrg# Define the identity of the package. 171e8340fabSmrgdnl Distinguish between old-style and new-style calls. 172e8340fabSmrgm4_ifval([$2], 173e8340fabSmrg[AC_DIAGNOSE([obsolete], 174e8340fabSmrg [$0: two- and three-arguments forms are deprecated.]) 175e8340fabSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl 176e8340fabSmrg AC_SUBST([PACKAGE], [$1])dnl 177e8340fabSmrg AC_SUBST([VERSION], [$2])], 178e8340fabSmrg[_AM_SET_OPTIONS([$1])dnl 179e8340fabSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. 180e8340fabSmrgm4_if( 181e8340fabSmrg m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), 182e8340fabSmrg [ok:ok],, 183e8340fabSmrg [m4_fatal([AC_INIT should be called with package and version arguments])])dnl 184e8340fabSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl 185e8340fabSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl 186129be1b7Smrg 187e8340fabSmrg_AM_IF_OPTION([no-define],, 188e8340fabSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) 189e8340fabSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl 190129be1b7Smrg 191e8340fabSmrg# Some tools Automake needs. 192e8340fabSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl 193e8340fabSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl 194e8340fabSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) 195e8340fabSmrgAM_MISSING_PROG([AUTOCONF], [autoconf]) 196e8340fabSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) 197e8340fabSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader]) 198e8340fabSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo]) 199e8340fabSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl 200e8340fabSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl 201e8340fabSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl 202e8340fabSmrg# For better backward compatibility. To be removed once Automake 1.9.x 203e8340fabSmrg# dies out for good. For more background, see: 204e8340fabSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> 205e8340fabSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> 206e8340fabSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)']) 207e8340fabSmrg# We need awk for the "check" target (and possibly the TAP driver). The 208e8340fabSmrg# system "awk" is bad on some platforms. 209e8340fabSmrgAC_REQUIRE([AC_PROG_AWK])dnl 210e8340fabSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl 211e8340fabSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl 212e8340fabSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], 213e8340fabSmrg [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], 214e8340fabSmrg [_AM_PROG_TAR([v7])])]) 215e8340fabSmrg_AM_IF_OPTION([no-dependencies],, 216e8340fabSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC], 217e8340fabSmrg [_AM_DEPENDENCIES([CC])], 218e8340fabSmrg [m4_define([AC_PROG_CC], 219e8340fabSmrg m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl 220e8340fabSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX], 221e8340fabSmrg [_AM_DEPENDENCIES([CXX])], 222e8340fabSmrg [m4_define([AC_PROG_CXX], 223e8340fabSmrg m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl 224e8340fabSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC], 225e8340fabSmrg [_AM_DEPENDENCIES([OBJC])], 226e8340fabSmrg [m4_define([AC_PROG_OBJC], 227e8340fabSmrg m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl 228e8340fabSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX], 229e8340fabSmrg [_AM_DEPENDENCIES([OBJCXX])], 230e8340fabSmrg [m4_define([AC_PROG_OBJCXX], 231e8340fabSmrg m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl 232e8340fabSmrg]) 233e8340fabSmrg# Variables for tags utilities; see am/tags.am 234e8340fabSmrgif test -z "$CTAGS"; then 235e8340fabSmrg CTAGS=ctags 236e8340fabSmrgfi 237e8340fabSmrgAC_SUBST([CTAGS]) 238e8340fabSmrgif test -z "$ETAGS"; then 239e8340fabSmrg ETAGS=etags 240e8340fabSmrgfi 241e8340fabSmrgAC_SUBST([ETAGS]) 242e8340fabSmrgif test -z "$CSCOPE"; then 243e8340fabSmrg CSCOPE=cscope 244e8340fabSmrgfi 245e8340fabSmrgAC_SUBST([CSCOPE]) 246a9a39c43Smrg 247e8340fabSmrgAC_REQUIRE([AM_SILENT_RULES])dnl 248e8340fabSmrgdnl The testsuite driver may need to know about EXEEXT, so add the 249e8340fabSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This 250e8340fabSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. 251e8340fabSmrgAC_CONFIG_COMMANDS_PRE(dnl 252e8340fabSmrg[m4_provide_if([_AM_COMPILER_EXEEXT], 253e8340fabSmrg [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl 254e1670675Smrg 255e8340fabSmrg# POSIX will say in a future version that running "rm -f" with no argument 256e8340fabSmrg# is OK; and we want to be able to make that assumption in our Makefile 257e8340fabSmrg# recipes. So use an aggressive probe to check that the usage we want is 258e8340fabSmrg# actually supported "in the wild" to an acceptable degree. 259e8340fabSmrg# See automake bug#10828. 260e8340fabSmrg# To make any issue more visible, cause the running configure to be aborted 261e8340fabSmrg# by default if the 'rm' program in use doesn't match our expectations; the 262e8340fabSmrg# user can still override this though. 263e8340fabSmrgif rm -f && rm -fr && rm -rf; then : OK; else 264e8340fabSmrg cat >&2 <<'END' 265e8340fabSmrgOops! 266e1670675Smrg 267e8340fabSmrgYour 'rm' program seems unable to run without file operands specified 268e8340fabSmrgon the command line, even when the '-f' option is present. This is contrary 269e8340fabSmrgto the behaviour of most rm programs out there, and not conforming with 270e8340fabSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> 271e1670675Smrg 272e8340fabSmrgPlease tell bug-automake@gnu.org about your system, including the value 273e8340fabSmrgof your $PATH and any error possibly output before this message. This 274e8340fabSmrgcan help us improve future automake versions. 275e1670675Smrg 276e8340fabSmrgEND 277e8340fabSmrg if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then 278e8340fabSmrg echo 'Configuration will proceed anyway, since you have set the' >&2 279e8340fabSmrg echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 280e8340fabSmrg echo >&2 281e8340fabSmrg else 282e8340fabSmrg cat >&2 <<'END' 283e8340fabSmrgAborting the configuration process, to ensure you take notice of the issue. 284129be1b7Smrg 285e8340fabSmrgYou can download and install GNU coreutils to get an 'rm' implementation 286e8340fabSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>. 287129be1b7Smrg 288e8340fabSmrgIf you want to complete the configuration process using your problematic 289e8340fabSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM 290e8340fabSmrgto "yes", and re-run configure. 291a9a39c43Smrg 292e8340fabSmrgEND 293e8340fabSmrg AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) 294e8340fabSmrg fi 295e8340fabSmrgfi 296e8340fabSmrgdnl The trailing newline in this macro's definition is deliberate, for 297e8340fabSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments 298e8340fabSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. 299e8340fabSmrg]) 300a9a39c43Smrg 301e8340fabSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not 302e8340fabSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further 303e8340fabSmrgdnl mangled by Autoconf and run in a shell conditional statement. 304e8340fabSmrgm4_define([_AC_COMPILER_EXEEXT], 305e8340fabSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) 306e8340fabSmrg 307e8340fabSmrg# When config.status generates a header, we must update the stamp-h file. 308e8340fabSmrg# This file resides in the same directory as the config header 309e8340fabSmrg# that is generated. The stamp files are numbered to have different names. 310e8340fabSmrg 311e8340fabSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the 312e8340fabSmrg# loop where config.status creates the headers, so we can generate 313e8340fabSmrg# our stamp files there. 314e8340fabSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], 315e8340fabSmrg[# Compute $1's index in $config_headers. 316e8340fabSmrg_am_arg=$1 317e8340fabSmrg_am_stamp_count=1 318e8340fabSmrgfor _am_header in $config_headers :; do 319e8340fabSmrg case $_am_header in 320e8340fabSmrg $_am_arg | $_am_arg:* ) 321e8340fabSmrg break ;; 322e8340fabSmrg * ) 323e8340fabSmrg _am_stamp_count=`expr $_am_stamp_count + 1` ;; 324e8340fabSmrg esac 325e8340fabSmrgdone 326e8340fabSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) 327e8340fabSmrg 328e8340fabSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc. 329e1670675Smrg# 330e8340fabSmrg# This file is free software; the Free Software Foundation 331e8340fabSmrg# gives unlimited permission to copy and/or distribute it, 332e8340fabSmrg# with or without modifications, as long as this notice is preserved. 333a9a39c43Smrg 334e8340fabSmrg# AM_PROG_INSTALL_SH 335e1670675Smrg# ------------------ 336e8340fabSmrg# Define $install_sh. 337e8340fabSmrgAC_DEFUN([AM_PROG_INSTALL_SH], 338e8340fabSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl 339e8340fabSmrgif test x"${install_sh+set}" != xset; then 340e8340fabSmrg case $am_aux_dir in 341e8340fabSmrg *\ * | *\ *) 342e8340fabSmrg install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; 343e8340fabSmrg *) 344e8340fabSmrg install_sh="\${SHELL} $am_aux_dir/install-sh" 345e8340fabSmrg esac 346e8340fabSmrgfi 347e8340fabSmrgAC_SUBST([install_sh])]) 348e8340fabSmrg 349e8340fabSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc. 350e1670675Smrg# 351e8340fabSmrg# This file is free software; the Free Software Foundation 352e8340fabSmrg# gives unlimited permission to copy and/or distribute it, 353e8340fabSmrg# with or without modifications, as long as this notice is preserved. 354a9a39c43Smrg 355e8340fabSmrg# Check whether the underlying file-system supports filenames 356e8340fabSmrg# with a leading dot. For instance MS-DOS doesn't. 357e8340fabSmrgAC_DEFUN([AM_SET_LEADING_DOT], 358e8340fabSmrg[rm -rf .tst 2>/dev/null 359e8340fabSmrgmkdir .tst 2>/dev/null 360e8340fabSmrgif test -d .tst; then 361e8340fabSmrg am__leading_dot=. 362e1670675Smrgelse 363e8340fabSmrg am__leading_dot=_ 364a9a39c43Smrgfi 365e8340fabSmrgrmdir .tst 2>/dev/null 366e8340fabSmrgAC_SUBST([am__leading_dot])]) 367a9a39c43Smrg 368e8340fabSmrg# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- 369a9a39c43Smrg 370e8340fabSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc. 371a9a39c43Smrg# 372e8340fabSmrg# This file is free software; the Free Software Foundation 373e8340fabSmrg# gives unlimited permission to copy and/or distribute it, 374e8340fabSmrg# with or without modifications, as long as this notice is preserved. 375a9a39c43Smrg 376e8340fabSmrg# AM_MISSING_PROG(NAME, PROGRAM) 377e8340fabSmrg# ------------------------------ 378e8340fabSmrgAC_DEFUN([AM_MISSING_PROG], 379e8340fabSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN]) 380e8340fabSmrg$1=${$1-"${am_missing_run}$2"} 381e8340fabSmrgAC_SUBST($1)]) 382a9a39c43Smrg 383e8340fabSmrg# AM_MISSING_HAS_RUN 384e8340fabSmrg# ------------------ 385e8340fabSmrg# Define MISSING if not defined so far and test if it is modern enough. 386e8340fabSmrg# If it is, set am_missing_run to use it, otherwise, to nothing. 387e8340fabSmrgAC_DEFUN([AM_MISSING_HAS_RUN], 388e8340fabSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl 389e8340fabSmrgAC_REQUIRE_AUX_FILE([missing])dnl 390e8340fabSmrgif test x"${MISSING+set}" != xset; then 391e8340fabSmrg MISSING="\${SHELL} '$am_aux_dir/missing'" 392e1670675Smrgfi 393e8340fabSmrg# Use eval to expand $SHELL 394e8340fabSmrgif eval "$MISSING --is-lightweight"; then 395e8340fabSmrg am_missing_run="$MISSING " 396e8340fabSmrgelse 397e8340fabSmrg am_missing_run= 398e8340fabSmrg AC_MSG_WARN(['missing' script is too old or missing]) 399e1670675Smrgfi 400e8340fabSmrg]) 401a9a39c43Smrg 402e8340fabSmrg# Helper functions for option handling. -*- Autoconf -*- 403a9a39c43Smrg 404e8340fabSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc. 405e8340fabSmrg# 406e8340fabSmrg# This file is free software; the Free Software Foundation 407e8340fabSmrg# gives unlimited permission to copy and/or distribute it, 408e8340fabSmrg# with or without modifications, as long as this notice is preserved. 409a9a39c43Smrg 410e8340fabSmrg# _AM_MANGLE_OPTION(NAME) 411e8340fabSmrg# ----------------------- 412e8340fabSmrgAC_DEFUN([_AM_MANGLE_OPTION], 413e8340fabSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) 414a9a39c43Smrg 415e8340fabSmrg# _AM_SET_OPTION(NAME) 416e8340fabSmrg# -------------------- 417e8340fabSmrg# Set option NAME. Presently that only means defining a flag for this option. 418e8340fabSmrgAC_DEFUN([_AM_SET_OPTION], 419e8340fabSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) 420a9a39c43Smrg 421e8340fabSmrg# _AM_SET_OPTIONS(OPTIONS) 422e8340fabSmrg# ------------------------ 423e8340fabSmrg# OPTIONS is a space-separated list of Automake options. 424e8340fabSmrgAC_DEFUN([_AM_SET_OPTIONS], 425e8340fabSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) 426a9a39c43Smrg 427e8340fabSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) 428e8340fabSmrg# ------------------------------------------- 429e8340fabSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 430e8340fabSmrgAC_DEFUN([_AM_IF_OPTION], 431e8340fabSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) 432a9a39c43Smrg 433e8340fabSmrg# Check to make sure that the build environment is sane. -*- Autoconf -*- 434a9a39c43Smrg 435e8340fabSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 436e1670675Smrg# 437e8340fabSmrg# This file is free software; the Free Software Foundation 438e8340fabSmrg# gives unlimited permission to copy and/or distribute it, 439e8340fabSmrg# with or without modifications, as long as this notice is preserved. 440a9a39c43Smrg 441e8340fabSmrg# AM_SANITY_CHECK 442e8340fabSmrg# --------------- 443e8340fabSmrgAC_DEFUN([AM_SANITY_CHECK], 444e8340fabSmrg[AC_MSG_CHECKING([whether build environment is sane]) 445e8340fabSmrg# Reject unsafe characters in $srcdir or the absolute working directory 446e8340fabSmrg# name. Accept space and tab only in the latter. 447e8340fabSmrgam_lf=' 448e8340fabSmrg' 449e8340fabSmrgcase `pwd` in 450e8340fabSmrg *[[\\\"\#\$\&\'\`$am_lf]]*) 451e8340fabSmrg AC_MSG_ERROR([unsafe absolute working directory name]);; 452e8340fabSmrgesac 453e8340fabSmrgcase $srcdir in 454e8340fabSmrg *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) 455e8340fabSmrg AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; 456e8340fabSmrgesac 457e8340fabSmrg 458e8340fabSmrg# Do 'set' in a subshell so we don't clobber the current shell's 459e8340fabSmrg# arguments. Must try -L first in case configure is actually a 460e8340fabSmrg# symlink; some systems play weird games with the mod time of symlinks 461e8340fabSmrg# (eg FreeBSD returns the mod time of the symlink's containing 462e8340fabSmrg# directory). 463e8340fabSmrgif ( 464e8340fabSmrg am_has_slept=no 465e8340fabSmrg for am_try in 1 2; do 466e8340fabSmrg echo "timestamp, slept: $am_has_slept" > conftest.file 467e8340fabSmrg set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` 468e8340fabSmrg if test "$[*]" = "X"; then 469e8340fabSmrg # -L didn't work. 470e8340fabSmrg set X `ls -t "$srcdir/configure" conftest.file` 471e8340fabSmrg fi 472e8340fabSmrg if test "$[*]" != "X $srcdir/configure conftest.file" \ 473e8340fabSmrg && test "$[*]" != "X conftest.file $srcdir/configure"; then 474e8340fabSmrg 475e8340fabSmrg # If neither matched, then we have a broken ls. This can happen 476e8340fabSmrg # if, for instance, CONFIG_SHELL is bash and it inherits a 477e8340fabSmrg # broken ls alias from the environment. This has actually 478e8340fabSmrg # happened. Such a system could not be considered "sane". 479e8340fabSmrg AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken 480e8340fabSmrg alias in your environment]) 481e8340fabSmrg fi 482e8340fabSmrg if test "$[2]" = conftest.file || test $am_try -eq 2; then 483e8340fabSmrg break 484e8340fabSmrg fi 485e8340fabSmrg # Just in case. 486e8340fabSmrg sleep 1 487e8340fabSmrg am_has_slept=yes 488e8340fabSmrg done 489e8340fabSmrg test "$[2]" = conftest.file 490e8340fabSmrg ) 491e8340fabSmrgthen 492e8340fabSmrg # Ok. 493e8340fabSmrg : 494e1670675Smrgelse 495e8340fabSmrg AC_MSG_ERROR([newly created file is older than distributed files! 496e8340fabSmrgCheck your system clock]) 497e1670675Smrgfi 498e8340fabSmrgAC_MSG_RESULT([yes]) 499e8340fabSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and 500e8340fabSmrg# generated files are strictly newer. 501e8340fabSmrgam_sleep_pid= 502e8340fabSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then 503e8340fabSmrg ( sleep 1 ) & 504e8340fabSmrg am_sleep_pid=$! 505e8340fabSmrgfi 506e8340fabSmrgAC_CONFIG_COMMANDS_PRE( 507e8340fabSmrg [AC_MSG_CHECKING([that generated files are newer than configure]) 508e8340fabSmrg if test -n "$am_sleep_pid"; then 509e8340fabSmrg # Hide warnings about reused PIDs. 510e8340fabSmrg wait $am_sleep_pid 2>/dev/null 511e8340fabSmrg fi 512e8340fabSmrg AC_MSG_RESULT([done])]) 513e8340fabSmrgrm -f conftest.file 514e8340fabSmrg]) 515a9a39c43Smrg 516e8340fabSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc. 517a9a39c43Smrg# 518e8340fabSmrg# This file is free software; the Free Software Foundation 519e8340fabSmrg# gives unlimited permission to copy and/or distribute it, 520e8340fabSmrg# with or without modifications, as long as this notice is preserved. 521e1670675Smrg 522e8340fabSmrg# AM_SILENT_RULES([DEFAULT]) 523e8340fabSmrg# -------------------------- 524e8340fabSmrg# Enable less verbose build rules; with the default set to DEFAULT 525e8340fabSmrg# ("yes" being less verbose, "no" or empty being verbose). 526e8340fabSmrgAC_DEFUN([AM_SILENT_RULES], 527e8340fabSmrg[AC_ARG_ENABLE([silent-rules], [dnl 528e8340fabSmrgAS_HELP_STRING( 529e8340fabSmrg [--enable-silent-rules], 530e8340fabSmrg [less verbose build output (undo: "make V=1")]) 531e8340fabSmrgAS_HELP_STRING( 532e8340fabSmrg [--disable-silent-rules], 533e8340fabSmrg [verbose build output (undo: "make V=0")])dnl 534e8340fabSmrg]) 535e8340fabSmrgcase $enable_silent_rules in @%:@ ((( 536e8340fabSmrg yes) AM_DEFAULT_VERBOSITY=0;; 537e8340fabSmrg no) AM_DEFAULT_VERBOSITY=1;; 538e8340fabSmrg *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; 539e8340fabSmrgesac 540e8340fabSmrgdnl 541e8340fabSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep) 542e8340fabSmrgdnl do not support nested variable expansions. 543e8340fabSmrgdnl See automake bug#9928 and bug#10237. 544e8340fabSmrgam_make=${MAKE-make} 545e8340fabSmrgAC_CACHE_CHECK([whether $am_make supports nested variables], 546e8340fabSmrg [am_cv_make_support_nested_variables], 547e8340fabSmrg [if AS_ECHO([['TRUE=$(BAR$(V)) 548e8340fabSmrgBAR0=false 549e8340fabSmrgBAR1=true 550e8340fabSmrgV=1 551e8340fabSmrgam__doit: 552e8340fabSmrg @$(TRUE) 553e8340fabSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then 554e8340fabSmrg am_cv_make_support_nested_variables=yes 555e1670675Smrgelse 556e8340fabSmrg am_cv_make_support_nested_variables=no 557e8340fabSmrgfi]) 558e8340fabSmrgif test $am_cv_make_support_nested_variables = yes; then 559e8340fabSmrg dnl Using '$V' instead of '$(V)' breaks IRIX make. 560e8340fabSmrg AM_V='$(V)' 561e8340fabSmrg AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' 562e8340fabSmrgelse 563e8340fabSmrg AM_V=$AM_DEFAULT_VERBOSITY 564e8340fabSmrg AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY 565a9a39c43Smrgfi 566e8340fabSmrgAC_SUBST([AM_V])dnl 567e8340fabSmrgAM_SUBST_NOTMAKE([AM_V])dnl 568e8340fabSmrgAC_SUBST([AM_DEFAULT_V])dnl 569e8340fabSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl 570e8340fabSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl 571e8340fabSmrgAM_BACKSLASH='\' 572e8340fabSmrgAC_SUBST([AM_BACKSLASH])dnl 573e8340fabSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl 574e8340fabSmrg]) 575a9a39c43Smrg 576e8340fabSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc. 577e8340fabSmrg# 578e8340fabSmrg# This file is free software; the Free Software Foundation 579e8340fabSmrg# gives unlimited permission to copy and/or distribute it, 580e8340fabSmrg# with or without modifications, as long as this notice is preserved. 581e1670675Smrg 582e8340fabSmrg# AM_PROG_INSTALL_STRIP 583e8340fabSmrg# --------------------- 584e8340fabSmrg# One issue with vendor 'install' (even GNU) is that you can't 585e8340fabSmrg# specify the program used to strip binaries. This is especially 586e8340fabSmrg# annoying in cross-compiling environments, where the build's strip 587e8340fabSmrg# is unlikely to handle the host's binaries. 588e8340fabSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we 589e8340fabSmrg# always use install-sh in "make install-strip", and initialize 590e8340fabSmrg# STRIPPROG with the value of the STRIP variable (set by the user). 591e8340fabSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP], 592e8340fabSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl 593e8340fabSmrg# Installed binaries are usually stripped using 'strip' when the user 594e8340fabSmrg# run "make install-strip". However 'strip' might not be the right 595e8340fabSmrg# tool to use in cross-compilation environments, therefore Automake 596e8340fabSmrg# will honor the 'STRIP' environment variable to overrule this program. 597e8340fabSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'. 598e8340fabSmrgif test "$cross_compiling" != no; then 599e8340fabSmrg AC_CHECK_TOOL([STRIP], [strip], :) 600a9a39c43Smrgfi 601e8340fabSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" 602e8340fabSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])]) 603a9a39c43Smrg 604e8340fabSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc. 605e8340fabSmrg# 606e8340fabSmrg# This file is free software; the Free Software Foundation 607e8340fabSmrg# gives unlimited permission to copy and/or distribute it, 608e8340fabSmrg# with or without modifications, as long as this notice is preserved. 609a9a39c43Smrg 610e8340fabSmrg# _AM_SUBST_NOTMAKE(VARIABLE) 611e8340fabSmrg# --------------------------- 612e8340fabSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. 613e8340fabSmrg# This macro is traced by Automake. 614e8340fabSmrgAC_DEFUN([_AM_SUBST_NOTMAKE]) 615a9a39c43Smrg 616e8340fabSmrg# AM_SUBST_NOTMAKE(VARIABLE) 617e8340fabSmrg# -------------------------- 618e8340fabSmrg# Public sister of _AM_SUBST_NOTMAKE. 619e8340fabSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) 620a9a39c43Smrg 621e8340fabSmrg# Check how to create a tarball. -*- Autoconf -*- 622a9a39c43Smrg 623e8340fabSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc. 624a9a39c43Smrg# 625e8340fabSmrg# This file is free software; the Free Software Foundation 626e8340fabSmrg# gives unlimited permission to copy and/or distribute it, 627e8340fabSmrg# with or without modifications, as long as this notice is preserved. 628a9a39c43Smrg 629e8340fabSmrg# _AM_PROG_TAR(FORMAT) 630e8340fabSmrg# -------------------- 631e8340fabSmrg# Check how to create a tarball in format FORMAT. 632e8340fabSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'. 633e8340fabSmrg# 634e8340fabSmrg# Substitute a variable $(am__tar) that is a command 635e8340fabSmrg# writing to stdout a FORMAT-tarball containing the directory 636e8340fabSmrg# $tardir. 637e8340fabSmrg# tardir=directory && $(am__tar) > result.tar 638e8340fabSmrg# 639e8340fabSmrg# Substitute a variable $(am__untar) that extract such 640e8340fabSmrg# a tarball read from stdin. 641e8340fabSmrg# $(am__untar) < result.tar 642e8340fabSmrg# 643e8340fabSmrgAC_DEFUN([_AM_PROG_TAR], 644e8340fabSmrg[# Always define AMTAR for backward compatibility. Yes, it's still used 645e8340fabSmrg# in the wild :-( We should find a proper way to deprecate it ... 646e8340fabSmrgAC_SUBST([AMTAR], ['$${TAR-tar}']) 647a9a39c43Smrg 648e8340fabSmrg# We'll loop over all known methods to create a tar archive until one works. 649e8340fabSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' 650a9a39c43Smrg 651e8340fabSmrgm4_if([$1], [v7], 652e8340fabSmrg [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], 653a9a39c43Smrg 654e8340fabSmrg [m4_case([$1], 655e8340fabSmrg [ustar], 656e8340fabSmrg [# The POSIX 1988 'ustar' format is defined with fixed-size fields. 657e8340fabSmrg # There is notably a 21 bits limit for the UID and the GID. In fact, 658e8340fabSmrg # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 659e8340fabSmrg # and bug#13588). 660e8340fabSmrg am_max_uid=2097151 # 2^21 - 1 661e8340fabSmrg am_max_gid=$am_max_uid 662e8340fabSmrg # The $UID and $GID variables are not portable, so we need to resort 663e8340fabSmrg # to the POSIX-mandated id(1) utility. Errors in the 'id' calls 664e8340fabSmrg # below are definitely unexpected, so allow the users to see them 665e8340fabSmrg # (that is, avoid stderr redirection). 666e8340fabSmrg am_uid=`id -u || echo unknown` 667e8340fabSmrg am_gid=`id -g || echo unknown` 668e8340fabSmrg AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) 669e8340fabSmrg if test $am_uid -le $am_max_uid; then 670e8340fabSmrg AC_MSG_RESULT([yes]) 671e8340fabSmrg else 672e8340fabSmrg AC_MSG_RESULT([no]) 673e8340fabSmrg _am_tools=none 674e8340fabSmrg fi 675e8340fabSmrg AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) 676e8340fabSmrg if test $am_gid -le $am_max_gid; then 677e8340fabSmrg AC_MSG_RESULT([yes]) 678e8340fabSmrg else 679e8340fabSmrg AC_MSG_RESULT([no]) 680e8340fabSmrg _am_tools=none 681e8340fabSmrg fi], 682a9a39c43Smrg 683e8340fabSmrg [pax], 684e8340fabSmrg [], 685a9a39c43Smrg 686e8340fabSmrg [m4_fatal([Unknown tar format])]) 687a9a39c43Smrg 688e8340fabSmrg AC_MSG_CHECKING([how to create a $1 tar archive]) 689a9a39c43Smrg 690e8340fabSmrg # Go ahead even if we have the value already cached. We do so because we 691e8340fabSmrg # need to set the values for the 'am__tar' and 'am__untar' variables. 692e8340fabSmrg _am_tools=${am_cv_prog_tar_$1-$_am_tools} 693a9a39c43Smrg 694e8340fabSmrg for _am_tool in $_am_tools; do 695e8340fabSmrg case $_am_tool in 696e8340fabSmrg gnutar) 697e8340fabSmrg for _am_tar in tar gnutar gtar; do 698e8340fabSmrg AM_RUN_LOG([$_am_tar --version]) && break 699e8340fabSmrg done 700e8340fabSmrg am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' 701e8340fabSmrg am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' 702e8340fabSmrg am__untar="$_am_tar -xf -" 703e8340fabSmrg ;; 704e8340fabSmrg plaintar) 705e8340fabSmrg # Must skip GNU tar: if it does not support --format= it doesn't create 706e8340fabSmrg # ustar tarball either. 707e8340fabSmrg (tar --version) >/dev/null 2>&1 && continue 708e8340fabSmrg am__tar='tar chf - "$$tardir"' 709e8340fabSmrg am__tar_='tar chf - "$tardir"' 710e8340fabSmrg am__untar='tar xf -' 711e8340fabSmrg ;; 712e8340fabSmrg pax) 713e8340fabSmrg am__tar='pax -L -x $1 -w "$$tardir"' 714e8340fabSmrg am__tar_='pax -L -x $1 -w "$tardir"' 715e8340fabSmrg am__untar='pax -r' 716e8340fabSmrg ;; 717e8340fabSmrg cpio) 718e8340fabSmrg am__tar='find "$$tardir" -print | cpio -o -H $1 -L' 719e8340fabSmrg am__tar_='find "$tardir" -print | cpio -o -H $1 -L' 720e8340fabSmrg am__untar='cpio -i -H $1 -d' 721e8340fabSmrg ;; 722e8340fabSmrg none) 723e8340fabSmrg am__tar=false 724e8340fabSmrg am__tar_=false 725e8340fabSmrg am__untar=false 726e8340fabSmrg ;; 727e8340fabSmrg esac 728a9a39c43Smrg 729e8340fabSmrg # If the value was cached, stop now. We just wanted to have am__tar 730e8340fabSmrg # and am__untar set. 731e8340fabSmrg test -n "${am_cv_prog_tar_$1}" && break 732a9a39c43Smrg 733e8340fabSmrg # tar/untar a dummy directory, and stop if the command works. 734e8340fabSmrg rm -rf conftest.dir 735e8340fabSmrg mkdir conftest.dir 736e8340fabSmrg echo GrepMe > conftest.dir/file 737e8340fabSmrg AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) 738e8340fabSmrg rm -rf conftest.dir 739e8340fabSmrg if test -s conftest.tar; then 740e8340fabSmrg AM_RUN_LOG([$am__untar <conftest.tar]) 741e8340fabSmrg AM_RUN_LOG([cat conftest.dir/file]) 742e8340fabSmrg grep GrepMe conftest.dir/file >/dev/null 2>&1 && break 743e8340fabSmrg fi 744e8340fabSmrg done 745e8340fabSmrg rm -rf conftest.dir 746a9a39c43Smrg 747e8340fabSmrg AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) 748e8340fabSmrg AC_MSG_RESULT([$am_cv_prog_tar_$1])]) 749a9a39c43Smrg 750e8340fabSmrgAC_SUBST([am__tar]) 751e8340fabSmrgAC_SUBST([am__untar]) 752e8340fabSmrg]) # _AM_PROG_TAR 753a9a39c43Smrg 754e8340fabSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- 755e8340fabSmrgdnl serial 11 (pkg-config-0.29) 756e8340fabSmrgdnl 757e8340fabSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>. 758e8340fabSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com> 759e8340fabSmrgdnl 760e8340fabSmrgdnl This program is free software; you can redistribute it and/or modify 761e8340fabSmrgdnl it under the terms of the GNU General Public License as published by 762e8340fabSmrgdnl the Free Software Foundation; either version 2 of the License, or 763e8340fabSmrgdnl (at your option) any later version. 764e8340fabSmrgdnl 765e8340fabSmrgdnl This program is distributed in the hope that it will be useful, but 766e8340fabSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of 767e8340fabSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 768e8340fabSmrgdnl General Public License for more details. 769e8340fabSmrgdnl 770e8340fabSmrgdnl You should have received a copy of the GNU General Public License 771e8340fabSmrgdnl along with this program; if not, write to the Free Software 772e8340fabSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 773e8340fabSmrgdnl 02111-1307, USA. 774e8340fabSmrgdnl 775e8340fabSmrgdnl As a special exception to the GNU General Public License, if you 776e8340fabSmrgdnl distribute this file as part of a program that contains a 777e8340fabSmrgdnl configuration script generated by Autoconf, you may include it under 778e8340fabSmrgdnl the same distribution terms that you use for the rest of that 779e8340fabSmrgdnl program. 780a9a39c43Smrg 781e8340fabSmrgdnl PKG_PREREQ(MIN-VERSION) 782e8340fabSmrgdnl ----------------------- 783e8340fabSmrgdnl Since: 0.29 784e8340fabSmrgdnl 785e8340fabSmrgdnl Verify that the version of the pkg-config macros are at least 786e8340fabSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's 787e8340fabSmrgdnl installed version of pkg-config, this checks the developer's version 788e8340fabSmrgdnl of pkg.m4 when generating configure. 789e8340fabSmrgdnl 790e8340fabSmrgdnl To ensure that this macro is defined, also add: 791e8340fabSmrgdnl m4_ifndef([PKG_PREREQ], 792e8340fabSmrgdnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) 793e8340fabSmrgdnl 794e8340fabSmrgdnl See the "Since" comment for each macro you use to see what version 795e8340fabSmrgdnl of the macros you require. 796e8340fabSmrgm4_defun([PKG_PREREQ], 797e8340fabSmrg[m4_define([PKG_MACROS_VERSION], [0.29]) 798e8340fabSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, 799e8340fabSmrg [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) 800e8340fabSmrg])dnl PKG_PREREQ 801a9a39c43Smrg 802e8340fabSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) 803e8340fabSmrgdnl ---------------------------------- 804e8340fabSmrgdnl Since: 0.16 805e8340fabSmrgdnl 806e8340fabSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to 807e8340fabSmrgdnl first found in the path. Checks that the version of pkg-config found 808e8340fabSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is 809e8340fabSmrgdnl used since that's the first version where most current features of 810e8340fabSmrgdnl pkg-config existed. 811e8340fabSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG], 812e8340fabSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) 813e8340fabSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) 814e8340fabSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) 815e8340fabSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) 816e8340fabSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) 817e8340fabSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) 818a9a39c43Smrg 819e8340fabSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then 820e8340fabSmrg AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) 821e1670675Smrgfi 822e8340fabSmrgif test -n "$PKG_CONFIG"; then 823e8340fabSmrg _pkg_min_version=m4_default([$1], [0.9.0]) 824e8340fabSmrg AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) 825e8340fabSmrg if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then 826e8340fabSmrg AC_MSG_RESULT([yes]) 827e8340fabSmrg else 828e8340fabSmrg AC_MSG_RESULT([no]) 829e8340fabSmrg PKG_CONFIG="" 830e8340fabSmrg fi 831e8340fabSmrgfi[]dnl 832e8340fabSmrg])dnl PKG_PROG_PKG_CONFIG 833a9a39c43Smrg 834e8340fabSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 835e8340fabSmrgdnl ------------------------------------------------------------------- 836e8340fabSmrgdnl Since: 0.18 837e8340fabSmrgdnl 838e8340fabSmrgdnl Check to see whether a particular set of modules exists. Similar to 839e8340fabSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors. 840e8340fabSmrgdnl 841e8340fabSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 842e8340fabSmrgdnl only at the first occurence in configure.ac, so if the first place 843e8340fabSmrgdnl it's called might be skipped (such as if it is within an "if", you 844e8340fabSmrgdnl have to call PKG_CHECK_EXISTS manually 845e8340fabSmrgAC_DEFUN([PKG_CHECK_EXISTS], 846e8340fabSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 847e8340fabSmrgif test -n "$PKG_CONFIG" && \ 848e8340fabSmrg AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then 849e8340fabSmrg m4_default([$2], [:]) 850e8340fabSmrgm4_ifvaln([$3], [else 851e8340fabSmrg $3])dnl 852e8340fabSmrgfi]) 853a9a39c43Smrg 854e8340fabSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) 855e8340fabSmrgdnl --------------------------------------------- 856e8340fabSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting 857e8340fabSmrgdnl pkg_failed based on the result. 858e8340fabSmrgm4_define([_PKG_CONFIG], 859e8340fabSmrg[if test -n "$$1"; then 860e8340fabSmrg pkg_cv_[]$1="$$1" 861e8340fabSmrg elif test -n "$PKG_CONFIG"; then 862e8340fabSmrg PKG_CHECK_EXISTS([$3], 863e8340fabSmrg [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` 864e8340fabSmrg test "x$?" != "x0" && pkg_failed=yes ], 865e8340fabSmrg [pkg_failed=yes]) 866e8340fabSmrg else 867e8340fabSmrg pkg_failed=untried 868e8340fabSmrgfi[]dnl 869e8340fabSmrg])dnl _PKG_CONFIG 870a9a39c43Smrg 871e8340fabSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED 872e8340fabSmrgdnl --------------------------- 873e8340fabSmrgdnl Internal check to see if pkg-config supports short errors. 874e8340fabSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], 875e8340fabSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 876e8340fabSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then 877e8340fabSmrg _pkg_short_errors_supported=yes 878129be1b7Smrgelse 879e8340fabSmrg _pkg_short_errors_supported=no 880e8340fabSmrgfi[]dnl 881e8340fabSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED 882129be1b7Smrg 883129be1b7Smrg 884e8340fabSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], 885e8340fabSmrgdnl [ACTION-IF-NOT-FOUND]) 886e8340fabSmrgdnl -------------------------------------------------------------- 887e8340fabSmrgdnl Since: 0.4.0 888e8340fabSmrgdnl 889e8340fabSmrgdnl Note that if there is a possibility the first call to 890e8340fabSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an 891e8340fabSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac 892e8340fabSmrgAC_DEFUN([PKG_CHECK_MODULES], 893e8340fabSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 894e8340fabSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl 895e8340fabSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl 896a9a39c43Smrg 897e8340fabSmrgpkg_failed=no 898e8340fabSmrgAC_MSG_CHECKING([for $1]) 899a9a39c43Smrg 900e8340fabSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) 901e8340fabSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2]) 902a9a39c43Smrg 903e8340fabSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS 904e8340fabSmrgand $1[]_LIBS to avoid the need to call pkg-config. 905e8340fabSmrgSee the pkg-config man page for more details.]) 906a9a39c43Smrg 907e8340fabSmrgif test $pkg_failed = yes; then 908e8340fabSmrg AC_MSG_RESULT([no]) 909e8340fabSmrg _PKG_SHORT_ERRORS_SUPPORTED 910e8340fabSmrg if test $_pkg_short_errors_supported = yes; then 911e8340fabSmrg $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` 912e8340fabSmrg else 913e8340fabSmrg $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` 914e8340fabSmrg fi 915e8340fabSmrg # Put the nasty error message in config.log where it belongs 916e8340fabSmrg echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD 917129be1b7Smrg 918e8340fabSmrg m4_default([$4], [AC_MSG_ERROR( 919e8340fabSmrg[Package requirements ($2) were not met: 920129be1b7Smrg 921e8340fabSmrg$$1_PKG_ERRORS 922129be1b7Smrg 923e8340fabSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you 924e8340fabSmrginstalled software in a non-standard prefix. 925129be1b7Smrg 926e8340fabSmrg_PKG_TEXT])[]dnl 927e8340fabSmrg ]) 928e8340fabSmrgelif test $pkg_failed = untried; then 929e8340fabSmrg AC_MSG_RESULT([no]) 930e8340fabSmrg m4_default([$4], [AC_MSG_FAILURE( 931e8340fabSmrg[The pkg-config script could not be found or is too old. Make sure it 932e8340fabSmrgis in your PATH or set the PKG_CONFIG environment variable to the full 933e8340fabSmrgpath to pkg-config. 934129be1b7Smrg 935e8340fabSmrg_PKG_TEXT 936a376accbSmrg 937e8340fabSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl 938e8340fabSmrg ]) 939a376accbSmrgelse 940e8340fabSmrg $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS 941e8340fabSmrg $1[]_LIBS=$pkg_cv_[]$1[]_LIBS 942e8340fabSmrg AC_MSG_RESULT([yes]) 943e8340fabSmrg $3 944e8340fabSmrgfi[]dnl 945e8340fabSmrg])dnl PKG_CHECK_MODULES 946a376accbSmrg 947a376accbSmrg 948e8340fabSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], 949e8340fabSmrgdnl [ACTION-IF-NOT-FOUND]) 950e8340fabSmrgdnl --------------------------------------------------------------------- 951e8340fabSmrgdnl Since: 0.29 952e8340fabSmrgdnl 953e8340fabSmrgdnl Checks for existence of MODULES and gathers its build flags with 954e8340fabSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags 955e8340fabSmrgdnl and VARIABLE-PREFIX_LIBS from --libs. 956e8340fabSmrgdnl 957e8340fabSmrgdnl Note that if there is a possibility the first call to 958e8340fabSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to 959e8340fabSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your 960e8340fabSmrgdnl configure.ac. 961e8340fabSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC], 962e8340fabSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 963e8340fabSmrg_save_PKG_CONFIG=$PKG_CONFIG 964e8340fabSmrgPKG_CONFIG="$PKG_CONFIG --static" 965e8340fabSmrgPKG_CHECK_MODULES($@) 966e8340fabSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl 967e8340fabSmrg])dnl PKG_CHECK_MODULES_STATIC 968e1670675Smrg 969e1670675Smrg 970e8340fabSmrgdnl PKG_INSTALLDIR([DIRECTORY]) 971e8340fabSmrgdnl ------------------------- 972e8340fabSmrgdnl Since: 0.27 973e8340fabSmrgdnl 974e8340fabSmrgdnl Substitutes the variable pkgconfigdir as the location where a module 975e8340fabSmrgdnl should install pkg-config .pc files. By default the directory is 976e8340fabSmrgdnl $libdir/pkgconfig, but the default can be changed by passing 977e8340fabSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir 978e8340fabSmrgdnl parameter. 979e8340fabSmrgAC_DEFUN([PKG_INSTALLDIR], 980e8340fabSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) 981e8340fabSmrgm4_pushdef([pkg_description], 982e8340fabSmrg [pkg-config installation directory @<:@]pkg_default[@:>@]) 983e8340fabSmrgAC_ARG_WITH([pkgconfigdir], 984e8340fabSmrg [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, 985e8340fabSmrg [with_pkgconfigdir=]pkg_default) 986e8340fabSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) 987e8340fabSmrgm4_popdef([pkg_default]) 988e8340fabSmrgm4_popdef([pkg_description]) 989e8340fabSmrg])dnl PKG_INSTALLDIR 990e1670675Smrg 991a376accbSmrg 992e8340fabSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) 993e8340fabSmrgdnl -------------------------------- 994e8340fabSmrgdnl Since: 0.27 995e8340fabSmrgdnl 996e8340fabSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a 997e8340fabSmrgdnl module should install arch-independent pkg-config .pc files. By 998e8340fabSmrgdnl default the directory is $datadir/pkgconfig, but the default can be 999e8340fabSmrgdnl changed by passing DIRECTORY. The user can override through the 1000e8340fabSmrgdnl --with-noarch-pkgconfigdir parameter. 1001e8340fabSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR], 1002e8340fabSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) 1003e8340fabSmrgm4_pushdef([pkg_description], 1004e8340fabSmrg [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) 1005e8340fabSmrgAC_ARG_WITH([noarch-pkgconfigdir], 1006e8340fabSmrg [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, 1007e8340fabSmrg [with_noarch_pkgconfigdir=]pkg_default) 1008e8340fabSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) 1009e8340fabSmrgm4_popdef([pkg_default]) 1010e8340fabSmrgm4_popdef([pkg_description]) 1011e8340fabSmrg])dnl PKG_NOARCH_INSTALLDIR 1012e1670675Smrg 1013e1670675Smrg 1014e8340fabSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, 1015e8340fabSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 1016e8340fabSmrgdnl ------------------------------------------- 1017e8340fabSmrgdnl Since: 0.28 1018e8340fabSmrgdnl 1019e8340fabSmrgdnl Retrieves the value of the pkg-config variable for the given module. 1020e8340fabSmrgAC_DEFUN([PKG_CHECK_VAR], 1021e8340fabSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 1022e8340fabSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl 1023e1670675Smrg 1024e8340fabSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2]) 1025e8340fabSmrgAS_VAR_COPY([$1], [pkg_cv_][$1]) 1026e1670675Smrg 1027e8340fabSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl 1028e8340fabSmrg])dnl PKG_CHECK_VAR 1029e1670675Smrg 1030e8340fabSmrgdnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. 1031e8340fabSmrgdnl 1032e8340fabSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates. 1033e8340fabSmrgdnl 1034e8340fabSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a 1035e8340fabSmrgdnl copy of this software and associated documentation files (the "Software"), 1036e8340fabSmrgdnl to deal in the Software without restriction, including without limitation 1037e8340fabSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense, 1038e8340fabSmrgdnl and/or sell copies of the Software, and to permit persons to whom the 1039e8340fabSmrgdnl Software is furnished to do so, subject to the following conditions: 1040e8340fabSmrgdnl 1041e8340fabSmrgdnl The above copyright notice and this permission notice (including the next 1042e8340fabSmrgdnl paragraph) shall be included in all copies or substantial portions of the 1043e8340fabSmrgdnl Software. 1044e8340fabSmrgdnl 1045e8340fabSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1046e8340fabSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1047e8340fabSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1048e8340fabSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1049e8340fabSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 1050e8340fabSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 1051e8340fabSmrgdnl DEALINGS IN THE SOFTWARE. 1052e1670675Smrg 1053e8340fabSmrg# XORG_MACROS_VERSION(required-version) 1054e8340fabSmrg# ------------------------------------- 1055e8340fabSmrg# Minimum version: 1.1.0 1056e1670675Smrg# 1057e8340fabSmrg# If you're using a macro added in Version 1.1 or newer, include this in 1058e8340fabSmrg# your configure.ac with the minimum required version, such as: 1059e8340fabSmrg# XORG_MACROS_VERSION(1.1) 1060e1670675Smrg# 1061e8340fabSmrg# To ensure that this macro is defined, also add: 1062e8340fabSmrg# m4_ifndef([XORG_MACROS_VERSION], 1063e8340fabSmrg# [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])]) 1064e1670675Smrg# 1065e1670675Smrg# 1066e8340fabSmrg# See the "minimum version" comment for each macro you use to see what 1067e8340fabSmrg# version you require. 1068e8340fabSmrgm4_defun([XORG_MACROS_VERSION],[ 1069e8340fabSmrgm4_define([vers_have], [1.20.0]) 1070e8340fabSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) 1071e8340fabSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) 1072e8340fabSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,, 1073e8340fabSmrg [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])]) 1074e8340fabSmrgm4_if(m4_version_compare(vers_have, [$1]), -1, 1075e8340fabSmrg [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])]) 1076e8340fabSmrgm4_undefine([vers_have]) 1077e8340fabSmrgm4_undefine([maj_have]) 1078e8340fabSmrgm4_undefine([maj_needed]) 1079e8340fabSmrg]) # XORG_MACROS_VERSION 1080e8340fabSmrg 1081e8340fabSmrg# XORG_PROG_RAWCPP() 1082e8340fabSmrg# ------------------ 1083e8340fabSmrg# Minimum version: 1.0.0 1084e1670675Smrg# 1085e8340fabSmrg# Find cpp program and necessary flags for use in pre-processing text files 1086e8340fabSmrg# such as man pages and config files 1087e8340fabSmrgAC_DEFUN([XORG_PROG_RAWCPP],[ 1088e8340fabSmrgAC_REQUIRE([AC_PROG_CPP]) 1089e8340fabSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}], 1090e8340fabSmrg [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib]) 1091e8340fabSmrg 1092e8340fabSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined, 1093e8340fabSmrg# which is not the best choice for supporting other OS'es, but covers most 1094e8340fabSmrg# of the ones we need for now. 1095e8340fabSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef]) 1096e8340fabSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])]) 1097e8340fabSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then 1098e8340fabSmrg AC_MSG_RESULT([no]) 1099e8340fabSmrgelse 1100e8340fabSmrg if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then 1101e8340fabSmrg RAWCPPFLAGS=-undef 1102e8340fabSmrg AC_MSG_RESULT([yes]) 1103e8340fabSmrg # under Cygwin unix is still defined even with -undef 1104e8340fabSmrg elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then 1105e8340fabSmrg RAWCPPFLAGS="-undef -ansi" 1106e8340fabSmrg AC_MSG_RESULT([yes, with -ansi]) 1107e8340fabSmrg else 1108e8340fabSmrg AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef. I don't know what to do.]) 1109e8340fabSmrg fi 1110e8340fabSmrgfi 1111e8340fabSmrgrm -f conftest.$ac_ext 1112e8340fabSmrg 1113e8340fabSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional]) 1114e8340fabSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve "whitespace"?]])]) 1115e8340fabSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then 1116e8340fabSmrg AC_MSG_RESULT([no]) 1117a376accbSmrgelse 1118e8340fabSmrg if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then 1119e8340fabSmrg TRADITIONALCPPFLAGS="-traditional" 1120e8340fabSmrg RAWCPPFLAGS="${RAWCPPFLAGS} -traditional" 1121e8340fabSmrg AC_MSG_RESULT([yes]) 1122e8340fabSmrg else 1123e8340fabSmrg AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional. I don't know what to do.]) 1124e8340fabSmrg fi 1125a376accbSmrgfi 1126e8340fabSmrgrm -f conftest.$ac_ext 1127e8340fabSmrgAC_SUBST(RAWCPPFLAGS) 1128e8340fabSmrgAC_SUBST(TRADITIONALCPPFLAGS) 1129e8340fabSmrg]) # XORG_PROG_RAWCPP 1130a376accbSmrg 1131e8340fabSmrg# XORG_MANPAGE_SECTIONS() 1132e1670675Smrg# ----------------------- 1133e8340fabSmrg# Minimum version: 1.0.0 1134a376accbSmrg# 1135e8340fabSmrg# Determine which sections man pages go in for the different man page types 1136e8340fabSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files. 1137e8340fabSmrg# Not sure if there's any better way than just hardcoding by OS name. 1138e8340fabSmrg# Override default settings by setting environment variables 1139e8340fabSmrg# Added MAN_SUBSTS in version 1.8 1140e8340fabSmrg# Added AC_PROG_SED in version 1.8 1141a376accbSmrg 1142e8340fabSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[ 1143e1670675SmrgAC_REQUIRE([AC_CANONICAL_HOST]) 1144e8340fabSmrgAC_REQUIRE([AC_PROG_SED]) 1145e1670675Smrg 1146e1670675Smrgcase $host_os in 1147e1670675Smrg solaris*) 1148e8340fabSmrg # Solaris 2.0 - 11.3 use SysV man page section numbers, so we 1149e8340fabSmrg # check for a man page file found in later versions that use 1150e8340fabSmrg # traditional section numbers instead 1151e8340fabSmrg AC_CHECK_FILE([/usr/share/man/man7/attributes.7], 1152e8340fabSmrg [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true]) 1153e1670675Smrg ;; 1154e8340fabSmrg *) SYSV_MAN_SECTIONS=false ;; 1155e1670675Smrgesac 1156e1670675Smrg 1157e8340fabSmrgif test x$APP_MAN_SUFFIX = x ; then 1158e8340fabSmrg APP_MAN_SUFFIX=1 1159e1670675Smrgfi 1160e8340fabSmrgif test x$APP_MAN_DIR = x ; then 1161e8340fabSmrg APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)' 1162e1670675Smrgfi 1163e1670675Smrg 1164e8340fabSmrgif test x$LIB_MAN_SUFFIX = x ; then 1165e8340fabSmrg LIB_MAN_SUFFIX=3 1166a376accbSmrgfi 1167e8340fabSmrgif test x$LIB_MAN_DIR = x ; then 1168e8340fabSmrg LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)' 1169a376accbSmrgfi 1170a376accbSmrg 1171e8340fabSmrgif test x$FILE_MAN_SUFFIX = x ; then 1172e8340fabSmrg case $SYSV_MAN_SECTIONS in 1173e8340fabSmrg true) FILE_MAN_SUFFIX=4 ;; 1174e8340fabSmrg *) FILE_MAN_SUFFIX=5 ;; 1175e8340fabSmrg esac 1176e8340fabSmrgfi 1177e8340fabSmrgif test x$FILE_MAN_DIR = x ; then 1178e8340fabSmrg FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)' 1179a376accbSmrgfi 1180a376accbSmrg 1181e8340fabSmrgif test x$MISC_MAN_SUFFIX = x ; then 1182e8340fabSmrg case $SYSV_MAN_SECTIONS in 1183e8340fabSmrg true) MISC_MAN_SUFFIX=5 ;; 1184e8340fabSmrg *) MISC_MAN_SUFFIX=7 ;; 1185e8340fabSmrg esac 1186e8340fabSmrgfi 1187e8340fabSmrgif test x$MISC_MAN_DIR = x ; then 1188e8340fabSmrg MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)' 1189e8340fabSmrgfi 1190a376accbSmrg 1191e8340fabSmrgif test x$DRIVER_MAN_SUFFIX = x ; then 1192e8340fabSmrg case $SYSV_MAN_SECTIONS in 1193e8340fabSmrg true) DRIVER_MAN_SUFFIX=7 ;; 1194e8340fabSmrg *) DRIVER_MAN_SUFFIX=4 ;; 1195e8340fabSmrg esac 1196e8340fabSmrgfi 1197e8340fabSmrgif test x$DRIVER_MAN_DIR = x ; then 1198e8340fabSmrg DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)' 1199e8340fabSmrgfi 1200a376accbSmrg 1201e8340fabSmrgif test x$ADMIN_MAN_SUFFIX = x ; then 1202e8340fabSmrg case $SYSV_MAN_SECTIONS in 1203e8340fabSmrg true) ADMIN_MAN_SUFFIX=1m ;; 1204e8340fabSmrg *) ADMIN_MAN_SUFFIX=8 ;; 1205e8340fabSmrg esac 1206e8340fabSmrgfi 1207e8340fabSmrgif test x$ADMIN_MAN_DIR = x ; then 1208e8340fabSmrg ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)' 1209e8340fabSmrgfi 1210a376accbSmrg 1211e1670675Smrg 1212e8340fabSmrgAC_SUBST([APP_MAN_SUFFIX]) 1213e8340fabSmrgAC_SUBST([LIB_MAN_SUFFIX]) 1214e8340fabSmrgAC_SUBST([FILE_MAN_SUFFIX]) 1215e8340fabSmrgAC_SUBST([MISC_MAN_SUFFIX]) 1216e8340fabSmrgAC_SUBST([DRIVER_MAN_SUFFIX]) 1217e8340fabSmrgAC_SUBST([ADMIN_MAN_SUFFIX]) 1218e8340fabSmrgAC_SUBST([APP_MAN_DIR]) 1219e8340fabSmrgAC_SUBST([LIB_MAN_DIR]) 1220e8340fabSmrgAC_SUBST([FILE_MAN_DIR]) 1221e8340fabSmrgAC_SUBST([MISC_MAN_DIR]) 1222e8340fabSmrgAC_SUBST([DRIVER_MAN_DIR]) 1223e8340fabSmrgAC_SUBST([ADMIN_MAN_DIR]) 1224e1670675Smrg 1225e8340fabSmrgXORG_MAN_PAGE="X Version 11" 1226e8340fabSmrgAC_SUBST([XORG_MAN_PAGE]) 1227e8340fabSmrgMAN_SUBSTS="\ 1228e8340fabSmrg -e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \ 1229e8340fabSmrg -e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \ 1230e8340fabSmrg -e 's|__xservername__|Xorg|g' \ 1231e8340fabSmrg -e 's|__xconfigfile__|xorg.conf|g' \ 1232e8340fabSmrg -e 's|__projectroot__|\$(prefix)|g' \ 1233e8340fabSmrg -e 's|__apploaddir__|\$(appdefaultdir)|g' \ 1234e8340fabSmrg -e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \ 1235e8340fabSmrg -e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \ 1236e8340fabSmrg -e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \ 1237e8340fabSmrg -e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \ 1238e8340fabSmrg -e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \ 1239e8340fabSmrg -e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'" 1240e8340fabSmrgAC_SUBST([MAN_SUBSTS]) 1241e1670675Smrg 1242e8340fabSmrg]) # XORG_MANPAGE_SECTIONS 1243e1670675Smrg 1244e8340fabSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION]) 1245e8340fabSmrg# ------------------------ 1246e8340fabSmrg# Minimum version: 1.7.0 1247e1670675Smrg# 1248e8340fabSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent 1249e8340fabSmrg# provided by xorg-sgml-doctools, if installed. 1250e8340fabSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[ 1251e8340fabSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])]) 1252e8340fabSmrgXORG_SGML_PATH= 1253e8340fabSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])], 1254e8340fabSmrg [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`], 1255e8340fabSmrg [m4_ifval([$1],[:], 1256e8340fabSmrg [if test x"$cross_compiling" != x"yes" ; then 1257e8340fabSmrg AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent], 1258e8340fabSmrg [XORG_SGML_PATH=$prefix/share/sgml]) 1259e8340fabSmrg fi]) 1260e8340fabSmrg ]) 1261e1670675Smrg 1262e8340fabSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing 1263e8340fabSmrg# the path and the name of the doc stylesheet 1264e8340fabSmrgif test "x$XORG_SGML_PATH" != "x" ; then 1265e8340fabSmrg AC_MSG_RESULT([$XORG_SGML_PATH]) 1266e8340fabSmrg STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11 1267e8340fabSmrg XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl 1268e8340fabSmrgelse 1269e8340fabSmrg AC_MSG_RESULT([no]) 1270e8340fabSmrgfi 1271e1670675Smrg 1272e8340fabSmrgAC_SUBST(XORG_SGML_PATH) 1273e8340fabSmrgAC_SUBST(STYLESHEET_SRCDIR) 1274e8340fabSmrgAC_SUBST(XSL_STYLESHEET) 1275e8340fabSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"]) 1276e8340fabSmrg]) # XORG_CHECK_SGML_DOCTOOLS 1277e1670675Smrg 1278e8340fabSmrg# XORG_CHECK_LINUXDOC 1279e8340fabSmrg# ------------------- 1280e8340fabSmrg# Minimum version: 1.0.0 1281e8340fabSmrg# 1282e8340fabSmrg# Defines the variable MAKE_TEXT if the necessary tools and 1283e8340fabSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt. 1284e8340fabSmrg# Whether or not the necessary tools and files are found can be checked 1285e8340fabSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC" 1286e8340fabSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[ 1287e8340fabSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS]) 1288e8340fabSmrgAC_REQUIRE([XORG_WITH_PS2PDF]) 1289e1670675Smrg 1290e8340fabSmrgAC_PATH_PROG(LINUXDOC, linuxdoc) 1291e1670675Smrg 1292e8340fabSmrgAC_MSG_CHECKING([whether to build documentation]) 1293e1670675Smrg 1294e8340fabSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then 1295e8340fabSmrg BUILDDOC=yes 1296e8340fabSmrgelse 1297e8340fabSmrg BUILDDOC=no 1298e1670675Smrgfi 1299e1670675Smrg 1300e8340fabSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes]) 1301e1670675Smrg 1302e8340fabSmrgAC_MSG_RESULT([$BUILDDOC]) 1303e1670675Smrg 1304e8340fabSmrgAC_MSG_CHECKING([whether to build pdf documentation]) 1305e1670675Smrg 1306e8340fabSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then 1307e8340fabSmrg BUILDPDFDOC=yes 1308e8340fabSmrgelse 1309e8340fabSmrg BUILDPDFDOC=no 1310e8340fabSmrgfi 1311e1670675Smrg 1312e8340fabSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes]) 1313e1670675Smrg 1314e8340fabSmrgAC_MSG_RESULT([$BUILDPDFDOC]) 1315e1670675Smrg 1316e8340fabSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f" 1317e8340fabSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps" 1318e8340fabSmrgMAKE_PDF="$PS2PDF" 1319e8340fabSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B html --split=0" 1320e1670675Smrg 1321e8340fabSmrgAC_SUBST(MAKE_TEXT) 1322e8340fabSmrgAC_SUBST(MAKE_PS) 1323e8340fabSmrgAC_SUBST(MAKE_PDF) 1324e8340fabSmrgAC_SUBST(MAKE_HTML) 1325e8340fabSmrg]) # XORG_CHECK_LINUXDOC 1326e1670675Smrg 1327e8340fabSmrg# XORG_CHECK_DOCBOOK 1328e8340fabSmrg# ------------------- 1329e8340fabSmrg# Minimum version: 1.0.0 1330e8340fabSmrg# 1331e8340fabSmrg# Checks for the ability to build output formats from SGML DocBook source. 1332e8340fabSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC" 1333e8340fabSmrg# indicates whether the necessary tools and files are found and, if set, 1334e8340fabSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx. 1335e8340fabSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[ 1336e8340fabSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS]) 1337a376accbSmrg 1338e8340fabSmrgBUILDTXTDOC=no 1339e8340fabSmrgBUILDPDFDOC=no 1340e8340fabSmrgBUILDPSDOC=no 1341e8340fabSmrgBUILDHTMLDOC=no 1342e1670675Smrg 1343e8340fabSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps) 1344e8340fabSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf) 1345e8340fabSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html) 1346e8340fabSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt) 1347a376accbSmrg 1348e8340fabSmrgAC_MSG_CHECKING([whether to build text documentation]) 1349e8340fabSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x && 1350e8340fabSmrg test x$BUILD_TXTDOC != xno; then 1351e8340fabSmrg BUILDTXTDOC=yes 1352e8340fabSmrgfi 1353e8340fabSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes]) 1354e8340fabSmrgAC_MSG_RESULT([$BUILDTXTDOC]) 1355e1670675Smrg 1356e8340fabSmrgAC_MSG_CHECKING([whether to build PDF documentation]) 1357e8340fabSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x && 1358e8340fabSmrg test x$BUILD_PDFDOC != xno; then 1359e8340fabSmrg BUILDPDFDOC=yes 1360e8340fabSmrgfi 1361e8340fabSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes]) 1362e8340fabSmrgAC_MSG_RESULT([$BUILDPDFDOC]) 1363e1670675Smrg 1364e8340fabSmrgAC_MSG_CHECKING([whether to build PostScript documentation]) 1365e8340fabSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x && 1366e8340fabSmrg test x$BUILD_PSDOC != xno; then 1367e8340fabSmrg BUILDPSDOC=yes 1368e8340fabSmrgfi 1369e8340fabSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes]) 1370e8340fabSmrgAC_MSG_RESULT([$BUILDPSDOC]) 1371e1670675Smrg 1372e8340fabSmrgAC_MSG_CHECKING([whether to build HTML documentation]) 1373e8340fabSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x && 1374e8340fabSmrg test x$BUILD_HTMLDOC != xno; then 1375e8340fabSmrg BUILDHTMLDOC=yes 1376a376accbSmrgfi 1377e8340fabSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes]) 1378e8340fabSmrgAC_MSG_RESULT([$BUILDHTMLDOC]) 1379a376accbSmrg 1380e8340fabSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT" 1381e8340fabSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS" 1382e8340fabSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF" 1383e8340fabSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML" 1384e1670675Smrg 1385e8340fabSmrgAC_SUBST(MAKE_TEXT) 1386e8340fabSmrgAC_SUBST(MAKE_PS) 1387e8340fabSmrgAC_SUBST(MAKE_PDF) 1388e8340fabSmrgAC_SUBST(MAKE_HTML) 1389e8340fabSmrg]) # XORG_CHECK_DOCBOOK 1390e8340fabSmrg 1391e8340fabSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT]) 1392e8340fabSmrg# ---------------- 1393e8340fabSmrg# Minimum version: 1.5.0 1394e8340fabSmrg# Minimum version for optional DEFAULT argument: 1.11.0 1395a376accbSmrg# 1396e8340fabSmrg# Documentation tools are not always available on all platforms and sometimes 1397e8340fabSmrg# not at the appropriate level. This macro enables a module to test for the 1398e8340fabSmrg# presence of the tool and obtain it's path in separate variables. Coupled with 1399e8340fabSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions 1400e8340fabSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified, 1401e8340fabSmrg# --with-xmlto assumes 'auto'. 1402a376accbSmrg# 1403e8340fabSmrg# Interface to module: 1404e8340fabSmrg# HAVE_XMLTO: used in makefiles to conditionally generate documentation 1405e8340fabSmrg# XMLTO: returns the path of the xmlto program found 1406e8340fabSmrg# returns the path set by the user in the environment 1407e8340fabSmrg# --with-xmlto: 'yes' user instructs the module to use xmlto 1408e8340fabSmrg# 'no' user instructs the module not to use xmlto 1409a376accbSmrg# 1410e8340fabSmrg# Added in version 1.10.0 1411e8340fabSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation 1412e8340fabSmrg# xmlto for text output requires either lynx, links, or w3m browsers 1413a376accbSmrg# 1414e8340fabSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path. 1415a376accbSmrg# 1416e8340fabSmrgAC_DEFUN([XORG_WITH_XMLTO],[ 1417e8340fabSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command]) 1418e8340fabSmrgm4_define([_defopt], m4_default([$2], [auto])) 1419e8340fabSmrgAC_ARG_WITH(xmlto, 1420e8340fabSmrg AS_HELP_STRING([--with-xmlto], 1421e8340fabSmrg [Use xmlto to regenerate documentation (default: ]_defopt[)]), 1422e8340fabSmrg [use_xmlto=$withval], [use_xmlto=]_defopt) 1423e8340fabSmrgm4_undefine([_defopt]) 1424a376accbSmrg 1425e8340fabSmrgif test "x$use_xmlto" = x"auto"; then 1426e8340fabSmrg AC_PATH_PROG([XMLTO], [xmlto]) 1427e8340fabSmrg if test "x$XMLTO" = "x"; then 1428e8340fabSmrg AC_MSG_WARN([xmlto not found - documentation targets will be skipped]) 1429e8340fabSmrg have_xmlto=no 1430e8340fabSmrg else 1431e8340fabSmrg have_xmlto=yes 1432e8340fabSmrg fi 1433e8340fabSmrgelif test "x$use_xmlto" = x"yes" ; then 1434e8340fabSmrg AC_PATH_PROG([XMLTO], [xmlto]) 1435e8340fabSmrg if test "x$XMLTO" = "x"; then 1436e8340fabSmrg AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH]) 1437e8340fabSmrg fi 1438e8340fabSmrg have_xmlto=yes 1439e8340fabSmrgelif test "x$use_xmlto" = x"no" ; then 1440e8340fabSmrg if test "x$XMLTO" != "x"; then 1441e8340fabSmrg AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified]) 1442e8340fabSmrg fi 1443e8340fabSmrg have_xmlto=no 1444e8340fabSmrgelse 1445e8340fabSmrg AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no']) 1446e8340fabSmrgfi 1447e1670675Smrg 1448e8340fabSmrg# Test for a minimum version of xmlto, if provided. 1449e8340fabSmrgm4_ifval([$1], 1450e8340fabSmrg[if test "$have_xmlto" = yes; then 1451e8340fabSmrg # scrape the xmlto version 1452e8340fabSmrg AC_MSG_CHECKING([the xmlto version]) 1453e8340fabSmrg xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3` 1454e8340fabSmrg AC_MSG_RESULT([$xmlto_version]) 1455e8340fabSmrg AS_VERSION_COMPARE([$xmlto_version], [$1], 1456e8340fabSmrg [if test "x$use_xmlto" = xauto; then 1457e8340fabSmrg AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed]) 1458e8340fabSmrg have_xmlto=no 1459e8340fabSmrg else 1460e8340fabSmrg AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed]) 1461e8340fabSmrg fi]) 1462e8340fabSmrgfi]) 1463e1670675Smrg 1464e8340fabSmrg# Test for the ability of xmlto to generate a text target 1465e8340fabSmrg# 1466e8340fabSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the 1467e8340fabSmrg# following test for empty XML docbook files. 1468e8340fabSmrg# For compatibility reasons use the following empty XML docbook file and if 1469e8340fabSmrg# it fails try it again with a non-empty XML file. 1470e8340fabSmrghave_xmlto_text=no 1471e8340fabSmrgcat > conftest.xml << "EOF" 1472e8340fabSmrgEOF 1473e8340fabSmrgAS_IF([test "$have_xmlto" = yes], 1474e8340fabSmrg [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1], 1475e8340fabSmrg [have_xmlto_text=yes], 1476e8340fabSmrg [# Try it again with a non-empty XML file. 1477e8340fabSmrg cat > conftest.xml << "EOF" 1478e8340fabSmrg<x></x> 1479e8340fabSmrgEOF 1480e8340fabSmrg AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1], 1481e8340fabSmrg [have_xmlto_text=yes], 1482e8340fabSmrg [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])]) 1483e8340fabSmrgrm -f conftest.xml 1484e8340fabSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes]) 1485e8340fabSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes]) 1486e8340fabSmrg]) # XORG_WITH_XMLTO 1487e1670675Smrg 1488e8340fabSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT]) 1489e8340fabSmrg# -------------------------------------------- 1490e8340fabSmrg# Minimum version: 1.12.0 1491e8340fabSmrg# Minimum version for optional DEFAULT argument: 1.12.0 1492e8340fabSmrg# 1493e8340fabSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative, 1494e8340fabSmrg# XML-based language used for the transformation of XML documents. 1495e8340fabSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents. 1496e8340fabSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML. 1497e8340fabSmrg# The XSLT processor is often used as a standalone tool for transformations. 1498e8340fabSmrg# It should not be assumed that this tool is used only to work with documnetation. 1499e8340fabSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'. 1500e8340fabSmrg# 1501e8340fabSmrg# Interface to module: 1502e8340fabSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation 1503e8340fabSmrg# XSLTPROC: returns the path of the xsltproc program found 1504e8340fabSmrg# returns the path set by the user in the environment 1505e8340fabSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc 1506e8340fabSmrg# 'no' user instructs the module not to use xsltproc 1507e8340fabSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no 1508e8340fabSmrg# 1509e8340fabSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path. 1510e8340fabSmrg# 1511e8340fabSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[ 1512e8340fabSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command]) 1513e8340fabSmrg# Preserves the interface, should it be implemented later 1514e8340fabSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])]) 1515e8340fabSmrgm4_define([_defopt], m4_default([$2], [auto])) 1516e8340fabSmrgAC_ARG_WITH(xsltproc, 1517e8340fabSmrg AS_HELP_STRING([--with-xsltproc], 1518e8340fabSmrg [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]), 1519e8340fabSmrg [use_xsltproc=$withval], [use_xsltproc=]_defopt) 1520e8340fabSmrgm4_undefine([_defopt]) 1521e1670675Smrg 1522e8340fabSmrgif test "x$use_xsltproc" = x"auto"; then 1523e8340fabSmrg AC_PATH_PROG([XSLTPROC], [xsltproc]) 1524e8340fabSmrg if test "x$XSLTPROC" = "x"; then 1525e8340fabSmrg AC_MSG_WARN([xsltproc not found - cannot transform XML documents]) 1526e8340fabSmrg have_xsltproc=no 1527e8340fabSmrg else 1528e8340fabSmrg have_xsltproc=yes 1529e8340fabSmrg fi 1530e8340fabSmrgelif test "x$use_xsltproc" = x"yes" ; then 1531e8340fabSmrg AC_PATH_PROG([XSLTPROC], [xsltproc]) 1532e8340fabSmrg if test "x$XSLTPROC" = "x"; then 1533e8340fabSmrg AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH]) 1534e8340fabSmrg fi 1535e8340fabSmrg have_xsltproc=yes 1536e8340fabSmrgelif test "x$use_xsltproc" = x"no" ; then 1537e8340fabSmrg if test "x$XSLTPROC" != "x"; then 1538e8340fabSmrg AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified]) 1539e8340fabSmrg fi 1540e8340fabSmrg have_xsltproc=no 1541e8340fabSmrgelse 1542e8340fabSmrg AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no']) 1543e1670675Smrgfi 1544e1670675Smrg 1545e8340fabSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes]) 1546e8340fabSmrg]) # XORG_WITH_XSLTPROC 1547e8340fabSmrg 1548e8340fabSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT]) 1549e8340fabSmrg# ---------------------------------------- 1550e8340fabSmrg# Minimum version: 1.15.0 1551a376accbSmrg# 1552e8340fabSmrg# PERL (Practical Extraction and Report Language) is a language optimized for 1553e8340fabSmrg# scanning arbitrary text files, extracting information from those text files, 1554e8340fabSmrg# and printing reports based on that information. 1555a376accbSmrg# 1556e8340fabSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'. 1557a9a39c43Smrg# 1558e8340fabSmrg# Interface to module: 1559e8340fabSmrg# HAVE_PERL: used in makefiles to conditionally scan text files 1560e8340fabSmrg# PERL: returns the path of the perl program found 1561e8340fabSmrg# returns the path set by the user in the environment 1562e8340fabSmrg# --with-perl: 'yes' user instructs the module to use perl 1563e8340fabSmrg# 'no' user instructs the module not to use perl 1564e8340fabSmrg# have_perl: returns yes if perl found in PATH or no 1565e1670675Smrg# 1566e8340fabSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path. 1567e8340fabSmrg# 1568e8340fabSmrgAC_DEFUN([XORG_WITH_PERL],[ 1569e8340fabSmrgAC_ARG_VAR([PERL], [Path to perl command]) 1570e8340fabSmrg# Preserves the interface, should it be implemented later 1571e8340fabSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])]) 1572e8340fabSmrgm4_define([_defopt], m4_default([$2], [auto])) 1573e8340fabSmrgAC_ARG_WITH(perl, 1574e8340fabSmrg AS_HELP_STRING([--with-perl], 1575e8340fabSmrg [Use perl for extracting information from files (default: ]_defopt[)]), 1576e8340fabSmrg [use_perl=$withval], [use_perl=]_defopt) 1577e8340fabSmrgm4_undefine([_defopt]) 1578e1670675Smrg 1579e8340fabSmrgif test "x$use_perl" = x"auto"; then 1580e8340fabSmrg AC_PATH_PROG([PERL], [perl]) 1581e8340fabSmrg if test "x$PERL" = "x"; then 1582e8340fabSmrg AC_MSG_WARN([perl not found - cannot extract information and report]) 1583e8340fabSmrg have_perl=no 1584e8340fabSmrg else 1585e8340fabSmrg have_perl=yes 1586e8340fabSmrg fi 1587e8340fabSmrgelif test "x$use_perl" = x"yes" ; then 1588e8340fabSmrg AC_PATH_PROG([PERL], [perl]) 1589e8340fabSmrg if test "x$PERL" = "x"; then 1590e8340fabSmrg AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH]) 1591e8340fabSmrg fi 1592e8340fabSmrg have_perl=yes 1593e8340fabSmrgelif test "x$use_perl" = x"no" ; then 1594e8340fabSmrg if test "x$PERL" != "x"; then 1595e8340fabSmrg AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified]) 1596e8340fabSmrg fi 1597e8340fabSmrg have_perl=no 1598e8340fabSmrgelse 1599e8340fabSmrg AC_MSG_ERROR([--with-perl expects 'yes' or 'no']) 1600e8340fabSmrgfi 1601e1670675Smrg 1602e8340fabSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes]) 1603e8340fabSmrg]) # XORG_WITH_PERL 1604e1670675Smrg 1605e8340fabSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT]) 1606e1670675Smrg# ---------------- 1607e8340fabSmrg# Minimum version: 1.5.0 1608e8340fabSmrg# Minimum version for optional DEFAULT argument: 1.11.0 1609e1670675Smrg# 1610e8340fabSmrg# Documentation tools are not always available on all platforms and sometimes 1611e8340fabSmrg# not at the appropriate level. This macro enables a module to test for the 1612e8340fabSmrg# presence of the tool and obtain it's path in separate variables. Coupled with 1613e8340fabSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions 1614e8340fabSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified, 1615e8340fabSmrg# --with-asciidoc assumes 'auto'. 1616e1670675Smrg# 1617e8340fabSmrg# Interface to module: 1618e8340fabSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation 1619e8340fabSmrg# ASCIIDOC: returns the path of the asciidoc program found 1620e8340fabSmrg# returns the path set by the user in the environment 1621e8340fabSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc 1622e8340fabSmrg# 'no' user instructs the module not to use asciidoc 1623e1670675Smrg# 1624e8340fabSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path. 1625e1670675Smrg# 1626e8340fabSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[ 1627e8340fabSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command]) 1628e8340fabSmrgm4_define([_defopt], m4_default([$2], [auto])) 1629e8340fabSmrgAC_ARG_WITH(asciidoc, 1630e8340fabSmrg AS_HELP_STRING([--with-asciidoc], 1631e8340fabSmrg [Use asciidoc to regenerate documentation (default: ]_defopt[)]), 1632e8340fabSmrg [use_asciidoc=$withval], [use_asciidoc=]_defopt) 1633e8340fabSmrgm4_undefine([_defopt]) 1634e1670675Smrg 1635e8340fabSmrgif test "x$use_asciidoc" = x"auto"; then 1636e8340fabSmrg AC_PATH_PROG([ASCIIDOC], [asciidoc]) 1637e8340fabSmrg if test "x$ASCIIDOC" = "x"; then 1638e8340fabSmrg AC_MSG_WARN([asciidoc not found - documentation targets will be skipped]) 1639e8340fabSmrg have_asciidoc=no 1640e8340fabSmrg else 1641e8340fabSmrg have_asciidoc=yes 1642e8340fabSmrg fi 1643e8340fabSmrgelif test "x$use_asciidoc" = x"yes" ; then 1644e8340fabSmrg AC_PATH_PROG([ASCIIDOC], [asciidoc]) 1645e8340fabSmrg if test "x$ASCIIDOC" = "x"; then 1646e8340fabSmrg AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH]) 1647e8340fabSmrg fi 1648e8340fabSmrg have_asciidoc=yes 1649e8340fabSmrgelif test "x$use_asciidoc" = x"no" ; then 1650e8340fabSmrg if test "x$ASCIIDOC" != "x"; then 1651e8340fabSmrg AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified]) 1652e8340fabSmrg fi 1653e8340fabSmrg have_asciidoc=no 1654e8340fabSmrgelse 1655e8340fabSmrg AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no']) 1656e8340fabSmrgfi 1657e8340fabSmrgm4_ifval([$1], 1658e8340fabSmrg[if test "$have_asciidoc" = yes; then 1659e8340fabSmrg # scrape the asciidoc version 1660e8340fabSmrg AC_MSG_CHECKING([the asciidoc version]) 1661e8340fabSmrg asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2` 1662e8340fabSmrg AC_MSG_RESULT([$asciidoc_version]) 1663e8340fabSmrg AS_VERSION_COMPARE([$asciidoc_version], [$1], 1664e8340fabSmrg [if test "x$use_asciidoc" = xauto; then 1665e8340fabSmrg AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed]) 1666e8340fabSmrg have_asciidoc=no 1667e8340fabSmrg else 1668e8340fabSmrg AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed]) 1669e8340fabSmrg fi]) 1670e8340fabSmrgfi]) 1671e8340fabSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes]) 1672e8340fabSmrg]) # XORG_WITH_ASCIIDOC 1673e8340fabSmrg 1674e8340fabSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT]) 1675e8340fabSmrg# ------------------------------------------- 1676e8340fabSmrg# Minimum version: 1.5.0 1677e8340fabSmrg# Minimum version for optional DEFAULT argument: 1.11.0 1678e8340fabSmrg# Minimum version for optional DOT checking: 1.18.0 1679e8340fabSmrg# 1680e8340fabSmrg# Documentation tools are not always available on all platforms and sometimes 1681e8340fabSmrg# not at the appropriate level. This macro enables a module to test for the 1682e8340fabSmrg# presence of the tool and obtain it's path in separate variables. Coupled with 1683e8340fabSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions 1684e8340fabSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified, 1685e8340fabSmrg# --with-doxygen assumes 'auto'. 1686e8340fabSmrg# 1687e8340fabSmrg# Interface to module: 1688e8340fabSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation 1689e8340fabSmrg# DOXYGEN: returns the path of the doxygen program found 1690e8340fabSmrg# returns the path set by the user in the environment 1691e8340fabSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen 1692e8340fabSmrg# 'no' user instructs the module not to use doxygen 1693e8340fabSmrg# 1694e8340fabSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path. 1695e8340fabSmrg# 1696e8340fabSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[ 1697e8340fabSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command]) 1698e8340fabSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility]) 1699e8340fabSmrgm4_define([_defopt], m4_default([$2], [auto])) 1700e8340fabSmrgAC_ARG_WITH(doxygen, 1701e8340fabSmrg AS_HELP_STRING([--with-doxygen], 1702e8340fabSmrg [Use doxygen to regenerate documentation (default: ]_defopt[)]), 1703e8340fabSmrg [use_doxygen=$withval], [use_doxygen=]_defopt) 1704e8340fabSmrgm4_undefine([_defopt]) 1705e1670675Smrg 1706e8340fabSmrgif test "x$use_doxygen" = x"auto"; then 1707e8340fabSmrg AC_PATH_PROG([DOXYGEN], [doxygen]) 1708e8340fabSmrg if test "x$DOXYGEN" = "x"; then 1709e8340fabSmrg AC_MSG_WARN([doxygen not found - documentation targets will be skipped]) 1710e8340fabSmrg have_doxygen=no 1711e8340fabSmrg else 1712e8340fabSmrg have_doxygen=yes 1713e8340fabSmrg fi 1714e8340fabSmrgelif test "x$use_doxygen" = x"yes" ; then 1715e8340fabSmrg AC_PATH_PROG([DOXYGEN], [doxygen]) 1716e8340fabSmrg if test "x$DOXYGEN" = "x"; then 1717e8340fabSmrg AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH]) 1718e8340fabSmrg fi 1719e8340fabSmrg have_doxygen=yes 1720e8340fabSmrgelif test "x$use_doxygen" = x"no" ; then 1721e8340fabSmrg if test "x$DOXYGEN" != "x"; then 1722e8340fabSmrg AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified]) 1723e8340fabSmrg fi 1724e8340fabSmrg have_doxygen=no 1725e8340fabSmrgelse 1726e8340fabSmrg AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no']) 1727e8340fabSmrgfi 1728e8340fabSmrgm4_ifval([$1], 1729e8340fabSmrg[if test "$have_doxygen" = yes; then 1730e8340fabSmrg # scrape the doxygen version 1731e8340fabSmrg AC_MSG_CHECKING([the doxygen version]) 1732e8340fabSmrg doxygen_version=`$DOXYGEN --version 2>/dev/null` 1733e8340fabSmrg AC_MSG_RESULT([$doxygen_version]) 1734e8340fabSmrg AS_VERSION_COMPARE([$doxygen_version], [$1], 1735e8340fabSmrg [if test "x$use_doxygen" = xauto; then 1736e8340fabSmrg AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed]) 1737e8340fabSmrg have_doxygen=no 1738e8340fabSmrg else 1739e8340fabSmrg AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed]) 1740e8340fabSmrg fi]) 1741e8340fabSmrgfi]) 1742e1670675Smrg 1743e8340fabSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory 1744e8340fabSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file: 1745e8340fabSmrgdnl HAVE_DOT = @HAVE_DOT@ 1746e8340fabSmrgHAVE_DOT=no 1747e8340fabSmrgif test "x$have_doxygen" = "xyes"; then 1748e8340fabSmrg AC_PATH_PROG([DOT], [dot]) 1749e8340fabSmrg if test "x$DOT" != "x"; then 1750e8340fabSmrg HAVE_DOT=yes 1751e8340fabSmrg fi 1752e8340fabSmrgfi 1753e1670675Smrg 1754e8340fabSmrgAC_SUBST([HAVE_DOT]) 1755e8340fabSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"]) 1756e8340fabSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes]) 1757e8340fabSmrg]) # XORG_WITH_DOXYGEN 1758e1670675Smrg 1759e8340fabSmrg# XORG_WITH_GROFF([DEFAULT]) 1760e8340fabSmrg# ---------------- 1761e8340fabSmrg# Minimum version: 1.6.0 1762e8340fabSmrg# Minimum version for optional DEFAULT argument: 1.11.0 1763e1670675Smrg# 1764e8340fabSmrg# Documentation tools are not always available on all platforms and sometimes 1765e8340fabSmrg# not at the appropriate level. This macro enables a module to test for the 1766e8340fabSmrg# presence of the tool and obtain it's path in separate variables. Coupled with 1767e8340fabSmrg# the --with-groff option, it allows maximum flexibility in making decisions 1768e8340fabSmrg# as whether or not to use the groff package. When DEFAULT is not specified, 1769e8340fabSmrg# --with-groff assumes 'auto'. 1770e1670675Smrg# 1771e8340fabSmrg# Interface to module: 1772e8340fabSmrg# HAVE_GROFF: used in makefiles to conditionally generate documentation 1773e8340fabSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package 1774e8340fabSmrg# HAVE_GROFF_MS: the -ms macros package 1775e8340fabSmrg# GROFF: returns the path of the groff program found 1776e8340fabSmrg# returns the path set by the user in the environment 1777e8340fabSmrg# --with-groff: 'yes' user instructs the module to use groff 1778e8340fabSmrg# 'no' user instructs the module not to use groff 1779e1670675Smrg# 1780e8340fabSmrg# Added in version 1.9.0: 1781e8340fabSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format: 1782e8340fabSmrg# pnmcut pnmcrop pnmtopng pnmtops from the netpbm package. 1783e8340fabSmrg# psselect from the psutils package. 1784e8340fabSmrg# the ghostcript package. Refer to the grohtml man pages 1785e1670675Smrg# 1786e8340fabSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path. 1787e1670675Smrg# 1788e8340fabSmrg# OS and distros often splits groff in a basic and full package, the former 1789e8340fabSmrg# having the groff program and the later having devices, fonts and macros 1790e8340fabSmrg# Checking for the groff executable is not enough. 1791e1670675Smrg# 1792e8340fabSmrg# If macros are missing, we cannot assume that groff is useless, so we don't 1793e8340fabSmrg# unset HAVE_GROFF or GROFF env variables. 1794e8340fabSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false. 1795e1670675Smrg# 1796e8340fabSmrgAC_DEFUN([XORG_WITH_GROFF],[ 1797e8340fabSmrgAC_ARG_VAR([GROFF], [Path to groff command]) 1798e8340fabSmrgm4_define([_defopt], m4_default([$1], [auto])) 1799e8340fabSmrgAC_ARG_WITH(groff, 1800e8340fabSmrg AS_HELP_STRING([--with-groff], 1801e8340fabSmrg [Use groff to regenerate documentation (default: ]_defopt[)]), 1802e8340fabSmrg [use_groff=$withval], [use_groff=]_defopt) 1803e8340fabSmrgm4_undefine([_defopt]) 1804e1670675Smrg 1805e8340fabSmrgif test "x$use_groff" = x"auto"; then 1806e8340fabSmrg AC_PATH_PROG([GROFF], [groff]) 1807e8340fabSmrg if test "x$GROFF" = "x"; then 1808e8340fabSmrg AC_MSG_WARN([groff not found - documentation targets will be skipped]) 1809e8340fabSmrg have_groff=no 1810e8340fabSmrg else 1811e8340fabSmrg have_groff=yes 1812e8340fabSmrg fi 1813e8340fabSmrgelif test "x$use_groff" = x"yes" ; then 1814e8340fabSmrg AC_PATH_PROG([GROFF], [groff]) 1815e8340fabSmrg if test "x$GROFF" = "x"; then 1816e8340fabSmrg AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH]) 1817e8340fabSmrg fi 1818e8340fabSmrg have_groff=yes 1819e8340fabSmrgelif test "x$use_groff" = x"no" ; then 1820e8340fabSmrg if test "x$GROFF" != "x"; then 1821e8340fabSmrg AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified]) 1822e8340fabSmrg fi 1823e8340fabSmrg have_groff=no 1824e1670675Smrgelse 1825e8340fabSmrg AC_MSG_ERROR([--with-groff expects 'yes' or 'no']) 1826a9a39c43Smrgfi 1827e1670675Smrg 1828e8340fabSmrg# We have groff, test for the presence of the macro packages 1829e8340fabSmrgif test "x$have_groff" = x"yes"; then 1830e8340fabSmrg AC_MSG_CHECKING([for ${GROFF} -ms macros]) 1831e8340fabSmrg if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then 1832e8340fabSmrg groff_ms_works=yes 1833e8340fabSmrg else 1834e8340fabSmrg groff_ms_works=no 1835e8340fabSmrg fi 1836e8340fabSmrg AC_MSG_RESULT([$groff_ms_works]) 1837e8340fabSmrg AC_MSG_CHECKING([for ${GROFF} -mm macros]) 1838e8340fabSmrg if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then 1839e8340fabSmrg groff_mm_works=yes 1840e8340fabSmrg else 1841e8340fabSmrg groff_mm_works=no 1842e8340fabSmrg fi 1843e8340fabSmrg AC_MSG_RESULT([$groff_mm_works]) 1844e8340fabSmrgfi 1845e1670675Smrg 1846e8340fabSmrg# We have groff, test for HTML dependencies, one command per package 1847e8340fabSmrgif test "x$have_groff" = x"yes"; then 1848e8340fabSmrg AC_PATH_PROGS(GS_PATH, [gs gswin32c]) 1849e8340fabSmrg AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng]) 1850e8340fabSmrg AC_PATH_PROG(PSSELECT_PATH, [psselect]) 1851e8340fabSmrg if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then 1852e8340fabSmrg have_groff_html=yes 1853e8340fabSmrg else 1854e8340fabSmrg have_groff_html=no 1855e8340fabSmrg AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages]) 1856e8340fabSmrg fi 1857e8340fabSmrgfi 1858e1670675Smrg 1859e8340fabSmrg# Set Automake conditionals for Makefiles 1860e8340fabSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes]) 1861e8340fabSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes]) 1862e8340fabSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes]) 1863e8340fabSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes]) 1864e8340fabSmrg]) # XORG_WITH_GROFF 1865e1670675Smrg 1866e8340fabSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT]) 1867e8340fabSmrg# --------------------------------------- 1868e8340fabSmrg# Minimum version: 1.6.0 1869e8340fabSmrg# Minimum version for optional DEFAULT argument: 1.11.0 1870e8340fabSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0 1871e8340fabSmrg# 1872e8340fabSmrg# Documentation tools are not always available on all platforms and sometimes 1873e8340fabSmrg# not at the appropriate level. This macro enables a module to test for the 1874e8340fabSmrg# presence of the tool and obtain it's path in separate variables. Coupled with 1875e8340fabSmrg# the --with-fop option, it allows maximum flexibility in making decisions 1876e8340fabSmrg# as whether or not to use the fop package. When DEFAULT is not specified, 1877e8340fabSmrg# --with-fop assumes 'auto'. 1878e8340fabSmrg# 1879e8340fabSmrg# Interface to module: 1880e8340fabSmrg# HAVE_FOP: used in makefiles to conditionally generate documentation 1881e8340fabSmrg# FOP: returns the path of the fop program found 1882e8340fabSmrg# returns the path set by the user in the environment 1883e8340fabSmrg# --with-fop: 'yes' user instructs the module to use fop 1884e8340fabSmrg# 'no' user instructs the module not to use fop 1885e8340fabSmrg# 1886e8340fabSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path. 1887e8340fabSmrg# 1888e8340fabSmrgAC_DEFUN([XORG_WITH_FOP],[ 1889e8340fabSmrgAC_ARG_VAR([FOP], [Path to fop command]) 1890e8340fabSmrgm4_define([_defopt], m4_default([$2], [auto])) 1891e8340fabSmrgAC_ARG_WITH(fop, 1892e8340fabSmrg AS_HELP_STRING([--with-fop], 1893e8340fabSmrg [Use fop to regenerate documentation (default: ]_defopt[)]), 1894e8340fabSmrg [use_fop=$withval], [use_fop=]_defopt) 1895e8340fabSmrgm4_undefine([_defopt]) 1896129be1b7Smrg 1897e8340fabSmrgif test "x$use_fop" = x"auto"; then 1898e8340fabSmrg AC_PATH_PROG([FOP], [fop]) 1899e8340fabSmrg if test "x$FOP" = "x"; then 1900e8340fabSmrg AC_MSG_WARN([fop not found - documentation targets will be skipped]) 1901e8340fabSmrg have_fop=no 1902e8340fabSmrg else 1903e8340fabSmrg have_fop=yes 1904e8340fabSmrg fi 1905e8340fabSmrgelif test "x$use_fop" = x"yes" ; then 1906e8340fabSmrg AC_PATH_PROG([FOP], [fop]) 1907e8340fabSmrg if test "x$FOP" = "x"; then 1908e8340fabSmrg AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH]) 1909e8340fabSmrg fi 1910e8340fabSmrg have_fop=yes 1911e8340fabSmrgelif test "x$use_fop" = x"no" ; then 1912e8340fabSmrg if test "x$FOP" != "x"; then 1913e8340fabSmrg AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified]) 1914e8340fabSmrg fi 1915e8340fabSmrg have_fop=no 1916a9a39c43Smrgelse 1917e8340fabSmrg AC_MSG_ERROR([--with-fop expects 'yes' or 'no']) 1918a9a39c43Smrgfi 1919e1670675Smrg 1920e8340fabSmrg# Test for a minimum version of fop, if provided. 1921e8340fabSmrgm4_ifval([$1], 1922e8340fabSmrg[if test "$have_fop" = yes; then 1923e8340fabSmrg # scrape the fop version 1924e8340fabSmrg AC_MSG_CHECKING([for fop minimum version]) 1925e8340fabSmrg fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3` 1926e8340fabSmrg AC_MSG_RESULT([$fop_version]) 1927e8340fabSmrg AS_VERSION_COMPARE([$fop_version], [$1], 1928e8340fabSmrg [if test "x$use_fop" = xauto; then 1929e8340fabSmrg AC_MSG_WARN([fop version $fop_version found, but $1 needed]) 1930e8340fabSmrg have_fop=no 1931e8340fabSmrg else 1932e8340fabSmrg AC_MSG_ERROR([fop version $fop_version found, but $1 needed]) 1933e8340fabSmrg fi]) 1934e8340fabSmrgfi]) 1935e8340fabSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes]) 1936e8340fabSmrg]) # XORG_WITH_FOP 1937e1670675Smrg 1938e8340fabSmrg# XORG_WITH_M4([MIN-VERSION]) 1939e8340fabSmrg# --------------------------- 1940e8340fabSmrg# Minimum version: 1.19.0 1941a376accbSmrg# 1942e8340fabSmrg# This macro attempts to locate an m4 macro processor which supports 1943e8340fabSmrg# -I option and is only useful for modules relying on M4 in order to 1944e8340fabSmrg# expand macros in source code files. 1945a9a39c43Smrg# 1946e8340fabSmrg# Interface to module: 1947e8340fabSmrg# M4: returns the path of the m4 program found 1948e8340fabSmrg# returns the path set by the user in the environment 1949e8340fabSmrg# 1950e8340fabSmrgAC_DEFUN([XORG_WITH_M4], [ 1951e8340fabSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4], 1952e8340fabSmrg [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4], 1953e8340fabSmrg [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \ 1954e8340fabSmrg ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]], 1955e8340fabSmrg [AC_MSG_ERROR([could not find m4 that supports -I option])], 1956e8340fabSmrg [$PATH:/usr/gnu/bin])]) 1957a376accbSmrg 1958e8340fabSmrgAC_SUBST([M4], [$ac_cv_path_M4]) 1959e8340fabSmrg]) # XORG_WITH_M4 1960a376accbSmrg 1961e8340fabSmrg# XORG_WITH_PS2PDF([DEFAULT]) 1962e8340fabSmrg# ---------------- 1963e8340fabSmrg# Minimum version: 1.6.0 1964e8340fabSmrg# Minimum version for optional DEFAULT argument: 1.11.0 1965e8340fabSmrg# 1966e8340fabSmrg# Documentation tools are not always available on all platforms and sometimes 1967e8340fabSmrg# not at the appropriate level. This macro enables a module to test for the 1968e8340fabSmrg# presence of the tool and obtain it's path in separate variables. Coupled with 1969e8340fabSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions 1970e8340fabSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified, 1971e8340fabSmrg# --with-ps2pdf assumes 'auto'. 1972e8340fabSmrg# 1973e8340fabSmrg# Interface to module: 1974e8340fabSmrg# HAVE_PS2PDF: used in makefiles to conditionally generate documentation 1975e8340fabSmrg# PS2PDF: returns the path of the ps2pdf program found 1976e8340fabSmrg# returns the path set by the user in the environment 1977e8340fabSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf 1978e8340fabSmrg# 'no' user instructs the module not to use ps2pdf 1979e8340fabSmrg# 1980e8340fabSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path. 1981e8340fabSmrg# 1982e8340fabSmrgAC_DEFUN([XORG_WITH_PS2PDF],[ 1983e8340fabSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command]) 1984e8340fabSmrgm4_define([_defopt], m4_default([$1], [auto])) 1985e8340fabSmrgAC_ARG_WITH(ps2pdf, 1986e8340fabSmrg AS_HELP_STRING([--with-ps2pdf], 1987e8340fabSmrg [Use ps2pdf to regenerate documentation (default: ]_defopt[)]), 1988e8340fabSmrg [use_ps2pdf=$withval], [use_ps2pdf=]_defopt) 1989e8340fabSmrgm4_undefine([_defopt]) 1990a376accbSmrg 1991e8340fabSmrgif test "x$use_ps2pdf" = x"auto"; then 1992e8340fabSmrg AC_PATH_PROG([PS2PDF], [ps2pdf]) 1993e8340fabSmrg if test "x$PS2PDF" = "x"; then 1994e8340fabSmrg AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped]) 1995e8340fabSmrg have_ps2pdf=no 1996e8340fabSmrg else 1997e8340fabSmrg have_ps2pdf=yes 1998e8340fabSmrg fi 1999e8340fabSmrgelif test "x$use_ps2pdf" = x"yes" ; then 2000e8340fabSmrg AC_PATH_PROG([PS2PDF], [ps2pdf]) 2001e8340fabSmrg if test "x$PS2PDF" = "x"; then 2002e8340fabSmrg AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH]) 2003e8340fabSmrg fi 2004e8340fabSmrg have_ps2pdf=yes 2005e8340fabSmrgelif test "x$use_ps2pdf" = x"no" ; then 2006e8340fabSmrg if test "x$PS2PDF" != "x"; then 2007e8340fabSmrg AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified]) 2008e8340fabSmrg fi 2009e8340fabSmrg have_ps2pdf=no 2010e8340fabSmrgelse 2011e8340fabSmrg AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no']) 2012a9a39c43Smrgfi 2013e8340fabSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes]) 2014e8340fabSmrg]) # XORG_WITH_PS2PDF 2015e1670675Smrg 2016e8340fabSmrg# XORG_ENABLE_DOCS (enable_docs=yes) 2017e8340fabSmrg# ---------------- 2018e8340fabSmrg# Minimum version: 1.6.0 2019e8340fabSmrg# 2020e8340fabSmrg# Documentation tools are not always available on all platforms and sometimes 2021e8340fabSmrg# not at the appropriate level. This macro enables a builder to skip all 2022e8340fabSmrg# documentation targets except traditional man pages. 2023e8340fabSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides 2024e8340fabSmrg# maximum flexibility in controlling documentation building. 2025e8340fabSmrg# Refer to: 2026e8340fabSmrg# XORG_WITH_XMLTO --with-xmlto 2027e8340fabSmrg# XORG_WITH_ASCIIDOC --with-asciidoc 2028e8340fabSmrg# XORG_WITH_DOXYGEN --with-doxygen 2029e8340fabSmrg# XORG_WITH_FOP --with-fop 2030e8340fabSmrg# XORG_WITH_GROFF --with-groff 2031e8340fabSmrg# XORG_WITH_PS2PDF --with-ps2pdf 2032e8340fabSmrg# 2033e8340fabSmrg# Interface to module: 2034e8340fabSmrg# ENABLE_DOCS: used in makefiles to conditionally generate documentation 2035e8340fabSmrg# --enable-docs: 'yes' user instructs the module to generate docs 2036e8340fabSmrg# 'no' user instructs the module not to generate docs 2037e8340fabSmrg# parm1: specify the default value, yes or no. 2038e8340fabSmrg# 2039e8340fabSmrgAC_DEFUN([XORG_ENABLE_DOCS],[ 2040e8340fabSmrgm4_define([docs_default], m4_default([$1], [yes])) 2041e8340fabSmrgAC_ARG_ENABLE(docs, 2042e8340fabSmrg AS_HELP_STRING([--enable-docs], 2043e8340fabSmrg [Enable building the documentation (default: ]docs_default[)]), 2044e8340fabSmrg [build_docs=$enableval], [build_docs=]docs_default) 2045e8340fabSmrgm4_undefine([docs_default]) 2046e8340fabSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes]) 2047e8340fabSmrgAC_MSG_CHECKING([whether to build documentation]) 2048e8340fabSmrgAC_MSG_RESULT([$build_docs]) 2049e8340fabSmrg]) # XORG_ENABLE_DOCS 2050e1670675Smrg 2051e8340fabSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes) 2052e8340fabSmrg# ---------------- 2053e8340fabSmrg# Minimum version: 1.6.0 2054e8340fabSmrg# 2055e8340fabSmrg# This macro enables a builder to skip all developer documentation. 2056e8340fabSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides 2057e8340fabSmrg# maximum flexibility in controlling documentation building. 2058e8340fabSmrg# Refer to: 2059e8340fabSmrg# XORG_WITH_XMLTO --with-xmlto 2060e8340fabSmrg# XORG_WITH_ASCIIDOC --with-asciidoc 2061e8340fabSmrg# XORG_WITH_DOXYGEN --with-doxygen 2062e8340fabSmrg# XORG_WITH_FOP --with-fop 2063e8340fabSmrg# XORG_WITH_GROFF --with-groff 2064e8340fabSmrg# XORG_WITH_PS2PDF --with-ps2pdf 2065e8340fabSmrg# 2066e8340fabSmrg# Interface to module: 2067e8340fabSmrg# ENABLE_DEVEL_DOCS: used in makefiles to conditionally generate developer docs 2068e8340fabSmrg# --enable-devel-docs: 'yes' user instructs the module to generate developer docs 2069e8340fabSmrg# 'no' user instructs the module not to generate developer docs 2070e8340fabSmrg# parm1: specify the default value, yes or no. 2071e8340fabSmrg# 2072e8340fabSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[ 2073e8340fabSmrgm4_define([devel_default], m4_default([$1], [yes])) 2074e8340fabSmrgAC_ARG_ENABLE(devel-docs, 2075e8340fabSmrg AS_HELP_STRING([--enable-devel-docs], 2076e8340fabSmrg [Enable building the developer documentation (default: ]devel_default[)]), 2077e8340fabSmrg [build_devel_docs=$enableval], [build_devel_docs=]devel_default) 2078e8340fabSmrgm4_undefine([devel_default]) 2079e8340fabSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes]) 2080e8340fabSmrgAC_MSG_CHECKING([whether to build developer documentation]) 2081e8340fabSmrgAC_MSG_RESULT([$build_devel_docs]) 2082e8340fabSmrg]) # XORG_ENABLE_DEVEL_DOCS 2083a376accbSmrg 2084e8340fabSmrg# XORG_ENABLE_SPECS (enable_specs=yes) 2085e8340fabSmrg# ---------------- 2086e8340fabSmrg# Minimum version: 1.6.0 2087e8340fabSmrg# 2088e8340fabSmrg# This macro enables a builder to skip all functional specification targets. 2089e8340fabSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides 2090e8340fabSmrg# maximum flexibility in controlling documentation building. 2091e8340fabSmrg# Refer to: 2092e8340fabSmrg# XORG_WITH_XMLTO --with-xmlto 2093e8340fabSmrg# XORG_WITH_ASCIIDOC --with-asciidoc 2094e8340fabSmrg# XORG_WITH_DOXYGEN --with-doxygen 2095e8340fabSmrg# XORG_WITH_FOP --with-fop 2096e8340fabSmrg# XORG_WITH_GROFF --with-groff 2097e8340fabSmrg# XORG_WITH_PS2PDF --with-ps2pdf 2098e8340fabSmrg# 2099e8340fabSmrg# Interface to module: 2100e8340fabSmrg# ENABLE_SPECS: used in makefiles to conditionally generate specs 2101e8340fabSmrg# --enable-specs: 'yes' user instructs the module to generate specs 2102e8340fabSmrg# 'no' user instructs the module not to generate specs 2103e8340fabSmrg# parm1: specify the default value, yes or no. 2104e8340fabSmrg# 2105e8340fabSmrgAC_DEFUN([XORG_ENABLE_SPECS],[ 2106e8340fabSmrgm4_define([spec_default], m4_default([$1], [yes])) 2107e8340fabSmrgAC_ARG_ENABLE(specs, 2108e8340fabSmrg AS_HELP_STRING([--enable-specs], 2109e8340fabSmrg [Enable building the specs (default: ]spec_default[)]), 2110e8340fabSmrg [build_specs=$enableval], [build_specs=]spec_default) 2111e8340fabSmrgm4_undefine([spec_default]) 2112e8340fabSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes]) 2113e8340fabSmrgAC_MSG_CHECKING([whether to build functional specifications]) 2114e8340fabSmrgAC_MSG_RESULT([$build_specs]) 2115e8340fabSmrg]) # XORG_ENABLE_SPECS 2116e1670675Smrg 2117e8340fabSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto) 2118e8340fabSmrg# ---------------------------------------------- 2119e8340fabSmrg# Minimum version: 1.13.0 2120e8340fabSmrg# 2121e8340fabSmrg# This macro enables a builder to enable/disable unit testing 2122e8340fabSmrg# It makes no assumption about the test cases implementation 2123e8340fabSmrg# Test cases may or may not use Automake "Support for test suites" 2124e8340fabSmrg# They may or may not use the software utility library GLib 2125e8340fabSmrg# 2126e8340fabSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL 2127e8340fabSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib. 2128e8340fabSmrg# The variable enable_unit_tests is used by other macros in this file. 2129e8340fabSmrg# 2130e8340fabSmrg# Interface to module: 2131e8340fabSmrg# ENABLE_UNIT_TESTS: used in makefiles to conditionally build tests 2132e8340fabSmrg# enable_unit_tests: used in configure.ac for additional configuration 2133e8340fabSmrg# --enable-unit-tests: 'yes' user instructs the module to build tests 2134e8340fabSmrg# 'no' user instructs the module not to build tests 2135e8340fabSmrg# parm1: specify the default value, yes or no. 2136e8340fabSmrg# 2137e8340fabSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[ 2138e8340fabSmrgAC_BEFORE([$0], [XORG_WITH_GLIB]) 2139e8340fabSmrgAC_BEFORE([$0], [XORG_LD_WRAP]) 2140e8340fabSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS]) 2141e8340fabSmrgm4_define([_defopt], m4_default([$1], [auto])) 2142e8340fabSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests], 2143e8340fabSmrg [Enable building unit test cases (default: ]_defopt[)]), 2144e8340fabSmrg [enable_unit_tests=$enableval], [enable_unit_tests=]_defopt) 2145e8340fabSmrgm4_undefine([_defopt]) 2146e8340fabSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno]) 2147e8340fabSmrgAC_MSG_CHECKING([whether to build unit test cases]) 2148e8340fabSmrgAC_MSG_RESULT([$enable_unit_tests]) 2149e8340fabSmrg]) # XORG_ENABLE_UNIT_TESTS 2150e1670675Smrg 2151e8340fabSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto) 2152e8340fabSmrg# ------------------------------------------------------ 2153e8340fabSmrg# Minimum version: 1.17.0 2154e8340fabSmrg# 2155e8340fabSmrg# This macro enables a builder to enable/disable integration testing 2156e8340fabSmrg# It makes no assumption about the test cases' implementation 2157e8340fabSmrg# Test cases may or may not use Automake "Support for test suites" 2158e8340fabSmrg# 2159e8340fabSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support 2160e8340fabSmrg# usually requires less dependencies and may be built and run under less 2161e8340fabSmrg# stringent environments than integration tests. 2162e8340fabSmrg# 2163e8340fabSmrg# Interface to module: 2164e8340fabSmrg# ENABLE_INTEGRATION_TESTS: used in makefiles to conditionally build tests 2165e8340fabSmrg# enable_integration_tests: used in configure.ac for additional configuration 2166e8340fabSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests 2167e8340fabSmrg# 'no' user instructs the module not to build tests 2168e8340fabSmrg# parm1: specify the default value, yes or no. 2169e8340fabSmrg# 2170e8340fabSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[ 2171e8340fabSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS]) 2172e8340fabSmrgm4_define([_defopt], m4_default([$1], [auto])) 2173e8340fabSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests], 2174e8340fabSmrg [Enable building integration test cases (default: ]_defopt[)]), 2175e8340fabSmrg [enable_integration_tests=$enableval], 2176e8340fabSmrg [enable_integration_tests=]_defopt) 2177e8340fabSmrgm4_undefine([_defopt]) 2178e8340fabSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS], 2179e8340fabSmrg [test "x$enable_integration_tests" != xno]) 2180e8340fabSmrgAC_MSG_CHECKING([whether to build unit test cases]) 2181e8340fabSmrgAC_MSG_RESULT([$enable_integration_tests]) 2182e8340fabSmrg]) # XORG_ENABLE_INTEGRATION_TESTS 2183e1670675Smrg 2184e8340fabSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT]) 2185e8340fabSmrg# ---------------------------------------- 2186e8340fabSmrg# Minimum version: 1.13.0 2187e8340fabSmrg# 2188e8340fabSmrg# GLib is a library which provides advanced data structures and functions. 2189e8340fabSmrg# This macro enables a module to test for the presence of Glib. 2190e8340fabSmrg# 2191e8340fabSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing. 2192e8340fabSmrg# Otherwise the value of $enable_unit_tests is blank. 2193e8340fabSmrg# 2194e8340fabSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit 2195e8340fabSmrg# test support usually requires less dependencies and may be built and run under 2196e8340fabSmrg# less stringent environments than integration tests. 2197e8340fabSmrg# 2198e8340fabSmrg# Interface to module: 2199e8340fabSmrg# HAVE_GLIB: used in makefiles to conditionally build targets 2200e8340fabSmrg# with_glib: used in configure.ac to know if GLib has been found 2201e8340fabSmrg# --with-glib: 'yes' user instructs the module to use glib 2202e8340fabSmrg# 'no' user instructs the module not to use glib 2203e8340fabSmrg# 2204e8340fabSmrgAC_DEFUN([XORG_WITH_GLIB],[ 2205e8340fabSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG]) 2206e8340fabSmrgm4_define([_defopt], m4_default([$2], [auto])) 2207e8340fabSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib], 2208e8340fabSmrg [Use GLib library for unit testing (default: ]_defopt[)]), 2209e8340fabSmrg [with_glib=$withval], [with_glib=]_defopt) 2210e8340fabSmrgm4_undefine([_defopt]) 2211e8340fabSmrg 2212e8340fabSmrghave_glib=no 2213e8340fabSmrg# Do not probe GLib if user explicitly disabled unit testing 2214e8340fabSmrgif test "x$enable_unit_tests" != x"no"; then 2215e8340fabSmrg # Do not probe GLib if user explicitly disabled it 2216e8340fabSmrg if test "x$with_glib" != x"no"; then 2217e8340fabSmrg m4_ifval( 2218e8340fabSmrg [$1], 2219e8340fabSmrg [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])], 2220e8340fabSmrg [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])] 2221e8340fabSmrg ) 2222e1670675Smrg fi 2223a9a39c43Smrgfi 2224a9a39c43Smrg 2225e8340fabSmrg# Not having GLib when unit testing has been explicitly requested is an error 2226e8340fabSmrgif test "x$enable_unit_tests" = x"yes"; then 2227e8340fabSmrg if test "x$have_glib" = x"no"; then 2228e8340fabSmrg AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found]) 2229e8340fabSmrg fi 2230e8340fabSmrgfi 2231e1670675Smrg 2232e8340fabSmrg# Having unit testing disabled when GLib has been explicitly requested is an error 2233e8340fabSmrgif test "x$enable_unit_tests" = x"no"; then 2234e8340fabSmrg if test "x$with_glib" = x"yes"; then 2235e8340fabSmrg AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found]) 2236e8340fabSmrg fi 2237e8340fabSmrgfi 2238e1670675Smrg 2239e8340fabSmrg# Not having GLib when it has been explicitly requested is an error 2240e8340fabSmrgif test "x$with_glib" = x"yes"; then 2241e8340fabSmrg if test "x$have_glib" = x"no"; then 2242e8340fabSmrg AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found]) 2243e8340fabSmrg fi 2244a9a39c43Smrgfi 2245a9a39c43Smrg 2246e8340fabSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes]) 2247e8340fabSmrg]) # XORG_WITH_GLIB 2248e8340fabSmrg 2249e8340fabSmrg# XORG_LD_WRAP([required|optional]) 2250e8340fabSmrg# --------------------------------- 2251e8340fabSmrg# Minimum version: 1.13.0 2252a9a39c43Smrg# 2253e8340fabSmrg# Check if linker supports -wrap, passed via compiler flags 2254e8340fabSmrg# 2255e8340fabSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing. 2256e8340fabSmrg# Otherwise the value of $enable_unit_tests is blank. 2257e8340fabSmrg# 2258e8340fabSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior 2259e8340fabSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not 2260e8340fabSmrg# available, an argument of "optional" allows use when some unit tests require 2261e8340fabSmrg# ld -wrap and others do not. 2262e8340fabSmrg# 2263e8340fabSmrgAC_DEFUN([XORG_LD_WRAP],[ 2264e8340fabSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no], 2265e8340fabSmrg [AC_LANG_PROGRAM([#include <stdlib.h> 2266e8340fabSmrg void __wrap_exit(int status) { return; }], 2267e8340fabSmrg [exit(0);])]) 2268e8340fabSmrg# Not having ld wrap when unit testing has been explicitly requested is an error 2269e8340fabSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then 2270e8340fabSmrg if test "x$have_ld_wrap" = x"no"; then 2271e8340fabSmrg AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available]) 2272e8340fabSmrg fi 2273e8340fabSmrgfi 2274e8340fabSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes]) 2275e8340fabSmrg# 2276e8340fabSmrg]) # XORG_LD_WRAP 2277a9a39c43Smrg 2278e8340fabSmrg# XORG_CHECK_LINKER_FLAGS 2279e8340fabSmrg# ----------------------- 2280e8340fabSmrg# SYNOPSIS 2281e8340fabSmrg# 2282e8340fabSmrg# XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE]) 2283e8340fabSmrg# 2284e8340fabSmrg# DESCRIPTION 2285e8340fabSmrg# 2286e8340fabSmrg# Check whether the given linker FLAGS work with the current language's 2287e8340fabSmrg# linker, or whether they give an error. 2288e8340fabSmrg# 2289e8340fabSmrg# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on 2290e8340fabSmrg# success/failure. 2291e8340fabSmrg# 2292e8340fabSmrg# PROGRAM-SOURCE is the program source to link with, if needed 2293e8340fabSmrg# 2294e8340fabSmrg# NOTE: Based on AX_CHECK_COMPILER_FLAGS. 2295e8340fabSmrg# 2296e8340fabSmrg# LICENSE 2297e8340fabSmrg# 2298e8340fabSmrg# Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org> 2299e8340fabSmrg# Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu> 2300e8340fabSmrg# Copyright (c) 2009 Matteo Frigo 2301e8340fabSmrg# 2302e8340fabSmrg# This program is free software: you can redistribute it and/or modify it 2303e8340fabSmrg# under the terms of the GNU General Public License as published by the 2304e8340fabSmrg# Free Software Foundation, either version 3 of the License, or (at your 2305e8340fabSmrg# option) any later version. 2306e8340fabSmrg# 2307e8340fabSmrg# This program is distributed in the hope that it will be useful, but 2308e8340fabSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 2309e8340fabSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 2310e8340fabSmrg# Public License for more details. 2311e8340fabSmrg# 2312e8340fabSmrg# You should have received a copy of the GNU General Public License along 2313e8340fabSmrg# with this program. If not, see <http://www.gnu.org/licenses/>. 2314e8340fabSmrg# 2315e8340fabSmrg# As a special exception, the respective Autoconf Macro's copyright owner 2316e8340fabSmrg# gives unlimited permission to copy, distribute and modify the configure 2317e8340fabSmrg# scripts that are the output of Autoconf when processing the Macro. You 2318e8340fabSmrg# need not follow the terms of the GNU General Public License when using 2319e8340fabSmrg# or distributing such scripts, even though portions of the text of the 2320e8340fabSmrg# Macro appear in them. The GNU General Public License (GPL) does govern 2321e8340fabSmrg# all other use of the material that constitutes the Autoconf Macro. 2322e8340fabSmrg# 2323e8340fabSmrg# This special exception to the GPL applies to versions of the Autoconf 2324e8340fabSmrg# Macro released by the Autoconf Archive. When you make and distribute a 2325e8340fabSmrg# modified version of the Autoconf Macro, you may extend this special 2326e8340fabSmrg# exception to the GPL to apply to your modified version as well.# 2327e8340fabSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS], 2328e8340fabSmrg[AC_MSG_CHECKING([whether the linker accepts $1]) 2329e8340fabSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: 2330e8340fabSmrgAS_LITERAL_IF([$1], 2331e8340fabSmrg [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [ 2332e8340fabSmrg ax_save_FLAGS=$LDFLAGS 2333e8340fabSmrg LDFLAGS="$1" 2334e8340fabSmrg AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])], 2335e8340fabSmrg AS_TR_SH(xorg_cv_linker_flags_[$1])=yes, 2336e8340fabSmrg AS_TR_SH(xorg_cv_linker_flags_[$1])=no) 2337e8340fabSmrg LDFLAGS=$ax_save_FLAGS])], 2338e8340fabSmrg [ax_save_FLAGS=$LDFLAGS 2339e8340fabSmrg LDFLAGS="$1" 2340e8340fabSmrg AC_LINK_IFELSE([AC_LANG_PROGRAM()], 2341e8340fabSmrg eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes, 2342e8340fabSmrg eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no) 2343e8340fabSmrg LDFLAGS=$ax_save_FLAGS]) 2344e8340fabSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1]) 2345e8340fabSmrgAC_MSG_RESULT($xorg_check_linker_flags) 2346e8340fabSmrgif test "x$xorg_check_linker_flags" = xyes; then 2347e8340fabSmrg m4_default([$2], :) 2348e1670675Smrgelse 2349e8340fabSmrg m4_default([$3], :) 2350a9a39c43Smrgfi 2351e8340fabSmrg]) # XORG_CHECK_LINKER_FLAGS 2352a376accbSmrg 2353e8340fabSmrg# XORG_MEMORY_CHECK_FLAGS 2354e8340fabSmrg# ----------------------- 2355e8340fabSmrg# Minimum version: 1.16.0 2356a376accbSmrg# 2357e8340fabSmrg# This macro attempts to find appropriate memory checking functionality 2358e8340fabSmrg# for various platforms which unit testing code may use to catch various 2359e8340fabSmrg# forms of memory allocation and access errors in testing. 2360e8340fabSmrg# 2361e8340fabSmrg# Interface to module: 2362e8340fabSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging 2363e8340fabSmrg# Usually added to TESTS_ENVIRONMENT in Makefile.am 2364e8340fabSmrg# 2365e8340fabSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim. 2366e8340fabSmrg# 2367e8340fabSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[ 2368129be1b7Smrg 2369e8340fabSmrgAC_REQUIRE([AC_CANONICAL_HOST]) 2370e8340fabSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV], 2371e8340fabSmrg [Environment variables to enable memory checking in tests]) 2372e8340fabSmrg 2373e8340fabSmrg# Check for different types of support on different platforms 2374e8340fabSmrgcase $host_os in 2375e8340fabSmrg solaris*) 2376e8340fabSmrg AC_CHECK_LIB([umem], [umem_alloc], 2377e8340fabSmrg [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default']) 2378e8340fabSmrg ;; 2379e8340fabSmrg *-gnu*) # GNU libc - Value is used as a single byte bit pattern, 2380e8340fabSmrg # both directly and inverted, so should not be 0 or 255. 2381e8340fabSmrg malloc_debug_env='MALLOC_PERTURB_=15' 2382e8340fabSmrg ;; 2383e8340fabSmrg darwin*) 2384e8340fabSmrg malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib' 2385e8340fabSmrg ;; 2386e8340fabSmrg *bsd*) 2387e8340fabSmrg malloc_debug_env='MallocPreScribble=1 MallocScribble=1' 2388e8340fabSmrg ;; 2389e1670675Smrgesac 2390129be1b7Smrg 2391e8340fabSmrg# User supplied flags override default flags 2392e8340fabSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then 2393e8340fabSmrg malloc_debug_env="$XORG_MALLOC_DEBUG_ENV" 2394e8340fabSmrgfi 2395e1670675Smrg 2396e8340fabSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env]) 2397e8340fabSmrg]) # XORG_WITH_LINT 2398e1670675Smrg 2399e8340fabSmrg# XORG_CHECK_MALLOC_ZERO 2400e8340fabSmrg# ---------------------- 2401e8340fabSmrg# Minimum version: 1.0.0 2402e8340fabSmrg# 2403e8340fabSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if 2404e8340fabSmrg# malloc(0) returns NULL. Packages should add one of these cflags to 2405e8340fabSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. 2406e8340fabSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[ 2407e8340fabSmrgAC_ARG_ENABLE(malloc0returnsnull, 2408e8340fabSmrg AS_HELP_STRING([--enable-malloc0returnsnull], 2409e8340fabSmrg [malloc(0) returns NULL (default: auto)]), 2410e8340fabSmrg [MALLOC_ZERO_RETURNS_NULL=$enableval], 2411e8340fabSmrg [MALLOC_ZERO_RETURNS_NULL=auto]) 2412e1670675Smrg 2413e8340fabSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL]) 2414e8340fabSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then 2415e8340fabSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null], 2416e8340fabSmrg [AC_RUN_IFELSE([AC_LANG_PROGRAM([ 2417e8340fabSmrg#include <stdlib.h> 2418e8340fabSmrg],[ 2419e8340fabSmrg char *m0, *r0, *c0, *p; 2420e8340fabSmrg m0 = malloc(0); 2421e8340fabSmrg p = malloc(10); 2422e8340fabSmrg r0 = realloc(p,0); 2423e8340fabSmrg c0 = calloc(0,10); 2424e8340fabSmrg exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); 2425e8340fabSmrg])], 2426e8340fabSmrg [xorg_cv_malloc0_returns_null=yes], 2427e8340fabSmrg [xorg_cv_malloc0_returns_null=no])]) 2428e8340fabSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null 2429e1670675Smrgfi 2430e8340fabSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) 2431e8340fabSmrg 2432e8340fabSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then 2433e8340fabSmrg MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL" 2434e8340fabSmrg XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS 2435e8340fabSmrg XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC" 2436e1670675Smrgelse 2437e8340fabSmrg MALLOC_ZERO_CFLAGS="" 2438e8340fabSmrg XMALLOC_ZERO_CFLAGS="" 2439e8340fabSmrg XTMALLOC_ZERO_CFLAGS="" 2440e1670675Smrgfi 2441a9a39c43Smrg 2442e8340fabSmrgAC_SUBST([MALLOC_ZERO_CFLAGS]) 2443e8340fabSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS]) 2444e8340fabSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS]) 2445e8340fabSmrg]) # XORG_CHECK_MALLOC_ZERO 2446e1670675Smrg 2447e8340fabSmrg# XORG_WITH_LINT() 2448e8340fabSmrg# ---------------- 2449e8340fabSmrg# Minimum version: 1.1.0 2450a376accbSmrg# 2451e8340fabSmrg# This macro enables the use of a tool that flags some suspicious and 2452e8340fabSmrg# non-portable constructs (likely to be bugs) in C language source code. 2453e8340fabSmrg# It will attempt to locate the tool and use appropriate options. 2454e8340fabSmrg# There are various lint type tools on different platforms. 2455e8340fabSmrg# 2456e8340fabSmrg# Interface to module: 2457e8340fabSmrg# LINT: returns the path to the tool found on the platform 2458e8340fabSmrg# or the value set to LINT on the configure cmd line 2459e8340fabSmrg# also an Automake conditional 2460e8340fabSmrg# LINT_FLAGS: an Automake variable with appropriate flags 2461e8340fabSmrg# 2462e8340fabSmrg# --with-lint: 'yes' user instructs the module to use lint 2463e8340fabSmrg# 'no' user instructs the module not to use lint (default) 2464e8340fabSmrg# 2465e8340fabSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path. 2466e8340fabSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim. 2467e8340fabSmrg# 2468e8340fabSmrgAC_DEFUN([XORG_WITH_LINT],[ 2469e1670675Smrg 2470e8340fabSmrgAC_ARG_VAR([LINT], [Path to a lint-style command]) 2471e8340fabSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command]) 2472e8340fabSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint], 2473e8340fabSmrg [Use a lint-style source code checker (default: disabled)])], 2474e8340fabSmrg [use_lint=$withval], [use_lint=no]) 2475e1670675Smrg 2476e8340fabSmrg# Obtain platform specific info like program name and options 2477e8340fabSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris 2478e8340fabSmrgcase $host_os in 2479e8340fabSmrg *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*) 2480e8340fabSmrg lint_name=splint 2481e8340fabSmrg lint_options="-badflag" 2482e8340fabSmrg ;; 2483e8340fabSmrg *freebsd* | *netbsd*) 2484e8340fabSmrg lint_name=lint 2485e8340fabSmrg lint_options="-u -b" 2486e8340fabSmrg ;; 2487e8340fabSmrg *solaris*) 2488e8340fabSmrg lint_name=lint 2489e8340fabSmrg lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2" 2490e8340fabSmrg ;; 2491e8340fabSmrgesac 2492e1670675Smrg 2493e8340fabSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user) 2494e8340fabSmrgif test "x$use_lint" = x"yes" ; then 2495e8340fabSmrg AC_PATH_PROG([LINT], [$lint_name]) 2496e8340fabSmrg if test "x$LINT" = "x"; then 2497e8340fabSmrg AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH]) 2498e8340fabSmrg fi 2499e8340fabSmrgelif test "x$use_lint" = x"no" ; then 2500e8340fabSmrg if test "x$LINT" != "x"; then 2501e8340fabSmrg AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified]) 2502e8340fabSmrg fi 2503e8340fabSmrgelse 2504e8340fabSmrg AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.]) 2505e8340fabSmrgfi 2506e1670675Smrg 2507e8340fabSmrg# User supplied flags override default flags 2508e8340fabSmrgif test "x$LINT_FLAGS" != "x"; then 2509e8340fabSmrg lint_options=$LINT_FLAGS 2510e8340fabSmrgfi 2511e1670675Smrg 2512e8340fabSmrgAC_SUBST([LINT_FLAGS],[$lint_options]) 2513e8340fabSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x]) 2514e8340fabSmrg 2515e8340fabSmrg]) # XORG_WITH_LINT 2516e8340fabSmrg 2517e8340fabSmrg# XORG_LINT_LIBRARY(LIBNAME) 2518e8340fabSmrg# -------------------------- 2519e8340fabSmrg# Minimum version: 1.1.0 2520a376accbSmrg# 2521e8340fabSmrg# Sets up flags for building lint libraries for checking programs that call 2522e8340fabSmrg# functions in the library. 2523e8340fabSmrg# 2524e8340fabSmrg# Interface to module: 2525e8340fabSmrg# LINTLIB - Automake variable with the name of lint library file to make 2526e8340fabSmrg# MAKE_LINT_LIB - Automake conditional 2527e8340fabSmrg# 2528e8340fabSmrg# --enable-lint-library: - 'yes' user instructs the module to created a lint library 2529e8340fabSmrg# - 'no' user instructs the module not to create a lint library (default) 2530a376accbSmrg 2531e8340fabSmrgAC_DEFUN([XORG_LINT_LIBRARY],[ 2532e8340fabSmrgAC_REQUIRE([XORG_WITH_LINT]) 2533e8340fabSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library], 2534e8340fabSmrg [Create lint library (default: disabled)])], 2535e8340fabSmrg [make_lint_lib=$enableval], [make_lint_lib=no]) 2536e8340fabSmrg 2537e8340fabSmrgif test "x$make_lint_lib" = x"yes" ; then 2538e8340fabSmrg LINTLIB=llib-l$1.ln 2539e8340fabSmrg if test "x$LINT" = "x"; then 2540e8340fabSmrg AC_MSG_ERROR([Cannot make lint library without --with-lint]) 2541e8340fabSmrg fi 2542e8340fabSmrgelif test "x$make_lint_lib" != x"no" ; then 2543e8340fabSmrg AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.]) 2544a376accbSmrgfi 2545a376accbSmrg 2546e8340fabSmrgAC_SUBST(LINTLIB) 2547e8340fabSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno]) 2548e1670675Smrg 2549e8340fabSmrg]) # XORG_LINT_LIBRARY 2550a376accbSmrg 2551e8340fabSmrg# XORG_COMPILER_BRAND 2552e1670675Smrg# ------------------- 2553e8340fabSmrg# Minimum version: 1.14.0 2554e1670675Smrg# 2555e8340fabSmrg# Checks for various brands of compilers and sets flags as appropriate: 2556e8340fabSmrg# GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes" 2557e8340fabSmrg# GNU g++ - relies on AC_PROG_CXX to set GXX to "yes" 2558e8340fabSmrg# clang compiler - sets CLANGCC to "yes" 2559e8340fabSmrg# Intel compiler - sets INTELCC to "yes" 2560e8340fabSmrg# Sun/Oracle Solaris Studio cc - sets SUNCC to "yes" 2561e8340fabSmrg# 2562e8340fabSmrgAC_DEFUN([XORG_COMPILER_BRAND], [ 2563e8340fabSmrgAC_LANG_CASE( 2564e8340fabSmrg [C], [ 2565e8340fabSmrg dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC 2566e8340fabSmrg dnl and complains that AC_PROG_CC_C99 is obsolete 2567e8340fabSmrg m4_version_prereq([2.70], 2568e8340fabSmrg [AC_REQUIRE([AC_PROG_CC])], 2569e8340fabSmrg [AC_REQUIRE([AC_PROG_CC_C99])]) 2570e8340fabSmrg ], 2571e8340fabSmrg [C++], [ 2572e8340fabSmrg AC_REQUIRE([AC_PROG_CXX]) 2573e8340fabSmrg ] 2574e8340fabSmrg) 2575e8340fabSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"]) 2576e8340fabSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) 2577e8340fabSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) 2578e8340fabSmrg]) # XORG_COMPILER_BRAND 2579a376accbSmrg 2580e8340fabSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...]) 2581e1670675Smrg# --------------- 2582e8340fabSmrg# Minimum version: 1.16.0 2583e8340fabSmrg# 2584e8340fabSmrg# Test if the compiler works when passed the given flag as a command line argument. 2585e8340fabSmrg# If it succeeds, the flag is appended to the given variable. If not, it tries the 2586e8340fabSmrg# next flag in the list until there are no more options. 2587e8340fabSmrg# 2588e8340fabSmrg# Note that this does not guarantee that the compiler supports the flag as some 2589e8340fabSmrg# compilers will simply ignore arguments that they do not understand, but we do 2590e8340fabSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and 2591e8340fabSmrg# -Werror=unused-command-line-argument 2592e8340fabSmrg# 2593e8340fabSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [ 2594e8340fabSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])]) 2595e8340fabSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])]) 2596a376accbSmrg 2597e8340fabSmrgAC_LANG_COMPILER_REQUIRE 2598e1670675Smrg 2599e8340fabSmrgAC_LANG_CASE( 2600e8340fabSmrg [C], [ 2601e8340fabSmrg dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC 2602e8340fabSmrg dnl and complains that AC_PROG_CC_C99 is obsolete 2603e8340fabSmrg m4_version_prereq([2.70], 2604e8340fabSmrg [AC_REQUIRE([AC_PROG_CC])], 2605e8340fabSmrg [AC_REQUIRE([AC_PROG_CC_C99])]) 2606e8340fabSmrg define([PREFIX], [C]) 2607e8340fabSmrg define([CACHE_PREFIX], [cc]) 2608e8340fabSmrg define([COMPILER], [$CC]) 2609e8340fabSmrg ], 2610e8340fabSmrg [C++], [ 2611e8340fabSmrg define([PREFIX], [CXX]) 2612e8340fabSmrg define([CACHE_PREFIX], [cxx]) 2613e8340fabSmrg define([COMPILER], [$CXX]) 2614e8340fabSmrg ] 2615e8340fabSmrg) 2616e8340fabSmrg 2617e8340fabSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]" 2618e8340fabSmrg 2619e8340fabSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then 2620e8340fabSmrg PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" 2621e8340fabSmrg AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option], 2622e8340fabSmrg [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option], 2623e8340fabSmrg AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], 2624e8340fabSmrg [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes], 2625e8340fabSmrg [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no])) 2626e8340fabSmrg [xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option] 2627e8340fabSmrg PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]" 2628e1670675Smrgfi 2629e8340fabSmrg 2630e8340fabSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then 2631e8340fabSmrg if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then 2632e8340fabSmrg PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" 2633e8340fabSmrg fi 2634e8340fabSmrg PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" 2635e8340fabSmrg AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument], 2636e8340fabSmrg [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument], 2637e8340fabSmrg AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], 2638e8340fabSmrg [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes], 2639e8340fabSmrg [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no])) 2640e8340fabSmrg [xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument] 2641e8340fabSmrg PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]" 2642e8340fabSmrgfi 2643e8340fabSmrg 2644e8340fabSmrgfound="no" 2645e8340fabSmrgm4_foreach([flag], m4_cdr($@), [ 2646e8340fabSmrg if test $found = "no" ; then 2647e8340fabSmrg if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then 2648e8340fabSmrg PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" 2649e8340fabSmrg fi 2650e8340fabSmrg 2651e8340fabSmrg if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then 2652e8340fabSmrg PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" 2653e8340fabSmrg fi 2654e8340fabSmrg 2655e8340fabSmrg PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag[" 2656e8340fabSmrg 2657e8340fabSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname 2658e8340fabSmrg AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[]) 2659e8340fabSmrg cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[]) 2660e8340fabSmrg AC_CACHE_VAL($cacheid, 2661e8340fabSmrg [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])], 2662e8340fabSmrg [eval $cacheid=yes], 2663e8340fabSmrg [eval $cacheid=no])]) 2664e8340fabSmrg 2665e8340fabSmrg PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]" 2666e8340fabSmrg 2667e8340fabSmrg eval supported=\$$cacheid 2668e8340fabSmrg AC_MSG_RESULT([$supported]) 2669e8340fabSmrg if test "$supported" = "yes" ; then 2670e8340fabSmrg $1="$$1 ]flag[" 2671e8340fabSmrg found="yes" 2672e8340fabSmrg fi 2673e8340fabSmrg fi 2674e1670675Smrg]) 2675e8340fabSmrg]) # XORG_TESTSET_CFLAG 2676e1670675Smrg 2677e8340fabSmrg# XORG_COMPILER_FLAGS 2678e8340fabSmrg# --------------- 2679e8340fabSmrg# Minimum version: 1.16.0 2680a376accbSmrg# 2681e8340fabSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line 2682e8340fabSmrg# arguments supported by the selected compiler which do NOT alter the generated 2683e8340fabSmrg# code. These arguments will cause the compiler to print various warnings 2684e8340fabSmrg# during compilation AND turn a conservative set of warnings into errors. 2685e8340fabSmrg# 2686e8340fabSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in 2687e8340fabSmrg# future versions of util-macros as options are added to new compilers. 2688e8340fabSmrg# 2689e8340fabSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [ 2690e8340fabSmrgAC_REQUIRE([XORG_COMPILER_BRAND]) 2691e1670675Smrg 2692e8340fabSmrgAC_ARG_ENABLE(selective-werror, 2693e8340fabSmrg AS_HELP_STRING([--disable-selective-werror], 2694e8340fabSmrg [Turn off selective compiler errors. (default: enabled)]), 2695e8340fabSmrg [SELECTIVE_WERROR=$enableval], 2696e8340fabSmrg [SELECTIVE_WERROR=yes]) 2697e8340fabSmrg 2698e8340fabSmrgAC_LANG_CASE( 2699e8340fabSmrg [C], [ 2700e8340fabSmrg define([PREFIX], [C]) 2701e8340fabSmrg ], 2702e8340fabSmrg [C++], [ 2703e8340fabSmrg define([PREFIX], [CXX]) 2704e8340fabSmrg ] 2705e8340fabSmrg) 2706e8340fabSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG 2707e8340fabSmrgif test "x$SUNCC" = "xyes"; then 2708e8340fabSmrg [BASE_]PREFIX[FLAGS]="-v" 2709e1670675Smrgelse 2710e8340fabSmrg [BASE_]PREFIX[FLAGS]="" 2711e1670675Smrgfi 2712e1670675Smrg 2713e8340fabSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS 2714e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall]) 2715e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith]) 2716e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations]) 2717e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat]) 2718e1670675Smrg 2719e8340fabSmrgAC_LANG_CASE( 2720e8340fabSmrg [C], [ 2721e8340fabSmrg XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes]) 2722e8340fabSmrg XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes]) 2723e8340fabSmrg XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs]) 2724e8340fabSmrg XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast]) 2725e8340fabSmrg XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd]) 2726e8340fabSmrg XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement]) 2727e8340fabSmrg ] 2728e8340fabSmrg) 2729e1670675Smrg 2730e8340fabSmrg# This chunk adds additional warnings that could catch undesired effects. 2731e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused]) 2732e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized]) 2733e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow]) 2734e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn]) 2735e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute]) 2736e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) 2737e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) 2738a376accbSmrg 2739e8340fabSmrg# These are currently disabled because they are noisy. They will be enabled 2740e8340fabSmrg# in the future once the codebase is sufficiently modernized to silence 2741e8340fabSmrg# them. For now, I don't want them to drown out the other warnings. 2742e8340fabSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) 2743e8340fabSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) 2744e8340fabSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) 2745a376accbSmrg 2746e8340fabSmrg# Turn some warnings into errors, so we don't accidentally get successful builds 2747e8340fabSmrg# when there are problems that should be fixed. 2748a376accbSmrg 2749e8340fabSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then 2750e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED]) 2751e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull]) 2752e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self]) 2753e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main]) 2754e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces]) 2755e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point]) 2756e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT]) 2757e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs]) 2758e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds]) 2759e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings]) 2760e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address]) 2761e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION]) 2762e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION 2763e8340fabSmrgelse 2764e8340fabSmrgAC_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]) 2765e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit]) 2766e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull]) 2767e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self]) 2768e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain]) 2769e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces]) 2770e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point]) 2771e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type]) 2772e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs]) 2773e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds]) 2774e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings]) 2775e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress]) 2776e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast]) 2777e8340fabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast]) 2778e8340fabSmrgfi 2779a376accbSmrg 2780e8340fabSmrgAC_SUBST([BASE_]PREFIX[FLAGS]) 2781e8340fabSmrg]) # XORG_COMPILER_FLAGS 2782a376accbSmrg 2783e8340fabSmrg# XORG_CWARNFLAGS 2784e8340fabSmrg# --------------- 2785e8340fabSmrg# Minimum version: 1.2.0 2786e8340fabSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead) 2787e1670675Smrg# 2788e8340fabSmrg# Defines CWARNFLAGS to enable C compiler warnings. 2789e1670675Smrg# 2790e8340fabSmrg# This function is deprecated because it defines -fno-strict-aliasing 2791e8340fabSmrg# which alters the code generated by the compiler. If -fno-strict-aliasing 2792e8340fabSmrg# is needed, then it should be added explicitly in the module when 2793e8340fabSmrg# it is updated to use BASE_CFLAGS. 2794e1670675Smrg# 2795e8340fabSmrgAC_DEFUN([XORG_CWARNFLAGS], [ 2796e8340fabSmrgAC_REQUIRE([XORG_COMPILER_FLAGS]) 2797e8340fabSmrgAC_REQUIRE([XORG_COMPILER_BRAND]) 2798e8340fabSmrgAC_LANG_CASE( 2799e8340fabSmrg [C], [ 2800e8340fabSmrg CWARNFLAGS="$BASE_CFLAGS" 2801e8340fabSmrg if test "x$GCC" = xyes ; then 2802e8340fabSmrg CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing" 2803e8340fabSmrg fi 2804e8340fabSmrg AC_SUBST(CWARNFLAGS) 2805e8340fabSmrg ] 2806e8340fabSmrg) 2807e8340fabSmrg]) # XORG_CWARNFLAGS 2808a376accbSmrg 2809e8340fabSmrg# XORG_STRICT_OPTION 2810e8340fabSmrg# ----------------------- 2811e8340fabSmrg# Minimum version: 1.3.0 2812e8340fabSmrg# 2813e8340fabSmrg# Add configure option to enable strict compilation flags, such as treating 2814e8340fabSmrg# warnings as fatal errors. 2815e8340fabSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to 2816e8340fabSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS. 2817e8340fabSmrg# 2818e8340fabSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or 2819e8340fabSmrg# when strict compilation is unconditionally desired. 2820e8340fabSmrgAC_DEFUN([XORG_STRICT_OPTION], [ 2821e8340fabSmrgAC_REQUIRE([XORG_CWARNFLAGS]) 2822e8340fabSmrgAC_REQUIRE([XORG_COMPILER_FLAGS]) 2823a376accbSmrg 2824e8340fabSmrgAC_ARG_ENABLE(strict-compilation, 2825e8340fabSmrg AS_HELP_STRING([--enable-strict-compilation], 2826e8340fabSmrg [Enable all warnings from compiler and make them errors (default: disabled)]), 2827e8340fabSmrg [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) 2828e1670675Smrg 2829e8340fabSmrgAC_LANG_CASE( 2830e8340fabSmrg [C], [ 2831e8340fabSmrg define([PREFIX], [C]) 2832e8340fabSmrg ], 2833e8340fabSmrg [C++], [ 2834e8340fabSmrg define([PREFIX], [CXX]) 2835e8340fabSmrg ] 2836e8340fabSmrg) 2837e1670675Smrg 2838e8340fabSmrg[STRICT_]PREFIX[FLAGS]="" 2839e8340fabSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic]) 2840e8340fabSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn]) 2841e1670675Smrg 2842e8340fabSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not 2843e8340fabSmrg# activate it with -Werror, so we add it here explicitly. 2844e8340fabSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes]) 2845e1670675Smrg 2846e8340fabSmrgif test "x$STRICT_COMPILE" = "xyes"; then 2847e8340fabSmrg [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]" 2848e8340fabSmrg AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"]) 2849e8340fabSmrgfi 2850e8340fabSmrgAC_SUBST([STRICT_]PREFIX[FLAGS]) 2851e8340fabSmrgAC_SUBST([BASE_]PREFIX[FLAGS]) 2852e8340fabSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS])) 2853e8340fabSmrg]) # XORG_STRICT_OPTION 2854e1670675Smrg 2855e8340fabSmrg# XORG_DEFAULT_NOCODE_OPTIONS 2856e8340fabSmrg# --------------------------- 2857e8340fabSmrg# Minimum version: 1.20.0 2858e8340fabSmrg# 2859e8340fabSmrg# Defines default options for X.Org modules which don't compile code, 2860e8340fabSmrg# such as fonts, bitmaps, cursors, and docs. 2861e8340fabSmrg# 2862e8340fabSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [ 2863e8340fabSmrgAC_REQUIRE([AC_PROG_INSTALL]) 2864e8340fabSmrgXORG_RELEASE_VERSION 2865e8340fabSmrgXORG_CHANGELOG 2866e8340fabSmrgXORG_INSTALL 2867e8340fabSmrgXORG_MANPAGE_SECTIONS 2868e8340fabSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], 2869e8340fabSmrg [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) 2870e8340fabSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS 2871e1670675Smrg 2872e8340fabSmrg# XORG_DEFAULT_OPTIONS 2873e8340fabSmrg# -------------------- 2874e8340fabSmrg# Minimum version: 1.3.0 2875e8340fabSmrg# 2876e8340fabSmrg# Defines default options for X.Org modules which compile code. 2877e8340fabSmrg# 2878e8340fabSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [ 2879e8340fabSmrgAC_REQUIRE([AC_PROG_INSTALL]) 2880e8340fabSmrgXORG_COMPILER_FLAGS 2881e8340fabSmrgXORG_CWARNFLAGS 2882e8340fabSmrgXORG_STRICT_OPTION 2883e8340fabSmrgXORG_DEFAULT_NOCODE_OPTIONS 2884e8340fabSmrg]) # XORG_DEFAULT_OPTIONS 2885a376accbSmrg 2886e8340fabSmrg# XORG_INSTALL() 2887e8340fabSmrg# ---------------- 2888e8340fabSmrg# Minimum version: 1.4.0 2889e8340fabSmrg# 2890e8340fabSmrg# Defines the variable INSTALL_CMD as the command to copy 2891e8340fabSmrg# INSTALL from $prefix/share/util-macros. 2892e8340fabSmrg# 2893e8340fabSmrgAC_DEFUN([XORG_INSTALL], [ 2894e8340fabSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG]) 2895e8340fabSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros` 2896e8340fabSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \ 2897e8340fabSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \ 2898e8340fabSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \ 2899e8340fabSmrgtouch \$(top_srcdir)/INSTALL; \ 2900e8340fabSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))" 2901e8340fabSmrgAC_SUBST([INSTALL_CMD]) 2902e8340fabSmrg]) # XORG_INSTALL 2903e8340fabSmrgdnl Copyright 2005 Red Hat, Inc 2904e8340fabSmrgdnl 2905e8340fabSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its 2906e8340fabSmrgdnl documentation for any purpose is hereby granted without fee, provided that 2907e8340fabSmrgdnl the above copyright notice appear in all copies and that both that 2908e8340fabSmrgdnl copyright notice and this permission notice appear in supporting 2909e8340fabSmrgdnl documentation. 2910e8340fabSmrgdnl 2911e8340fabSmrgdnl The above copyright notice and this permission notice shall be included 2912e8340fabSmrgdnl in all copies or substantial portions of the Software. 2913e8340fabSmrgdnl 2914e8340fabSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 2915e8340fabSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 2916e8340fabSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 2917e8340fabSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 2918e8340fabSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 2919e8340fabSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2920e8340fabSmrgdnl OTHER DEALINGS IN THE SOFTWARE. 2921e8340fabSmrgdnl 2922e8340fabSmrgdnl Except as contained in this notice, the name of the copyright holders shall 2923e8340fabSmrgdnl not be used in advertising or otherwise to promote the sale, use or 2924e8340fabSmrgdnl other dealings in this Software without prior written authorization 2925e8340fabSmrgdnl from the copyright holders. 2926e8340fabSmrgdnl 2927e1670675Smrg 2928e8340fabSmrg# XORG_RELEASE_VERSION 2929e8340fabSmrg# -------------------- 2930e8340fabSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use. 2931a376accbSmrg 2932e8340fabSmrgAC_DEFUN([XORG_RELEASE_VERSION],[ 2933e8340fabSmrg AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR], 2934e8340fabSmrg [`echo $PACKAGE_VERSION | cut -d . -f 1`], 2935e8340fabSmrg [Major version of this package]) 2936e8340fabSmrg PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1` 2937e8340fabSmrg if test "x$PVM" = "x"; then 2938e8340fabSmrg PVM="0" 2939e8340fabSmrg fi 2940e8340fabSmrg AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR], 2941e8340fabSmrg [$PVM], 2942e8340fabSmrg [Minor version of this package]) 2943e8340fabSmrg PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1` 2944e8340fabSmrg if test "x$PVP" = "x"; then 2945e8340fabSmrg PVP="0" 2946e8340fabSmrg fi 2947e8340fabSmrg AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL], 2948e8340fabSmrg [$PVP], 2949e8340fabSmrg [Patch version of this package]) 2950e8340fabSmrg]) 2951a376accbSmrg 2952e8340fabSmrg# XORG_CHANGELOG() 2953e8340fabSmrg# ---------------- 2954e8340fabSmrg# Minimum version: 1.2.0 2955e8340fabSmrg# 2956e8340fabSmrg# Defines the variable CHANGELOG_CMD as the command to generate 2957e8340fabSmrg# ChangeLog from git. 2958e8340fabSmrg# 2959e8340fabSmrg# 2960e8340fabSmrgAC_DEFUN([XORG_CHANGELOG], [ 2961e8340fabSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \ 2962e8340fabSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \ 2963e8340fabSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \ 2964e8340fabSmrgtouch \$(top_srcdir)/ChangeLog; \ 2965e8340fabSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))" 2966e8340fabSmrgAC_SUBST([CHANGELOG_CMD]) 2967e8340fabSmrg]) # XORG_CHANGELOG 2968a376accbSmrg 2969