13d13e800Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
201395c31Smrg
33d13e800Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
492bb16f8Smrg
592bb16f8Smrg# This file is free software; the Free Software Foundation
692bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
792bb16f8Smrg# with or without modifications, as long as this notice is preserved.
892bb16f8Smrg
992bb16f8Smrg# This program is distributed in the hope that it will be useful,
1092bb16f8Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1192bb16f8Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1292bb16f8Smrg# PARTICULAR PURPOSE.
1392bb16f8Smrg
1401395c31Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
158255a313Smrgm4_ifndef([AC_AUTOCONF_VERSION],
168255a313Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17187ef25fSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18187ef25fSmrg[m4_warning([this file was generated for autoconf 2.72.
198255a313SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
208255a313SmrgIf you have problems, you may need to regenerate the build system entirely.
2101395c31SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2201395c31Smrg
233d13e800Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2401395c31Smrg#
253d13e800Smrg# This file is free software; the Free Software Foundation
263d13e800Smrg# gives unlimited permission to copy and/or distribute it,
273d13e800Smrg# with or without modifications, as long as this notice is preserved.
2892bb16f8Smrg
293d13e800Smrg# AM_AUTOMAKE_VERSION(VERSION)
303d13e800Smrg# ----------------------------
313d13e800Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
323d13e800Smrg# generated from the m4 files accompanying Automake X.Y.
333d13e800Smrg# (This private macro should not be called outside this file.)
343d13e800SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
353d13e800Smrg[am__api_version='1.16'
363d13e800Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
373d13e800Smrgdnl require some minimum version.  Point them to the right macro.
383d13e800Smrgm4_if([$1], [1.16.5], [],
393d13e800Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
403d13e800Smrg])
4192bb16f8Smrg
423d13e800Smrg# _AM_AUTOCONF_VERSION(VERSION)
433d13e800Smrg# -----------------------------
443d13e800Smrg# aclocal traces this macro to find the Autoconf version.
453d13e800Smrg# This is a private macro too.  Using m4_define simplifies
463d13e800Smrg# the logic in aclocal, which can simply ignore this definition.
473d13e800Smrgm4_define([_AM_AUTOCONF_VERSION], [])
4801395c31Smrg
493d13e800Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
503d13e800Smrg# -------------------------------
513d13e800Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
523d13e800Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
533d13e800SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
543d13e800Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
553d13e800Smrgm4_ifndef([AC_AUTOCONF_VERSION],
563d13e800Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
573d13e800Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5801395c31Smrg
593d13e800Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6092bb16f8Smrg
613d13e800Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6292bb16f8Smrg#
633d13e800Smrg# This file is free software; the Free Software Foundation
643d13e800Smrg# gives unlimited permission to copy and/or distribute it,
653d13e800Smrg# with or without modifications, as long as this notice is preserved.
6692bb16f8Smrg
673d13e800Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
683d13e800Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
693d13e800Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7092bb16f8Smrg#
713d13e800Smrg# Of course, Automake must honor this variable whenever it calls a
723d13e800Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
733d13e800Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
743d13e800Smrg# depending on how configure is run.  This is pretty annoying, since
753d13e800Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
763d13e800Smrg# source directory, any form will work fine, but in subdirectories a
773d13e800Smrg# relative path needs to be adjusted first.
7892bb16f8Smrg#
793d13e800Smrg# $ac_aux_dir/missing
803d13e800Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
813d13e800Smrg# $top_srcdir/$ac_aux_dir/missing
823d13e800Smrg#    fails if $ac_aux_dir is absolute,
833d13e800Smrg#    fails when called from a subdirectory in a VPATH build with
843d13e800Smrg#          a relative $ac_aux_dir
8592bb16f8Smrg#
863d13e800Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
873d13e800Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
883d13e800Smrg# harmless because $srcdir is '.', but things will broke when you
893d13e800Smrg# start a VPATH build or use an absolute $srcdir.
9001395c31Smrg#
913d13e800Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
923d13e800Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
933d13e800Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
943d13e800Smrg# and then we would define $MISSING as
953d13e800Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
963d13e800Smrg# This will work as long as MISSING is not called from configure, because
973d13e800Smrg# unfortunately $(top_srcdir) has no meaning in configure.
983d13e800Smrg# However there are other variables, like CC, which are often used in
993d13e800Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10001395c31Smrg#
1013d13e800Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1023d13e800Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1033d13e800Smrg# configured tree to be moved without reconfiguration.
10401395c31Smrg
1053d13e800SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1063d13e800Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1073d13e800Smrg# Expand $ac_aux_dir to an absolute path.
1083d13e800Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10992bb16f8Smrg])
11092bb16f8Smrg
1113d13e800Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11292bb16f8Smrg
1133d13e800Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11492bb16f8Smrg#
1153d13e800Smrg# This file is free software; the Free Software Foundation
1163d13e800Smrg# gives unlimited permission to copy and/or distribute it,
1173d13e800Smrg# with or without modifications, as long as this notice is preserved.
11892bb16f8Smrg
1193d13e800Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1203d13e800Smrg# -------------------------------------
1213d13e800Smrg# Define a conditional.
1223d13e800SmrgAC_DEFUN([AM_CONDITIONAL],
1233d13e800Smrg[AC_PREREQ([2.52])dnl
1243d13e800Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1253d13e800Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1263d13e800SmrgAC_SUBST([$1_TRUE])dnl
1273d13e800SmrgAC_SUBST([$1_FALSE])dnl
1283d13e800Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1293d13e800Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1303d13e800Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1313d13e800Smrgif $2; then
1323d13e800Smrg  $1_TRUE=
1333d13e800Smrg  $1_FALSE='#'
1343d13e800Smrgelse
1353d13e800Smrg  $1_TRUE='#'
1363d13e800Smrg  $1_FALSE=
1373d13e800Smrgfi
1383d13e800SmrgAC_CONFIG_COMMANDS_PRE(
1393d13e800Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1403d13e800Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1413d13e800SmrgUsually this means the macro was only invoked conditionally.]])
1423d13e800Smrgfi])])
14392bb16f8Smrg
1443d13e800Smrg# Do all the work for Automake.                             -*- Autoconf -*-
14592bb16f8Smrg
1463d13e800Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
1473d13e800Smrg#
1483d13e800Smrg# This file is free software; the Free Software Foundation
1493d13e800Smrg# gives unlimited permission to copy and/or distribute it,
1503d13e800Smrg# with or without modifications, as long as this notice is preserved.
15101395c31Smrg
1523d13e800Smrg# This macro actually does too much.  Some checks are only needed if
1533d13e800Smrg# your package does certain things.  But this isn't really a big deal.
15401395c31Smrg
1553d13e800Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
1563d13e800Smrgm4_define([AC_PROG_CC],
1573d13e800Smrgm4_defn([AC_PROG_CC])
1583d13e800Smrg[_AM_PROG_CC_C_O
1593d13e800Smrg])
16092bb16f8Smrg
1613d13e800Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
1623d13e800Smrg# AM_INIT_AUTOMAKE([OPTIONS])
1633d13e800Smrg# -----------------------------------------------
1643d13e800Smrg# The call with PACKAGE and VERSION arguments is the old style
1653d13e800Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
1663d13e800Smrg# and VERSION should now be passed to AC_INIT and removed from
1673d13e800Smrg# the call to AM_INIT_AUTOMAKE.
1683d13e800Smrg# We support both call styles for the transition.  After
1693d13e800Smrg# the next Automake release, Autoconf can make the AC_INIT
1703d13e800Smrg# arguments mandatory, and then we can depend on a new Autoconf
1713d13e800Smrg# release and drop the old call support.
1723d13e800SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
1733d13e800Smrg[AC_PREREQ([2.65])dnl
1743d13e800Smrgm4_ifdef([_$0_ALREADY_INIT],
1753d13e800Smrg  [m4_fatal([$0 expanded multiple times
1763d13e800Smrg]m4_defn([_$0_ALREADY_INIT]))],
1773d13e800Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
1783d13e800Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
1793d13e800Smrgdnl the ones we care about.
1803d13e800Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
1813d13e800SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
1823d13e800SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
1833d13e800Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
1843d13e800Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
1853d13e800Smrg  # is not polluted with repeated "-I."
1863d13e800Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
1873d13e800Smrg  # test to see if srcdir already configured
1883d13e800Smrg  if test -f $srcdir/config.status; then
1893d13e800Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1903d13e800Smrg  fi
19192bb16f8Smrgfi
19292bb16f8Smrg
1933d13e800Smrg# test whether we have cygpath
1943d13e800Smrgif test -z "$CYGPATH_W"; then
1953d13e800Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
1963d13e800Smrg    CYGPATH_W='cygpath -w'
1973d13e800Smrg  else
1983d13e800Smrg    CYGPATH_W=echo
1993d13e800Smrg  fi
2003d13e800Smrgfi
2013d13e800SmrgAC_SUBST([CYGPATH_W])
20292bb16f8Smrg
2033d13e800Smrg# Define the identity of the package.
2043d13e800Smrgdnl Distinguish between old-style and new-style calls.
2053d13e800Smrgm4_ifval([$2],
2063d13e800Smrg[AC_DIAGNOSE([obsolete],
2073d13e800Smrg             [$0: two- and three-arguments forms are deprecated.])
2083d13e800Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2093d13e800Smrg AC_SUBST([PACKAGE], [$1])dnl
2103d13e800Smrg AC_SUBST([VERSION], [$2])],
2113d13e800Smrg[_AM_SET_OPTIONS([$1])dnl
2123d13e800Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2133d13e800Smrgm4_if(
2143d13e800Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
2153d13e800Smrg  [ok:ok],,
2163d13e800Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2173d13e800Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2183d13e800Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
21992bb16f8Smrg
2203d13e800Smrg_AM_IF_OPTION([no-define],,
2213d13e800Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
2223d13e800Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
22392bb16f8Smrg
2243d13e800Smrg# Some tools Automake needs.
2253d13e800SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
2263d13e800SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
2273d13e800SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
2283d13e800SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
2293d13e800SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
2303d13e800SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
2313d13e800SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
2323d13e800SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2333d13e800SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2343d13e800SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
2353d13e800Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
2363d13e800Smrg# dies out for good.  For more background, see:
2373d13e800Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2383d13e800Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2393d13e800SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2403d13e800Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
2413d13e800Smrg# system "awk" is bad on some platforms.
2423d13e800SmrgAC_REQUIRE([AC_PROG_AWK])dnl
2433d13e800SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
2443d13e800SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
2453d13e800Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2463d13e800Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2473d13e800Smrg			     [_AM_PROG_TAR([v7])])])
2483d13e800Smrg_AM_IF_OPTION([no-dependencies],,
2493d13e800Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
2503d13e800Smrg		  [_AM_DEPENDENCIES([CC])],
2513d13e800Smrg		  [m4_define([AC_PROG_CC],
2523d13e800Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2533d13e800SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
2543d13e800Smrg		  [_AM_DEPENDENCIES([CXX])],
2553d13e800Smrg		  [m4_define([AC_PROG_CXX],
2563d13e800Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2573d13e800SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
2583d13e800Smrg		  [_AM_DEPENDENCIES([OBJC])],
2593d13e800Smrg		  [m4_define([AC_PROG_OBJC],
2603d13e800Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2613d13e800SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2623d13e800Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
2633d13e800Smrg		  [m4_define([AC_PROG_OBJCXX],
2643d13e800Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
2653d13e800Smrg])
2663d13e800Smrg# Variables for tags utilities; see am/tags.am
2673d13e800Smrgif test -z "$CTAGS"; then
2683d13e800Smrg  CTAGS=ctags
2693d13e800Smrgfi
2703d13e800SmrgAC_SUBST([CTAGS])
2713d13e800Smrgif test -z "$ETAGS"; then
2723d13e800Smrg  ETAGS=etags
2733d13e800Smrgfi
2743d13e800SmrgAC_SUBST([ETAGS])
2753d13e800Smrgif test -z "$CSCOPE"; then
2763d13e800Smrg  CSCOPE=cscope
2773d13e800Smrgfi
2783d13e800SmrgAC_SUBST([CSCOPE])
2798255a313Smrg
2803d13e800SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
2813d13e800Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
2823d13e800Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2833d13e800Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2843d13e800SmrgAC_CONFIG_COMMANDS_PRE(dnl
2853d13e800Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
2863d13e800Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
28792bb16f8Smrg
2883d13e800Smrg# POSIX will say in a future version that running "rm -f" with no argument
2893d13e800Smrg# is OK; and we want to be able to make that assumption in our Makefile
2903d13e800Smrg# recipes.  So use an aggressive probe to check that the usage we want is
2913d13e800Smrg# actually supported "in the wild" to an acceptable degree.
2923d13e800Smrg# See automake bug#10828.
2933d13e800Smrg# To make any issue more visible, cause the running configure to be aborted
2943d13e800Smrg# by default if the 'rm' program in use doesn't match our expectations; the
2953d13e800Smrg# user can still override this though.
2963d13e800Smrgif rm -f && rm -fr && rm -rf; then : OK; else
2973d13e800Smrg  cat >&2 <<'END'
2983d13e800SmrgOops!
29992bb16f8Smrg
3003d13e800SmrgYour 'rm' program seems unable to run without file operands specified
3013d13e800Smrgon the command line, even when the '-f' option is present.  This is contrary
3023d13e800Smrgto the behaviour of most rm programs out there, and not conforming with
3033d13e800Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
30492bb16f8Smrg
3053d13e800SmrgPlease tell bug-automake@gnu.org about your system, including the value
3063d13e800Smrgof your $PATH and any error possibly output before this message.  This
3073d13e800Smrgcan help us improve future automake versions.
30892bb16f8Smrg
3093d13e800SmrgEND
3103d13e800Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
3113d13e800Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
3123d13e800Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
3133d13e800Smrg    echo >&2
3143d13e800Smrg  else
3153d13e800Smrg    cat >&2 <<'END'
3163d13e800SmrgAborting the configuration process, to ensure you take notice of the issue.
31792bb16f8Smrg
3183d13e800SmrgYou can download and install GNU coreutils to get an 'rm' implementation
3193d13e800Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
32092bb16f8Smrg
3213d13e800SmrgIf you want to complete the configuration process using your problematic
3223d13e800Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
3233d13e800Smrgto "yes", and re-run configure.
32492bb16f8Smrg
3253d13e800SmrgEND
3263d13e800Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
3273d13e800Smrg  fi
3283d13e800Smrgfi
3293d13e800Smrgdnl The trailing newline in this macro's definition is deliberate, for
3303d13e800Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
3313d13e800Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
3323d13e800Smrg])
333de7ed6e8Smrg
3343d13e800Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
3353d13e800Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
3363d13e800Smrgdnl mangled by Autoconf and run in a shell conditional statement.
3373d13e800Smrgm4_define([_AC_COMPILER_EXEEXT],
3383d13e800Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
339de7ed6e8Smrg
3403d13e800Smrg# When config.status generates a header, we must update the stamp-h file.
3413d13e800Smrg# This file resides in the same directory as the config header
3423d13e800Smrg# that is generated.  The stamp files are numbered to have different names.
343de7ed6e8Smrg
3443d13e800Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
3453d13e800Smrg# loop where config.status creates the headers, so we can generate
3463d13e800Smrg# our stamp files there.
3473d13e800SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
3483d13e800Smrg[# Compute $1's index in $config_headers.
3493d13e800Smrg_am_arg=$1
3503d13e800Smrg_am_stamp_count=1
3513d13e800Smrgfor _am_header in $config_headers :; do
3523d13e800Smrg  case $_am_header in
3533d13e800Smrg    $_am_arg | $_am_arg:* )
3543d13e800Smrg      break ;;
3553d13e800Smrg    * )
3563d13e800Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
3573d13e800Smrg  esac
3583d13e800Smrgdone
3593d13e800Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
360de7ed6e8Smrg
3613d13e800Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
3623d13e800Smrg#
3633d13e800Smrg# This file is free software; the Free Software Foundation
3643d13e800Smrg# gives unlimited permission to copy and/or distribute it,
3653d13e800Smrg# with or without modifications, as long as this notice is preserved.
366de7ed6e8Smrg
3673d13e800Smrg# AM_PROG_INSTALL_SH
3683d13e800Smrg# ------------------
3693d13e800Smrg# Define $install_sh.
3703d13e800SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
3713d13e800Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3723d13e800Smrgif test x"${install_sh+set}" != xset; then
3733d13e800Smrg  case $am_aux_dir in
3743d13e800Smrg  *\ * | *\	*)
3753d13e800Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
3763d13e800Smrg  *)
3773d13e800Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
3783d13e800Smrg  esac
3793d13e800Smrgfi
3803d13e800SmrgAC_SUBST([install_sh])])
3818255a313Smrg
3823d13e800Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
3833d13e800Smrg#
3843d13e800Smrg# This file is free software; the Free Software Foundation
3853d13e800Smrg# gives unlimited permission to copy and/or distribute it,
3863d13e800Smrg# with or without modifications, as long as this notice is preserved.
38701395c31Smrg
3883d13e800Smrg# Check whether the underlying file-system supports filenames
3893d13e800Smrg# with a leading dot.  For instance MS-DOS doesn't.
3903d13e800SmrgAC_DEFUN([AM_SET_LEADING_DOT],
3913d13e800Smrg[rm -rf .tst 2>/dev/null
3923d13e800Smrgmkdir .tst 2>/dev/null
3933d13e800Smrgif test -d .tst; then
3943d13e800Smrg  am__leading_dot=.
3953d13e800Smrgelse
3963d13e800Smrg  am__leading_dot=_
3973d13e800Smrgfi
3983d13e800Smrgrmdir .tst 2>/dev/null
3993d13e800SmrgAC_SUBST([am__leading_dot])])
40001395c31Smrg
4013d13e800Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
4028255a313Smrg
4033d13e800Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
4043d13e800Smrg#
4053d13e800Smrg# This file is free software; the Free Software Foundation
4063d13e800Smrg# gives unlimited permission to copy and/or distribute it,
4073d13e800Smrg# with or without modifications, as long as this notice is preserved.
40892bb16f8Smrg
4093d13e800Smrg# AM_MISSING_PROG(NAME, PROGRAM)
4103d13e800Smrg# ------------------------------
4113d13e800SmrgAC_DEFUN([AM_MISSING_PROG],
4123d13e800Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
4133d13e800Smrg$1=${$1-"${am_missing_run}$2"}
4143d13e800SmrgAC_SUBST($1)])
41592bb16f8Smrg
4163d13e800Smrg# AM_MISSING_HAS_RUN
4173d13e800Smrg# ------------------
4183d13e800Smrg# Define MISSING if not defined so far and test if it is modern enough.
4193d13e800Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
4203d13e800SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
4213d13e800Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
4223d13e800SmrgAC_REQUIRE_AUX_FILE([missing])dnl
4233d13e800Smrgif test x"${MISSING+set}" != xset; then
4243d13e800Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
4253d13e800Smrgfi
4263d13e800Smrg# Use eval to expand $SHELL
4273d13e800Smrgif eval "$MISSING --is-lightweight"; then
4283d13e800Smrg  am_missing_run="$MISSING "
4293d13e800Smrgelse
4303d13e800Smrg  am_missing_run=
4313d13e800Smrg  AC_MSG_WARN(['missing' script is too old or missing])
4323d13e800Smrgfi
4333d13e800Smrg])
43492bb16f8Smrg
4353d13e800Smrg# Helper functions for option handling.                     -*- Autoconf -*-
43692bb16f8Smrg
4373d13e800Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
43801395c31Smrg#
4393d13e800Smrg# This file is free software; the Free Software Foundation
4403d13e800Smrg# gives unlimited permission to copy and/or distribute it,
4413d13e800Smrg# with or without modifications, as long as this notice is preserved.
44292bb16f8Smrg
4433d13e800Smrg# _AM_MANGLE_OPTION(NAME)
4443d13e800Smrg# -----------------------
4453d13e800SmrgAC_DEFUN([_AM_MANGLE_OPTION],
4463d13e800Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
4473d13e800Smrg
4483d13e800Smrg# _AM_SET_OPTION(NAME)
4493d13e800Smrg# --------------------
4503d13e800Smrg# Set option NAME.  Presently that only means defining a flag for this option.
4513d13e800SmrgAC_DEFUN([_AM_SET_OPTION],
4523d13e800Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
4533d13e800Smrg
4543d13e800Smrg# _AM_SET_OPTIONS(OPTIONS)
4553d13e800Smrg# ------------------------
4563d13e800Smrg# OPTIONS is a space-separated list of Automake options.
4573d13e800SmrgAC_DEFUN([_AM_SET_OPTIONS],
4583d13e800Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
4593d13e800Smrg
4603d13e800Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
4613d13e800Smrg# -------------------------------------------
4623d13e800Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
4633d13e800SmrgAC_DEFUN([_AM_IF_OPTION],
4643d13e800Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
4653d13e800Smrg
4663d13e800Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
46792bb16f8Smrg
4683d13e800Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4693d13e800Smrg#
4703d13e800Smrg# This file is free software; the Free Software Foundation
4713d13e800Smrg# gives unlimited permission to copy and/or distribute it,
4723d13e800Smrg# with or without modifications, as long as this notice is preserved.
47392bb16f8Smrg
4743d13e800Smrg# AM_SANITY_CHECK
4753d13e800Smrg# ---------------
4763d13e800SmrgAC_DEFUN([AM_SANITY_CHECK],
4773d13e800Smrg[AC_MSG_CHECKING([whether build environment is sane])
4783d13e800Smrg# Reject unsafe characters in $srcdir or the absolute working directory
4793d13e800Smrg# name.  Accept space and tab only in the latter.
4803d13e800Smrgam_lf='
4813d13e800Smrg'
4823d13e800Smrgcase `pwd` in
4833d13e800Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
4843d13e800Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
4853d13e800Smrgesac
4863d13e800Smrgcase $srcdir in
4873d13e800Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
4883d13e800Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
4893d13e800Smrgesac
49092bb16f8Smrg
4913d13e800Smrg# Do 'set' in a subshell so we don't clobber the current shell's
4923d13e800Smrg# arguments.  Must try -L first in case configure is actually a
4933d13e800Smrg# symlink; some systems play weird games with the mod time of symlinks
4943d13e800Smrg# (eg FreeBSD returns the mod time of the symlink's containing
4953d13e800Smrg# directory).
4963d13e800Smrgif (
4973d13e800Smrg   am_has_slept=no
4983d13e800Smrg   for am_try in 1 2; do
4993d13e800Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
5003d13e800Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
5013d13e800Smrg     if test "$[*]" = "X"; then
5023d13e800Smrg	# -L didn't work.
5033d13e800Smrg	set X `ls -t "$srcdir/configure" conftest.file`
5043d13e800Smrg     fi
5053d13e800Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
5063d13e800Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
50792bb16f8Smrg
5083d13e800Smrg	# If neither matched, then we have a broken ls.  This can happen
5093d13e800Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
5103d13e800Smrg	# broken ls alias from the environment.  This has actually
5113d13e800Smrg	# happened.  Such a system could not be considered "sane".
5123d13e800Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
5133d13e800Smrg  alias in your environment])
5143d13e800Smrg     fi
5153d13e800Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
5163d13e800Smrg       break
5173d13e800Smrg     fi
5183d13e800Smrg     # Just in case.
5193d13e800Smrg     sleep 1
5203d13e800Smrg     am_has_slept=yes
5213d13e800Smrg   done
5223d13e800Smrg   test "$[2]" = conftest.file
5233d13e800Smrg   )
5243d13e800Smrgthen
5253d13e800Smrg   # Ok.
5263d13e800Smrg   :
5273d13e800Smrgelse
5283d13e800Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
5293d13e800SmrgCheck your system clock])
53001395c31Smrgfi
5313d13e800SmrgAC_MSG_RESULT([yes])
5323d13e800Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
5333d13e800Smrg# generated files are strictly newer.
5343d13e800Smrgam_sleep_pid=
5353d13e800Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
5363d13e800Smrg  ( sleep 1 ) &
5373d13e800Smrg  am_sleep_pid=$!
53801395c31Smrgfi
5393d13e800SmrgAC_CONFIG_COMMANDS_PRE(
5403d13e800Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
5413d13e800Smrg   if test -n "$am_sleep_pid"; then
5423d13e800Smrg     # Hide warnings about reused PIDs.
5433d13e800Smrg     wait $am_sleep_pid 2>/dev/null
5443d13e800Smrg   fi
5453d13e800Smrg   AC_MSG_RESULT([done])])
5463d13e800Smrgrm -f conftest.file
5473d13e800Smrg])
54892bb16f8Smrg
5493d13e800Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
5503d13e800Smrg#
5513d13e800Smrg# This file is free software; the Free Software Foundation
5523d13e800Smrg# gives unlimited permission to copy and/or distribute it,
5533d13e800Smrg# with or without modifications, as long as this notice is preserved.
55492bb16f8Smrg
5553d13e800Smrg# AM_SILENT_RULES([DEFAULT])
5563d13e800Smrg# --------------------------
5573d13e800Smrg# Enable less verbose build rules; with the default set to DEFAULT
5583d13e800Smrg# ("yes" being less verbose, "no" or empty being verbose).
5593d13e800SmrgAC_DEFUN([AM_SILENT_RULES],
5603d13e800Smrg[AC_ARG_ENABLE([silent-rules], [dnl
5613d13e800SmrgAS_HELP_STRING(
5623d13e800Smrg  [--enable-silent-rules],
5633d13e800Smrg  [less verbose build output (undo: "make V=1")])
5643d13e800SmrgAS_HELP_STRING(
5653d13e800Smrg  [--disable-silent-rules],
5663d13e800Smrg  [verbose build output (undo: "make V=0")])dnl
5673d13e800Smrg])
5683d13e800Smrgcase $enable_silent_rules in @%:@ (((
5693d13e800Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
5703d13e800Smrg   no) AM_DEFAULT_VERBOSITY=1;;
5713d13e800Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
5723d13e800Smrgesac
5733d13e800Smrgdnl
5743d13e800Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
5753d13e800Smrgdnl do not support nested variable expansions.
5763d13e800Smrgdnl See automake bug#9928 and bug#10237.
5773d13e800Smrgam_make=${MAKE-make}
5783d13e800SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
5793d13e800Smrg   [am_cv_make_support_nested_variables],
5803d13e800Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
5813d13e800SmrgBAR0=false
5823d13e800SmrgBAR1=true
5833d13e800SmrgV=1
5843d13e800Smrgam__doit:
5853d13e800Smrg	@$(TRUE)
5863d13e800Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
5873d13e800Smrg  am_cv_make_support_nested_variables=yes
58892bb16f8Smrgelse
5893d13e800Smrg  am_cv_make_support_nested_variables=no
5903d13e800Smrgfi])
5913d13e800Smrgif test $am_cv_make_support_nested_variables = yes; then
5923d13e800Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
5933d13e800Smrg  AM_V='$(V)'
5943d13e800Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
5953d13e800Smrgelse
5963d13e800Smrg  AM_V=$AM_DEFAULT_VERBOSITY
5973d13e800Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
59892bb16f8Smrgfi
5993d13e800SmrgAC_SUBST([AM_V])dnl
6003d13e800SmrgAM_SUBST_NOTMAKE([AM_V])dnl
6013d13e800SmrgAC_SUBST([AM_DEFAULT_V])dnl
6023d13e800SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
6033d13e800SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
6043d13e800SmrgAM_BACKSLASH='\'
6053d13e800SmrgAC_SUBST([AM_BACKSLASH])dnl
6063d13e800Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
6073d13e800Smrg])
60892bb16f8Smrg
6093d13e800Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61001395c31Smrg#
6113d13e800Smrg# This file is free software; the Free Software Foundation
6123d13e800Smrg# gives unlimited permission to copy and/or distribute it,
6133d13e800Smrg# with or without modifications, as long as this notice is preserved.
61492bb16f8Smrg
6153d13e800Smrg# AM_PROG_INSTALL_STRIP
6163d13e800Smrg# ---------------------
6173d13e800Smrg# One issue with vendor 'install' (even GNU) is that you can't
6183d13e800Smrg# specify the program used to strip binaries.  This is especially
6193d13e800Smrg# annoying in cross-compiling environments, where the build's strip
6203d13e800Smrg# is unlikely to handle the host's binaries.
6213d13e800Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
6223d13e800Smrg# always use install-sh in "make install-strip", and initialize
6233d13e800Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
6243d13e800SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
6253d13e800Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
6263d13e800Smrg# Installed binaries are usually stripped using 'strip' when the user
6273d13e800Smrg# run "make install-strip".  However 'strip' might not be the right
6283d13e800Smrg# tool to use in cross-compilation environments, therefore Automake
6293d13e800Smrg# will honor the 'STRIP' environment variable to overrule this program.
6303d13e800Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
6313d13e800Smrgif test "$cross_compiling" != no; then
6323d13e800Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
63392bb16f8Smrgfi
6343d13e800SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
6353d13e800SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
63692bb16f8Smrg
6373d13e800Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
6383d13e800Smrg#
6393d13e800Smrg# This file is free software; the Free Software Foundation
6403d13e800Smrg# gives unlimited permission to copy and/or distribute it,
6413d13e800Smrg# with or without modifications, as long as this notice is preserved.
6428255a313Smrg
6433d13e800Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
6443d13e800Smrg# ---------------------------
6453d13e800Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
6463d13e800Smrg# This macro is traced by Automake.
6473d13e800SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
6488255a313Smrg
6493d13e800Smrg# AM_SUBST_NOTMAKE(VARIABLE)
6503d13e800Smrg# --------------------------
6513d13e800Smrg# Public sister of _AM_SUBST_NOTMAKE.
6523d13e800SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
6538255a313Smrg
6543d13e800Smrg# Check how to create a tarball.                            -*- Autoconf -*-
6558255a313Smrg
6563d13e800Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
6573d13e800Smrg#
6583d13e800Smrg# This file is free software; the Free Software Foundation
6593d13e800Smrg# gives unlimited permission to copy and/or distribute it,
6603d13e800Smrg# with or without modifications, as long as this notice is preserved.
66192bb16f8Smrg
6623d13e800Smrg# _AM_PROG_TAR(FORMAT)
6633d13e800Smrg# --------------------
6643d13e800Smrg# Check how to create a tarball in format FORMAT.
6653d13e800Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
6663d13e800Smrg#
6673d13e800Smrg# Substitute a variable $(am__tar) that is a command
6683d13e800Smrg# writing to stdout a FORMAT-tarball containing the directory
6693d13e800Smrg# $tardir.
6703d13e800Smrg#     tardir=directory && $(am__tar) > result.tar
6713d13e800Smrg#
6723d13e800Smrg# Substitute a variable $(am__untar) that extract such
6733d13e800Smrg# a tarball read from stdin.
6743d13e800Smrg#     $(am__untar) < result.tar
6753d13e800Smrg#
6763d13e800SmrgAC_DEFUN([_AM_PROG_TAR],
6773d13e800Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
6783d13e800Smrg# in the wild :-(  We should find a proper way to deprecate it ...
6793d13e800SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
68092bb16f8Smrg
6813d13e800Smrg# We'll loop over all known methods to create a tar archive until one works.
6823d13e800Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
68392bb16f8Smrg
6843d13e800Smrgm4_if([$1], [v7],
6853d13e800Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
68601395c31Smrg
6873d13e800Smrg  [m4_case([$1],
6883d13e800Smrg    [ustar],
6893d13e800Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
6903d13e800Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
6913d13e800Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
6923d13e800Smrg      # and bug#13588).
6933d13e800Smrg      am_max_uid=2097151 # 2^21 - 1
6943d13e800Smrg      am_max_gid=$am_max_uid
6953d13e800Smrg      # The $UID and $GID variables are not portable, so we need to resort
6963d13e800Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
6973d13e800Smrg      # below are definitely unexpected, so allow the users to see them
6983d13e800Smrg      # (that is, avoid stderr redirection).
6993d13e800Smrg      am_uid=`id -u || echo unknown`
7003d13e800Smrg      am_gid=`id -g || echo unknown`
7013d13e800Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
7023d13e800Smrg      if test $am_uid -le $am_max_uid; then
7033d13e800Smrg         AC_MSG_RESULT([yes])
7043d13e800Smrg      else
7053d13e800Smrg         AC_MSG_RESULT([no])
7063d13e800Smrg         _am_tools=none
7073d13e800Smrg      fi
7083d13e800Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
7093d13e800Smrg      if test $am_gid -le $am_max_gid; then
7103d13e800Smrg         AC_MSG_RESULT([yes])
7113d13e800Smrg      else
7123d13e800Smrg        AC_MSG_RESULT([no])
7133d13e800Smrg        _am_tools=none
7143d13e800Smrg      fi],
71592bb16f8Smrg
7163d13e800Smrg  [pax],
7173d13e800Smrg    [],
71892bb16f8Smrg
7193d13e800Smrg  [m4_fatal([Unknown tar format])])
72092bb16f8Smrg
7213d13e800Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
72292bb16f8Smrg
7233d13e800Smrg  # Go ahead even if we have the value already cached.  We do so because we
7243d13e800Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
7253d13e800Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
7268255a313Smrg
7273d13e800Smrg  for _am_tool in $_am_tools; do
7283d13e800Smrg    case $_am_tool in
7293d13e800Smrg    gnutar)
7303d13e800Smrg      for _am_tar in tar gnutar gtar; do
7313d13e800Smrg        AM_RUN_LOG([$_am_tar --version]) && break
7323d13e800Smrg      done
7333d13e800Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
7343d13e800Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
7353d13e800Smrg      am__untar="$_am_tar -xf -"
7363d13e800Smrg      ;;
7373d13e800Smrg    plaintar)
7383d13e800Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
7393d13e800Smrg      # ustar tarball either.
7403d13e800Smrg      (tar --version) >/dev/null 2>&1 && continue
7413d13e800Smrg      am__tar='tar chf - "$$tardir"'
7423d13e800Smrg      am__tar_='tar chf - "$tardir"'
7433d13e800Smrg      am__untar='tar xf -'
7443d13e800Smrg      ;;
7453d13e800Smrg    pax)
7463d13e800Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
7473d13e800Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
7483d13e800Smrg      am__untar='pax -r'
7493d13e800Smrg      ;;
7503d13e800Smrg    cpio)
7513d13e800Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
7523d13e800Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
7533d13e800Smrg      am__untar='cpio -i -H $1 -d'
7543d13e800Smrg      ;;
7553d13e800Smrg    none)
7563d13e800Smrg      am__tar=false
7573d13e800Smrg      am__tar_=false
7583d13e800Smrg      am__untar=false
7593d13e800Smrg      ;;
7603d13e800Smrg    esac
76101395c31Smrg
7623d13e800Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
7633d13e800Smrg    # and am__untar set.
7643d13e800Smrg    test -n "${am_cv_prog_tar_$1}" && break
76501395c31Smrg
7663d13e800Smrg    # tar/untar a dummy directory, and stop if the command works.
7673d13e800Smrg    rm -rf conftest.dir
7683d13e800Smrg    mkdir conftest.dir
7693d13e800Smrg    echo GrepMe > conftest.dir/file
7703d13e800Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
7713d13e800Smrg    rm -rf conftest.dir
7723d13e800Smrg    if test -s conftest.tar; then
7733d13e800Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
7743d13e800Smrg      AM_RUN_LOG([cat conftest.dir/file])
7753d13e800Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
7763d13e800Smrg    fi
7773d13e800Smrg  done
7783d13e800Smrg  rm -rf conftest.dir
77901395c31Smrg
7803d13e800Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
7813d13e800Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
78201395c31Smrg
7833d13e800SmrgAC_SUBST([am__tar])
7843d13e800SmrgAC_SUBST([am__untar])
7853d13e800Smrg]) # _AM_PROG_TAR
7868255a313Smrg
7873d13e800Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
7883d13e800Smrgdnl serial 11 (pkg-config-0.29)
7893d13e800Smrgdnl
7903d13e800Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
7913d13e800Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
7923d13e800Smrgdnl
7933d13e800Smrgdnl This program is free software; you can redistribute it and/or modify
7943d13e800Smrgdnl it under the terms of the GNU General Public License as published by
7953d13e800Smrgdnl the Free Software Foundation; either version 2 of the License, or
7963d13e800Smrgdnl (at your option) any later version.
7973d13e800Smrgdnl
7983d13e800Smrgdnl This program is distributed in the hope that it will be useful, but
7993d13e800Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
8003d13e800Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8013d13e800Smrgdnl General Public License for more details.
8023d13e800Smrgdnl
8033d13e800Smrgdnl You should have received a copy of the GNU General Public License
8043d13e800Smrgdnl along with this program; if not, write to the Free Software
8053d13e800Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
8063d13e800Smrgdnl 02111-1307, USA.
8073d13e800Smrgdnl
8083d13e800Smrgdnl As a special exception to the GNU General Public License, if you
8093d13e800Smrgdnl distribute this file as part of a program that contains a
8103d13e800Smrgdnl configuration script generated by Autoconf, you may include it under
8113d13e800Smrgdnl the same distribution terms that you use for the rest of that
8123d13e800Smrgdnl program.
8133d13e800Smrg
8143d13e800Smrgdnl PKG_PREREQ(MIN-VERSION)
8153d13e800Smrgdnl -----------------------
8163d13e800Smrgdnl Since: 0.29
8173d13e800Smrgdnl
8183d13e800Smrgdnl Verify that the version of the pkg-config macros are at least
8193d13e800Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
8203d13e800Smrgdnl installed version of pkg-config, this checks the developer's version
8213d13e800Smrgdnl of pkg.m4 when generating configure.
8223d13e800Smrgdnl
8233d13e800Smrgdnl To ensure that this macro is defined, also add:
8243d13e800Smrgdnl m4_ifndef([PKG_PREREQ],
8253d13e800Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
8263d13e800Smrgdnl
8273d13e800Smrgdnl See the "Since" comment for each macro you use to see what version
8283d13e800Smrgdnl of the macros you require.
8293d13e800Smrgm4_defun([PKG_PREREQ],
8303d13e800Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
8313d13e800Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
8323d13e800Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
8333d13e800Smrg])dnl PKG_PREREQ
8343d13e800Smrg
8353d13e800Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
8363d13e800Smrgdnl ----------------------------------
8373d13e800Smrgdnl Since: 0.16
8383d13e800Smrgdnl
8393d13e800Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
8403d13e800Smrgdnl first found in the path. Checks that the version of pkg-config found
8413d13e800Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
8423d13e800Smrgdnl used since that's the first version where most current features of
8433d13e800Smrgdnl pkg-config existed.
8443d13e800SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8453d13e800Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8463d13e800Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8473d13e800Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
8483d13e800SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
8493d13e800SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
8503d13e800SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
8513d13e800Smrg
8523d13e800Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8533d13e800Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
85401395c31Smrgfi
8553d13e800Smrgif test -n "$PKG_CONFIG"; then
8563d13e800Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
8573d13e800Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
8583d13e800Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
8593d13e800Smrg		AC_MSG_RESULT([yes])
8603d13e800Smrg	else
8613d13e800Smrg		AC_MSG_RESULT([no])
8623d13e800Smrg		PKG_CONFIG=""
8633d13e800Smrg	fi
8643d13e800Smrgfi[]dnl
8653d13e800Smrg])dnl PKG_PROG_PKG_CONFIG
8668255a313Smrg
8673d13e800Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
8683d13e800Smrgdnl -------------------------------------------------------------------
8693d13e800Smrgdnl Since: 0.18
8703d13e800Smrgdnl
8713d13e800Smrgdnl Check to see whether a particular set of modules exists. Similar to
8723d13e800Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
8733d13e800Smrgdnl
8743d13e800Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
8753d13e800Smrgdnl only at the first occurence in configure.ac, so if the first place
8763d13e800Smrgdnl it's called might be skipped (such as if it is within an "if", you
8773d13e800Smrgdnl have to call PKG_CHECK_EXISTS manually
8783d13e800SmrgAC_DEFUN([PKG_CHECK_EXISTS],
8793d13e800Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
8803d13e800Smrgif test -n "$PKG_CONFIG" && \
8813d13e800Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
8823d13e800Smrg  m4_default([$2], [:])
8833d13e800Smrgm4_ifvaln([$3], [else
8843d13e800Smrg  $3])dnl
88501395c31Smrgfi])
8868255a313Smrg
8873d13e800Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
8883d13e800Smrgdnl ---------------------------------------------
8893d13e800Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
8903d13e800Smrgdnl pkg_failed based on the result.
8913d13e800Smrgm4_define([_PKG_CONFIG],
8923d13e800Smrg[if test -n "$$1"; then
8933d13e800Smrg    pkg_cv_[]$1="$$1"
8943d13e800Smrg elif test -n "$PKG_CONFIG"; then
8953d13e800Smrg    PKG_CHECK_EXISTS([$3],
8963d13e800Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
8973d13e800Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
8983d13e800Smrg		     [pkg_failed=yes])
8993d13e800Smrg else
9003d13e800Smrg    pkg_failed=untried
9013d13e800Smrgfi[]dnl
9023d13e800Smrg])dnl _PKG_CONFIG
9038255a313Smrg
9043d13e800Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
9053d13e800Smrgdnl ---------------------------
9063d13e800Smrgdnl Internal check to see if pkg-config supports short errors.
9073d13e800SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
9083d13e800Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
9093d13e800Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
9103d13e800Smrg        _pkg_short_errors_supported=yes
91101395c31Smrgelse
9123d13e800Smrg        _pkg_short_errors_supported=no
9133d13e800Smrgfi[]dnl
9143d13e800Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
9158255a313Smrg
9168255a313Smrg
9173d13e800Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
9183d13e800Smrgdnl   [ACTION-IF-NOT-FOUND])
9193d13e800Smrgdnl --------------------------------------------------------------
9203d13e800Smrgdnl Since: 0.4.0
9213d13e800Smrgdnl
9223d13e800Smrgdnl Note that if there is a possibility the first call to
9233d13e800Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
9243d13e800Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
9253d13e800SmrgAC_DEFUN([PKG_CHECK_MODULES],
9263d13e800Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
9273d13e800SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
9283d13e800SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
9298255a313Smrg
9303d13e800Smrgpkg_failed=no
9313d13e800SmrgAC_MSG_CHECKING([for $1])
9328255a313Smrg
9333d13e800Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
9343d13e800Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
9358255a313Smrg
9363d13e800Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
9373d13e800Smrgand $1[]_LIBS to avoid the need to call pkg-config.
9383d13e800SmrgSee the pkg-config man page for more details.])
9398255a313Smrg
9403d13e800Smrgif test $pkg_failed = yes; then
9413d13e800Smrg   	AC_MSG_RESULT([no])
9423d13e800Smrg        _PKG_SHORT_ERRORS_SUPPORTED
9433d13e800Smrg        if test $_pkg_short_errors_supported = yes; then
9443d13e800Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
9453d13e800Smrg        else 
9463d13e800Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
9473d13e800Smrg        fi
9483d13e800Smrg	# Put the nasty error message in config.log where it belongs
9493d13e800Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
9508255a313Smrg
9513d13e800Smrg	m4_default([$4], [AC_MSG_ERROR(
9523d13e800Smrg[Package requirements ($2) were not met:
953de7ed6e8Smrg
9543d13e800Smrg$$1_PKG_ERRORS
955de7ed6e8Smrg
9563d13e800SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
9573d13e800Smrginstalled software in a non-standard prefix.
958de7ed6e8Smrg
9593d13e800Smrg_PKG_TEXT])[]dnl
9603d13e800Smrg        ])
9613d13e800Smrgelif test $pkg_failed = untried; then
9623d13e800Smrg     	AC_MSG_RESULT([no])
9633d13e800Smrg	m4_default([$4], [AC_MSG_FAILURE(
9643d13e800Smrg[The pkg-config script could not be found or is too old.  Make sure it
9653d13e800Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
9663d13e800Smrgpath to pkg-config.
967de7ed6e8Smrg
9683d13e800Smrg_PKG_TEXT
9698255a313Smrg
9703d13e800SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
9713d13e800Smrg        ])
9728255a313Smrgelse
9733d13e800Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
9743d13e800Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
9753d13e800Smrg        AC_MSG_RESULT([yes])
9763d13e800Smrg	$3
9773d13e800Smrgfi[]dnl
9783d13e800Smrg])dnl PKG_CHECK_MODULES
9798255a313Smrg
9808255a313Smrg
9813d13e800Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
9823d13e800Smrgdnl   [ACTION-IF-NOT-FOUND])
9833d13e800Smrgdnl ---------------------------------------------------------------------
9843d13e800Smrgdnl Since: 0.29
9853d13e800Smrgdnl
9863d13e800Smrgdnl Checks for existence of MODULES and gathers its build flags with
9873d13e800Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
9883d13e800Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
9893d13e800Smrgdnl
9903d13e800Smrgdnl Note that if there is a possibility the first call to
9913d13e800Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
9923d13e800Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
9933d13e800Smrgdnl configure.ac.
9943d13e800SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
9953d13e800Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
9963d13e800Smrg_save_PKG_CONFIG=$PKG_CONFIG
9973d13e800SmrgPKG_CONFIG="$PKG_CONFIG --static"
9983d13e800SmrgPKG_CHECK_MODULES($@)
9993d13e800SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
10003d13e800Smrg])dnl PKG_CHECK_MODULES_STATIC
10018255a313Smrg
10028255a313Smrg
10033d13e800Smrgdnl PKG_INSTALLDIR([DIRECTORY])
10043d13e800Smrgdnl -------------------------
10053d13e800Smrgdnl Since: 0.27
10063d13e800Smrgdnl
10073d13e800Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
10083d13e800Smrgdnl should install pkg-config .pc files. By default the directory is
10093d13e800Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
10103d13e800Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
10113d13e800Smrgdnl parameter.
10123d13e800SmrgAC_DEFUN([PKG_INSTALLDIR],
10133d13e800Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
10143d13e800Smrgm4_pushdef([pkg_description],
10153d13e800Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
10163d13e800SmrgAC_ARG_WITH([pkgconfigdir],
10173d13e800Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
10183d13e800Smrg    [with_pkgconfigdir=]pkg_default)
10193d13e800SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
10203d13e800Smrgm4_popdef([pkg_default])
10213d13e800Smrgm4_popdef([pkg_description])
10223d13e800Smrg])dnl PKG_INSTALLDIR
10238255a313Smrg
1024de7ed6e8Smrg
10253d13e800Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
10263d13e800Smrgdnl --------------------------------
10273d13e800Smrgdnl Since: 0.27
10283d13e800Smrgdnl
10293d13e800Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
10303d13e800Smrgdnl module should install arch-independent pkg-config .pc files. By
10313d13e800Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
10323d13e800Smrgdnl changed by passing DIRECTORY. The user can override through the
10333d13e800Smrgdnl --with-noarch-pkgconfigdir parameter.
10343d13e800SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
10353d13e800Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
10363d13e800Smrgm4_pushdef([pkg_description],
10373d13e800Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
10383d13e800SmrgAC_ARG_WITH([noarch-pkgconfigdir],
10393d13e800Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
10403d13e800Smrg    [with_noarch_pkgconfigdir=]pkg_default)
10413d13e800SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
10423d13e800Smrgm4_popdef([pkg_default])
10433d13e800Smrgm4_popdef([pkg_description])
10443d13e800Smrg])dnl PKG_NOARCH_INSTALLDIR
1045de7ed6e8Smrg
10468255a313Smrg
10473d13e800Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
10483d13e800Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10493d13e800Smrgdnl -------------------------------------------
10503d13e800Smrgdnl Since: 0.28
10513d13e800Smrgdnl
10523d13e800Smrgdnl Retrieves the value of the pkg-config variable for the given module.
10533d13e800SmrgAC_DEFUN([PKG_CHECK_VAR],
10543d13e800Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
10553d13e800SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1056de7ed6e8Smrg
10573d13e800Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
10583d13e800SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1059de7ed6e8Smrg
10603d13e800SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
10613d13e800Smrg])dnl PKG_CHECK_VAR
10623d13e800Smrg
10633d13e800Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
10643d13e800Smrgdnl
1065187ef25fSmrgdnl This file comes from X.Org's font-util 1.4.1
10663d13e800Smrgdnl
106722138c50Smrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
10683d13e800Smrgdnl
10693d13e800Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
10703d13e800Smrgdnl copy of this software and associated documentation files (the "Software"),
10713d13e800Smrgdnl to deal in the Software without restriction, including without limitation
10723d13e800Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
10733d13e800Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
10743d13e800Smrgdnl Software is furnished to do so, subject to the following conditions:
10753d13e800Smrgdnl
10763d13e800Smrgdnl The above copyright notice and this permission notice (including the next
10773d13e800Smrgdnl paragraph) shall be included in all copies or substantial portions of the
10783d13e800Smrgdnl Software.
10793d13e800Smrgdnl
10803d13e800Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10813d13e800Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10823d13e800Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
10833d13e800Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10843d13e800Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
10853d13e800Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
10863d13e800Smrgdnl DEALINGS IN THE SOFTWARE.
10873d13e800Smrgdnl
10883d13e800Smrgdnl --------------------------------------------------------------------
10893d13e800Smrgdnl
10903d13e800Smrgdnl Copyright 2005 Red Hat, Inc
10913d13e800Smrgdnl
10923d13e800Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
10933d13e800Smrgdnl documentation for any purpose is hereby granted without fee, provided that
10943d13e800Smrgdnl the above copyright notice appear in all copies and that both that
10953d13e800Smrgdnl copyright notice and this permission notice appear in supporting
10963d13e800Smrgdnl documentation.
10973d13e800Smrgdnl
10983d13e800Smrgdnl The above copyright notice and this permission notice shall be included
10993d13e800Smrgdnl in all copies or substantial portions of the Software.
11003d13e800Smrgdnl
11013d13e800Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
11023d13e800Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11033d13e800Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
11043d13e800Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
11053d13e800Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
11063d13e800Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
11073d13e800Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
11083d13e800Smrgdnl
11093d13e800Smrgdnl Except as contained in this notice, the name of the copyright holders shall
11103d13e800Smrgdnl not be used in advertising or otherwise to promote the sale, use or
11113d13e800Smrgdnl other dealings in this Software without prior written authorization
11123d13e800Smrgdnl from the copyright holders.
11133d13e800Smrg
11143d13e800Smrg# XORG_FONT_MACROS_VERSION(required-version)
11153d13e800Smrg# ------------------------------------------
11163d13e800Smrg# Minimum version: 1.1.0
111701395c31Smrg#
11183d13e800Smrg# If you're using a macro added in Version 1.1 or newer, include this in
11193d13e800Smrg# your configure.ac with the minimum required version, such as:
11203d13e800Smrg# XORG_FONT_MACROS_VERSION(1.1)
112101395c31Smrg#
11223d13e800Smrg# To ensure that this macro is defined, also add:
11233d13e800Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
11243d13e800Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
112501395c31Smrg#
112601395c31Smrg#
11273d13e800Smrg# See the "minimum version" comment for each macro you use to see what
11283d13e800Smrg# version you require.
11293d13e800Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
1130187ef25fSmrgm4_define([vers_have], [1.4.1])
11313d13e800Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
11323d13e800Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
11333d13e800Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
11343d13e800Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
11353d13e800Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
11363d13e800Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
11373d13e800Smrgm4_undefine([vers_have])
11383d13e800Smrgm4_undefine([maj_have])
11393d13e800Smrgm4_undefine([maj_needed])
11403d13e800Smrg]) # XORG_FONT_MACROS_VERSION
11413d13e800Smrg
11423d13e800Smrg# XORG_FONT_CHECK_{maps}()
11433d13e800Smrg# ------------------------
11443d13e800Smrg# Minimum version: 1.0.0
11453d13e800Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
11463d13e800Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
11473d13e800Smrg
11483d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
11493d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
11503d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
11513d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
11523d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
11533d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
11543d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
11553d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
11563d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
11573d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
11583d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
11593d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
11603d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
11613d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
11623d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
11633d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
11643d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
11653d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
11663d13e800Smrg
11673d13e800Smrg# XORG_FONT_CHECK_ENCODING(encoding)
11683d13e800Smrg# ----------------------------------
11693d13e800Smrg# Minimum version: 1.1.0
11703d13e800Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
11713d13e800Smrg# It replaced individual copies of this code in the above macros in 1.1.
11723d13e800Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
11733d13e800Smrg# calls if this is not true in the future.
11743d13e800Smrg
11753d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
11763d13e800Smrg	AC_ARG_ENABLE(m4_tolower($1),
11773d13e800Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
11783d13e800Smrg				[Build $1 fonts (default: yes)]),
11793d13e800Smrg		[AS_TR_SH($1)=$enableval])
11803d13e800Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
11813d13e800Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
11823d13e800Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
11833d13e800Smrg]) # XORG_FONT_CHECK_ENCODING
11843d13e800Smrg
11853d13e800Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
11863d13e800Smrg# -----------------------------------------------------
11873d13e800Smrg# Minimum version: 1.1.0
11883d13e800Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
11893d13e800Smrg# Add a shorthand --enable/disable-all-encodings option.
11903d13e800Smrg
11913d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
11923d13e800Smrg	AC_ARG_ENABLE([all-encodings],
11933d13e800Smrg		AS_HELP_STRING([--disable-all-encodings],
11943d13e800Smrg				[Disable building of all font encodings]),
11953d13e800Smrg		[m4_foreach_w([enc], [$1], [
11963d13e800Smrg			AS_TR_SH(enc)=$enableval
11973d13e800Smrg		])],
11983d13e800Smrg		[m4_foreach_w([enc], [$1], [
11993d13e800Smrg			AS_TR_SH(enc)=yes
12003d13e800Smrg		])])
12013d13e800Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
12023d13e800Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
12033d13e800Smrg
12043d13e800Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
12053d13e800Smrg# ------------------------------------------
12063d13e800Smrg# Minimum version: 1.1.0
120701395c31Smrg#
12083d13e800Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
120901395c31Smrg#
121001395c31Smrg
12113d13e800SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
12123d13e800Smrg	AC_PATH_PROG($1, $2)
12133d13e800Smrg	if test x"$$1" = x; then
12143d13e800Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
12153d13e800Smrg	fi
12163d13e800Smrg])
12173d13e800Smrg
12183d13e800Smrg
12193d13e800Smrg# XORG_FONT_FCCACHE()
12203d13e800Smrg# -------------------
12213d13e800Smrg# Minimum version: 1.1.0
122201395c31Smrg#
12233d13e800Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
12243d13e800Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
12253d13e800Smrg# to run fc-cache if found and not installing to $DESTDIR and not
12263d13e800Smrg# cross-compiling
122701395c31Smrg#
12283d13e800Smrg# fc-cache is optional, not required, and should be skipped when making
12293d13e800Smrg# packages (installing to $DESTDIR) or cross-compiling
123001395c31Smrg#
12313d13e800SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
12323d13e800Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
12333d13e800Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
12343d13e800Smrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
12353d13e800Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
12363d13e800Smrg	else
12373d13e800Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
12383d13e800Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
12393d13e800Smrg	fi
12403d13e800Smrg	AC_SUBST([RUN_FCCACHE])
12413d13e800Smrg])
1242de7ed6e8Smrg
12433d13e800Smrg# XORG_FONT_MKFONTDIR()
12443d13e800Smrg# -------------------
12453d13e800Smrg# Minimum version: 1.3.0
12468255a313Smrg#
12473d13e800Smrg# Set MKFONTDIR to path to mkfontdir.
124801395c31Smrg#
12493d13e800Smrg# If cross-compiling, and if mkdir is not found, use a shell command
12503d13e800Smrg# which warns mkfontdir needs to be run on the target
125101395c31Smrg#
12523d13e800Smrg# If not cross-compiling, mkfontdir must be found
125301395c31Smrg#
12543d13e800SmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
12553d13e800Smrg	if test x"$cross_compiling" != x"no" ; then
12563d13e800Smrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
12573d13e800Smrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
12588255a313Smrg
12593d13e800Smrg		if test x"$MKFONTDIR" = x; then
12603d13e800Smrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
12613d13e800Smrg		fi
12623d13e800Smrg	else
12633d13e800Smrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
12643d13e800Smrg	fi
12653d13e800Smrg
12663d13e800Smrg	AC_SUBST([MKFONTDIR])
12673d13e800Smrg])
12683d13e800Smrg
12693d13e800Smrg# XORG_FONT_COMMON_UTILS()
12703d13e800Smrg# ------------------------
12713d13e800Smrg# Minimum version: 1.1.0
127201395c31Smrg#
12733d13e800Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
12743d13e800Smrg
12753d13e800SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
12763d13e800Smrg	XORG_FONT_FCCACHE
12773d13e800Smrg	XORG_FONT_MKFONTDIR
12783d13e800Smrg])
12793d13e800Smrg
12803d13e800Smrg# XORG_FONT_SCALED_UTILS()
12813d13e800Smrg# ------------------------
12823d13e800Smrg# Minimum version: 1.1.0
128301395c31Smrg#
12843d13e800Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
12853d13e800Smrg# (TrueType, OpenType, Type1)
12863d13e800Smrg
12873d13e800SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
12883d13e800Smrg	XORG_FONT_COMMON_UTILS
12893d13e800Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
12903d13e800Smrg])
12913d13e800Smrg
12923d13e800Smrg# XORG_FONT_BDF_UTILS()
12933d13e800Smrg# ---------------------
12943d13e800Smrg# Minimum version: 1.1.0
129501395c31Smrg#
12963d13e800Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
12973d13e800Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
12983d13e800Smrg# PCF output files created by bdftopcf
12993d13e800Smrg
13003d13e800SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
13013d13e800Smrg	XORG_FONT_COMMON_UTILS
13023d13e800Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
13033d13e800Smrg	XORG_FONT_CHECK_COMPRESSION
13043d13e800Smrg])
13053d13e800Smrg
13063d13e800Smrg# XORG_FONT_CHECK_COMPRESSION()
13073d13e800Smrg# -----------------------------
13083d13e800Smrg# Minimum version: 1.1.0
130901395c31Smrg#
13103d13e800Smrg# Offer a --with-compression flag to control what compression method is
13113d13e800Smrg# used for pcf font files.   Offers all the methods currently supported
13123d13e800Smrg# by libXfont, including no compression.
131322138c50Smrg#
131422138c50Smrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
131522138c50Smrg# for reproducible builds, such as gzip -n to not record timestamp, will
131622138c50Smrg# set COMPRESS_FLAGS to those options.
13178255a313Smrg
13183d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
13193d13e800Smrg	AC_MSG_CHECKING([font compression method])
13203d13e800Smrg	AC_ARG_WITH(compression,
13213d13e800Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
13223d13e800Smrg			 [compression method to use on pcf fonts])],
13233d13e800Smrg         [compression="$withval"], [compression="yes"])
13243d13e800Smrg	if test x"$compression" = "xyes" ; then
13253d13e800Smrg		compression="gzip"
13263d13e800Smrg	fi
13273d13e800Smrg	AC_MSG_RESULT([${compression}])
13283d13e800Smrg	case ${compression} in
13293d13e800Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
133022138c50Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
133122138c50Smrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
13323d13e800Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
13333d13e800Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
13343d13e800Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
13353d13e800Smrg	esac
13363d13e800Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
13373d13e800Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
13383d13e800Smrg	fi
133922138c50Smrg	AC_MSG_CHECKING([options to font compression command])
134022138c50Smrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
134122138c50Smrg	AC_SUBST([COMPRESS_FLAGS])
13423d13e800Smrg	AC_SUBST([COMPRESS_SUFFIX])
13433d13e800Smrg])
13443d13e800Smrg
13453d13e800Smrg# XORG_FONT_UCS2ANY()
13463d13e800Smrg# -------------------
13473d13e800Smrg# Minimum version: 1.1.0
134801395c31Smrg#
13493d13e800Smrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
13503d13e800Smrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
13513d13e800Smrg# Also call pkg-config to find the directory with the encoding files needed
13523d13e800Smrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
13533d13e800Smrg
13543d13e800SmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
13553d13e800Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
13563d13e800Smrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
13573d13e800Smrg	PKG_CHECK_MODULES(MAPS, [fontutil])
13583d13e800Smrg	AC_MSG_CHECKING([for ucs2any encoding data files])
13593d13e800Smrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
13603d13e800Smrg	AC_SUBST(MAPFILES_PATH)
13613d13e800Smrg	AC_MSG_RESULT([${MAPFILES_PATH}])
13623d13e800Smrg])
13633d13e800Smrg
13643d13e800Smrg
13653d13e800Smrg
13663d13e800Smrg# XORG_FONT_FC_CONFDIR()
13673d13e800Smrg# --------------------
13683d13e800Smrg# Minimum version: 1.2.0
136901395c31Smrg#
13703d13e800Smrg# Sets FC_CONFDIR to the fontconfig config directory
13713d13e800Smrg# (which should be --with-confdir=... when building fontconfig)
13723d13e800Smrg# found from:
13733d13e800Smrg#	--with-fc-confdir=...
13743d13e800Smrg#	pkg-config --variable=confdir fontconfig
13753d13e800Smrg#	${sysconfdir}/fonts
13763d13e800Smrg
13773d13e800SmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
13783d13e800Smrg	dnl Ensure $PKG_CONFIG is set first
13793d13e800Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
13803d13e800Smrg
13813d13e800Smrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
13823d13e800Smrg	AC_ARG_WITH(fc-confdir,
13833d13e800Smrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
13843d13e800Smrg			   [Path to fontconfig's configuration directory]),
13853d13e800Smrg		    [FC_CONFDIR="$withval"])
13863d13e800Smrg	# if --with-fc-confdir was not specified
13873d13e800Smrg	if test "x${FC_CONFDIR}" = "x"; then
13883d13e800Smrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
13893d13e800Smrg	fi
13903d13e800Smrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
13913d13e800Smrg	if test "x${FC_CONFDIR}" = "x"; then
13923d13e800Smrg		FC_CONFDIR="${sysconfdir}/fonts"
13933d13e800Smrg	fi
13943d13e800Smrg	AC_SUBST(FC_CONFDIR)
13953d13e800Smrg	AC_MSG_RESULT([${FC_CONFDIR}])
13963d13e800Smrg])
13973d13e800Smrg
13983d13e800Smrg
13993d13e800Smrg
14003d13e800Smrg# XORG_FONTROOTDIR()
14013d13e800Smrg# --------------------
14023d13e800Smrg# Minimum version: 1.1.0
140301395c31Smrg#
14043d13e800Smrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
14053d13e800Smrg# found from:
14063d13e800Smrg#	--with-fontrootdir
14073d13e800Smrg#	pkg-config --variable=fontrootdir fontutil
14083d13e800Smrg#	${datadir}/fonts/X11
14098255a313Smrg
14103d13e800SmrgAC_DEFUN([XORG_FONTROOTDIR],[
14113d13e800Smrg	dnl Ensure $PKG_CONFIG is set first
14123d13e800Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
14138255a313Smrg
14143d13e800Smrg	AC_MSG_CHECKING([for root directory for font files])
14153d13e800Smrg	AC_ARG_WITH(fontrootdir,
14163d13e800Smrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
14173d13e800Smrg			   [Path to root directory for font files]),
14183d13e800Smrg		    [FONTROOTDIR="$withval"])
14193d13e800Smrg	# if --with-fontrootdir not specified...
14203d13e800Smrg	if test "x${FONTROOTDIR}" = "x"; then
14213d13e800Smrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
14223d13e800Smrg	fi
14233d13e800Smrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
14243d13e800Smrg	if test "x${FONTROOTDIR}" = "x"; then
14253d13e800Smrg		FONTROOTDIR="${datadir}/fonts/X11"
14263d13e800Smrg	fi
14273d13e800Smrg	AC_SUBST(FONTROOTDIR)
14283d13e800Smrg	AC_MSG_RESULT([${FONTROOTDIR}])
14293d13e800Smrg])
14308255a313Smrg
14313d13e800Smrg# XORG_FONTSUBDIR(variable, flag, subdir)
14323d13e800Smrg# ---------------------------------------
14333d13e800Smrg# Minimum version: 1.1.0
14343d13e800Smrg#
14353d13e800Smrg# Offer a --with-<flag> flag to control directory for font installation
14363d13e800Smrg# Default is the specified <subdir> of the font root directory.
14373d13e800Smrg# Sets <variable> to the selected directory
14388255a313Smrg
14393d13e800SmrgAC_DEFUN([XORG_FONTSUBDIR],[
14403d13e800Smrg	AC_REQUIRE([XORG_FONTROOTDIR])
14418255a313Smrg
14423d13e800Smrg	AC_MSG_CHECKING([for directory for $3 files])
14433d13e800Smrg	AC_ARG_WITH($2,
14443d13e800Smrg		    [AS_HELP_STRING([--with-$2=DIR],
14453d13e800Smrg				    [Path to $3 files [FONTROOTDIR/$3]])],
14463d13e800Smrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
14473d13e800Smrg	AC_SUBST($1)
14483d13e800Smrg	AC_MSG_RESULT([${$1}])
14493d13e800Smrg]) # XORG_FONTSUBDIR
14508255a313Smrg
14513d13e800Smrg# XORG_FONTDIR(subdir)
14523d13e800Smrg# --------------------
14533d13e800Smrg# Minimum version: 1.1.0
145401395c31Smrg#
14553d13e800Smrg# Offer a --with-fontdir flag to control directory for font installation
14563d13e800Smrg# Default is the specified subdir of the font root directory.
14573d13e800Smrg# Sets FONTDIR to the selected directory
14583d13e800Smrg
14593d13e800SmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
14603d13e800Smrg
14613d13e800Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14623d13e800Smrgdnl
146322138c50Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
14643d13e800Smrgdnl
14653d13e800Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14663d13e800Smrgdnl copy of this software and associated documentation files (the "Software"),
14673d13e800Smrgdnl to deal in the Software without restriction, including without limitation
14683d13e800Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14693d13e800Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
14703d13e800Smrgdnl Software is furnished to do so, subject to the following conditions:
14713d13e800Smrgdnl
14723d13e800Smrgdnl The above copyright notice and this permission notice (including the next
14733d13e800Smrgdnl paragraph) shall be included in all copies or substantial portions of the
14743d13e800Smrgdnl Software.
14753d13e800Smrgdnl
14763d13e800Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14773d13e800Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14783d13e800Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14793d13e800Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14803d13e800Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14813d13e800Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14823d13e800Smrgdnl DEALINGS IN THE SOFTWARE.
14833d13e800Smrg
14843d13e800Smrg# XORG_MACROS_VERSION(required-version)
14853d13e800Smrg# -------------------------------------
14863d13e800Smrg# Minimum version: 1.1.0
148701395c31Smrg#
14883d13e800Smrg# If you're using a macro added in Version 1.1 or newer, include this in
14893d13e800Smrg# your configure.ac with the minimum required version, such as:
14903d13e800Smrg# XORG_MACROS_VERSION(1.1)
149101395c31Smrg#
14923d13e800Smrg# To ensure that this macro is defined, also add:
14933d13e800Smrg# m4_ifndef([XORG_MACROS_VERSION],
14943d13e800Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
149501395c31Smrg#
149601395c31Smrg#
14973d13e800Smrg# See the "minimum version" comment for each macro you use to see what
14983d13e800Smrg# version you require.
14993d13e800Smrgm4_defun([XORG_MACROS_VERSION],[
150022138c50Smrgm4_define([vers_have], [1.20.0])
15013d13e800Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
15023d13e800Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
15033d13e800Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
15043d13e800Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
15053d13e800Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
15063d13e800Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
15073d13e800Smrgm4_undefine([vers_have])
15083d13e800Smrgm4_undefine([maj_have])
15093d13e800Smrgm4_undefine([maj_needed])
15103d13e800Smrg]) # XORG_MACROS_VERSION
15113d13e800Smrg
15123d13e800Smrg# XORG_PROG_RAWCPP()
15133d13e800Smrg# ------------------
15143d13e800Smrg# Minimum version: 1.0.0
151501395c31Smrg#
15163d13e800Smrg# Find cpp program and necessary flags for use in pre-processing text files
15173d13e800Smrg# such as man pages and config files
15183d13e800SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
15193d13e800SmrgAC_REQUIRE([AC_PROG_CPP])
15203d13e800SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
15213d13e800Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
15223d13e800Smrg
15233d13e800Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
15243d13e800Smrg# which is not the best choice for supporting other OS'es, but covers most
15253d13e800Smrg# of the ones we need for now.
15263d13e800SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
15273d13e800SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
15283d13e800Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15293d13e800Smrg	AC_MSG_RESULT([no])
153001395c31Smrgelse
15313d13e800Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15323d13e800Smrg		RAWCPPFLAGS=-undef
15333d13e800Smrg		AC_MSG_RESULT([yes])
15343d13e800Smrg	# under Cygwin unix is still defined even with -undef
15353d13e800Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15363d13e800Smrg		RAWCPPFLAGS="-undef -ansi"
15373d13e800Smrg		AC_MSG_RESULT([yes, with -ansi])
15383d13e800Smrg	else
15393d13e800Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15403d13e800Smrg	fi
154101395c31Smrgfi
15423d13e800Smrgrm -f conftest.$ac_ext
15438255a313Smrg
15443d13e800SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15453d13e800SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1546187ef25fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
15473d13e800Smrg	AC_MSG_RESULT([no])
15483d13e800Smrgelse
1549187ef25fSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
15503d13e800Smrg		TRADITIONALCPPFLAGS="-traditional"
15513d13e800Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15523d13e800Smrg		AC_MSG_RESULT([yes])
15533d13e800Smrg	else
15543d13e800Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15553d13e800Smrg	fi
15563d13e800Smrgfi
15573d13e800Smrgrm -f conftest.$ac_ext
15583d13e800SmrgAC_SUBST(RAWCPPFLAGS)
15593d13e800SmrgAC_SUBST(TRADITIONALCPPFLAGS)
15603d13e800Smrg]) # XORG_PROG_RAWCPP
15613d13e800Smrg
15623d13e800Smrg# XORG_MANPAGE_SECTIONS()
156301395c31Smrg# -----------------------
15643d13e800Smrg# Minimum version: 1.0.0
1565de7ed6e8Smrg#
15663d13e800Smrg# Determine which sections man pages go in for the different man page types
15673d13e800Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15683d13e800Smrg# Not sure if there's any better way than just hardcoding by OS name.
15693d13e800Smrg# Override default settings by setting environment variables
15703d13e800Smrg# Added MAN_SUBSTS in version 1.8
15713d13e800Smrg# Added AC_PROG_SED in version 1.8
157201395c31Smrg
15733d13e800SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
157401395c31SmrgAC_REQUIRE([AC_CANONICAL_HOST])
15753d13e800SmrgAC_REQUIRE([AC_PROG_SED])
157601395c31Smrg
157701395c31Smrgcase $host_os in
157801395c31Smrg    solaris*)
15793d13e800Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15803d13e800Smrg        # check for a man page file found in later versions that use
15813d13e800Smrg        # traditional section numbers instead
15823d13e800Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15833d13e800Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
158401395c31Smrg        ;;
15853d13e800Smrg    *) SYSV_MAN_SECTIONS=false ;;
158601395c31Smrgesac
158701395c31Smrg
15883d13e800Smrgif test x$APP_MAN_SUFFIX = x    ; then
15893d13e800Smrg    APP_MAN_SUFFIX=1
15903d13e800Smrgfi
15913d13e800Smrgif test x$APP_MAN_DIR = x    ; then
15923d13e800Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
159301395c31Smrgfi
159401395c31Smrg
15953d13e800Smrgif test x$LIB_MAN_SUFFIX = x    ; then
15963d13e800Smrg    LIB_MAN_SUFFIX=3
15973d13e800Smrgfi
15983d13e800Smrgif test x$LIB_MAN_DIR = x    ; then
15993d13e800Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
16003d13e800Smrgfi
160101395c31Smrg
16023d13e800Smrgif test x$FILE_MAN_SUFFIX = x    ; then
16033d13e800Smrg    case $SYSV_MAN_SECTIONS in
16043d13e800Smrg	true)				FILE_MAN_SUFFIX=4  ;;
16053d13e800Smrg	*)				FILE_MAN_SUFFIX=5  ;;
16063d13e800Smrg    esac
16073d13e800Smrgfi
16083d13e800Smrgif test x$FILE_MAN_DIR = x    ; then
16093d13e800Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
16103d13e800Smrgfi
1611de7ed6e8Smrg
16123d13e800Smrgif test x$MISC_MAN_SUFFIX = x    ; then
16133d13e800Smrg    case $SYSV_MAN_SECTIONS in
16143d13e800Smrg	true)				MISC_MAN_SUFFIX=5  ;;
16153d13e800Smrg	*)				MISC_MAN_SUFFIX=7  ;;
16163d13e800Smrg    esac
16173d13e800Smrgfi
16183d13e800Smrgif test x$MISC_MAN_DIR = x    ; then
16193d13e800Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1620de7ed6e8Smrgfi
1621de7ed6e8Smrg
16223d13e800Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
16233d13e800Smrg    case $SYSV_MAN_SECTIONS in
16243d13e800Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
16253d13e800Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
16263d13e800Smrg    esac
16273d13e800Smrgfi
16283d13e800Smrgif test x$DRIVER_MAN_DIR = x    ; then
16293d13e800Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
163001395c31Smrgfi
1631de7ed6e8Smrg
16323d13e800Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
16333d13e800Smrg    case $SYSV_MAN_SECTIONS in
16343d13e800Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16353d13e800Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16363d13e800Smrg    esac
16373d13e800Smrgfi
16383d13e800Smrgif test x$ADMIN_MAN_DIR = x    ; then
16393d13e800Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16403d13e800Smrgfi
1641de7ed6e8Smrg
16423d13e800Smrg
16433d13e800SmrgAC_SUBST([APP_MAN_SUFFIX])
16443d13e800SmrgAC_SUBST([LIB_MAN_SUFFIX])
16453d13e800SmrgAC_SUBST([FILE_MAN_SUFFIX])
16463d13e800SmrgAC_SUBST([MISC_MAN_SUFFIX])
16473d13e800SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16483d13e800SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16493d13e800SmrgAC_SUBST([APP_MAN_DIR])
16503d13e800SmrgAC_SUBST([LIB_MAN_DIR])
16513d13e800SmrgAC_SUBST([FILE_MAN_DIR])
16523d13e800SmrgAC_SUBST([MISC_MAN_DIR])
16533d13e800SmrgAC_SUBST([DRIVER_MAN_DIR])
16543d13e800SmrgAC_SUBST([ADMIN_MAN_DIR])
16553d13e800Smrg
16563d13e800SmrgXORG_MAN_PAGE="X Version 11"
16573d13e800SmrgAC_SUBST([XORG_MAN_PAGE])
16583d13e800SmrgMAN_SUBSTS="\
16593d13e800Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16603d13e800Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16613d13e800Smrg	-e 's|__xservername__|Xorg|g' \
16623d13e800Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
16633d13e800Smrg	-e 's|__projectroot__|\$(prefix)|g' \
16643d13e800Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16653d13e800Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16663d13e800Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16673d13e800Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16683d13e800Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16693d13e800Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16703d13e800Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16713d13e800SmrgAC_SUBST([MAN_SUBSTS])
16723d13e800Smrg
16733d13e800Smrg]) # XORG_MANPAGE_SECTIONS
16743d13e800Smrg
16753d13e800Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16763d13e800Smrg# ------------------------
16773d13e800Smrg# Minimum version: 1.7.0
1678de7ed6e8Smrg#
16793d13e800Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16803d13e800Smrg# provided by xorg-sgml-doctools, if installed.
16813d13e800SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16823d13e800SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16833d13e800SmrgXORG_SGML_PATH=
16843d13e800SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16853d13e800Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16863d13e800Smrg    [m4_ifval([$1],[:],
16873d13e800Smrg        [if test x"$cross_compiling" != x"yes" ; then
16883d13e800Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16893d13e800Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16903d13e800Smrg         fi])
16913d13e800Smrg    ])
16923d13e800Smrg
16933d13e800Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16943d13e800Smrg# the path and the name of the doc stylesheet
16953d13e800Smrgif test "x$XORG_SGML_PATH" != "x" ; then
16963d13e800Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16973d13e800Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16983d13e800Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16993d13e800Smrgelse
17003d13e800Smrg   AC_MSG_RESULT([no])
17013d13e800Smrgfi
17023d13e800Smrg
17033d13e800SmrgAC_SUBST(XORG_SGML_PATH)
17043d13e800SmrgAC_SUBST(STYLESHEET_SRCDIR)
17053d13e800SmrgAC_SUBST(XSL_STYLESHEET)
17063d13e800SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
17073d13e800Smrg]) # XORG_CHECK_SGML_DOCTOOLS
17083d13e800Smrg
17093d13e800Smrg# XORG_CHECK_LINUXDOC
17103d13e800Smrg# -------------------
17113d13e800Smrg# Minimum version: 1.0.0
171201395c31Smrg#
17133d13e800Smrg# Defines the variable MAKE_TEXT if the necessary tools and
17143d13e800Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
17153d13e800Smrg# Whether or not the necessary tools and files are found can be checked
17163d13e800Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
17173d13e800SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
17183d13e800SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17193d13e800SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1720de7ed6e8Smrg
17213d13e800SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
172201395c31Smrg
17233d13e800SmrgAC_MSG_CHECKING([whether to build documentation])
172401395c31Smrg
17253d13e800Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
17263d13e800Smrg   BUILDDOC=yes
1727de7ed6e8Smrgelse
17283d13e800Smrg   BUILDDOC=no
1729de7ed6e8Smrgfi
1730de7ed6e8Smrg
17313d13e800SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
173201395c31Smrg
17333d13e800SmrgAC_MSG_RESULT([$BUILDDOC])
173401395c31Smrg
17353d13e800SmrgAC_MSG_CHECKING([whether to build pdf documentation])
173601395c31Smrg
17373d13e800Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17383d13e800Smrg   BUILDPDFDOC=yes
17393d13e800Smrgelse
17403d13e800Smrg   BUILDPDFDOC=no
17413d13e800Smrgfi
1742de7ed6e8Smrg
17433d13e800SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
174401395c31Smrg
17453d13e800SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1746de7ed6e8Smrg
17473d13e800SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17483d13e800SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17493d13e800SmrgMAKE_PDF="$PS2PDF"
17503d13e800SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
175101395c31Smrg
17523d13e800SmrgAC_SUBST(MAKE_TEXT)
17533d13e800SmrgAC_SUBST(MAKE_PS)
17543d13e800SmrgAC_SUBST(MAKE_PDF)
17553d13e800SmrgAC_SUBST(MAKE_HTML)
17563d13e800Smrg]) # XORG_CHECK_LINUXDOC
175701395c31Smrg
17583d13e800Smrg# XORG_CHECK_DOCBOOK
175901395c31Smrg# -------------------
17603d13e800Smrg# Minimum version: 1.0.0
176101395c31Smrg#
17623d13e800Smrg# Checks for the ability to build output formats from SGML DocBook source.
17633d13e800Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17643d13e800Smrg# indicates whether the necessary tools and files are found and, if set,
17653d13e800Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17663d13e800SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17673d13e800SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
176801395c31Smrg
17693d13e800SmrgBUILDTXTDOC=no
17703d13e800SmrgBUILDPDFDOC=no
17713d13e800SmrgBUILDPSDOC=no
17723d13e800SmrgBUILDHTMLDOC=no
177301395c31Smrg
17743d13e800SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17753d13e800SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17763d13e800SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17773d13e800SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
177801395c31Smrg
17793d13e800SmrgAC_MSG_CHECKING([whether to build text documentation])
17803d13e800Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17813d13e800Smrg   test x$BUILD_TXTDOC != xno; then
17823d13e800Smrg	BUILDTXTDOC=yes
178301395c31Smrgfi
17843d13e800SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17853d13e800SmrgAC_MSG_RESULT([$BUILDTXTDOC])
178601395c31Smrg
17873d13e800SmrgAC_MSG_CHECKING([whether to build PDF documentation])
17883d13e800Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17893d13e800Smrg   test x$BUILD_PDFDOC != xno; then
17903d13e800Smrg	BUILDPDFDOC=yes
179101395c31Smrgfi
17923d13e800SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17933d13e800SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1794de7ed6e8Smrg
17953d13e800SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17963d13e800Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17973d13e800Smrg   test x$BUILD_PSDOC != xno; then
17983d13e800Smrg	BUILDPSDOC=yes
17993d13e800Smrgfi
18003d13e800SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
18013d13e800SmrgAC_MSG_RESULT([$BUILDPSDOC])
180201395c31Smrg
18033d13e800SmrgAC_MSG_CHECKING([whether to build HTML documentation])
18043d13e800Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
18053d13e800Smrg   test x$BUILD_HTMLDOC != xno; then
18063d13e800Smrg	BUILDHTMLDOC=yes
18073d13e800Smrgfi
18083d13e800SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
18093d13e800SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
181001395c31Smrg
18113d13e800SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
18123d13e800SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
18133d13e800SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
18143d13e800SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
181501395c31Smrg
18163d13e800SmrgAC_SUBST(MAKE_TEXT)
18173d13e800SmrgAC_SUBST(MAKE_PS)
18183d13e800SmrgAC_SUBST(MAKE_PDF)
18193d13e800SmrgAC_SUBST(MAKE_HTML)
18203d13e800Smrg]) # XORG_CHECK_DOCBOOK
182101395c31Smrg
18223d13e800Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
18233d13e800Smrg# ----------------
18243d13e800Smrg# Minimum version: 1.5.0
18253d13e800Smrg# Minimum version for optional DEFAULT argument: 1.11.0
182601395c31Smrg#
18273d13e800Smrg# Documentation tools are not always available on all platforms and sometimes
18283d13e800Smrg# not at the appropriate level. This macro enables a module to test for the
18293d13e800Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
183022138c50Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
18313d13e800Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
18323d13e800Smrg# --with-xmlto assumes 'auto'.
183301395c31Smrg#
18343d13e800Smrg# Interface to module:
18353d13e800Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18363d13e800Smrg# XMLTO:	returns the path of the xmlto program found
18373d13e800Smrg#		returns the path set by the user in the environment
18383d13e800Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18393d13e800Smrg#		'no' user instructs the module not to use xmlto
184001395c31Smrg#
18413d13e800Smrg# Added in version 1.10.0
18423d13e800Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18433d13e800Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
18443d13e800Smrg#
18453d13e800Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
18463d13e800Smrg#
18473d13e800SmrgAC_DEFUN([XORG_WITH_XMLTO],[
18483d13e800SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18493d13e800Smrgm4_define([_defopt], m4_default([$2], [auto]))
18503d13e800SmrgAC_ARG_WITH(xmlto,
18513d13e800Smrg	AS_HELP_STRING([--with-xmlto],
18523d13e800Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18533d13e800Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18543d13e800Smrgm4_undefine([_defopt])
185501395c31Smrg
18563d13e800Smrgif test "x$use_xmlto" = x"auto"; then
18573d13e800Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18583d13e800Smrg   if test "x$XMLTO" = "x"; then
18593d13e800Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18603d13e800Smrg	have_xmlto=no
18613d13e800Smrg   else
18623d13e800Smrg        have_xmlto=yes
18633d13e800Smrg   fi
18643d13e800Smrgelif test "x$use_xmlto" = x"yes" ; then
18653d13e800Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18663d13e800Smrg   if test "x$XMLTO" = "x"; then
18673d13e800Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18683d13e800Smrg   fi
18693d13e800Smrg   have_xmlto=yes
18703d13e800Smrgelif test "x$use_xmlto" = x"no" ; then
18713d13e800Smrg   if test "x$XMLTO" != "x"; then
18723d13e800Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18733d13e800Smrg   fi
18743d13e800Smrg   have_xmlto=no
1875de7ed6e8Smrgelse
18763d13e800Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1877de7ed6e8Smrgfi
1878de7ed6e8Smrg
18793d13e800Smrg# Test for a minimum version of xmlto, if provided.
18803d13e800Smrgm4_ifval([$1],
18813d13e800Smrg[if test "$have_xmlto" = yes; then
18823d13e800Smrg    # scrape the xmlto version
18833d13e800Smrg    AC_MSG_CHECKING([the xmlto version])
18843d13e800Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18853d13e800Smrg    AC_MSG_RESULT([$xmlto_version])
18863d13e800Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18873d13e800Smrg        [if test "x$use_xmlto" = xauto; then
18883d13e800Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18893d13e800Smrg            have_xmlto=no
18903d13e800Smrg        else
18913d13e800Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18923d13e800Smrg        fi])
18933d13e800Smrgfi])
189401395c31Smrg
18953d13e800Smrg# Test for the ability of xmlto to generate a text target
18963d13e800Smrg#
18973d13e800Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18983d13e800Smrg# following test for empty XML docbook files.
18993d13e800Smrg# For compatibility reasons use the following empty XML docbook file and if
19003d13e800Smrg# it fails try it again with a non-empty XML file.
19013d13e800Smrghave_xmlto_text=no
19023d13e800Smrgcat > conftest.xml << "EOF"
19033d13e800SmrgEOF
19043d13e800SmrgAS_IF([test "$have_xmlto" = yes],
19053d13e800Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
19063d13e800Smrg             [have_xmlto_text=yes],
19073d13e800Smrg             [# Try it again with a non-empty XML file.
19083d13e800Smrg              cat > conftest.xml << "EOF"
19093d13e800Smrg<x></x>
19103d13e800SmrgEOF
19113d13e800Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
19123d13e800Smrg                    [have_xmlto_text=yes],
19133d13e800Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
19143d13e800Smrgrm -f conftest.xml
19153d13e800SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
19163d13e800SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
19173d13e800Smrg]) # XORG_WITH_XMLTO
191801395c31Smrg
19193d13e800Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
19203d13e800Smrg# --------------------------------------------
19213d13e800Smrg# Minimum version: 1.12.0
19223d13e800Smrg# Minimum version for optional DEFAULT argument: 1.12.0
19233d13e800Smrg#
19243d13e800Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
19253d13e800Smrg# XML-based language used for the transformation of XML documents.
19263d13e800Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
19273d13e800Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
19283d13e800Smrg# The XSLT processor is often used as a standalone tool for transformations.
19293d13e800Smrg# It should not be assumed that this tool is used only to work with documnetation.
19303d13e800Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
19313d13e800Smrg#
19323d13e800Smrg# Interface to module:
19333d13e800Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19343d13e800Smrg# XSLTPROC:	 returns the path of the xsltproc program found
19353d13e800Smrg#		 returns the path set by the user in the environment
19363d13e800Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19373d13e800Smrg#		  'no' user instructs the module not to use xsltproc
19383d13e800Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19393d13e800Smrg#
19403d13e800Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19413d13e800Smrg#
19423d13e800SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19433d13e800SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19443d13e800Smrg# Preserves the interface, should it be implemented later
19453d13e800Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19463d13e800Smrgm4_define([_defopt], m4_default([$2], [auto]))
19473d13e800SmrgAC_ARG_WITH(xsltproc,
19483d13e800Smrg	AS_HELP_STRING([--with-xsltproc],
19493d13e800Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19503d13e800Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19513d13e800Smrgm4_undefine([_defopt])
19523d13e800Smrg
19533d13e800Smrgif test "x$use_xsltproc" = x"auto"; then
19543d13e800Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19553d13e800Smrg   if test "x$XSLTPROC" = "x"; then
19563d13e800Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19573d13e800Smrg	have_xsltproc=no
19583d13e800Smrg   else
19593d13e800Smrg        have_xsltproc=yes
19603d13e800Smrg   fi
19613d13e800Smrgelif test "x$use_xsltproc" = x"yes" ; then
19623d13e800Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19633d13e800Smrg   if test "x$XSLTPROC" = "x"; then
19643d13e800Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19653d13e800Smrg   fi
19663d13e800Smrg   have_xsltproc=yes
19673d13e800Smrgelif test "x$use_xsltproc" = x"no" ; then
19683d13e800Smrg   if test "x$XSLTPROC" != "x"; then
19693d13e800Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19703d13e800Smrg   fi
19713d13e800Smrg   have_xsltproc=no
197201395c31Smrgelse
19733d13e800Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1974de7ed6e8Smrgfi
1975de7ed6e8Smrg
19763d13e800SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19773d13e800Smrg]) # XORG_WITH_XSLTPROC
1978de7ed6e8Smrg
19793d13e800Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19803d13e800Smrg# ----------------------------------------
19813d13e800Smrg# Minimum version: 1.15.0
1982de7ed6e8Smrg#
19833d13e800Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
19843d13e800Smrg# scanning arbitrary text files, extracting information from those text files,
19853d13e800Smrg# and printing reports based on that information.
1986de7ed6e8Smrg#
19873d13e800Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1988de7ed6e8Smrg#
19893d13e800Smrg# Interface to module:
19903d13e800Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
19913d13e800Smrg# PERL:	     returns the path of the perl program found
19923d13e800Smrg#	     returns the path set by the user in the environment
19933d13e800Smrg# --with-perl: 'yes' user instructs the module to use perl
19943d13e800Smrg#	       'no' user instructs the module not to use perl
19953d13e800Smrg# have_perl: returns yes if perl found in PATH or no
1996de7ed6e8Smrg#
19973d13e800Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
199801395c31Smrg#
19993d13e800SmrgAC_DEFUN([XORG_WITH_PERL],[
20003d13e800SmrgAC_ARG_VAR([PERL], [Path to perl command])
20013d13e800Smrg# Preserves the interface, should it be implemented later
20023d13e800Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
20033d13e800Smrgm4_define([_defopt], m4_default([$2], [auto]))
20043d13e800SmrgAC_ARG_WITH(perl,
20053d13e800Smrg	AS_HELP_STRING([--with-perl],
20063d13e800Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
20073d13e800Smrg	   [use_perl=$withval], [use_perl=]_defopt)
20083d13e800Smrgm4_undefine([_defopt])
200901395c31Smrg
20103d13e800Smrgif test "x$use_perl" = x"auto"; then
20113d13e800Smrg   AC_PATH_PROG([PERL], [perl])
20123d13e800Smrg   if test "x$PERL" = "x"; then
20133d13e800Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
20143d13e800Smrg	have_perl=no
20153d13e800Smrg   else
20163d13e800Smrg        have_perl=yes
20173d13e800Smrg   fi
20183d13e800Smrgelif test "x$use_perl" = x"yes" ; then
20193d13e800Smrg   AC_PATH_PROG([PERL], [perl])
20203d13e800Smrg   if test "x$PERL" = "x"; then
20213d13e800Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
20223d13e800Smrg   fi
20233d13e800Smrg   have_perl=yes
20243d13e800Smrgelif test "x$use_perl" = x"no" ; then
20253d13e800Smrg   if test "x$PERL" != "x"; then
20263d13e800Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
20273d13e800Smrg   fi
20283d13e800Smrg   have_perl=no
20293d13e800Smrgelse
20303d13e800Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2031de7ed6e8Smrgfi
2032de7ed6e8Smrg
20333d13e800SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20343d13e800Smrg]) # XORG_WITH_PERL
203501395c31Smrg
20363d13e800Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
203701395c31Smrg# ----------------
20383d13e800Smrg# Minimum version: 1.5.0
20393d13e800Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2040de7ed6e8Smrg#
20413d13e800Smrg# Documentation tools are not always available on all platforms and sometimes
20423d13e800Smrg# not at the appropriate level. This macro enables a module to test for the
20433d13e800Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
204422138c50Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
20453d13e800Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20463d13e800Smrg# --with-asciidoc assumes 'auto'.
2047de7ed6e8Smrg#
20483d13e800Smrg# Interface to module:
20493d13e800Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20503d13e800Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
20513d13e800Smrg#		 returns the path set by the user in the environment
20523d13e800Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20533d13e800Smrg#		  'no' user instructs the module not to use asciidoc
2054de7ed6e8Smrg#
20553d13e800Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2056de7ed6e8Smrg#
20573d13e800SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20583d13e800SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20593d13e800Smrgm4_define([_defopt], m4_default([$2], [auto]))
20603d13e800SmrgAC_ARG_WITH(asciidoc,
20613d13e800Smrg	AS_HELP_STRING([--with-asciidoc],
20623d13e800Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20633d13e800Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20643d13e800Smrgm4_undefine([_defopt])
206501395c31Smrg
20663d13e800Smrgif test "x$use_asciidoc" = x"auto"; then
20673d13e800Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20683d13e800Smrg   if test "x$ASCIIDOC" = "x"; then
20693d13e800Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20703d13e800Smrg	have_asciidoc=no
20713d13e800Smrg   else
20723d13e800Smrg        have_asciidoc=yes
20733d13e800Smrg   fi
20743d13e800Smrgelif test "x$use_asciidoc" = x"yes" ; then
20753d13e800Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20763d13e800Smrg   if test "x$ASCIIDOC" = "x"; then
20773d13e800Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20783d13e800Smrg   fi
20793d13e800Smrg   have_asciidoc=yes
20803d13e800Smrgelif test "x$use_asciidoc" = x"no" ; then
20813d13e800Smrg   if test "x$ASCIIDOC" != "x"; then
20823d13e800Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20833d13e800Smrg   fi
20843d13e800Smrg   have_asciidoc=no
20853d13e800Smrgelse
20863d13e800Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20873d13e800Smrgfi
20883d13e800Smrgm4_ifval([$1],
20893d13e800Smrg[if test "$have_asciidoc" = yes; then
20903d13e800Smrg    # scrape the asciidoc version
20913d13e800Smrg    AC_MSG_CHECKING([the asciidoc version])
20923d13e800Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20933d13e800Smrg    AC_MSG_RESULT([$asciidoc_version])
20943d13e800Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20953d13e800Smrg        [if test "x$use_asciidoc" = xauto; then
20963d13e800Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20973d13e800Smrg            have_asciidoc=no
20983d13e800Smrg        else
20993d13e800Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
21003d13e800Smrg        fi])
21013d13e800Smrgfi])
21023d13e800SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
21033d13e800Smrg]) # XORG_WITH_ASCIIDOC
210401395c31Smrg
21053d13e800Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
21063d13e800Smrg# -------------------------------------------
21073d13e800Smrg# Minimum version: 1.5.0
21083d13e800Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21093d13e800Smrg# Minimum version for optional DOT checking: 1.18.0
211001395c31Smrg#
21113d13e800Smrg# Documentation tools are not always available on all platforms and sometimes
21123d13e800Smrg# not at the appropriate level. This macro enables a module to test for the
21133d13e800Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
211422138c50Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
21153d13e800Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
21163d13e800Smrg# --with-doxygen assumes 'auto'.
211701395c31Smrg#
21183d13e800Smrg# Interface to module:
21193d13e800Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
21203d13e800Smrg# DOXYGEN:	 returns the path of the doxygen program found
21213d13e800Smrg#		 returns the path set by the user in the environment
21223d13e800Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
21233d13e800Smrg#		  'no' user instructs the module not to use doxygen
212401395c31Smrg#
21253d13e800Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2126de7ed6e8Smrg#
21273d13e800SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
21283d13e800SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
21293d13e800SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
21303d13e800Smrgm4_define([_defopt], m4_default([$2], [auto]))
21313d13e800SmrgAC_ARG_WITH(doxygen,
21323d13e800Smrg	AS_HELP_STRING([--with-doxygen],
21333d13e800Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21343d13e800Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21353d13e800Smrgm4_undefine([_defopt])
213601395c31Smrg
21373d13e800Smrgif test "x$use_doxygen" = x"auto"; then
21383d13e800Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21393d13e800Smrg   if test "x$DOXYGEN" = "x"; then
21403d13e800Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21413d13e800Smrg	have_doxygen=no
21423d13e800Smrg   else
21433d13e800Smrg        have_doxygen=yes
21443d13e800Smrg   fi
21453d13e800Smrgelif test "x$use_doxygen" = x"yes" ; then
21463d13e800Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21473d13e800Smrg   if test "x$DOXYGEN" = "x"; then
21483d13e800Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21493d13e800Smrg   fi
21503d13e800Smrg   have_doxygen=yes
21513d13e800Smrgelif test "x$use_doxygen" = x"no" ; then
21523d13e800Smrg   if test "x$DOXYGEN" != "x"; then
21533d13e800Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21543d13e800Smrg   fi
21553d13e800Smrg   have_doxygen=no
215601395c31Smrgelse
21573d13e800Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
215801395c31Smrgfi
21593d13e800Smrgm4_ifval([$1],
21603d13e800Smrg[if test "$have_doxygen" = yes; then
21613d13e800Smrg    # scrape the doxygen version
21623d13e800Smrg    AC_MSG_CHECKING([the doxygen version])
21633d13e800Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21643d13e800Smrg    AC_MSG_RESULT([$doxygen_version])
21653d13e800Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21663d13e800Smrg        [if test "x$use_doxygen" = xauto; then
21673d13e800Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21683d13e800Smrg            have_doxygen=no
21693d13e800Smrg        else
21703d13e800Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21713d13e800Smrg        fi])
21723d13e800Smrgfi])
217301395c31Smrg
21743d13e800Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21753d13e800Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21763d13e800Smrgdnl 	HAVE_DOT = @HAVE_DOT@
21773d13e800SmrgHAVE_DOT=no
21783d13e800Smrgif test "x$have_doxygen" = "xyes"; then
21793d13e800Smrg  AC_PATH_PROG([DOT], [dot])
21803d13e800Smrg    if test "x$DOT" != "x"; then
21813d13e800Smrg      HAVE_DOT=yes
21823d13e800Smrg    fi
21833d13e800Smrgfi
218401395c31Smrg
21853d13e800SmrgAC_SUBST([HAVE_DOT])
21863d13e800SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21873d13e800SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21883d13e800Smrg]) # XORG_WITH_DOXYGEN
218901395c31Smrg
21903d13e800Smrg# XORG_WITH_GROFF([DEFAULT])
21913d13e800Smrg# ----------------
21923d13e800Smrg# Minimum version: 1.6.0
21933d13e800Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2194de7ed6e8Smrg#
21953d13e800Smrg# Documentation tools are not always available on all platforms and sometimes
21963d13e800Smrg# not at the appropriate level. This macro enables a module to test for the
21973d13e800Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
219822138c50Smrg# the --with-groff option, it allows maximum flexibility in making decisions
21993d13e800Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
22003d13e800Smrg# --with-groff assumes 'auto'.
22013d13e800Smrg#
22023d13e800Smrg# Interface to module:
22033d13e800Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
22043d13e800Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
22053d13e800Smrg# HAVE_GROFF_MS: the -ms macros package
22063d13e800Smrg# GROFF:	 returns the path of the groff program found
22073d13e800Smrg#		 returns the path set by the user in the environment
22083d13e800Smrg# --with-groff:	 'yes' user instructs the module to use groff
22093d13e800Smrg#		 'no' user instructs the module not to use groff
22103d13e800Smrg#
22113d13e800Smrg# Added in version 1.9.0:
22123d13e800Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
22133d13e800Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
22143d13e800Smrg#		   psselect from the psutils package.
22153d13e800Smrg#		   the ghostcript package. Refer to the grohtml man pages
22163d13e800Smrg#
22173d13e800Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
22183d13e800Smrg#
22193d13e800Smrg# OS and distros often splits groff in a basic and full package, the former
22203d13e800Smrg# having the groff program and the later having devices, fonts and macros
22213d13e800Smrg# Checking for the groff executable is not enough.
22223d13e800Smrg#
22233d13e800Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
22243d13e800Smrg# unset HAVE_GROFF or GROFF env variables.
22253d13e800Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
22263d13e800Smrg#
22273d13e800SmrgAC_DEFUN([XORG_WITH_GROFF],[
22283d13e800SmrgAC_ARG_VAR([GROFF], [Path to groff command])
22293d13e800Smrgm4_define([_defopt], m4_default([$1], [auto]))
22303d13e800SmrgAC_ARG_WITH(groff,
22313d13e800Smrg	AS_HELP_STRING([--with-groff],
22323d13e800Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
22333d13e800Smrg	   [use_groff=$withval], [use_groff=]_defopt)
22343d13e800Smrgm4_undefine([_defopt])
22358255a313Smrg
22363d13e800Smrgif test "x$use_groff" = x"auto"; then
22373d13e800Smrg   AC_PATH_PROG([GROFF], [groff])
22383d13e800Smrg   if test "x$GROFF" = "x"; then
22393d13e800Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22403d13e800Smrg	have_groff=no
22413d13e800Smrg   else
22423d13e800Smrg        have_groff=yes
22433d13e800Smrg   fi
22443d13e800Smrgelif test "x$use_groff" = x"yes" ; then
22453d13e800Smrg   AC_PATH_PROG([GROFF], [groff])
22463d13e800Smrg   if test "x$GROFF" = "x"; then
22473d13e800Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22483d13e800Smrg   fi
22493d13e800Smrg   have_groff=yes
22503d13e800Smrgelif test "x$use_groff" = x"no" ; then
22513d13e800Smrg   if test "x$GROFF" != "x"; then
22523d13e800Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22533d13e800Smrg   fi
22543d13e800Smrg   have_groff=no
225501395c31Smrgelse
22563d13e800Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22578255a313Smrgfi
22588255a313Smrg
22593d13e800Smrg# We have groff, test for the presence of the macro packages
22603d13e800Smrgif test "x$have_groff" = x"yes"; then
22613d13e800Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22623d13e800Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22633d13e800Smrg        groff_ms_works=yes
22643d13e800Smrg    else
22653d13e800Smrg        groff_ms_works=no
22663d13e800Smrg    fi
22673d13e800Smrg    AC_MSG_RESULT([$groff_ms_works])
22683d13e800Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22693d13e800Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22703d13e800Smrg        groff_mm_works=yes
22713d13e800Smrg    else
22723d13e800Smrg        groff_mm_works=no
22733d13e800Smrg    fi
22743d13e800Smrg    AC_MSG_RESULT([$groff_mm_works])
22753d13e800Smrgfi
227601395c31Smrg
22773d13e800Smrg# We have groff, test for HTML dependencies, one command per package
22783d13e800Smrgif test "x$have_groff" = x"yes"; then
22793d13e800Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22803d13e800Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22813d13e800Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22823d13e800Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22833d13e800Smrg      have_groff_html=yes
22843d13e800Smrg   else
22853d13e800Smrg      have_groff_html=no
22863d13e800Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22873d13e800Smrg   fi
22883d13e800Smrgfi
228901395c31Smrg
22903d13e800Smrg# Set Automake conditionals for Makefiles
22913d13e800SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22923d13e800SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22933d13e800SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22943d13e800SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22953d13e800Smrg]) # XORG_WITH_GROFF
229601395c31Smrg
22973d13e800Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22983d13e800Smrg# ---------------------------------------
22993d13e800Smrg# Minimum version: 1.6.0
23003d13e800Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23013d13e800Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
23023d13e800Smrg#
23033d13e800Smrg# Documentation tools are not always available on all platforms and sometimes
23043d13e800Smrg# not at the appropriate level. This macro enables a module to test for the
23053d13e800Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
230622138c50Smrg# the --with-fop option, it allows maximum flexibility in making decisions
23073d13e800Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
23083d13e800Smrg# --with-fop assumes 'auto'.
23093d13e800Smrg#
23103d13e800Smrg# Interface to module:
23113d13e800Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
23123d13e800Smrg# FOP:	 	returns the path of the fop program found
23133d13e800Smrg#		returns the path set by the user in the environment
23143d13e800Smrg# --with-fop: 	'yes' user instructs the module to use fop
23153d13e800Smrg#		'no' user instructs the module not to use fop
23163d13e800Smrg#
23173d13e800Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
23183d13e800Smrg#
23193d13e800SmrgAC_DEFUN([XORG_WITH_FOP],[
23203d13e800SmrgAC_ARG_VAR([FOP], [Path to fop command])
23213d13e800Smrgm4_define([_defopt], m4_default([$2], [auto]))
23223d13e800SmrgAC_ARG_WITH(fop,
23233d13e800Smrg	AS_HELP_STRING([--with-fop],
23243d13e800Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
23253d13e800Smrg	   [use_fop=$withval], [use_fop=]_defopt)
23263d13e800Smrgm4_undefine([_defopt])
23273d13e800Smrg
23283d13e800Smrgif test "x$use_fop" = x"auto"; then
23293d13e800Smrg   AC_PATH_PROG([FOP], [fop])
23303d13e800Smrg   if test "x$FOP" = "x"; then
23313d13e800Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
23323d13e800Smrg	have_fop=no
23333d13e800Smrg   else
23343d13e800Smrg        have_fop=yes
23353d13e800Smrg   fi
23363d13e800Smrgelif test "x$use_fop" = x"yes" ; then
23373d13e800Smrg   AC_PATH_PROG([FOP], [fop])
23383d13e800Smrg   if test "x$FOP" = "x"; then
23393d13e800Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23403d13e800Smrg   fi
23413d13e800Smrg   have_fop=yes
23423d13e800Smrgelif test "x$use_fop" = x"no" ; then
23433d13e800Smrg   if test "x$FOP" != "x"; then
23443d13e800Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23453d13e800Smrg   fi
23463d13e800Smrg   have_fop=no
23473d13e800Smrgelse
23483d13e800Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
23498255a313Smrgfi
23508255a313Smrg
23513d13e800Smrg# Test for a minimum version of fop, if provided.
23523d13e800Smrgm4_ifval([$1],
23533d13e800Smrg[if test "$have_fop" = yes; then
23543d13e800Smrg    # scrape the fop version
23553d13e800Smrg    AC_MSG_CHECKING([for fop minimum version])
23563d13e800Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23573d13e800Smrg    AC_MSG_RESULT([$fop_version])
23583d13e800Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
23593d13e800Smrg        [if test "x$use_fop" = xauto; then
23603d13e800Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23613d13e800Smrg            have_fop=no
23623d13e800Smrg        else
23633d13e800Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23643d13e800Smrg        fi])
23653d13e800Smrgfi])
23663d13e800SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23673d13e800Smrg]) # XORG_WITH_FOP
23688255a313Smrg
23693d13e800Smrg# XORG_WITH_M4([MIN-VERSION])
23703d13e800Smrg# ---------------------------
23713d13e800Smrg# Minimum version: 1.19.0
2372de7ed6e8Smrg#
23733d13e800Smrg# This macro attempts to locate an m4 macro processor which supports
23743d13e800Smrg# -I option and is only useful for modules relying on M4 in order to
23753d13e800Smrg# expand macros in source code files.
23763d13e800Smrg#
23773d13e800Smrg# Interface to module:
23783d13e800Smrg# M4:	 	returns the path of the m4 program found
23793d13e800Smrg#		returns the path set by the user in the environment
23803d13e800Smrg#
23813d13e800SmrgAC_DEFUN([XORG_WITH_M4], [
23823d13e800SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23833d13e800Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23843d13e800Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23853d13e800Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23863d13e800Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23873d13e800Smrg   [$PATH:/usr/gnu/bin])])
238801395c31Smrg
23893d13e800SmrgAC_SUBST([M4], [$ac_cv_path_M4])
23903d13e800Smrg]) # XORG_WITH_M4
23913d13e800Smrg
23923d13e800Smrg# XORG_WITH_PS2PDF([DEFAULT])
23933d13e800Smrg# ----------------
23943d13e800Smrg# Minimum version: 1.6.0
23953d13e800Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23963d13e800Smrg#
23973d13e800Smrg# Documentation tools are not always available on all platforms and sometimes
23983d13e800Smrg# not at the appropriate level. This macro enables a module to test for the
23993d13e800Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
240022138c50Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
24013d13e800Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
24023d13e800Smrg# --with-ps2pdf assumes 'auto'.
24033d13e800Smrg#
24043d13e800Smrg# Interface to module:
24053d13e800Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
24063d13e800Smrg# PS2PDF:	returns the path of the ps2pdf program found
24073d13e800Smrg#		returns the path set by the user in the environment
24083d13e800Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
24093d13e800Smrg#		 'no' user instructs the module not to use ps2pdf
24103d13e800Smrg#
24113d13e800Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
24123d13e800Smrg#
24133d13e800SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
24143d13e800SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
24153d13e800Smrgm4_define([_defopt], m4_default([$1], [auto]))
24163d13e800SmrgAC_ARG_WITH(ps2pdf,
24173d13e800Smrg	AS_HELP_STRING([--with-ps2pdf],
24183d13e800Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
24193d13e800Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
24203d13e800Smrgm4_undefine([_defopt])
242101395c31Smrg
24223d13e800Smrgif test "x$use_ps2pdf" = x"auto"; then
24233d13e800Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
24243d13e800Smrg   if test "x$PS2PDF" = "x"; then
24253d13e800Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
24263d13e800Smrg	have_ps2pdf=no
24273d13e800Smrg   else
24283d13e800Smrg        have_ps2pdf=yes
24293d13e800Smrg   fi
24303d13e800Smrgelif test "x$use_ps2pdf" = x"yes" ; then
24313d13e800Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
24323d13e800Smrg   if test "x$PS2PDF" = "x"; then
24333d13e800Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24343d13e800Smrg   fi
24353d13e800Smrg   have_ps2pdf=yes
24363d13e800Smrgelif test "x$use_ps2pdf" = x"no" ; then
24373d13e800Smrg   if test "x$PS2PDF" != "x"; then
24383d13e800Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24393d13e800Smrg   fi
24403d13e800Smrg   have_ps2pdf=no
24413d13e800Smrgelse
24423d13e800Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
24433d13e800Smrgfi
24443d13e800SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24453d13e800Smrg]) # XORG_WITH_PS2PDF
244601395c31Smrg
24473d13e800Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
24483d13e800Smrg# ----------------
24493d13e800Smrg# Minimum version: 1.6.0
2450de7ed6e8Smrg#
24513d13e800Smrg# Documentation tools are not always available on all platforms and sometimes
24523d13e800Smrg# not at the appropriate level. This macro enables a builder to skip all
24533d13e800Smrg# documentation targets except traditional man pages.
24543d13e800Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245522138c50Smrg# maximum flexibility in controlling documentation building.
24563d13e800Smrg# Refer to:
24573d13e800Smrg# XORG_WITH_XMLTO         --with-xmlto
24583d13e800Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24593d13e800Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24603d13e800Smrg# XORG_WITH_FOP           --with-fop
24613d13e800Smrg# XORG_WITH_GROFF         --with-groff
24623d13e800Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24633d13e800Smrg#
24643d13e800Smrg# Interface to module:
24653d13e800Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24663d13e800Smrg# --enable-docs: 'yes' user instructs the module to generate docs
24673d13e800Smrg#		 'no' user instructs the module not to generate docs
24683d13e800Smrg# parm1:	specify the default value, yes or no.
24693d13e800Smrg#
24703d13e800SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24713d13e800Smrgm4_define([docs_default], m4_default([$1], [yes]))
24723d13e800SmrgAC_ARG_ENABLE(docs,
24733d13e800Smrg	AS_HELP_STRING([--enable-docs],
24743d13e800Smrg	   [Enable building the documentation (default: ]docs_default[)]),
24753d13e800Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
24763d13e800Smrgm4_undefine([docs_default])
24773d13e800SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24783d13e800SmrgAC_MSG_CHECKING([whether to build documentation])
24793d13e800SmrgAC_MSG_RESULT([$build_docs])
24803d13e800Smrg]) # XORG_ENABLE_DOCS
248101395c31Smrg
24823d13e800Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24833d13e800Smrg# ----------------
24843d13e800Smrg# Minimum version: 1.6.0
24853d13e800Smrg#
24863d13e800Smrg# This macro enables a builder to skip all developer documentation.
24873d13e800Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248822138c50Smrg# maximum flexibility in controlling documentation building.
24893d13e800Smrg# Refer to:
24903d13e800Smrg# XORG_WITH_XMLTO         --with-xmlto
24913d13e800Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24923d13e800Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24933d13e800Smrg# XORG_WITH_FOP           --with-fop
24943d13e800Smrg# XORG_WITH_GROFF         --with-groff
24953d13e800Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24963d13e800Smrg#
24973d13e800Smrg# Interface to module:
24983d13e800Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24993d13e800Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
25003d13e800Smrg#			'no' user instructs the module not to generate developer docs
25013d13e800Smrg# parm1:		specify the default value, yes or no.
25023d13e800Smrg#
25033d13e800SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
25043d13e800Smrgm4_define([devel_default], m4_default([$1], [yes]))
25053d13e800SmrgAC_ARG_ENABLE(devel-docs,
25063d13e800Smrg	AS_HELP_STRING([--enable-devel-docs],
25073d13e800Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
25083d13e800Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
25093d13e800Smrgm4_undefine([devel_default])
25103d13e800SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
25113d13e800SmrgAC_MSG_CHECKING([whether to build developer documentation])
25123d13e800SmrgAC_MSG_RESULT([$build_devel_docs])
25133d13e800Smrg]) # XORG_ENABLE_DEVEL_DOCS
251401395c31Smrg
25153d13e800Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
25163d13e800Smrg# ----------------
25173d13e800Smrg# Minimum version: 1.6.0
25188255a313Smrg#
25193d13e800Smrg# This macro enables a builder to skip all functional specification targets.
25203d13e800Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
252122138c50Smrg# maximum flexibility in controlling documentation building.
25223d13e800Smrg# Refer to:
25233d13e800Smrg# XORG_WITH_XMLTO         --with-xmlto
25243d13e800Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
25253d13e800Smrg# XORG_WITH_DOXYGEN       --with-doxygen
25263d13e800Smrg# XORG_WITH_FOP           --with-fop
25273d13e800Smrg# XORG_WITH_GROFF         --with-groff
25283d13e800Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
25293d13e800Smrg#
25303d13e800Smrg# Interface to module:
25313d13e800Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
25323d13e800Smrg# --enable-specs:	'yes' user instructs the module to generate specs
25333d13e800Smrg#			'no' user instructs the module not to generate specs
25343d13e800Smrg# parm1:		specify the default value, yes or no.
25353d13e800Smrg#
25363d13e800SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25373d13e800Smrgm4_define([spec_default], m4_default([$1], [yes]))
25383d13e800SmrgAC_ARG_ENABLE(specs,
25393d13e800Smrg	AS_HELP_STRING([--enable-specs],
25403d13e800Smrg	   [Enable building the specs (default: ]spec_default[)]),
25413d13e800Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
25423d13e800Smrgm4_undefine([spec_default])
25433d13e800SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25443d13e800SmrgAC_MSG_CHECKING([whether to build functional specifications])
25453d13e800SmrgAC_MSG_RESULT([$build_specs])
25463d13e800Smrg]) # XORG_ENABLE_SPECS
25478255a313Smrg
25483d13e800Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25493d13e800Smrg# ----------------------------------------------
25503d13e800Smrg# Minimum version: 1.13.0
25513d13e800Smrg#
25523d13e800Smrg# This macro enables a builder to enable/disable unit testing
25533d13e800Smrg# It makes no assumption about the test cases implementation
25543d13e800Smrg# Test cases may or may not use Automake "Support for test suites"
25553d13e800Smrg# They may or may not use the software utility library GLib
25563d13e800Smrg#
25573d13e800Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25583d13e800Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25593d13e800Smrg# The variable enable_unit_tests is used by other macros in this file.
25603d13e800Smrg#
25613d13e800Smrg# Interface to module:
25623d13e800Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25633d13e800Smrg# enable_unit_tests:    used in configure.ac for additional configuration
25643d13e800Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25653d13e800Smrg#			'no' user instructs the module not to build tests
25663d13e800Smrg# parm1:		specify the default value, yes or no.
25673d13e800Smrg#
25683d13e800SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25693d13e800SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25703d13e800SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25713d13e800SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25723d13e800Smrgm4_define([_defopt], m4_default([$1], [auto]))
25733d13e800SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25743d13e800Smrg	[Enable building unit test cases (default: ]_defopt[)]),
25753d13e800Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25763d13e800Smrgm4_undefine([_defopt])
25773d13e800SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25783d13e800SmrgAC_MSG_CHECKING([whether to build unit test cases])
25793d13e800SmrgAC_MSG_RESULT([$enable_unit_tests])
25803d13e800Smrg]) # XORG_ENABLE_UNIT_TESTS
2581de7ed6e8Smrg
25823d13e800Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25833d13e800Smrg# ------------------------------------------------------
25843d13e800Smrg# Minimum version: 1.17.0
25853d13e800Smrg#
25863d13e800Smrg# This macro enables a builder to enable/disable integration testing
25873d13e800Smrg# It makes no assumption about the test cases' implementation
25883d13e800Smrg# Test cases may or may not use Automake "Support for test suites"
25893d13e800Smrg#
25903d13e800Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25913d13e800Smrg# usually requires less dependencies and may be built and run under less
25923d13e800Smrg# stringent environments than integration tests.
25933d13e800Smrg#
25943d13e800Smrg# Interface to module:
25953d13e800Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25963d13e800Smrg# enable_integration_tests:   used in configure.ac for additional configuration
25973d13e800Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25983d13e800Smrg#                             'no' user instructs the module not to build tests
25993d13e800Smrg# parm1:                      specify the default value, yes or no.
26003d13e800Smrg#
26013d13e800SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
26023d13e800SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
26033d13e800Smrgm4_define([_defopt], m4_default([$1], [auto]))
26043d13e800SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
26053d13e800Smrg	[Enable building integration test cases (default: ]_defopt[)]),
26063d13e800Smrg	[enable_integration_tests=$enableval],
26073d13e800Smrg	[enable_integration_tests=]_defopt)
26083d13e800Smrgm4_undefine([_defopt])
26093d13e800SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
26103d13e800Smrg	[test "x$enable_integration_tests" != xno])
26113d13e800SmrgAC_MSG_CHECKING([whether to build unit test cases])
26123d13e800SmrgAC_MSG_RESULT([$enable_integration_tests])
26133d13e800Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2614de7ed6e8Smrg
26153d13e800Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
26163d13e800Smrg# ----------------------------------------
26173d13e800Smrg# Minimum version: 1.13.0
26183d13e800Smrg#
26193d13e800Smrg# GLib is a library which provides advanced data structures and functions.
26203d13e800Smrg# This macro enables a module to test for the presence of Glib.
26213d13e800Smrg#
26223d13e800Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
26233d13e800Smrg# Otherwise the value of $enable_unit_tests is blank.
26243d13e800Smrg#
26253d13e800Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
26263d13e800Smrg# test support usually requires less dependencies and may be built and run under
26273d13e800Smrg# less stringent environments than integration tests.
26283d13e800Smrg#
26293d13e800Smrg# Interface to module:
26303d13e800Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
26313d13e800Smrg# with_glib: used in configure.ac to know if GLib has been found
26323d13e800Smrg# --with-glib:	'yes' user instructs the module to use glib
26333d13e800Smrg#		'no' user instructs the module not to use glib
26343d13e800Smrg#
26353d13e800SmrgAC_DEFUN([XORG_WITH_GLIB],[
26363d13e800SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26373d13e800Smrgm4_define([_defopt], m4_default([$2], [auto]))
26383d13e800SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26393d13e800Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26403d13e800Smrg	[with_glib=$withval], [with_glib=]_defopt)
26413d13e800Smrgm4_undefine([_defopt])
26423d13e800Smrg
26433d13e800Smrghave_glib=no
26443d13e800Smrg# Do not probe GLib if user explicitly disabled unit testing
26453d13e800Smrgif test "x$enable_unit_tests" != x"no"; then
26463d13e800Smrg  # Do not probe GLib if user explicitly disabled it
26473d13e800Smrg  if test "x$with_glib" != x"no"; then
26483d13e800Smrg    m4_ifval(
26493d13e800Smrg      [$1],
26503d13e800Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26513d13e800Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26523d13e800Smrg    )
265301395c31Smrg  fi
26548255a313Smrgfi
2655de7ed6e8Smrg
26563d13e800Smrg# Not having GLib when unit testing has been explicitly requested is an error
26573d13e800Smrgif test "x$enable_unit_tests" = x"yes"; then
26583d13e800Smrg  if test "x$have_glib" = x"no"; then
26593d13e800Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
266001395c31Smrg  fi
26618255a313Smrgfi
266201395c31Smrg
26633d13e800Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
26643d13e800Smrgif test "x$enable_unit_tests" = x"no"; then
26653d13e800Smrg  if test "x$with_glib" = x"yes"; then
26663d13e800Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26673d13e800Smrg  fi
26683d13e800Smrgfi
266901395c31Smrg
26703d13e800Smrg# Not having GLib when it has been explicitly requested is an error
26713d13e800Smrgif test "x$with_glib" = x"yes"; then
26723d13e800Smrg  if test "x$have_glib" = x"no"; then
26733d13e800Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26743d13e800Smrg  fi
26753d13e800Smrgfi
26768255a313Smrg
26773d13e800SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26783d13e800Smrg]) # XORG_WITH_GLIB
267901395c31Smrg
26803d13e800Smrg# XORG_LD_WRAP([required|optional])
26813d13e800Smrg# ---------------------------------
26823d13e800Smrg# Minimum version: 1.13.0
26833d13e800Smrg#
26843d13e800Smrg# Check if linker supports -wrap, passed via compiler flags
26853d13e800Smrg#
26863d13e800Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26873d13e800Smrg# Otherwise the value of $enable_unit_tests is blank.
26883d13e800Smrg#
26893d13e800Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26903d13e800Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26913d13e800Smrg# available, an argument of "optional" allows use when some unit tests require
26923d13e800Smrg# ld -wrap and others do not.
26933d13e800Smrg#
26943d13e800SmrgAC_DEFUN([XORG_LD_WRAP],[
26953d13e800SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26963d13e800Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26973d13e800Smrg                      void __wrap_exit(int status) { return; }],
26983d13e800Smrg                     [exit(0);])])
26993d13e800Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
27003d13e800Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
27013d13e800Smrg  if test "x$have_ld_wrap" = x"no"; then
27023d13e800Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
27033d13e800Smrg  fi
27043d13e800Smrgfi
27053d13e800SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
27063d13e800Smrg#
27073d13e800Smrg]) # XORG_LD_WRAP
270801395c31Smrg
27093d13e800Smrg# XORG_CHECK_LINKER_FLAGS
27103d13e800Smrg# -----------------------
27113d13e800Smrg# SYNOPSIS
27123d13e800Smrg#
27133d13e800Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
27143d13e800Smrg#
27153d13e800Smrg# DESCRIPTION
27163d13e800Smrg#
27173d13e800Smrg#   Check whether the given linker FLAGS work with the current language's
27183d13e800Smrg#   linker, or whether they give an error.
27193d13e800Smrg#
27203d13e800Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
27213d13e800Smrg#   success/failure.
27223d13e800Smrg#
27233d13e800Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
27243d13e800Smrg#
27253d13e800Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
27263d13e800Smrg#
27273d13e800Smrg# LICENSE
27283d13e800Smrg#
27293d13e800Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
27303d13e800Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
27313d13e800Smrg#   Copyright (c) 2009 Matteo Frigo
27323d13e800Smrg#
27333d13e800Smrg#   This program is free software: you can redistribute it and/or modify it
27343d13e800Smrg#   under the terms of the GNU General Public License as published by the
27353d13e800Smrg#   Free Software Foundation, either version 3 of the License, or (at your
27363d13e800Smrg#   option) any later version.
27373d13e800Smrg#
27383d13e800Smrg#   This program is distributed in the hope that it will be useful, but
27393d13e800Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27403d13e800Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27413d13e800Smrg#   Public License for more details.
27423d13e800Smrg#
27433d13e800Smrg#   You should have received a copy of the GNU General Public License along
27443d13e800Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27453d13e800Smrg#
27463d13e800Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
27473d13e800Smrg#   gives unlimited permission to copy, distribute and modify the configure
27483d13e800Smrg#   scripts that are the output of Autoconf when processing the Macro. You
27493d13e800Smrg#   need not follow the terms of the GNU General Public License when using
27503d13e800Smrg#   or distributing such scripts, even though portions of the text of the
27513d13e800Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27523d13e800Smrg#   all other use of the material that constitutes the Autoconf Macro.
27533d13e800Smrg#
27543d13e800Smrg#   This special exception to the GPL applies to versions of the Autoconf
27553d13e800Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
27563d13e800Smrg#   modified version of the Autoconf Macro, you may extend this special
27573d13e800Smrg#   exception to the GPL to apply to your modified version as well.#
27583d13e800SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27593d13e800Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
27603d13e800Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27613d13e800SmrgAS_LITERAL_IF([$1],
27623d13e800Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27633d13e800Smrg      ax_save_FLAGS=$LDFLAGS
27643d13e800Smrg      LDFLAGS="$1"
27653d13e800Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27663d13e800Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27673d13e800Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27683d13e800Smrg      LDFLAGS=$ax_save_FLAGS])],
27693d13e800Smrg  [ax_save_FLAGS=$LDFLAGS
27703d13e800Smrg   LDFLAGS="$1"
27713d13e800Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27723d13e800Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27733d13e800Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27743d13e800Smrg   LDFLAGS=$ax_save_FLAGS])
27753d13e800Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27763d13e800SmrgAC_MSG_RESULT($xorg_check_linker_flags)
27773d13e800Smrgif test "x$xorg_check_linker_flags" = xyes; then
27783d13e800Smrg	m4_default([$2], :)
27793d13e800Smrgelse
27803d13e800Smrg	m4_default([$3], :)
27813d13e800Smrgfi
27823d13e800Smrg]) # XORG_CHECK_LINKER_FLAGS
27838255a313Smrg
27843d13e800Smrg# XORG_MEMORY_CHECK_FLAGS
27853d13e800Smrg# -----------------------
27863d13e800Smrg# Minimum version: 1.16.0
27873d13e800Smrg#
27883d13e800Smrg# This macro attempts to find appropriate memory checking functionality
27893d13e800Smrg# for various platforms which unit testing code may use to catch various
27903d13e800Smrg# forms of memory allocation and access errors in testing.
27913d13e800Smrg#
27923d13e800Smrg# Interface to module:
27933d13e800Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27943d13e800Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27953d13e800Smrg#
27963d13e800Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27973d13e800Smrg#
27983d13e800SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
27998255a313Smrg
28003d13e800SmrgAC_REQUIRE([AC_CANONICAL_HOST])
28013d13e800SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
28023d13e800Smrg           [Environment variables to enable memory checking in tests])
28038255a313Smrg
28043d13e800Smrg# Check for different types of support on different platforms
28053d13e800Smrgcase $host_os in
28063d13e800Smrg    solaris*)
28073d13e800Smrg        AC_CHECK_LIB([umem], [umem_alloc],
28083d13e800Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
28093d13e800Smrg        ;;
28103d13e800Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
28113d13e800Smrg        # both directly and inverted, so should not be 0 or 255.
28123d13e800Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
28133d13e800Smrg        ;;
28143d13e800Smrg    darwin*)
28153d13e800Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
28163d13e800Smrg        ;;
28173d13e800Smrg    *bsd*)
28183d13e800Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
28193d13e800Smrg        ;;
28203d13e800Smrgesac
2821de7ed6e8Smrg
28223d13e800Smrg# User supplied flags override default flags
28233d13e800Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
28243d13e800Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
28258255a313Smrgfi
28268255a313Smrg
28273d13e800SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
28283d13e800Smrg]) # XORG_WITH_LINT
282901395c31Smrg
28303d13e800Smrg# XORG_CHECK_MALLOC_ZERO
28313d13e800Smrg# ----------------------
28323d13e800Smrg# Minimum version: 1.0.0
28338255a313Smrg#
28343d13e800Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28353d13e800Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28363d13e800Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28373d13e800SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28383d13e800SmrgAC_ARG_ENABLE(malloc0returnsnull,
28393d13e800Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28403d13e800Smrg		       [malloc(0) returns NULL (default: auto)]),
28413d13e800Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28423d13e800Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
284301395c31Smrg
28443d13e800SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28453d13e800Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28463d13e800SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28473d13e800Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28483d13e800Smrg#include <stdlib.h>
28493d13e800Smrg],[
28503d13e800Smrg    char *m0, *r0, *c0, *p;
28513d13e800Smrg    m0 = malloc(0);
28523d13e800Smrg    p = malloc(10);
28533d13e800Smrg    r0 = realloc(p,0);
28543d13e800Smrg    c0 = calloc(0,10);
28553d13e800Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28563d13e800Smrg])],
28573d13e800Smrg		[xorg_cv_malloc0_returns_null=yes],
28583d13e800Smrg		[xorg_cv_malloc0_returns_null=no])])
28593d13e800SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28608255a313Smrgfi
28613d13e800SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
28628255a313Smrg
28633d13e800Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28643d13e800Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28653d13e800Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28663d13e800Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
286701395c31Smrgelse
28683d13e800Smrg	MALLOC_ZERO_CFLAGS=""
28693d13e800Smrg	XMALLOC_ZERO_CFLAGS=""
28703d13e800Smrg	XTMALLOC_ZERO_CFLAGS=""
28718255a313Smrgfi
28728255a313Smrg
28733d13e800SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28743d13e800SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28753d13e800SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28763d13e800Smrg]) # XORG_CHECK_MALLOC_ZERO
2877de7ed6e8Smrg
28783d13e800Smrg# XORG_WITH_LINT()
28793d13e800Smrg# ----------------
28803d13e800Smrg# Minimum version: 1.1.0
2881de7ed6e8Smrg#
28823d13e800Smrg# This macro enables the use of a tool that flags some suspicious and
28833d13e800Smrg# non-portable constructs (likely to be bugs) in C language source code.
28843d13e800Smrg# It will attempt to locate the tool and use appropriate options.
28853d13e800Smrg# There are various lint type tools on different platforms.
28868255a313Smrg#
28873d13e800Smrg# Interface to module:
28883d13e800Smrg# LINT:		returns the path to the tool found on the platform
28893d13e800Smrg#		or the value set to LINT on the configure cmd line
28903d13e800Smrg#		also an Automake conditional
28913d13e800Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
28923d13e800Smrg#
28933d13e800Smrg# --with-lint:	'yes' user instructs the module to use lint
28943d13e800Smrg#		'no' user instructs the module not to use lint (default)
28953d13e800Smrg#
28963d13e800Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28973d13e800Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28983d13e800Smrg#
28993d13e800SmrgAC_DEFUN([XORG_WITH_LINT],[
290001395c31Smrg
29013d13e800SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
29023d13e800SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
29033d13e800SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
29043d13e800Smrg		[Use a lint-style source code checker (default: disabled)])],
29053d13e800Smrg		[use_lint=$withval], [use_lint=no])
290601395c31Smrg
29073d13e800Smrg# Obtain platform specific info like program name and options
29083d13e800Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
29093d13e800Smrgcase $host_os in
29103d13e800Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
29113d13e800Smrg	lint_name=splint
29123d13e800Smrg	lint_options="-badflag"
29133d13e800Smrg	;;
29143d13e800Smrg  *freebsd* | *netbsd*)
29153d13e800Smrg	lint_name=lint
29163d13e800Smrg	lint_options="-u -b"
29173d13e800Smrg	;;
29183d13e800Smrg  *solaris*)
29193d13e800Smrg	lint_name=lint
29203d13e800Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
29213d13e800Smrg	;;
29223d13e800Smrgesac
29233d13e800Smrg
29243d13e800Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
29253d13e800Smrgif test "x$use_lint" = x"yes" ; then
29263d13e800Smrg   AC_PATH_PROG([LINT], [$lint_name])
29273d13e800Smrg   if test "x$LINT" = "x"; then
29283d13e800Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
29293d13e800Smrg   fi
29303d13e800Smrgelif test "x$use_lint" = x"no" ; then
29313d13e800Smrg   if test "x$LINT" != "x"; then
29323d13e800Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
29333d13e800Smrg   fi
293401395c31Smrgelse
29353d13e800Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
293601395c31Smrgfi
293701395c31Smrg
29383d13e800Smrg# User supplied flags override default flags
29393d13e800Smrgif test "x$LINT_FLAGS" != "x"; then
29403d13e800Smrg   lint_options=$LINT_FLAGS
29413d13e800Smrgfi
294201395c31Smrg
29433d13e800SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29443d13e800SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
294501395c31Smrg
29463d13e800Smrg]) # XORG_WITH_LINT
294701395c31Smrg
29483d13e800Smrg# XORG_LINT_LIBRARY(LIBNAME)
29493d13e800Smrg# --------------------------
29503d13e800Smrg# Minimum version: 1.1.0
29518255a313Smrg#
29523d13e800Smrg# Sets up flags for building lint libraries for checking programs that call
29533d13e800Smrg# functions in the library.
29543d13e800Smrg#
29553d13e800Smrg# Interface to module:
29563d13e800Smrg# LINTLIB		- Automake variable with the name of lint library file to make
29573d13e800Smrg# MAKE_LINT_LIB		- Automake conditional
29583d13e800Smrg#
29593d13e800Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29603d13e800Smrg#			  - 'no' user instructs the module not to create a lint library (default)
29618255a313Smrg
29623d13e800SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29633d13e800SmrgAC_REQUIRE([XORG_WITH_LINT])
29643d13e800SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29653d13e800Smrg	[Create lint library (default: disabled)])],
29663d13e800Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
29673d13e800Smrg
29683d13e800Smrgif test "x$make_lint_lib" = x"yes" ; then
29693d13e800Smrg   LINTLIB=llib-l$1.ln
29703d13e800Smrg   if test "x$LINT" = "x"; then
29713d13e800Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29723d13e800Smrg   fi
29733d13e800Smrgelif test "x$make_lint_lib" != x"no" ; then
29743d13e800Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29758255a313Smrgfi
29768255a313Smrg
29773d13e800SmrgAC_SUBST(LINTLIB)
29783d13e800SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
297901395c31Smrg
29803d13e800Smrg]) # XORG_LINT_LIBRARY
29818255a313Smrg
29823d13e800Smrg# XORG_COMPILER_BRAND
298301395c31Smrg# -------------------
29843d13e800Smrg# Minimum version: 1.14.0
298501395c31Smrg#
29863d13e800Smrg# Checks for various brands of compilers and sets flags as appropriate:
29873d13e800Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29883d13e800Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29893d13e800Smrg#   clang compiler - sets CLANGCC to "yes"
29903d13e800Smrg#   Intel compiler - sets INTELCC to "yes"
29913d13e800Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29923d13e800Smrg#
29933d13e800SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29943d13e800SmrgAC_LANG_CASE(
29953d13e800Smrg	[C], [
299622138c50Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
299722138c50Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
299822138c50Smrg		m4_version_prereq([2.70],
299922138c50Smrg			[AC_REQUIRE([AC_PROG_CC])],
300022138c50Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30013d13e800Smrg	],
30023d13e800Smrg	[C++], [
30033d13e800Smrg		AC_REQUIRE([AC_PROG_CXX])
30043d13e800Smrg	]
30053d13e800Smrg)
30063d13e800SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
30073d13e800SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
30083d13e800SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
30093d13e800Smrg]) # XORG_COMPILER_BRAND
30108255a313Smrg
30113d13e800Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
301201395c31Smrg# ---------------
30133d13e800Smrg# Minimum version: 1.16.0
30143d13e800Smrg#
30153d13e800Smrg# Test if the compiler works when passed the given flag as a command line argument.
301622138c50Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
30173d13e800Smrg# next flag in the list until there are no more options.
30183d13e800Smrg#
30193d13e800Smrg# Note that this does not guarantee that the compiler supports the flag as some
30203d13e800Smrg# compilers will simply ignore arguments that they do not understand, but we do
30213d13e800Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
30223d13e800Smrg# -Werror=unused-command-line-argument
30233d13e800Smrg#
30243d13e800SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
30253d13e800Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
30263d13e800Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
30278255a313Smrg
30283d13e800SmrgAC_LANG_COMPILER_REQUIRE
302901395c31Smrg
30303d13e800SmrgAC_LANG_CASE(
30313d13e800Smrg	[C], [
303222138c50Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
303322138c50Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
303422138c50Smrg		m4_version_prereq([2.70],
303522138c50Smrg			[AC_REQUIRE([AC_PROG_CC])],
303622138c50Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30373d13e800Smrg		define([PREFIX], [C])
30383d13e800Smrg		define([CACHE_PREFIX], [cc])
30393d13e800Smrg		define([COMPILER], [$CC])
30403d13e800Smrg	],
30413d13e800Smrg	[C++], [
30423d13e800Smrg		define([PREFIX], [CXX])
30433d13e800Smrg		define([CACHE_PREFIX], [cxx])
30443d13e800Smrg		define([COMPILER], [$CXX])
30453d13e800Smrg	]
30463d13e800Smrg)
30473d13e800Smrg
30483d13e800Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30493d13e800Smrg
30503d13e800Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30513d13e800Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30523d13e800Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30533d13e800Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30543d13e800Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30553d13e800Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30563d13e800Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30573d13e800Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30583d13e800Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
305901395c31Smrgfi
30603d13e800Smrg
30613d13e800Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30623d13e800Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30633d13e800Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30643d13e800Smrg	fi
30653d13e800Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30663d13e800Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30673d13e800Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30683d13e800Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30693d13e800Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30703d13e800Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30713d13e800Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30723d13e800Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
307301395c31Smrgfi
30743d13e800Smrg
30753d13e800Smrgfound="no"
30763d13e800Smrgm4_foreach([flag], m4_cdr($@), [
30773d13e800Smrg	if test $found = "no" ; then
30783d13e800Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30793d13e800Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30803d13e800Smrg		fi
30813d13e800Smrg
30823d13e800Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30833d13e800Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30843d13e800Smrg		fi
30853d13e800Smrg
30863d13e800Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30873d13e800Smrg
30883d13e800Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30893d13e800Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30903d13e800Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30913d13e800Smrg		AC_CACHE_VAL($cacheid,
30923d13e800Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30933d13e800Smrg					     [eval $cacheid=yes],
30943d13e800Smrg					     [eval $cacheid=no])])
30953d13e800Smrg
30963d13e800Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30973d13e800Smrg
30983d13e800Smrg		eval supported=\$$cacheid
30993d13e800Smrg		AC_MSG_RESULT([$supported])
31003d13e800Smrg		if test "$supported" = "yes" ; then
31013d13e800Smrg			$1="$$1 ]flag["
31023d13e800Smrg			found="yes"
31033d13e800Smrg		fi
31043d13e800Smrg	fi
310501395c31Smrg])
31063d13e800Smrg]) # XORG_TESTSET_CFLAG
310701395c31Smrg
31083d13e800Smrg# XORG_COMPILER_FLAGS
31093d13e800Smrg# ---------------
31103d13e800Smrg# Minimum version: 1.16.0
31118255a313Smrg#
31123d13e800Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
31133d13e800Smrg# arguments supported by the selected compiler which do NOT alter the generated
31143d13e800Smrg# code.  These arguments will cause the compiler to print various warnings
31153d13e800Smrg# during compilation AND turn a conservative set of warnings into errors.
31163d13e800Smrg#
31173d13e800Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
31183d13e800Smrg# future versions of util-macros as options are added to new compilers.
31193d13e800Smrg#
31203d13e800SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
31213d13e800SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
312201395c31Smrg
31233d13e800SmrgAC_ARG_ENABLE(selective-werror,
31243d13e800Smrg              AS_HELP_STRING([--disable-selective-werror],
31253d13e800Smrg                             [Turn off selective compiler errors. (default: enabled)]),
31263d13e800Smrg              [SELECTIVE_WERROR=$enableval],
31273d13e800Smrg              [SELECTIVE_WERROR=yes])
31283d13e800Smrg
31293d13e800SmrgAC_LANG_CASE(
31303d13e800Smrg        [C], [
31313d13e800Smrg                define([PREFIX], [C])
31323d13e800Smrg        ],
31333d13e800Smrg        [C++], [
31343d13e800Smrg                define([PREFIX], [CXX])
31353d13e800Smrg        ]
31363d13e800Smrg)
31373d13e800Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
31383d13e800Smrgif test "x$SUNCC" = "xyes"; then
31393d13e800Smrg    [BASE_]PREFIX[FLAGS]="-v"
314001395c31Smrgelse
31413d13e800Smrg    [BASE_]PREFIX[FLAGS]=""
314201395c31Smrgfi
314301395c31Smrg
31443d13e800Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31453d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31463d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31473d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31483d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
314901395c31Smrg
31503d13e800SmrgAC_LANG_CASE(
31513d13e800Smrg	[C], [
31523d13e800Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31533d13e800Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31543d13e800Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31553d13e800Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31563d13e800Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31573d13e800Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31583d13e800Smrg	]
31593d13e800Smrg)
316001395c31Smrg
31613d13e800Smrg# This chunk adds additional warnings that could catch undesired effects.
31623d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31633d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31643d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31653d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31663d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31673d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31683d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
31698255a313Smrg
31703d13e800Smrg# These are currently disabled because they are noisy.  They will be enabled
31713d13e800Smrg# in the future once the codebase is sufficiently modernized to silence
31723d13e800Smrg# them.  For now, I don't want them to drown out the other warnings.
31733d13e800Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31743d13e800Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31753d13e800Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
31768255a313Smrg
317722138c50Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
31783d13e800Smrg# when there are problems that should be fixed.
31798255a313Smrg
31803d13e800Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31813d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31823d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31833d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31843d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31853d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31863d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31873d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31883d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31893d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31903d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31913d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31923d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31933d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31943d13e800Smrgelse
31953d13e800SmrgAC_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])
31963d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31973d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31983d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31993d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
32003d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
32013d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
32023d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
32033d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
32043d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
32053d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
32063d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
32073d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
32083d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
32093d13e800Smrgfi
32108255a313Smrg
32113d13e800SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32123d13e800Smrg]) # XORG_COMPILER_FLAGS
32138255a313Smrg
32143d13e800Smrg# XORG_CWARNFLAGS
32153d13e800Smrg# ---------------
32163d13e800Smrg# Minimum version: 1.2.0
32173d13e800Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
321801395c31Smrg#
32193d13e800Smrg# Defines CWARNFLAGS to enable C compiler warnings.
322001395c31Smrg#
32213d13e800Smrg# This function is deprecated because it defines -fno-strict-aliasing
32223d13e800Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
32233d13e800Smrg# is needed, then it should be added explicitly in the module when
32243d13e800Smrg# it is updated to use BASE_CFLAGS.
322501395c31Smrg#
32263d13e800SmrgAC_DEFUN([XORG_CWARNFLAGS], [
32273d13e800SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32283d13e800SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
32293d13e800SmrgAC_LANG_CASE(
32303d13e800Smrg	[C], [
32313d13e800Smrg		CWARNFLAGS="$BASE_CFLAGS"
32323d13e800Smrg		if  test "x$GCC" = xyes ; then
32333d13e800Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
32343d13e800Smrg		fi
32353d13e800Smrg		AC_SUBST(CWARNFLAGS)
32363d13e800Smrg	]
32373d13e800Smrg)
32383d13e800Smrg]) # XORG_CWARNFLAGS
32398255a313Smrg
32403d13e800Smrg# XORG_STRICT_OPTION
32413d13e800Smrg# -----------------------
32423d13e800Smrg# Minimum version: 1.3.0
32433d13e800Smrg#
32443d13e800Smrg# Add configure option to enable strict compilation flags, such as treating
32453d13e800Smrg# warnings as fatal errors.
32463d13e800Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32473d13e800Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32483d13e800Smrg#
32493d13e800Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32503d13e800Smrg# when strict compilation is unconditionally desired.
32513d13e800SmrgAC_DEFUN([XORG_STRICT_OPTION], [
32523d13e800SmrgAC_REQUIRE([XORG_CWARNFLAGS])
32533d13e800SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
325401395c31Smrg
32553d13e800SmrgAC_ARG_ENABLE(strict-compilation,
32563d13e800Smrg			  AS_HELP_STRING([--enable-strict-compilation],
32573d13e800Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32583d13e800Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
325901395c31Smrg
32603d13e800SmrgAC_LANG_CASE(
32613d13e800Smrg        [C], [
32623d13e800Smrg                define([PREFIX], [C])
32633d13e800Smrg        ],
32643d13e800Smrg        [C++], [
32653d13e800Smrg                define([PREFIX], [CXX])
32663d13e800Smrg        ]
32673d13e800Smrg)
326801395c31Smrg
32693d13e800Smrg[STRICT_]PREFIX[FLAGS]=""
32703d13e800SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32713d13e800SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
327201395c31Smrg
32733d13e800Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32743d13e800Smrg# activate it with -Werror, so we add it here explicitly.
32753d13e800SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
327601395c31Smrg
32773d13e800Smrgif test "x$STRICT_COMPILE" = "xyes"; then
32783d13e800Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32793d13e800Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32803d13e800Smrgfi
32813d13e800SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32823d13e800SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32833d13e800SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32843d13e800Smrg]) # XORG_STRICT_OPTION
328501395c31Smrg
328622138c50Smrg# XORG_DEFAULT_NOCODE_OPTIONS
328722138c50Smrg# ---------------------------
328822138c50Smrg# Minimum version: 1.20.0
328922138c50Smrg#
329022138c50Smrg# Defines default options for X.Org modules which don't compile code,
329122138c50Smrg# such as fonts, bitmaps, cursors, and docs.
329222138c50Smrg#
329322138c50SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
329422138c50SmrgAC_REQUIRE([AC_PROG_INSTALL])
329522138c50SmrgXORG_RELEASE_VERSION
329622138c50SmrgXORG_CHANGELOG
329722138c50SmrgXORG_INSTALL
329822138c50SmrgXORG_MANPAGE_SECTIONS
329922138c50Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
330022138c50Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
330122138c50Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
330222138c50Smrg
33033d13e800Smrg# XORG_DEFAULT_OPTIONS
33043d13e800Smrg# --------------------
33053d13e800Smrg# Minimum version: 1.3.0
33063d13e800Smrg#
330722138c50Smrg# Defines default options for X.Org modules which compile code.
33083d13e800Smrg#
33093d13e800SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
33103d13e800SmrgAC_REQUIRE([AC_PROG_INSTALL])
33113d13e800SmrgXORG_COMPILER_FLAGS
33123d13e800SmrgXORG_CWARNFLAGS
33133d13e800SmrgXORG_STRICT_OPTION
331422138c50SmrgXORG_DEFAULT_NOCODE_OPTIONS
33153d13e800Smrg]) # XORG_DEFAULT_OPTIONS
33168255a313Smrg
33173d13e800Smrg# XORG_INSTALL()
33183d13e800Smrg# ----------------
33193d13e800Smrg# Minimum version: 1.4.0
33203d13e800Smrg#
33213d13e800Smrg# Defines the variable INSTALL_CMD as the command to copy
33223d13e800Smrg# INSTALL from $prefix/share/util-macros.
33233d13e800Smrg#
33243d13e800SmrgAC_DEFUN([XORG_INSTALL], [
33253d13e800SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
33263d13e800Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
33273d13e800SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
33283d13e800Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
33293d13e800Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
33303d13e800Smrgtouch \$(top_srcdir)/INSTALL; \
33313d13e800Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
33323d13e800SmrgAC_SUBST([INSTALL_CMD])
33333d13e800Smrg]) # XORG_INSTALL
33343d13e800Smrgdnl Copyright 2005 Red Hat, Inc
33353d13e800Smrgdnl
33363d13e800Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
33373d13e800Smrgdnl documentation for any purpose is hereby granted without fee, provided that
33383d13e800Smrgdnl the above copyright notice appear in all copies and that both that
33393d13e800Smrgdnl copyright notice and this permission notice appear in supporting
33403d13e800Smrgdnl documentation.
33413d13e800Smrgdnl
33423d13e800Smrgdnl The above copyright notice and this permission notice shall be included
33433d13e800Smrgdnl in all copies or substantial portions of the Software.
33443d13e800Smrgdnl
33453d13e800Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33463d13e800Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33473d13e800Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33483d13e800Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
33493d13e800Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33503d13e800Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33513d13e800Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
33523d13e800Smrgdnl
33533d13e800Smrgdnl Except as contained in this notice, the name of the copyright holders shall
33543d13e800Smrgdnl not be used in advertising or otherwise to promote the sale, use or
33553d13e800Smrgdnl other dealings in this Software without prior written authorization
33563d13e800Smrgdnl from the copyright holders.
33573d13e800Smrgdnl
335801395c31Smrg
33593d13e800Smrg# XORG_RELEASE_VERSION
33603d13e800Smrg# --------------------
33613d13e800Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33628255a313Smrg
33633d13e800SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33643d13e800Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33653d13e800Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33663d13e800Smrg		[Major version of this package])
33673d13e800Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33683d13e800Smrg	if test "x$PVM" = "x"; then
33693d13e800Smrg		PVM="0"
33703d13e800Smrg	fi
33713d13e800Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33723d13e800Smrg		[$PVM],
33733d13e800Smrg		[Minor version of this package])
33743d13e800Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33753d13e800Smrg	if test "x$PVP" = "x"; then
33763d13e800Smrg		PVP="0"
33773d13e800Smrg	fi
33783d13e800Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33793d13e800Smrg		[$PVP],
33803d13e800Smrg		[Patch version of this package])
33813d13e800Smrg])
33828255a313Smrg
33833d13e800Smrg# XORG_CHANGELOG()
33843d13e800Smrg# ----------------
33853d13e800Smrg# Minimum version: 1.2.0
33863d13e800Smrg#
33873d13e800Smrg# Defines the variable CHANGELOG_CMD as the command to generate
33883d13e800Smrg# ChangeLog from git.
33893d13e800Smrg#
33903d13e800Smrg#
33913d13e800SmrgAC_DEFUN([XORG_CHANGELOG], [
33923d13e800SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33933d13e800Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33943d13e800Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33953d13e800Smrgtouch \$(top_srcdir)/ChangeLog; \
33963d13e800Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33973d13e800SmrgAC_SUBST([CHANGELOG_CMD])
33983d13e800Smrg]) # XORG_CHANGELOG
33998255a313Smrg
3400