118eba588Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
218eba588Smrg
318eba588Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
41cc8c64fSmrg
51cc8c64fSmrg# This file is free software; the Free Software Foundation
61cc8c64fSmrg# gives unlimited permission to copy and/or distribute it,
71cc8c64fSmrg# with or without modifications, as long as this notice is preserved.
81cc8c64fSmrg
91cc8c64fSmrg# This program is distributed in the hope that it will be useful,
101cc8c64fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
111cc8c64fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
121cc8c64fSmrg# PARTICULAR PURPOSE.
131cc8c64fSmrg
1418eba588Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15b9bb67cbSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16b9bb67cbSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1718eba588Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
1818eba588Smrg[m4_warning([this file was generated for autoconf 2.71.
19b9bb67cbSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20b9bb67cbSmrgIf you have problems, you may need to regenerate the build system entirely.
2118eba588SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22b5d2086dSmrg
2318eba588Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
24b5d2086dSmrg#
2518eba588Smrg# This file is free software; the Free Software Foundation
2618eba588Smrg# gives unlimited permission to copy and/or distribute it,
2718eba588Smrg# with or without modifications, as long as this notice is preserved.
28b9bb67cbSmrg
2918eba588Smrg# AM_AUTOMAKE_VERSION(VERSION)
3018eba588Smrg# ----------------------------
3118eba588Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3218eba588Smrg# generated from the m4 files accompanying Automake X.Y.
3318eba588Smrg# (This private macro should not be called outside this file.)
3418eba588SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3518eba588Smrg[am__api_version='1.16'
3618eba588Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3718eba588Smrgdnl require some minimum version.  Point them to the right macro.
3818eba588Smrgm4_if([$1], [1.16.5], [],
3918eba588Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4018eba588Smrg])
411cc8c64fSmrg
4218eba588Smrg# _AM_AUTOCONF_VERSION(VERSION)
4318eba588Smrg# -----------------------------
4418eba588Smrg# aclocal traces this macro to find the Autoconf version.
4518eba588Smrg# This is a private macro too.  Using m4_define simplifies
4618eba588Smrg# the logic in aclocal, which can simply ignore this definition.
4718eba588Smrgm4_define([_AM_AUTOCONF_VERSION], [])
481cc8c64fSmrg
4918eba588Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5018eba588Smrg# -------------------------------
5118eba588Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5218eba588Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5318eba588SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5418eba588Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5518eba588Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5618eba588Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5718eba588Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
581cc8c64fSmrg
5918eba588Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
601cc8c64fSmrg
6118eba588Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6218eba588Smrg#
6318eba588Smrg# This file is free software; the Free Software Foundation
6418eba588Smrg# gives unlimited permission to copy and/or distribute it,
6518eba588Smrg# with or without modifications, as long as this notice is preserved.
66b5d2086dSmrg
6718eba588Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6818eba588Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6918eba588Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
701cc8c64fSmrg#
7118eba588Smrg# Of course, Automake must honor this variable whenever it calls a
7218eba588Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7318eba588Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7418eba588Smrg# depending on how configure is run.  This is pretty annoying, since
7518eba588Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7618eba588Smrg# source directory, any form will work fine, but in subdirectories a
7718eba588Smrg# relative path needs to be adjusted first.
781cc8c64fSmrg#
7918eba588Smrg# $ac_aux_dir/missing
8018eba588Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8118eba588Smrg# $top_srcdir/$ac_aux_dir/missing
8218eba588Smrg#    fails if $ac_aux_dir is absolute,
8318eba588Smrg#    fails when called from a subdirectory in a VPATH build with
8418eba588Smrg#          a relative $ac_aux_dir
85b9bb67cbSmrg#
8618eba588Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8718eba588Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8818eba588Smrg# harmless because $srcdir is '.', but things will broke when you
8918eba588Smrg# start a VPATH build or use an absolute $srcdir.
90b5d2086dSmrg#
9118eba588Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9218eba588Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9318eba588Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9418eba588Smrg# and then we would define $MISSING as
9518eba588Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9618eba588Smrg# This will work as long as MISSING is not called from configure, because
9718eba588Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9818eba588Smrg# However there are other variables, like CC, which are often used in
9918eba588Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100b5d2086dSmrg#
10118eba588Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10218eba588Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10318eba588Smrg# configured tree to be moved without reconfiguration.
10418eba588Smrg
10518eba588SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10618eba588Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10718eba588Smrg# Expand $ac_aux_dir to an absolute path.
10818eba588Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109b5d2086dSmrg])
1101cc8c64fSmrg
11118eba588Smrg# Do all the work for Automake.                             -*- Autoconf -*-
1121cc8c64fSmrg
11318eba588Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
114b9bb67cbSmrg#
11518eba588Smrg# This file is free software; the Free Software Foundation
11618eba588Smrg# gives unlimited permission to copy and/or distribute it,
11718eba588Smrg# with or without modifications, as long as this notice is preserved.
1181cc8c64fSmrg
11918eba588Smrg# This macro actually does too much.  Some checks are only needed if
12018eba588Smrg# your package does certain things.  But this isn't really a big deal.
1211cc8c64fSmrg
12218eba588Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
12318eba588Smrgm4_define([AC_PROG_CC],
12418eba588Smrgm4_defn([AC_PROG_CC])
12518eba588Smrg[_AM_PROG_CC_C_O
126b5d2086dSmrg])
1271cc8c64fSmrg
12818eba588Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
12918eba588Smrg# AM_INIT_AUTOMAKE([OPTIONS])
13018eba588Smrg# -----------------------------------------------
13118eba588Smrg# The call with PACKAGE and VERSION arguments is the old style
13218eba588Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
13318eba588Smrg# and VERSION should now be passed to AC_INIT and removed from
13418eba588Smrg# the call to AM_INIT_AUTOMAKE.
13518eba588Smrg# We support both call styles for the transition.  After
13618eba588Smrg# the next Automake release, Autoconf can make the AC_INIT
13718eba588Smrg# arguments mandatory, and then we can depend on a new Autoconf
13818eba588Smrg# release and drop the old call support.
13918eba588SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
14018eba588Smrg[AC_PREREQ([2.65])dnl
14118eba588Smrgm4_ifdef([_$0_ALREADY_INIT],
14218eba588Smrg  [m4_fatal([$0 expanded multiple times
14318eba588Smrg]m4_defn([_$0_ALREADY_INIT]))],
14418eba588Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
14518eba588Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
14618eba588Smrgdnl the ones we care about.
14718eba588Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
14818eba588SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
14918eba588SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
15018eba588Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
15118eba588Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
15218eba588Smrg  # is not polluted with repeated "-I."
15318eba588Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
15418eba588Smrg  # test to see if srcdir already configured
15518eba588Smrg  if test -f $srcdir/config.status; then
15618eba588Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
15718eba588Smrg  fi
15818eba588Smrgfi
1591cc8c64fSmrg
16018eba588Smrg# test whether we have cygpath
16118eba588Smrgif test -z "$CYGPATH_W"; then
16218eba588Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
16318eba588Smrg    CYGPATH_W='cygpath -w'
16418eba588Smrg  else
16518eba588Smrg    CYGPATH_W=echo
16618eba588Smrg  fi
16718eba588Smrgfi
16818eba588SmrgAC_SUBST([CYGPATH_W])
169b9bb67cbSmrg
17018eba588Smrg# Define the identity of the package.
17118eba588Smrgdnl Distinguish between old-style and new-style calls.
17218eba588Smrgm4_ifval([$2],
17318eba588Smrg[AC_DIAGNOSE([obsolete],
17418eba588Smrg             [$0: two- and three-arguments forms are deprecated.])
17518eba588Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
17618eba588Smrg AC_SUBST([PACKAGE], [$1])dnl
17718eba588Smrg AC_SUBST([VERSION], [$2])],
17818eba588Smrg[_AM_SET_OPTIONS([$1])dnl
17918eba588Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
18018eba588Smrgm4_if(
18118eba588Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
18218eba588Smrg  [ok:ok],,
18318eba588Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
18418eba588Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
18518eba588Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
1861cc8c64fSmrg
18718eba588Smrg_AM_IF_OPTION([no-define],,
18818eba588Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
18918eba588Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
1901cc8c64fSmrg
19118eba588Smrg# Some tools Automake needs.
19218eba588SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
19318eba588SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
19418eba588SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
19518eba588SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
19618eba588SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
19718eba588SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
19818eba588SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
19918eba588SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
20018eba588SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
20118eba588SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
20218eba588Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
20318eba588Smrg# dies out for good.  For more background, see:
20418eba588Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
20518eba588Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
20618eba588SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
20718eba588Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
20818eba588Smrg# system "awk" is bad on some platforms.
20918eba588SmrgAC_REQUIRE([AC_PROG_AWK])dnl
21018eba588SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
21118eba588SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
21218eba588Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
21318eba588Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
21418eba588Smrg			     [_AM_PROG_TAR([v7])])])
21518eba588Smrg_AM_IF_OPTION([no-dependencies],,
21618eba588Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
21718eba588Smrg		  [_AM_DEPENDENCIES([CC])],
21818eba588Smrg		  [m4_define([AC_PROG_CC],
21918eba588Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
22018eba588SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
22118eba588Smrg		  [_AM_DEPENDENCIES([CXX])],
22218eba588Smrg		  [m4_define([AC_PROG_CXX],
22318eba588Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
22418eba588SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
22518eba588Smrg		  [_AM_DEPENDENCIES([OBJC])],
22618eba588Smrg		  [m4_define([AC_PROG_OBJC],
22718eba588Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
22818eba588SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
22918eba588Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
23018eba588Smrg		  [m4_define([AC_PROG_OBJCXX],
23118eba588Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
232b9bb67cbSmrg])
23318eba588Smrg# Variables for tags utilities; see am/tags.am
23418eba588Smrgif test -z "$CTAGS"; then
23518eba588Smrg  CTAGS=ctags
23618eba588Smrgfi
23718eba588SmrgAC_SUBST([CTAGS])
23818eba588Smrgif test -z "$ETAGS"; then
23918eba588Smrg  ETAGS=etags
24018eba588Smrgfi
24118eba588SmrgAC_SUBST([ETAGS])
24218eba588Smrgif test -z "$CSCOPE"; then
24318eba588Smrg  CSCOPE=cscope
24418eba588Smrgfi
24518eba588SmrgAC_SUBST([CSCOPE])
246b9bb67cbSmrg
24718eba588SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
24818eba588Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
24918eba588Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
25018eba588Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
25118eba588SmrgAC_CONFIG_COMMANDS_PRE(dnl
25218eba588Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
25318eba588Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
254b9bb67cbSmrg
25518eba588Smrg# POSIX will say in a future version that running "rm -f" with no argument
25618eba588Smrg# is OK; and we want to be able to make that assumption in our Makefile
25718eba588Smrg# recipes.  So use an aggressive probe to check that the usage we want is
25818eba588Smrg# actually supported "in the wild" to an acceptable degree.
25918eba588Smrg# See automake bug#10828.
26018eba588Smrg# To make any issue more visible, cause the running configure to be aborted
26118eba588Smrg# by default if the 'rm' program in use doesn't match our expectations; the
26218eba588Smrg# user can still override this though.
26318eba588Smrgif rm -f && rm -fr && rm -rf; then : OK; else
26418eba588Smrg  cat >&2 <<'END'
26518eba588SmrgOops!
26618eba588Smrg
26718eba588SmrgYour 'rm' program seems unable to run without file operands specified
26818eba588Smrgon the command line, even when the '-f' option is present.  This is contrary
26918eba588Smrgto the behaviour of most rm programs out there, and not conforming with
27018eba588Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
27118eba588Smrg
27218eba588SmrgPlease tell bug-automake@gnu.org about your system, including the value
27318eba588Smrgof your $PATH and any error possibly output before this message.  This
27418eba588Smrgcan help us improve future automake versions.
275b9bb67cbSmrg
27618eba588SmrgEND
27718eba588Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
27818eba588Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
27918eba588Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
28018eba588Smrg    echo >&2
28118eba588Smrg  else
28218eba588Smrg    cat >&2 <<'END'
28318eba588SmrgAborting the configuration process, to ensure you take notice of the issue.
284b9bb67cbSmrg
28518eba588SmrgYou can download and install GNU coreutils to get an 'rm' implementation
28618eba588Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
287b5d2086dSmrg
28818eba588SmrgIf you want to complete the configuration process using your problematic
28918eba588Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
29018eba588Smrgto "yes", and re-run configure.
29118eba588Smrg
29218eba588SmrgEND
29318eba588Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
29418eba588Smrg  fi
29518eba588Smrgfi
29618eba588Smrgdnl The trailing newline in this macro's definition is deliberate, for
29718eba588Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
29818eba588Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
299b9bb67cbSmrg])
300b9bb67cbSmrg
30118eba588Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
30218eba588Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
30318eba588Smrgdnl mangled by Autoconf and run in a shell conditional statement.
30418eba588Smrgm4_define([_AC_COMPILER_EXEEXT],
30518eba588Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
306b9bb67cbSmrg
30718eba588Smrg# When config.status generates a header, we must update the stamp-h file.
30818eba588Smrg# This file resides in the same directory as the config header
30918eba588Smrg# that is generated.  The stamp files are numbered to have different names.
310b5d2086dSmrg
31118eba588Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
31218eba588Smrg# loop where config.status creates the headers, so we can generate
31318eba588Smrg# our stamp files there.
31418eba588SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
31518eba588Smrg[# Compute $1's index in $config_headers.
31618eba588Smrg_am_arg=$1
31718eba588Smrg_am_stamp_count=1
31818eba588Smrgfor _am_header in $config_headers :; do
31918eba588Smrg  case $_am_header in
32018eba588Smrg    $_am_arg | $_am_arg:* )
32118eba588Smrg      break ;;
32218eba588Smrg    * )
32318eba588Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
32418eba588Smrg  esac
32518eba588Smrgdone
32618eba588Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
327b9bb67cbSmrg
32818eba588Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
32918eba588Smrg#
33018eba588Smrg# This file is free software; the Free Software Foundation
33118eba588Smrg# gives unlimited permission to copy and/or distribute it,
33218eba588Smrg# with or without modifications, as long as this notice is preserved.
333b9bb67cbSmrg
33418eba588Smrg# AM_PROG_INSTALL_SH
33518eba588Smrg# ------------------
33618eba588Smrg# Define $install_sh.
33718eba588SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
33818eba588Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
33918eba588Smrgif test x"${install_sh+set}" != xset; then
34018eba588Smrg  case $am_aux_dir in
34118eba588Smrg  *\ * | *\	*)
34218eba588Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
34318eba588Smrg  *)
34418eba588Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
34518eba588Smrg  esac
34618eba588Smrgfi
34718eba588SmrgAC_SUBST([install_sh])])
348b9bb67cbSmrg
34918eba588Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
350b9bb67cbSmrg#
35118eba588Smrg# This file is free software; the Free Software Foundation
35218eba588Smrg# gives unlimited permission to copy and/or distribute it,
35318eba588Smrg# with or without modifications, as long as this notice is preserved.
354b9bb67cbSmrg
35518eba588Smrg# Check whether the underlying file-system supports filenames
35618eba588Smrg# with a leading dot.  For instance MS-DOS doesn't.
35718eba588SmrgAC_DEFUN([AM_SET_LEADING_DOT],
35818eba588Smrg[rm -rf .tst 2>/dev/null
35918eba588Smrgmkdir .tst 2>/dev/null
36018eba588Smrgif test -d .tst; then
36118eba588Smrg  am__leading_dot=.
36218eba588Smrgelse
36318eba588Smrg  am__leading_dot=_
36418eba588Smrgfi
36518eba588Smrgrmdir .tst 2>/dev/null
36618eba588SmrgAC_SUBST([am__leading_dot])])
367b9bb67cbSmrg
36818eba588Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
369b5d2086dSmrg
37018eba588Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
371b9bb67cbSmrg#
37218eba588Smrg# This file is free software; the Free Software Foundation
37318eba588Smrg# gives unlimited permission to copy and/or distribute it,
37418eba588Smrg# with or without modifications, as long as this notice is preserved.
375b9bb67cbSmrg
37618eba588Smrg# AM_MISSING_PROG(NAME, PROGRAM)
37718eba588Smrg# ------------------------------
37818eba588SmrgAC_DEFUN([AM_MISSING_PROG],
37918eba588Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
38018eba588Smrg$1=${$1-"${am_missing_run}$2"}
38118eba588SmrgAC_SUBST($1)])
38218eba588Smrg
38318eba588Smrg# AM_MISSING_HAS_RUN
38418eba588Smrg# ------------------
38518eba588Smrg# Define MISSING if not defined so far and test if it is modern enough.
38618eba588Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
38718eba588SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
38818eba588Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
38918eba588SmrgAC_REQUIRE_AUX_FILE([missing])dnl
39018eba588Smrgif test x"${MISSING+set}" != xset; then
39118eba588Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
39218eba588Smrgfi
39318eba588Smrg# Use eval to expand $SHELL
39418eba588Smrgif eval "$MISSING --is-lightweight"; then
39518eba588Smrg  am_missing_run="$MISSING "
39618eba588Smrgelse
39718eba588Smrg  am_missing_run=
39818eba588Smrg  AC_MSG_WARN(['missing' script is too old or missing])
39918eba588Smrgfi
40018eba588Smrg])
40118eba588Smrg
40218eba588Smrg# Helper functions for option handling.                     -*- Autoconf -*-
403b9bb67cbSmrg
40418eba588Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
405b5d2086dSmrg#
40618eba588Smrg# This file is free software; the Free Software Foundation
40718eba588Smrg# gives unlimited permission to copy and/or distribute it,
40818eba588Smrg# with or without modifications, as long as this notice is preserved.
40918eba588Smrg
41018eba588Smrg# _AM_MANGLE_OPTION(NAME)
41118eba588Smrg# -----------------------
41218eba588SmrgAC_DEFUN([_AM_MANGLE_OPTION],
41318eba588Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
41418eba588Smrg
41518eba588Smrg# _AM_SET_OPTION(NAME)
41618eba588Smrg# --------------------
41718eba588Smrg# Set option NAME.  Presently that only means defining a flag for this option.
41818eba588SmrgAC_DEFUN([_AM_SET_OPTION],
41918eba588Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
42018eba588Smrg
42118eba588Smrg# _AM_SET_OPTIONS(OPTIONS)
42218eba588Smrg# ------------------------
42318eba588Smrg# OPTIONS is a space-separated list of Automake options.
42418eba588SmrgAC_DEFUN([_AM_SET_OPTIONS],
42518eba588Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
42618eba588Smrg
42718eba588Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
42818eba588Smrg# -------------------------------------------
42918eba588Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
43018eba588SmrgAC_DEFUN([_AM_IF_OPTION],
43118eba588Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
43218eba588Smrg
43318eba588Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
43418eba588Smrg
43518eba588Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
436b5d2086dSmrg#
43718eba588Smrg# This file is free software; the Free Software Foundation
43818eba588Smrg# gives unlimited permission to copy and/or distribute it,
43918eba588Smrg# with or without modifications, as long as this notice is preserved.
44018eba588Smrg
44118eba588Smrg# AM_SANITY_CHECK
44218eba588Smrg# ---------------
44318eba588SmrgAC_DEFUN([AM_SANITY_CHECK],
44418eba588Smrg[AC_MSG_CHECKING([whether build environment is sane])
44518eba588Smrg# Reject unsafe characters in $srcdir or the absolute working directory
44618eba588Smrg# name.  Accept space and tab only in the latter.
44718eba588Smrgam_lf='
44818eba588Smrg'
44918eba588Smrgcase `pwd` in
45018eba588Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
45118eba588Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
45218eba588Smrgesac
45318eba588Smrgcase $srcdir in
45418eba588Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
45518eba588Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
45618eba588Smrgesac
45718eba588Smrg
45818eba588Smrg# Do 'set' in a subshell so we don't clobber the current shell's
45918eba588Smrg# arguments.  Must try -L first in case configure is actually a
46018eba588Smrg# symlink; some systems play weird games with the mod time of symlinks
46118eba588Smrg# (eg FreeBSD returns the mod time of the symlink's containing
46218eba588Smrg# directory).
46318eba588Smrgif (
46418eba588Smrg   am_has_slept=no
46518eba588Smrg   for am_try in 1 2; do
46618eba588Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
46718eba588Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
46818eba588Smrg     if test "$[*]" = "X"; then
46918eba588Smrg	# -L didn't work.
47018eba588Smrg	set X `ls -t "$srcdir/configure" conftest.file`
47118eba588Smrg     fi
47218eba588Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
47318eba588Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
47418eba588Smrg
47518eba588Smrg	# If neither matched, then we have a broken ls.  This can happen
47618eba588Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
47718eba588Smrg	# broken ls alias from the environment.  This has actually
47818eba588Smrg	# happened.  Such a system could not be considered "sane".
47918eba588Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
48018eba588Smrg  alias in your environment])
48118eba588Smrg     fi
48218eba588Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
48318eba588Smrg       break
48418eba588Smrg     fi
48518eba588Smrg     # Just in case.
48618eba588Smrg     sleep 1
48718eba588Smrg     am_has_slept=yes
48818eba588Smrg   done
48918eba588Smrg   test "$[2]" = conftest.file
49018eba588Smrg   )
49118eba588Smrgthen
49218eba588Smrg   # Ok.
49318eba588Smrg   :
49418eba588Smrgelse
49518eba588Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
49618eba588SmrgCheck your system clock])
49718eba588Smrgfi
49818eba588SmrgAC_MSG_RESULT([yes])
49918eba588Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
50018eba588Smrg# generated files are strictly newer.
50118eba588Smrgam_sleep_pid=
50218eba588Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
50318eba588Smrg  ( sleep 1 ) &
50418eba588Smrg  am_sleep_pid=$!
50518eba588Smrgfi
50618eba588SmrgAC_CONFIG_COMMANDS_PRE(
50718eba588Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
50818eba588Smrg   if test -n "$am_sleep_pid"; then
50918eba588Smrg     # Hide warnings about reused PIDs.
51018eba588Smrg     wait $am_sleep_pid 2>/dev/null
51118eba588Smrg   fi
51218eba588Smrg   AC_MSG_RESULT([done])])
51318eba588Smrgrm -f conftest.file
51418eba588Smrg])
51518eba588Smrg
51618eba588Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
517b5d2086dSmrg#
51818eba588Smrg# This file is free software; the Free Software Foundation
51918eba588Smrg# gives unlimited permission to copy and/or distribute it,
52018eba588Smrg# with or without modifications, as long as this notice is preserved.
52118eba588Smrg
52218eba588Smrg# AM_SILENT_RULES([DEFAULT])
52318eba588Smrg# --------------------------
52418eba588Smrg# Enable less verbose build rules; with the default set to DEFAULT
52518eba588Smrg# ("yes" being less verbose, "no" or empty being verbose).
52618eba588SmrgAC_DEFUN([AM_SILENT_RULES],
52718eba588Smrg[AC_ARG_ENABLE([silent-rules], [dnl
52818eba588SmrgAS_HELP_STRING(
52918eba588Smrg  [--enable-silent-rules],
53018eba588Smrg  [less verbose build output (undo: "make V=1")])
53118eba588SmrgAS_HELP_STRING(
53218eba588Smrg  [--disable-silent-rules],
53318eba588Smrg  [verbose build output (undo: "make V=0")])dnl
53418eba588Smrg])
53518eba588Smrgcase $enable_silent_rules in @%:@ (((
53618eba588Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
53718eba588Smrg   no) AM_DEFAULT_VERBOSITY=1;;
53818eba588Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
53918eba588Smrgesac
54018eba588Smrgdnl
54118eba588Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
54218eba588Smrgdnl do not support nested variable expansions.
54318eba588Smrgdnl See automake bug#9928 and bug#10237.
54418eba588Smrgam_make=${MAKE-make}
54518eba588SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
54618eba588Smrg   [am_cv_make_support_nested_variables],
54718eba588Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
54818eba588SmrgBAR0=false
54918eba588SmrgBAR1=true
55018eba588SmrgV=1
55118eba588Smrgam__doit:
55218eba588Smrg	@$(TRUE)
55318eba588Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
55418eba588Smrg  am_cv_make_support_nested_variables=yes
55518eba588Smrgelse
55618eba588Smrg  am_cv_make_support_nested_variables=no
55718eba588Smrgfi])
55818eba588Smrgif test $am_cv_make_support_nested_variables = yes; then
55918eba588Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
56018eba588Smrg  AM_V='$(V)'
56118eba588Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
56218eba588Smrgelse
56318eba588Smrg  AM_V=$AM_DEFAULT_VERBOSITY
56418eba588Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
56518eba588Smrgfi
56618eba588SmrgAC_SUBST([AM_V])dnl
56718eba588SmrgAM_SUBST_NOTMAKE([AM_V])dnl
56818eba588SmrgAC_SUBST([AM_DEFAULT_V])dnl
56918eba588SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
57018eba588SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
57118eba588SmrgAM_BACKSLASH='\'
57218eba588SmrgAC_SUBST([AM_BACKSLASH])dnl
57318eba588Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
57418eba588Smrg])
57518eba588Smrg
57618eba588Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
577b5d2086dSmrg#
57818eba588Smrg# This file is free software; the Free Software Foundation
57918eba588Smrg# gives unlimited permission to copy and/or distribute it,
58018eba588Smrg# with or without modifications, as long as this notice is preserved.
581b9bb67cbSmrg
58218eba588Smrg# AM_PROG_INSTALL_STRIP
58318eba588Smrg# ---------------------
58418eba588Smrg# One issue with vendor 'install' (even GNU) is that you can't
58518eba588Smrg# specify the program used to strip binaries.  This is especially
58618eba588Smrg# annoying in cross-compiling environments, where the build's strip
58718eba588Smrg# is unlikely to handle the host's binaries.
58818eba588Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
58918eba588Smrg# always use install-sh in "make install-strip", and initialize
59018eba588Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
59118eba588SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
59218eba588Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
59318eba588Smrg# Installed binaries are usually stripped using 'strip' when the user
59418eba588Smrg# run "make install-strip".  However 'strip' might not be the right
59518eba588Smrg# tool to use in cross-compilation environments, therefore Automake
59618eba588Smrg# will honor the 'STRIP' environment variable to overrule this program.
59718eba588Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
59818eba588Smrgif test "$cross_compiling" != no; then
59918eba588Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
60018eba588Smrgfi
60118eba588SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
60218eba588SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
60318eba588Smrg
60418eba588Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
60518eba588Smrg#
60618eba588Smrg# This file is free software; the Free Software Foundation
60718eba588Smrg# gives unlimited permission to copy and/or distribute it,
60818eba588Smrg# with or without modifications, as long as this notice is preserved.
60918eba588Smrg
61018eba588Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
61118eba588Smrg# ---------------------------
61218eba588Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
61318eba588Smrg# This macro is traced by Automake.
61418eba588SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
61518eba588Smrg
61618eba588Smrg# AM_SUBST_NOTMAKE(VARIABLE)
61718eba588Smrg# --------------------------
61818eba588Smrg# Public sister of _AM_SUBST_NOTMAKE.
61918eba588SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
62018eba588Smrg
62118eba588Smrg# Check how to create a tarball.                            -*- Autoconf -*-
62218eba588Smrg
62318eba588Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
62418eba588Smrg#
62518eba588Smrg# This file is free software; the Free Software Foundation
62618eba588Smrg# gives unlimited permission to copy and/or distribute it,
62718eba588Smrg# with or without modifications, as long as this notice is preserved.
62818eba588Smrg
62918eba588Smrg# _AM_PROG_TAR(FORMAT)
63018eba588Smrg# --------------------
63118eba588Smrg# Check how to create a tarball in format FORMAT.
63218eba588Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
63318eba588Smrg#
63418eba588Smrg# Substitute a variable $(am__tar) that is a command
63518eba588Smrg# writing to stdout a FORMAT-tarball containing the directory
63618eba588Smrg# $tardir.
63718eba588Smrg#     tardir=directory && $(am__tar) > result.tar
63818eba588Smrg#
63918eba588Smrg# Substitute a variable $(am__untar) that extract such
64018eba588Smrg# a tarball read from stdin.
64118eba588Smrg#     $(am__untar) < result.tar
64218eba588Smrg#
64318eba588SmrgAC_DEFUN([_AM_PROG_TAR],
64418eba588Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
64518eba588Smrg# in the wild :-(  We should find a proper way to deprecate it ...
64618eba588SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
64718eba588Smrg
64818eba588Smrg# We'll loop over all known methods to create a tar archive until one works.
64918eba588Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
65018eba588Smrg
65118eba588Smrgm4_if([$1], [v7],
65218eba588Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
65318eba588Smrg
65418eba588Smrg  [m4_case([$1],
65518eba588Smrg    [ustar],
65618eba588Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
65718eba588Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
65818eba588Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
65918eba588Smrg      # and bug#13588).
66018eba588Smrg      am_max_uid=2097151 # 2^21 - 1
66118eba588Smrg      am_max_gid=$am_max_uid
66218eba588Smrg      # The $UID and $GID variables are not portable, so we need to resort
66318eba588Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
66418eba588Smrg      # below are definitely unexpected, so allow the users to see them
66518eba588Smrg      # (that is, avoid stderr redirection).
66618eba588Smrg      am_uid=`id -u || echo unknown`
66718eba588Smrg      am_gid=`id -g || echo unknown`
66818eba588Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
66918eba588Smrg      if test $am_uid -le $am_max_uid; then
67018eba588Smrg         AC_MSG_RESULT([yes])
67118eba588Smrg      else
67218eba588Smrg         AC_MSG_RESULT([no])
67318eba588Smrg         _am_tools=none
67418eba588Smrg      fi
67518eba588Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
67618eba588Smrg      if test $am_gid -le $am_max_gid; then
67718eba588Smrg         AC_MSG_RESULT([yes])
67818eba588Smrg      else
67918eba588Smrg        AC_MSG_RESULT([no])
68018eba588Smrg        _am_tools=none
68118eba588Smrg      fi],
68218eba588Smrg
68318eba588Smrg  [pax],
68418eba588Smrg    [],
68518eba588Smrg
68618eba588Smrg  [m4_fatal([Unknown tar format])])
68718eba588Smrg
68818eba588Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
68918eba588Smrg
69018eba588Smrg  # Go ahead even if we have the value already cached.  We do so because we
69118eba588Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
69218eba588Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
69318eba588Smrg
69418eba588Smrg  for _am_tool in $_am_tools; do
69518eba588Smrg    case $_am_tool in
69618eba588Smrg    gnutar)
69718eba588Smrg      for _am_tar in tar gnutar gtar; do
69818eba588Smrg        AM_RUN_LOG([$_am_tar --version]) && break
69918eba588Smrg      done
70018eba588Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
70118eba588Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
70218eba588Smrg      am__untar="$_am_tar -xf -"
70318eba588Smrg      ;;
70418eba588Smrg    plaintar)
70518eba588Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
70618eba588Smrg      # ustar tarball either.
70718eba588Smrg      (tar --version) >/dev/null 2>&1 && continue
70818eba588Smrg      am__tar='tar chf - "$$tardir"'
70918eba588Smrg      am__tar_='tar chf - "$tardir"'
71018eba588Smrg      am__untar='tar xf -'
71118eba588Smrg      ;;
71218eba588Smrg    pax)
71318eba588Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
71418eba588Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
71518eba588Smrg      am__untar='pax -r'
71618eba588Smrg      ;;
71718eba588Smrg    cpio)
71818eba588Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
71918eba588Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
72018eba588Smrg      am__untar='cpio -i -H $1 -d'
72118eba588Smrg      ;;
72218eba588Smrg    none)
72318eba588Smrg      am__tar=false
72418eba588Smrg      am__tar_=false
72518eba588Smrg      am__untar=false
72618eba588Smrg      ;;
72718eba588Smrg    esac
72818eba588Smrg
72918eba588Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
73018eba588Smrg    # and am__untar set.
73118eba588Smrg    test -n "${am_cv_prog_tar_$1}" && break
73218eba588Smrg
73318eba588Smrg    # tar/untar a dummy directory, and stop if the command works.
73418eba588Smrg    rm -rf conftest.dir
73518eba588Smrg    mkdir conftest.dir
73618eba588Smrg    echo GrepMe > conftest.dir/file
73718eba588Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
73818eba588Smrg    rm -rf conftest.dir
73918eba588Smrg    if test -s conftest.tar; then
74018eba588Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
74118eba588Smrg      AM_RUN_LOG([cat conftest.dir/file])
74218eba588Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
74318eba588Smrg    fi
74418eba588Smrg  done
74518eba588Smrg  rm -rf conftest.dir
74618eba588Smrg
74718eba588Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
74818eba588Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
74918eba588Smrg
75018eba588SmrgAC_SUBST([am__tar])
75118eba588SmrgAC_SUBST([am__untar])
75218eba588Smrg]) # _AM_PROG_TAR
75318eba588Smrg
75418eba588Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
75518eba588Smrgdnl serial 11 (pkg-config-0.29)
75618eba588Smrgdnl
75718eba588Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
75818eba588Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
75918eba588Smrgdnl
76018eba588Smrgdnl This program is free software; you can redistribute it and/or modify
76118eba588Smrgdnl it under the terms of the GNU General Public License as published by
76218eba588Smrgdnl the Free Software Foundation; either version 2 of the License, or
76318eba588Smrgdnl (at your option) any later version.
76418eba588Smrgdnl
76518eba588Smrgdnl This program is distributed in the hope that it will be useful, but
76618eba588Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
76718eba588Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
76818eba588Smrgdnl General Public License for more details.
76918eba588Smrgdnl
77018eba588Smrgdnl You should have received a copy of the GNU General Public License
77118eba588Smrgdnl along with this program; if not, write to the Free Software
77218eba588Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
77318eba588Smrgdnl 02111-1307, USA.
77418eba588Smrgdnl
77518eba588Smrgdnl As a special exception to the GNU General Public License, if you
77618eba588Smrgdnl distribute this file as part of a program that contains a
77718eba588Smrgdnl configuration script generated by Autoconf, you may include it under
77818eba588Smrgdnl the same distribution terms that you use for the rest of that
77918eba588Smrgdnl program.
78018eba588Smrg
78118eba588Smrgdnl PKG_PREREQ(MIN-VERSION)
78218eba588Smrgdnl -----------------------
78318eba588Smrgdnl Since: 0.29
78418eba588Smrgdnl
78518eba588Smrgdnl Verify that the version of the pkg-config macros are at least
78618eba588Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
78718eba588Smrgdnl installed version of pkg-config, this checks the developer's version
78818eba588Smrgdnl of pkg.m4 when generating configure.
78918eba588Smrgdnl
79018eba588Smrgdnl To ensure that this macro is defined, also add:
79118eba588Smrgdnl m4_ifndef([PKG_PREREQ],
79218eba588Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
79318eba588Smrgdnl
79418eba588Smrgdnl See the "Since" comment for each macro you use to see what version
79518eba588Smrgdnl of the macros you require.
79618eba588Smrgm4_defun([PKG_PREREQ],
79718eba588Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
79818eba588Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
79918eba588Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
80018eba588Smrg])dnl PKG_PREREQ
80118eba588Smrg
80218eba588Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
80318eba588Smrgdnl ----------------------------------
80418eba588Smrgdnl Since: 0.16
80518eba588Smrgdnl
80618eba588Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
80718eba588Smrgdnl first found in the path. Checks that the version of pkg-config found
80818eba588Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
80918eba588Smrgdnl used since that's the first version where most current features of
81018eba588Smrgdnl pkg-config existed.
811b5d2086dSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
812b5d2086dSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
81318eba588Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
81418eba588Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
815b5d2086dSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
816b5d2086dSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
817b5d2086dSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
818b9bb67cbSmrg
819b5d2086dSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
820b5d2086dSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
821b9bb67cbSmrgfi
822b5d2086dSmrgif test -n "$PKG_CONFIG"; then
823b5d2086dSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
824b5d2086dSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
825b5d2086dSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
826b5d2086dSmrg		AC_MSG_RESULT([yes])
827b5d2086dSmrg	else
828b5d2086dSmrg		AC_MSG_RESULT([no])
829b5d2086dSmrg		PKG_CONFIG=""
830b5d2086dSmrg	fi
831b5d2086dSmrgfi[]dnl
83218eba588Smrg])dnl PKG_PROG_PKG_CONFIG
833b9bb67cbSmrg
83418eba588Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
83518eba588Smrgdnl -------------------------------------------------------------------
83618eba588Smrgdnl Since: 0.18
83718eba588Smrgdnl
83818eba588Smrgdnl Check to see whether a particular set of modules exists. Similar to
83918eba588Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
84018eba588Smrgdnl
84118eba588Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
84218eba588Smrgdnl only at the first occurence in configure.ac, so if the first place
84318eba588Smrgdnl it's called might be skipped (such as if it is within an "if", you
84418eba588Smrgdnl have to call PKG_CHECK_EXISTS manually
845b5d2086dSmrgAC_DEFUN([PKG_CHECK_EXISTS],
846b5d2086dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
847b5d2086dSmrgif test -n "$PKG_CONFIG" && \
848b5d2086dSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
849b5d2086dSmrg  m4_default([$2], [:])
850b5d2086dSmrgm4_ifvaln([$3], [else
851b5d2086dSmrg  $3])dnl
852b5d2086dSmrgfi])
853b9bb67cbSmrg
85418eba588Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
85518eba588Smrgdnl ---------------------------------------------
85618eba588Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
85718eba588Smrgdnl pkg_failed based on the result.
858b5d2086dSmrgm4_define([_PKG_CONFIG],
859b5d2086dSmrg[if test -n "$$1"; then
860b5d2086dSmrg    pkg_cv_[]$1="$$1"
861b5d2086dSmrg elif test -n "$PKG_CONFIG"; then
862b5d2086dSmrg    PKG_CHECK_EXISTS([$3],
86318eba588Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
86418eba588Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
865b5d2086dSmrg		     [pkg_failed=yes])
866b5d2086dSmrg else
867b5d2086dSmrg    pkg_failed=untried
868b5d2086dSmrgfi[]dnl
86918eba588Smrg])dnl _PKG_CONFIG
870b9bb67cbSmrg
87118eba588Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
87218eba588Smrgdnl ---------------------------
87318eba588Smrgdnl Internal check to see if pkg-config supports short errors.
874b5d2086dSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
875b5d2086dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
876b5d2086dSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
877b5d2086dSmrg        _pkg_short_errors_supported=yes
878b5d2086dSmrgelse
879b5d2086dSmrg        _pkg_short_errors_supported=no
880b5d2086dSmrgfi[]dnl
88118eba588Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
882b9bb67cbSmrg
883b9bb67cbSmrg
88418eba588Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
88518eba588Smrgdnl   [ACTION-IF-NOT-FOUND])
88618eba588Smrgdnl --------------------------------------------------------------
88718eba588Smrgdnl Since: 0.4.0
88818eba588Smrgdnl
88918eba588Smrgdnl Note that if there is a possibility the first call to
89018eba588Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
89118eba588Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
892b5d2086dSmrgAC_DEFUN([PKG_CHECK_MODULES],
893b5d2086dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
894b5d2086dSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
895b5d2086dSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
896b9bb67cbSmrg
897b5d2086dSmrgpkg_failed=no
898b5d2086dSmrgAC_MSG_CHECKING([for $1])
899b5d2086dSmrg
900b5d2086dSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
901b5d2086dSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
902b5d2086dSmrg
903b5d2086dSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
904b5d2086dSmrgand $1[]_LIBS to avoid the need to call pkg-config.
905b5d2086dSmrgSee the pkg-config man page for more details.])
906b5d2086dSmrg
907b5d2086dSmrgif test $pkg_failed = yes; then
908b5d2086dSmrg   	AC_MSG_RESULT([no])
909b5d2086dSmrg        _PKG_SHORT_ERRORS_SUPPORTED
910b5d2086dSmrg        if test $_pkg_short_errors_supported = yes; then
91118eba588Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
912b5d2086dSmrg        else 
91318eba588Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
914b5d2086dSmrg        fi
915b5d2086dSmrg	# Put the nasty error message in config.log where it belongs
916b5d2086dSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
917b5d2086dSmrg
918b5d2086dSmrg	m4_default([$4], [AC_MSG_ERROR(
919b5d2086dSmrg[Package requirements ($2) were not met:
920b5d2086dSmrg
921b5d2086dSmrg$$1_PKG_ERRORS
922b5d2086dSmrg
923b5d2086dSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
924b5d2086dSmrginstalled software in a non-standard prefix.
925b5d2086dSmrg
926b5d2086dSmrg_PKG_TEXT])[]dnl
927b5d2086dSmrg        ])
928b5d2086dSmrgelif test $pkg_failed = untried; then
929b5d2086dSmrg     	AC_MSG_RESULT([no])
930b5d2086dSmrg	m4_default([$4], [AC_MSG_FAILURE(
931b5d2086dSmrg[The pkg-config script could not be found or is too old.  Make sure it
932b5d2086dSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
933b5d2086dSmrgpath to pkg-config.
934b5d2086dSmrg
935b5d2086dSmrg_PKG_TEXT
936b5d2086dSmrg
93718eba588SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
938b5d2086dSmrg        ])
939b5d2086dSmrgelse
940b5d2086dSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
941b5d2086dSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
942b5d2086dSmrg        AC_MSG_RESULT([yes])
943b5d2086dSmrg	$3
944b5d2086dSmrgfi[]dnl
94518eba588Smrg])dnl PKG_CHECK_MODULES
946b9bb67cbSmrg
94718eba588Smrg
94818eba588Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
94918eba588Smrgdnl   [ACTION-IF-NOT-FOUND])
95018eba588Smrgdnl ---------------------------------------------------------------------
95118eba588Smrgdnl Since: 0.29
95218eba588Smrgdnl
95318eba588Smrgdnl Checks for existence of MODULES and gathers its build flags with
95418eba588Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
95518eba588Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
95618eba588Smrgdnl
95718eba588Smrgdnl Note that if there is a possibility the first call to
95818eba588Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
95918eba588Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
96018eba588Smrgdnl configure.ac.
96118eba588SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
96218eba588Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
96318eba588Smrg_save_PKG_CONFIG=$PKG_CONFIG
96418eba588SmrgPKG_CONFIG="$PKG_CONFIG --static"
96518eba588SmrgPKG_CHECK_MODULES($@)
96618eba588SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
96718eba588Smrg])dnl PKG_CHECK_MODULES_STATIC
96818eba588Smrg
96918eba588Smrg
97018eba588Smrgdnl PKG_INSTALLDIR([DIRECTORY])
97118eba588Smrgdnl -------------------------
97218eba588Smrgdnl Since: 0.27
97318eba588Smrgdnl
97418eba588Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
97518eba588Smrgdnl should install pkg-config .pc files. By default the directory is
97618eba588Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
97718eba588Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
97818eba588Smrgdnl parameter.
97918eba588SmrgAC_DEFUN([PKG_INSTALLDIR],
98018eba588Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
98118eba588Smrgm4_pushdef([pkg_description],
98218eba588Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
98318eba588SmrgAC_ARG_WITH([pkgconfigdir],
98418eba588Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
98518eba588Smrg    [with_pkgconfigdir=]pkg_default)
98618eba588SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
98718eba588Smrgm4_popdef([pkg_default])
98818eba588Smrgm4_popdef([pkg_description])
98918eba588Smrg])dnl PKG_INSTALLDIR
99018eba588Smrg
99118eba588Smrg
99218eba588Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
99318eba588Smrgdnl --------------------------------
99418eba588Smrgdnl Since: 0.27
99518eba588Smrgdnl
99618eba588Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
99718eba588Smrgdnl module should install arch-independent pkg-config .pc files. By
99818eba588Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
99918eba588Smrgdnl changed by passing DIRECTORY. The user can override through the
100018eba588Smrgdnl --with-noarch-pkgconfigdir parameter.
100118eba588SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
100218eba588Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
100318eba588Smrgm4_pushdef([pkg_description],
100418eba588Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
100518eba588SmrgAC_ARG_WITH([noarch-pkgconfigdir],
100618eba588Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
100718eba588Smrg    [with_noarch_pkgconfigdir=]pkg_default)
100818eba588SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
100918eba588Smrgm4_popdef([pkg_default])
101018eba588Smrgm4_popdef([pkg_description])
101118eba588Smrg])dnl PKG_NOARCH_INSTALLDIR
101218eba588Smrg
101318eba588Smrg
101418eba588Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
101518eba588Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
101618eba588Smrgdnl -------------------------------------------
101718eba588Smrgdnl Since: 0.28
101818eba588Smrgdnl
101918eba588Smrgdnl Retrieves the value of the pkg-config variable for the given module.
102018eba588SmrgAC_DEFUN([PKG_CHECK_VAR],
102118eba588Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
102218eba588SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
102318eba588Smrg
102418eba588Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
102518eba588SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
102618eba588Smrg
102718eba588SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
102818eba588Smrg])dnl PKG_CHECK_VAR
102918eba588Smrg
103018eba588Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
103118eba588Smrgdnl
103218eba588Smrgdnl This file comes from X.Org's font-util 1.4.0
103318eba588Smrgdnl
103418eba588Smrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
1035b5d2086dSmrgdnl
1036b5d2086dSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1037b5d2086dSmrgdnl copy of this software and associated documentation files (the "Software"),
1038b5d2086dSmrgdnl to deal in the Software without restriction, including without limitation
1039b5d2086dSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1040b5d2086dSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1041b5d2086dSmrgdnl Software is furnished to do so, subject to the following conditions:
1042b5d2086dSmrgdnl
1043b5d2086dSmrgdnl The above copyright notice and this permission notice (including the next
1044b5d2086dSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1045b5d2086dSmrgdnl Software.
1046b5d2086dSmrgdnl
1047b5d2086dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1048b5d2086dSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1049b5d2086dSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1050b5d2086dSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1051b5d2086dSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1052b5d2086dSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1053b5d2086dSmrgdnl DEALINGS IN THE SOFTWARE.
105418eba588Smrgdnl
105518eba588Smrgdnl --------------------------------------------------------------------
105618eba588Smrgdnl
105718eba588Smrgdnl Copyright 2005 Red Hat, Inc
105818eba588Smrgdnl
105918eba588Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
106018eba588Smrgdnl documentation for any purpose is hereby granted without fee, provided that
106118eba588Smrgdnl the above copyright notice appear in all copies and that both that
106218eba588Smrgdnl copyright notice and this permission notice appear in supporting
106318eba588Smrgdnl documentation.
106418eba588Smrgdnl
106518eba588Smrgdnl The above copyright notice and this permission notice shall be included
106618eba588Smrgdnl in all copies or substantial portions of the Software.
106718eba588Smrgdnl
106818eba588Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
106918eba588Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
107018eba588Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
107118eba588Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
107218eba588Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
107318eba588Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
107418eba588Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
107518eba588Smrgdnl
107618eba588Smrgdnl Except as contained in this notice, the name of the copyright holders shall
107718eba588Smrgdnl not be used in advertising or otherwise to promote the sale, use or
107818eba588Smrgdnl other dealings in this Software without prior written authorization
107918eba588Smrgdnl from the copyright holders.
1080b9bb67cbSmrg
108118eba588Smrg# XORG_FONT_MACROS_VERSION(required-version)
108218eba588Smrg# ------------------------------------------
1083b5d2086dSmrg# Minimum version: 1.1.0
1084b9bb67cbSmrg#
1085b5d2086dSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1086b5d2086dSmrg# your configure.ac with the minimum required version, such as:
108718eba588Smrg# XORG_FONT_MACROS_VERSION(1.1)
1088b5d2086dSmrg#
1089b5d2086dSmrg# To ensure that this macro is defined, also add:
109018eba588Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
109118eba588Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
1092b5d2086dSmrg#
1093b5d2086dSmrg#
109418eba588Smrg# See the "minimum version" comment for each macro you use to see what
1095b5d2086dSmrg# version you require.
109618eba588Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
109718eba588Smrgm4_define([vers_have], [1.4.0])
1098b5d2086dSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1099b5d2086dSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1100b5d2086dSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
110118eba588Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
1102b5d2086dSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
110318eba588Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
1104b5d2086dSmrgm4_undefine([vers_have])
1105b5d2086dSmrgm4_undefine([maj_have])
1106b5d2086dSmrgm4_undefine([maj_needed])
110718eba588Smrg]) # XORG_FONT_MACROS_VERSION
1108b9bb67cbSmrg
110918eba588Smrg# XORG_FONT_CHECK_{maps}()
111018eba588Smrg# ------------------------
1111b5d2086dSmrg# Minimum version: 1.0.0
111218eba588Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
111318eba588Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
1114b9bb67cbSmrg
111518eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
111618eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
111718eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
111818eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
111918eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
112018eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
112118eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
112218eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
112318eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
112418eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
112518eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
112618eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
112718eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
112818eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
112918eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
113018eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
113118eba588SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
113218eba588SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
1133b9bb67cbSmrg
113418eba588Smrg# XORG_FONT_CHECK_ENCODING(encoding)
113518eba588Smrg# ----------------------------------
113618eba588Smrg# Minimum version: 1.1.0
113718eba588Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
113818eba588Smrg# It replaced individual copies of this code in the above macros in 1.1.
113918eba588Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
114018eba588Smrg# calls if this is not true in the future.
1141b9bb67cbSmrg
114218eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
114318eba588Smrg	AC_ARG_ENABLE(m4_tolower($1),
114418eba588Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
114518eba588Smrg				[Build $1 fonts (default: yes)]),
114618eba588Smrg		[AS_TR_SH($1)=$enableval])
114718eba588Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
114818eba588Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
114918eba588Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
115018eba588Smrg]) # XORG_FONT_CHECK_ENCODING
1151b9bb67cbSmrg
115218eba588Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
115318eba588Smrg# -----------------------------------------------------
115418eba588Smrg# Minimum version: 1.1.0
115518eba588Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
115618eba588Smrg# Add a shorthand --enable/disable-all-encodings option.
1157b9bb67cbSmrg
115818eba588SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
115918eba588Smrg	AC_ARG_ENABLE([all-encodings],
116018eba588Smrg		AS_HELP_STRING([--disable-all-encodings],
116118eba588Smrg				[Disable building of all font encodings]),
116218eba588Smrg		[m4_foreach_w([enc], [$1], [
116318eba588Smrg			AS_TR_SH(enc)=$enableval
116418eba588Smrg		])],
116518eba588Smrg		[m4_foreach_w([enc], [$1], [
116618eba588Smrg			AS_TR_SH(enc)=yes
116718eba588Smrg		])])
116818eba588Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
116918eba588Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
1170b9bb67cbSmrg
117118eba588Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
117218eba588Smrg# ------------------------------------------
117318eba588Smrg# Minimum version: 1.1.0
117418eba588Smrg#
117518eba588Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
117618eba588Smrg#
1177b9bb67cbSmrg
117818eba588SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
117918eba588Smrg	AC_PATH_PROG($1, $2)
118018eba588Smrg	if test x"$$1" = x; then
118118eba588Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
118218eba588Smrg	fi
118318eba588Smrg])
1184b9bb67cbSmrg
1185b9bb67cbSmrg
118618eba588Smrg# XORG_FONT_FCCACHE()
118718eba588Smrg# -------------------
118818eba588Smrg# Minimum version: 1.1.0
118918eba588Smrg#
119018eba588Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
119118eba588Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
119218eba588Smrg# to run fc-cache if found and not installing to $DESTDIR and not
119318eba588Smrg# cross-compiling
119418eba588Smrg#
119518eba588Smrg# fc-cache is optional, not required, and should be skipped when making
119618eba588Smrg# packages (installing to $DESTDIR) or cross-compiling
119718eba588Smrg#
119818eba588SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
119918eba588Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
120018eba588Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
120118eba588Smrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
120218eba588Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
120318eba588Smrg	else
120418eba588Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
120518eba588Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
120618eba588Smrg	fi
120718eba588Smrg	AC_SUBST([RUN_FCCACHE])
120818eba588Smrg])
1209b9bb67cbSmrg
121018eba588Smrg# XORG_FONT_MKFONTDIR()
121118eba588Smrg# -------------------
121218eba588Smrg# Minimum version: 1.3.0
121318eba588Smrg#
121418eba588Smrg# Set MKFONTDIR to path to mkfontdir.
121518eba588Smrg#
121618eba588Smrg# If cross-compiling, and if mkdir is not found, use a shell command
121718eba588Smrg# which warns mkfontdir needs to be run on the target
121818eba588Smrg#
121918eba588Smrg# If not cross-compiling, mkfontdir must be found
122018eba588Smrg#
122118eba588SmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
122218eba588Smrg	if test x"$cross_compiling" != x"no" ; then
122318eba588Smrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
122418eba588Smrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
1225b9bb67cbSmrg
122618eba588Smrg		if test x"$MKFONTDIR" = x; then
122718eba588Smrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
122818eba588Smrg		fi
122918eba588Smrg	else
123018eba588Smrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
123118eba588Smrg	fi
1232b9bb67cbSmrg
123318eba588Smrg	AC_SUBST([MKFONTDIR])
123418eba588Smrg])
1235b9bb67cbSmrg
123618eba588Smrg# XORG_FONT_COMMON_UTILS()
123718eba588Smrg# ------------------------
123818eba588Smrg# Minimum version: 1.1.0
123918eba588Smrg#
124018eba588Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
1241b9bb67cbSmrg
124218eba588SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
124318eba588Smrg	XORG_FONT_FCCACHE
124418eba588Smrg	XORG_FONT_MKFONTDIR
124518eba588Smrg])
1246b9bb67cbSmrg
124718eba588Smrg# XORG_FONT_SCALED_UTILS()
1248b5d2086dSmrg# ------------------------
124918eba588Smrg# Minimum version: 1.1.0
1250b5d2086dSmrg#
125118eba588Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
125218eba588Smrg# (TrueType, OpenType, Type1)
1253b5d2086dSmrg
125418eba588SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
125518eba588Smrg	XORG_FONT_COMMON_UTILS
125618eba588Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
125718eba588Smrg])
1258b5d2086dSmrg
125918eba588Smrg# XORG_FONT_BDF_UTILS()
126018eba588Smrg# ---------------------
126118eba588Smrg# Minimum version: 1.1.0
1262b9bb67cbSmrg#
126318eba588Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
126418eba588Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
126518eba588Smrg# PCF output files created by bdftopcf
1266b9bb67cbSmrg
126718eba588SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
126818eba588Smrg	XORG_FONT_COMMON_UTILS
126918eba588Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
127018eba588Smrg	XORG_FONT_CHECK_COMPRESSION
127118eba588Smrg])
1272b9bb67cbSmrg
127318eba588Smrg# XORG_FONT_CHECK_COMPRESSION()
127418eba588Smrg# -----------------------------
127518eba588Smrg# Minimum version: 1.1.0
127618eba588Smrg#
127718eba588Smrg# Offer a --with-compression flag to control what compression method is
127818eba588Smrg# used for pcf font files.   Offers all the methods currently supported
127918eba588Smrg# by libXfont, including no compression.
128018eba588Smrg#
128118eba588Smrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
128218eba588Smrg# for reproducible builds, such as gzip -n to not record timestamp, will
128318eba588Smrg# set COMPRESS_FLAGS to those options.
1284b9bb67cbSmrg
128518eba588SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
128618eba588Smrg	AC_MSG_CHECKING([font compression method])
128718eba588Smrg	AC_ARG_WITH(compression,
128818eba588Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
128918eba588Smrg			 [compression method to use on pcf fonts])],
129018eba588Smrg         [compression="$withval"], [compression="yes"])
129118eba588Smrg	if test x"$compression" = "xyes" ; then
129218eba588Smrg		compression="gzip"
129318eba588Smrg	fi
129418eba588Smrg	AC_MSG_RESULT([${compression}])
129518eba588Smrg	case ${compression} in
129618eba588Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
129718eba588Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
129818eba588Smrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
129918eba588Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
130018eba588Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
130118eba588Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
130218eba588Smrg	esac
130318eba588Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
130418eba588Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
130518eba588Smrg	fi
130618eba588Smrg	AC_MSG_CHECKING([options to font compression command])
130718eba588Smrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
130818eba588Smrg	AC_SUBST([COMPRESS_FLAGS])
130918eba588Smrg	AC_SUBST([COMPRESS_SUFFIX])
131018eba588Smrg])
1311b9bb67cbSmrg
131218eba588Smrg# XORG_FONT_UCS2ANY()
131318eba588Smrg# -------------------
131418eba588Smrg# Minimum version: 1.1.0
131518eba588Smrg#
131618eba588Smrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
131718eba588Smrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
131818eba588Smrg# Also call pkg-config to find the directory with the encoding files needed
131918eba588Smrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
1320b9bb67cbSmrg
132118eba588SmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
132218eba588Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
132318eba588Smrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
132418eba588Smrg	PKG_CHECK_MODULES(MAPS, [fontutil])
132518eba588Smrg	AC_MSG_CHECKING([for ucs2any encoding data files])
132618eba588Smrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
132718eba588Smrg	AC_SUBST(MAPFILES_PATH)
132818eba588Smrg	AC_MSG_RESULT([${MAPFILES_PATH}])
132918eba588Smrg])
1330b9bb67cbSmrg
1331b9bb67cbSmrg
1332b9bb67cbSmrg
133318eba588Smrg# XORG_FONT_FC_CONFDIR()
133418eba588Smrg# --------------------
133518eba588Smrg# Minimum version: 1.2.0
133618eba588Smrg#
133718eba588Smrg# Sets FC_CONFDIR to the fontconfig config directory
133818eba588Smrg# (which should be --with-confdir=... when building fontconfig)
133918eba588Smrg# found from:
134018eba588Smrg#	--with-fc-confdir=...
134118eba588Smrg#	pkg-config --variable=confdir fontconfig
134218eba588Smrg#	${sysconfdir}/fonts
1343b9bb67cbSmrg
134418eba588SmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
134518eba588Smrg	dnl Ensure $PKG_CONFIG is set first
134618eba588Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1347b9bb67cbSmrg
134818eba588Smrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
134918eba588Smrg	AC_ARG_WITH(fc-confdir,
135018eba588Smrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
135118eba588Smrg			   [Path to fontconfig's configuration directory]),
135218eba588Smrg		    [FC_CONFDIR="$withval"])
135318eba588Smrg	# if --with-fc-confdir was not specified
135418eba588Smrg	if test "x${FC_CONFDIR}" = "x"; then
135518eba588Smrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
135618eba588Smrg	fi
135718eba588Smrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
135818eba588Smrg	if test "x${FC_CONFDIR}" = "x"; then
135918eba588Smrg		FC_CONFDIR="${sysconfdir}/fonts"
136018eba588Smrg	fi
136118eba588Smrg	AC_SUBST(FC_CONFDIR)
136218eba588Smrg	AC_MSG_RESULT([${FC_CONFDIR}])
136318eba588Smrg])
1364b9bb67cbSmrg
1365b9bb67cbSmrg
1366b9bb67cbSmrg
136718eba588Smrg# XORG_FONTROOTDIR()
136818eba588Smrg# --------------------
136918eba588Smrg# Minimum version: 1.1.0
137018eba588Smrg#
137118eba588Smrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
137218eba588Smrg# found from:
137318eba588Smrg#	--with-fontrootdir
137418eba588Smrg#	pkg-config --variable=fontrootdir fontutil
137518eba588Smrg#	${datadir}/fonts/X11
1376b9bb67cbSmrg
137718eba588SmrgAC_DEFUN([XORG_FONTROOTDIR],[
137818eba588Smrg	dnl Ensure $PKG_CONFIG is set first
137918eba588Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1380b9bb67cbSmrg
138118eba588Smrg	AC_MSG_CHECKING([for root directory for font files])
138218eba588Smrg	AC_ARG_WITH(fontrootdir,
138318eba588Smrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
138418eba588Smrg			   [Path to root directory for font files]),
138518eba588Smrg		    [FONTROOTDIR="$withval"])
138618eba588Smrg	# if --with-fontrootdir not specified...
138718eba588Smrg	if test "x${FONTROOTDIR}" = "x"; then
138818eba588Smrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
138918eba588Smrg	fi
139018eba588Smrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
139118eba588Smrg	if test "x${FONTROOTDIR}" = "x"; then
139218eba588Smrg		FONTROOTDIR="${datadir}/fonts/X11"
139318eba588Smrg	fi
139418eba588Smrg	AC_SUBST(FONTROOTDIR)
139518eba588Smrg	AC_MSG_RESULT([${FONTROOTDIR}])
139618eba588Smrg])
1397b9bb67cbSmrg
139818eba588Smrg# XORG_FONTSUBDIR(variable, flag, subdir)
139918eba588Smrg# ---------------------------------------
140018eba588Smrg# Minimum version: 1.1.0
140118eba588Smrg#
140218eba588Smrg# Offer a --with-<flag> flag to control directory for font installation
140318eba588Smrg# Default is the specified <subdir> of the font root directory.
140418eba588Smrg# Sets <variable> to the selected directory
1405b9bb67cbSmrg
140618eba588SmrgAC_DEFUN([XORG_FONTSUBDIR],[
140718eba588Smrg	AC_REQUIRE([XORG_FONTROOTDIR])
1408b9bb67cbSmrg
140918eba588Smrg	AC_MSG_CHECKING([for directory for $3 files])
141018eba588Smrg	AC_ARG_WITH($2,
141118eba588Smrg		    [AS_HELP_STRING([--with-$2=DIR],
141218eba588Smrg				    [Path to $3 files [FONTROOTDIR/$3]])],
141318eba588Smrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
141418eba588Smrg	AC_SUBST($1)
141518eba588Smrg	AC_MSG_RESULT([${$1}])
141618eba588Smrg]) # XORG_FONTSUBDIR
1417b5d2086dSmrg
141818eba588Smrg# XORG_FONTDIR(subdir)
141918eba588Smrg# --------------------
142018eba588Smrg# Minimum version: 1.1.0
142118eba588Smrg#
142218eba588Smrg# Offer a --with-fontdir flag to control directory for font installation
142318eba588Smrg# Default is the specified subdir of the font root directory.
142418eba588Smrg# Sets FONTDIR to the selected directory
1425b9bb67cbSmrg
142618eba588SmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
1427b9bb67cbSmrg
142818eba588Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142918eba588Smrgdnl
143018eba588Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
143118eba588Smrgdnl
143218eba588Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143318eba588Smrgdnl copy of this software and associated documentation files (the "Software"),
143418eba588Smrgdnl to deal in the Software without restriction, including without limitation
143518eba588Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143618eba588Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
143718eba588Smrgdnl Software is furnished to do so, subject to the following conditions:
143818eba588Smrgdnl
143918eba588Smrgdnl The above copyright notice and this permission notice (including the next
144018eba588Smrgdnl paragraph) shall be included in all copies or substantial portions of the
144118eba588Smrgdnl Software.
144218eba588Smrgdnl
144318eba588Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144418eba588Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144518eba588Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144618eba588Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144718eba588Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144818eba588Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144918eba588Smrgdnl DEALINGS IN THE SOFTWARE.
145018eba588Smrg
145118eba588Smrg# XORG_MACROS_VERSION(required-version)
145218eba588Smrg# -------------------------------------
145318eba588Smrg# Minimum version: 1.1.0
1454b5d2086dSmrg#
145518eba588Smrg# If you're using a macro added in Version 1.1 or newer, include this in
145618eba588Smrg# your configure.ac with the minimum required version, such as:
145718eba588Smrg# XORG_MACROS_VERSION(1.1)
1458b5d2086dSmrg#
145918eba588Smrg# To ensure that this macro is defined, also add:
146018eba588Smrg# m4_ifndef([XORG_MACROS_VERSION],
146118eba588Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1462b5d2086dSmrg#
1463b5d2086dSmrg#
146418eba588Smrg# See the "minimum version" comment for each macro you use to see what
146518eba588Smrg# version you require.
146618eba588Smrgm4_defun([XORG_MACROS_VERSION],[
146718eba588Smrgm4_define([vers_have], [1.20.0])
146818eba588Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146918eba588Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
147018eba588Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147118eba588Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147218eba588Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147318eba588Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147418eba588Smrgm4_undefine([vers_have])
147518eba588Smrgm4_undefine([maj_have])
147618eba588Smrgm4_undefine([maj_needed])
147718eba588Smrg]) # XORG_MACROS_VERSION
1478b5d2086dSmrg
147918eba588Smrg# XORG_PROG_RAWCPP()
148018eba588Smrg# ------------------
148118eba588Smrg# Minimum version: 1.0.0
148218eba588Smrg#
148318eba588Smrg# Find cpp program and necessary flags for use in pre-processing text files
148418eba588Smrg# such as man pages and config files
148518eba588SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148618eba588SmrgAC_REQUIRE([AC_PROG_CPP])
148718eba588SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148818eba588Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
148918eba588Smrg
149018eba588Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149118eba588Smrg# which is not the best choice for supporting other OS'es, but covers most
149218eba588Smrg# of the ones we need for now.
149318eba588SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149418eba588SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149518eba588Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149618eba588Smrg	AC_MSG_RESULT([no])
1497b5d2086dSmrgelse
149818eba588Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149918eba588Smrg		RAWCPPFLAGS=-undef
150018eba588Smrg		AC_MSG_RESULT([yes])
150118eba588Smrg	# under Cygwin unix is still defined even with -undef
150218eba588Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150318eba588Smrg		RAWCPPFLAGS="-undef -ansi"
150418eba588Smrg		AC_MSG_RESULT([yes, with -ansi])
150518eba588Smrg	else
150618eba588Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150718eba588Smrg	fi
1508b9bb67cbSmrgfi
150918eba588Smrgrm -f conftest.$ac_ext
1510b9bb67cbSmrg
151118eba588SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151218eba588SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151318eba588Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151418eba588Smrg	AC_MSG_RESULT([no])
1515b5d2086dSmrgelse
151618eba588Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151718eba588Smrg		TRADITIONALCPPFLAGS="-traditional"
151818eba588Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151918eba588Smrg		AC_MSG_RESULT([yes])
152018eba588Smrg	else
152118eba588Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152218eba588Smrg	fi
1523b5d2086dSmrgfi
152418eba588Smrgrm -f conftest.$ac_ext
152518eba588SmrgAC_SUBST(RAWCPPFLAGS)
152618eba588SmrgAC_SUBST(TRADITIONALCPPFLAGS)
152718eba588Smrg]) # XORG_PROG_RAWCPP
1528b5d2086dSmrg
152918eba588Smrg# XORG_MANPAGE_SECTIONS()
153018eba588Smrg# -----------------------
153118eba588Smrg# Minimum version: 1.0.0
1532b5d2086dSmrg#
153318eba588Smrg# Determine which sections man pages go in for the different man page types
153418eba588Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153518eba588Smrg# Not sure if there's any better way than just hardcoding by OS name.
153618eba588Smrg# Override default settings by setting environment variables
153718eba588Smrg# Added MAN_SUBSTS in version 1.8
153818eba588Smrg# Added AC_PROG_SED in version 1.8
1539b5d2086dSmrg
154018eba588SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154118eba588SmrgAC_REQUIRE([AC_CANONICAL_HOST])
154218eba588SmrgAC_REQUIRE([AC_PROG_SED])
1543b9bb67cbSmrg
154418eba588Smrgcase $host_os in
154518eba588Smrg    solaris*)
154618eba588Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
154718eba588Smrg        # check for a man page file found in later versions that use
154818eba588Smrg        # traditional section numbers instead
154918eba588Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
155018eba588Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
155118eba588Smrg        ;;
155218eba588Smrg    *) SYSV_MAN_SECTIONS=false ;;
155318eba588Smrgesac
1554b5d2086dSmrg
155518eba588Smrgif test x$APP_MAN_SUFFIX = x    ; then
155618eba588Smrg    APP_MAN_SUFFIX=1
155718eba588Smrgfi
155818eba588Smrgif test x$APP_MAN_DIR = x    ; then
155918eba588Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1560b5d2086dSmrgfi
1561b9bb67cbSmrg
156218eba588Smrgif test x$LIB_MAN_SUFFIX = x    ; then
156318eba588Smrg    LIB_MAN_SUFFIX=3
156418eba588Smrgfi
156518eba588Smrgif test x$LIB_MAN_DIR = x    ; then
156618eba588Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1567b5d2086dSmrgfi
1568b9bb67cbSmrg
156918eba588Smrgif test x$FILE_MAN_SUFFIX = x    ; then
157018eba588Smrg    case $SYSV_MAN_SECTIONS in
157118eba588Smrg	true)				FILE_MAN_SUFFIX=4  ;;
157218eba588Smrg	*)				FILE_MAN_SUFFIX=5  ;;
157318eba588Smrg    esac
157418eba588Smrgfi
157518eba588Smrgif test x$FILE_MAN_DIR = x    ; then
157618eba588Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1577b5d2086dSmrgfi
1578b9bb67cbSmrg
157918eba588Smrgif test x$MISC_MAN_SUFFIX = x    ; then
158018eba588Smrg    case $SYSV_MAN_SECTIONS in
158118eba588Smrg	true)				MISC_MAN_SUFFIX=5  ;;
158218eba588Smrg	*)				MISC_MAN_SUFFIX=7  ;;
158318eba588Smrg    esac
158418eba588Smrgfi
158518eba588Smrgif test x$MISC_MAN_DIR = x    ; then
158618eba588Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
158718eba588Smrgfi
1588b9bb67cbSmrg
158918eba588Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
159018eba588Smrg    case $SYSV_MAN_SECTIONS in
159118eba588Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
159218eba588Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159318eba588Smrg    esac
159418eba588Smrgfi
159518eba588Smrgif test x$DRIVER_MAN_DIR = x    ; then
159618eba588Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159718eba588Smrgfi
1598b5d2086dSmrg
159918eba588Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
160018eba588Smrg    case $SYSV_MAN_SECTIONS in
160118eba588Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
160218eba588Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160318eba588Smrg    esac
160418eba588Smrgfi
160518eba588Smrgif test x$ADMIN_MAN_DIR = x    ; then
160618eba588Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1607b5d2086dSmrgfi
1608b9bb67cbSmrg
1609b5d2086dSmrg
161018eba588SmrgAC_SUBST([APP_MAN_SUFFIX])
161118eba588SmrgAC_SUBST([LIB_MAN_SUFFIX])
161218eba588SmrgAC_SUBST([FILE_MAN_SUFFIX])
161318eba588SmrgAC_SUBST([MISC_MAN_SUFFIX])
161418eba588SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161518eba588SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161618eba588SmrgAC_SUBST([APP_MAN_DIR])
161718eba588SmrgAC_SUBST([LIB_MAN_DIR])
161818eba588SmrgAC_SUBST([FILE_MAN_DIR])
161918eba588SmrgAC_SUBST([MISC_MAN_DIR])
162018eba588SmrgAC_SUBST([DRIVER_MAN_DIR])
162118eba588SmrgAC_SUBST([ADMIN_MAN_DIR])
1622b9bb67cbSmrg
162318eba588SmrgXORG_MAN_PAGE="X Version 11"
162418eba588SmrgAC_SUBST([XORG_MAN_PAGE])
162518eba588SmrgMAN_SUBSTS="\
162618eba588Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162718eba588Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162818eba588Smrg	-e 's|__xservername__|Xorg|g' \
162918eba588Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
163018eba588Smrg	-e 's|__projectroot__|\$(prefix)|g' \
163118eba588Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163218eba588Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163318eba588Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163418eba588Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163518eba588Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163618eba588Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163718eba588Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163818eba588SmrgAC_SUBST([MAN_SUBSTS])
1639b5d2086dSmrg
164018eba588Smrg]) # XORG_MANPAGE_SECTIONS
1641b5d2086dSmrg
164218eba588Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164318eba588Smrg# ------------------------
164418eba588Smrg# Minimum version: 1.7.0
1645b5d2086dSmrg#
164618eba588Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164718eba588Smrg# provided by xorg-sgml-doctools, if installed.
164818eba588SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164918eba588SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
165018eba588SmrgXORG_SGML_PATH=
165118eba588SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165218eba588Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165318eba588Smrg    [m4_ifval([$1],[:],
165418eba588Smrg        [if test x"$cross_compiling" != x"yes" ; then
165518eba588Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165618eba588Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165718eba588Smrg         fi])
165818eba588Smrg    ])
165918eba588Smrg
166018eba588Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166118eba588Smrg# the path and the name of the doc stylesheet
166218eba588Smrgif test "x$XORG_SGML_PATH" != "x" ; then
166318eba588Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166418eba588Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166518eba588Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166618eba588Smrgelse
166718eba588Smrg   AC_MSG_RESULT([no])
166818eba588Smrgfi
166918eba588Smrg
167018eba588SmrgAC_SUBST(XORG_SGML_PATH)
167118eba588SmrgAC_SUBST(STYLESHEET_SRCDIR)
167218eba588SmrgAC_SUBST(XSL_STYLESHEET)
167318eba588SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167418eba588Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1675b9bb67cbSmrg
167618eba588Smrg# XORG_CHECK_LINUXDOC
167718eba588Smrg# -------------------
1678b5d2086dSmrg# Minimum version: 1.0.0
1679b5d2086dSmrg#
168018eba588Smrg# Defines the variable MAKE_TEXT if the necessary tools and
168118eba588Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168218eba588Smrg# Whether or not the necessary tools and files are found can be checked
168318eba588Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168418eba588SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168518eba588SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168618eba588SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1687b9bb67cbSmrg
168818eba588SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
168918eba588Smrg
169018eba588SmrgAC_MSG_CHECKING([whether to build documentation])
169118eba588Smrg
169218eba588Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169318eba588Smrg   BUILDDOC=yes
169418eba588Smrgelse
169518eba588Smrg   BUILDDOC=no
1696b5d2086dSmrgfi
1697b9bb67cbSmrg
169818eba588SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
169918eba588Smrg
170018eba588SmrgAC_MSG_RESULT([$BUILDDOC])
170118eba588Smrg
170218eba588SmrgAC_MSG_CHECKING([whether to build pdf documentation])
170318eba588Smrg
170418eba588Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170518eba588Smrg   BUILDPDFDOC=yes
1706b5d2086dSmrgelse
170718eba588Smrg   BUILDPDFDOC=no
1708b5d2086dSmrgfi
1709b5d2086dSmrg
171018eba588SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1711b9bb67cbSmrg
171218eba588SmrgAC_MSG_RESULT([$BUILDPDFDOC])
171318eba588Smrg
171418eba588SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171518eba588SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171618eba588SmrgMAKE_PDF="$PS2PDF"
171718eba588SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171818eba588Smrg
171918eba588SmrgAC_SUBST(MAKE_TEXT)
172018eba588SmrgAC_SUBST(MAKE_PS)
172118eba588SmrgAC_SUBST(MAKE_PDF)
172218eba588SmrgAC_SUBST(MAKE_HTML)
172318eba588Smrg]) # XORG_CHECK_LINUXDOC
172418eba588Smrg
172518eba588Smrg# XORG_CHECK_DOCBOOK
172618eba588Smrg# -------------------
172718eba588Smrg# Minimum version: 1.0.0
172818eba588Smrg#
172918eba588Smrg# Checks for the ability to build output formats from SGML DocBook source.
173018eba588Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173118eba588Smrg# indicates whether the necessary tools and files are found and, if set,
173218eba588Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173318eba588SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173418eba588SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
173518eba588Smrg
173618eba588SmrgBUILDTXTDOC=no
173718eba588SmrgBUILDPDFDOC=no
173818eba588SmrgBUILDPSDOC=no
173918eba588SmrgBUILDHTMLDOC=no
174018eba588Smrg
174118eba588SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174218eba588SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174318eba588SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174418eba588SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
174518eba588Smrg
174618eba588SmrgAC_MSG_CHECKING([whether to build text documentation])
174718eba588Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174818eba588Smrg   test x$BUILD_TXTDOC != xno; then
174918eba588Smrg	BUILDTXTDOC=yes
175018eba588Smrgfi
175118eba588SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175218eba588SmrgAC_MSG_RESULT([$BUILDTXTDOC])
175318eba588Smrg
175418eba588SmrgAC_MSG_CHECKING([whether to build PDF documentation])
175518eba588Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175618eba588Smrg   test x$BUILD_PDFDOC != xno; then
175718eba588Smrg	BUILDPDFDOC=yes
175818eba588Smrgfi
175918eba588SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
176018eba588SmrgAC_MSG_RESULT([$BUILDPDFDOC])
176118eba588Smrg
176218eba588SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176318eba588Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176418eba588Smrg   test x$BUILD_PSDOC != xno; then
176518eba588Smrg	BUILDPSDOC=yes
176618eba588Smrgfi
176718eba588SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176818eba588SmrgAC_MSG_RESULT([$BUILDPSDOC])
176918eba588Smrg
177018eba588SmrgAC_MSG_CHECKING([whether to build HTML documentation])
177118eba588Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177218eba588Smrg   test x$BUILD_HTMLDOC != xno; then
177318eba588Smrg	BUILDHTMLDOC=yes
177418eba588Smrgfi
177518eba588SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177618eba588SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
177718eba588Smrg
177818eba588SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177918eba588SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
178018eba588SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178118eba588SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178218eba588Smrg
178318eba588SmrgAC_SUBST(MAKE_TEXT)
178418eba588SmrgAC_SUBST(MAKE_PS)
178518eba588SmrgAC_SUBST(MAKE_PDF)
178618eba588SmrgAC_SUBST(MAKE_HTML)
178718eba588Smrg]) # XORG_CHECK_DOCBOOK
178818eba588Smrg
178918eba588Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1790b5d2086dSmrg# ----------------
179118eba588Smrg# Minimum version: 1.5.0
179218eba588Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1793b9bb67cbSmrg#
179418eba588Smrg# Documentation tools are not always available on all platforms and sometimes
179518eba588Smrg# not at the appropriate level. This macro enables a module to test for the
179618eba588Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
179718eba588Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
179818eba588Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179918eba588Smrg# --with-xmlto assumes 'auto'.
1800b9bb67cbSmrg#
1801b5d2086dSmrg# Interface to module:
180218eba588Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180318eba588Smrg# XMLTO:	returns the path of the xmlto program found
180418eba588Smrg#		returns the path set by the user in the environment
180518eba588Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180618eba588Smrg#		'no' user instructs the module not to use xmlto
1807b9bb67cbSmrg#
180818eba588Smrg# Added in version 1.10.0
180918eba588Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
181018eba588Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1811b9bb67cbSmrg#
181218eba588Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1813b5d2086dSmrg#
181418eba588SmrgAC_DEFUN([XORG_WITH_XMLTO],[
181518eba588SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181618eba588Smrgm4_define([_defopt], m4_default([$2], [auto]))
181718eba588SmrgAC_ARG_WITH(xmlto,
181818eba588Smrg	AS_HELP_STRING([--with-xmlto],
181918eba588Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
182018eba588Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182118eba588Smrgm4_undefine([_defopt])
1822b9bb67cbSmrg
182318eba588Smrgif test "x$use_xmlto" = x"auto"; then
182418eba588Smrg   AC_PATH_PROG([XMLTO], [xmlto])
182518eba588Smrg   if test "x$XMLTO" = "x"; then
182618eba588Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182718eba588Smrg	have_xmlto=no
182818eba588Smrg   else
182918eba588Smrg        have_xmlto=yes
1830b5d2086dSmrg   fi
183118eba588Smrgelif test "x$use_xmlto" = x"yes" ; then
183218eba588Smrg   AC_PATH_PROG([XMLTO], [xmlto])
183318eba588Smrg   if test "x$XMLTO" = "x"; then
183418eba588Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1835b5d2086dSmrg   fi
183618eba588Smrg   have_xmlto=yes
183718eba588Smrgelif test "x$use_xmlto" = x"no" ; then
183818eba588Smrg   if test "x$XMLTO" != "x"; then
183918eba588Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
184018eba588Smrg   fi
184118eba588Smrg   have_xmlto=no
1842b5d2086dSmrgelse
184318eba588Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1844b5d2086dSmrgfi
1845b9bb67cbSmrg
184618eba588Smrg# Test for a minimum version of xmlto, if provided.
184718eba588Smrgm4_ifval([$1],
184818eba588Smrg[if test "$have_xmlto" = yes; then
184918eba588Smrg    # scrape the xmlto version
185018eba588Smrg    AC_MSG_CHECKING([the xmlto version])
185118eba588Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185218eba588Smrg    AC_MSG_RESULT([$xmlto_version])
185318eba588Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185418eba588Smrg        [if test "x$use_xmlto" = xauto; then
185518eba588Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185618eba588Smrg            have_xmlto=no
185718eba588Smrg        else
185818eba588Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185918eba588Smrg        fi])
186018eba588Smrgfi])
1861b9bb67cbSmrg
186218eba588Smrg# Test for the ability of xmlto to generate a text target
186318eba588Smrg#
186418eba588Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
186518eba588Smrg# following test for empty XML docbook files.
186618eba588Smrg# For compatibility reasons use the following empty XML docbook file and if
186718eba588Smrg# it fails try it again with a non-empty XML file.
186818eba588Smrghave_xmlto_text=no
186918eba588Smrgcat > conftest.xml << "EOF"
187018eba588SmrgEOF
187118eba588SmrgAS_IF([test "$have_xmlto" = yes],
187218eba588Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187318eba588Smrg             [have_xmlto_text=yes],
187418eba588Smrg             [# Try it again with a non-empty XML file.
187518eba588Smrg              cat > conftest.xml << "EOF"
187618eba588Smrg<x></x>
187718eba588SmrgEOF
187818eba588Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187918eba588Smrg                    [have_xmlto_text=yes],
188018eba588Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188118eba588Smrgrm -f conftest.xml
188218eba588SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188318eba588SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188418eba588Smrg]) # XORG_WITH_XMLTO
1885b9bb67cbSmrg
188618eba588Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188718eba588Smrg# --------------------------------------------
188818eba588Smrg# Minimum version: 1.12.0
188918eba588Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1890b9bb67cbSmrg#
189118eba588Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189218eba588Smrg# XML-based language used for the transformation of XML documents.
189318eba588Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189418eba588Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189518eba588Smrg# The XSLT processor is often used as a standalone tool for transformations.
189618eba588Smrg# It should not be assumed that this tool is used only to work with documnetation.
189718eba588Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1898b9bb67cbSmrg#
1899b5d2086dSmrg# Interface to module:
190018eba588Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190118eba588Smrg# XSLTPROC:	 returns the path of the xsltproc program found
190218eba588Smrg#		 returns the path set by the user in the environment
190318eba588Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190418eba588Smrg#		  'no' user instructs the module not to use xsltproc
190518eba588Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1906b9bb67cbSmrg#
190718eba588Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190818eba588Smrg#
190918eba588SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
191018eba588SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191118eba588Smrg# Preserves the interface, should it be implemented later
191218eba588Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191318eba588Smrgm4_define([_defopt], m4_default([$2], [auto]))
191418eba588SmrgAC_ARG_WITH(xsltproc,
191518eba588Smrg	AS_HELP_STRING([--with-xsltproc],
191618eba588Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191718eba588Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191818eba588Smrgm4_undefine([_defopt])
19191cc8c64fSmrg
192018eba588Smrgif test "x$use_xsltproc" = x"auto"; then
192118eba588Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192218eba588Smrg   if test "x$XSLTPROC" = "x"; then
192318eba588Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192418eba588Smrg	have_xsltproc=no
192518eba588Smrg   else
192618eba588Smrg        have_xsltproc=yes
1927b5d2086dSmrg   fi
192818eba588Smrgelif test "x$use_xsltproc" = x"yes" ; then
192918eba588Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
193018eba588Smrg   if test "x$XSLTPROC" = "x"; then
193118eba588Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193218eba588Smrg   fi
193318eba588Smrg   have_xsltproc=yes
193418eba588Smrgelif test "x$use_xsltproc" = x"no" ; then
193518eba588Smrg   if test "x$XSLTPROC" != "x"; then
193618eba588Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193718eba588Smrg   fi
193818eba588Smrg   have_xsltproc=no
193918eba588Smrgelse
194018eba588Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1941b5d2086dSmrgfi
19421cc8c64fSmrg
194318eba588SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194418eba588Smrg]) # XORG_WITH_XSLTPROC
19451cc8c64fSmrg
194618eba588Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194718eba588Smrg# ----------------------------------------
194818eba588Smrg# Minimum version: 1.15.0
1949b9bb67cbSmrg#
195018eba588Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
195118eba588Smrg# scanning arbitrary text files, extracting information from those text files,
195218eba588Smrg# and printing reports based on that information.
1953b9bb67cbSmrg#
195418eba588Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1955b9bb67cbSmrg#
195618eba588Smrg# Interface to module:
195718eba588Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
195818eba588Smrg# PERL:	     returns the path of the perl program found
195918eba588Smrg#	     returns the path set by the user in the environment
196018eba588Smrg# --with-perl: 'yes' user instructs the module to use perl
196118eba588Smrg#	       'no' user instructs the module not to use perl
196218eba588Smrg# have_perl: returns yes if perl found in PATH or no
196318eba588Smrg#
196418eba588Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196518eba588Smrg#
196618eba588SmrgAC_DEFUN([XORG_WITH_PERL],[
196718eba588SmrgAC_ARG_VAR([PERL], [Path to perl command])
196818eba588Smrg# Preserves the interface, should it be implemented later
196918eba588Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
197018eba588Smrgm4_define([_defopt], m4_default([$2], [auto]))
197118eba588SmrgAC_ARG_WITH(perl,
197218eba588Smrg	AS_HELP_STRING([--with-perl],
197318eba588Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197418eba588Smrg	   [use_perl=$withval], [use_perl=]_defopt)
197518eba588Smrgm4_undefine([_defopt])
19761cc8c64fSmrg
197718eba588Smrgif test "x$use_perl" = x"auto"; then
197818eba588Smrg   AC_PATH_PROG([PERL], [perl])
197918eba588Smrg   if test "x$PERL" = "x"; then
198018eba588Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198118eba588Smrg	have_perl=no
198218eba588Smrg   else
198318eba588Smrg        have_perl=yes
198418eba588Smrg   fi
198518eba588Smrgelif test "x$use_perl" = x"yes" ; then
198618eba588Smrg   AC_PATH_PROG([PERL], [perl])
198718eba588Smrg   if test "x$PERL" = "x"; then
198818eba588Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198918eba588Smrg   fi
199018eba588Smrg   have_perl=yes
199118eba588Smrgelif test "x$use_perl" = x"no" ; then
199218eba588Smrg   if test "x$PERL" != "x"; then
199318eba588Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199418eba588Smrg   fi
199518eba588Smrg   have_perl=no
199618eba588Smrgelse
199718eba588Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1998b5d2086dSmrgfi
19991cc8c64fSmrg
200018eba588SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200118eba588Smrg]) # XORG_WITH_PERL
2002b9bb67cbSmrg
200318eba588Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2004b5d2086dSmrg# ----------------
200518eba588Smrg# Minimum version: 1.5.0
200618eba588Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2007b5d2086dSmrg#
200818eba588Smrg# Documentation tools are not always available on all platforms and sometimes
200918eba588Smrg# not at the appropriate level. This macro enables a module to test for the
201018eba588Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
201118eba588Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
201218eba588Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201318eba588Smrg# --with-asciidoc assumes 'auto'.
2014b5d2086dSmrg#
201518eba588Smrg# Interface to module:
201618eba588Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201718eba588Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
201818eba588Smrg#		 returns the path set by the user in the environment
201918eba588Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
202018eba588Smrg#		  'no' user instructs the module not to use asciidoc
202118eba588Smrg#
202218eba588Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
202318eba588Smrg#
202418eba588SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202518eba588SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202618eba588Smrgm4_define([_defopt], m4_default([$2], [auto]))
202718eba588SmrgAC_ARG_WITH(asciidoc,
202818eba588Smrg	AS_HELP_STRING([--with-asciidoc],
202918eba588Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
203018eba588Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203118eba588Smrgm4_undefine([_defopt])
2032b9bb67cbSmrg
203318eba588Smrgif test "x$use_asciidoc" = x"auto"; then
203418eba588Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203518eba588Smrg   if test "x$ASCIIDOC" = "x"; then
203618eba588Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203718eba588Smrg	have_asciidoc=no
203818eba588Smrg   else
203918eba588Smrg        have_asciidoc=yes
204018eba588Smrg   fi
204118eba588Smrgelif test "x$use_asciidoc" = x"yes" ; then
204218eba588Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204318eba588Smrg   if test "x$ASCIIDOC" = "x"; then
204418eba588Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204518eba588Smrg   fi
204618eba588Smrg   have_asciidoc=yes
204718eba588Smrgelif test "x$use_asciidoc" = x"no" ; then
204818eba588Smrg   if test "x$ASCIIDOC" != "x"; then
204918eba588Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
205018eba588Smrg   fi
205118eba588Smrg   have_asciidoc=no
205218eba588Smrgelse
205318eba588Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205418eba588Smrgfi
205518eba588Smrgm4_ifval([$1],
205618eba588Smrg[if test "$have_asciidoc" = yes; then
205718eba588Smrg    # scrape the asciidoc version
205818eba588Smrg    AC_MSG_CHECKING([the asciidoc version])
205918eba588Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
206018eba588Smrg    AC_MSG_RESULT([$asciidoc_version])
206118eba588Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206218eba588Smrg        [if test "x$use_asciidoc" = xauto; then
206318eba588Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206418eba588Smrg            have_asciidoc=no
206518eba588Smrg        else
206618eba588Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206718eba588Smrg        fi])
206818eba588Smrgfi])
206918eba588SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
207018eba588Smrg]) # XORG_WITH_ASCIIDOC
20711cc8c64fSmrg
207218eba588Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207318eba588Smrg# -------------------------------------------
207418eba588Smrg# Minimum version: 1.5.0
207518eba588Smrg# Minimum version for optional DEFAULT argument: 1.11.0
207618eba588Smrg# Minimum version for optional DOT checking: 1.18.0
2077b9bb67cbSmrg#
207818eba588Smrg# Documentation tools are not always available on all platforms and sometimes
207918eba588Smrg# not at the appropriate level. This macro enables a module to test for the
208018eba588Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
208118eba588Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
208218eba588Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208318eba588Smrg# --with-doxygen assumes 'auto'.
2084b5d2086dSmrg#
208518eba588Smrg# Interface to module:
208618eba588Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208718eba588Smrg# DOXYGEN:	 returns the path of the doxygen program found
208818eba588Smrg#		 returns the path set by the user in the environment
208918eba588Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
209018eba588Smrg#		  'no' user instructs the module not to use doxygen
2091b5d2086dSmrg#
209218eba588Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2093b5d2086dSmrg#
209418eba588SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209518eba588SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209618eba588SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209718eba588Smrgm4_define([_defopt], m4_default([$2], [auto]))
209818eba588SmrgAC_ARG_WITH(doxygen,
209918eba588Smrg	AS_HELP_STRING([--with-doxygen],
210018eba588Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210118eba588Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210218eba588Smrgm4_undefine([_defopt])
21031cc8c64fSmrg
210418eba588Smrgif test "x$use_doxygen" = x"auto"; then
210518eba588Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210618eba588Smrg   if test "x$DOXYGEN" = "x"; then
210718eba588Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210818eba588Smrg	have_doxygen=no
210918eba588Smrg   else
211018eba588Smrg        have_doxygen=yes
211118eba588Smrg   fi
211218eba588Smrgelif test "x$use_doxygen" = x"yes" ; then
211318eba588Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211418eba588Smrg   if test "x$DOXYGEN" = "x"; then
211518eba588Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211618eba588Smrg   fi
211718eba588Smrg   have_doxygen=yes
211818eba588Smrgelif test "x$use_doxygen" = x"no" ; then
211918eba588Smrg   if test "x$DOXYGEN" != "x"; then
212018eba588Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212118eba588Smrg   fi
212218eba588Smrg   have_doxygen=no
212318eba588Smrgelse
212418eba588Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
212518eba588Smrgfi
212618eba588Smrgm4_ifval([$1],
212718eba588Smrg[if test "$have_doxygen" = yes; then
212818eba588Smrg    # scrape the doxygen version
212918eba588Smrg    AC_MSG_CHECKING([the doxygen version])
213018eba588Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213118eba588Smrg    AC_MSG_RESULT([$doxygen_version])
213218eba588Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213318eba588Smrg        [if test "x$use_doxygen" = xauto; then
213418eba588Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213518eba588Smrg            have_doxygen=no
213618eba588Smrg        else
213718eba588Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213818eba588Smrg        fi])
213918eba588Smrgfi])
21401cc8c64fSmrg
214118eba588Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214218eba588Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214318eba588Smrgdnl 	HAVE_DOT = @HAVE_DOT@
214418eba588SmrgHAVE_DOT=no
214518eba588Smrgif test "x$have_doxygen" = "xyes"; then
214618eba588Smrg  AC_PATH_PROG([DOT], [dot])
214718eba588Smrg    if test "x$DOT" != "x"; then
214818eba588Smrg      HAVE_DOT=yes
214918eba588Smrg    fi
215018eba588Smrgfi
2151b9bb67cbSmrg
215218eba588SmrgAC_SUBST([HAVE_DOT])
215318eba588SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215418eba588SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215518eba588Smrg]) # XORG_WITH_DOXYGEN
2156b5d2086dSmrg
215718eba588Smrg# XORG_WITH_GROFF([DEFAULT])
215818eba588Smrg# ----------------
215918eba588Smrg# Minimum version: 1.6.0
216018eba588Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2161b9bb67cbSmrg#
216218eba588Smrg# Documentation tools are not always available on all platforms and sometimes
216318eba588Smrg# not at the appropriate level. This macro enables a module to test for the
216418eba588Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
216518eba588Smrg# the --with-groff option, it allows maximum flexibility in making decisions
216618eba588Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
216718eba588Smrg# --with-groff assumes 'auto'.
2168b9bb67cbSmrg#
216918eba588Smrg# Interface to module:
217018eba588Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217118eba588Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217218eba588Smrg# HAVE_GROFF_MS: the -ms macros package
217318eba588Smrg# GROFF:	 returns the path of the groff program found
217418eba588Smrg#		 returns the path set by the user in the environment
217518eba588Smrg# --with-groff:	 'yes' user instructs the module to use groff
217618eba588Smrg#		 'no' user instructs the module not to use groff
2177b9bb67cbSmrg#
217818eba588Smrg# Added in version 1.9.0:
217918eba588Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
218018eba588Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218118eba588Smrg#		   psselect from the psutils package.
218218eba588Smrg#		   the ghostcript package. Refer to the grohtml man pages
2183b9bb67cbSmrg#
218418eba588Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2185b5d2086dSmrg#
218618eba588Smrg# OS and distros often splits groff in a basic and full package, the former
218718eba588Smrg# having the groff program and the later having devices, fonts and macros
218818eba588Smrg# Checking for the groff executable is not enough.
2189b5d2086dSmrg#
219018eba588Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
219118eba588Smrg# unset HAVE_GROFF or GROFF env variables.
219218eba588Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219318eba588Smrg#
219418eba588SmrgAC_DEFUN([XORG_WITH_GROFF],[
219518eba588SmrgAC_ARG_VAR([GROFF], [Path to groff command])
219618eba588Smrgm4_define([_defopt], m4_default([$1], [auto]))
219718eba588SmrgAC_ARG_WITH(groff,
219818eba588Smrg	AS_HELP_STRING([--with-groff],
219918eba588Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
220018eba588Smrg	   [use_groff=$withval], [use_groff=]_defopt)
220118eba588Smrgm4_undefine([_defopt])
2202b5d2086dSmrg
220318eba588Smrgif test "x$use_groff" = x"auto"; then
220418eba588Smrg   AC_PATH_PROG([GROFF], [groff])
220518eba588Smrg   if test "x$GROFF" = "x"; then
220618eba588Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220718eba588Smrg	have_groff=no
220818eba588Smrg   else
220918eba588Smrg        have_groff=yes
221018eba588Smrg   fi
221118eba588Smrgelif test "x$use_groff" = x"yes" ; then
221218eba588Smrg   AC_PATH_PROG([GROFF], [groff])
221318eba588Smrg   if test "x$GROFF" = "x"; then
221418eba588Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221518eba588Smrg   fi
221618eba588Smrg   have_groff=yes
221718eba588Smrgelif test "x$use_groff" = x"no" ; then
221818eba588Smrg   if test "x$GROFF" != "x"; then
221918eba588Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
222018eba588Smrg   fi
222118eba588Smrg   have_groff=no
2222b9bb67cbSmrgelse
222318eba588Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2224b9bb67cbSmrgfi
22251cc8c64fSmrg
222618eba588Smrg# We have groff, test for the presence of the macro packages
222718eba588Smrgif test "x$have_groff" = x"yes"; then
222818eba588Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222918eba588Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
223018eba588Smrg        groff_ms_works=yes
223118eba588Smrg    else
223218eba588Smrg        groff_ms_works=no
2233b5d2086dSmrg    fi
223418eba588Smrg    AC_MSG_RESULT([$groff_ms_works])
223518eba588Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223618eba588Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223718eba588Smrg        groff_mm_works=yes
223818eba588Smrg    else
223918eba588Smrg        groff_mm_works=no
224018eba588Smrg    fi
224118eba588Smrg    AC_MSG_RESULT([$groff_mm_works])
2242b9bb67cbSmrgfi
2243b5d2086dSmrg
224418eba588Smrg# We have groff, test for HTML dependencies, one command per package
224518eba588Smrgif test "x$have_groff" = x"yes"; then
224618eba588Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224718eba588Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224818eba588Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224918eba588Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
225018eba588Smrg      have_groff_html=yes
225118eba588Smrg   else
225218eba588Smrg      have_groff_html=no
225318eba588Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225418eba588Smrg   fi
225518eba588Smrgfi
2256b5d2086dSmrg
225718eba588Smrg# Set Automake conditionals for Makefiles
225818eba588SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225918eba588SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
226018eba588SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226118eba588SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226218eba588Smrg]) # XORG_WITH_GROFF
2263b5d2086dSmrg
226418eba588Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226518eba588Smrg# ---------------------------------------
226618eba588Smrg# Minimum version: 1.6.0
226718eba588Smrg# Minimum version for optional DEFAULT argument: 1.11.0
226818eba588Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226918eba588Smrg#
227018eba588Smrg# Documentation tools are not always available on all platforms and sometimes
227118eba588Smrg# not at the appropriate level. This macro enables a module to test for the
227218eba588Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
227318eba588Smrg# the --with-fop option, it allows maximum flexibility in making decisions
227418eba588Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
227518eba588Smrg# --with-fop assumes 'auto'.
227618eba588Smrg#
227718eba588Smrg# Interface to module:
227818eba588Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227918eba588Smrg# FOP:	 	returns the path of the fop program found
228018eba588Smrg#		returns the path set by the user in the environment
228118eba588Smrg# --with-fop: 	'yes' user instructs the module to use fop
228218eba588Smrg#		'no' user instructs the module not to use fop
228318eba588Smrg#
228418eba588Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228518eba588Smrg#
228618eba588SmrgAC_DEFUN([XORG_WITH_FOP],[
228718eba588SmrgAC_ARG_VAR([FOP], [Path to fop command])
228818eba588Smrgm4_define([_defopt], m4_default([$2], [auto]))
228918eba588SmrgAC_ARG_WITH(fop,
229018eba588Smrg	AS_HELP_STRING([--with-fop],
229118eba588Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229218eba588Smrg	   [use_fop=$withval], [use_fop=]_defopt)
229318eba588Smrgm4_undefine([_defopt])
2294b5d2086dSmrg
229518eba588Smrgif test "x$use_fop" = x"auto"; then
229618eba588Smrg   AC_PATH_PROG([FOP], [fop])
229718eba588Smrg   if test "x$FOP" = "x"; then
229818eba588Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229918eba588Smrg	have_fop=no
230018eba588Smrg   else
230118eba588Smrg        have_fop=yes
230218eba588Smrg   fi
230318eba588Smrgelif test "x$use_fop" = x"yes" ; then
230418eba588Smrg   AC_PATH_PROG([FOP], [fop])
230518eba588Smrg   if test "x$FOP" = "x"; then
230618eba588Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230718eba588Smrg   fi
230818eba588Smrg   have_fop=yes
230918eba588Smrgelif test "x$use_fop" = x"no" ; then
231018eba588Smrg   if test "x$FOP" != "x"; then
231118eba588Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231218eba588Smrg   fi
231318eba588Smrg   have_fop=no
231418eba588Smrgelse
231518eba588Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2316b9bb67cbSmrgfi
23171cc8c64fSmrg
231818eba588Smrg# Test for a minimum version of fop, if provided.
231918eba588Smrgm4_ifval([$1],
232018eba588Smrg[if test "$have_fop" = yes; then
232118eba588Smrg    # scrape the fop version
232218eba588Smrg    AC_MSG_CHECKING([for fop minimum version])
232318eba588Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232418eba588Smrg    AC_MSG_RESULT([$fop_version])
232518eba588Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
232618eba588Smrg        [if test "x$use_fop" = xauto; then
232718eba588Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232818eba588Smrg            have_fop=no
232918eba588Smrg        else
233018eba588Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233118eba588Smrg        fi])
233218eba588Smrgfi])
233318eba588SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233418eba588Smrg]) # XORG_WITH_FOP
23351cc8c64fSmrg
233618eba588Smrg# XORG_WITH_M4([MIN-VERSION])
233718eba588Smrg# ---------------------------
233818eba588Smrg# Minimum version: 1.19.0
2339b9bb67cbSmrg#
234018eba588Smrg# This macro attempts to locate an m4 macro processor which supports
234118eba588Smrg# -I option and is only useful for modules relying on M4 in order to
234218eba588Smrg# expand macros in source code files.
2343b5d2086dSmrg#
234418eba588Smrg# Interface to module:
234518eba588Smrg# M4:	 	returns the path of the m4 program found
234618eba588Smrg#		returns the path set by the user in the environment
234718eba588Smrg#
234818eba588SmrgAC_DEFUN([XORG_WITH_M4], [
234918eba588SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
235018eba588Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235118eba588Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235218eba588Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235318eba588Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235418eba588Smrg   [$PATH:/usr/gnu/bin])])
23551cc8c64fSmrg
235618eba588SmrgAC_SUBST([M4], [$ac_cv_path_M4])
235718eba588Smrg]) # XORG_WITH_M4
23581cc8c64fSmrg
235918eba588Smrg# XORG_WITH_PS2PDF([DEFAULT])
236018eba588Smrg# ----------------
236118eba588Smrg# Minimum version: 1.6.0
236218eba588Smrg# Minimum version for optional DEFAULT argument: 1.11.0
236318eba588Smrg#
236418eba588Smrg# Documentation tools are not always available on all platforms and sometimes
236518eba588Smrg# not at the appropriate level. This macro enables a module to test for the
236618eba588Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
236718eba588Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
236818eba588Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236918eba588Smrg# --with-ps2pdf assumes 'auto'.
237018eba588Smrg#
237118eba588Smrg# Interface to module:
237218eba588Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237318eba588Smrg# PS2PDF:	returns the path of the ps2pdf program found
237418eba588Smrg#		returns the path set by the user in the environment
237518eba588Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237618eba588Smrg#		 'no' user instructs the module not to use ps2pdf
237718eba588Smrg#
237818eba588Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237918eba588Smrg#
238018eba588SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238118eba588SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238218eba588Smrgm4_define([_defopt], m4_default([$1], [auto]))
238318eba588SmrgAC_ARG_WITH(ps2pdf,
238418eba588Smrg	AS_HELP_STRING([--with-ps2pdf],
238518eba588Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238618eba588Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238718eba588Smrgm4_undefine([_defopt])
23881cc8c64fSmrg
238918eba588Smrgif test "x$use_ps2pdf" = x"auto"; then
239018eba588Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239118eba588Smrg   if test "x$PS2PDF" = "x"; then
239218eba588Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239318eba588Smrg	have_ps2pdf=no
239418eba588Smrg   else
239518eba588Smrg        have_ps2pdf=yes
239618eba588Smrg   fi
239718eba588Smrgelif test "x$use_ps2pdf" = x"yes" ; then
239818eba588Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239918eba588Smrg   if test "x$PS2PDF" = "x"; then
240018eba588Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240118eba588Smrg   fi
240218eba588Smrg   have_ps2pdf=yes
240318eba588Smrgelif test "x$use_ps2pdf" = x"no" ; then
240418eba588Smrg   if test "x$PS2PDF" != "x"; then
240518eba588Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240618eba588Smrg   fi
240718eba588Smrg   have_ps2pdf=no
240818eba588Smrgelse
240918eba588Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2410b5d2086dSmrgfi
241118eba588SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241218eba588Smrg]) # XORG_WITH_PS2PDF
24131cc8c64fSmrg
241418eba588Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
241518eba588Smrg# ----------------
241618eba588Smrg# Minimum version: 1.6.0
241718eba588Smrg#
241818eba588Smrg# Documentation tools are not always available on all platforms and sometimes
241918eba588Smrg# not at the appropriate level. This macro enables a builder to skip all
242018eba588Smrg# documentation targets except traditional man pages.
242118eba588Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242218eba588Smrg# maximum flexibility in controlling documentation building.
242318eba588Smrg# Refer to:
242418eba588Smrg# XORG_WITH_XMLTO         --with-xmlto
242518eba588Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242618eba588Smrg# XORG_WITH_DOXYGEN       --with-doxygen
242718eba588Smrg# XORG_WITH_FOP           --with-fop
242818eba588Smrg# XORG_WITH_GROFF         --with-groff
242918eba588Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
243018eba588Smrg#
243118eba588Smrg# Interface to module:
243218eba588Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243318eba588Smrg# --enable-docs: 'yes' user instructs the module to generate docs
243418eba588Smrg#		 'no' user instructs the module not to generate docs
243518eba588Smrg# parm1:	specify the default value, yes or no.
243618eba588Smrg#
243718eba588SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243818eba588Smrgm4_define([docs_default], m4_default([$1], [yes]))
243918eba588SmrgAC_ARG_ENABLE(docs,
244018eba588Smrg	AS_HELP_STRING([--enable-docs],
244118eba588Smrg	   [Enable building the documentation (default: ]docs_default[)]),
244218eba588Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
244318eba588Smrgm4_undefine([docs_default])
244418eba588SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244518eba588SmrgAC_MSG_CHECKING([whether to build documentation])
244618eba588SmrgAC_MSG_RESULT([$build_docs])
244718eba588Smrg]) # XORG_ENABLE_DOCS
24481cc8c64fSmrg
244918eba588Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
245018eba588Smrg# ----------------
245118eba588Smrg# Minimum version: 1.6.0
245218eba588Smrg#
245318eba588Smrg# This macro enables a builder to skip all developer documentation.
245418eba588Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245518eba588Smrg# maximum flexibility in controlling documentation building.
245618eba588Smrg# Refer to:
245718eba588Smrg# XORG_WITH_XMLTO         --with-xmlto
245818eba588Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245918eba588Smrg# XORG_WITH_DOXYGEN       --with-doxygen
246018eba588Smrg# XORG_WITH_FOP           --with-fop
246118eba588Smrg# XORG_WITH_GROFF         --with-groff
246218eba588Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
246318eba588Smrg#
246418eba588Smrg# Interface to module:
246518eba588Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246618eba588Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246718eba588Smrg#			'no' user instructs the module not to generate developer docs
246818eba588Smrg# parm1:		specify the default value, yes or no.
246918eba588Smrg#
247018eba588SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247118eba588Smrgm4_define([devel_default], m4_default([$1], [yes]))
247218eba588SmrgAC_ARG_ENABLE(devel-docs,
247318eba588Smrg	AS_HELP_STRING([--enable-devel-docs],
247418eba588Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247518eba588Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247618eba588Smrgm4_undefine([devel_default])
247718eba588SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247818eba588SmrgAC_MSG_CHECKING([whether to build developer documentation])
247918eba588SmrgAC_MSG_RESULT([$build_devel_docs])
248018eba588Smrg]) # XORG_ENABLE_DEVEL_DOCS
24811cc8c64fSmrg
248218eba588Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
248318eba588Smrg# ----------------
248418eba588Smrg# Minimum version: 1.6.0
248518eba588Smrg#
248618eba588Smrg# This macro enables a builder to skip all functional specification targets.
248718eba588Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248818eba588Smrg# maximum flexibility in controlling documentation building.
248918eba588Smrg# Refer to:
249018eba588Smrg# XORG_WITH_XMLTO         --with-xmlto
249118eba588Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249218eba588Smrg# XORG_WITH_DOXYGEN       --with-doxygen
249318eba588Smrg# XORG_WITH_FOP           --with-fop
249418eba588Smrg# XORG_WITH_GROFF         --with-groff
249518eba588Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
249618eba588Smrg#
249718eba588Smrg# Interface to module:
249818eba588Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249918eba588Smrg# --enable-specs:	'yes' user instructs the module to generate specs
250018eba588Smrg#			'no' user instructs the module not to generate specs
250118eba588Smrg# parm1:		specify the default value, yes or no.
250218eba588Smrg#
250318eba588SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250418eba588Smrgm4_define([spec_default], m4_default([$1], [yes]))
250518eba588SmrgAC_ARG_ENABLE(specs,
250618eba588Smrg	AS_HELP_STRING([--enable-specs],
250718eba588Smrg	   [Enable building the specs (default: ]spec_default[)]),
250818eba588Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
250918eba588Smrgm4_undefine([spec_default])
251018eba588SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251118eba588SmrgAC_MSG_CHECKING([whether to build functional specifications])
251218eba588SmrgAC_MSG_RESULT([$build_specs])
251318eba588Smrg]) # XORG_ENABLE_SPECS
2514b9bb67cbSmrg
251518eba588Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251618eba588Smrg# ----------------------------------------------
251718eba588Smrg# Minimum version: 1.13.0
251818eba588Smrg#
251918eba588Smrg# This macro enables a builder to enable/disable unit testing
252018eba588Smrg# It makes no assumption about the test cases implementation
252118eba588Smrg# Test cases may or may not use Automake "Support for test suites"
252218eba588Smrg# They may or may not use the software utility library GLib
252318eba588Smrg#
252418eba588Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252518eba588Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252618eba588Smrg# The variable enable_unit_tests is used by other macros in this file.
252718eba588Smrg#
252818eba588Smrg# Interface to module:
252918eba588Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
253018eba588Smrg# enable_unit_tests:    used in configure.ac for additional configuration
253118eba588Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253218eba588Smrg#			'no' user instructs the module not to build tests
253318eba588Smrg# parm1:		specify the default value, yes or no.
253418eba588Smrg#
253518eba588SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253618eba588SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253718eba588SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253818eba588SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253918eba588Smrgm4_define([_defopt], m4_default([$1], [auto]))
254018eba588SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254118eba588Smrg	[Enable building unit test cases (default: ]_defopt[)]),
254218eba588Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254318eba588Smrgm4_undefine([_defopt])
254418eba588SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254518eba588SmrgAC_MSG_CHECKING([whether to build unit test cases])
254618eba588SmrgAC_MSG_RESULT([$enable_unit_tests])
254718eba588Smrg]) # XORG_ENABLE_UNIT_TESTS
2548b5d2086dSmrg
254918eba588Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
255018eba588Smrg# ------------------------------------------------------
255118eba588Smrg# Minimum version: 1.17.0
255218eba588Smrg#
255318eba588Smrg# This macro enables a builder to enable/disable integration testing
255418eba588Smrg# It makes no assumption about the test cases' implementation
255518eba588Smrg# Test cases may or may not use Automake "Support for test suites"
255618eba588Smrg#
255718eba588Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255818eba588Smrg# usually requires less dependencies and may be built and run under less
255918eba588Smrg# stringent environments than integration tests.
256018eba588Smrg#
256118eba588Smrg# Interface to module:
256218eba588Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256318eba588Smrg# enable_integration_tests:   used in configure.ac for additional configuration
256418eba588Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256518eba588Smrg#                             'no' user instructs the module not to build tests
256618eba588Smrg# parm1:                      specify the default value, yes or no.
256718eba588Smrg#
256818eba588SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256918eba588SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
257018eba588Smrgm4_define([_defopt], m4_default([$1], [auto]))
257118eba588SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257218eba588Smrg	[Enable building integration test cases (default: ]_defopt[)]),
257318eba588Smrg	[enable_integration_tests=$enableval],
257418eba588Smrg	[enable_integration_tests=]_defopt)
257518eba588Smrgm4_undefine([_defopt])
257618eba588SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257718eba588Smrg	[test "x$enable_integration_tests" != xno])
257818eba588SmrgAC_MSG_CHECKING([whether to build unit test cases])
257918eba588SmrgAC_MSG_RESULT([$enable_integration_tests])
258018eba588Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2581b5d2086dSmrg
258218eba588Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258318eba588Smrg# ----------------------------------------
258418eba588Smrg# Minimum version: 1.13.0
258518eba588Smrg#
258618eba588Smrg# GLib is a library which provides advanced data structures and functions.
258718eba588Smrg# This macro enables a module to test for the presence of Glib.
258818eba588Smrg#
258918eba588Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
259018eba588Smrg# Otherwise the value of $enable_unit_tests is blank.
259118eba588Smrg#
259218eba588Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259318eba588Smrg# test support usually requires less dependencies and may be built and run under
259418eba588Smrg# less stringent environments than integration tests.
259518eba588Smrg#
259618eba588Smrg# Interface to module:
259718eba588Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
259818eba588Smrg# with_glib: used in configure.ac to know if GLib has been found
259918eba588Smrg# --with-glib:	'yes' user instructs the module to use glib
260018eba588Smrg#		'no' user instructs the module not to use glib
260118eba588Smrg#
260218eba588SmrgAC_DEFUN([XORG_WITH_GLIB],[
260318eba588SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260418eba588Smrgm4_define([_defopt], m4_default([$2], [auto]))
260518eba588SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260618eba588Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260718eba588Smrg	[with_glib=$withval], [with_glib=]_defopt)
260818eba588Smrgm4_undefine([_defopt])
2609b5d2086dSmrg
261018eba588Smrghave_glib=no
261118eba588Smrg# Do not probe GLib if user explicitly disabled unit testing
261218eba588Smrgif test "x$enable_unit_tests" != x"no"; then
261318eba588Smrg  # Do not probe GLib if user explicitly disabled it
261418eba588Smrg  if test "x$with_glib" != x"no"; then
261518eba588Smrg    m4_ifval(
261618eba588Smrg      [$1],
261718eba588Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261818eba588Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261918eba588Smrg    )
262018eba588Smrg  fi
262118eba588Smrgfi
2622b5d2086dSmrg
262318eba588Smrg# Not having GLib when unit testing has been explicitly requested is an error
262418eba588Smrgif test "x$enable_unit_tests" = x"yes"; then
262518eba588Smrg  if test "x$have_glib" = x"no"; then
262618eba588Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
262718eba588Smrg  fi
262818eba588Smrgfi
2629b5d2086dSmrg
263018eba588Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
263118eba588Smrgif test "x$enable_unit_tests" = x"no"; then
263218eba588Smrg  if test "x$with_glib" = x"yes"; then
263318eba588Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263418eba588Smrg  fi
2635b9bb67cbSmrgfi
2636b9bb67cbSmrg
263718eba588Smrg# Not having GLib when it has been explicitly requested is an error
263818eba588Smrgif test "x$with_glib" = x"yes"; then
263918eba588Smrg  if test "x$have_glib" = x"no"; then
264018eba588Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264118eba588Smrg  fi
264218eba588Smrgfi
2643b9bb67cbSmrg
264418eba588SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264518eba588Smrg]) # XORG_WITH_GLIB
2646b9bb67cbSmrg
264718eba588Smrg# XORG_LD_WRAP([required|optional])
264818eba588Smrg# ---------------------------------
264918eba588Smrg# Minimum version: 1.13.0
265018eba588Smrg#
265118eba588Smrg# Check if linker supports -wrap, passed via compiler flags
265218eba588Smrg#
265318eba588Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265418eba588Smrg# Otherwise the value of $enable_unit_tests is blank.
265518eba588Smrg#
265618eba588Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265718eba588Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265818eba588Smrg# available, an argument of "optional" allows use when some unit tests require
265918eba588Smrg# ld -wrap and others do not.
266018eba588Smrg#
266118eba588SmrgAC_DEFUN([XORG_LD_WRAP],[
266218eba588SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266318eba588Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266418eba588Smrg                      void __wrap_exit(int status) { return; }],
266518eba588Smrg                     [exit(0);])])
266618eba588Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
266718eba588Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266818eba588Smrg  if test "x$have_ld_wrap" = x"no"; then
266918eba588Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
267018eba588Smrg  fi
2671b9bb67cbSmrgfi
267218eba588SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267318eba588Smrg#
267418eba588Smrg]) # XORG_LD_WRAP
2675b9bb67cbSmrg
267618eba588Smrg# XORG_CHECK_LINKER_FLAGS
267718eba588Smrg# -----------------------
267818eba588Smrg# SYNOPSIS
267918eba588Smrg#
268018eba588Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268118eba588Smrg#
268218eba588Smrg# DESCRIPTION
268318eba588Smrg#
268418eba588Smrg#   Check whether the given linker FLAGS work with the current language's
268518eba588Smrg#   linker, or whether they give an error.
268618eba588Smrg#
268718eba588Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268818eba588Smrg#   success/failure.
268918eba588Smrg#
269018eba588Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
269118eba588Smrg#
269218eba588Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269318eba588Smrg#
269418eba588Smrg# LICENSE
269518eba588Smrg#
269618eba588Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269718eba588Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269818eba588Smrg#   Copyright (c) 2009 Matteo Frigo
269918eba588Smrg#
270018eba588Smrg#   This program is free software: you can redistribute it and/or modify it
270118eba588Smrg#   under the terms of the GNU General Public License as published by the
270218eba588Smrg#   Free Software Foundation, either version 3 of the License, or (at your
270318eba588Smrg#   option) any later version.
270418eba588Smrg#
270518eba588Smrg#   This program is distributed in the hope that it will be useful, but
270618eba588Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270718eba588Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270818eba588Smrg#   Public License for more details.
270918eba588Smrg#
271018eba588Smrg#   You should have received a copy of the GNU General Public License along
271118eba588Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271218eba588Smrg#
271318eba588Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
271418eba588Smrg#   gives unlimited permission to copy, distribute and modify the configure
271518eba588Smrg#   scripts that are the output of Autoconf when processing the Macro. You
271618eba588Smrg#   need not follow the terms of the GNU General Public License when using
271718eba588Smrg#   or distributing such scripts, even though portions of the text of the
271818eba588Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271918eba588Smrg#   all other use of the material that constitutes the Autoconf Macro.
272018eba588Smrg#
272118eba588Smrg#   This special exception to the GPL applies to versions of the Autoconf
272218eba588Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
272318eba588Smrg#   modified version of the Autoconf Macro, you may extend this special
272418eba588Smrg#   exception to the GPL to apply to your modified version as well.#
272518eba588SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272618eba588Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
272718eba588Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272818eba588SmrgAS_LITERAL_IF([$1],
272918eba588Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
273018eba588Smrg      ax_save_FLAGS=$LDFLAGS
273118eba588Smrg      LDFLAGS="$1"
273218eba588Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273318eba588Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273418eba588Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273518eba588Smrg      LDFLAGS=$ax_save_FLAGS])],
273618eba588Smrg  [ax_save_FLAGS=$LDFLAGS
273718eba588Smrg   LDFLAGS="$1"
273818eba588Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273918eba588Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
274018eba588Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274118eba588Smrg   LDFLAGS=$ax_save_FLAGS])
274218eba588Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274318eba588SmrgAC_MSG_RESULT($xorg_check_linker_flags)
274418eba588Smrgif test "x$xorg_check_linker_flags" = xyes; then
274518eba588Smrg	m4_default([$2], :)
274618eba588Smrgelse
274718eba588Smrg	m4_default([$3], :)
274818eba588Smrgfi
274918eba588Smrg]) # XORG_CHECK_LINKER_FLAGS
2750b9bb67cbSmrg
275118eba588Smrg# XORG_MEMORY_CHECK_FLAGS
275218eba588Smrg# -----------------------
275318eba588Smrg# Minimum version: 1.16.0
2754b5d2086dSmrg#
275518eba588Smrg# This macro attempts to find appropriate memory checking functionality
275618eba588Smrg# for various platforms which unit testing code may use to catch various
275718eba588Smrg# forms of memory allocation and access errors in testing.
275818eba588Smrg#
275918eba588Smrg# Interface to module:
276018eba588Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276118eba588Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276218eba588Smrg#
276318eba588Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276418eba588Smrg#
276518eba588SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2766b9bb67cbSmrg
276718eba588SmrgAC_REQUIRE([AC_CANONICAL_HOST])
276818eba588SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276918eba588Smrg           [Environment variables to enable memory checking in tests])
2770b9bb67cbSmrg
277118eba588Smrg# Check for different types of support on different platforms
277218eba588Smrgcase $host_os in
277318eba588Smrg    solaris*)
277418eba588Smrg        AC_CHECK_LIB([umem], [umem_alloc],
277518eba588Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277618eba588Smrg        ;;
277718eba588Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277818eba588Smrg        # both directly and inverted, so should not be 0 or 255.
277918eba588Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
278018eba588Smrg        ;;
278118eba588Smrg    darwin*)
278218eba588Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278318eba588Smrg        ;;
278418eba588Smrg    *bsd*)
278518eba588Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278618eba588Smrg        ;;
278718eba588Smrgesac
2788b9bb67cbSmrg
278918eba588Smrg# User supplied flags override default flags
279018eba588Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279118eba588Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
279218eba588Smrgfi
2793b9bb67cbSmrg
279418eba588SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279518eba588Smrg]) # XORG_WITH_LINT
2796b5d2086dSmrg
279718eba588Smrg# XORG_CHECK_MALLOC_ZERO
279818eba588Smrg# ----------------------
279918eba588Smrg# Minimum version: 1.0.0
2800b9bb67cbSmrg#
280118eba588Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280218eba588Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280318eba588Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280418eba588SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280518eba588SmrgAC_ARG_ENABLE(malloc0returnsnull,
280618eba588Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280718eba588Smrg		       [malloc(0) returns NULL (default: auto)]),
280818eba588Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280918eba588Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2810b9bb67cbSmrg
281118eba588SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281218eba588Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281318eba588SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281418eba588Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281518eba588Smrg#include <stdlib.h>
281618eba588Smrg],[
281718eba588Smrg    char *m0, *r0, *c0, *p;
281818eba588Smrg    m0 = malloc(0);
281918eba588Smrg    p = malloc(10);
282018eba588Smrg    r0 = realloc(p,0);
282118eba588Smrg    c0 = calloc(0,10);
282218eba588Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282318eba588Smrg])],
282418eba588Smrg		[xorg_cv_malloc0_returns_null=yes],
282518eba588Smrg		[xorg_cv_malloc0_returns_null=no])])
282618eba588SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
282718eba588Smrgfi
282818eba588SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2829b9bb67cbSmrg
283018eba588Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283118eba588Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283218eba588Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283318eba588Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
283418eba588Smrgelse
283518eba588Smrg	MALLOC_ZERO_CFLAGS=""
283618eba588Smrg	XMALLOC_ZERO_CFLAGS=""
283718eba588Smrg	XTMALLOC_ZERO_CFLAGS=""
283818eba588Smrgfi
2839b9bb67cbSmrg
284018eba588SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284118eba588SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284218eba588SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284318eba588Smrg]) # XORG_CHECK_MALLOC_ZERO
28441cc8c64fSmrg
284518eba588Smrg# XORG_WITH_LINT()
284618eba588Smrg# ----------------
284718eba588Smrg# Minimum version: 1.1.0
2848b9bb67cbSmrg#
284918eba588Smrg# This macro enables the use of a tool that flags some suspicious and
285018eba588Smrg# non-portable constructs (likely to be bugs) in C language source code.
285118eba588Smrg# It will attempt to locate the tool and use appropriate options.
285218eba588Smrg# There are various lint type tools on different platforms.
285318eba588Smrg#
285418eba588Smrg# Interface to module:
285518eba588Smrg# LINT:		returns the path to the tool found on the platform
285618eba588Smrg#		or the value set to LINT on the configure cmd line
285718eba588Smrg#		also an Automake conditional
285818eba588Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
285918eba588Smrg#
286018eba588Smrg# --with-lint:	'yes' user instructs the module to use lint
286118eba588Smrg#		'no' user instructs the module not to use lint (default)
286218eba588Smrg#
286318eba588Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286418eba588Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286518eba588Smrg#
286618eba588SmrgAC_DEFUN([XORG_WITH_LINT],[
2867b9bb67cbSmrg
286818eba588SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286918eba588SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
287018eba588SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287118eba588Smrg		[Use a lint-style source code checker (default: disabled)])],
287218eba588Smrg		[use_lint=$withval], [use_lint=no])
2873b9bb67cbSmrg
287418eba588Smrg# Obtain platform specific info like program name and options
287518eba588Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287618eba588Smrgcase $host_os in
287718eba588Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287818eba588Smrg	lint_name=splint
287918eba588Smrg	lint_options="-badflag"
288018eba588Smrg	;;
288118eba588Smrg  *freebsd* | *netbsd*)
288218eba588Smrg	lint_name=lint
288318eba588Smrg	lint_options="-u -b"
288418eba588Smrg	;;
288518eba588Smrg  *solaris*)
288618eba588Smrg	lint_name=lint
288718eba588Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288818eba588Smrg	;;
288918eba588Smrgesac
2890b9bb67cbSmrg
289118eba588Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289218eba588Smrgif test "x$use_lint" = x"yes" ; then
289318eba588Smrg   AC_PATH_PROG([LINT], [$lint_name])
289418eba588Smrg   if test "x$LINT" = "x"; then
289518eba588Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289618eba588Smrg   fi
289718eba588Smrgelif test "x$use_lint" = x"no" ; then
289818eba588Smrg   if test "x$LINT" != "x"; then
289918eba588Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
290018eba588Smrg   fi
2901b5d2086dSmrgelse
290218eba588Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2903b5d2086dSmrgfi
2904b9bb67cbSmrg
290518eba588Smrg# User supplied flags override default flags
290618eba588Smrgif test "x$LINT_FLAGS" != "x"; then
290718eba588Smrg   lint_options=$LINT_FLAGS
290818eba588Smrgfi
2909b9bb67cbSmrg
291018eba588SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291118eba588SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2912b5d2086dSmrg
291318eba588Smrg]) # XORG_WITH_LINT
2914b5d2086dSmrg
291518eba588Smrg# XORG_LINT_LIBRARY(LIBNAME)
291618eba588Smrg# --------------------------
291718eba588Smrg# Minimum version: 1.1.0
2918b9bb67cbSmrg#
291918eba588Smrg# Sets up flags for building lint libraries for checking programs that call
292018eba588Smrg# functions in the library.
292118eba588Smrg#
292218eba588Smrg# Interface to module:
292318eba588Smrg# LINTLIB		- Automake variable with the name of lint library file to make
292418eba588Smrg# MAKE_LINT_LIB		- Automake conditional
292518eba588Smrg#
292618eba588Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292718eba588Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2928b5d2086dSmrg
292918eba588SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
293018eba588SmrgAC_REQUIRE([XORG_WITH_LINT])
293118eba588SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293218eba588Smrg	[Create lint library (default: disabled)])],
293318eba588Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2934b9bb67cbSmrg
293518eba588Smrgif test "x$make_lint_lib" = x"yes" ; then
293618eba588Smrg   LINTLIB=llib-l$1.ln
293718eba588Smrg   if test "x$LINT" = "x"; then
293818eba588Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293918eba588Smrg   fi
294018eba588Smrgelif test "x$make_lint_lib" != x"no" ; then
294118eba588Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
294218eba588Smrgfi
2943b9bb67cbSmrg
294418eba588SmrgAC_SUBST(LINTLIB)
294518eba588SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29461cc8c64fSmrg
294718eba588Smrg]) # XORG_LINT_LIBRARY
29481cc8c64fSmrg
294918eba588Smrg# XORG_COMPILER_BRAND
295018eba588Smrg# -------------------
295118eba588Smrg# Minimum version: 1.14.0
295218eba588Smrg#
295318eba588Smrg# Checks for various brands of compilers and sets flags as appropriate:
295418eba588Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295518eba588Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295618eba588Smrg#   clang compiler - sets CLANGCC to "yes"
295718eba588Smrg#   Intel compiler - sets INTELCC to "yes"
295818eba588Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295918eba588Smrg#
296018eba588SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296118eba588SmrgAC_LANG_CASE(
296218eba588Smrg	[C], [
296318eba588Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
296418eba588Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
296518eba588Smrg		m4_version_prereq([2.70],
296618eba588Smrg			[AC_REQUIRE([AC_PROG_CC])],
296718eba588Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
296818eba588Smrg	],
296918eba588Smrg	[C++], [
297018eba588Smrg		AC_REQUIRE([AC_PROG_CXX])
297118eba588Smrg	]
297218eba588Smrg)
297318eba588SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
297418eba588SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297518eba588SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297618eba588Smrg]) # XORG_COMPILER_BRAND
2977b9bb67cbSmrg
297818eba588Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
297918eba588Smrg# ---------------
298018eba588Smrg# Minimum version: 1.16.0
298118eba588Smrg#
298218eba588Smrg# Test if the compiler works when passed the given flag as a command line argument.
298318eba588Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
298418eba588Smrg# next flag in the list until there are no more options.
298518eba588Smrg#
298618eba588Smrg# Note that this does not guarantee that the compiler supports the flag as some
298718eba588Smrg# compilers will simply ignore arguments that they do not understand, but we do
298818eba588Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298918eba588Smrg# -Werror=unused-command-line-argument
299018eba588Smrg#
299118eba588SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
299218eba588Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
299318eba588Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
299418eba588Smrg
299518eba588SmrgAC_LANG_COMPILER_REQUIRE
299618eba588Smrg
299718eba588SmrgAC_LANG_CASE(
299818eba588Smrg	[C], [
299918eba588Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
300018eba588Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
300118eba588Smrg		m4_version_prereq([2.70],
300218eba588Smrg			[AC_REQUIRE([AC_PROG_CC])],
300318eba588Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
300418eba588Smrg		define([PREFIX], [C])
300518eba588Smrg		define([CACHE_PREFIX], [cc])
300618eba588Smrg		define([COMPILER], [$CC])
300718eba588Smrg	],
300818eba588Smrg	[C++], [
300918eba588Smrg		define([PREFIX], [CXX])
301018eba588Smrg		define([CACHE_PREFIX], [cxx])
301118eba588Smrg		define([COMPILER], [$CXX])
301218eba588Smrg	]
301318eba588Smrg)
3014b9bb67cbSmrg
301518eba588Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
301618eba588Smrg
301718eba588Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
301818eba588Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301918eba588Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
302018eba588Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
302118eba588Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302218eba588Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
302318eba588Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
302418eba588Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
302518eba588Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
302618eba588Smrgfi
3027b5d2086dSmrg
302818eba588Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302918eba588Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
303018eba588Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303118eba588Smrg	fi
303218eba588Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
303318eba588Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
303418eba588Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
303518eba588Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
303618eba588Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
303718eba588Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
303818eba588Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303918eba588Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
304018eba588Smrgfi
3041b5d2086dSmrg
304218eba588Smrgfound="no"
304318eba588Smrgm4_foreach([flag], m4_cdr($@), [
304418eba588Smrg	if test $found = "no" ; then
304518eba588Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
304618eba588Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
304718eba588Smrg		fi
304818eba588Smrg
304918eba588Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
305018eba588Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
305118eba588Smrg		fi
305218eba588Smrg
305318eba588Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
305418eba588Smrg
305518eba588Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
305618eba588Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
305718eba588Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
305818eba588Smrg		AC_CACHE_VAL($cacheid,
305918eba588Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
306018eba588Smrg					     [eval $cacheid=yes],
306118eba588Smrg					     [eval $cacheid=no])])
306218eba588Smrg
306318eba588Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
306418eba588Smrg
306518eba588Smrg		eval supported=\$$cacheid
306618eba588Smrg		AC_MSG_RESULT([$supported])
306718eba588Smrg		if test "$supported" = "yes" ; then
306818eba588Smrg			$1="$$1 ]flag["
306918eba588Smrg			found="yes"
307018eba588Smrg		fi
307118eba588Smrg	fi
307218eba588Smrg])
307318eba588Smrg]) # XORG_TESTSET_CFLAG
3074b5d2086dSmrg
307518eba588Smrg# XORG_COMPILER_FLAGS
307618eba588Smrg# ---------------
307718eba588Smrg# Minimum version: 1.16.0
307818eba588Smrg#
307918eba588Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
308018eba588Smrg# arguments supported by the selected compiler which do NOT alter the generated
308118eba588Smrg# code.  These arguments will cause the compiler to print various warnings
308218eba588Smrg# during compilation AND turn a conservative set of warnings into errors.
308318eba588Smrg#
308418eba588Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
308518eba588Smrg# future versions of util-macros as options are added to new compilers.
308618eba588Smrg#
308718eba588SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
308818eba588SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
308918eba588Smrg
309018eba588SmrgAC_ARG_ENABLE(selective-werror,
309118eba588Smrg              AS_HELP_STRING([--disable-selective-werror],
309218eba588Smrg                             [Turn off selective compiler errors. (default: enabled)]),
309318eba588Smrg              [SELECTIVE_WERROR=$enableval],
309418eba588Smrg              [SELECTIVE_WERROR=yes])
309518eba588Smrg
309618eba588SmrgAC_LANG_CASE(
309718eba588Smrg        [C], [
309818eba588Smrg                define([PREFIX], [C])
309918eba588Smrg        ],
310018eba588Smrg        [C++], [
310118eba588Smrg                define([PREFIX], [CXX])
310218eba588Smrg        ]
310318eba588Smrg)
310418eba588Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
310518eba588Smrgif test "x$SUNCC" = "xyes"; then
310618eba588Smrg    [BASE_]PREFIX[FLAGS]="-v"
3107b5d2086dSmrgelse
310818eba588Smrg    [BASE_]PREFIX[FLAGS]=""
3109b9bb67cbSmrgfi
3110b9bb67cbSmrg
311118eba588Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
311218eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
311318eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
311418eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
311518eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
311618eba588Smrg
311718eba588SmrgAC_LANG_CASE(
311818eba588Smrg	[C], [
311918eba588Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
312018eba588Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
312118eba588Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
312218eba588Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
312318eba588Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
312418eba588Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
312518eba588Smrg	]
312618eba588Smrg)
3127b9bb67cbSmrg
312818eba588Smrg# This chunk adds additional warnings that could catch undesired effects.
312918eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
313018eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
313118eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
313218eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
313318eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
313418eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
313518eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
313618eba588Smrg
313718eba588Smrg# These are currently disabled because they are noisy.  They will be enabled
313818eba588Smrg# in the future once the codebase is sufficiently modernized to silence
313918eba588Smrg# them.  For now, I don't want them to drown out the other warnings.
314018eba588Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
314118eba588Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
314218eba588Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
314318eba588Smrg
314418eba588Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
314518eba588Smrg# when there are problems that should be fixed.
314618eba588Smrg
314718eba588Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
314818eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314918eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
315018eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
315118eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
315218eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
315318eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
315418eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
315518eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
315618eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
315718eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
315818eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315918eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
316018eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
316118eba588Smrgelse
316218eba588SmrgAC_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])
316318eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
316418eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
316518eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
316618eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
316718eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
316818eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316918eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
317018eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
317118eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
317218eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
317318eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
317418eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
317518eba588SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
317618eba588Smrgfi
3177b9bb67cbSmrg
317818eba588SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317918eba588Smrg]) # XORG_COMPILER_FLAGS
3180b9bb67cbSmrg
318118eba588Smrg# XORG_CWARNFLAGS
318218eba588Smrg# ---------------
318318eba588Smrg# Minimum version: 1.2.0
318418eba588Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3185b5d2086dSmrg#
318618eba588Smrg# Defines CWARNFLAGS to enable C compiler warnings.
318718eba588Smrg#
318818eba588Smrg# This function is deprecated because it defines -fno-strict-aliasing
318918eba588Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
319018eba588Smrg# is needed, then it should be added explicitly in the module when
319118eba588Smrg# it is updated to use BASE_CFLAGS.
319218eba588Smrg#
319318eba588SmrgAC_DEFUN([XORG_CWARNFLAGS], [
319418eba588SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
319518eba588SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
319618eba588SmrgAC_LANG_CASE(
319718eba588Smrg	[C], [
319818eba588Smrg		CWARNFLAGS="$BASE_CFLAGS"
319918eba588Smrg		if  test "x$GCC" = xyes ; then
320018eba588Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
320118eba588Smrg		fi
320218eba588Smrg		AC_SUBST(CWARNFLAGS)
320318eba588Smrg	]
320418eba588Smrg)
320518eba588Smrg]) # XORG_CWARNFLAGS
3206b9bb67cbSmrg
320718eba588Smrg# XORG_STRICT_OPTION
320818eba588Smrg# -----------------------
320918eba588Smrg# Minimum version: 1.3.0
3210b9bb67cbSmrg#
321118eba588Smrg# Add configure option to enable strict compilation flags, such as treating
321218eba588Smrg# warnings as fatal errors.
321318eba588Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
321418eba588Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
321518eba588Smrg#
321618eba588Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
321718eba588Smrg# when strict compilation is unconditionally desired.
321818eba588SmrgAC_DEFUN([XORG_STRICT_OPTION], [
321918eba588SmrgAC_REQUIRE([XORG_CWARNFLAGS])
322018eba588SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
322118eba588Smrg
322218eba588SmrgAC_ARG_ENABLE(strict-compilation,
322318eba588Smrg			  AS_HELP_STRING([--enable-strict-compilation],
322418eba588Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
322518eba588Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3226b9bb67cbSmrg
322718eba588SmrgAC_LANG_CASE(
322818eba588Smrg        [C], [
322918eba588Smrg                define([PREFIX], [C])
323018eba588Smrg        ],
323118eba588Smrg        [C++], [
323218eba588Smrg                define([PREFIX], [CXX])
323318eba588Smrg        ]
323418eba588Smrg)
3235b9bb67cbSmrg
323618eba588Smrg[STRICT_]PREFIX[FLAGS]=""
323718eba588SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
323818eba588SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3239b9bb67cbSmrg
324018eba588Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
324118eba588Smrg# activate it with -Werror, so we add it here explicitly.
324218eba588SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3243b9bb67cbSmrg
324418eba588Smrgif test "x$STRICT_COMPILE" = "xyes"; then
324518eba588Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
324618eba588Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
324718eba588Smrgfi
324818eba588SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324918eba588SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
325018eba588SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
325118eba588Smrg]) # XORG_STRICT_OPTION
3252b9bb67cbSmrg
325318eba588Smrg# XORG_DEFAULT_NOCODE_OPTIONS
325418eba588Smrg# ---------------------------
325518eba588Smrg# Minimum version: 1.20.0
3256b5d2086dSmrg#
325718eba588Smrg# Defines default options for X.Org modules which don't compile code,
325818eba588Smrg# such as fonts, bitmaps, cursors, and docs.
325918eba588Smrg#
326018eba588SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
326118eba588SmrgAC_REQUIRE([AC_PROG_INSTALL])
326218eba588SmrgXORG_RELEASE_VERSION
326318eba588SmrgXORG_CHANGELOG
326418eba588SmrgXORG_INSTALL
326518eba588SmrgXORG_MANPAGE_SECTIONS
326618eba588Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326718eba588Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
326818eba588Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3269b9bb67cbSmrg
327018eba588Smrg# XORG_DEFAULT_OPTIONS
3271b5d2086dSmrg# --------------------
327218eba588Smrg# Minimum version: 1.3.0
3273b5d2086dSmrg#
327418eba588Smrg# Defines default options for X.Org modules which compile code.
3275b5d2086dSmrg#
327618eba588SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
327718eba588SmrgAC_REQUIRE([AC_PROG_INSTALL])
327818eba588SmrgXORG_COMPILER_FLAGS
327918eba588SmrgXORG_CWARNFLAGS
328018eba588SmrgXORG_STRICT_OPTION
328118eba588SmrgXORG_DEFAULT_NOCODE_OPTIONS
328218eba588Smrg]) # XORG_DEFAULT_OPTIONS
328318eba588Smrg
328418eba588Smrg# XORG_INSTALL()
328518eba588Smrg# ----------------
328618eba588Smrg# Minimum version: 1.4.0
328718eba588Smrg#
328818eba588Smrg# Defines the variable INSTALL_CMD as the command to copy
328918eba588Smrg# INSTALL from $prefix/share/util-macros.
329018eba588Smrg#
329118eba588SmrgAC_DEFUN([XORG_INSTALL], [
329218eba588SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
329318eba588Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
329418eba588SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
329518eba588Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
329618eba588Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
329718eba588Smrgtouch \$(top_srcdir)/INSTALL; \
329818eba588Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
329918eba588SmrgAC_SUBST([INSTALL_CMD])
330018eba588Smrg]) # XORG_INSTALL
330118eba588Smrgdnl Copyright 2005 Red Hat, Inc
330218eba588Smrgdnl
330318eba588Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
330418eba588Smrgdnl documentation for any purpose is hereby granted without fee, provided that
330518eba588Smrgdnl the above copyright notice appear in all copies and that both that
330618eba588Smrgdnl copyright notice and this permission notice appear in supporting
330718eba588Smrgdnl documentation.
330818eba588Smrgdnl
330918eba588Smrgdnl The above copyright notice and this permission notice shall be included
331018eba588Smrgdnl in all copies or substantial portions of the Software.
331118eba588Smrgdnl
331218eba588Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
331318eba588Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
331418eba588Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
331518eba588Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
331618eba588Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
331718eba588Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
331818eba588Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
331918eba588Smrgdnl
332018eba588Smrgdnl Except as contained in this notice, the name of the copyright holders shall
332118eba588Smrgdnl not be used in advertising or otherwise to promote the sale, use or
332218eba588Smrgdnl other dealings in this Software without prior written authorization
332318eba588Smrgdnl from the copyright holders.
332418eba588Smrgdnl
3325b9bb67cbSmrg
332618eba588Smrg# XORG_RELEASE_VERSION
332718eba588Smrg# --------------------
332818eba588Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3329b9bb67cbSmrg
333018eba588SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
333118eba588Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
333218eba588Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
333318eba588Smrg		[Major version of this package])
333418eba588Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
333518eba588Smrg	if test "x$PVM" = "x"; then
333618eba588Smrg		PVM="0"
333718eba588Smrg	fi
333818eba588Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
333918eba588Smrg		[$PVM],
334018eba588Smrg		[Minor version of this package])
334118eba588Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
334218eba588Smrg	if test "x$PVP" = "x"; then
334318eba588Smrg		PVP="0"
334418eba588Smrg	fi
334518eba588Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
334618eba588Smrg		[$PVP],
334718eba588Smrg		[Patch version of this package])
334818eba588Smrg])
3349b9bb67cbSmrg
335018eba588Smrg# XORG_CHANGELOG()
335118eba588Smrg# ----------------
335218eba588Smrg# Minimum version: 1.2.0
335318eba588Smrg#
335418eba588Smrg# Defines the variable CHANGELOG_CMD as the command to generate
335518eba588Smrg# ChangeLog from git.
335618eba588Smrg#
335718eba588Smrg#
335818eba588SmrgAC_DEFUN([XORG_CHANGELOG], [
335918eba588SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
336018eba588Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
336118eba588Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
336218eba588Smrgtouch \$(top_srcdir)/ChangeLog; \
336318eba588Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
336418eba588SmrgAC_SUBST([CHANGELOG_CMD])
336518eba588Smrg]) # XORG_CHANGELOG
3366b9bb67cbSmrg
3367