10cfee914Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
20cfee914Smrg
30cfee914Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4335e815aSmrg
5335e815aSmrg# This file is free software; the Free Software Foundation
6335e815aSmrg# gives unlimited permission to copy and/or distribute it,
7335e815aSmrg# with or without modifications, as long as this notice is preserved.
8335e815aSmrg
9335e815aSmrg# This program is distributed in the hope that it will be useful,
10335e815aSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11335e815aSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12335e815aSmrg# PARTICULAR PURPOSE.
13335e815aSmrg
140cfee914Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15f4959950Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16f4959950Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
170cfee914Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
180cfee914Smrg[m4_warning([this file was generated for autoconf 2.71.
19f4959950SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20f4959950SmrgIf you have problems, you may need to regenerate the build system entirely.
210cfee914SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2227268fb8Smrg
230cfee914Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2427268fb8Smrg#
250cfee914Smrg# This file is free software; the Free Software Foundation
260cfee914Smrg# gives unlimited permission to copy and/or distribute it,
270cfee914Smrg# with or without modifications, as long as this notice is preserved.
28335e815aSmrg
290cfee914Smrg# AM_AUTOMAKE_VERSION(VERSION)
300cfee914Smrg# ----------------------------
310cfee914Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
320cfee914Smrg# generated from the m4 files accompanying Automake X.Y.
330cfee914Smrg# (This private macro should not be called outside this file.)
340cfee914SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
350cfee914Smrg[am__api_version='1.16'
360cfee914Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
370cfee914Smrgdnl require some minimum version.  Point them to the right macro.
380cfee914Smrgm4_if([$1], [1.16.5], [],
390cfee914Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
400cfee914Smrg])
41335e815aSmrg
420cfee914Smrg# _AM_AUTOCONF_VERSION(VERSION)
430cfee914Smrg# -----------------------------
440cfee914Smrg# aclocal traces this macro to find the Autoconf version.
450cfee914Smrg# This is a private macro too.  Using m4_define simplifies
460cfee914Smrg# the logic in aclocal, which can simply ignore this definition.
470cfee914Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48335e815aSmrg
490cfee914Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
500cfee914Smrg# -------------------------------
510cfee914Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
520cfee914Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
530cfee914SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
540cfee914Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
550cfee914Smrgm4_ifndef([AC_AUTOCONF_VERSION],
560cfee914Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
570cfee914Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58335e815aSmrg
590cfee914Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6027268fb8Smrg
610cfee914Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62335e815aSmrg#
630cfee914Smrg# This file is free software; the Free Software Foundation
640cfee914Smrg# gives unlimited permission to copy and/or distribute it,
650cfee914Smrg# with or without modifications, as long as this notice is preserved.
6627268fb8Smrg
670cfee914Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
680cfee914Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
690cfee914Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70335e815aSmrg#
710cfee914Smrg# Of course, Automake must honor this variable whenever it calls a
720cfee914Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
730cfee914Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
740cfee914Smrg# depending on how configure is run.  This is pretty annoying, since
750cfee914Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
760cfee914Smrg# source directory, any form will work fine, but in subdirectories a
770cfee914Smrg# relative path needs to be adjusted first.
78335e815aSmrg#
790cfee914Smrg# $ac_aux_dir/missing
800cfee914Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
810cfee914Smrg# $top_srcdir/$ac_aux_dir/missing
820cfee914Smrg#    fails if $ac_aux_dir is absolute,
830cfee914Smrg#    fails when called from a subdirectory in a VPATH build with
840cfee914Smrg#          a relative $ac_aux_dir
85335e815aSmrg#
860cfee914Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
870cfee914Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
880cfee914Smrg# harmless because $srcdir is '.', but things will broke when you
890cfee914Smrg# start a VPATH build or use an absolute $srcdir.
90f4959950Smrg#
910cfee914Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
920cfee914Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
930cfee914Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
940cfee914Smrg# and then we would define $MISSING as
950cfee914Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
960cfee914Smrg# This will work as long as MISSING is not called from configure, because
970cfee914Smrg# unfortunately $(top_srcdir) has no meaning in configure.
980cfee914Smrg# However there are other variables, like CC, which are often used in
990cfee914Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100f4959950Smrg#
1010cfee914Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1020cfee914Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1030cfee914Smrg# configured tree to be moved without reconfiguration.
104335e815aSmrg
1050cfee914SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1060cfee914Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1070cfee914Smrg# Expand $ac_aux_dir to an absolute path.
1080cfee914Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10927268fb8Smrg])
110335e815aSmrg
1110cfee914Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1120cfee914Smrg
1130cfee914Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11427268fb8Smrg#
1150cfee914Smrg# This file is free software; the Free Software Foundation
1160cfee914Smrg# gives unlimited permission to copy and/or distribute it,
1170cfee914Smrg# with or without modifications, as long as this notice is preserved.
118335e815aSmrg
1190cfee914Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1200cfee914Smrg# -------------------------------------
1210cfee914Smrg# Define a conditional.
1220cfee914SmrgAC_DEFUN([AM_CONDITIONAL],
1230cfee914Smrg[AC_PREREQ([2.52])dnl
1240cfee914Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1250cfee914Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1260cfee914SmrgAC_SUBST([$1_TRUE])dnl
1270cfee914SmrgAC_SUBST([$1_FALSE])dnl
1280cfee914Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1290cfee914Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1300cfee914Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1310cfee914Smrgif $2; then
1320cfee914Smrg  $1_TRUE=
1330cfee914Smrg  $1_FALSE='#'
1340cfee914Smrgelse
1350cfee914Smrg  $1_TRUE='#'
1360cfee914Smrg  $1_FALSE=
1370cfee914Smrgfi
1380cfee914SmrgAC_CONFIG_COMMANDS_PRE(
1390cfee914Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1400cfee914Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1410cfee914SmrgUsually this means the macro was only invoked conditionally.]])
1420cfee914Smrgfi])])
143335e815aSmrg
1440cfee914Smrg# Do all the work for Automake.                             -*- Autoconf -*-
145335e815aSmrg
1460cfee914Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
14727268fb8Smrg#
1480cfee914Smrg# This file is free software; the Free Software Foundation
1490cfee914Smrg# gives unlimited permission to copy and/or distribute it,
1500cfee914Smrg# with or without modifications, as long as this notice is preserved.
151335e815aSmrg
1520cfee914Smrg# This macro actually does too much.  Some checks are only needed if
1530cfee914Smrg# your package does certain things.  But this isn't really a big deal.
1540cfee914Smrg
1550cfee914Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
1560cfee914Smrgm4_define([AC_PROG_CC],
1570cfee914Smrgm4_defn([AC_PROG_CC])
1580cfee914Smrg[_AM_PROG_CC_C_O
15927268fb8Smrg])
160f4959950Smrg
1610cfee914Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
1620cfee914Smrg# AM_INIT_AUTOMAKE([OPTIONS])
1630cfee914Smrg# -----------------------------------------------
1640cfee914Smrg# The call with PACKAGE and VERSION arguments is the old style
1650cfee914Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
1660cfee914Smrg# and VERSION should now be passed to AC_INIT and removed from
1670cfee914Smrg# the call to AM_INIT_AUTOMAKE.
1680cfee914Smrg# We support both call styles for the transition.  After
1690cfee914Smrg# the next Automake release, Autoconf can make the AC_INIT
1700cfee914Smrg# arguments mandatory, and then we can depend on a new Autoconf
1710cfee914Smrg# release and drop the old call support.
1720cfee914SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
1730cfee914Smrg[AC_PREREQ([2.65])dnl
1740cfee914Smrgm4_ifdef([_$0_ALREADY_INIT],
1750cfee914Smrg  [m4_fatal([$0 expanded multiple times
1760cfee914Smrg]m4_defn([_$0_ALREADY_INIT]))],
1770cfee914Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
1780cfee914Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
1790cfee914Smrgdnl the ones we care about.
1800cfee914Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
1810cfee914SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
1820cfee914SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
1830cfee914Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
1840cfee914Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
1850cfee914Smrg  # is not polluted with repeated "-I."
1860cfee914Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
1870cfee914Smrg  # test to see if srcdir already configured
1880cfee914Smrg  if test -f $srcdir/config.status; then
1890cfee914Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1900cfee914Smrg  fi
1910cfee914Smrgfi
192335e815aSmrg
1930cfee914Smrg# test whether we have cygpath
1940cfee914Smrgif test -z "$CYGPATH_W"; then
1950cfee914Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
1960cfee914Smrg    CYGPATH_W='cygpath -w'
1970cfee914Smrg  else
1980cfee914Smrg    CYGPATH_W=echo
1990cfee914Smrg  fi
2000cfee914Smrgfi
2010cfee914SmrgAC_SUBST([CYGPATH_W])
202335e815aSmrg
2030cfee914Smrg# Define the identity of the package.
2040cfee914Smrgdnl Distinguish between old-style and new-style calls.
2050cfee914Smrgm4_ifval([$2],
2060cfee914Smrg[AC_DIAGNOSE([obsolete],
2070cfee914Smrg             [$0: two- and three-arguments forms are deprecated.])
2080cfee914Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2090cfee914Smrg AC_SUBST([PACKAGE], [$1])dnl
2100cfee914Smrg AC_SUBST([VERSION], [$2])],
2110cfee914Smrg[_AM_SET_OPTIONS([$1])dnl
2120cfee914Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2130cfee914Smrgm4_if(
2140cfee914Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
2150cfee914Smrg  [ok:ok],,
2160cfee914Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2170cfee914Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2180cfee914Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
219335e815aSmrg
2200cfee914Smrg_AM_IF_OPTION([no-define],,
2210cfee914Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
2220cfee914Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
223335e815aSmrg
2240cfee914Smrg# Some tools Automake needs.
2250cfee914SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
2260cfee914SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
2270cfee914SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
2280cfee914SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
2290cfee914SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
2300cfee914SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
2310cfee914SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
2320cfee914SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2330cfee914SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2340cfee914SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
2350cfee914Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
2360cfee914Smrg# dies out for good.  For more background, see:
2370cfee914Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2380cfee914Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2390cfee914SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2400cfee914Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
2410cfee914Smrg# system "awk" is bad on some platforms.
2420cfee914SmrgAC_REQUIRE([AC_PROG_AWK])dnl
2430cfee914SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
2440cfee914SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
2450cfee914Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2460cfee914Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2470cfee914Smrg			     [_AM_PROG_TAR([v7])])])
2480cfee914Smrg_AM_IF_OPTION([no-dependencies],,
2490cfee914Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
2500cfee914Smrg		  [_AM_DEPENDENCIES([CC])],
2510cfee914Smrg		  [m4_define([AC_PROG_CC],
2520cfee914Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2530cfee914SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
2540cfee914Smrg		  [_AM_DEPENDENCIES([CXX])],
2550cfee914Smrg		  [m4_define([AC_PROG_CXX],
2560cfee914Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2570cfee914SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
2580cfee914Smrg		  [_AM_DEPENDENCIES([OBJC])],
2590cfee914Smrg		  [m4_define([AC_PROG_OBJC],
2600cfee914Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2610cfee914SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2620cfee914Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
2630cfee914Smrg		  [m4_define([AC_PROG_OBJCXX],
2640cfee914Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
265335e815aSmrg])
2660cfee914Smrg# Variables for tags utilities; see am/tags.am
2670cfee914Smrgif test -z "$CTAGS"; then
2680cfee914Smrg  CTAGS=ctags
2690cfee914Smrgfi
2700cfee914SmrgAC_SUBST([CTAGS])
2710cfee914Smrgif test -z "$ETAGS"; then
2720cfee914Smrg  ETAGS=etags
2730cfee914Smrgfi
2740cfee914SmrgAC_SUBST([ETAGS])
2750cfee914Smrgif test -z "$CSCOPE"; then
2760cfee914Smrg  CSCOPE=cscope
2770cfee914Smrgfi
2780cfee914SmrgAC_SUBST([CSCOPE])
279335e815aSmrg
2800cfee914SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
2810cfee914Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
2820cfee914Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2830cfee914Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2840cfee914SmrgAC_CONFIG_COMMANDS_PRE(dnl
2850cfee914Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
2860cfee914Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
287335e815aSmrg
2880cfee914Smrg# POSIX will say in a future version that running "rm -f" with no argument
2890cfee914Smrg# is OK; and we want to be able to make that assumption in our Makefile
2900cfee914Smrg# recipes.  So use an aggressive probe to check that the usage we want is
2910cfee914Smrg# actually supported "in the wild" to an acceptable degree.
2920cfee914Smrg# See automake bug#10828.
2930cfee914Smrg# To make any issue more visible, cause the running configure to be aborted
2940cfee914Smrg# by default if the 'rm' program in use doesn't match our expectations; the
2950cfee914Smrg# user can still override this though.
2960cfee914Smrgif rm -f && rm -fr && rm -rf; then : OK; else
2970cfee914Smrg  cat >&2 <<'END'
2980cfee914SmrgOops!
2990cfee914Smrg
3000cfee914SmrgYour 'rm' program seems unable to run without file operands specified
3010cfee914Smrgon the command line, even when the '-f' option is present.  This is contrary
3020cfee914Smrgto the behaviour of most rm programs out there, and not conforming with
3030cfee914Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
3040cfee914Smrg
3050cfee914SmrgPlease tell bug-automake@gnu.org about your system, including the value
3060cfee914Smrgof your $PATH and any error possibly output before this message.  This
3070cfee914Smrgcan help us improve future automake versions.
308335e815aSmrg
3090cfee914SmrgEND
3100cfee914Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
3110cfee914Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
3120cfee914Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
3130cfee914Smrg    echo >&2
3140cfee914Smrg  else
3150cfee914Smrg    cat >&2 <<'END'
3160cfee914SmrgAborting the configuration process, to ensure you take notice of the issue.
317335e815aSmrg
3180cfee914SmrgYou can download and install GNU coreutils to get an 'rm' implementation
3190cfee914Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
320335e815aSmrg
3210cfee914SmrgIf you want to complete the configuration process using your problematic
3220cfee914Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
3230cfee914Smrgto "yes", and re-run configure.
3240cfee914Smrg
3250cfee914SmrgEND
3260cfee914Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
3270cfee914Smrg  fi
3280cfee914Smrgfi
3290cfee914Smrgdnl The trailing newline in this macro's definition is deliberate, for
3300cfee914Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
3310cfee914Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
33227268fb8Smrg])
333335e815aSmrg
3340cfee914Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
3350cfee914Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
3360cfee914Smrgdnl mangled by Autoconf and run in a shell conditional statement.
3370cfee914Smrgm4_define([_AC_COMPILER_EXEEXT],
3380cfee914Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
339335e815aSmrg
3400cfee914Smrg# When config.status generates a header, we must update the stamp-h file.
3410cfee914Smrg# This file resides in the same directory as the config header
3420cfee914Smrg# that is generated.  The stamp files are numbered to have different names.
343f4959950Smrg
3440cfee914Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
3450cfee914Smrg# loop where config.status creates the headers, so we can generate
3460cfee914Smrg# our stamp files there.
3470cfee914SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
3480cfee914Smrg[# Compute $1's index in $config_headers.
3490cfee914Smrg_am_arg=$1
3500cfee914Smrg_am_stamp_count=1
3510cfee914Smrgfor _am_header in $config_headers :; do
3520cfee914Smrg  case $_am_header in
3530cfee914Smrg    $_am_arg | $_am_arg:* )
3540cfee914Smrg      break ;;
3550cfee914Smrg    * )
3560cfee914Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
3570cfee914Smrg  esac
3580cfee914Smrgdone
3590cfee914Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
36027268fb8Smrg
3610cfee914Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
362f4959950Smrg#
3630cfee914Smrg# This file is free software; the Free Software Foundation
3640cfee914Smrg# gives unlimited permission to copy and/or distribute it,
3650cfee914Smrg# with or without modifications, as long as this notice is preserved.
366f4959950Smrg
3670cfee914Smrg# AM_PROG_INSTALL_SH
3680cfee914Smrg# ------------------
3690cfee914Smrg# Define $install_sh.
3700cfee914SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
3710cfee914Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3720cfee914Smrgif test x"${install_sh+set}" != xset; then
3730cfee914Smrg  case $am_aux_dir in
3740cfee914Smrg  *\ * | *\	*)
3750cfee914Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
3760cfee914Smrg  *)
3770cfee914Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
3780cfee914Smrg  esac
3790cfee914Smrgfi
3800cfee914SmrgAC_SUBST([install_sh])])
381f4959950Smrg
3820cfee914Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
3830cfee914Smrg#
3840cfee914Smrg# This file is free software; the Free Software Foundation
3850cfee914Smrg# gives unlimited permission to copy and/or distribute it,
3860cfee914Smrg# with or without modifications, as long as this notice is preserved.
3870cfee914Smrg
3880cfee914Smrg# Check whether the underlying file-system supports filenames
3890cfee914Smrg# with a leading dot.  For instance MS-DOS doesn't.
3900cfee914SmrgAC_DEFUN([AM_SET_LEADING_DOT],
3910cfee914Smrg[rm -rf .tst 2>/dev/null
3920cfee914Smrgmkdir .tst 2>/dev/null
3930cfee914Smrgif test -d .tst; then
3940cfee914Smrg  am__leading_dot=.
3950cfee914Smrgelse
3960cfee914Smrg  am__leading_dot=_
3970cfee914Smrgfi
3980cfee914Smrgrmdir .tst 2>/dev/null
3990cfee914SmrgAC_SUBST([am__leading_dot])])
4000cfee914Smrg
4010cfee914Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
4020cfee914Smrg
4030cfee914Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
4040cfee914Smrg#
4050cfee914Smrg# This file is free software; the Free Software Foundation
4060cfee914Smrg# gives unlimited permission to copy and/or distribute it,
4070cfee914Smrg# with or without modifications, as long as this notice is preserved.
4080cfee914Smrg
4090cfee914Smrg# AM_MISSING_PROG(NAME, PROGRAM)
4100cfee914Smrg# ------------------------------
4110cfee914SmrgAC_DEFUN([AM_MISSING_PROG],
4120cfee914Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
4130cfee914Smrg$1=${$1-"${am_missing_run}$2"}
4140cfee914SmrgAC_SUBST($1)])
4150cfee914Smrg
4160cfee914Smrg# AM_MISSING_HAS_RUN
4170cfee914Smrg# ------------------
4180cfee914Smrg# Define MISSING if not defined so far and test if it is modern enough.
4190cfee914Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
4200cfee914SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
4210cfee914Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
4220cfee914SmrgAC_REQUIRE_AUX_FILE([missing])dnl
4230cfee914Smrgif test x"${MISSING+set}" != xset; then
4240cfee914Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
4250cfee914Smrgfi
4260cfee914Smrg# Use eval to expand $SHELL
4270cfee914Smrgif eval "$MISSING --is-lightweight"; then
4280cfee914Smrg  am_missing_run="$MISSING "
4290cfee914Smrgelse
4300cfee914Smrg  am_missing_run=
4310cfee914Smrg  AC_MSG_WARN(['missing' script is too old or missing])
4320cfee914Smrgfi
4330cfee914Smrg])
4340cfee914Smrg
4350cfee914Smrg# Helper functions for option handling.                     -*- Autoconf -*-
4360cfee914Smrg
4370cfee914Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
4380cfee914Smrg#
4390cfee914Smrg# This file is free software; the Free Software Foundation
4400cfee914Smrg# gives unlimited permission to copy and/or distribute it,
4410cfee914Smrg# with or without modifications, as long as this notice is preserved.
4420cfee914Smrg
4430cfee914Smrg# _AM_MANGLE_OPTION(NAME)
4440cfee914Smrg# -----------------------
4450cfee914SmrgAC_DEFUN([_AM_MANGLE_OPTION],
4460cfee914Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
4470cfee914Smrg
4480cfee914Smrg# _AM_SET_OPTION(NAME)
4490cfee914Smrg# --------------------
4500cfee914Smrg# Set option NAME.  Presently that only means defining a flag for this option.
4510cfee914SmrgAC_DEFUN([_AM_SET_OPTION],
4520cfee914Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
4530cfee914Smrg
4540cfee914Smrg# _AM_SET_OPTIONS(OPTIONS)
4550cfee914Smrg# ------------------------
4560cfee914Smrg# OPTIONS is a space-separated list of Automake options.
4570cfee914SmrgAC_DEFUN([_AM_SET_OPTIONS],
4580cfee914Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
4590cfee914Smrg
4600cfee914Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
4610cfee914Smrg# -------------------------------------------
4620cfee914Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
4630cfee914SmrgAC_DEFUN([_AM_IF_OPTION],
4640cfee914Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
4650cfee914Smrg
4660cfee914Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
4670cfee914Smrg
4680cfee914Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4690cfee914Smrg#
4700cfee914Smrg# This file is free software; the Free Software Foundation
4710cfee914Smrg# gives unlimited permission to copy and/or distribute it,
4720cfee914Smrg# with or without modifications, as long as this notice is preserved.
4730cfee914Smrg
4740cfee914Smrg# AM_SANITY_CHECK
4750cfee914Smrg# ---------------
4760cfee914SmrgAC_DEFUN([AM_SANITY_CHECK],
4770cfee914Smrg[AC_MSG_CHECKING([whether build environment is sane])
4780cfee914Smrg# Reject unsafe characters in $srcdir or the absolute working directory
4790cfee914Smrg# name.  Accept space and tab only in the latter.
4800cfee914Smrgam_lf='
4810cfee914Smrg'
4820cfee914Smrgcase `pwd` in
4830cfee914Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
4840cfee914Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
4850cfee914Smrgesac
4860cfee914Smrgcase $srcdir in
4870cfee914Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
4880cfee914Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
4890cfee914Smrgesac
4900cfee914Smrg
4910cfee914Smrg# Do 'set' in a subshell so we don't clobber the current shell's
4920cfee914Smrg# arguments.  Must try -L first in case configure is actually a
4930cfee914Smrg# symlink; some systems play weird games with the mod time of symlinks
4940cfee914Smrg# (eg FreeBSD returns the mod time of the symlink's containing
4950cfee914Smrg# directory).
4960cfee914Smrgif (
4970cfee914Smrg   am_has_slept=no
4980cfee914Smrg   for am_try in 1 2; do
4990cfee914Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
5000cfee914Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
5010cfee914Smrg     if test "$[*]" = "X"; then
5020cfee914Smrg	# -L didn't work.
5030cfee914Smrg	set X `ls -t "$srcdir/configure" conftest.file`
5040cfee914Smrg     fi
5050cfee914Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
5060cfee914Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
5070cfee914Smrg
5080cfee914Smrg	# If neither matched, then we have a broken ls.  This can happen
5090cfee914Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
5100cfee914Smrg	# broken ls alias from the environment.  This has actually
5110cfee914Smrg	# happened.  Such a system could not be considered "sane".
5120cfee914Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
5130cfee914Smrg  alias in your environment])
5140cfee914Smrg     fi
5150cfee914Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
5160cfee914Smrg       break
5170cfee914Smrg     fi
5180cfee914Smrg     # Just in case.
5190cfee914Smrg     sleep 1
5200cfee914Smrg     am_has_slept=yes
5210cfee914Smrg   done
5220cfee914Smrg   test "$[2]" = conftest.file
5230cfee914Smrg   )
5240cfee914Smrgthen
5250cfee914Smrg   # Ok.
5260cfee914Smrg   :
5270cfee914Smrgelse
5280cfee914Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
5290cfee914SmrgCheck your system clock])
5300cfee914Smrgfi
5310cfee914SmrgAC_MSG_RESULT([yes])
5320cfee914Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
5330cfee914Smrg# generated files are strictly newer.
5340cfee914Smrgam_sleep_pid=
5350cfee914Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
5360cfee914Smrg  ( sleep 1 ) &
5370cfee914Smrg  am_sleep_pid=$!
5380cfee914Smrgfi
5390cfee914SmrgAC_CONFIG_COMMANDS_PRE(
5400cfee914Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
5410cfee914Smrg   if test -n "$am_sleep_pid"; then
5420cfee914Smrg     # Hide warnings about reused PIDs.
5430cfee914Smrg     wait $am_sleep_pid 2>/dev/null
5440cfee914Smrg   fi
5450cfee914Smrg   AC_MSG_RESULT([done])])
5460cfee914Smrgrm -f conftest.file
5470cfee914Smrg])
5480cfee914Smrg
5490cfee914Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
5500cfee914Smrg#
5510cfee914Smrg# This file is free software; the Free Software Foundation
5520cfee914Smrg# gives unlimited permission to copy and/or distribute it,
5530cfee914Smrg# with or without modifications, as long as this notice is preserved.
5540cfee914Smrg
5550cfee914Smrg# AM_SILENT_RULES([DEFAULT])
5560cfee914Smrg# --------------------------
5570cfee914Smrg# Enable less verbose build rules; with the default set to DEFAULT
5580cfee914Smrg# ("yes" being less verbose, "no" or empty being verbose).
5590cfee914SmrgAC_DEFUN([AM_SILENT_RULES],
5600cfee914Smrg[AC_ARG_ENABLE([silent-rules], [dnl
5610cfee914SmrgAS_HELP_STRING(
5620cfee914Smrg  [--enable-silent-rules],
5630cfee914Smrg  [less verbose build output (undo: "make V=1")])
5640cfee914SmrgAS_HELP_STRING(
5650cfee914Smrg  [--disable-silent-rules],
5660cfee914Smrg  [verbose build output (undo: "make V=0")])dnl
5670cfee914Smrg])
5680cfee914Smrgcase $enable_silent_rules in @%:@ (((
5690cfee914Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
5700cfee914Smrg   no) AM_DEFAULT_VERBOSITY=1;;
5710cfee914Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
5720cfee914Smrgesac
5730cfee914Smrgdnl
5740cfee914Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
5750cfee914Smrgdnl do not support nested variable expansions.
5760cfee914Smrgdnl See automake bug#9928 and bug#10237.
5770cfee914Smrgam_make=${MAKE-make}
5780cfee914SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
5790cfee914Smrg   [am_cv_make_support_nested_variables],
5800cfee914Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
5810cfee914SmrgBAR0=false
5820cfee914SmrgBAR1=true
5830cfee914SmrgV=1
5840cfee914Smrgam__doit:
5850cfee914Smrg	@$(TRUE)
5860cfee914Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
5870cfee914Smrg  am_cv_make_support_nested_variables=yes
5880cfee914Smrgelse
5890cfee914Smrg  am_cv_make_support_nested_variables=no
5900cfee914Smrgfi])
5910cfee914Smrgif test $am_cv_make_support_nested_variables = yes; then
5920cfee914Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
5930cfee914Smrg  AM_V='$(V)'
5940cfee914Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
5950cfee914Smrgelse
5960cfee914Smrg  AM_V=$AM_DEFAULT_VERBOSITY
5970cfee914Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
5980cfee914Smrgfi
5990cfee914SmrgAC_SUBST([AM_V])dnl
6000cfee914SmrgAM_SUBST_NOTMAKE([AM_V])dnl
6010cfee914SmrgAC_SUBST([AM_DEFAULT_V])dnl
6020cfee914SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
6030cfee914SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
6040cfee914SmrgAM_BACKSLASH='\'
6050cfee914SmrgAC_SUBST([AM_BACKSLASH])dnl
6060cfee914Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
6070cfee914Smrg])
6080cfee914Smrg
6090cfee914Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6100cfee914Smrg#
6110cfee914Smrg# This file is free software; the Free Software Foundation
6120cfee914Smrg# gives unlimited permission to copy and/or distribute it,
6130cfee914Smrg# with or without modifications, as long as this notice is preserved.
6140cfee914Smrg
6150cfee914Smrg# AM_PROG_INSTALL_STRIP
6160cfee914Smrg# ---------------------
6170cfee914Smrg# One issue with vendor 'install' (even GNU) is that you can't
6180cfee914Smrg# specify the program used to strip binaries.  This is especially
6190cfee914Smrg# annoying in cross-compiling environments, where the build's strip
6200cfee914Smrg# is unlikely to handle the host's binaries.
6210cfee914Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
6220cfee914Smrg# always use install-sh in "make install-strip", and initialize
6230cfee914Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
6240cfee914SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
6250cfee914Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
6260cfee914Smrg# Installed binaries are usually stripped using 'strip' when the user
6270cfee914Smrg# run "make install-strip".  However 'strip' might not be the right
6280cfee914Smrg# tool to use in cross-compilation environments, therefore Automake
6290cfee914Smrg# will honor the 'STRIP' environment variable to overrule this program.
6300cfee914Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
6310cfee914Smrgif test "$cross_compiling" != no; then
6320cfee914Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
6330cfee914Smrgfi
6340cfee914SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
6350cfee914SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
6360cfee914Smrg
6370cfee914Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
6380cfee914Smrg#
6390cfee914Smrg# This file is free software; the Free Software Foundation
6400cfee914Smrg# gives unlimited permission to copy and/or distribute it,
6410cfee914Smrg# with or without modifications, as long as this notice is preserved.
6420cfee914Smrg
6430cfee914Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
6440cfee914Smrg# ---------------------------
6450cfee914Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
6460cfee914Smrg# This macro is traced by Automake.
6470cfee914SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
6480cfee914Smrg
6490cfee914Smrg# AM_SUBST_NOTMAKE(VARIABLE)
6500cfee914Smrg# --------------------------
6510cfee914Smrg# Public sister of _AM_SUBST_NOTMAKE.
6520cfee914SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
6530cfee914Smrg
6540cfee914Smrg# Check how to create a tarball.                            -*- Autoconf -*-
6550cfee914Smrg
6560cfee914Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
6570cfee914Smrg#
6580cfee914Smrg# This file is free software; the Free Software Foundation
6590cfee914Smrg# gives unlimited permission to copy and/or distribute it,
6600cfee914Smrg# with or without modifications, as long as this notice is preserved.
6610cfee914Smrg
6620cfee914Smrg# _AM_PROG_TAR(FORMAT)
6630cfee914Smrg# --------------------
6640cfee914Smrg# Check how to create a tarball in format FORMAT.
6650cfee914Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
6660cfee914Smrg#
6670cfee914Smrg# Substitute a variable $(am__tar) that is a command
6680cfee914Smrg# writing to stdout a FORMAT-tarball containing the directory
6690cfee914Smrg# $tardir.
6700cfee914Smrg#     tardir=directory && $(am__tar) > result.tar
6710cfee914Smrg#
6720cfee914Smrg# Substitute a variable $(am__untar) that extract such
6730cfee914Smrg# a tarball read from stdin.
6740cfee914Smrg#     $(am__untar) < result.tar
6750cfee914Smrg#
6760cfee914SmrgAC_DEFUN([_AM_PROG_TAR],
6770cfee914Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
6780cfee914Smrg# in the wild :-(  We should find a proper way to deprecate it ...
6790cfee914SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
6800cfee914Smrg
6810cfee914Smrg# We'll loop over all known methods to create a tar archive until one works.
6820cfee914Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
6830cfee914Smrg
6840cfee914Smrgm4_if([$1], [v7],
6850cfee914Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
6860cfee914Smrg
6870cfee914Smrg  [m4_case([$1],
6880cfee914Smrg    [ustar],
6890cfee914Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
6900cfee914Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
6910cfee914Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
6920cfee914Smrg      # and bug#13588).
6930cfee914Smrg      am_max_uid=2097151 # 2^21 - 1
6940cfee914Smrg      am_max_gid=$am_max_uid
6950cfee914Smrg      # The $UID and $GID variables are not portable, so we need to resort
6960cfee914Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
6970cfee914Smrg      # below are definitely unexpected, so allow the users to see them
6980cfee914Smrg      # (that is, avoid stderr redirection).
6990cfee914Smrg      am_uid=`id -u || echo unknown`
7000cfee914Smrg      am_gid=`id -g || echo unknown`
7010cfee914Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
7020cfee914Smrg      if test $am_uid -le $am_max_uid; then
7030cfee914Smrg         AC_MSG_RESULT([yes])
7040cfee914Smrg      else
7050cfee914Smrg         AC_MSG_RESULT([no])
7060cfee914Smrg         _am_tools=none
7070cfee914Smrg      fi
7080cfee914Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
7090cfee914Smrg      if test $am_gid -le $am_max_gid; then
7100cfee914Smrg         AC_MSG_RESULT([yes])
7110cfee914Smrg      else
7120cfee914Smrg        AC_MSG_RESULT([no])
7130cfee914Smrg        _am_tools=none
7140cfee914Smrg      fi],
7150cfee914Smrg
7160cfee914Smrg  [pax],
7170cfee914Smrg    [],
7180cfee914Smrg
7190cfee914Smrg  [m4_fatal([Unknown tar format])])
7200cfee914Smrg
7210cfee914Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
7220cfee914Smrg
7230cfee914Smrg  # Go ahead even if we have the value already cached.  We do so because we
7240cfee914Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
7250cfee914Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
7260cfee914Smrg
7270cfee914Smrg  for _am_tool in $_am_tools; do
7280cfee914Smrg    case $_am_tool in
7290cfee914Smrg    gnutar)
7300cfee914Smrg      for _am_tar in tar gnutar gtar; do
7310cfee914Smrg        AM_RUN_LOG([$_am_tar --version]) && break
7320cfee914Smrg      done
7330cfee914Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
7340cfee914Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
7350cfee914Smrg      am__untar="$_am_tar -xf -"
7360cfee914Smrg      ;;
7370cfee914Smrg    plaintar)
7380cfee914Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
7390cfee914Smrg      # ustar tarball either.
7400cfee914Smrg      (tar --version) >/dev/null 2>&1 && continue
7410cfee914Smrg      am__tar='tar chf - "$$tardir"'
7420cfee914Smrg      am__tar_='tar chf - "$tardir"'
7430cfee914Smrg      am__untar='tar xf -'
7440cfee914Smrg      ;;
7450cfee914Smrg    pax)
7460cfee914Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
7470cfee914Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
7480cfee914Smrg      am__untar='pax -r'
7490cfee914Smrg      ;;
7500cfee914Smrg    cpio)
7510cfee914Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
7520cfee914Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
7530cfee914Smrg      am__untar='cpio -i -H $1 -d'
7540cfee914Smrg      ;;
7550cfee914Smrg    none)
7560cfee914Smrg      am__tar=false
7570cfee914Smrg      am__tar_=false
7580cfee914Smrg      am__untar=false
7590cfee914Smrg      ;;
7600cfee914Smrg    esac
7610cfee914Smrg
7620cfee914Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
7630cfee914Smrg    # and am__untar set.
7640cfee914Smrg    test -n "${am_cv_prog_tar_$1}" && break
7650cfee914Smrg
7660cfee914Smrg    # tar/untar a dummy directory, and stop if the command works.
7670cfee914Smrg    rm -rf conftest.dir
7680cfee914Smrg    mkdir conftest.dir
7690cfee914Smrg    echo GrepMe > conftest.dir/file
7700cfee914Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
7710cfee914Smrg    rm -rf conftest.dir
7720cfee914Smrg    if test -s conftest.tar; then
7730cfee914Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
7740cfee914Smrg      AM_RUN_LOG([cat conftest.dir/file])
7750cfee914Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
7760cfee914Smrg    fi
7770cfee914Smrg  done
7780cfee914Smrg  rm -rf conftest.dir
7790cfee914Smrg
7800cfee914Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
7810cfee914Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
7820cfee914Smrg
7830cfee914SmrgAC_SUBST([am__tar])
7840cfee914SmrgAC_SUBST([am__untar])
7850cfee914Smrg]) # _AM_PROG_TAR
7860cfee914Smrg
7870cfee914Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
7880cfee914Smrgdnl serial 11 (pkg-config-0.29)
7890cfee914Smrgdnl
7900cfee914Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
7910cfee914Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
7920cfee914Smrgdnl
7930cfee914Smrgdnl This program is free software; you can redistribute it and/or modify
7940cfee914Smrgdnl it under the terms of the GNU General Public License as published by
7950cfee914Smrgdnl the Free Software Foundation; either version 2 of the License, or
7960cfee914Smrgdnl (at your option) any later version.
7970cfee914Smrgdnl
7980cfee914Smrgdnl This program is distributed in the hope that it will be useful, but
7990cfee914Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
8000cfee914Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8010cfee914Smrgdnl General Public License for more details.
8020cfee914Smrgdnl
8030cfee914Smrgdnl You should have received a copy of the GNU General Public License
8040cfee914Smrgdnl along with this program; if not, write to the Free Software
8050cfee914Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
8060cfee914Smrgdnl 02111-1307, USA.
8070cfee914Smrgdnl
8080cfee914Smrgdnl As a special exception to the GNU General Public License, if you
8090cfee914Smrgdnl distribute this file as part of a program that contains a
8100cfee914Smrgdnl configuration script generated by Autoconf, you may include it under
8110cfee914Smrgdnl the same distribution terms that you use for the rest of that
8120cfee914Smrgdnl program.
8130cfee914Smrg
8140cfee914Smrgdnl PKG_PREREQ(MIN-VERSION)
8150cfee914Smrgdnl -----------------------
8160cfee914Smrgdnl Since: 0.29
8170cfee914Smrgdnl
8180cfee914Smrgdnl Verify that the version of the pkg-config macros are at least
8190cfee914Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
8200cfee914Smrgdnl installed version of pkg-config, this checks the developer's version
8210cfee914Smrgdnl of pkg.m4 when generating configure.
8220cfee914Smrgdnl
8230cfee914Smrgdnl To ensure that this macro is defined, also add:
8240cfee914Smrgdnl m4_ifndef([PKG_PREREQ],
8250cfee914Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
8260cfee914Smrgdnl
8270cfee914Smrgdnl See the "Since" comment for each macro you use to see what version
8280cfee914Smrgdnl of the macros you require.
8290cfee914Smrgm4_defun([PKG_PREREQ],
8300cfee914Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
8310cfee914Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
8320cfee914Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
8330cfee914Smrg])dnl PKG_PREREQ
8340cfee914Smrg
8350cfee914Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
8360cfee914Smrgdnl ----------------------------------
8370cfee914Smrgdnl Since: 0.16
8380cfee914Smrgdnl
8390cfee914Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
8400cfee914Smrgdnl first found in the path. Checks that the version of pkg-config found
8410cfee914Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
8420cfee914Smrgdnl used since that's the first version where most current features of
8430cfee914Smrgdnl pkg-config existed.
84427268fb8SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
84527268fb8Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8460cfee914Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8470cfee914Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
84827268fb8SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
84927268fb8SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
85027268fb8SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
851f4959950Smrg
85227268fb8Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
85327268fb8Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
854f4959950Smrgfi
85527268fb8Smrgif test -n "$PKG_CONFIG"; then
85627268fb8Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
85727268fb8Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
85827268fb8Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
85927268fb8Smrg		AC_MSG_RESULT([yes])
86027268fb8Smrg	else
86127268fb8Smrg		AC_MSG_RESULT([no])
86227268fb8Smrg		PKG_CONFIG=""
86327268fb8Smrg	fi
86427268fb8Smrgfi[]dnl
8650cfee914Smrg])dnl PKG_PROG_PKG_CONFIG
866f4959950Smrg
8670cfee914Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
8680cfee914Smrgdnl -------------------------------------------------------------------
8690cfee914Smrgdnl Since: 0.18
8700cfee914Smrgdnl
8710cfee914Smrgdnl Check to see whether a particular set of modules exists. Similar to
8720cfee914Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
8730cfee914Smrgdnl
8740cfee914Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
8750cfee914Smrgdnl only at the first occurence in configure.ac, so if the first place
8760cfee914Smrgdnl it's called might be skipped (such as if it is within an "if", you
8770cfee914Smrgdnl have to call PKG_CHECK_EXISTS manually
87827268fb8SmrgAC_DEFUN([PKG_CHECK_EXISTS],
87927268fb8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
88027268fb8Smrgif test -n "$PKG_CONFIG" && \
88127268fb8Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
88227268fb8Smrg  m4_default([$2], [:])
88327268fb8Smrgm4_ifvaln([$3], [else
88427268fb8Smrg  $3])dnl
88527268fb8Smrgfi])
886f4959950Smrg
8870cfee914Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
8880cfee914Smrgdnl ---------------------------------------------
8890cfee914Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
8900cfee914Smrgdnl pkg_failed based on the result.
89127268fb8Smrgm4_define([_PKG_CONFIG],
89227268fb8Smrg[if test -n "$$1"; then
89327268fb8Smrg    pkg_cv_[]$1="$$1"
89427268fb8Smrg elif test -n "$PKG_CONFIG"; then
89527268fb8Smrg    PKG_CHECK_EXISTS([$3],
8960cfee914Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
8970cfee914Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
89827268fb8Smrg		     [pkg_failed=yes])
89927268fb8Smrg else
90027268fb8Smrg    pkg_failed=untried
90127268fb8Smrgfi[]dnl
9020cfee914Smrg])dnl _PKG_CONFIG
903f4959950Smrg
9040cfee914Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
9050cfee914Smrgdnl ---------------------------
9060cfee914Smrgdnl Internal check to see if pkg-config supports short errors.
90727268fb8SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
90827268fb8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
90927268fb8Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
91027268fb8Smrg        _pkg_short_errors_supported=yes
91127268fb8Smrgelse
91227268fb8Smrg        _pkg_short_errors_supported=no
91327268fb8Smrgfi[]dnl
9140cfee914Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
915f4959950Smrg
916f4959950Smrg
9170cfee914Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
9180cfee914Smrgdnl   [ACTION-IF-NOT-FOUND])
9190cfee914Smrgdnl --------------------------------------------------------------
9200cfee914Smrgdnl Since: 0.4.0
9210cfee914Smrgdnl
9220cfee914Smrgdnl Note that if there is a possibility the first call to
9230cfee914Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
9240cfee914Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
92527268fb8SmrgAC_DEFUN([PKG_CHECK_MODULES],
92627268fb8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
92727268fb8SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
92827268fb8SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
929f4959950Smrg
93027268fb8Smrgpkg_failed=no
93127268fb8SmrgAC_MSG_CHECKING([for $1])
932f4959950Smrg
93327268fb8Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
93427268fb8Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
935f4959950Smrg
93627268fb8Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
93727268fb8Smrgand $1[]_LIBS to avoid the need to call pkg-config.
93827268fb8SmrgSee the pkg-config man page for more details.])
939f4959950Smrg
94027268fb8Smrgif test $pkg_failed = yes; then
94127268fb8Smrg   	AC_MSG_RESULT([no])
94227268fb8Smrg        _PKG_SHORT_ERRORS_SUPPORTED
94327268fb8Smrg        if test $_pkg_short_errors_supported = yes; then
9440cfee914Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
94527268fb8Smrg        else 
9460cfee914Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
94727268fb8Smrg        fi
94827268fb8Smrg	# Put the nasty error message in config.log where it belongs
94927268fb8Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
950f4959950Smrg
95127268fb8Smrg	m4_default([$4], [AC_MSG_ERROR(
95227268fb8Smrg[Package requirements ($2) were not met:
953f4959950Smrg
95427268fb8Smrg$$1_PKG_ERRORS
955f4959950Smrg
95627268fb8SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
95727268fb8Smrginstalled software in a non-standard prefix.
958335e815aSmrg
95927268fb8Smrg_PKG_TEXT])[]dnl
96027268fb8Smrg        ])
96127268fb8Smrgelif test $pkg_failed = untried; then
96227268fb8Smrg     	AC_MSG_RESULT([no])
96327268fb8Smrg	m4_default([$4], [AC_MSG_FAILURE(
96427268fb8Smrg[The pkg-config script could not be found or is too old.  Make sure it
96527268fb8Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
96627268fb8Smrgpath to pkg-config.
967f4959950Smrg
96827268fb8Smrg_PKG_TEXT
969f4959950Smrg
9700cfee914SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
97127268fb8Smrg        ])
97227268fb8Smrgelse
97327268fb8Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
97427268fb8Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
97527268fb8Smrg        AC_MSG_RESULT([yes])
97627268fb8Smrg	$3
97727268fb8Smrgfi[]dnl
9780cfee914Smrg])dnl PKG_CHECK_MODULES
979f4959950Smrg
9800cfee914Smrg
9810cfee914Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
9820cfee914Smrgdnl   [ACTION-IF-NOT-FOUND])
9830cfee914Smrgdnl ---------------------------------------------------------------------
9840cfee914Smrgdnl Since: 0.29
98527268fb8Smrgdnl
9860cfee914Smrgdnl Checks for existence of MODULES and gathers its build flags with
9870cfee914Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
9880cfee914Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
9890cfee914Smrgdnl
9900cfee914Smrgdnl Note that if there is a possibility the first call to
9910cfee914Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
9920cfee914Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
9930cfee914Smrgdnl configure.ac.
9940cfee914SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
9950cfee914Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
9960cfee914Smrg_save_PKG_CONFIG=$PKG_CONFIG
9970cfee914SmrgPKG_CONFIG="$PKG_CONFIG --static"
9980cfee914SmrgPKG_CHECK_MODULES($@)
9990cfee914SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
10000cfee914Smrg])dnl PKG_CHECK_MODULES_STATIC
10010cfee914Smrg
10020cfee914Smrg
10030cfee914Smrgdnl PKG_INSTALLDIR([DIRECTORY])
10040cfee914Smrgdnl -------------------------
10050cfee914Smrgdnl Since: 0.27
10060cfee914Smrgdnl
10070cfee914Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
10080cfee914Smrgdnl should install pkg-config .pc files. By default the directory is
10090cfee914Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
10100cfee914Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
10110cfee914Smrgdnl parameter.
10120cfee914SmrgAC_DEFUN([PKG_INSTALLDIR],
10130cfee914Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
10140cfee914Smrgm4_pushdef([pkg_description],
10150cfee914Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
10160cfee914SmrgAC_ARG_WITH([pkgconfigdir],
10170cfee914Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
10180cfee914Smrg    [with_pkgconfigdir=]pkg_default)
10190cfee914SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
10200cfee914Smrgm4_popdef([pkg_default])
10210cfee914Smrgm4_popdef([pkg_description])
10220cfee914Smrg])dnl PKG_INSTALLDIR
10230cfee914Smrg
10240cfee914Smrg
10250cfee914Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
10260cfee914Smrgdnl --------------------------------
10270cfee914Smrgdnl Since: 0.27
10280cfee914Smrgdnl
10290cfee914Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
10300cfee914Smrgdnl module should install arch-independent pkg-config .pc files. By
10310cfee914Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
10320cfee914Smrgdnl changed by passing DIRECTORY. The user can override through the
10330cfee914Smrgdnl --with-noarch-pkgconfigdir parameter.
10340cfee914SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
10350cfee914Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
10360cfee914Smrgm4_pushdef([pkg_description],
10370cfee914Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
10380cfee914SmrgAC_ARG_WITH([noarch-pkgconfigdir],
10390cfee914Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
10400cfee914Smrg    [with_noarch_pkgconfigdir=]pkg_default)
10410cfee914SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
10420cfee914Smrgm4_popdef([pkg_default])
10430cfee914Smrgm4_popdef([pkg_description])
10440cfee914Smrg])dnl PKG_NOARCH_INSTALLDIR
10450cfee914Smrg
10460cfee914Smrg
10470cfee914Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
10480cfee914Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10490cfee914Smrgdnl -------------------------------------------
10500cfee914Smrgdnl Since: 0.28
10510cfee914Smrgdnl
10520cfee914Smrgdnl Retrieves the value of the pkg-config variable for the given module.
10530cfee914SmrgAC_DEFUN([PKG_CHECK_VAR],
10540cfee914Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
10550cfee914SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
10560cfee914Smrg
10570cfee914Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
10580cfee914SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
10590cfee914Smrg
10600cfee914SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
10610cfee914Smrg])dnl PKG_CHECK_VAR
10620cfee914Smrg
10630cfee914Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
10640cfee914Smrgdnl
10650cfee914Smrgdnl This file comes from X.Org's font-util 1.4.0
10660cfee914Smrgdnl
10670cfee914Smrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
10680cfee914Smrgdnl
10690cfee914Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
10700cfee914Smrgdnl copy of this software and associated documentation files (the "Software"),
107127268fb8Smrgdnl to deal in the Software without restriction, including without limitation
107227268fb8Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
107327268fb8Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
107427268fb8Smrgdnl Software is furnished to do so, subject to the following conditions:
107527268fb8Smrgdnl
107627268fb8Smrgdnl The above copyright notice and this permission notice (including the next
107727268fb8Smrgdnl paragraph) shall be included in all copies or substantial portions of the
107827268fb8Smrgdnl Software.
107927268fb8Smrgdnl
108027268fb8Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
108127268fb8Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
108227268fb8Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
108327268fb8Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
108427268fb8Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
108527268fb8Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
108627268fb8Smrgdnl DEALINGS IN THE SOFTWARE.
10870cfee914Smrgdnl
10880cfee914Smrgdnl --------------------------------------------------------------------
10890cfee914Smrgdnl
10900cfee914Smrgdnl Copyright 2005 Red Hat, Inc
10910cfee914Smrgdnl
10920cfee914Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
10930cfee914Smrgdnl documentation for any purpose is hereby granted without fee, provided that
10940cfee914Smrgdnl the above copyright notice appear in all copies and that both that
10950cfee914Smrgdnl copyright notice and this permission notice appear in supporting
10960cfee914Smrgdnl documentation.
10970cfee914Smrgdnl
10980cfee914Smrgdnl The above copyright notice and this permission notice shall be included
10990cfee914Smrgdnl in all copies or substantial portions of the Software.
11000cfee914Smrgdnl
11010cfee914Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
11020cfee914Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11030cfee914Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
11040cfee914Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
11050cfee914Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
11060cfee914Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
11070cfee914Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
11080cfee914Smrgdnl
11090cfee914Smrgdnl Except as contained in this notice, the name of the copyright holders shall
11100cfee914Smrgdnl not be used in advertising or otherwise to promote the sale, use or
11110cfee914Smrgdnl other dealings in this Software without prior written authorization
11120cfee914Smrgdnl from the copyright holders.
1113f4959950Smrg
11140cfee914Smrg# XORG_FONT_MACROS_VERSION(required-version)
11150cfee914Smrg# ------------------------------------------
111627268fb8Smrg# Minimum version: 1.1.0
1117f4959950Smrg#
111827268fb8Smrg# If you're using a macro added in Version 1.1 or newer, include this in
111927268fb8Smrg# your configure.ac with the minimum required version, such as:
11200cfee914Smrg# XORG_FONT_MACROS_VERSION(1.1)
112127268fb8Smrg#
112227268fb8Smrg# To ensure that this macro is defined, also add:
11230cfee914Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
11240cfee914Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
112527268fb8Smrg#
112627268fb8Smrg#
11270cfee914Smrg# See the "minimum version" comment for each macro you use to see what
112827268fb8Smrg# version you require.
11290cfee914Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
11300cfee914Smrgm4_define([vers_have], [1.4.0])
113127268fb8Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
113227268fb8Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
113327268fb8Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
11340cfee914Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
113527268fb8Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
11360cfee914Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
113727268fb8Smrgm4_undefine([vers_have])
113827268fb8Smrgm4_undefine([maj_have])
113927268fb8Smrgm4_undefine([maj_needed])
11400cfee914Smrg]) # XORG_FONT_MACROS_VERSION
1141f4959950Smrg
11420cfee914Smrg# XORG_FONT_CHECK_{maps}()
11430cfee914Smrg# ------------------------
114427268fb8Smrg# Minimum version: 1.0.0
11450cfee914Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
11460cfee914Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
11470cfee914Smrg
11480cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
11490cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
11500cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
11510cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
11520cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
11530cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
11540cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
11550cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
11560cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
11570cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
11580cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
11590cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
11600cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
11610cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
11620cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
11630cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
11640cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
11650cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
11660cfee914Smrg
11670cfee914Smrg# XORG_FONT_CHECK_ENCODING(encoding)
11680cfee914Smrg# ----------------------------------
11690cfee914Smrg# Minimum version: 1.1.0
11700cfee914Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
11710cfee914Smrg# It replaced individual copies of this code in the above macros in 1.1.
11720cfee914Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
11730cfee914Smrg# calls if this is not true in the future.
11740cfee914Smrg
11750cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
11760cfee914Smrg	AC_ARG_ENABLE(m4_tolower($1),
11770cfee914Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
11780cfee914Smrg				[Build $1 fonts (default: yes)]),
11790cfee914Smrg		[AS_TR_SH($1)=$enableval])
11800cfee914Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
11810cfee914Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
11820cfee914Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
11830cfee914Smrg]) # XORG_FONT_CHECK_ENCODING
11840cfee914Smrg
11850cfee914Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
11860cfee914Smrg# -----------------------------------------------------
11870cfee914Smrg# Minimum version: 1.1.0
11880cfee914Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
11890cfee914Smrg# Add a shorthand --enable/disable-all-encodings option.
11900cfee914Smrg
11910cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
11920cfee914Smrg	AC_ARG_ENABLE([all-encodings],
11930cfee914Smrg		AS_HELP_STRING([--disable-all-encodings],
11940cfee914Smrg				[Disable building of all font encodings]),
11950cfee914Smrg		[m4_foreach_w([enc], [$1], [
11960cfee914Smrg			AS_TR_SH(enc)=$enableval
11970cfee914Smrg		])],
11980cfee914Smrg		[m4_foreach_w([enc], [$1], [
11990cfee914Smrg			AS_TR_SH(enc)=yes
12000cfee914Smrg		])])
12010cfee914Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
12020cfee914Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
12030cfee914Smrg
12040cfee914Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
12050cfee914Smrg# ------------------------------------------
12060cfee914Smrg# Minimum version: 1.1.0
12070cfee914Smrg#
12080cfee914Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
120927268fb8Smrg#
121027268fb8Smrg
12110cfee914SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
12120cfee914Smrg	AC_PATH_PROG($1, $2)
12130cfee914Smrg	if test x"$$1" = x; then
12140cfee914Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
121527268fb8Smrg	fi
12160cfee914Smrg])
121727268fb8Smrg
12180cfee914Smrg
12190cfee914Smrg# XORG_FONT_FCCACHE()
12200cfee914Smrg# -------------------
12210cfee914Smrg# Minimum version: 1.1.0
12220cfee914Smrg#
12230cfee914Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
12240cfee914Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
12250cfee914Smrg# to run fc-cache if found and not installing to $DESTDIR and not
12260cfee914Smrg# cross-compiling
12270cfee914Smrg#
12280cfee914Smrg# fc-cache is optional, not required, and should be skipped when making
12290cfee914Smrg# packages (installing to $DESTDIR) or cross-compiling
12300cfee914Smrg#
12310cfee914SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
12320cfee914Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
12330cfee914Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
12340cfee914Smrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
12350cfee914Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
123627268fb8Smrg	else
12370cfee914Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
12380cfee914Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
123927268fb8Smrg	fi
12400cfee914Smrg	AC_SUBST([RUN_FCCACHE])
12410cfee914Smrg])
1242f4959950Smrg
12430cfee914Smrg# XORG_FONT_MKFONTDIR()
12440cfee914Smrg# -------------------
12450cfee914Smrg# Minimum version: 1.3.0
1246f4959950Smrg#
12470cfee914Smrg# Set MKFONTDIR to path to mkfontdir.
12480cfee914Smrg#
12490cfee914Smrg# If cross-compiling, and if mkdir is not found, use a shell command
12500cfee914Smrg# which warns mkfontdir needs to be run on the target
12510cfee914Smrg#
12520cfee914Smrg# If not cross-compiling, mkfontdir must be found
12530cfee914Smrg#
12540cfee914SmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
12550cfee914Smrg	if test x"$cross_compiling" != x"no" ; then
12560cfee914Smrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
12570cfee914Smrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
1258f4959950Smrg
12590cfee914Smrg		if test x"$MKFONTDIR" = x; then
12600cfee914Smrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
12610cfee914Smrg		fi
12620cfee914Smrg	else
12630cfee914Smrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
12640cfee914Smrg	fi
1265f4959950Smrg
12660cfee914Smrg	AC_SUBST([MKFONTDIR])
12670cfee914Smrg])
1268f4959950Smrg
12690cfee914Smrg# XORG_FONT_COMMON_UTILS()
12700cfee914Smrg# ------------------------
12710cfee914Smrg# Minimum version: 1.1.0
12720cfee914Smrg#
12730cfee914Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
1274f4959950Smrg
12750cfee914SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
12760cfee914Smrg	XORG_FONT_FCCACHE
12770cfee914Smrg	XORG_FONT_MKFONTDIR
12780cfee914Smrg])
1279f4959950Smrg
12800cfee914Smrg# XORG_FONT_SCALED_UTILS()
12810cfee914Smrg# ------------------------
12820cfee914Smrg# Minimum version: 1.1.0
12830cfee914Smrg#
12840cfee914Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
12850cfee914Smrg# (TrueType, OpenType, Type1)
1286f4959950Smrg
12870cfee914SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
12880cfee914Smrg	XORG_FONT_COMMON_UTILS
12890cfee914Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
12900cfee914Smrg])
1291f4959950Smrg
12920cfee914Smrg# XORG_FONT_BDF_UTILS()
12930cfee914Smrg# ---------------------
12940cfee914Smrg# Minimum version: 1.1.0
12950cfee914Smrg#
12960cfee914Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
12970cfee914Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
12980cfee914Smrg# PCF output files created by bdftopcf
1299f4959950Smrg
13000cfee914SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
13010cfee914Smrg	XORG_FONT_COMMON_UTILS
13020cfee914Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
13030cfee914Smrg	XORG_FONT_CHECK_COMPRESSION
13040cfee914Smrg])
1305f4959950Smrg
13060cfee914Smrg# XORG_FONT_CHECK_COMPRESSION()
13070cfee914Smrg# -----------------------------
13080cfee914Smrg# Minimum version: 1.1.0
130927268fb8Smrg#
13100cfee914Smrg# Offer a --with-compression flag to control what compression method is
13110cfee914Smrg# used for pcf font files.   Offers all the methods currently supported
13120cfee914Smrg# by libXfont, including no compression.
13130cfee914Smrg#
13140cfee914Smrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
13150cfee914Smrg# for reproducible builds, such as gzip -n to not record timestamp, will
13160cfee914Smrg# set COMPRESS_FLAGS to those options.
1317f4959950Smrg
13180cfee914SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
13190cfee914Smrg	AC_MSG_CHECKING([font compression method])
13200cfee914Smrg	AC_ARG_WITH(compression,
13210cfee914Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
13220cfee914Smrg			 [compression method to use on pcf fonts])],
13230cfee914Smrg         [compression="$withval"], [compression="yes"])
13240cfee914Smrg	if test x"$compression" = "xyes" ; then
13250cfee914Smrg		compression="gzip"
13260cfee914Smrg	fi
13270cfee914Smrg	AC_MSG_RESULT([${compression}])
13280cfee914Smrg	case ${compression} in
13290cfee914Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
13300cfee914Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
13310cfee914Smrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
13320cfee914Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
13330cfee914Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
13340cfee914Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
13350cfee914Smrg	esac
13360cfee914Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
13370cfee914Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
13380cfee914Smrg	fi
13390cfee914Smrg	AC_MSG_CHECKING([options to font compression command])
13400cfee914Smrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
13410cfee914Smrg	AC_SUBST([COMPRESS_FLAGS])
13420cfee914Smrg	AC_SUBST([COMPRESS_SUFFIX])
13430cfee914Smrg])
134427268fb8Smrg
13450cfee914Smrg# XORG_FONT_UCS2ANY()
134627268fb8Smrg# -------------------
13470cfee914Smrg# Minimum version: 1.1.0
1348f4959950Smrg#
13490cfee914Smrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
13500cfee914Smrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
13510cfee914Smrg# Also call pkg-config to find the directory with the encoding files needed
13520cfee914Smrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
1353f4959950Smrg
13540cfee914SmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
13550cfee914Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
13560cfee914Smrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
13570cfee914Smrg	PKG_CHECK_MODULES(MAPS, [fontutil])
13580cfee914Smrg	AC_MSG_CHECKING([for ucs2any encoding data files])
13590cfee914Smrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
13600cfee914Smrg	AC_SUBST(MAPFILES_PATH)
13610cfee914Smrg	AC_MSG_RESULT([${MAPFILES_PATH}])
13620cfee914Smrg])
1363f4959950Smrg
1364f4959950Smrg
1365f4959950Smrg
13660cfee914Smrg# XORG_FONT_FC_CONFDIR()
13670cfee914Smrg# --------------------
13680cfee914Smrg# Minimum version: 1.2.0
13690cfee914Smrg#
13700cfee914Smrg# Sets FC_CONFDIR to the fontconfig config directory
13710cfee914Smrg# (which should be --with-confdir=... when building fontconfig)
13720cfee914Smrg# found from:
13730cfee914Smrg#	--with-fc-confdir=...
13740cfee914Smrg#	pkg-config --variable=confdir fontconfig
13750cfee914Smrg#	${sysconfdir}/fonts
137627268fb8Smrg
13770cfee914SmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
13780cfee914Smrg	dnl Ensure $PKG_CONFIG is set first
13790cfee914Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
138027268fb8Smrg
13810cfee914Smrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
13820cfee914Smrg	AC_ARG_WITH(fc-confdir,
13830cfee914Smrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
13840cfee914Smrg			   [Path to fontconfig's configuration directory]),
13850cfee914Smrg		    [FC_CONFDIR="$withval"])
13860cfee914Smrg	# if --with-fc-confdir was not specified
13870cfee914Smrg	if test "x${FC_CONFDIR}" = "x"; then
13880cfee914Smrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
13890cfee914Smrg	fi
13900cfee914Smrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
13910cfee914Smrg	if test "x${FC_CONFDIR}" = "x"; then
13920cfee914Smrg		FC_CONFDIR="${sysconfdir}/fonts"
13930cfee914Smrg	fi
13940cfee914Smrg	AC_SUBST(FC_CONFDIR)
13950cfee914Smrg	AC_MSG_RESULT([${FC_CONFDIR}])
13960cfee914Smrg])
139727268fb8Smrg
1398f4959950Smrg
139927268fb8Smrg
14000cfee914Smrg# XORG_FONTROOTDIR()
14010cfee914Smrg# --------------------
14020cfee914Smrg# Minimum version: 1.1.0
14030cfee914Smrg#
14040cfee914Smrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
14050cfee914Smrg# found from:
14060cfee914Smrg#	--with-fontrootdir
14070cfee914Smrg#	pkg-config --variable=fontrootdir fontutil
14080cfee914Smrg#	${datadir}/fonts/X11
140927268fb8Smrg
14100cfee914SmrgAC_DEFUN([XORG_FONTROOTDIR],[
14110cfee914Smrg	dnl Ensure $PKG_CONFIG is set first
14120cfee914Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
141327268fb8Smrg
14140cfee914Smrg	AC_MSG_CHECKING([for root directory for font files])
14150cfee914Smrg	AC_ARG_WITH(fontrootdir,
14160cfee914Smrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
14170cfee914Smrg			   [Path to root directory for font files]),
14180cfee914Smrg		    [FONTROOTDIR="$withval"])
14190cfee914Smrg	# if --with-fontrootdir not specified...
14200cfee914Smrg	if test "x${FONTROOTDIR}" = "x"; then
14210cfee914Smrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
14220cfee914Smrg	fi
14230cfee914Smrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
14240cfee914Smrg	if test "x${FONTROOTDIR}" = "x"; then
14250cfee914Smrg		FONTROOTDIR="${datadir}/fonts/X11"
14260cfee914Smrg	fi
14270cfee914Smrg	AC_SUBST(FONTROOTDIR)
14280cfee914Smrg	AC_MSG_RESULT([${FONTROOTDIR}])
14290cfee914Smrg])
143027268fb8Smrg
14310cfee914Smrg# XORG_FONTSUBDIR(variable, flag, subdir)
14320cfee914Smrg# ---------------------------------------
14330cfee914Smrg# Minimum version: 1.1.0
1434f4959950Smrg#
14350cfee914Smrg# Offer a --with-<flag> flag to control directory for font installation
14360cfee914Smrg# Default is the specified <subdir> of the font root directory.
14370cfee914Smrg# Sets <variable> to the selected directory
1438f4959950Smrg
14390cfee914SmrgAC_DEFUN([XORG_FONTSUBDIR],[
14400cfee914Smrg	AC_REQUIRE([XORG_FONTROOTDIR])
1441f4959950Smrg
14420cfee914Smrg	AC_MSG_CHECKING([for directory for $3 files])
14430cfee914Smrg	AC_ARG_WITH($2,
14440cfee914Smrg		    [AS_HELP_STRING([--with-$2=DIR],
14450cfee914Smrg				    [Path to $3 files [FONTROOTDIR/$3]])],
14460cfee914Smrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
14470cfee914Smrg	AC_SUBST($1)
14480cfee914Smrg	AC_MSG_RESULT([${$1}])
14490cfee914Smrg]) # XORG_FONTSUBDIR
1450f4959950Smrg
14510cfee914Smrg# XORG_FONTDIR(subdir)
14520cfee914Smrg# --------------------
14530cfee914Smrg# Minimum version: 1.1.0
14540cfee914Smrg#
14550cfee914Smrg# Offer a --with-fontdir flag to control directory for font installation
14560cfee914Smrg# Default is the specified subdir of the font root directory.
14570cfee914Smrg# Sets FONTDIR to the selected directory
1458f4959950Smrg
14590cfee914SmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
146027268fb8Smrg
14610cfee914Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14620cfee914Smrgdnl
14630cfee914Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
14640cfee914Smrgdnl
14650cfee914Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14660cfee914Smrgdnl copy of this software and associated documentation files (the "Software"),
14670cfee914Smrgdnl to deal in the Software without restriction, including without limitation
14680cfee914Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14690cfee914Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
14700cfee914Smrgdnl Software is furnished to do so, subject to the following conditions:
14710cfee914Smrgdnl
14720cfee914Smrgdnl The above copyright notice and this permission notice (including the next
14730cfee914Smrgdnl paragraph) shall be included in all copies or substantial portions of the
14740cfee914Smrgdnl Software.
14750cfee914Smrgdnl
14760cfee914Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14770cfee914Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14780cfee914Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14790cfee914Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14800cfee914Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14810cfee914Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14820cfee914Smrgdnl DEALINGS IN THE SOFTWARE.
148327268fb8Smrg
14840cfee914Smrg# XORG_MACROS_VERSION(required-version)
14850cfee914Smrg# -------------------------------------
14860cfee914Smrg# Minimum version: 1.1.0
1487f4959950Smrg#
14880cfee914Smrg# If you're using a macro added in Version 1.1 or newer, include this in
14890cfee914Smrg# your configure.ac with the minimum required version, such as:
14900cfee914Smrg# XORG_MACROS_VERSION(1.1)
1491f4959950Smrg#
14920cfee914Smrg# To ensure that this macro is defined, also add:
14930cfee914Smrg# m4_ifndef([XORG_MACROS_VERSION],
14940cfee914Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
149527268fb8Smrg#
149627268fb8Smrg#
14970cfee914Smrg# See the "minimum version" comment for each macro you use to see what
14980cfee914Smrg# version you require.
14990cfee914Smrgm4_defun([XORG_MACROS_VERSION],[
15000cfee914Smrgm4_define([vers_have], [1.20.0])
15010cfee914Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
15020cfee914Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
15030cfee914Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
15040cfee914Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
15050cfee914Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
15060cfee914Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
15070cfee914Smrgm4_undefine([vers_have])
15080cfee914Smrgm4_undefine([maj_have])
15090cfee914Smrgm4_undefine([maj_needed])
15100cfee914Smrg]) # XORG_MACROS_VERSION
15110cfee914Smrg
15120cfee914Smrg# XORG_PROG_RAWCPP()
15130cfee914Smrg# ------------------
15140cfee914Smrg# Minimum version: 1.0.0
151527268fb8Smrg#
15160cfee914Smrg# Find cpp program and necessary flags for use in pre-processing text files
15170cfee914Smrg# such as man pages and config files
15180cfee914SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
15190cfee914SmrgAC_REQUIRE([AC_PROG_CPP])
15200cfee914SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
15210cfee914Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1522f4959950Smrg
15230cfee914Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
15240cfee914Smrg# which is not the best choice for supporting other OS'es, but covers most
15250cfee914Smrg# of the ones we need for now.
15260cfee914SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
15270cfee914SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
15280cfee914Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15290cfee914Smrg	AC_MSG_RESULT([no])
153027268fb8Smrgelse
15310cfee914Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15320cfee914Smrg		RAWCPPFLAGS=-undef
15330cfee914Smrg		AC_MSG_RESULT([yes])
15340cfee914Smrg	# under Cygwin unix is still defined even with -undef
15350cfee914Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15360cfee914Smrg		RAWCPPFLAGS="-undef -ansi"
15370cfee914Smrg		AC_MSG_RESULT([yes, with -ansi])
15380cfee914Smrg	else
15390cfee914Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15400cfee914Smrg	fi
154127268fb8Smrgfi
15420cfee914Smrgrm -f conftest.$ac_ext
1543f4959950Smrg
15440cfee914SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15450cfee914SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15460cfee914Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15470cfee914Smrg	AC_MSG_RESULT([no])
15480cfee914Smrgelse
15490cfee914Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15500cfee914Smrg		TRADITIONALCPPFLAGS="-traditional"
15510cfee914Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15520cfee914Smrg		AC_MSG_RESULT([yes])
15530cfee914Smrg	else
15540cfee914Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15550cfee914Smrg	fi
15560cfee914Smrgfi
15570cfee914Smrgrm -f conftest.$ac_ext
15580cfee914SmrgAC_SUBST(RAWCPPFLAGS)
15590cfee914SmrgAC_SUBST(TRADITIONALCPPFLAGS)
15600cfee914Smrg]) # XORG_PROG_RAWCPP
1561f4959950Smrg
15620cfee914Smrg# XORG_MANPAGE_SECTIONS()
15630cfee914Smrg# -----------------------
15640cfee914Smrg# Minimum version: 1.0.0
1565f4959950Smrg#
15660cfee914Smrg# Determine which sections man pages go in for the different man page types
15670cfee914Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15680cfee914Smrg# Not sure if there's any better way than just hardcoding by OS name.
15690cfee914Smrg# Override default settings by setting environment variables
15700cfee914Smrg# Added MAN_SUBSTS in version 1.8
15710cfee914Smrg# Added AC_PROG_SED in version 1.8
1572f4959950Smrg
15730cfee914SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15740cfee914SmrgAC_REQUIRE([AC_CANONICAL_HOST])
15750cfee914SmrgAC_REQUIRE([AC_PROG_SED])
1576f4959950Smrg
15770cfee914Smrgcase $host_os in
15780cfee914Smrg    solaris*)
15790cfee914Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15800cfee914Smrg        # check for a man page file found in later versions that use
15810cfee914Smrg        # traditional section numbers instead
15820cfee914Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15830cfee914Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15840cfee914Smrg        ;;
15850cfee914Smrg    *) SYSV_MAN_SECTIONS=false ;;
15860cfee914Smrgesac
1587f4959950Smrg
15880cfee914Smrgif test x$APP_MAN_SUFFIX = x    ; then
15890cfee914Smrg    APP_MAN_SUFFIX=1
15900cfee914Smrgfi
15910cfee914Smrgif test x$APP_MAN_DIR = x    ; then
15920cfee914Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
159327268fb8Smrgfi
1594f4959950Smrg
15950cfee914Smrgif test x$LIB_MAN_SUFFIX = x    ; then
15960cfee914Smrg    LIB_MAN_SUFFIX=3
15970cfee914Smrgfi
15980cfee914Smrgif test x$LIB_MAN_DIR = x    ; then
15990cfee914Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
16000cfee914Smrgfi
1601f4959950Smrg
16020cfee914Smrgif test x$FILE_MAN_SUFFIX = x    ; then
16030cfee914Smrg    case $SYSV_MAN_SECTIONS in
16040cfee914Smrg	true)				FILE_MAN_SUFFIX=4  ;;
16050cfee914Smrg	*)				FILE_MAN_SUFFIX=5  ;;
16060cfee914Smrg    esac
16070cfee914Smrgfi
16080cfee914Smrgif test x$FILE_MAN_DIR = x    ; then
16090cfee914Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
161027268fb8Smrgfi
1611f4959950Smrg
16120cfee914Smrgif test x$MISC_MAN_SUFFIX = x    ; then
16130cfee914Smrg    case $SYSV_MAN_SECTIONS in
16140cfee914Smrg	true)				MISC_MAN_SUFFIX=5  ;;
16150cfee914Smrg	*)				MISC_MAN_SUFFIX=7  ;;
16160cfee914Smrg    esac
16170cfee914Smrgfi
16180cfee914Smrgif test x$MISC_MAN_DIR = x    ; then
16190cfee914Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
162027268fb8Smrgfi
1621f4959950Smrg
16220cfee914Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
16230cfee914Smrg    case $SYSV_MAN_SECTIONS in
16240cfee914Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
16250cfee914Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
16260cfee914Smrg    esac
16270cfee914Smrgfi
16280cfee914Smrgif test x$DRIVER_MAN_DIR = x    ; then
16290cfee914Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
163027268fb8Smrgfi
1631f4959950Smrg
16320cfee914Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
16330cfee914Smrg    case $SYSV_MAN_SECTIONS in
16340cfee914Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16350cfee914Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16360cfee914Smrg    esac
16370cfee914Smrgfi
16380cfee914Smrgif test x$ADMIN_MAN_DIR = x    ; then
16390cfee914Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16400cfee914Smrgfi
1641f4959950Smrg
1642f4959950Smrg
16430cfee914SmrgAC_SUBST([APP_MAN_SUFFIX])
16440cfee914SmrgAC_SUBST([LIB_MAN_SUFFIX])
16450cfee914SmrgAC_SUBST([FILE_MAN_SUFFIX])
16460cfee914SmrgAC_SUBST([MISC_MAN_SUFFIX])
16470cfee914SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16480cfee914SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16490cfee914SmrgAC_SUBST([APP_MAN_DIR])
16500cfee914SmrgAC_SUBST([LIB_MAN_DIR])
16510cfee914SmrgAC_SUBST([FILE_MAN_DIR])
16520cfee914SmrgAC_SUBST([MISC_MAN_DIR])
16530cfee914SmrgAC_SUBST([DRIVER_MAN_DIR])
16540cfee914SmrgAC_SUBST([ADMIN_MAN_DIR])
1655f4959950Smrg
16560cfee914SmrgXORG_MAN_PAGE="X Version 11"
16570cfee914SmrgAC_SUBST([XORG_MAN_PAGE])
16580cfee914SmrgMAN_SUBSTS="\
16590cfee914Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16600cfee914Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16610cfee914Smrg	-e 's|__xservername__|Xorg|g' \
16620cfee914Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
16630cfee914Smrg	-e 's|__projectroot__|\$(prefix)|g' \
16640cfee914Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16650cfee914Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16660cfee914Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16670cfee914Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16680cfee914Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16690cfee914Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16700cfee914Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16710cfee914SmrgAC_SUBST([MAN_SUBSTS])
16720cfee914Smrg
16730cfee914Smrg]) # XORG_MANPAGE_SECTIONS
16740cfee914Smrg
16750cfee914Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16760cfee914Smrg# ------------------------
16770cfee914Smrg# Minimum version: 1.7.0
1678f4959950Smrg#
16790cfee914Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16800cfee914Smrg# provided by xorg-sgml-doctools, if installed.
16810cfee914SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16820cfee914SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16830cfee914SmrgXORG_SGML_PATH=
16840cfee914SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16850cfee914Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16860cfee914Smrg    [m4_ifval([$1],[:],
16870cfee914Smrg        [if test x"$cross_compiling" != x"yes" ; then
16880cfee914Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16890cfee914Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16900cfee914Smrg         fi])
16910cfee914Smrg    ])
1692f4959950Smrg
16930cfee914Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16940cfee914Smrg# the path and the name of the doc stylesheet
16950cfee914Smrgif test "x$XORG_SGML_PATH" != "x" ; then
16960cfee914Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16970cfee914Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16980cfee914Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1699f4959950Smrgelse
17000cfee914Smrg   AC_MSG_RESULT([no])
1701f4959950Smrgfi
1702f4959950Smrg
17030cfee914SmrgAC_SUBST(XORG_SGML_PATH)
17040cfee914SmrgAC_SUBST(STYLESHEET_SRCDIR)
17050cfee914SmrgAC_SUBST(XSL_STYLESHEET)
17060cfee914SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
17070cfee914Smrg]) # XORG_CHECK_SGML_DOCTOOLS
17080cfee914Smrg
17090cfee914Smrg# XORG_CHECK_LINUXDOC
17100cfee914Smrg# -------------------
17110cfee914Smrg# Minimum version: 1.0.0
171227268fb8Smrg#
17130cfee914Smrg# Defines the variable MAKE_TEXT if the necessary tools and
17140cfee914Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
17150cfee914Smrg# Whether or not the necessary tools and files are found can be checked
17160cfee914Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
17170cfee914SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
17180cfee914SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17190cfee914SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
17200cfee914Smrg
17210cfee914SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
17220cfee914Smrg
172327268fb8SmrgAC_MSG_CHECKING([whether to build documentation])
1724f4959950Smrg
17250cfee914Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
17260cfee914Smrg   BUILDDOC=yes
17270cfee914Smrgelse
17280cfee914Smrg   BUILDDOC=no
17290cfee914Smrgfi
1730f4959950Smrg
17310cfee914SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1732f4959950Smrg
17330cfee914SmrgAC_MSG_RESULT([$BUILDDOC])
17340cfee914Smrg
17350cfee914SmrgAC_MSG_CHECKING([whether to build pdf documentation])
17360cfee914Smrg
17370cfee914Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17380cfee914Smrg   BUILDPDFDOC=yes
17390cfee914Smrgelse
17400cfee914Smrg   BUILDPDFDOC=no
17410cfee914Smrgfi
17420cfee914Smrg
17430cfee914SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17440cfee914Smrg
17450cfee914SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17460cfee914Smrg
17470cfee914SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17480cfee914SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17490cfee914SmrgMAKE_PDF="$PS2PDF"
17500cfee914SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17510cfee914Smrg
17520cfee914SmrgAC_SUBST(MAKE_TEXT)
17530cfee914SmrgAC_SUBST(MAKE_PS)
17540cfee914SmrgAC_SUBST(MAKE_PDF)
17550cfee914SmrgAC_SUBST(MAKE_HTML)
17560cfee914Smrg]) # XORG_CHECK_LINUXDOC
17570cfee914Smrg
17580cfee914Smrg# XORG_CHECK_DOCBOOK
17590cfee914Smrg# -------------------
176027268fb8Smrg# Minimum version: 1.0.0
176127268fb8Smrg#
17620cfee914Smrg# Checks for the ability to build output formats from SGML DocBook source.
17630cfee914Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17640cfee914Smrg# indicates whether the necessary tools and files are found and, if set,
17650cfee914Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17660cfee914SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17670cfee914SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1768f4959950Smrg
17690cfee914SmrgBUILDTXTDOC=no
17700cfee914SmrgBUILDPDFDOC=no
17710cfee914SmrgBUILDPSDOC=no
17720cfee914SmrgBUILDHTMLDOC=no
17730cfee914Smrg
17740cfee914SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17750cfee914SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17760cfee914SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17770cfee914SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17780cfee914Smrg
17790cfee914SmrgAC_MSG_CHECKING([whether to build text documentation])
17800cfee914Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17810cfee914Smrg   test x$BUILD_TXTDOC != xno; then
17820cfee914Smrg	BUILDTXTDOC=yes
1783f4959950Smrgfi
17840cfee914SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17850cfee914SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1786f4959950Smrg
17870cfee914SmrgAC_MSG_CHECKING([whether to build PDF documentation])
17880cfee914Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17890cfee914Smrg   test x$BUILD_PDFDOC != xno; then
17900cfee914Smrg	BUILDPDFDOC=yes
1791f4959950Smrgfi
17920cfee914SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17930cfee914SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1794f4959950Smrg
17950cfee914SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17960cfee914Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17970cfee914Smrg   test x$BUILD_PSDOC != xno; then
17980cfee914Smrg	BUILDPSDOC=yes
17990cfee914Smrgfi
18000cfee914SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
18010cfee914SmrgAC_MSG_RESULT([$BUILDPSDOC])
1802f4959950Smrg
18030cfee914SmrgAC_MSG_CHECKING([whether to build HTML documentation])
18040cfee914Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
18050cfee914Smrg   test x$BUILD_HTMLDOC != xno; then
18060cfee914Smrg	BUILDHTMLDOC=yes
18070cfee914Smrgfi
18080cfee914SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
18090cfee914SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
18100cfee914Smrg
18110cfee914SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
18120cfee914SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
18130cfee914SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
18140cfee914SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
18150cfee914Smrg
18160cfee914SmrgAC_SUBST(MAKE_TEXT)
18170cfee914SmrgAC_SUBST(MAKE_PS)
18180cfee914SmrgAC_SUBST(MAKE_PDF)
18190cfee914SmrgAC_SUBST(MAKE_HTML)
18200cfee914Smrg]) # XORG_CHECK_DOCBOOK
18210cfee914Smrg
18220cfee914Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
182327268fb8Smrg# ----------------
18240cfee914Smrg# Minimum version: 1.5.0
18250cfee914Smrg# Minimum version for optional DEFAULT argument: 1.11.0
182627268fb8Smrg#
18270cfee914Smrg# Documentation tools are not always available on all platforms and sometimes
18280cfee914Smrg# not at the appropriate level. This macro enables a module to test for the
18290cfee914Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
18300cfee914Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
18310cfee914Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
18320cfee914Smrg# --with-xmlto assumes 'auto'.
183327268fb8Smrg#
183427268fb8Smrg# Interface to module:
18350cfee914Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18360cfee914Smrg# XMLTO:	returns the path of the xmlto program found
18370cfee914Smrg#		returns the path set by the user in the environment
18380cfee914Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18390cfee914Smrg#		'no' user instructs the module not to use xmlto
184027268fb8Smrg#
18410cfee914Smrg# Added in version 1.10.0
18420cfee914Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18430cfee914Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
184427268fb8Smrg#
18450cfee914Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
184627268fb8Smrg#
18470cfee914SmrgAC_DEFUN([XORG_WITH_XMLTO],[
18480cfee914SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18490cfee914Smrgm4_define([_defopt], m4_default([$2], [auto]))
18500cfee914SmrgAC_ARG_WITH(xmlto,
18510cfee914Smrg	AS_HELP_STRING([--with-xmlto],
18520cfee914Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18530cfee914Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18540cfee914Smrgm4_undefine([_defopt])
1855f4959950Smrg
18560cfee914Smrgif test "x$use_xmlto" = x"auto"; then
18570cfee914Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18580cfee914Smrg   if test "x$XMLTO" = "x"; then
18590cfee914Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18600cfee914Smrg	have_xmlto=no
18610cfee914Smrg   else
18620cfee914Smrg        have_xmlto=yes
186327268fb8Smrg   fi
18640cfee914Smrgelif test "x$use_xmlto" = x"yes" ; then
18650cfee914Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18660cfee914Smrg   if test "x$XMLTO" = "x"; then
18670cfee914Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18680cfee914Smrg   fi
18690cfee914Smrg   have_xmlto=yes
18700cfee914Smrgelif test "x$use_xmlto" = x"no" ; then
18710cfee914Smrg   if test "x$XMLTO" != "x"; then
18720cfee914Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
187327268fb8Smrg   fi
18740cfee914Smrg   have_xmlto=no
1875f4959950Smrgelse
18760cfee914Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1877f4959950Smrgfi
1878335e815aSmrg
18790cfee914Smrg# Test for a minimum version of xmlto, if provided.
18800cfee914Smrgm4_ifval([$1],
18810cfee914Smrg[if test "$have_xmlto" = yes; then
18820cfee914Smrg    # scrape the xmlto version
18830cfee914Smrg    AC_MSG_CHECKING([the xmlto version])
18840cfee914Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18850cfee914Smrg    AC_MSG_RESULT([$xmlto_version])
18860cfee914Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18870cfee914Smrg        [if test "x$use_xmlto" = xauto; then
18880cfee914Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18890cfee914Smrg            have_xmlto=no
18900cfee914Smrg        else
18910cfee914Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18920cfee914Smrg        fi])
18930cfee914Smrgfi])
1894335e815aSmrg
18950cfee914Smrg# Test for the ability of xmlto to generate a text target
189627268fb8Smrg#
18970cfee914Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18980cfee914Smrg# following test for empty XML docbook files.
18990cfee914Smrg# For compatibility reasons use the following empty XML docbook file and if
19000cfee914Smrg# it fails try it again with a non-empty XML file.
19010cfee914Smrghave_xmlto_text=no
19020cfee914Smrgcat > conftest.xml << "EOF"
19030cfee914SmrgEOF
19040cfee914SmrgAS_IF([test "$have_xmlto" = yes],
19050cfee914Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
19060cfee914Smrg             [have_xmlto_text=yes],
19070cfee914Smrg             [# Try it again with a non-empty XML file.
19080cfee914Smrg              cat > conftest.xml << "EOF"
19090cfee914Smrg<x></x>
19100cfee914SmrgEOF
19110cfee914Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
19120cfee914Smrg                    [have_xmlto_text=yes],
19130cfee914Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
19140cfee914Smrgrm -f conftest.xml
19150cfee914SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
19160cfee914SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
19170cfee914Smrg]) # XORG_WITH_XMLTO
1918f4959950Smrg
19190cfee914Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
19200cfee914Smrg# --------------------------------------------
19210cfee914Smrg# Minimum version: 1.12.0
19220cfee914Smrg# Minimum version for optional DEFAULT argument: 1.12.0
19230cfee914Smrg#
19240cfee914Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
19250cfee914Smrg# XML-based language used for the transformation of XML documents.
19260cfee914Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
19270cfee914Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
19280cfee914Smrg# The XSLT processor is often used as a standalone tool for transformations.
19290cfee914Smrg# It should not be assumed that this tool is used only to work with documnetation.
19300cfee914Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
19310cfee914Smrg#
19320cfee914Smrg# Interface to module:
19330cfee914Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19340cfee914Smrg# XSLTPROC:	 returns the path of the xsltproc program found
19350cfee914Smrg#		 returns the path set by the user in the environment
19360cfee914Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19370cfee914Smrg#		  'no' user instructs the module not to use xsltproc
19380cfee914Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19390cfee914Smrg#
19400cfee914Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19410cfee914Smrg#
19420cfee914SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19430cfee914SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19440cfee914Smrg# Preserves the interface, should it be implemented later
19450cfee914Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19460cfee914Smrgm4_define([_defopt], m4_default([$2], [auto]))
19470cfee914SmrgAC_ARG_WITH(xsltproc,
19480cfee914Smrg	AS_HELP_STRING([--with-xsltproc],
19490cfee914Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19500cfee914Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19510cfee914Smrgm4_undefine([_defopt])
1952f4959950Smrg
19530cfee914Smrgif test "x$use_xsltproc" = x"auto"; then
19540cfee914Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19550cfee914Smrg   if test "x$XSLTPROC" = "x"; then
19560cfee914Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19570cfee914Smrg	have_xsltproc=no
19580cfee914Smrg   else
19590cfee914Smrg        have_xsltproc=yes
196027268fb8Smrg   fi
19610cfee914Smrgelif test "x$use_xsltproc" = x"yes" ; then
19620cfee914Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19630cfee914Smrg   if test "x$XSLTPROC" = "x"; then
19640cfee914Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19650cfee914Smrg   fi
19660cfee914Smrg   have_xsltproc=yes
19670cfee914Smrgelif test "x$use_xsltproc" = x"no" ; then
19680cfee914Smrg   if test "x$XSLTPROC" != "x"; then
19690cfee914Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19700cfee914Smrg   fi
19710cfee914Smrg   have_xsltproc=no
19720cfee914Smrgelse
19730cfee914Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1974335e815aSmrgfi
1975335e815aSmrg
19760cfee914SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19770cfee914Smrg]) # XORG_WITH_XSLTPROC
1978335e815aSmrg
19790cfee914Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19800cfee914Smrg# ----------------------------------------
19810cfee914Smrg# Minimum version: 1.15.0
198227268fb8Smrg#
19830cfee914Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
19840cfee914Smrg# scanning arbitrary text files, extracting information from those text files,
19850cfee914Smrg# and printing reports based on that information.
198627268fb8Smrg#
19870cfee914Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
198827268fb8Smrg#
19890cfee914Smrg# Interface to module:
19900cfee914Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
19910cfee914Smrg# PERL:	     returns the path of the perl program found
19920cfee914Smrg#	     returns the path set by the user in the environment
19930cfee914Smrg# --with-perl: 'yes' user instructs the module to use perl
19940cfee914Smrg#	       'no' user instructs the module not to use perl
19950cfee914Smrg# have_perl: returns yes if perl found in PATH or no
19960cfee914Smrg#
19970cfee914Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19980cfee914Smrg#
19990cfee914SmrgAC_DEFUN([XORG_WITH_PERL],[
20000cfee914SmrgAC_ARG_VAR([PERL], [Path to perl command])
20010cfee914Smrg# Preserves the interface, should it be implemented later
20020cfee914Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
20030cfee914Smrgm4_define([_defopt], m4_default([$2], [auto]))
20040cfee914SmrgAC_ARG_WITH(perl,
20050cfee914Smrg	AS_HELP_STRING([--with-perl],
20060cfee914Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
20070cfee914Smrg	   [use_perl=$withval], [use_perl=]_defopt)
20080cfee914Smrgm4_undefine([_defopt])
2009335e815aSmrg
20100cfee914Smrgif test "x$use_perl" = x"auto"; then
20110cfee914Smrg   AC_PATH_PROG([PERL], [perl])
20120cfee914Smrg   if test "x$PERL" = "x"; then
20130cfee914Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
20140cfee914Smrg	have_perl=no
20150cfee914Smrg   else
20160cfee914Smrg        have_perl=yes
20170cfee914Smrg   fi
20180cfee914Smrgelif test "x$use_perl" = x"yes" ; then
20190cfee914Smrg   AC_PATH_PROG([PERL], [perl])
20200cfee914Smrg   if test "x$PERL" = "x"; then
20210cfee914Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
20220cfee914Smrg   fi
20230cfee914Smrg   have_perl=yes
20240cfee914Smrgelif test "x$use_perl" = x"no" ; then
20250cfee914Smrg   if test "x$PERL" != "x"; then
20260cfee914Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
20270cfee914Smrg   fi
20280cfee914Smrg   have_perl=no
20290cfee914Smrgelse
20300cfee914Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
203127268fb8Smrgfi
2032335e815aSmrg
20330cfee914SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20340cfee914Smrg]) # XORG_WITH_PERL
203527268fb8Smrg
20360cfee914Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
203727268fb8Smrg# ----------------
20380cfee914Smrg# Minimum version: 1.5.0
20390cfee914Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2040cf8f59bfSmrg#
20410cfee914Smrg# Documentation tools are not always available on all platforms and sometimes
20420cfee914Smrg# not at the appropriate level. This macro enables a module to test for the
20430cfee914Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20440cfee914Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
20450cfee914Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20460cfee914Smrg# --with-asciidoc assumes 'auto'.
2047cf8f59bfSmrg#
20480cfee914Smrg# Interface to module:
20490cfee914Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20500cfee914Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
20510cfee914Smrg#		 returns the path set by the user in the environment
20520cfee914Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20530cfee914Smrg#		  'no' user instructs the module not to use asciidoc
20540cfee914Smrg#
20550cfee914Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20560cfee914Smrg#
20570cfee914SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20580cfee914SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20590cfee914Smrgm4_define([_defopt], m4_default([$2], [auto]))
20600cfee914SmrgAC_ARG_WITH(asciidoc,
20610cfee914Smrg	AS_HELP_STRING([--with-asciidoc],
20620cfee914Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20630cfee914Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20640cfee914Smrgm4_undefine([_defopt])
2065cf8f59bfSmrg
20660cfee914Smrgif test "x$use_asciidoc" = x"auto"; then
20670cfee914Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20680cfee914Smrg   if test "x$ASCIIDOC" = "x"; then
20690cfee914Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20700cfee914Smrg	have_asciidoc=no
20710cfee914Smrg   else
20720cfee914Smrg        have_asciidoc=yes
20730cfee914Smrg   fi
20740cfee914Smrgelif test "x$use_asciidoc" = x"yes" ; then
20750cfee914Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20760cfee914Smrg   if test "x$ASCIIDOC" = "x"; then
20770cfee914Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20780cfee914Smrg   fi
20790cfee914Smrg   have_asciidoc=yes
20800cfee914Smrgelif test "x$use_asciidoc" = x"no" ; then
20810cfee914Smrg   if test "x$ASCIIDOC" != "x"; then
20820cfee914Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20830cfee914Smrg   fi
20840cfee914Smrg   have_asciidoc=no
20850cfee914Smrgelse
20860cfee914Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20870cfee914Smrgfi
20880cfee914Smrgm4_ifval([$1],
20890cfee914Smrg[if test "$have_asciidoc" = yes; then
20900cfee914Smrg    # scrape the asciidoc version
20910cfee914Smrg    AC_MSG_CHECKING([the asciidoc version])
20920cfee914Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20930cfee914Smrg    AC_MSG_RESULT([$asciidoc_version])
20940cfee914Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20950cfee914Smrg        [if test "x$use_asciidoc" = xauto; then
20960cfee914Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20970cfee914Smrg            have_asciidoc=no
20980cfee914Smrg        else
20990cfee914Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
21000cfee914Smrg        fi])
21010cfee914Smrgfi])
21020cfee914SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
21030cfee914Smrg]) # XORG_WITH_ASCIIDOC
2104cf8f59bfSmrg
21050cfee914Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
21060cfee914Smrg# -------------------------------------------
21070cfee914Smrg# Minimum version: 1.5.0
21080cfee914Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21090cfee914Smrg# Minimum version for optional DOT checking: 1.18.0
2110cf8f59bfSmrg#
21110cfee914Smrg# Documentation tools are not always available on all platforms and sometimes
21120cfee914Smrg# not at the appropriate level. This macro enables a module to test for the
21130cfee914Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21140cfee914Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
21150cfee914Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
21160cfee914Smrg# --with-doxygen assumes 'auto'.
2117cf8f59bfSmrg#
21180cfee914Smrg# Interface to module:
21190cfee914Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
21200cfee914Smrg# DOXYGEN:	 returns the path of the doxygen program found
21210cfee914Smrg#		 returns the path set by the user in the environment
21220cfee914Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
21230cfee914Smrg#		  'no' user instructs the module not to use doxygen
2124cf8f59bfSmrg#
21250cfee914Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2126cf8f59bfSmrg#
21270cfee914SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
21280cfee914SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
21290cfee914SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
21300cfee914Smrgm4_define([_defopt], m4_default([$2], [auto]))
21310cfee914SmrgAC_ARG_WITH(doxygen,
21320cfee914Smrg	AS_HELP_STRING([--with-doxygen],
21330cfee914Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21340cfee914Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21350cfee914Smrgm4_undefine([_defopt])
2136cf8f59bfSmrg
21370cfee914Smrgif test "x$use_doxygen" = x"auto"; then
21380cfee914Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21390cfee914Smrg   if test "x$DOXYGEN" = "x"; then
21400cfee914Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21410cfee914Smrg	have_doxygen=no
21420cfee914Smrg   else
21430cfee914Smrg        have_doxygen=yes
21440cfee914Smrg   fi
21450cfee914Smrgelif test "x$use_doxygen" = x"yes" ; then
21460cfee914Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21470cfee914Smrg   if test "x$DOXYGEN" = "x"; then
21480cfee914Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21490cfee914Smrg   fi
21500cfee914Smrg   have_doxygen=yes
21510cfee914Smrgelif test "x$use_doxygen" = x"no" ; then
21520cfee914Smrg   if test "x$DOXYGEN" != "x"; then
21530cfee914Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21540cfee914Smrg   fi
21550cfee914Smrg   have_doxygen=no
21560cfee914Smrgelse
21570cfee914Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
21580cfee914Smrgfi
21590cfee914Smrgm4_ifval([$1],
21600cfee914Smrg[if test "$have_doxygen" = yes; then
21610cfee914Smrg    # scrape the doxygen version
21620cfee914Smrg    AC_MSG_CHECKING([the doxygen version])
21630cfee914Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21640cfee914Smrg    AC_MSG_RESULT([$doxygen_version])
21650cfee914Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21660cfee914Smrg        [if test "x$use_doxygen" = xauto; then
21670cfee914Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21680cfee914Smrg            have_doxygen=no
21690cfee914Smrg        else
21700cfee914Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21710cfee914Smrg        fi])
21720cfee914Smrgfi])
217327268fb8Smrg
21740cfee914Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21750cfee914Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21760cfee914Smrgdnl 	HAVE_DOT = @HAVE_DOT@
21770cfee914SmrgHAVE_DOT=no
21780cfee914Smrgif test "x$have_doxygen" = "xyes"; then
21790cfee914Smrg  AC_PATH_PROG([DOT], [dot])
21800cfee914Smrg    if test "x$DOT" != "x"; then
21810cfee914Smrg      HAVE_DOT=yes
21820cfee914Smrg    fi
21830cfee914Smrgfi
218427268fb8Smrg
21850cfee914SmrgAC_SUBST([HAVE_DOT])
21860cfee914SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21870cfee914SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21880cfee914Smrg]) # XORG_WITH_DOXYGEN
218927268fb8Smrg
21900cfee914Smrg# XORG_WITH_GROFF([DEFAULT])
21910cfee914Smrg# ----------------
21920cfee914Smrg# Minimum version: 1.6.0
21930cfee914Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2194cf8f59bfSmrg#
21950cfee914Smrg# Documentation tools are not always available on all platforms and sometimes
21960cfee914Smrg# not at the appropriate level. This macro enables a module to test for the
21970cfee914Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21980cfee914Smrg# the --with-groff option, it allows maximum flexibility in making decisions
21990cfee914Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
22000cfee914Smrg# --with-groff assumes 'auto'.
2201cf8f59bfSmrg#
22020cfee914Smrg# Interface to module:
22030cfee914Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
22040cfee914Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
22050cfee914Smrg# HAVE_GROFF_MS: the -ms macros package
22060cfee914Smrg# GROFF:	 returns the path of the groff program found
22070cfee914Smrg#		 returns the path set by the user in the environment
22080cfee914Smrg# --with-groff:	 'yes' user instructs the module to use groff
22090cfee914Smrg#		 'no' user instructs the module not to use groff
2210cf8f59bfSmrg#
22110cfee914Smrg# Added in version 1.9.0:
22120cfee914Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
22130cfee914Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
22140cfee914Smrg#		   psselect from the psutils package.
22150cfee914Smrg#		   the ghostcript package. Refer to the grohtml man pages
2216cf8f59bfSmrg#
22170cfee914Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
221827268fb8Smrg#
22190cfee914Smrg# OS and distros often splits groff in a basic and full package, the former
22200cfee914Smrg# having the groff program and the later having devices, fonts and macros
22210cfee914Smrg# Checking for the groff executable is not enough.
222227268fb8Smrg#
22230cfee914Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
22240cfee914Smrg# unset HAVE_GROFF or GROFF env variables.
22250cfee914Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
222627268fb8Smrg#
22270cfee914SmrgAC_DEFUN([XORG_WITH_GROFF],[
22280cfee914SmrgAC_ARG_VAR([GROFF], [Path to groff command])
22290cfee914Smrgm4_define([_defopt], m4_default([$1], [auto]))
22300cfee914SmrgAC_ARG_WITH(groff,
22310cfee914Smrg	AS_HELP_STRING([--with-groff],
22320cfee914Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
22330cfee914Smrg	   [use_groff=$withval], [use_groff=]_defopt)
22340cfee914Smrgm4_undefine([_defopt])
223527268fb8Smrg
22360cfee914Smrgif test "x$use_groff" = x"auto"; then
22370cfee914Smrg   AC_PATH_PROG([GROFF], [groff])
22380cfee914Smrg   if test "x$GROFF" = "x"; then
22390cfee914Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22400cfee914Smrg	have_groff=no
22410cfee914Smrg   else
22420cfee914Smrg        have_groff=yes
22430cfee914Smrg   fi
22440cfee914Smrgelif test "x$use_groff" = x"yes" ; then
22450cfee914Smrg   AC_PATH_PROG([GROFF], [groff])
22460cfee914Smrg   if test "x$GROFF" = "x"; then
22470cfee914Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22480cfee914Smrg   fi
22490cfee914Smrg   have_groff=yes
22500cfee914Smrgelif test "x$use_groff" = x"no" ; then
22510cfee914Smrg   if test "x$GROFF" != "x"; then
22520cfee914Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22530cfee914Smrg   fi
22540cfee914Smrg   have_groff=no
2255cf8f59bfSmrgelse
22560cfee914Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2257cf8f59bfSmrgfi
225827268fb8Smrg
22590cfee914Smrg# We have groff, test for the presence of the macro packages
22600cfee914Smrgif test "x$have_groff" = x"yes"; then
22610cfee914Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22620cfee914Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22630cfee914Smrg        groff_ms_works=yes
22640cfee914Smrg    else
22650cfee914Smrg        groff_ms_works=no
226627268fb8Smrg    fi
22670cfee914Smrg    AC_MSG_RESULT([$groff_ms_works])
22680cfee914Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22690cfee914Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22700cfee914Smrg        groff_mm_works=yes
22710cfee914Smrg    else
22720cfee914Smrg        groff_mm_works=no
22730cfee914Smrg    fi
22740cfee914Smrg    AC_MSG_RESULT([$groff_mm_works])
2275cf8f59bfSmrgfi
2276cf8f59bfSmrg
22770cfee914Smrg# We have groff, test for HTML dependencies, one command per package
22780cfee914Smrgif test "x$have_groff" = x"yes"; then
22790cfee914Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22800cfee914Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22810cfee914Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22820cfee914Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22830cfee914Smrg      have_groff_html=yes
22840cfee914Smrg   else
22850cfee914Smrg      have_groff_html=no
22860cfee914Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22870cfee914Smrg   fi
22880cfee914Smrgfi
2289cf8f59bfSmrg
22900cfee914Smrg# Set Automake conditionals for Makefiles
22910cfee914SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22920cfee914SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22930cfee914SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22940cfee914SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22950cfee914Smrg]) # XORG_WITH_GROFF
2296cf8f59bfSmrg
22970cfee914Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22980cfee914Smrg# ---------------------------------------
22990cfee914Smrg# Minimum version: 1.6.0
23000cfee914Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23010cfee914Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
23020cfee914Smrg#
23030cfee914Smrg# Documentation tools are not always available on all platforms and sometimes
23040cfee914Smrg# not at the appropriate level. This macro enables a module to test for the
23050cfee914Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23060cfee914Smrg# the --with-fop option, it allows maximum flexibility in making decisions
23070cfee914Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
23080cfee914Smrg# --with-fop assumes 'auto'.
23090cfee914Smrg#
23100cfee914Smrg# Interface to module:
23110cfee914Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
23120cfee914Smrg# FOP:	 	returns the path of the fop program found
23130cfee914Smrg#		returns the path set by the user in the environment
23140cfee914Smrg# --with-fop: 	'yes' user instructs the module to use fop
23150cfee914Smrg#		'no' user instructs the module not to use fop
23160cfee914Smrg#
23170cfee914Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
23180cfee914Smrg#
23190cfee914SmrgAC_DEFUN([XORG_WITH_FOP],[
23200cfee914SmrgAC_ARG_VAR([FOP], [Path to fop command])
23210cfee914Smrgm4_define([_defopt], m4_default([$2], [auto]))
23220cfee914SmrgAC_ARG_WITH(fop,
23230cfee914Smrg	AS_HELP_STRING([--with-fop],
23240cfee914Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
23250cfee914Smrg	   [use_fop=$withval], [use_fop=]_defopt)
23260cfee914Smrgm4_undefine([_defopt])
2327cf8f59bfSmrg
23280cfee914Smrgif test "x$use_fop" = x"auto"; then
23290cfee914Smrg   AC_PATH_PROG([FOP], [fop])
23300cfee914Smrg   if test "x$FOP" = "x"; then
23310cfee914Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
23320cfee914Smrg	have_fop=no
23330cfee914Smrg   else
23340cfee914Smrg        have_fop=yes
23350cfee914Smrg   fi
23360cfee914Smrgelif test "x$use_fop" = x"yes" ; then
23370cfee914Smrg   AC_PATH_PROG([FOP], [fop])
23380cfee914Smrg   if test "x$FOP" = "x"; then
23390cfee914Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23400cfee914Smrg   fi
23410cfee914Smrg   have_fop=yes
23420cfee914Smrgelif test "x$use_fop" = x"no" ; then
23430cfee914Smrg   if test "x$FOP" != "x"; then
23440cfee914Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23450cfee914Smrg   fi
23460cfee914Smrg   have_fop=no
23470cfee914Smrgelse
23480cfee914Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2349cf8f59bfSmrgfi
2350cf8f59bfSmrg
23510cfee914Smrg# Test for a minimum version of fop, if provided.
23520cfee914Smrgm4_ifval([$1],
23530cfee914Smrg[if test "$have_fop" = yes; then
23540cfee914Smrg    # scrape the fop version
23550cfee914Smrg    AC_MSG_CHECKING([for fop minimum version])
23560cfee914Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23570cfee914Smrg    AC_MSG_RESULT([$fop_version])
23580cfee914Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
23590cfee914Smrg        [if test "x$use_fop" = xauto; then
23600cfee914Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23610cfee914Smrg            have_fop=no
23620cfee914Smrg        else
23630cfee914Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23640cfee914Smrg        fi])
23650cfee914Smrgfi])
23660cfee914SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23670cfee914Smrg]) # XORG_WITH_FOP
236827268fb8Smrg
23690cfee914Smrg# XORG_WITH_M4([MIN-VERSION])
23700cfee914Smrg# ---------------------------
23710cfee914Smrg# Minimum version: 1.19.0
2372cf8f59bfSmrg#
23730cfee914Smrg# This macro attempts to locate an m4 macro processor which supports
23740cfee914Smrg# -I option and is only useful for modules relying on M4 in order to
23750cfee914Smrg# expand macros in source code files.
2376cf8f59bfSmrg#
23770cfee914Smrg# Interface to module:
23780cfee914Smrg# M4:	 	returns the path of the m4 program found
23790cfee914Smrg#		returns the path set by the user in the environment
23800cfee914Smrg#
23810cfee914SmrgAC_DEFUN([XORG_WITH_M4], [
23820cfee914SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23830cfee914Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23840cfee914Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23850cfee914Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23860cfee914Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23870cfee914Smrg   [$PATH:/usr/gnu/bin])])
238827268fb8Smrg
23890cfee914SmrgAC_SUBST([M4], [$ac_cv_path_M4])
23900cfee914Smrg]) # XORG_WITH_M4
239127268fb8Smrg
23920cfee914Smrg# XORG_WITH_PS2PDF([DEFAULT])
23930cfee914Smrg# ----------------
23940cfee914Smrg# Minimum version: 1.6.0
23950cfee914Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23960cfee914Smrg#
23970cfee914Smrg# Documentation tools are not always available on all platforms and sometimes
23980cfee914Smrg# not at the appropriate level. This macro enables a module to test for the
23990cfee914Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
24000cfee914Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
24010cfee914Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
24020cfee914Smrg# --with-ps2pdf assumes 'auto'.
24030cfee914Smrg#
24040cfee914Smrg# Interface to module:
24050cfee914Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
24060cfee914Smrg# PS2PDF:	returns the path of the ps2pdf program found
24070cfee914Smrg#		returns the path set by the user in the environment
24080cfee914Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
24090cfee914Smrg#		 'no' user instructs the module not to use ps2pdf
24100cfee914Smrg#
24110cfee914Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
24120cfee914Smrg#
24130cfee914SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
24140cfee914SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
24150cfee914Smrgm4_define([_defopt], m4_default([$1], [auto]))
24160cfee914SmrgAC_ARG_WITH(ps2pdf,
24170cfee914Smrg	AS_HELP_STRING([--with-ps2pdf],
24180cfee914Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
24190cfee914Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
24200cfee914Smrgm4_undefine([_defopt])
2421cf8f59bfSmrg
24220cfee914Smrgif test "x$use_ps2pdf" = x"auto"; then
24230cfee914Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
24240cfee914Smrg   if test "x$PS2PDF" = "x"; then
24250cfee914Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
24260cfee914Smrg	have_ps2pdf=no
24270cfee914Smrg   else
24280cfee914Smrg        have_ps2pdf=yes
24290cfee914Smrg   fi
24300cfee914Smrgelif test "x$use_ps2pdf" = x"yes" ; then
24310cfee914Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
24320cfee914Smrg   if test "x$PS2PDF" = "x"; then
24330cfee914Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24340cfee914Smrg   fi
24350cfee914Smrg   have_ps2pdf=yes
24360cfee914Smrgelif test "x$use_ps2pdf" = x"no" ; then
24370cfee914Smrg   if test "x$PS2PDF" != "x"; then
24380cfee914Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24390cfee914Smrg   fi
24400cfee914Smrg   have_ps2pdf=no
24410cfee914Smrgelse
24420cfee914Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2443cf8f59bfSmrgfi
24440cfee914SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24450cfee914Smrg]) # XORG_WITH_PS2PDF
2446cf8f59bfSmrg
24470cfee914Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
24480cfee914Smrg# ----------------
24490cfee914Smrg# Minimum version: 1.6.0
24500cfee914Smrg#
24510cfee914Smrg# Documentation tools are not always available on all platforms and sometimes
24520cfee914Smrg# not at the appropriate level. This macro enables a builder to skip all
24530cfee914Smrg# documentation targets except traditional man pages.
24540cfee914Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24550cfee914Smrg# maximum flexibility in controlling documentation building.
24560cfee914Smrg# Refer to:
24570cfee914Smrg# XORG_WITH_XMLTO         --with-xmlto
24580cfee914Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24590cfee914Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24600cfee914Smrg# XORG_WITH_FOP           --with-fop
24610cfee914Smrg# XORG_WITH_GROFF         --with-groff
24620cfee914Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24630cfee914Smrg#
24640cfee914Smrg# Interface to module:
24650cfee914Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24660cfee914Smrg# --enable-docs: 'yes' user instructs the module to generate docs
24670cfee914Smrg#		 'no' user instructs the module not to generate docs
24680cfee914Smrg# parm1:	specify the default value, yes or no.
24690cfee914Smrg#
24700cfee914SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24710cfee914Smrgm4_define([docs_default], m4_default([$1], [yes]))
24720cfee914SmrgAC_ARG_ENABLE(docs,
24730cfee914Smrg	AS_HELP_STRING([--enable-docs],
24740cfee914Smrg	   [Enable building the documentation (default: ]docs_default[)]),
24750cfee914Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
24760cfee914Smrgm4_undefine([docs_default])
24770cfee914SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24780cfee914SmrgAC_MSG_CHECKING([whether to build documentation])
24790cfee914SmrgAC_MSG_RESULT([$build_docs])
24800cfee914Smrg]) # XORG_ENABLE_DOCS
248127268fb8Smrg
24820cfee914Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24830cfee914Smrg# ----------------
24840cfee914Smrg# Minimum version: 1.6.0
24850cfee914Smrg#
24860cfee914Smrg# This macro enables a builder to skip all developer documentation.
24870cfee914Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24880cfee914Smrg# maximum flexibility in controlling documentation building.
24890cfee914Smrg# Refer to:
24900cfee914Smrg# XORG_WITH_XMLTO         --with-xmlto
24910cfee914Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24920cfee914Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24930cfee914Smrg# XORG_WITH_FOP           --with-fop
24940cfee914Smrg# XORG_WITH_GROFF         --with-groff
24950cfee914Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24960cfee914Smrg#
24970cfee914Smrg# Interface to module:
24980cfee914Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24990cfee914Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
25000cfee914Smrg#			'no' user instructs the module not to generate developer docs
25010cfee914Smrg# parm1:		specify the default value, yes or no.
25020cfee914Smrg#
25030cfee914SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
25040cfee914Smrgm4_define([devel_default], m4_default([$1], [yes]))
25050cfee914SmrgAC_ARG_ENABLE(devel-docs,
25060cfee914Smrg	AS_HELP_STRING([--enable-devel-docs],
25070cfee914Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
25080cfee914Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
25090cfee914Smrgm4_undefine([devel_default])
25100cfee914SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
25110cfee914SmrgAC_MSG_CHECKING([whether to build developer documentation])
25120cfee914SmrgAC_MSG_RESULT([$build_devel_docs])
25130cfee914Smrg]) # XORG_ENABLE_DEVEL_DOCS
251427268fb8Smrg
25150cfee914Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
25160cfee914Smrg# ----------------
25170cfee914Smrg# Minimum version: 1.6.0
25180cfee914Smrg#
25190cfee914Smrg# This macro enables a builder to skip all functional specification targets.
25200cfee914Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
25210cfee914Smrg# maximum flexibility in controlling documentation building.
25220cfee914Smrg# Refer to:
25230cfee914Smrg# XORG_WITH_XMLTO         --with-xmlto
25240cfee914Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
25250cfee914Smrg# XORG_WITH_DOXYGEN       --with-doxygen
25260cfee914Smrg# XORG_WITH_FOP           --with-fop
25270cfee914Smrg# XORG_WITH_GROFF         --with-groff
25280cfee914Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
25290cfee914Smrg#
25300cfee914Smrg# Interface to module:
25310cfee914Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
25320cfee914Smrg# --enable-specs:	'yes' user instructs the module to generate specs
25330cfee914Smrg#			'no' user instructs the module not to generate specs
25340cfee914Smrg# parm1:		specify the default value, yes or no.
25350cfee914Smrg#
25360cfee914SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25370cfee914Smrgm4_define([spec_default], m4_default([$1], [yes]))
25380cfee914SmrgAC_ARG_ENABLE(specs,
25390cfee914Smrg	AS_HELP_STRING([--enable-specs],
25400cfee914Smrg	   [Enable building the specs (default: ]spec_default[)]),
25410cfee914Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
25420cfee914Smrgm4_undefine([spec_default])
25430cfee914SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25440cfee914SmrgAC_MSG_CHECKING([whether to build functional specifications])
25450cfee914SmrgAC_MSG_RESULT([$build_specs])
25460cfee914Smrg]) # XORG_ENABLE_SPECS
254727268fb8Smrg
25480cfee914Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25490cfee914Smrg# ----------------------------------------------
25500cfee914Smrg# Minimum version: 1.13.0
25510cfee914Smrg#
25520cfee914Smrg# This macro enables a builder to enable/disable unit testing
25530cfee914Smrg# It makes no assumption about the test cases implementation
25540cfee914Smrg# Test cases may or may not use Automake "Support for test suites"
25550cfee914Smrg# They may or may not use the software utility library GLib
25560cfee914Smrg#
25570cfee914Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25580cfee914Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25590cfee914Smrg# The variable enable_unit_tests is used by other macros in this file.
25600cfee914Smrg#
25610cfee914Smrg# Interface to module:
25620cfee914Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25630cfee914Smrg# enable_unit_tests:    used in configure.ac for additional configuration
25640cfee914Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25650cfee914Smrg#			'no' user instructs the module not to build tests
25660cfee914Smrg# parm1:		specify the default value, yes or no.
25670cfee914Smrg#
25680cfee914SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25690cfee914SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25700cfee914SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25710cfee914SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25720cfee914Smrgm4_define([_defopt], m4_default([$1], [auto]))
25730cfee914SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25740cfee914Smrg	[Enable building unit test cases (default: ]_defopt[)]),
25750cfee914Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25760cfee914Smrgm4_undefine([_defopt])
25770cfee914SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25780cfee914SmrgAC_MSG_CHECKING([whether to build unit test cases])
25790cfee914SmrgAC_MSG_RESULT([$enable_unit_tests])
25800cfee914Smrg]) # XORG_ENABLE_UNIT_TESTS
258127268fb8Smrg
25820cfee914Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25830cfee914Smrg# ------------------------------------------------------
25840cfee914Smrg# Minimum version: 1.17.0
25850cfee914Smrg#
25860cfee914Smrg# This macro enables a builder to enable/disable integration testing
25870cfee914Smrg# It makes no assumption about the test cases' implementation
25880cfee914Smrg# Test cases may or may not use Automake "Support for test suites"
25890cfee914Smrg#
25900cfee914Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25910cfee914Smrg# usually requires less dependencies and may be built and run under less
25920cfee914Smrg# stringent environments than integration tests.
25930cfee914Smrg#
25940cfee914Smrg# Interface to module:
25950cfee914Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25960cfee914Smrg# enable_integration_tests:   used in configure.ac for additional configuration
25970cfee914Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25980cfee914Smrg#                             'no' user instructs the module not to build tests
25990cfee914Smrg# parm1:                      specify the default value, yes or no.
26000cfee914Smrg#
26010cfee914SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
26020cfee914SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
26030cfee914Smrgm4_define([_defopt], m4_default([$1], [auto]))
26040cfee914SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
26050cfee914Smrg	[Enable building integration test cases (default: ]_defopt[)]),
26060cfee914Smrg	[enable_integration_tests=$enableval],
26070cfee914Smrg	[enable_integration_tests=]_defopt)
26080cfee914Smrgm4_undefine([_defopt])
26090cfee914SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
26100cfee914Smrg	[test "x$enable_integration_tests" != xno])
26110cfee914SmrgAC_MSG_CHECKING([whether to build unit test cases])
26120cfee914SmrgAC_MSG_RESULT([$enable_integration_tests])
26130cfee914Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
261427268fb8Smrg
26150cfee914Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
26160cfee914Smrg# ----------------------------------------
26170cfee914Smrg# Minimum version: 1.13.0
26180cfee914Smrg#
26190cfee914Smrg# GLib is a library which provides advanced data structures and functions.
26200cfee914Smrg# This macro enables a module to test for the presence of Glib.
26210cfee914Smrg#
26220cfee914Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
26230cfee914Smrg# Otherwise the value of $enable_unit_tests is blank.
26240cfee914Smrg#
26250cfee914Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
26260cfee914Smrg# test support usually requires less dependencies and may be built and run under
26270cfee914Smrg# less stringent environments than integration tests.
26280cfee914Smrg#
26290cfee914Smrg# Interface to module:
26300cfee914Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
26310cfee914Smrg# with_glib: used in configure.ac to know if GLib has been found
26320cfee914Smrg# --with-glib:	'yes' user instructs the module to use glib
26330cfee914Smrg#		'no' user instructs the module not to use glib
26340cfee914Smrg#
26350cfee914SmrgAC_DEFUN([XORG_WITH_GLIB],[
26360cfee914SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26370cfee914Smrgm4_define([_defopt], m4_default([$2], [auto]))
26380cfee914SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26390cfee914Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26400cfee914Smrg	[with_glib=$withval], [with_glib=]_defopt)
26410cfee914Smrgm4_undefine([_defopt])
264227268fb8Smrg
26430cfee914Smrghave_glib=no
26440cfee914Smrg# Do not probe GLib if user explicitly disabled unit testing
26450cfee914Smrgif test "x$enable_unit_tests" != x"no"; then
26460cfee914Smrg  # Do not probe GLib if user explicitly disabled it
26470cfee914Smrg  if test "x$with_glib" != x"no"; then
26480cfee914Smrg    m4_ifval(
26490cfee914Smrg      [$1],
26500cfee914Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26510cfee914Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26520cfee914Smrg    )
26530cfee914Smrg  fi
26540cfee914Smrgfi
265527268fb8Smrg
26560cfee914Smrg# Not having GLib when unit testing has been explicitly requested is an error
26570cfee914Smrgif test "x$enable_unit_tests" = x"yes"; then
26580cfee914Smrg  if test "x$have_glib" = x"no"; then
26590cfee914Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26600cfee914Smrg  fi
26610cfee914Smrgfi
2662f4959950Smrg
26630cfee914Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
26640cfee914Smrgif test "x$enable_unit_tests" = x"no"; then
26650cfee914Smrg  if test "x$with_glib" = x"yes"; then
26660cfee914Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26670cfee914Smrg  fi
2668f4959950Smrgfi
2669335e815aSmrg
26700cfee914Smrg# Not having GLib when it has been explicitly requested is an error
26710cfee914Smrgif test "x$with_glib" = x"yes"; then
26720cfee914Smrg  if test "x$have_glib" = x"no"; then
26730cfee914Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26740cfee914Smrg  fi
26750cfee914Smrgfi
267627268fb8Smrg
26770cfee914SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26780cfee914Smrg]) # XORG_WITH_GLIB
267927268fb8Smrg
26800cfee914Smrg# XORG_LD_WRAP([required|optional])
26810cfee914Smrg# ---------------------------------
26820cfee914Smrg# Minimum version: 1.13.0
26830cfee914Smrg#
26840cfee914Smrg# Check if linker supports -wrap, passed via compiler flags
26850cfee914Smrg#
26860cfee914Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26870cfee914Smrg# Otherwise the value of $enable_unit_tests is blank.
26880cfee914Smrg#
26890cfee914Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26900cfee914Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26910cfee914Smrg# available, an argument of "optional" allows use when some unit tests require
26920cfee914Smrg# ld -wrap and others do not.
26930cfee914Smrg#
26940cfee914SmrgAC_DEFUN([XORG_LD_WRAP],[
26950cfee914SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26960cfee914Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26970cfee914Smrg                      void __wrap_exit(int status) { return; }],
26980cfee914Smrg                     [exit(0);])])
26990cfee914Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
27000cfee914Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
27010cfee914Smrg  if test "x$have_ld_wrap" = x"no"; then
27020cfee914Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
27030cfee914Smrg  fi
2704f4959950Smrgfi
27050cfee914SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
27060cfee914Smrg#
27070cfee914Smrg]) # XORG_LD_WRAP
2708335e815aSmrg
27090cfee914Smrg# XORG_CHECK_LINKER_FLAGS
27100cfee914Smrg# -----------------------
27110cfee914Smrg# SYNOPSIS
27120cfee914Smrg#
27130cfee914Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
27140cfee914Smrg#
27150cfee914Smrg# DESCRIPTION
27160cfee914Smrg#
27170cfee914Smrg#   Check whether the given linker FLAGS work with the current language's
27180cfee914Smrg#   linker, or whether they give an error.
27190cfee914Smrg#
27200cfee914Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
27210cfee914Smrg#   success/failure.
27220cfee914Smrg#
27230cfee914Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
27240cfee914Smrg#
27250cfee914Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
27260cfee914Smrg#
27270cfee914Smrg# LICENSE
27280cfee914Smrg#
27290cfee914Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
27300cfee914Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
27310cfee914Smrg#   Copyright (c) 2009 Matteo Frigo
27320cfee914Smrg#
27330cfee914Smrg#   This program is free software: you can redistribute it and/or modify it
27340cfee914Smrg#   under the terms of the GNU General Public License as published by the
27350cfee914Smrg#   Free Software Foundation, either version 3 of the License, or (at your
27360cfee914Smrg#   option) any later version.
27370cfee914Smrg#
27380cfee914Smrg#   This program is distributed in the hope that it will be useful, but
27390cfee914Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27400cfee914Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27410cfee914Smrg#   Public License for more details.
27420cfee914Smrg#
27430cfee914Smrg#   You should have received a copy of the GNU General Public License along
27440cfee914Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27450cfee914Smrg#
27460cfee914Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
27470cfee914Smrg#   gives unlimited permission to copy, distribute and modify the configure
27480cfee914Smrg#   scripts that are the output of Autoconf when processing the Macro. You
27490cfee914Smrg#   need not follow the terms of the GNU General Public License when using
27500cfee914Smrg#   or distributing such scripts, even though portions of the text of the
27510cfee914Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27520cfee914Smrg#   all other use of the material that constitutes the Autoconf Macro.
27530cfee914Smrg#
27540cfee914Smrg#   This special exception to the GPL applies to versions of the Autoconf
27550cfee914Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
27560cfee914Smrg#   modified version of the Autoconf Macro, you may extend this special
27570cfee914Smrg#   exception to the GPL to apply to your modified version as well.#
27580cfee914SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27590cfee914Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
27600cfee914Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27610cfee914SmrgAS_LITERAL_IF([$1],
27620cfee914Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27630cfee914Smrg      ax_save_FLAGS=$LDFLAGS
27640cfee914Smrg      LDFLAGS="$1"
27650cfee914Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27660cfee914Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27670cfee914Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27680cfee914Smrg      LDFLAGS=$ax_save_FLAGS])],
27690cfee914Smrg  [ax_save_FLAGS=$LDFLAGS
27700cfee914Smrg   LDFLAGS="$1"
27710cfee914Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27720cfee914Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27730cfee914Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27740cfee914Smrg   LDFLAGS=$ax_save_FLAGS])
27750cfee914Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27760cfee914SmrgAC_MSG_RESULT($xorg_check_linker_flags)
27770cfee914Smrgif test "x$xorg_check_linker_flags" = xyes; then
27780cfee914Smrg	m4_default([$2], :)
27790cfee914Smrgelse
27800cfee914Smrg	m4_default([$3], :)
27810cfee914Smrgfi
27820cfee914Smrg]) # XORG_CHECK_LINKER_FLAGS
2783f4959950Smrg
27840cfee914Smrg# XORG_MEMORY_CHECK_FLAGS
27850cfee914Smrg# -----------------------
27860cfee914Smrg# Minimum version: 1.16.0
2787cf8f59bfSmrg#
27880cfee914Smrg# This macro attempts to find appropriate memory checking functionality
27890cfee914Smrg# for various platforms which unit testing code may use to catch various
27900cfee914Smrg# forms of memory allocation and access errors in testing.
27910cfee914Smrg#
27920cfee914Smrg# Interface to module:
27930cfee914Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27940cfee914Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27950cfee914Smrg#
27960cfee914Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27970cfee914Smrg#
27980cfee914SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
279927268fb8Smrg
28000cfee914SmrgAC_REQUIRE([AC_CANONICAL_HOST])
28010cfee914SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
28020cfee914Smrg           [Environment variables to enable memory checking in tests])
280327268fb8Smrg
28040cfee914Smrg# Check for different types of support on different platforms
28050cfee914Smrgcase $host_os in
28060cfee914Smrg    solaris*)
28070cfee914Smrg        AC_CHECK_LIB([umem], [umem_alloc],
28080cfee914Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
28090cfee914Smrg        ;;
28100cfee914Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
28110cfee914Smrg        # both directly and inverted, so should not be 0 or 255.
28120cfee914Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
28130cfee914Smrg        ;;
28140cfee914Smrg    darwin*)
28150cfee914Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
28160cfee914Smrg        ;;
28170cfee914Smrg    *bsd*)
28180cfee914Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
28190cfee914Smrg        ;;
28200cfee914Smrgesac
282127268fb8Smrg
28220cfee914Smrg# User supplied flags override default flags
28230cfee914Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
28240cfee914Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
28250cfee914Smrgfi
282627268fb8Smrg
28270cfee914SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
28280cfee914Smrg]) # XORG_WITH_LINT
282927268fb8Smrg
28300cfee914Smrg# XORG_CHECK_MALLOC_ZERO
28310cfee914Smrg# ----------------------
28320cfee914Smrg# Minimum version: 1.0.0
2833f4959950Smrg#
28340cfee914Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28350cfee914Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28360cfee914Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28370cfee914SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28380cfee914SmrgAC_ARG_ENABLE(malloc0returnsnull,
28390cfee914Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28400cfee914Smrg		       [malloc(0) returns NULL (default: auto)]),
28410cfee914Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28420cfee914Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2843f4959950Smrg
28440cfee914SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28450cfee914Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28460cfee914SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28470cfee914Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28480cfee914Smrg#include <stdlib.h>
28490cfee914Smrg],[
28500cfee914Smrg    char *m0, *r0, *c0, *p;
28510cfee914Smrg    m0 = malloc(0);
28520cfee914Smrg    p = malloc(10);
28530cfee914Smrg    r0 = realloc(p,0);
28540cfee914Smrg    c0 = calloc(0,10);
28550cfee914Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28560cfee914Smrg])],
28570cfee914Smrg		[xorg_cv_malloc0_returns_null=yes],
28580cfee914Smrg		[xorg_cv_malloc0_returns_null=no])])
28590cfee914SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28600cfee914Smrgfi
28610cfee914SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2862cf8f59bfSmrg
28630cfee914Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28640cfee914Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28650cfee914Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28660cfee914Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28670cfee914Smrgelse
28680cfee914Smrg	MALLOC_ZERO_CFLAGS=""
28690cfee914Smrg	XMALLOC_ZERO_CFLAGS=""
28700cfee914Smrg	XTMALLOC_ZERO_CFLAGS=""
28710cfee914Smrgfi
2872cf8f59bfSmrg
28730cfee914SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28740cfee914SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28750cfee914SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28760cfee914Smrg]) # XORG_CHECK_MALLOC_ZERO
2877335e815aSmrg
28780cfee914Smrg# XORG_WITH_LINT()
28790cfee914Smrg# ----------------
28800cfee914Smrg# Minimum version: 1.1.0
288127268fb8Smrg#
28820cfee914Smrg# This macro enables the use of a tool that flags some suspicious and
28830cfee914Smrg# non-portable constructs (likely to be bugs) in C language source code.
28840cfee914Smrg# It will attempt to locate the tool and use appropriate options.
28850cfee914Smrg# There are various lint type tools on different platforms.
28860cfee914Smrg#
28870cfee914Smrg# Interface to module:
28880cfee914Smrg# LINT:		returns the path to the tool found on the platform
28890cfee914Smrg#		or the value set to LINT on the configure cmd line
28900cfee914Smrg#		also an Automake conditional
28910cfee914Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
28920cfee914Smrg#
28930cfee914Smrg# --with-lint:	'yes' user instructs the module to use lint
28940cfee914Smrg#		'no' user instructs the module not to use lint (default)
28950cfee914Smrg#
28960cfee914Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28970cfee914Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28980cfee914Smrg#
28990cfee914SmrgAC_DEFUN([XORG_WITH_LINT],[
2900335e815aSmrg
29010cfee914SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
29020cfee914SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
29030cfee914SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
29040cfee914Smrg		[Use a lint-style source code checker (default: disabled)])],
29050cfee914Smrg		[use_lint=$withval], [use_lint=no])
2906335e815aSmrg
29070cfee914Smrg# Obtain platform specific info like program name and options
29080cfee914Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
29090cfee914Smrgcase $host_os in
29100cfee914Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
29110cfee914Smrg	lint_name=splint
29120cfee914Smrg	lint_options="-badflag"
29130cfee914Smrg	;;
29140cfee914Smrg  *freebsd* | *netbsd*)
29150cfee914Smrg	lint_name=lint
29160cfee914Smrg	lint_options="-u -b"
29170cfee914Smrg	;;
29180cfee914Smrg  *solaris*)
29190cfee914Smrg	lint_name=lint
29200cfee914Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
29210cfee914Smrg	;;
29220cfee914Smrgesac
2923cf8f59bfSmrg
29240cfee914Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
29250cfee914Smrgif test "x$use_lint" = x"yes" ; then
29260cfee914Smrg   AC_PATH_PROG([LINT], [$lint_name])
29270cfee914Smrg   if test "x$LINT" = "x"; then
29280cfee914Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
29290cfee914Smrg   fi
29300cfee914Smrgelif test "x$use_lint" = x"no" ; then
29310cfee914Smrg   if test "x$LINT" != "x"; then
29320cfee914Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
29330cfee914Smrg   fi
293427268fb8Smrgelse
29350cfee914Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2936f4959950Smrgfi
2937cf8f59bfSmrg
29380cfee914Smrg# User supplied flags override default flags
29390cfee914Smrgif test "x$LINT_FLAGS" != "x"; then
29400cfee914Smrg   lint_options=$LINT_FLAGS
29410cfee914Smrgfi
294227268fb8Smrg
29430cfee914SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29440cfee914SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2945335e815aSmrg
29460cfee914Smrg]) # XORG_WITH_LINT
2947335e815aSmrg
29480cfee914Smrg# XORG_LINT_LIBRARY(LIBNAME)
29490cfee914Smrg# --------------------------
29500cfee914Smrg# Minimum version: 1.1.0
2951f4959950Smrg#
29520cfee914Smrg# Sets up flags for building lint libraries for checking programs that call
29530cfee914Smrg# functions in the library.
29540cfee914Smrg#
29550cfee914Smrg# Interface to module:
29560cfee914Smrg# LINTLIB		- Automake variable with the name of lint library file to make
29570cfee914Smrg# MAKE_LINT_LIB		- Automake conditional
29580cfee914Smrg#
29590cfee914Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29600cfee914Smrg#			  - 'no' user instructs the module not to create a lint library (default)
296127268fb8Smrg
29620cfee914SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29630cfee914SmrgAC_REQUIRE([XORG_WITH_LINT])
29640cfee914SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29650cfee914Smrg	[Create lint library (default: disabled)])],
29660cfee914Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2967f4959950Smrg
29680cfee914Smrgif test "x$make_lint_lib" = x"yes" ; then
29690cfee914Smrg   LINTLIB=llib-l$1.ln
29700cfee914Smrg   if test "x$LINT" = "x"; then
29710cfee914Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29720cfee914Smrg   fi
29730cfee914Smrgelif test "x$make_lint_lib" != x"no" ; then
29740cfee914Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29750cfee914Smrgfi
2976335e815aSmrg
29770cfee914SmrgAC_SUBST(LINTLIB)
29780cfee914SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2979cf8f59bfSmrg
29800cfee914Smrg]) # XORG_LINT_LIBRARY
2981f4959950Smrg
29820cfee914Smrg# XORG_COMPILER_BRAND
29830cfee914Smrg# -------------------
29840cfee914Smrg# Minimum version: 1.14.0
29850cfee914Smrg#
29860cfee914Smrg# Checks for various brands of compilers and sets flags as appropriate:
29870cfee914Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29880cfee914Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29890cfee914Smrg#   clang compiler - sets CLANGCC to "yes"
29900cfee914Smrg#   Intel compiler - sets INTELCC to "yes"
29910cfee914Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29920cfee914Smrg#
29930cfee914SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29940cfee914SmrgAC_LANG_CASE(
29950cfee914Smrg	[C], [
29960cfee914Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29970cfee914Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
29980cfee914Smrg		m4_version_prereq([2.70],
29990cfee914Smrg			[AC_REQUIRE([AC_PROG_CC])],
30000cfee914Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30010cfee914Smrg	],
30020cfee914Smrg	[C++], [
30030cfee914Smrg		AC_REQUIRE([AC_PROG_CXX])
30040cfee914Smrg	]
30050cfee914Smrg)
30060cfee914SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
30070cfee914SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
30080cfee914SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
30090cfee914Smrg]) # XORG_COMPILER_BRAND
3010f4959950Smrg
30110cfee914Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
30120cfee914Smrg# ---------------
30130cfee914Smrg# Minimum version: 1.16.0
30140cfee914Smrg#
30150cfee914Smrg# Test if the compiler works when passed the given flag as a command line argument.
30160cfee914Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
30170cfee914Smrg# next flag in the list until there are no more options.
30180cfee914Smrg#
30190cfee914Smrg# Note that this does not guarantee that the compiler supports the flag as some
30200cfee914Smrg# compilers will simply ignore arguments that they do not understand, but we do
30210cfee914Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
30220cfee914Smrg# -Werror=unused-command-line-argument
30230cfee914Smrg#
30240cfee914SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
30250cfee914Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
30260cfee914Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
30270cfee914Smrg
30280cfee914SmrgAC_LANG_COMPILER_REQUIRE
30290cfee914Smrg
30300cfee914SmrgAC_LANG_CASE(
30310cfee914Smrg	[C], [
30320cfee914Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
30330cfee914Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
30340cfee914Smrg		m4_version_prereq([2.70],
30350cfee914Smrg			[AC_REQUIRE([AC_PROG_CC])],
30360cfee914Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30370cfee914Smrg		define([PREFIX], [C])
30380cfee914Smrg		define([CACHE_PREFIX], [cc])
30390cfee914Smrg		define([COMPILER], [$CC])
30400cfee914Smrg	],
30410cfee914Smrg	[C++], [
30420cfee914Smrg		define([PREFIX], [CXX])
30430cfee914Smrg		define([CACHE_PREFIX], [cxx])
30440cfee914Smrg		define([COMPILER], [$CXX])
30450cfee914Smrg	]
30460cfee914Smrg)
3047335e815aSmrg
30480cfee914Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30490cfee914Smrg
30500cfee914Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30510cfee914Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30520cfee914Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30530cfee914Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30540cfee914Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30550cfee914Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30560cfee914Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30570cfee914Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30580cfee914Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30590cfee914Smrgfi
3060335e815aSmrg
30610cfee914Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30620cfee914Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30630cfee914Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30640cfee914Smrg	fi
30650cfee914Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30660cfee914Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30670cfee914Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30680cfee914Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30690cfee914Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30700cfee914Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30710cfee914Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30720cfee914Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30730cfee914Smrgfi
307427268fb8Smrg
30750cfee914Smrgfound="no"
30760cfee914Smrgm4_foreach([flag], m4_cdr($@), [
30770cfee914Smrg	if test $found = "no" ; then
30780cfee914Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30790cfee914Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30800cfee914Smrg		fi
30810cfee914Smrg
30820cfee914Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30830cfee914Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30840cfee914Smrg		fi
30850cfee914Smrg
30860cfee914Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30870cfee914Smrg
30880cfee914Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30890cfee914Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30900cfee914Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30910cfee914Smrg		AC_CACHE_VAL($cacheid,
30920cfee914Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30930cfee914Smrg					     [eval $cacheid=yes],
30940cfee914Smrg					     [eval $cacheid=no])])
30950cfee914Smrg
30960cfee914Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30970cfee914Smrg
30980cfee914Smrg		eval supported=\$$cacheid
30990cfee914Smrg		AC_MSG_RESULT([$supported])
31000cfee914Smrg		if test "$supported" = "yes" ; then
31010cfee914Smrg			$1="$$1 ]flag["
31020cfee914Smrg			found="yes"
31030cfee914Smrg		fi
31040cfee914Smrg	fi
31050cfee914Smrg])
31060cfee914Smrg]) # XORG_TESTSET_CFLAG
310727268fb8Smrg
31080cfee914Smrg# XORG_COMPILER_FLAGS
31090cfee914Smrg# ---------------
31100cfee914Smrg# Minimum version: 1.16.0
31110cfee914Smrg#
31120cfee914Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
31130cfee914Smrg# arguments supported by the selected compiler which do NOT alter the generated
31140cfee914Smrg# code.  These arguments will cause the compiler to print various warnings
31150cfee914Smrg# during compilation AND turn a conservative set of warnings into errors.
31160cfee914Smrg#
31170cfee914Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
31180cfee914Smrg# future versions of util-macros as options are added to new compilers.
31190cfee914Smrg#
31200cfee914SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
31210cfee914SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31220cfee914Smrg
31230cfee914SmrgAC_ARG_ENABLE(selective-werror,
31240cfee914Smrg              AS_HELP_STRING([--disable-selective-werror],
31250cfee914Smrg                             [Turn off selective compiler errors. (default: enabled)]),
31260cfee914Smrg              [SELECTIVE_WERROR=$enableval],
31270cfee914Smrg              [SELECTIVE_WERROR=yes])
31280cfee914Smrg
31290cfee914SmrgAC_LANG_CASE(
31300cfee914Smrg        [C], [
31310cfee914Smrg                define([PREFIX], [C])
31320cfee914Smrg        ],
31330cfee914Smrg        [C++], [
31340cfee914Smrg                define([PREFIX], [CXX])
31350cfee914Smrg        ]
31360cfee914Smrg)
31370cfee914Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
31380cfee914Smrgif test "x$SUNCC" = "xyes"; then
31390cfee914Smrg    [BASE_]PREFIX[FLAGS]="-v"
314027268fb8Smrgelse
31410cfee914Smrg    [BASE_]PREFIX[FLAGS]=""
3142335e815aSmrgfi
3143335e815aSmrg
31440cfee914Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31450cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31460cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31470cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31480cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31490cfee914Smrg
31500cfee914SmrgAC_LANG_CASE(
31510cfee914Smrg	[C], [
31520cfee914Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31530cfee914Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31540cfee914Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31550cfee914Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31560cfee914Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31570cfee914Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31580cfee914Smrg	]
31590cfee914Smrg)
3160335e815aSmrg
31610cfee914Smrg# This chunk adds additional warnings that could catch undesired effects.
31620cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31630cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31640cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31650cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31660cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31670cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31680cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
31690cfee914Smrg
31700cfee914Smrg# These are currently disabled because they are noisy.  They will be enabled
31710cfee914Smrg# in the future once the codebase is sufficiently modernized to silence
31720cfee914Smrg# them.  For now, I don't want them to drown out the other warnings.
31730cfee914Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31740cfee914Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31750cfee914Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
31760cfee914Smrg
31770cfee914Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
31780cfee914Smrg# when there are problems that should be fixed.
31790cfee914Smrg
31800cfee914Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31810cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31820cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31830cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31840cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31850cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31860cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31870cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31880cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31890cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31900cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31910cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31920cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31930cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31940cfee914Smrgelse
31950cfee914SmrgAC_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])
31960cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31970cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31980cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31990cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
32000cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
32010cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
32020cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
32030cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
32040cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
32050cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
32060cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
32070cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
32080cfee914SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
32090cfee914Smrgfi
3210335e815aSmrg
32110cfee914SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32120cfee914Smrg]) # XORG_COMPILER_FLAGS
3213335e815aSmrg
32140cfee914Smrg# XORG_CWARNFLAGS
32150cfee914Smrg# ---------------
32160cfee914Smrg# Minimum version: 1.2.0
32170cfee914Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
321827268fb8Smrg#
32190cfee914Smrg# Defines CWARNFLAGS to enable C compiler warnings.
32200cfee914Smrg#
32210cfee914Smrg# This function is deprecated because it defines -fno-strict-aliasing
32220cfee914Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
32230cfee914Smrg# is needed, then it should be added explicitly in the module when
32240cfee914Smrg# it is updated to use BASE_CFLAGS.
32250cfee914Smrg#
32260cfee914SmrgAC_DEFUN([XORG_CWARNFLAGS], [
32270cfee914SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32280cfee914SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
32290cfee914SmrgAC_LANG_CASE(
32300cfee914Smrg	[C], [
32310cfee914Smrg		CWARNFLAGS="$BASE_CFLAGS"
32320cfee914Smrg		if  test "x$GCC" = xyes ; then
32330cfee914Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
32340cfee914Smrg		fi
32350cfee914Smrg		AC_SUBST(CWARNFLAGS)
32360cfee914Smrg	]
32370cfee914Smrg)
32380cfee914Smrg]) # XORG_CWARNFLAGS
3239335e815aSmrg
32400cfee914Smrg# XORG_STRICT_OPTION
32410cfee914Smrg# -----------------------
32420cfee914Smrg# Minimum version: 1.3.0
3243335e815aSmrg#
32440cfee914Smrg# Add configure option to enable strict compilation flags, such as treating
32450cfee914Smrg# warnings as fatal errors.
32460cfee914Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32470cfee914Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32480cfee914Smrg#
32490cfee914Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32500cfee914Smrg# when strict compilation is unconditionally desired.
32510cfee914SmrgAC_DEFUN([XORG_STRICT_OPTION], [
32520cfee914SmrgAC_REQUIRE([XORG_CWARNFLAGS])
32530cfee914SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32540cfee914Smrg
32550cfee914SmrgAC_ARG_ENABLE(strict-compilation,
32560cfee914Smrg			  AS_HELP_STRING([--enable-strict-compilation],
32570cfee914Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32580cfee914Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3259335e815aSmrg
32600cfee914SmrgAC_LANG_CASE(
32610cfee914Smrg        [C], [
32620cfee914Smrg                define([PREFIX], [C])
32630cfee914Smrg        ],
32640cfee914Smrg        [C++], [
32650cfee914Smrg                define([PREFIX], [CXX])
32660cfee914Smrg        ]
32670cfee914Smrg)
3268335e815aSmrg
32690cfee914Smrg[STRICT_]PREFIX[FLAGS]=""
32700cfee914SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32710cfee914SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3272335e815aSmrg
32730cfee914Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32740cfee914Smrg# activate it with -Werror, so we add it here explicitly.
32750cfee914SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3276335e815aSmrg
32770cfee914Smrgif test "x$STRICT_COMPILE" = "xyes"; then
32780cfee914Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32790cfee914Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32800cfee914Smrgfi
32810cfee914SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32820cfee914SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32830cfee914SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32840cfee914Smrg]) # XORG_STRICT_OPTION
3285335e815aSmrg
32860cfee914Smrg# XORG_DEFAULT_NOCODE_OPTIONS
32870cfee914Smrg# ---------------------------
32880cfee914Smrg# Minimum version: 1.20.0
328927268fb8Smrg#
32900cfee914Smrg# Defines default options for X.Org modules which don't compile code,
32910cfee914Smrg# such as fonts, bitmaps, cursors, and docs.
32920cfee914Smrg#
32930cfee914SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
32940cfee914SmrgAC_REQUIRE([AC_PROG_INSTALL])
32950cfee914SmrgXORG_RELEASE_VERSION
32960cfee914SmrgXORG_CHANGELOG
32970cfee914SmrgXORG_INSTALL
32980cfee914SmrgXORG_MANPAGE_SECTIONS
32990cfee914Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
33000cfee914Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
33010cfee914Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3302335e815aSmrg
33030cfee914Smrg# XORG_DEFAULT_OPTIONS
330427268fb8Smrg# --------------------
33050cfee914Smrg# Minimum version: 1.3.0
330627268fb8Smrg#
33070cfee914Smrg# Defines default options for X.Org modules which compile code.
330827268fb8Smrg#
33090cfee914SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
33100cfee914SmrgAC_REQUIRE([AC_PROG_INSTALL])
33110cfee914SmrgXORG_COMPILER_FLAGS
33120cfee914SmrgXORG_CWARNFLAGS
33130cfee914SmrgXORG_STRICT_OPTION
33140cfee914SmrgXORG_DEFAULT_NOCODE_OPTIONS
33150cfee914Smrg]) # XORG_DEFAULT_OPTIONS
33160cfee914Smrg
33170cfee914Smrg# XORG_INSTALL()
33180cfee914Smrg# ----------------
33190cfee914Smrg# Minimum version: 1.4.0
33200cfee914Smrg#
33210cfee914Smrg# Defines the variable INSTALL_CMD as the command to copy
33220cfee914Smrg# INSTALL from $prefix/share/util-macros.
33230cfee914Smrg#
33240cfee914SmrgAC_DEFUN([XORG_INSTALL], [
33250cfee914SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
33260cfee914Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
33270cfee914SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
33280cfee914Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
33290cfee914Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
33300cfee914Smrgtouch \$(top_srcdir)/INSTALL; \
33310cfee914Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
33320cfee914SmrgAC_SUBST([INSTALL_CMD])
33330cfee914Smrg]) # XORG_INSTALL
33340cfee914Smrgdnl Copyright 2005 Red Hat, Inc
33350cfee914Smrgdnl
33360cfee914Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
33370cfee914Smrgdnl documentation for any purpose is hereby granted without fee, provided that
33380cfee914Smrgdnl the above copyright notice appear in all copies and that both that
33390cfee914Smrgdnl copyright notice and this permission notice appear in supporting
33400cfee914Smrgdnl documentation.
33410cfee914Smrgdnl
33420cfee914Smrgdnl The above copyright notice and this permission notice shall be included
33430cfee914Smrgdnl in all copies or substantial portions of the Software.
33440cfee914Smrgdnl
33450cfee914Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33460cfee914Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33470cfee914Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33480cfee914Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
33490cfee914Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33500cfee914Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33510cfee914Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
33520cfee914Smrgdnl
33530cfee914Smrgdnl Except as contained in this notice, the name of the copyright holders shall
33540cfee914Smrgdnl not be used in advertising or otherwise to promote the sale, use or
33550cfee914Smrgdnl other dealings in this Software without prior written authorization
33560cfee914Smrgdnl from the copyright holders.
33570cfee914Smrgdnl
3358335e815aSmrg
33590cfee914Smrg# XORG_RELEASE_VERSION
33600cfee914Smrg# --------------------
33610cfee914Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3362335e815aSmrg
33630cfee914SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33640cfee914Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33650cfee914Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33660cfee914Smrg		[Major version of this package])
33670cfee914Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33680cfee914Smrg	if test "x$PVM" = "x"; then
33690cfee914Smrg		PVM="0"
33700cfee914Smrg	fi
33710cfee914Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33720cfee914Smrg		[$PVM],
33730cfee914Smrg		[Minor version of this package])
33740cfee914Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33750cfee914Smrg	if test "x$PVP" = "x"; then
33760cfee914Smrg		PVP="0"
33770cfee914Smrg	fi
33780cfee914Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33790cfee914Smrg		[$PVP],
33800cfee914Smrg		[Patch version of this package])
33810cfee914Smrg])
3382335e815aSmrg
33830cfee914Smrg# XORG_CHANGELOG()
33840cfee914Smrg# ----------------
33850cfee914Smrg# Minimum version: 1.2.0
33860cfee914Smrg#
33870cfee914Smrg# Defines the variable CHANGELOG_CMD as the command to generate
33880cfee914Smrg# ChangeLog from git.
33890cfee914Smrg#
33900cfee914Smrg#
33910cfee914SmrgAC_DEFUN([XORG_CHANGELOG], [
33920cfee914SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33930cfee914Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33940cfee914Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33950cfee914Smrgtouch \$(top_srcdir)/ChangeLog; \
33960cfee914Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33970cfee914SmrgAC_SUBST([CHANGELOG_CMD])
33980cfee914Smrg]) # XORG_CHANGELOG
3399335e815aSmrg
3400