138b41dabSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
238b41dabSmrg
338b41dabSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
438b41dabSmrg
538b41dabSmrg# This file is free software; the Free Software Foundation
638b41dabSmrg# gives unlimited permission to copy and/or distribute it,
738b41dabSmrg# with or without modifications, as long as this notice is preserved.
838b41dabSmrg
938b41dabSmrg# This program is distributed in the hope that it will be useful,
1038b41dabSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1138b41dabSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1238b41dabSmrg# PARTICULAR PURPOSE.
1338b41dabSmrg
1438b41dabSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1538b41dabSmrgm4_ifndef([AC_AUTOCONF_VERSION],
1638b41dabSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1738b41dabSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
1838b41dabSmrg[m4_warning([this file was generated for autoconf 2.71.
1938b41dabSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2038b41dabSmrgIf you have problems, you may need to regenerate the build system entirely.
2138b41dabSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2238b41dabSmrg
2338b41dabSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2438b41dabSmrg#
2538b41dabSmrg# This file is free software; the Free Software Foundation
2638b41dabSmrg# gives unlimited permission to copy and/or distribute it,
2738b41dabSmrg# with or without modifications, as long as this notice is preserved.
2838b41dabSmrg
2938b41dabSmrg# AM_AUTOMAKE_VERSION(VERSION)
3038b41dabSmrg# ----------------------------
3138b41dabSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3238b41dabSmrg# generated from the m4 files accompanying Automake X.Y.
3338b41dabSmrg# (This private macro should not be called outside this file.)
3438b41dabSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3538b41dabSmrg[am__api_version='1.16'
3638b41dabSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3738b41dabSmrgdnl require some minimum version.  Point them to the right macro.
3838b41dabSmrgm4_if([$1], [1.16.5], [],
3938b41dabSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4038b41dabSmrg])
4138b41dabSmrg
4238b41dabSmrg# _AM_AUTOCONF_VERSION(VERSION)
4338b41dabSmrg# -----------------------------
4438b41dabSmrg# aclocal traces this macro to find the Autoconf version.
4538b41dabSmrg# This is a private macro too.  Using m4_define simplifies
4638b41dabSmrg# the logic in aclocal, which can simply ignore this definition.
4738b41dabSmrgm4_define([_AM_AUTOCONF_VERSION], [])
4838b41dabSmrg
4938b41dabSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5038b41dabSmrg# -------------------------------
5138b41dabSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5238b41dabSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5338b41dabSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5438b41dabSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5538b41dabSmrgm4_ifndef([AC_AUTOCONF_VERSION],
5638b41dabSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5738b41dabSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5838b41dabSmrg
5938b41dabSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6038b41dabSmrg
6138b41dabSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6238b41dabSmrg#
6338b41dabSmrg# This file is free software; the Free Software Foundation
6438b41dabSmrg# gives unlimited permission to copy and/or distribute it,
6538b41dabSmrg# with or without modifications, as long as this notice is preserved.
6638b41dabSmrg
6738b41dabSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6838b41dabSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6938b41dabSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7038b41dabSmrg#
7138b41dabSmrg# Of course, Automake must honor this variable whenever it calls a
7238b41dabSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7338b41dabSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7438b41dabSmrg# depending on how configure is run.  This is pretty annoying, since
7538b41dabSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7638b41dabSmrg# source directory, any form will work fine, but in subdirectories a
7738b41dabSmrg# relative path needs to be adjusted first.
7838b41dabSmrg#
7938b41dabSmrg# $ac_aux_dir/missing
8038b41dabSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8138b41dabSmrg# $top_srcdir/$ac_aux_dir/missing
8238b41dabSmrg#    fails if $ac_aux_dir is absolute,
8338b41dabSmrg#    fails when called from a subdirectory in a VPATH build with
8438b41dabSmrg#          a relative $ac_aux_dir
8538b41dabSmrg#
8638b41dabSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8738b41dabSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
8838b41dabSmrg# harmless because $srcdir is '.', but things will broke when you
8938b41dabSmrg# start a VPATH build or use an absolute $srcdir.
9038b41dabSmrg#
9138b41dabSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9238b41dabSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9338b41dabSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9438b41dabSmrg# and then we would define $MISSING as
9538b41dabSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9638b41dabSmrg# This will work as long as MISSING is not called from configure, because
9738b41dabSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9838b41dabSmrg# However there are other variables, like CC, which are often used in
9938b41dabSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10038b41dabSmrg#
10138b41dabSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10238b41dabSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10338b41dabSmrg# configured tree to be moved without reconfiguration.
10438b41dabSmrg
10538b41dabSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10638b41dabSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10738b41dabSmrg# Expand $ac_aux_dir to an absolute path.
10838b41dabSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10938b41dabSmrg])
11038b41dabSmrg
11138b41dabSmrg# Do all the work for Automake.                             -*- Autoconf -*-
11238b41dabSmrg
11338b41dabSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
11438b41dabSmrg#
11538b41dabSmrg# This file is free software; the Free Software Foundation
11638b41dabSmrg# gives unlimited permission to copy and/or distribute it,
11738b41dabSmrg# with or without modifications, as long as this notice is preserved.
11838b41dabSmrg
11938b41dabSmrg# This macro actually does too much.  Some checks are only needed if
12038b41dabSmrg# your package does certain things.  But this isn't really a big deal.
12138b41dabSmrg
12238b41dabSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
12338b41dabSmrgm4_define([AC_PROG_CC],
12438b41dabSmrgm4_defn([AC_PROG_CC])
12538b41dabSmrg[_AM_PROG_CC_C_O
12638b41dabSmrg])
12738b41dabSmrg
12838b41dabSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
12938b41dabSmrg# AM_INIT_AUTOMAKE([OPTIONS])
13038b41dabSmrg# -----------------------------------------------
13138b41dabSmrg# The call with PACKAGE and VERSION arguments is the old style
13238b41dabSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
13338b41dabSmrg# and VERSION should now be passed to AC_INIT and removed from
13438b41dabSmrg# the call to AM_INIT_AUTOMAKE.
13538b41dabSmrg# We support both call styles for the transition.  After
13638b41dabSmrg# the next Automake release, Autoconf can make the AC_INIT
13738b41dabSmrg# arguments mandatory, and then we can depend on a new Autoconf
13838b41dabSmrg# release and drop the old call support.
13938b41dabSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
14038b41dabSmrg[AC_PREREQ([2.65])dnl
14138b41dabSmrgm4_ifdef([_$0_ALREADY_INIT],
14238b41dabSmrg  [m4_fatal([$0 expanded multiple times
14338b41dabSmrg]m4_defn([_$0_ALREADY_INIT]))],
14438b41dabSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
14538b41dabSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
14638b41dabSmrgdnl the ones we care about.
14738b41dabSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
14838b41dabSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
14938b41dabSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
15038b41dabSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
15138b41dabSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
15238b41dabSmrg  # is not polluted with repeated "-I."
15338b41dabSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
15438b41dabSmrg  # test to see if srcdir already configured
15538b41dabSmrg  if test -f $srcdir/config.status; then
15638b41dabSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
15738b41dabSmrg  fi
15838b41dabSmrgfi
15938b41dabSmrg
16038b41dabSmrg# test whether we have cygpath
16138b41dabSmrgif test -z "$CYGPATH_W"; then
16238b41dabSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
16338b41dabSmrg    CYGPATH_W='cygpath -w'
16438b41dabSmrg  else
16538b41dabSmrg    CYGPATH_W=echo
16638b41dabSmrg  fi
16738b41dabSmrgfi
16838b41dabSmrgAC_SUBST([CYGPATH_W])
16938b41dabSmrg
17038b41dabSmrg# Define the identity of the package.
17138b41dabSmrgdnl Distinguish between old-style and new-style calls.
17238b41dabSmrgm4_ifval([$2],
17338b41dabSmrg[AC_DIAGNOSE([obsolete],
17438b41dabSmrg             [$0: two- and three-arguments forms are deprecated.])
17538b41dabSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
17638b41dabSmrg AC_SUBST([PACKAGE], [$1])dnl
17738b41dabSmrg AC_SUBST([VERSION], [$2])],
17838b41dabSmrg[_AM_SET_OPTIONS([$1])dnl
17938b41dabSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
18038b41dabSmrgm4_if(
18138b41dabSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
18238b41dabSmrg  [ok:ok],,
18338b41dabSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
18438b41dabSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
18538b41dabSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
18638b41dabSmrg
18738b41dabSmrg_AM_IF_OPTION([no-define],,
18838b41dabSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
18938b41dabSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
19038b41dabSmrg
19138b41dabSmrg# Some tools Automake needs.
19238b41dabSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
19338b41dabSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
19438b41dabSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
19538b41dabSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
19638b41dabSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
19738b41dabSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
19838b41dabSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
19938b41dabSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
20038b41dabSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
20138b41dabSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
20238b41dabSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
20338b41dabSmrg# dies out for good.  For more background, see:
20438b41dabSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
20538b41dabSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
20638b41dabSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
20738b41dabSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
20838b41dabSmrg# system "awk" is bad on some platforms.
20938b41dabSmrgAC_REQUIRE([AC_PROG_AWK])dnl
21038b41dabSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
21138b41dabSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
21238b41dabSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
21338b41dabSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
21438b41dabSmrg			     [_AM_PROG_TAR([v7])])])
21538b41dabSmrg_AM_IF_OPTION([no-dependencies],,
21638b41dabSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
21738b41dabSmrg		  [_AM_DEPENDENCIES([CC])],
21838b41dabSmrg		  [m4_define([AC_PROG_CC],
21938b41dabSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
22038b41dabSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
22138b41dabSmrg		  [_AM_DEPENDENCIES([CXX])],
22238b41dabSmrg		  [m4_define([AC_PROG_CXX],
22338b41dabSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
22438b41dabSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
22538b41dabSmrg		  [_AM_DEPENDENCIES([OBJC])],
22638b41dabSmrg		  [m4_define([AC_PROG_OBJC],
22738b41dabSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
22838b41dabSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
22938b41dabSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
23038b41dabSmrg		  [m4_define([AC_PROG_OBJCXX],
23138b41dabSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
23238b41dabSmrg])
23338b41dabSmrg# Variables for tags utilities; see am/tags.am
23438b41dabSmrgif test -z "$CTAGS"; then
23538b41dabSmrg  CTAGS=ctags
23638b41dabSmrgfi
23738b41dabSmrgAC_SUBST([CTAGS])
23838b41dabSmrgif test -z "$ETAGS"; then
23938b41dabSmrg  ETAGS=etags
24038b41dabSmrgfi
24138b41dabSmrgAC_SUBST([ETAGS])
24238b41dabSmrgif test -z "$CSCOPE"; then
24338b41dabSmrg  CSCOPE=cscope
24438b41dabSmrgfi
24538b41dabSmrgAC_SUBST([CSCOPE])
24638b41dabSmrg
24738b41dabSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
24838b41dabSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
24938b41dabSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
25038b41dabSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
25138b41dabSmrgAC_CONFIG_COMMANDS_PRE(dnl
25238b41dabSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
25338b41dabSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
25438b41dabSmrg
25538b41dabSmrg# POSIX will say in a future version that running "rm -f" with no argument
25638b41dabSmrg# is OK; and we want to be able to make that assumption in our Makefile
25738b41dabSmrg# recipes.  So use an aggressive probe to check that the usage we want is
25838b41dabSmrg# actually supported "in the wild" to an acceptable degree.
25938b41dabSmrg# See automake bug#10828.
26038b41dabSmrg# To make any issue more visible, cause the running configure to be aborted
26138b41dabSmrg# by default if the 'rm' program in use doesn't match our expectations; the
26238b41dabSmrg# user can still override this though.
26338b41dabSmrgif rm -f && rm -fr && rm -rf; then : OK; else
26438b41dabSmrg  cat >&2 <<'END'
26538b41dabSmrgOops!
26638b41dabSmrg
26738b41dabSmrgYour 'rm' program seems unable to run without file operands specified
26838b41dabSmrgon the command line, even when the '-f' option is present.  This is contrary
26938b41dabSmrgto the behaviour of most rm programs out there, and not conforming with
27038b41dabSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
27138b41dabSmrg
27238b41dabSmrgPlease tell bug-automake@gnu.org about your system, including the value
27338b41dabSmrgof your $PATH and any error possibly output before this message.  This
27438b41dabSmrgcan help us improve future automake versions.
27538b41dabSmrg
27638b41dabSmrgEND
27738b41dabSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
27838b41dabSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
27938b41dabSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
28038b41dabSmrg    echo >&2
28138b41dabSmrg  else
28238b41dabSmrg    cat >&2 <<'END'
28338b41dabSmrgAborting the configuration process, to ensure you take notice of the issue.
28438b41dabSmrg
28538b41dabSmrgYou can download and install GNU coreutils to get an 'rm' implementation
28638b41dabSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
28738b41dabSmrg
28838b41dabSmrgIf you want to complete the configuration process using your problematic
28938b41dabSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
29038b41dabSmrgto "yes", and re-run configure.
29138b41dabSmrg
29238b41dabSmrgEND
29338b41dabSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
29438b41dabSmrg  fi
29538b41dabSmrgfi
29638b41dabSmrgdnl The trailing newline in this macro's definition is deliberate, for
29738b41dabSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
29838b41dabSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
29938b41dabSmrg])
30038b41dabSmrg
30138b41dabSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
30238b41dabSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
30338b41dabSmrgdnl mangled by Autoconf and run in a shell conditional statement.
30438b41dabSmrgm4_define([_AC_COMPILER_EXEEXT],
30538b41dabSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
30638b41dabSmrg
30738b41dabSmrg# When config.status generates a header, we must update the stamp-h file.
30838b41dabSmrg# This file resides in the same directory as the config header
30938b41dabSmrg# that is generated.  The stamp files are numbered to have different names.
31038b41dabSmrg
31138b41dabSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
31238b41dabSmrg# loop where config.status creates the headers, so we can generate
31338b41dabSmrg# our stamp files there.
31438b41dabSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
31538b41dabSmrg[# Compute $1's index in $config_headers.
31638b41dabSmrg_am_arg=$1
31738b41dabSmrg_am_stamp_count=1
31838b41dabSmrgfor _am_header in $config_headers :; do
31938b41dabSmrg  case $_am_header in
32038b41dabSmrg    $_am_arg | $_am_arg:* )
32138b41dabSmrg      break ;;
32238b41dabSmrg    * )
32338b41dabSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
32438b41dabSmrg  esac
32538b41dabSmrgdone
32638b41dabSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
32738b41dabSmrg
32838b41dabSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
32938b41dabSmrg#
33038b41dabSmrg# This file is free software; the Free Software Foundation
33138b41dabSmrg# gives unlimited permission to copy and/or distribute it,
33238b41dabSmrg# with or without modifications, as long as this notice is preserved.
33338b41dabSmrg
33438b41dabSmrg# AM_PROG_INSTALL_SH
33538b41dabSmrg# ------------------
33638b41dabSmrg# Define $install_sh.
33738b41dabSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
33838b41dabSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
33938b41dabSmrgif test x"${install_sh+set}" != xset; then
34038b41dabSmrg  case $am_aux_dir in
34138b41dabSmrg  *\ * | *\	*)
34238b41dabSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
34338b41dabSmrg  *)
34438b41dabSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
34538b41dabSmrg  esac
34638b41dabSmrgfi
34738b41dabSmrgAC_SUBST([install_sh])])
34838b41dabSmrg
34938b41dabSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
35038b41dabSmrg#
35138b41dabSmrg# This file is free software; the Free Software Foundation
35238b41dabSmrg# gives unlimited permission to copy and/or distribute it,
35338b41dabSmrg# with or without modifications, as long as this notice is preserved.
35438b41dabSmrg
35538b41dabSmrg# Check whether the underlying file-system supports filenames
35638b41dabSmrg# with a leading dot.  For instance MS-DOS doesn't.
35738b41dabSmrgAC_DEFUN([AM_SET_LEADING_DOT],
35838b41dabSmrg[rm -rf .tst 2>/dev/null
35938b41dabSmrgmkdir .tst 2>/dev/null
36038b41dabSmrgif test -d .tst; then
36138b41dabSmrg  am__leading_dot=.
36238b41dabSmrgelse
36338b41dabSmrg  am__leading_dot=_
36438b41dabSmrgfi
36538b41dabSmrgrmdir .tst 2>/dev/null
36638b41dabSmrgAC_SUBST([am__leading_dot])])
36738b41dabSmrg
36838b41dabSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
36938b41dabSmrg
37038b41dabSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
37138b41dabSmrg#
37238b41dabSmrg# This file is free software; the Free Software Foundation
37338b41dabSmrg# gives unlimited permission to copy and/or distribute it,
37438b41dabSmrg# with or without modifications, as long as this notice is preserved.
37538b41dabSmrg
37638b41dabSmrg# AM_MISSING_PROG(NAME, PROGRAM)
37738b41dabSmrg# ------------------------------
37838b41dabSmrgAC_DEFUN([AM_MISSING_PROG],
37938b41dabSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
38038b41dabSmrg$1=${$1-"${am_missing_run}$2"}
38138b41dabSmrgAC_SUBST($1)])
38238b41dabSmrg
38338b41dabSmrg# AM_MISSING_HAS_RUN
38438b41dabSmrg# ------------------
38538b41dabSmrg# Define MISSING if not defined so far and test if it is modern enough.
38638b41dabSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
38738b41dabSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
38838b41dabSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
38938b41dabSmrgAC_REQUIRE_AUX_FILE([missing])dnl
39038b41dabSmrgif test x"${MISSING+set}" != xset; then
39138b41dabSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
39238b41dabSmrgfi
39338b41dabSmrg# Use eval to expand $SHELL
39438b41dabSmrgif eval "$MISSING --is-lightweight"; then
39538b41dabSmrg  am_missing_run="$MISSING "
39638b41dabSmrgelse
39738b41dabSmrg  am_missing_run=
39838b41dabSmrg  AC_MSG_WARN(['missing' script is too old or missing])
39938b41dabSmrgfi
40038b41dabSmrg])
40138b41dabSmrg
40238b41dabSmrg# Helper functions for option handling.                     -*- Autoconf -*-
40338b41dabSmrg
40438b41dabSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
40538b41dabSmrg#
40638b41dabSmrg# This file is free software; the Free Software Foundation
40738b41dabSmrg# gives unlimited permission to copy and/or distribute it,
40838b41dabSmrg# with or without modifications, as long as this notice is preserved.
40938b41dabSmrg
41038b41dabSmrg# _AM_MANGLE_OPTION(NAME)
41138b41dabSmrg# -----------------------
41238b41dabSmrgAC_DEFUN([_AM_MANGLE_OPTION],
41338b41dabSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
41438b41dabSmrg
41538b41dabSmrg# _AM_SET_OPTION(NAME)
41638b41dabSmrg# --------------------
41738b41dabSmrg# Set option NAME.  Presently that only means defining a flag for this option.
41838b41dabSmrgAC_DEFUN([_AM_SET_OPTION],
41938b41dabSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
42038b41dabSmrg
42138b41dabSmrg# _AM_SET_OPTIONS(OPTIONS)
42238b41dabSmrg# ------------------------
42338b41dabSmrg# OPTIONS is a space-separated list of Automake options.
42438b41dabSmrgAC_DEFUN([_AM_SET_OPTIONS],
42538b41dabSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
42638b41dabSmrg
42738b41dabSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
42838b41dabSmrg# -------------------------------------------
42938b41dabSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
43038b41dabSmrgAC_DEFUN([_AM_IF_OPTION],
43138b41dabSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
43238b41dabSmrg
43338b41dabSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
43438b41dabSmrg
43538b41dabSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
43638b41dabSmrg#
43738b41dabSmrg# This file is free software; the Free Software Foundation
43838b41dabSmrg# gives unlimited permission to copy and/or distribute it,
43938b41dabSmrg# with or without modifications, as long as this notice is preserved.
44038b41dabSmrg
44138b41dabSmrg# AM_SANITY_CHECK
44238b41dabSmrg# ---------------
44338b41dabSmrgAC_DEFUN([AM_SANITY_CHECK],
44438b41dabSmrg[AC_MSG_CHECKING([whether build environment is sane])
44538b41dabSmrg# Reject unsafe characters in $srcdir or the absolute working directory
44638b41dabSmrg# name.  Accept space and tab only in the latter.
44738b41dabSmrgam_lf='
44838b41dabSmrg'
44938b41dabSmrgcase `pwd` in
45038b41dabSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
45138b41dabSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
45238b41dabSmrgesac
45338b41dabSmrgcase $srcdir in
45438b41dabSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
45538b41dabSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
45638b41dabSmrgesac
45738b41dabSmrg
45838b41dabSmrg# Do 'set' in a subshell so we don't clobber the current shell's
45938b41dabSmrg# arguments.  Must try -L first in case configure is actually a
46038b41dabSmrg# symlink; some systems play weird games with the mod time of symlinks
46138b41dabSmrg# (eg FreeBSD returns the mod time of the symlink's containing
46238b41dabSmrg# directory).
46338b41dabSmrgif (
46438b41dabSmrg   am_has_slept=no
46538b41dabSmrg   for am_try in 1 2; do
46638b41dabSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
46738b41dabSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
46838b41dabSmrg     if test "$[*]" = "X"; then
46938b41dabSmrg	# -L didn't work.
47038b41dabSmrg	set X `ls -t "$srcdir/configure" conftest.file`
47138b41dabSmrg     fi
47238b41dabSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
47338b41dabSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
47438b41dabSmrg
47538b41dabSmrg	# If neither matched, then we have a broken ls.  This can happen
47638b41dabSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
47738b41dabSmrg	# broken ls alias from the environment.  This has actually
47838b41dabSmrg	# happened.  Such a system could not be considered "sane".
47938b41dabSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
48038b41dabSmrg  alias in your environment])
48138b41dabSmrg     fi
48238b41dabSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
48338b41dabSmrg       break
48438b41dabSmrg     fi
48538b41dabSmrg     # Just in case.
48638b41dabSmrg     sleep 1
48738b41dabSmrg     am_has_slept=yes
48838b41dabSmrg   done
48938b41dabSmrg   test "$[2]" = conftest.file
49038b41dabSmrg   )
49138b41dabSmrgthen
49238b41dabSmrg   # Ok.
49338b41dabSmrg   :
49438b41dabSmrgelse
49538b41dabSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
49638b41dabSmrgCheck your system clock])
49738b41dabSmrgfi
49838b41dabSmrgAC_MSG_RESULT([yes])
49938b41dabSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
50038b41dabSmrg# generated files are strictly newer.
50138b41dabSmrgam_sleep_pid=
50238b41dabSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
50338b41dabSmrg  ( sleep 1 ) &
50438b41dabSmrg  am_sleep_pid=$!
50538b41dabSmrgfi
50638b41dabSmrgAC_CONFIG_COMMANDS_PRE(
50738b41dabSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
50838b41dabSmrg   if test -n "$am_sleep_pid"; then
50938b41dabSmrg     # Hide warnings about reused PIDs.
51038b41dabSmrg     wait $am_sleep_pid 2>/dev/null
51138b41dabSmrg   fi
51238b41dabSmrg   AC_MSG_RESULT([done])])
51338b41dabSmrgrm -f conftest.file
51438b41dabSmrg])
51538b41dabSmrg
51638b41dabSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
51738b41dabSmrg#
51838b41dabSmrg# This file is free software; the Free Software Foundation
51938b41dabSmrg# gives unlimited permission to copy and/or distribute it,
52038b41dabSmrg# with or without modifications, as long as this notice is preserved.
52138b41dabSmrg
52238b41dabSmrg# AM_SILENT_RULES([DEFAULT])
52338b41dabSmrg# --------------------------
52438b41dabSmrg# Enable less verbose build rules; with the default set to DEFAULT
52538b41dabSmrg# ("yes" being less verbose, "no" or empty being verbose).
52638b41dabSmrgAC_DEFUN([AM_SILENT_RULES],
52738b41dabSmrg[AC_ARG_ENABLE([silent-rules], [dnl
52838b41dabSmrgAS_HELP_STRING(
52938b41dabSmrg  [--enable-silent-rules],
53038b41dabSmrg  [less verbose build output (undo: "make V=1")])
53138b41dabSmrgAS_HELP_STRING(
53238b41dabSmrg  [--disable-silent-rules],
53338b41dabSmrg  [verbose build output (undo: "make V=0")])dnl
53438b41dabSmrg])
53538b41dabSmrgcase $enable_silent_rules in @%:@ (((
53638b41dabSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
53738b41dabSmrg   no) AM_DEFAULT_VERBOSITY=1;;
53838b41dabSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
53938b41dabSmrgesac
54038b41dabSmrgdnl
54138b41dabSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
54238b41dabSmrgdnl do not support nested variable expansions.
54338b41dabSmrgdnl See automake bug#9928 and bug#10237.
54438b41dabSmrgam_make=${MAKE-make}
54538b41dabSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
54638b41dabSmrg   [am_cv_make_support_nested_variables],
54738b41dabSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
54838b41dabSmrgBAR0=false
54938b41dabSmrgBAR1=true
55038b41dabSmrgV=1
55138b41dabSmrgam__doit:
55238b41dabSmrg	@$(TRUE)
55338b41dabSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
55438b41dabSmrg  am_cv_make_support_nested_variables=yes
55538b41dabSmrgelse
55638b41dabSmrg  am_cv_make_support_nested_variables=no
55738b41dabSmrgfi])
55838b41dabSmrgif test $am_cv_make_support_nested_variables = yes; then
55938b41dabSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
56038b41dabSmrg  AM_V='$(V)'
56138b41dabSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
56238b41dabSmrgelse
56338b41dabSmrg  AM_V=$AM_DEFAULT_VERBOSITY
56438b41dabSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
56538b41dabSmrgfi
56638b41dabSmrgAC_SUBST([AM_V])dnl
56738b41dabSmrgAM_SUBST_NOTMAKE([AM_V])dnl
56838b41dabSmrgAC_SUBST([AM_DEFAULT_V])dnl
56938b41dabSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
57038b41dabSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
57138b41dabSmrgAM_BACKSLASH='\'
57238b41dabSmrgAC_SUBST([AM_BACKSLASH])dnl
57338b41dabSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
57438b41dabSmrg])
57538b41dabSmrg
57638b41dabSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
57738b41dabSmrg#
57838b41dabSmrg# This file is free software; the Free Software Foundation
57938b41dabSmrg# gives unlimited permission to copy and/or distribute it,
58038b41dabSmrg# with or without modifications, as long as this notice is preserved.
58138b41dabSmrg
58238b41dabSmrg# AM_PROG_INSTALL_STRIP
58338b41dabSmrg# ---------------------
58438b41dabSmrg# One issue with vendor 'install' (even GNU) is that you can't
58538b41dabSmrg# specify the program used to strip binaries.  This is especially
58638b41dabSmrg# annoying in cross-compiling environments, where the build's strip
58738b41dabSmrg# is unlikely to handle the host's binaries.
58838b41dabSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
58938b41dabSmrg# always use install-sh in "make install-strip", and initialize
59038b41dabSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
59138b41dabSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
59238b41dabSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
59338b41dabSmrg# Installed binaries are usually stripped using 'strip' when the user
59438b41dabSmrg# run "make install-strip".  However 'strip' might not be the right
59538b41dabSmrg# tool to use in cross-compilation environments, therefore Automake
59638b41dabSmrg# will honor the 'STRIP' environment variable to overrule this program.
59738b41dabSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
59838b41dabSmrgif test "$cross_compiling" != no; then
59938b41dabSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
60038b41dabSmrgfi
60138b41dabSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
60238b41dabSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
60338b41dabSmrg
60438b41dabSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
60538b41dabSmrg#
60638b41dabSmrg# This file is free software; the Free Software Foundation
60738b41dabSmrg# gives unlimited permission to copy and/or distribute it,
60838b41dabSmrg# with or without modifications, as long as this notice is preserved.
60938b41dabSmrg
61038b41dabSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
61138b41dabSmrg# ---------------------------
61238b41dabSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
61338b41dabSmrg# This macro is traced by Automake.
61438b41dabSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
61538b41dabSmrg
61638b41dabSmrg# AM_SUBST_NOTMAKE(VARIABLE)
61738b41dabSmrg# --------------------------
61838b41dabSmrg# Public sister of _AM_SUBST_NOTMAKE.
61938b41dabSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
62038b41dabSmrg
62138b41dabSmrg# Check how to create a tarball.                            -*- Autoconf -*-
62238b41dabSmrg
62338b41dabSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
62438b41dabSmrg#
62538b41dabSmrg# This file is free software; the Free Software Foundation
62638b41dabSmrg# gives unlimited permission to copy and/or distribute it,
62738b41dabSmrg# with or without modifications, as long as this notice is preserved.
62838b41dabSmrg
62938b41dabSmrg# _AM_PROG_TAR(FORMAT)
63038b41dabSmrg# --------------------
63138b41dabSmrg# Check how to create a tarball in format FORMAT.
63238b41dabSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
63338b41dabSmrg#
63438b41dabSmrg# Substitute a variable $(am__tar) that is a command
63538b41dabSmrg# writing to stdout a FORMAT-tarball containing the directory
63638b41dabSmrg# $tardir.
63738b41dabSmrg#     tardir=directory && $(am__tar) > result.tar
63838b41dabSmrg#
63938b41dabSmrg# Substitute a variable $(am__untar) that extract such
64038b41dabSmrg# a tarball read from stdin.
64138b41dabSmrg#     $(am__untar) < result.tar
64238b41dabSmrg#
64338b41dabSmrgAC_DEFUN([_AM_PROG_TAR],
64438b41dabSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
64538b41dabSmrg# in the wild :-(  We should find a proper way to deprecate it ...
64638b41dabSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
64738b41dabSmrg
64838b41dabSmrg# We'll loop over all known methods to create a tar archive until one works.
64938b41dabSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
65038b41dabSmrg
65138b41dabSmrgm4_if([$1], [v7],
65238b41dabSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
65338b41dabSmrg
65438b41dabSmrg  [m4_case([$1],
65538b41dabSmrg    [ustar],
65638b41dabSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
65738b41dabSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
65838b41dabSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
65938b41dabSmrg      # and bug#13588).
66038b41dabSmrg      am_max_uid=2097151 # 2^21 - 1
66138b41dabSmrg      am_max_gid=$am_max_uid
66238b41dabSmrg      # The $UID and $GID variables are not portable, so we need to resort
66338b41dabSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
66438b41dabSmrg      # below are definitely unexpected, so allow the users to see them
66538b41dabSmrg      # (that is, avoid stderr redirection).
66638b41dabSmrg      am_uid=`id -u || echo unknown`
66738b41dabSmrg      am_gid=`id -g || echo unknown`
66838b41dabSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
66938b41dabSmrg      if test $am_uid -le $am_max_uid; then
67038b41dabSmrg         AC_MSG_RESULT([yes])
67138b41dabSmrg      else
67238b41dabSmrg         AC_MSG_RESULT([no])
67338b41dabSmrg         _am_tools=none
67438b41dabSmrg      fi
67538b41dabSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
67638b41dabSmrg      if test $am_gid -le $am_max_gid; then
67738b41dabSmrg         AC_MSG_RESULT([yes])
67838b41dabSmrg      else
67938b41dabSmrg        AC_MSG_RESULT([no])
68038b41dabSmrg        _am_tools=none
68138b41dabSmrg      fi],
68238b41dabSmrg
68338b41dabSmrg  [pax],
68438b41dabSmrg    [],
68538b41dabSmrg
68638b41dabSmrg  [m4_fatal([Unknown tar format])])
68738b41dabSmrg
68838b41dabSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
68938b41dabSmrg
69038b41dabSmrg  # Go ahead even if we have the value already cached.  We do so because we
69138b41dabSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
69238b41dabSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
69338b41dabSmrg
69438b41dabSmrg  for _am_tool in $_am_tools; do
69538b41dabSmrg    case $_am_tool in
69638b41dabSmrg    gnutar)
69738b41dabSmrg      for _am_tar in tar gnutar gtar; do
69838b41dabSmrg        AM_RUN_LOG([$_am_tar --version]) && break
69938b41dabSmrg      done
70038b41dabSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
70138b41dabSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
70238b41dabSmrg      am__untar="$_am_tar -xf -"
70338b41dabSmrg      ;;
70438b41dabSmrg    plaintar)
70538b41dabSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
70638b41dabSmrg      # ustar tarball either.
70738b41dabSmrg      (tar --version) >/dev/null 2>&1 && continue
70838b41dabSmrg      am__tar='tar chf - "$$tardir"'
70938b41dabSmrg      am__tar_='tar chf - "$tardir"'
71038b41dabSmrg      am__untar='tar xf -'
71138b41dabSmrg      ;;
71238b41dabSmrg    pax)
71338b41dabSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
71438b41dabSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
71538b41dabSmrg      am__untar='pax -r'
71638b41dabSmrg      ;;
71738b41dabSmrg    cpio)
71838b41dabSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
71938b41dabSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
72038b41dabSmrg      am__untar='cpio -i -H $1 -d'
72138b41dabSmrg      ;;
72238b41dabSmrg    none)
72338b41dabSmrg      am__tar=false
72438b41dabSmrg      am__tar_=false
72538b41dabSmrg      am__untar=false
72638b41dabSmrg      ;;
72738b41dabSmrg    esac
72838b41dabSmrg
72938b41dabSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
73038b41dabSmrg    # and am__untar set.
73138b41dabSmrg    test -n "${am_cv_prog_tar_$1}" && break
73238b41dabSmrg
73338b41dabSmrg    # tar/untar a dummy directory, and stop if the command works.
73438b41dabSmrg    rm -rf conftest.dir
73538b41dabSmrg    mkdir conftest.dir
73638b41dabSmrg    echo GrepMe > conftest.dir/file
73738b41dabSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
73838b41dabSmrg    rm -rf conftest.dir
73938b41dabSmrg    if test -s conftest.tar; then
74038b41dabSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
74138b41dabSmrg      AM_RUN_LOG([cat conftest.dir/file])
74238b41dabSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
74338b41dabSmrg    fi
74438b41dabSmrg  done
74538b41dabSmrg  rm -rf conftest.dir
74638b41dabSmrg
74738b41dabSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
74838b41dabSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
74938b41dabSmrg
75038b41dabSmrgAC_SUBST([am__tar])
75138b41dabSmrgAC_SUBST([am__untar])
75238b41dabSmrg]) # _AM_PROG_TAR
75338b41dabSmrg
75438b41dabSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
75538b41dabSmrgdnl serial 11 (pkg-config-0.29)
75638b41dabSmrgdnl
75738b41dabSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
75838b41dabSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
75938b41dabSmrgdnl
76038b41dabSmrgdnl This program is free software; you can redistribute it and/or modify
76138b41dabSmrgdnl it under the terms of the GNU General Public License as published by
76238b41dabSmrgdnl the Free Software Foundation; either version 2 of the License, or
76338b41dabSmrgdnl (at your option) any later version.
76438b41dabSmrgdnl
76538b41dabSmrgdnl This program is distributed in the hope that it will be useful, but
76638b41dabSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
76738b41dabSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
76838b41dabSmrgdnl General Public License for more details.
76938b41dabSmrgdnl
77038b41dabSmrgdnl You should have received a copy of the GNU General Public License
77138b41dabSmrgdnl along with this program; if not, write to the Free Software
77238b41dabSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
77338b41dabSmrgdnl 02111-1307, USA.
77438b41dabSmrgdnl
77538b41dabSmrgdnl As a special exception to the GNU General Public License, if you
77638b41dabSmrgdnl distribute this file as part of a program that contains a
77738b41dabSmrgdnl configuration script generated by Autoconf, you may include it under
77838b41dabSmrgdnl the same distribution terms that you use for the rest of that
77938b41dabSmrgdnl program.
78038b41dabSmrg
78138b41dabSmrgdnl PKG_PREREQ(MIN-VERSION)
78238b41dabSmrgdnl -----------------------
78338b41dabSmrgdnl Since: 0.29
78438b41dabSmrgdnl
78538b41dabSmrgdnl Verify that the version of the pkg-config macros are at least
78638b41dabSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
78738b41dabSmrgdnl installed version of pkg-config, this checks the developer's version
78838b41dabSmrgdnl of pkg.m4 when generating configure.
78938b41dabSmrgdnl
79038b41dabSmrgdnl To ensure that this macro is defined, also add:
79138b41dabSmrgdnl m4_ifndef([PKG_PREREQ],
79238b41dabSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
79338b41dabSmrgdnl
79438b41dabSmrgdnl See the "Since" comment for each macro you use to see what version
79538b41dabSmrgdnl of the macros you require.
79638b41dabSmrgm4_defun([PKG_PREREQ],
79738b41dabSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
79838b41dabSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
79938b41dabSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
80038b41dabSmrg])dnl PKG_PREREQ
80138b41dabSmrg
80238b41dabSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
80338b41dabSmrgdnl ----------------------------------
80438b41dabSmrgdnl Since: 0.16
80538b41dabSmrgdnl
80638b41dabSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
80738b41dabSmrgdnl first found in the path. Checks that the version of pkg-config found
80838b41dabSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
80938b41dabSmrgdnl used since that's the first version where most current features of
81038b41dabSmrgdnl pkg-config existed.
81138b41dabSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
81238b41dabSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
81338b41dabSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
81438b41dabSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
81538b41dabSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
81638b41dabSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
81738b41dabSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
81838b41dabSmrg
81938b41dabSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
82038b41dabSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
82138b41dabSmrgfi
82238b41dabSmrgif test -n "$PKG_CONFIG"; then
82338b41dabSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
82438b41dabSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
82538b41dabSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
82638b41dabSmrg		AC_MSG_RESULT([yes])
82738b41dabSmrg	else
82838b41dabSmrg		AC_MSG_RESULT([no])
82938b41dabSmrg		PKG_CONFIG=""
83038b41dabSmrg	fi
83138b41dabSmrgfi[]dnl
83238b41dabSmrg])dnl PKG_PROG_PKG_CONFIG
83338b41dabSmrg
83438b41dabSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
83538b41dabSmrgdnl -------------------------------------------------------------------
83638b41dabSmrgdnl Since: 0.18
83738b41dabSmrgdnl
83838b41dabSmrgdnl Check to see whether a particular set of modules exists. Similar to
83938b41dabSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
84038b41dabSmrgdnl
84138b41dabSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
84238b41dabSmrgdnl only at the first occurence in configure.ac, so if the first place
84338b41dabSmrgdnl it's called might be skipped (such as if it is within an "if", you
84438b41dabSmrgdnl have to call PKG_CHECK_EXISTS manually
84538b41dabSmrgAC_DEFUN([PKG_CHECK_EXISTS],
84638b41dabSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
84738b41dabSmrgif test -n "$PKG_CONFIG" && \
84838b41dabSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
84938b41dabSmrg  m4_default([$2], [:])
85038b41dabSmrgm4_ifvaln([$3], [else
85138b41dabSmrg  $3])dnl
85238b41dabSmrgfi])
85338b41dabSmrg
85438b41dabSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
85538b41dabSmrgdnl ---------------------------------------------
85638b41dabSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
85738b41dabSmrgdnl pkg_failed based on the result.
85838b41dabSmrgm4_define([_PKG_CONFIG],
85938b41dabSmrg[if test -n "$$1"; then
86038b41dabSmrg    pkg_cv_[]$1="$$1"
86138b41dabSmrg elif test -n "$PKG_CONFIG"; then
86238b41dabSmrg    PKG_CHECK_EXISTS([$3],
86338b41dabSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
86438b41dabSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
86538b41dabSmrg		     [pkg_failed=yes])
86638b41dabSmrg else
86738b41dabSmrg    pkg_failed=untried
86838b41dabSmrgfi[]dnl
86938b41dabSmrg])dnl _PKG_CONFIG
87038b41dabSmrg
87138b41dabSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
87238b41dabSmrgdnl ---------------------------
87338b41dabSmrgdnl Internal check to see if pkg-config supports short errors.
87438b41dabSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
87538b41dabSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
87638b41dabSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
87738b41dabSmrg        _pkg_short_errors_supported=yes
87838b41dabSmrgelse
87938b41dabSmrg        _pkg_short_errors_supported=no
88038b41dabSmrgfi[]dnl
88138b41dabSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
88238b41dabSmrg
88338b41dabSmrg
88438b41dabSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
88538b41dabSmrgdnl   [ACTION-IF-NOT-FOUND])
88638b41dabSmrgdnl --------------------------------------------------------------
88738b41dabSmrgdnl Since: 0.4.0
88838b41dabSmrgdnl
88938b41dabSmrgdnl Note that if there is a possibility the first call to
89038b41dabSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
89138b41dabSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
89238b41dabSmrgAC_DEFUN([PKG_CHECK_MODULES],
89338b41dabSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
89438b41dabSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
89538b41dabSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
89638b41dabSmrg
89738b41dabSmrgpkg_failed=no
89838b41dabSmrgAC_MSG_CHECKING([for $1])
89938b41dabSmrg
90038b41dabSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
90138b41dabSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
90238b41dabSmrg
90338b41dabSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
90438b41dabSmrgand $1[]_LIBS to avoid the need to call pkg-config.
90538b41dabSmrgSee the pkg-config man page for more details.])
90638b41dabSmrg
90738b41dabSmrgif test $pkg_failed = yes; then
90838b41dabSmrg   	AC_MSG_RESULT([no])
90938b41dabSmrg        _PKG_SHORT_ERRORS_SUPPORTED
91038b41dabSmrg        if test $_pkg_short_errors_supported = yes; then
91138b41dabSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
91238b41dabSmrg        else 
91338b41dabSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
91438b41dabSmrg        fi
91538b41dabSmrg	# Put the nasty error message in config.log where it belongs
91638b41dabSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
91738b41dabSmrg
91838b41dabSmrg	m4_default([$4], [AC_MSG_ERROR(
91938b41dabSmrg[Package requirements ($2) were not met:
92038b41dabSmrg
92138b41dabSmrg$$1_PKG_ERRORS
92238b41dabSmrg
92338b41dabSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
92438b41dabSmrginstalled software in a non-standard prefix.
92538b41dabSmrg
92638b41dabSmrg_PKG_TEXT])[]dnl
92738b41dabSmrg        ])
92838b41dabSmrgelif test $pkg_failed = untried; then
92938b41dabSmrg     	AC_MSG_RESULT([no])
93038b41dabSmrg	m4_default([$4], [AC_MSG_FAILURE(
93138b41dabSmrg[The pkg-config script could not be found or is too old.  Make sure it
93238b41dabSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
93338b41dabSmrgpath to pkg-config.
93438b41dabSmrg
93538b41dabSmrg_PKG_TEXT
93638b41dabSmrg
93738b41dabSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
93838b41dabSmrg        ])
93938b41dabSmrgelse
94038b41dabSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
94138b41dabSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
94238b41dabSmrg        AC_MSG_RESULT([yes])
94338b41dabSmrg	$3
94438b41dabSmrgfi[]dnl
94538b41dabSmrg])dnl PKG_CHECK_MODULES
94638b41dabSmrg
94738b41dabSmrg
94838b41dabSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
94938b41dabSmrgdnl   [ACTION-IF-NOT-FOUND])
95038b41dabSmrgdnl ---------------------------------------------------------------------
95138b41dabSmrgdnl Since: 0.29
95238b41dabSmrgdnl
95338b41dabSmrgdnl Checks for existence of MODULES and gathers its build flags with
95438b41dabSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
95538b41dabSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
95638b41dabSmrgdnl
95738b41dabSmrgdnl Note that if there is a possibility the first call to
95838b41dabSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
95938b41dabSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
96038b41dabSmrgdnl configure.ac.
96138b41dabSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
96238b41dabSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
96338b41dabSmrg_save_PKG_CONFIG=$PKG_CONFIG
96438b41dabSmrgPKG_CONFIG="$PKG_CONFIG --static"
96538b41dabSmrgPKG_CHECK_MODULES($@)
96638b41dabSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
96738b41dabSmrg])dnl PKG_CHECK_MODULES_STATIC
96838b41dabSmrg
96938b41dabSmrg
97038b41dabSmrgdnl PKG_INSTALLDIR([DIRECTORY])
97138b41dabSmrgdnl -------------------------
97238b41dabSmrgdnl Since: 0.27
97338b41dabSmrgdnl
97438b41dabSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
97538b41dabSmrgdnl should install pkg-config .pc files. By default the directory is
97638b41dabSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
97738b41dabSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
97838b41dabSmrgdnl parameter.
97938b41dabSmrgAC_DEFUN([PKG_INSTALLDIR],
98038b41dabSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
98138b41dabSmrgm4_pushdef([pkg_description],
98238b41dabSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
98338b41dabSmrgAC_ARG_WITH([pkgconfigdir],
98438b41dabSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
98538b41dabSmrg    [with_pkgconfigdir=]pkg_default)
98638b41dabSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
98738b41dabSmrgm4_popdef([pkg_default])
98838b41dabSmrgm4_popdef([pkg_description])
98938b41dabSmrg])dnl PKG_INSTALLDIR
99038b41dabSmrg
99138b41dabSmrg
99238b41dabSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
99338b41dabSmrgdnl --------------------------------
99438b41dabSmrgdnl Since: 0.27
99538b41dabSmrgdnl
99638b41dabSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
99738b41dabSmrgdnl module should install arch-independent pkg-config .pc files. By
99838b41dabSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
99938b41dabSmrgdnl changed by passing DIRECTORY. The user can override through the
100038b41dabSmrgdnl --with-noarch-pkgconfigdir parameter.
100138b41dabSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
100238b41dabSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
100338b41dabSmrgm4_pushdef([pkg_description],
100438b41dabSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
100538b41dabSmrgAC_ARG_WITH([noarch-pkgconfigdir],
100638b41dabSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
100738b41dabSmrg    [with_noarch_pkgconfigdir=]pkg_default)
100838b41dabSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
100938b41dabSmrgm4_popdef([pkg_default])
101038b41dabSmrgm4_popdef([pkg_description])
101138b41dabSmrg])dnl PKG_NOARCH_INSTALLDIR
101238b41dabSmrg
101338b41dabSmrg
101438b41dabSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
101538b41dabSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
101638b41dabSmrgdnl -------------------------------------------
101738b41dabSmrgdnl Since: 0.28
101838b41dabSmrgdnl
101938b41dabSmrgdnl Retrieves the value of the pkg-config variable for the given module.
102038b41dabSmrgAC_DEFUN([PKG_CHECK_VAR],
102138b41dabSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
102238b41dabSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
102338b41dabSmrg
102438b41dabSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
102538b41dabSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
102638b41dabSmrg
102738b41dabSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
102838b41dabSmrg])dnl PKG_CHECK_VAR
102938b41dabSmrg
103038b41dabSmrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
103138b41dabSmrgdnl
103238b41dabSmrgdnl This file comes from X.Org's font-util 1.4.0
103338b41dabSmrgdnl
103438b41dabSmrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
103538b41dabSmrgdnl
103638b41dabSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
103738b41dabSmrgdnl copy of this software and associated documentation files (the "Software"),
103838b41dabSmrgdnl to deal in the Software without restriction, including without limitation
103938b41dabSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
104038b41dabSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
104138b41dabSmrgdnl Software is furnished to do so, subject to the following conditions:
104238b41dabSmrgdnl
104338b41dabSmrgdnl The above copyright notice and this permission notice (including the next
104438b41dabSmrgdnl paragraph) shall be included in all copies or substantial portions of the
104538b41dabSmrgdnl Software.
104638b41dabSmrgdnl
104738b41dabSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
104838b41dabSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
104938b41dabSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
105038b41dabSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
105138b41dabSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
105238b41dabSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
105338b41dabSmrgdnl DEALINGS IN THE SOFTWARE.
105438b41dabSmrgdnl
105538b41dabSmrgdnl --------------------------------------------------------------------
105638b41dabSmrgdnl
105738b41dabSmrgdnl Copyright 2005 Red Hat, Inc
105838b41dabSmrgdnl
105938b41dabSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
106038b41dabSmrgdnl documentation for any purpose is hereby granted without fee, provided that
106138b41dabSmrgdnl the above copyright notice appear in all copies and that both that
106238b41dabSmrgdnl copyright notice and this permission notice appear in supporting
106338b41dabSmrgdnl documentation.
106438b41dabSmrgdnl
106538b41dabSmrgdnl The above copyright notice and this permission notice shall be included
106638b41dabSmrgdnl in all copies or substantial portions of the Software.
106738b41dabSmrgdnl
106838b41dabSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
106938b41dabSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
107038b41dabSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
107138b41dabSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
107238b41dabSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
107338b41dabSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
107438b41dabSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
107538b41dabSmrgdnl
107638b41dabSmrgdnl Except as contained in this notice, the name of the copyright holders shall
107738b41dabSmrgdnl not be used in advertising or otherwise to promote the sale, use or
107838b41dabSmrgdnl other dealings in this Software without prior written authorization
107938b41dabSmrgdnl from the copyright holders.
108038b41dabSmrg
108138b41dabSmrg# XORG_FONT_MACROS_VERSION(required-version)
108238b41dabSmrg# ------------------------------------------
108338b41dabSmrg# Minimum version: 1.1.0
108438b41dabSmrg#
108538b41dabSmrg# If you're using a macro added in Version 1.1 or newer, include this in
108638b41dabSmrg# your configure.ac with the minimum required version, such as:
108738b41dabSmrg# XORG_FONT_MACROS_VERSION(1.1)
108838b41dabSmrg#
108938b41dabSmrg# To ensure that this macro is defined, also add:
109038b41dabSmrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
109138b41dabSmrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
109238b41dabSmrg#
109338b41dabSmrg#
109438b41dabSmrg# See the "minimum version" comment for each macro you use to see what
109538b41dabSmrg# version you require.
109638b41dabSmrgm4_defun([XORG_FONT_MACROS_VERSION],[
109738b41dabSmrgm4_define([vers_have], [1.4.0])
109838b41dabSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
109938b41dabSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
110038b41dabSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
110138b41dabSmrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
110238b41dabSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
110338b41dabSmrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
110438b41dabSmrgm4_undefine([vers_have])
110538b41dabSmrgm4_undefine([maj_have])
110638b41dabSmrgm4_undefine([maj_needed])
110738b41dabSmrg]) # XORG_FONT_MACROS_VERSION
110838b41dabSmrg
110938b41dabSmrg# XORG_FONT_CHECK_{maps}()
111038b41dabSmrg# ------------------------
111138b41dabSmrg# Minimum version: 1.0.0
111238b41dabSmrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
111338b41dabSmrg# JISX0201 or KOI8_R.  By default, they are all enabled.
111438b41dabSmrg
111538b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
111638b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
111738b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
111838b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
111938b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
112038b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
112138b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
112238b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
112338b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
112438b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
112538b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
112638b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
112738b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
112838b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
112938b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
113038b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
113138b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
113238b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
113338b41dabSmrg
113438b41dabSmrg# XORG_FONT_CHECK_ENCODING(encoding)
113538b41dabSmrg# ----------------------------------
113638b41dabSmrg# Minimum version: 1.1.0
113738b41dabSmrg# This macro adds --enable/disable-<encoding>, enabled by default.
113838b41dabSmrg# It replaced individual copies of this code in the above macros in 1.1.
113938b41dabSmrg# Currently assumes encoding names will be all upper-case - add m4_toupper
114038b41dabSmrg# calls if this is not true in the future.
114138b41dabSmrg
114238b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
114338b41dabSmrg	AC_ARG_ENABLE(m4_tolower($1),
114438b41dabSmrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
114538b41dabSmrg				[Build $1 fonts (default: yes)]),
114638b41dabSmrg		[AS_TR_SH($1)=$enableval])
114738b41dabSmrg	AC_MSG_CHECKING([whether to build $1 fonts])
114838b41dabSmrg	AC_MSG_RESULT($[AS_TR_SH($1)])
114938b41dabSmrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
115038b41dabSmrg]) # XORG_FONT_CHECK_ENCODING
115138b41dabSmrg
115238b41dabSmrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
115338b41dabSmrg# -----------------------------------------------------
115438b41dabSmrg# Minimum version: 1.1.0
115538b41dabSmrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
115638b41dabSmrg# Add a shorthand --enable/disable-all-encodings option.
115738b41dabSmrg
115838b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
115938b41dabSmrg	AC_ARG_ENABLE([all-encodings],
116038b41dabSmrg		AS_HELP_STRING([--disable-all-encodings],
116138b41dabSmrg				[Disable building of all font encodings]),
116238b41dabSmrg		[m4_foreach_w([enc], [$1], [
116338b41dabSmrg			AS_TR_SH(enc)=$enableval
116438b41dabSmrg		])],
116538b41dabSmrg		[m4_foreach_w([enc], [$1], [
116638b41dabSmrg			AS_TR_SH(enc)=yes
116738b41dabSmrg		])])
116838b41dabSmrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
116938b41dabSmrg]) # XORG_FONT_CHECK_ENCODING_LIST
117038b41dabSmrg
117138b41dabSmrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
117238b41dabSmrg# ------------------------------------------
117338b41dabSmrg# Minimum version: 1.1.0
117438b41dabSmrg#
117538b41dabSmrg# Simple wrapper around AC_PATH_PROG that errors if not found
117638b41dabSmrg#
117738b41dabSmrg
117838b41dabSmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
117938b41dabSmrg	AC_PATH_PROG($1, $2)
118038b41dabSmrg	if test x"$$1" = x; then
118138b41dabSmrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
118238b41dabSmrg	fi
118338b41dabSmrg])
118438b41dabSmrg
118538b41dabSmrg
118638b41dabSmrg# XORG_FONT_FCCACHE()
118738b41dabSmrg# -------------------
118838b41dabSmrg# Minimum version: 1.1.0
118938b41dabSmrg#
119038b41dabSmrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
119138b41dabSmrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
119238b41dabSmrg# to run fc-cache if found and not installing to $DESTDIR and not
119338b41dabSmrg# cross-compiling
119438b41dabSmrg#
119538b41dabSmrg# fc-cache is optional, not required, and should be skipped when making
119638b41dabSmrg# packages (installing to $DESTDIR) or cross-compiling
119738b41dabSmrg#
119838b41dabSmrgAC_DEFUN([XORG_FONT_FCCACHE],[
119938b41dabSmrg	AC_PATH_PROG(FCCACHE, fc-cache)
120038b41dabSmrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
120138b41dabSmrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
120238b41dabSmrg		RUN_FCCACHE="${FCCACHE_WARN}"
120338b41dabSmrg	else
120438b41dabSmrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
120538b41dabSmrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
120638b41dabSmrg	fi
120738b41dabSmrg	AC_SUBST([RUN_FCCACHE])
120838b41dabSmrg])
120938b41dabSmrg
121038b41dabSmrg# XORG_FONT_MKFONTDIR()
121138b41dabSmrg# -------------------
121238b41dabSmrg# Minimum version: 1.3.0
121338b41dabSmrg#
121438b41dabSmrg# Set MKFONTDIR to path to mkfontdir.
121538b41dabSmrg#
121638b41dabSmrg# If cross-compiling, and if mkdir is not found, use a shell command
121738b41dabSmrg# which warns mkfontdir needs to be run on the target
121838b41dabSmrg#
121938b41dabSmrg# If not cross-compiling, mkfontdir must be found
122038b41dabSmrg#
122138b41dabSmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
122238b41dabSmrg	if test x"$cross_compiling" != x"no" ; then
122338b41dabSmrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
122438b41dabSmrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
122538b41dabSmrg
122638b41dabSmrg		if test x"$MKFONTDIR" = x; then
122738b41dabSmrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
122838b41dabSmrg		fi
122938b41dabSmrg	else
123038b41dabSmrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
123138b41dabSmrg	fi
123238b41dabSmrg
123338b41dabSmrg	AC_SUBST([MKFONTDIR])
123438b41dabSmrg])
123538b41dabSmrg
123638b41dabSmrg# XORG_FONT_COMMON_UTILS()
123738b41dabSmrg# ------------------------
123838b41dabSmrg# Minimum version: 1.1.0
123938b41dabSmrg#
124038b41dabSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
124138b41dabSmrg
124238b41dabSmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
124338b41dabSmrg	XORG_FONT_FCCACHE
124438b41dabSmrg	XORG_FONT_MKFONTDIR
124538b41dabSmrg])
124638b41dabSmrg
124738b41dabSmrg# XORG_FONT_SCALED_UTILS()
124838b41dabSmrg# ------------------------
124938b41dabSmrg# Minimum version: 1.1.0
125038b41dabSmrg#
125138b41dabSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
125238b41dabSmrg# (TrueType, OpenType, Type1)
125338b41dabSmrg
125438b41dabSmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
125538b41dabSmrg	XORG_FONT_COMMON_UTILS
125638b41dabSmrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
125738b41dabSmrg])
125838b41dabSmrg
125938b41dabSmrg# XORG_FONT_BDF_UTILS()
126038b41dabSmrg# ---------------------
126138b41dabSmrg# Minimum version: 1.1.0
126238b41dabSmrg#
126338b41dabSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
126438b41dabSmrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
126538b41dabSmrg# PCF output files created by bdftopcf
126638b41dabSmrg
126738b41dabSmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
126838b41dabSmrg	XORG_FONT_COMMON_UTILS
126938b41dabSmrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
127038b41dabSmrg	XORG_FONT_CHECK_COMPRESSION
127138b41dabSmrg])
127238b41dabSmrg
127338b41dabSmrg# XORG_FONT_CHECK_COMPRESSION()
127438b41dabSmrg# -----------------------------
127538b41dabSmrg# Minimum version: 1.1.0
127638b41dabSmrg#
127738b41dabSmrg# Offer a --with-compression flag to control what compression method is
127838b41dabSmrg# used for pcf font files.   Offers all the methods currently supported
127938b41dabSmrg# by libXfont, including no compression.
128038b41dabSmrg#
128138b41dabSmrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
128238b41dabSmrg# for reproducible builds, such as gzip -n to not record timestamp, will
128338b41dabSmrg# set COMPRESS_FLAGS to those options.
128438b41dabSmrg
128538b41dabSmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
128638b41dabSmrg	AC_MSG_CHECKING([font compression method])
128738b41dabSmrg	AC_ARG_WITH(compression,
128838b41dabSmrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
128938b41dabSmrg			 [compression method to use on pcf fonts])],
129038b41dabSmrg         [compression="$withval"], [compression="yes"])
129138b41dabSmrg	if test x"$compression" = "xyes" ; then
129238b41dabSmrg		compression="gzip"
129338b41dabSmrg	fi
129438b41dabSmrg	AC_MSG_RESULT([${compression}])
129538b41dabSmrg	case ${compression} in
129638b41dabSmrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
129738b41dabSmrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
129838b41dabSmrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
129938b41dabSmrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
130038b41dabSmrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
130138b41dabSmrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
130238b41dabSmrg	esac
130338b41dabSmrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
130438b41dabSmrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
130538b41dabSmrg	fi
130638b41dabSmrg	AC_MSG_CHECKING([options to font compression command])
130738b41dabSmrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
130838b41dabSmrg	AC_SUBST([COMPRESS_FLAGS])
130938b41dabSmrg	AC_SUBST([COMPRESS_SUFFIX])
131038b41dabSmrg])
131138b41dabSmrg
131238b41dabSmrg# XORG_FONT_UCS2ANY()
131338b41dabSmrg# -------------------
131438b41dabSmrg# Minimum version: 1.1.0
131538b41dabSmrg#
131638b41dabSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
131738b41dabSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
131838b41dabSmrg# Also call pkg-config to find the directory with the encoding files needed
131938b41dabSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
132038b41dabSmrg
132138b41dabSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
132238b41dabSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
132338b41dabSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
132438b41dabSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
132538b41dabSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
132638b41dabSmrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
132738b41dabSmrg	AC_SUBST(MAPFILES_PATH)
132838b41dabSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
132938b41dabSmrg])
133038b41dabSmrg
133138b41dabSmrg
133238b41dabSmrg
133338b41dabSmrg# XORG_FONT_FC_CONFDIR()
133438b41dabSmrg# --------------------
133538b41dabSmrg# Minimum version: 1.2.0
133638b41dabSmrg#
133738b41dabSmrg# Sets FC_CONFDIR to the fontconfig config directory
133838b41dabSmrg# (which should be --with-confdir=... when building fontconfig)
133938b41dabSmrg# found from:
134038b41dabSmrg#	--with-fc-confdir=...
134138b41dabSmrg#	pkg-config --variable=confdir fontconfig
134238b41dabSmrg#	${sysconfdir}/fonts
134338b41dabSmrg
134438b41dabSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
134538b41dabSmrg	dnl Ensure $PKG_CONFIG is set first
134638b41dabSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
134738b41dabSmrg
134838b41dabSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
134938b41dabSmrg	AC_ARG_WITH(fc-confdir,
135038b41dabSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
135138b41dabSmrg			   [Path to fontconfig's configuration directory]),
135238b41dabSmrg		    [FC_CONFDIR="$withval"])
135338b41dabSmrg	# if --with-fc-confdir was not specified
135438b41dabSmrg	if test "x${FC_CONFDIR}" = "x"; then
135538b41dabSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
135638b41dabSmrg	fi
135738b41dabSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
135838b41dabSmrg	if test "x${FC_CONFDIR}" = "x"; then
135938b41dabSmrg		FC_CONFDIR="${sysconfdir}/fonts"
136038b41dabSmrg	fi
136138b41dabSmrg	AC_SUBST(FC_CONFDIR)
136238b41dabSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
136338b41dabSmrg])
136438b41dabSmrg
136538b41dabSmrg
136638b41dabSmrg
136738b41dabSmrg# XORG_FONTROOTDIR()
136838b41dabSmrg# --------------------
136938b41dabSmrg# Minimum version: 1.1.0
137038b41dabSmrg#
137138b41dabSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
137238b41dabSmrg# found from:
137338b41dabSmrg#	--with-fontrootdir
137438b41dabSmrg#	pkg-config --variable=fontrootdir fontutil
137538b41dabSmrg#	${datadir}/fonts/X11
137638b41dabSmrg
137738b41dabSmrgAC_DEFUN([XORG_FONTROOTDIR],[
137838b41dabSmrg	dnl Ensure $PKG_CONFIG is set first
137938b41dabSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
138038b41dabSmrg
138138b41dabSmrg	AC_MSG_CHECKING([for root directory for font files])
138238b41dabSmrg	AC_ARG_WITH(fontrootdir,
138338b41dabSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
138438b41dabSmrg			   [Path to root directory for font files]),
138538b41dabSmrg		    [FONTROOTDIR="$withval"])
138638b41dabSmrg	# if --with-fontrootdir not specified...
138738b41dabSmrg	if test "x${FONTROOTDIR}" = "x"; then
138838b41dabSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
138938b41dabSmrg	fi
139038b41dabSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
139138b41dabSmrg	if test "x${FONTROOTDIR}" = "x"; then
139238b41dabSmrg		FONTROOTDIR="${datadir}/fonts/X11"
139338b41dabSmrg	fi
139438b41dabSmrg	AC_SUBST(FONTROOTDIR)
139538b41dabSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
139638b41dabSmrg])
139738b41dabSmrg
139838b41dabSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
139938b41dabSmrg# ---------------------------------------
140038b41dabSmrg# Minimum version: 1.1.0
140138b41dabSmrg#
140238b41dabSmrg# Offer a --with-<flag> flag to control directory for font installation
140338b41dabSmrg# Default is the specified <subdir> of the font root directory.
140438b41dabSmrg# Sets <variable> to the selected directory
140538b41dabSmrg
140638b41dabSmrgAC_DEFUN([XORG_FONTSUBDIR],[
140738b41dabSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
140838b41dabSmrg
140938b41dabSmrg	AC_MSG_CHECKING([for directory for $3 files])
141038b41dabSmrg	AC_ARG_WITH($2,
141138b41dabSmrg		    [AS_HELP_STRING([--with-$2=DIR],
141238b41dabSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
141338b41dabSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
141438b41dabSmrg	AC_SUBST($1)
141538b41dabSmrg	AC_MSG_RESULT([${$1}])
141638b41dabSmrg]) # XORG_FONTSUBDIR
141738b41dabSmrg
141838b41dabSmrg# XORG_FONTDIR(subdir)
141938b41dabSmrg# --------------------
142038b41dabSmrg# Minimum version: 1.1.0
142138b41dabSmrg#
142238b41dabSmrg# Offer a --with-fontdir flag to control directory for font installation
142338b41dabSmrg# Default is the specified subdir of the font root directory.
142438b41dabSmrg# Sets FONTDIR to the selected directory
142538b41dabSmrg
142638b41dabSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
142738b41dabSmrg
142838b41dabSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142938b41dabSmrgdnl
143038b41dabSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
143138b41dabSmrgdnl
143238b41dabSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143338b41dabSmrgdnl copy of this software and associated documentation files (the "Software"),
143438b41dabSmrgdnl to deal in the Software without restriction, including without limitation
143538b41dabSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143638b41dabSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
143738b41dabSmrgdnl Software is furnished to do so, subject to the following conditions:
143838b41dabSmrgdnl
143938b41dabSmrgdnl The above copyright notice and this permission notice (including the next
144038b41dabSmrgdnl paragraph) shall be included in all copies or substantial portions of the
144138b41dabSmrgdnl Software.
144238b41dabSmrgdnl
144338b41dabSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144438b41dabSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144538b41dabSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144638b41dabSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144738b41dabSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144838b41dabSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144938b41dabSmrgdnl DEALINGS IN THE SOFTWARE.
145038b41dabSmrg
145138b41dabSmrg# XORG_MACROS_VERSION(required-version)
145238b41dabSmrg# -------------------------------------
145338b41dabSmrg# Minimum version: 1.1.0
145438b41dabSmrg#
145538b41dabSmrg# If you're using a macro added in Version 1.1 or newer, include this in
145638b41dabSmrg# your configure.ac with the minimum required version, such as:
145738b41dabSmrg# XORG_MACROS_VERSION(1.1)
145838b41dabSmrg#
145938b41dabSmrg# To ensure that this macro is defined, also add:
146038b41dabSmrg# m4_ifndef([XORG_MACROS_VERSION],
146138b41dabSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
146238b41dabSmrg#
146338b41dabSmrg#
146438b41dabSmrg# See the "minimum version" comment for each macro you use to see what
146538b41dabSmrg# version you require.
146638b41dabSmrgm4_defun([XORG_MACROS_VERSION],[
146738b41dabSmrgm4_define([vers_have], [1.20.0])
146838b41dabSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146938b41dabSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
147038b41dabSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147138b41dabSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147238b41dabSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147338b41dabSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147438b41dabSmrgm4_undefine([vers_have])
147538b41dabSmrgm4_undefine([maj_have])
147638b41dabSmrgm4_undefine([maj_needed])
147738b41dabSmrg]) # XORG_MACROS_VERSION
147838b41dabSmrg
147938b41dabSmrg# XORG_PROG_RAWCPP()
148038b41dabSmrg# ------------------
148138b41dabSmrg# Minimum version: 1.0.0
148238b41dabSmrg#
148338b41dabSmrg# Find cpp program and necessary flags for use in pre-processing text files
148438b41dabSmrg# such as man pages and config files
148538b41dabSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148638b41dabSmrgAC_REQUIRE([AC_PROG_CPP])
148738b41dabSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148838b41dabSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
148938b41dabSmrg
149038b41dabSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149138b41dabSmrg# which is not the best choice for supporting other OS'es, but covers most
149238b41dabSmrg# of the ones we need for now.
149338b41dabSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149438b41dabSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149538b41dabSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149638b41dabSmrg	AC_MSG_RESULT([no])
149738b41dabSmrgelse
149838b41dabSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149938b41dabSmrg		RAWCPPFLAGS=-undef
150038b41dabSmrg		AC_MSG_RESULT([yes])
150138b41dabSmrg	# under Cygwin unix is still defined even with -undef
150238b41dabSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150338b41dabSmrg		RAWCPPFLAGS="-undef -ansi"
150438b41dabSmrg		AC_MSG_RESULT([yes, with -ansi])
150538b41dabSmrg	else
150638b41dabSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150738b41dabSmrg	fi
150838b41dabSmrgfi
150938b41dabSmrgrm -f conftest.$ac_ext
151038b41dabSmrg
151138b41dabSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151238b41dabSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151338b41dabSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151438b41dabSmrg	AC_MSG_RESULT([no])
151538b41dabSmrgelse
151638b41dabSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151738b41dabSmrg		TRADITIONALCPPFLAGS="-traditional"
151838b41dabSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151938b41dabSmrg		AC_MSG_RESULT([yes])
152038b41dabSmrg	else
152138b41dabSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152238b41dabSmrg	fi
152338b41dabSmrgfi
152438b41dabSmrgrm -f conftest.$ac_ext
152538b41dabSmrgAC_SUBST(RAWCPPFLAGS)
152638b41dabSmrgAC_SUBST(TRADITIONALCPPFLAGS)
152738b41dabSmrg]) # XORG_PROG_RAWCPP
152838b41dabSmrg
152938b41dabSmrg# XORG_MANPAGE_SECTIONS()
153038b41dabSmrg# -----------------------
153138b41dabSmrg# Minimum version: 1.0.0
153238b41dabSmrg#
153338b41dabSmrg# Determine which sections man pages go in for the different man page types
153438b41dabSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153538b41dabSmrg# Not sure if there's any better way than just hardcoding by OS name.
153638b41dabSmrg# Override default settings by setting environment variables
153738b41dabSmrg# Added MAN_SUBSTS in version 1.8
153838b41dabSmrg# Added AC_PROG_SED in version 1.8
153938b41dabSmrg
154038b41dabSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154138b41dabSmrgAC_REQUIRE([AC_CANONICAL_HOST])
154238b41dabSmrgAC_REQUIRE([AC_PROG_SED])
154338b41dabSmrg
154438b41dabSmrgcase $host_os in
154538b41dabSmrg    solaris*)
154638b41dabSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
154738b41dabSmrg        # check for a man page file found in later versions that use
154838b41dabSmrg        # traditional section numbers instead
154938b41dabSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
155038b41dabSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
155138b41dabSmrg        ;;
155238b41dabSmrg    *) SYSV_MAN_SECTIONS=false ;;
155338b41dabSmrgesac
155438b41dabSmrg
155538b41dabSmrgif test x$APP_MAN_SUFFIX = x    ; then
155638b41dabSmrg    APP_MAN_SUFFIX=1
155738b41dabSmrgfi
155838b41dabSmrgif test x$APP_MAN_DIR = x    ; then
155938b41dabSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
156038b41dabSmrgfi
156138b41dabSmrg
156238b41dabSmrgif test x$LIB_MAN_SUFFIX = x    ; then
156338b41dabSmrg    LIB_MAN_SUFFIX=3
156438b41dabSmrgfi
156538b41dabSmrgif test x$LIB_MAN_DIR = x    ; then
156638b41dabSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
156738b41dabSmrgfi
156838b41dabSmrg
156938b41dabSmrgif test x$FILE_MAN_SUFFIX = x    ; then
157038b41dabSmrg    case $SYSV_MAN_SECTIONS in
157138b41dabSmrg	true)				FILE_MAN_SUFFIX=4  ;;
157238b41dabSmrg	*)				FILE_MAN_SUFFIX=5  ;;
157338b41dabSmrg    esac
157438b41dabSmrgfi
157538b41dabSmrgif test x$FILE_MAN_DIR = x    ; then
157638b41dabSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
157738b41dabSmrgfi
157838b41dabSmrg
157938b41dabSmrgif test x$MISC_MAN_SUFFIX = x    ; then
158038b41dabSmrg    case $SYSV_MAN_SECTIONS in
158138b41dabSmrg	true)				MISC_MAN_SUFFIX=5  ;;
158238b41dabSmrg	*)				MISC_MAN_SUFFIX=7  ;;
158338b41dabSmrg    esac
158438b41dabSmrgfi
158538b41dabSmrgif test x$MISC_MAN_DIR = x    ; then
158638b41dabSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
158738b41dabSmrgfi
158838b41dabSmrg
158938b41dabSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
159038b41dabSmrg    case $SYSV_MAN_SECTIONS in
159138b41dabSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
159238b41dabSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159338b41dabSmrg    esac
159438b41dabSmrgfi
159538b41dabSmrgif test x$DRIVER_MAN_DIR = x    ; then
159638b41dabSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159738b41dabSmrgfi
159838b41dabSmrg
159938b41dabSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
160038b41dabSmrg    case $SYSV_MAN_SECTIONS in
160138b41dabSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
160238b41dabSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160338b41dabSmrg    esac
160438b41dabSmrgfi
160538b41dabSmrgif test x$ADMIN_MAN_DIR = x    ; then
160638b41dabSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160738b41dabSmrgfi
160838b41dabSmrg
160938b41dabSmrg
161038b41dabSmrgAC_SUBST([APP_MAN_SUFFIX])
161138b41dabSmrgAC_SUBST([LIB_MAN_SUFFIX])
161238b41dabSmrgAC_SUBST([FILE_MAN_SUFFIX])
161338b41dabSmrgAC_SUBST([MISC_MAN_SUFFIX])
161438b41dabSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161538b41dabSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161638b41dabSmrgAC_SUBST([APP_MAN_DIR])
161738b41dabSmrgAC_SUBST([LIB_MAN_DIR])
161838b41dabSmrgAC_SUBST([FILE_MAN_DIR])
161938b41dabSmrgAC_SUBST([MISC_MAN_DIR])
162038b41dabSmrgAC_SUBST([DRIVER_MAN_DIR])
162138b41dabSmrgAC_SUBST([ADMIN_MAN_DIR])
162238b41dabSmrg
162338b41dabSmrgXORG_MAN_PAGE="X Version 11"
162438b41dabSmrgAC_SUBST([XORG_MAN_PAGE])
162538b41dabSmrgMAN_SUBSTS="\
162638b41dabSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162738b41dabSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162838b41dabSmrg	-e 's|__xservername__|Xorg|g' \
162938b41dabSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
163038b41dabSmrg	-e 's|__projectroot__|\$(prefix)|g' \
163138b41dabSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163238b41dabSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163338b41dabSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163438b41dabSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163538b41dabSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163638b41dabSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163738b41dabSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163838b41dabSmrgAC_SUBST([MAN_SUBSTS])
163938b41dabSmrg
164038b41dabSmrg]) # XORG_MANPAGE_SECTIONS
164138b41dabSmrg
164238b41dabSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164338b41dabSmrg# ------------------------
164438b41dabSmrg# Minimum version: 1.7.0
164538b41dabSmrg#
164638b41dabSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164738b41dabSmrg# provided by xorg-sgml-doctools, if installed.
164838b41dabSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164938b41dabSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
165038b41dabSmrgXORG_SGML_PATH=
165138b41dabSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165238b41dabSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165338b41dabSmrg    [m4_ifval([$1],[:],
165438b41dabSmrg        [if test x"$cross_compiling" != x"yes" ; then
165538b41dabSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165638b41dabSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165738b41dabSmrg         fi])
165838b41dabSmrg    ])
165938b41dabSmrg
166038b41dabSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166138b41dabSmrg# the path and the name of the doc stylesheet
166238b41dabSmrgif test "x$XORG_SGML_PATH" != "x" ; then
166338b41dabSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166438b41dabSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166538b41dabSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166638b41dabSmrgelse
166738b41dabSmrg   AC_MSG_RESULT([no])
166838b41dabSmrgfi
166938b41dabSmrg
167038b41dabSmrgAC_SUBST(XORG_SGML_PATH)
167138b41dabSmrgAC_SUBST(STYLESHEET_SRCDIR)
167238b41dabSmrgAC_SUBST(XSL_STYLESHEET)
167338b41dabSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167438b41dabSmrg]) # XORG_CHECK_SGML_DOCTOOLS
167538b41dabSmrg
167638b41dabSmrg# XORG_CHECK_LINUXDOC
167738b41dabSmrg# -------------------
167838b41dabSmrg# Minimum version: 1.0.0
167938b41dabSmrg#
168038b41dabSmrg# Defines the variable MAKE_TEXT if the necessary tools and
168138b41dabSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168238b41dabSmrg# Whether or not the necessary tools and files are found can be checked
168338b41dabSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168438b41dabSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168538b41dabSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168638b41dabSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
168738b41dabSmrg
168838b41dabSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
168938b41dabSmrg
169038b41dabSmrgAC_MSG_CHECKING([whether to build documentation])
169138b41dabSmrg
169238b41dabSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169338b41dabSmrg   BUILDDOC=yes
169438b41dabSmrgelse
169538b41dabSmrg   BUILDDOC=no
169638b41dabSmrgfi
169738b41dabSmrg
169838b41dabSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
169938b41dabSmrg
170038b41dabSmrgAC_MSG_RESULT([$BUILDDOC])
170138b41dabSmrg
170238b41dabSmrgAC_MSG_CHECKING([whether to build pdf documentation])
170338b41dabSmrg
170438b41dabSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170538b41dabSmrg   BUILDPDFDOC=yes
170638b41dabSmrgelse
170738b41dabSmrg   BUILDPDFDOC=no
170838b41dabSmrgfi
170938b41dabSmrg
171038b41dabSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171138b41dabSmrg
171238b41dabSmrgAC_MSG_RESULT([$BUILDPDFDOC])
171338b41dabSmrg
171438b41dabSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171538b41dabSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171638b41dabSmrgMAKE_PDF="$PS2PDF"
171738b41dabSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171838b41dabSmrg
171938b41dabSmrgAC_SUBST(MAKE_TEXT)
172038b41dabSmrgAC_SUBST(MAKE_PS)
172138b41dabSmrgAC_SUBST(MAKE_PDF)
172238b41dabSmrgAC_SUBST(MAKE_HTML)
172338b41dabSmrg]) # XORG_CHECK_LINUXDOC
172438b41dabSmrg
172538b41dabSmrg# XORG_CHECK_DOCBOOK
172638b41dabSmrg# -------------------
172738b41dabSmrg# Minimum version: 1.0.0
172838b41dabSmrg#
172938b41dabSmrg# Checks for the ability to build output formats from SGML DocBook source.
173038b41dabSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173138b41dabSmrg# indicates whether the necessary tools and files are found and, if set,
173238b41dabSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173338b41dabSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173438b41dabSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
173538b41dabSmrg
173638b41dabSmrgBUILDTXTDOC=no
173738b41dabSmrgBUILDPDFDOC=no
173838b41dabSmrgBUILDPSDOC=no
173938b41dabSmrgBUILDHTMLDOC=no
174038b41dabSmrg
174138b41dabSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174238b41dabSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174338b41dabSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174438b41dabSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
174538b41dabSmrg
174638b41dabSmrgAC_MSG_CHECKING([whether to build text documentation])
174738b41dabSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174838b41dabSmrg   test x$BUILD_TXTDOC != xno; then
174938b41dabSmrg	BUILDTXTDOC=yes
175038b41dabSmrgfi
175138b41dabSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175238b41dabSmrgAC_MSG_RESULT([$BUILDTXTDOC])
175338b41dabSmrg
175438b41dabSmrgAC_MSG_CHECKING([whether to build PDF documentation])
175538b41dabSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175638b41dabSmrg   test x$BUILD_PDFDOC != xno; then
175738b41dabSmrg	BUILDPDFDOC=yes
175838b41dabSmrgfi
175938b41dabSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
176038b41dabSmrgAC_MSG_RESULT([$BUILDPDFDOC])
176138b41dabSmrg
176238b41dabSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176338b41dabSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176438b41dabSmrg   test x$BUILD_PSDOC != xno; then
176538b41dabSmrg	BUILDPSDOC=yes
176638b41dabSmrgfi
176738b41dabSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176838b41dabSmrgAC_MSG_RESULT([$BUILDPSDOC])
176938b41dabSmrg
177038b41dabSmrgAC_MSG_CHECKING([whether to build HTML documentation])
177138b41dabSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177238b41dabSmrg   test x$BUILD_HTMLDOC != xno; then
177338b41dabSmrg	BUILDHTMLDOC=yes
177438b41dabSmrgfi
177538b41dabSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177638b41dabSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
177738b41dabSmrg
177838b41dabSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177938b41dabSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
178038b41dabSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178138b41dabSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178238b41dabSmrg
178338b41dabSmrgAC_SUBST(MAKE_TEXT)
178438b41dabSmrgAC_SUBST(MAKE_PS)
178538b41dabSmrgAC_SUBST(MAKE_PDF)
178638b41dabSmrgAC_SUBST(MAKE_HTML)
178738b41dabSmrg]) # XORG_CHECK_DOCBOOK
178838b41dabSmrg
178938b41dabSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
179038b41dabSmrg# ----------------
179138b41dabSmrg# Minimum version: 1.5.0
179238b41dabSmrg# Minimum version for optional DEFAULT argument: 1.11.0
179338b41dabSmrg#
179438b41dabSmrg# Documentation tools are not always available on all platforms and sometimes
179538b41dabSmrg# not at the appropriate level. This macro enables a module to test for the
179638b41dabSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
179738b41dabSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
179838b41dabSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179938b41dabSmrg# --with-xmlto assumes 'auto'.
180038b41dabSmrg#
180138b41dabSmrg# Interface to module:
180238b41dabSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180338b41dabSmrg# XMLTO:	returns the path of the xmlto program found
180438b41dabSmrg#		returns the path set by the user in the environment
180538b41dabSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180638b41dabSmrg#		'no' user instructs the module not to use xmlto
180738b41dabSmrg#
180838b41dabSmrg# Added in version 1.10.0
180938b41dabSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
181038b41dabSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
181138b41dabSmrg#
181238b41dabSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
181338b41dabSmrg#
181438b41dabSmrgAC_DEFUN([XORG_WITH_XMLTO],[
181538b41dabSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181638b41dabSmrgm4_define([_defopt], m4_default([$2], [auto]))
181738b41dabSmrgAC_ARG_WITH(xmlto,
181838b41dabSmrg	AS_HELP_STRING([--with-xmlto],
181938b41dabSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
182038b41dabSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182138b41dabSmrgm4_undefine([_defopt])
182238b41dabSmrg
182338b41dabSmrgif test "x$use_xmlto" = x"auto"; then
182438b41dabSmrg   AC_PATH_PROG([XMLTO], [xmlto])
182538b41dabSmrg   if test "x$XMLTO" = "x"; then
182638b41dabSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182738b41dabSmrg	have_xmlto=no
182838b41dabSmrg   else
182938b41dabSmrg        have_xmlto=yes
183038b41dabSmrg   fi
183138b41dabSmrgelif test "x$use_xmlto" = x"yes" ; then
183238b41dabSmrg   AC_PATH_PROG([XMLTO], [xmlto])
183338b41dabSmrg   if test "x$XMLTO" = "x"; then
183438b41dabSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183538b41dabSmrg   fi
183638b41dabSmrg   have_xmlto=yes
183738b41dabSmrgelif test "x$use_xmlto" = x"no" ; then
183838b41dabSmrg   if test "x$XMLTO" != "x"; then
183938b41dabSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
184038b41dabSmrg   fi
184138b41dabSmrg   have_xmlto=no
184238b41dabSmrgelse
184338b41dabSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184438b41dabSmrgfi
184538b41dabSmrg
184638b41dabSmrg# Test for a minimum version of xmlto, if provided.
184738b41dabSmrgm4_ifval([$1],
184838b41dabSmrg[if test "$have_xmlto" = yes; then
184938b41dabSmrg    # scrape the xmlto version
185038b41dabSmrg    AC_MSG_CHECKING([the xmlto version])
185138b41dabSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185238b41dabSmrg    AC_MSG_RESULT([$xmlto_version])
185338b41dabSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185438b41dabSmrg        [if test "x$use_xmlto" = xauto; then
185538b41dabSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185638b41dabSmrg            have_xmlto=no
185738b41dabSmrg        else
185838b41dabSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185938b41dabSmrg        fi])
186038b41dabSmrgfi])
186138b41dabSmrg
186238b41dabSmrg# Test for the ability of xmlto to generate a text target
186338b41dabSmrg#
186438b41dabSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
186538b41dabSmrg# following test for empty XML docbook files.
186638b41dabSmrg# For compatibility reasons use the following empty XML docbook file and if
186738b41dabSmrg# it fails try it again with a non-empty XML file.
186838b41dabSmrghave_xmlto_text=no
186938b41dabSmrgcat > conftest.xml << "EOF"
187038b41dabSmrgEOF
187138b41dabSmrgAS_IF([test "$have_xmlto" = yes],
187238b41dabSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187338b41dabSmrg             [have_xmlto_text=yes],
187438b41dabSmrg             [# Try it again with a non-empty XML file.
187538b41dabSmrg              cat > conftest.xml << "EOF"
187638b41dabSmrg<x></x>
187738b41dabSmrgEOF
187838b41dabSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187938b41dabSmrg                    [have_xmlto_text=yes],
188038b41dabSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188138b41dabSmrgrm -f conftest.xml
188238b41dabSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188338b41dabSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188438b41dabSmrg]) # XORG_WITH_XMLTO
188538b41dabSmrg
188638b41dabSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188738b41dabSmrg# --------------------------------------------
188838b41dabSmrg# Minimum version: 1.12.0
188938b41dabSmrg# Minimum version for optional DEFAULT argument: 1.12.0
189038b41dabSmrg#
189138b41dabSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189238b41dabSmrg# XML-based language used for the transformation of XML documents.
189338b41dabSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189438b41dabSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189538b41dabSmrg# The XSLT processor is often used as a standalone tool for transformations.
189638b41dabSmrg# It should not be assumed that this tool is used only to work with documnetation.
189738b41dabSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189838b41dabSmrg#
189938b41dabSmrg# Interface to module:
190038b41dabSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190138b41dabSmrg# XSLTPROC:	 returns the path of the xsltproc program found
190238b41dabSmrg#		 returns the path set by the user in the environment
190338b41dabSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190438b41dabSmrg#		  'no' user instructs the module not to use xsltproc
190538b41dabSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190638b41dabSmrg#
190738b41dabSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190838b41dabSmrg#
190938b41dabSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
191038b41dabSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191138b41dabSmrg# Preserves the interface, should it be implemented later
191238b41dabSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191338b41dabSmrgm4_define([_defopt], m4_default([$2], [auto]))
191438b41dabSmrgAC_ARG_WITH(xsltproc,
191538b41dabSmrg	AS_HELP_STRING([--with-xsltproc],
191638b41dabSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191738b41dabSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191838b41dabSmrgm4_undefine([_defopt])
191938b41dabSmrg
192038b41dabSmrgif test "x$use_xsltproc" = x"auto"; then
192138b41dabSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192238b41dabSmrg   if test "x$XSLTPROC" = "x"; then
192338b41dabSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192438b41dabSmrg	have_xsltproc=no
192538b41dabSmrg   else
192638b41dabSmrg        have_xsltproc=yes
192738b41dabSmrg   fi
192838b41dabSmrgelif test "x$use_xsltproc" = x"yes" ; then
192938b41dabSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
193038b41dabSmrg   if test "x$XSLTPROC" = "x"; then
193138b41dabSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193238b41dabSmrg   fi
193338b41dabSmrg   have_xsltproc=yes
193438b41dabSmrgelif test "x$use_xsltproc" = x"no" ; then
193538b41dabSmrg   if test "x$XSLTPROC" != "x"; then
193638b41dabSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193738b41dabSmrg   fi
193838b41dabSmrg   have_xsltproc=no
193938b41dabSmrgelse
194038b41dabSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
194138b41dabSmrgfi
194238b41dabSmrg
194338b41dabSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194438b41dabSmrg]) # XORG_WITH_XSLTPROC
194538b41dabSmrg
194638b41dabSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194738b41dabSmrg# ----------------------------------------
194838b41dabSmrg# Minimum version: 1.15.0
194938b41dabSmrg#
195038b41dabSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
195138b41dabSmrg# scanning arbitrary text files, extracting information from those text files,
195238b41dabSmrg# and printing reports based on that information.
195338b41dabSmrg#
195438b41dabSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
195538b41dabSmrg#
195638b41dabSmrg# Interface to module:
195738b41dabSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
195838b41dabSmrg# PERL:	     returns the path of the perl program found
195938b41dabSmrg#	     returns the path set by the user in the environment
196038b41dabSmrg# --with-perl: 'yes' user instructs the module to use perl
196138b41dabSmrg#	       'no' user instructs the module not to use perl
196238b41dabSmrg# have_perl: returns yes if perl found in PATH or no
196338b41dabSmrg#
196438b41dabSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196538b41dabSmrg#
196638b41dabSmrgAC_DEFUN([XORG_WITH_PERL],[
196738b41dabSmrgAC_ARG_VAR([PERL], [Path to perl command])
196838b41dabSmrg# Preserves the interface, should it be implemented later
196938b41dabSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
197038b41dabSmrgm4_define([_defopt], m4_default([$2], [auto]))
197138b41dabSmrgAC_ARG_WITH(perl,
197238b41dabSmrg	AS_HELP_STRING([--with-perl],
197338b41dabSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197438b41dabSmrg	   [use_perl=$withval], [use_perl=]_defopt)
197538b41dabSmrgm4_undefine([_defopt])
197638b41dabSmrg
197738b41dabSmrgif test "x$use_perl" = x"auto"; then
197838b41dabSmrg   AC_PATH_PROG([PERL], [perl])
197938b41dabSmrg   if test "x$PERL" = "x"; then
198038b41dabSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198138b41dabSmrg	have_perl=no
198238b41dabSmrg   else
198338b41dabSmrg        have_perl=yes
198438b41dabSmrg   fi
198538b41dabSmrgelif test "x$use_perl" = x"yes" ; then
198638b41dabSmrg   AC_PATH_PROG([PERL], [perl])
198738b41dabSmrg   if test "x$PERL" = "x"; then
198838b41dabSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198938b41dabSmrg   fi
199038b41dabSmrg   have_perl=yes
199138b41dabSmrgelif test "x$use_perl" = x"no" ; then
199238b41dabSmrg   if test "x$PERL" != "x"; then
199338b41dabSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199438b41dabSmrg   fi
199538b41dabSmrg   have_perl=no
199638b41dabSmrgelse
199738b41dabSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199838b41dabSmrgfi
199938b41dabSmrg
200038b41dabSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200138b41dabSmrg]) # XORG_WITH_PERL
200238b41dabSmrg
200338b41dabSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
200438b41dabSmrg# ----------------
200538b41dabSmrg# Minimum version: 1.5.0
200638b41dabSmrg# Minimum version for optional DEFAULT argument: 1.11.0
200738b41dabSmrg#
200838b41dabSmrg# Documentation tools are not always available on all platforms and sometimes
200938b41dabSmrg# not at the appropriate level. This macro enables a module to test for the
201038b41dabSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
201138b41dabSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
201238b41dabSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201338b41dabSmrg# --with-asciidoc assumes 'auto'.
201438b41dabSmrg#
201538b41dabSmrg# Interface to module:
201638b41dabSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201738b41dabSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
201838b41dabSmrg#		 returns the path set by the user in the environment
201938b41dabSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
202038b41dabSmrg#		  'no' user instructs the module not to use asciidoc
202138b41dabSmrg#
202238b41dabSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
202338b41dabSmrg#
202438b41dabSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202538b41dabSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202638b41dabSmrgm4_define([_defopt], m4_default([$2], [auto]))
202738b41dabSmrgAC_ARG_WITH(asciidoc,
202838b41dabSmrg	AS_HELP_STRING([--with-asciidoc],
202938b41dabSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
203038b41dabSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203138b41dabSmrgm4_undefine([_defopt])
203238b41dabSmrg
203338b41dabSmrgif test "x$use_asciidoc" = x"auto"; then
203438b41dabSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203538b41dabSmrg   if test "x$ASCIIDOC" = "x"; then
203638b41dabSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203738b41dabSmrg	have_asciidoc=no
203838b41dabSmrg   else
203938b41dabSmrg        have_asciidoc=yes
204038b41dabSmrg   fi
204138b41dabSmrgelif test "x$use_asciidoc" = x"yes" ; then
204238b41dabSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204338b41dabSmrg   if test "x$ASCIIDOC" = "x"; then
204438b41dabSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204538b41dabSmrg   fi
204638b41dabSmrg   have_asciidoc=yes
204738b41dabSmrgelif test "x$use_asciidoc" = x"no" ; then
204838b41dabSmrg   if test "x$ASCIIDOC" != "x"; then
204938b41dabSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
205038b41dabSmrg   fi
205138b41dabSmrg   have_asciidoc=no
205238b41dabSmrgelse
205338b41dabSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205438b41dabSmrgfi
205538b41dabSmrgm4_ifval([$1],
205638b41dabSmrg[if test "$have_asciidoc" = yes; then
205738b41dabSmrg    # scrape the asciidoc version
205838b41dabSmrg    AC_MSG_CHECKING([the asciidoc version])
205938b41dabSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
206038b41dabSmrg    AC_MSG_RESULT([$asciidoc_version])
206138b41dabSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206238b41dabSmrg        [if test "x$use_asciidoc" = xauto; then
206338b41dabSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206438b41dabSmrg            have_asciidoc=no
206538b41dabSmrg        else
206638b41dabSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206738b41dabSmrg        fi])
206838b41dabSmrgfi])
206938b41dabSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
207038b41dabSmrg]) # XORG_WITH_ASCIIDOC
207138b41dabSmrg
207238b41dabSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207338b41dabSmrg# -------------------------------------------
207438b41dabSmrg# Minimum version: 1.5.0
207538b41dabSmrg# Minimum version for optional DEFAULT argument: 1.11.0
207638b41dabSmrg# Minimum version for optional DOT checking: 1.18.0
207738b41dabSmrg#
207838b41dabSmrg# Documentation tools are not always available on all platforms and sometimes
207938b41dabSmrg# not at the appropriate level. This macro enables a module to test for the
208038b41dabSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
208138b41dabSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
208238b41dabSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208338b41dabSmrg# --with-doxygen assumes 'auto'.
208438b41dabSmrg#
208538b41dabSmrg# Interface to module:
208638b41dabSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208738b41dabSmrg# DOXYGEN:	 returns the path of the doxygen program found
208838b41dabSmrg#		 returns the path set by the user in the environment
208938b41dabSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
209038b41dabSmrg#		  'no' user instructs the module not to use doxygen
209138b41dabSmrg#
209238b41dabSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
209338b41dabSmrg#
209438b41dabSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209538b41dabSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209638b41dabSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209738b41dabSmrgm4_define([_defopt], m4_default([$2], [auto]))
209838b41dabSmrgAC_ARG_WITH(doxygen,
209938b41dabSmrg	AS_HELP_STRING([--with-doxygen],
210038b41dabSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210138b41dabSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210238b41dabSmrgm4_undefine([_defopt])
210338b41dabSmrg
210438b41dabSmrgif test "x$use_doxygen" = x"auto"; then
210538b41dabSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210638b41dabSmrg   if test "x$DOXYGEN" = "x"; then
210738b41dabSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210838b41dabSmrg	have_doxygen=no
210938b41dabSmrg   else
211038b41dabSmrg        have_doxygen=yes
211138b41dabSmrg   fi
211238b41dabSmrgelif test "x$use_doxygen" = x"yes" ; then
211338b41dabSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211438b41dabSmrg   if test "x$DOXYGEN" = "x"; then
211538b41dabSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211638b41dabSmrg   fi
211738b41dabSmrg   have_doxygen=yes
211838b41dabSmrgelif test "x$use_doxygen" = x"no" ; then
211938b41dabSmrg   if test "x$DOXYGEN" != "x"; then
212038b41dabSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212138b41dabSmrg   fi
212238b41dabSmrg   have_doxygen=no
212338b41dabSmrgelse
212438b41dabSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
212538b41dabSmrgfi
212638b41dabSmrgm4_ifval([$1],
212738b41dabSmrg[if test "$have_doxygen" = yes; then
212838b41dabSmrg    # scrape the doxygen version
212938b41dabSmrg    AC_MSG_CHECKING([the doxygen version])
213038b41dabSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213138b41dabSmrg    AC_MSG_RESULT([$doxygen_version])
213238b41dabSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213338b41dabSmrg        [if test "x$use_doxygen" = xauto; then
213438b41dabSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213538b41dabSmrg            have_doxygen=no
213638b41dabSmrg        else
213738b41dabSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213838b41dabSmrg        fi])
213938b41dabSmrgfi])
214038b41dabSmrg
214138b41dabSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214238b41dabSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214338b41dabSmrgdnl 	HAVE_DOT = @HAVE_DOT@
214438b41dabSmrgHAVE_DOT=no
214538b41dabSmrgif test "x$have_doxygen" = "xyes"; then
214638b41dabSmrg  AC_PATH_PROG([DOT], [dot])
214738b41dabSmrg    if test "x$DOT" != "x"; then
214838b41dabSmrg      HAVE_DOT=yes
214938b41dabSmrg    fi
215038b41dabSmrgfi
215138b41dabSmrg
215238b41dabSmrgAC_SUBST([HAVE_DOT])
215338b41dabSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215438b41dabSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215538b41dabSmrg]) # XORG_WITH_DOXYGEN
215638b41dabSmrg
215738b41dabSmrg# XORG_WITH_GROFF([DEFAULT])
215838b41dabSmrg# ----------------
215938b41dabSmrg# Minimum version: 1.6.0
216038b41dabSmrg# Minimum version for optional DEFAULT argument: 1.11.0
216138b41dabSmrg#
216238b41dabSmrg# Documentation tools are not always available on all platforms and sometimes
216338b41dabSmrg# not at the appropriate level. This macro enables a module to test for the
216438b41dabSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
216538b41dabSmrg# the --with-groff option, it allows maximum flexibility in making decisions
216638b41dabSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
216738b41dabSmrg# --with-groff assumes 'auto'.
216838b41dabSmrg#
216938b41dabSmrg# Interface to module:
217038b41dabSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217138b41dabSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217238b41dabSmrg# HAVE_GROFF_MS: the -ms macros package
217338b41dabSmrg# GROFF:	 returns the path of the groff program found
217438b41dabSmrg#		 returns the path set by the user in the environment
217538b41dabSmrg# --with-groff:	 'yes' user instructs the module to use groff
217638b41dabSmrg#		 'no' user instructs the module not to use groff
217738b41dabSmrg#
217838b41dabSmrg# Added in version 1.9.0:
217938b41dabSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
218038b41dabSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218138b41dabSmrg#		   psselect from the psutils package.
218238b41dabSmrg#		   the ghostcript package. Refer to the grohtml man pages
218338b41dabSmrg#
218438b41dabSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218538b41dabSmrg#
218638b41dabSmrg# OS and distros often splits groff in a basic and full package, the former
218738b41dabSmrg# having the groff program and the later having devices, fonts and macros
218838b41dabSmrg# Checking for the groff executable is not enough.
218938b41dabSmrg#
219038b41dabSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
219138b41dabSmrg# unset HAVE_GROFF or GROFF env variables.
219238b41dabSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219338b41dabSmrg#
219438b41dabSmrgAC_DEFUN([XORG_WITH_GROFF],[
219538b41dabSmrgAC_ARG_VAR([GROFF], [Path to groff command])
219638b41dabSmrgm4_define([_defopt], m4_default([$1], [auto]))
219738b41dabSmrgAC_ARG_WITH(groff,
219838b41dabSmrg	AS_HELP_STRING([--with-groff],
219938b41dabSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
220038b41dabSmrg	   [use_groff=$withval], [use_groff=]_defopt)
220138b41dabSmrgm4_undefine([_defopt])
220238b41dabSmrg
220338b41dabSmrgif test "x$use_groff" = x"auto"; then
220438b41dabSmrg   AC_PATH_PROG([GROFF], [groff])
220538b41dabSmrg   if test "x$GROFF" = "x"; then
220638b41dabSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220738b41dabSmrg	have_groff=no
220838b41dabSmrg   else
220938b41dabSmrg        have_groff=yes
221038b41dabSmrg   fi
221138b41dabSmrgelif test "x$use_groff" = x"yes" ; then
221238b41dabSmrg   AC_PATH_PROG([GROFF], [groff])
221338b41dabSmrg   if test "x$GROFF" = "x"; then
221438b41dabSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221538b41dabSmrg   fi
221638b41dabSmrg   have_groff=yes
221738b41dabSmrgelif test "x$use_groff" = x"no" ; then
221838b41dabSmrg   if test "x$GROFF" != "x"; then
221938b41dabSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
222038b41dabSmrg   fi
222138b41dabSmrg   have_groff=no
222238b41dabSmrgelse
222338b41dabSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222438b41dabSmrgfi
222538b41dabSmrg
222638b41dabSmrg# We have groff, test for the presence of the macro packages
222738b41dabSmrgif test "x$have_groff" = x"yes"; then
222838b41dabSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222938b41dabSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
223038b41dabSmrg        groff_ms_works=yes
223138b41dabSmrg    else
223238b41dabSmrg        groff_ms_works=no
223338b41dabSmrg    fi
223438b41dabSmrg    AC_MSG_RESULT([$groff_ms_works])
223538b41dabSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223638b41dabSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223738b41dabSmrg        groff_mm_works=yes
223838b41dabSmrg    else
223938b41dabSmrg        groff_mm_works=no
224038b41dabSmrg    fi
224138b41dabSmrg    AC_MSG_RESULT([$groff_mm_works])
224238b41dabSmrgfi
224338b41dabSmrg
224438b41dabSmrg# We have groff, test for HTML dependencies, one command per package
224538b41dabSmrgif test "x$have_groff" = x"yes"; then
224638b41dabSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224738b41dabSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224838b41dabSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224938b41dabSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
225038b41dabSmrg      have_groff_html=yes
225138b41dabSmrg   else
225238b41dabSmrg      have_groff_html=no
225338b41dabSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225438b41dabSmrg   fi
225538b41dabSmrgfi
225638b41dabSmrg
225738b41dabSmrg# Set Automake conditionals for Makefiles
225838b41dabSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225938b41dabSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
226038b41dabSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226138b41dabSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226238b41dabSmrg]) # XORG_WITH_GROFF
226338b41dabSmrg
226438b41dabSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226538b41dabSmrg# ---------------------------------------
226638b41dabSmrg# Minimum version: 1.6.0
226738b41dabSmrg# Minimum version for optional DEFAULT argument: 1.11.0
226838b41dabSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226938b41dabSmrg#
227038b41dabSmrg# Documentation tools are not always available on all platforms and sometimes
227138b41dabSmrg# not at the appropriate level. This macro enables a module to test for the
227238b41dabSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
227338b41dabSmrg# the --with-fop option, it allows maximum flexibility in making decisions
227438b41dabSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
227538b41dabSmrg# --with-fop assumes 'auto'.
227638b41dabSmrg#
227738b41dabSmrg# Interface to module:
227838b41dabSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227938b41dabSmrg# FOP:	 	returns the path of the fop program found
228038b41dabSmrg#		returns the path set by the user in the environment
228138b41dabSmrg# --with-fop: 	'yes' user instructs the module to use fop
228238b41dabSmrg#		'no' user instructs the module not to use fop
228338b41dabSmrg#
228438b41dabSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228538b41dabSmrg#
228638b41dabSmrgAC_DEFUN([XORG_WITH_FOP],[
228738b41dabSmrgAC_ARG_VAR([FOP], [Path to fop command])
228838b41dabSmrgm4_define([_defopt], m4_default([$2], [auto]))
228938b41dabSmrgAC_ARG_WITH(fop,
229038b41dabSmrg	AS_HELP_STRING([--with-fop],
229138b41dabSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229238b41dabSmrg	   [use_fop=$withval], [use_fop=]_defopt)
229338b41dabSmrgm4_undefine([_defopt])
229438b41dabSmrg
229538b41dabSmrgif test "x$use_fop" = x"auto"; then
229638b41dabSmrg   AC_PATH_PROG([FOP], [fop])
229738b41dabSmrg   if test "x$FOP" = "x"; then
229838b41dabSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229938b41dabSmrg	have_fop=no
230038b41dabSmrg   else
230138b41dabSmrg        have_fop=yes
230238b41dabSmrg   fi
230338b41dabSmrgelif test "x$use_fop" = x"yes" ; then
230438b41dabSmrg   AC_PATH_PROG([FOP], [fop])
230538b41dabSmrg   if test "x$FOP" = "x"; then
230638b41dabSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230738b41dabSmrg   fi
230838b41dabSmrg   have_fop=yes
230938b41dabSmrgelif test "x$use_fop" = x"no" ; then
231038b41dabSmrg   if test "x$FOP" != "x"; then
231138b41dabSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231238b41dabSmrg   fi
231338b41dabSmrg   have_fop=no
231438b41dabSmrgelse
231538b41dabSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
231638b41dabSmrgfi
231738b41dabSmrg
231838b41dabSmrg# Test for a minimum version of fop, if provided.
231938b41dabSmrgm4_ifval([$1],
232038b41dabSmrg[if test "$have_fop" = yes; then
232138b41dabSmrg    # scrape the fop version
232238b41dabSmrg    AC_MSG_CHECKING([for fop minimum version])
232338b41dabSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232438b41dabSmrg    AC_MSG_RESULT([$fop_version])
232538b41dabSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
232638b41dabSmrg        [if test "x$use_fop" = xauto; then
232738b41dabSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232838b41dabSmrg            have_fop=no
232938b41dabSmrg        else
233038b41dabSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233138b41dabSmrg        fi])
233238b41dabSmrgfi])
233338b41dabSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233438b41dabSmrg]) # XORG_WITH_FOP
233538b41dabSmrg
233638b41dabSmrg# XORG_WITH_M4([MIN-VERSION])
233738b41dabSmrg# ---------------------------
233838b41dabSmrg# Minimum version: 1.19.0
233938b41dabSmrg#
234038b41dabSmrg# This macro attempts to locate an m4 macro processor which supports
234138b41dabSmrg# -I option and is only useful for modules relying on M4 in order to
234238b41dabSmrg# expand macros in source code files.
234338b41dabSmrg#
234438b41dabSmrg# Interface to module:
234538b41dabSmrg# M4:	 	returns the path of the m4 program found
234638b41dabSmrg#		returns the path set by the user in the environment
234738b41dabSmrg#
234838b41dabSmrgAC_DEFUN([XORG_WITH_M4], [
234938b41dabSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
235038b41dabSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235138b41dabSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235238b41dabSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235338b41dabSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235438b41dabSmrg   [$PATH:/usr/gnu/bin])])
235538b41dabSmrg
235638b41dabSmrgAC_SUBST([M4], [$ac_cv_path_M4])
235738b41dabSmrg]) # XORG_WITH_M4
235838b41dabSmrg
235938b41dabSmrg# XORG_WITH_PS2PDF([DEFAULT])
236038b41dabSmrg# ----------------
236138b41dabSmrg# Minimum version: 1.6.0
236238b41dabSmrg# Minimum version for optional DEFAULT argument: 1.11.0
236338b41dabSmrg#
236438b41dabSmrg# Documentation tools are not always available on all platforms and sometimes
236538b41dabSmrg# not at the appropriate level. This macro enables a module to test for the
236638b41dabSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
236738b41dabSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
236838b41dabSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236938b41dabSmrg# --with-ps2pdf assumes 'auto'.
237038b41dabSmrg#
237138b41dabSmrg# Interface to module:
237238b41dabSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237338b41dabSmrg# PS2PDF:	returns the path of the ps2pdf program found
237438b41dabSmrg#		returns the path set by the user in the environment
237538b41dabSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237638b41dabSmrg#		 'no' user instructs the module not to use ps2pdf
237738b41dabSmrg#
237838b41dabSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237938b41dabSmrg#
238038b41dabSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238138b41dabSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238238b41dabSmrgm4_define([_defopt], m4_default([$1], [auto]))
238338b41dabSmrgAC_ARG_WITH(ps2pdf,
238438b41dabSmrg	AS_HELP_STRING([--with-ps2pdf],
238538b41dabSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238638b41dabSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238738b41dabSmrgm4_undefine([_defopt])
238838b41dabSmrg
238938b41dabSmrgif test "x$use_ps2pdf" = x"auto"; then
239038b41dabSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239138b41dabSmrg   if test "x$PS2PDF" = "x"; then
239238b41dabSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239338b41dabSmrg	have_ps2pdf=no
239438b41dabSmrg   else
239538b41dabSmrg        have_ps2pdf=yes
239638b41dabSmrg   fi
239738b41dabSmrgelif test "x$use_ps2pdf" = x"yes" ; then
239838b41dabSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239938b41dabSmrg   if test "x$PS2PDF" = "x"; then
240038b41dabSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240138b41dabSmrg   fi
240238b41dabSmrg   have_ps2pdf=yes
240338b41dabSmrgelif test "x$use_ps2pdf" = x"no" ; then
240438b41dabSmrg   if test "x$PS2PDF" != "x"; then
240538b41dabSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240638b41dabSmrg   fi
240738b41dabSmrg   have_ps2pdf=no
240838b41dabSmrgelse
240938b41dabSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
241038b41dabSmrgfi
241138b41dabSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241238b41dabSmrg]) # XORG_WITH_PS2PDF
241338b41dabSmrg
241438b41dabSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
241538b41dabSmrg# ----------------
241638b41dabSmrg# Minimum version: 1.6.0
241738b41dabSmrg#
241838b41dabSmrg# Documentation tools are not always available on all platforms and sometimes
241938b41dabSmrg# not at the appropriate level. This macro enables a builder to skip all
242038b41dabSmrg# documentation targets except traditional man pages.
242138b41dabSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242238b41dabSmrg# maximum flexibility in controlling documentation building.
242338b41dabSmrg# Refer to:
242438b41dabSmrg# XORG_WITH_XMLTO         --with-xmlto
242538b41dabSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242638b41dabSmrg# XORG_WITH_DOXYGEN       --with-doxygen
242738b41dabSmrg# XORG_WITH_FOP           --with-fop
242838b41dabSmrg# XORG_WITH_GROFF         --with-groff
242938b41dabSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
243038b41dabSmrg#
243138b41dabSmrg# Interface to module:
243238b41dabSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243338b41dabSmrg# --enable-docs: 'yes' user instructs the module to generate docs
243438b41dabSmrg#		 'no' user instructs the module not to generate docs
243538b41dabSmrg# parm1:	specify the default value, yes or no.
243638b41dabSmrg#
243738b41dabSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243838b41dabSmrgm4_define([docs_default], m4_default([$1], [yes]))
243938b41dabSmrgAC_ARG_ENABLE(docs,
244038b41dabSmrg	AS_HELP_STRING([--enable-docs],
244138b41dabSmrg	   [Enable building the documentation (default: ]docs_default[)]),
244238b41dabSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
244338b41dabSmrgm4_undefine([docs_default])
244438b41dabSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244538b41dabSmrgAC_MSG_CHECKING([whether to build documentation])
244638b41dabSmrgAC_MSG_RESULT([$build_docs])
244738b41dabSmrg]) # XORG_ENABLE_DOCS
244838b41dabSmrg
244938b41dabSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
245038b41dabSmrg# ----------------
245138b41dabSmrg# Minimum version: 1.6.0
245238b41dabSmrg#
245338b41dabSmrg# This macro enables a builder to skip all developer documentation.
245438b41dabSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245538b41dabSmrg# maximum flexibility in controlling documentation building.
245638b41dabSmrg# Refer to:
245738b41dabSmrg# XORG_WITH_XMLTO         --with-xmlto
245838b41dabSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245938b41dabSmrg# XORG_WITH_DOXYGEN       --with-doxygen
246038b41dabSmrg# XORG_WITH_FOP           --with-fop
246138b41dabSmrg# XORG_WITH_GROFF         --with-groff
246238b41dabSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
246338b41dabSmrg#
246438b41dabSmrg# Interface to module:
246538b41dabSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246638b41dabSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246738b41dabSmrg#			'no' user instructs the module not to generate developer docs
246838b41dabSmrg# parm1:		specify the default value, yes or no.
246938b41dabSmrg#
247038b41dabSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247138b41dabSmrgm4_define([devel_default], m4_default([$1], [yes]))
247238b41dabSmrgAC_ARG_ENABLE(devel-docs,
247338b41dabSmrg	AS_HELP_STRING([--enable-devel-docs],
247438b41dabSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247538b41dabSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247638b41dabSmrgm4_undefine([devel_default])
247738b41dabSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247838b41dabSmrgAC_MSG_CHECKING([whether to build developer documentation])
247938b41dabSmrgAC_MSG_RESULT([$build_devel_docs])
248038b41dabSmrg]) # XORG_ENABLE_DEVEL_DOCS
248138b41dabSmrg
248238b41dabSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
248338b41dabSmrg# ----------------
248438b41dabSmrg# Minimum version: 1.6.0
248538b41dabSmrg#
248638b41dabSmrg# This macro enables a builder to skip all functional specification targets.
248738b41dabSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248838b41dabSmrg# maximum flexibility in controlling documentation building.
248938b41dabSmrg# Refer to:
249038b41dabSmrg# XORG_WITH_XMLTO         --with-xmlto
249138b41dabSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249238b41dabSmrg# XORG_WITH_DOXYGEN       --with-doxygen
249338b41dabSmrg# XORG_WITH_FOP           --with-fop
249438b41dabSmrg# XORG_WITH_GROFF         --with-groff
249538b41dabSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
249638b41dabSmrg#
249738b41dabSmrg# Interface to module:
249838b41dabSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249938b41dabSmrg# --enable-specs:	'yes' user instructs the module to generate specs
250038b41dabSmrg#			'no' user instructs the module not to generate specs
250138b41dabSmrg# parm1:		specify the default value, yes or no.
250238b41dabSmrg#
250338b41dabSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250438b41dabSmrgm4_define([spec_default], m4_default([$1], [yes]))
250538b41dabSmrgAC_ARG_ENABLE(specs,
250638b41dabSmrg	AS_HELP_STRING([--enable-specs],
250738b41dabSmrg	   [Enable building the specs (default: ]spec_default[)]),
250838b41dabSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
250938b41dabSmrgm4_undefine([spec_default])
251038b41dabSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251138b41dabSmrgAC_MSG_CHECKING([whether to build functional specifications])
251238b41dabSmrgAC_MSG_RESULT([$build_specs])
251338b41dabSmrg]) # XORG_ENABLE_SPECS
251438b41dabSmrg
251538b41dabSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251638b41dabSmrg# ----------------------------------------------
251738b41dabSmrg# Minimum version: 1.13.0
251838b41dabSmrg#
251938b41dabSmrg# This macro enables a builder to enable/disable unit testing
252038b41dabSmrg# It makes no assumption about the test cases implementation
252138b41dabSmrg# Test cases may or may not use Automake "Support for test suites"
252238b41dabSmrg# They may or may not use the software utility library GLib
252338b41dabSmrg#
252438b41dabSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252538b41dabSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252638b41dabSmrg# The variable enable_unit_tests is used by other macros in this file.
252738b41dabSmrg#
252838b41dabSmrg# Interface to module:
252938b41dabSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
253038b41dabSmrg# enable_unit_tests:    used in configure.ac for additional configuration
253138b41dabSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253238b41dabSmrg#			'no' user instructs the module not to build tests
253338b41dabSmrg# parm1:		specify the default value, yes or no.
253438b41dabSmrg#
253538b41dabSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253638b41dabSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253738b41dabSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253838b41dabSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253938b41dabSmrgm4_define([_defopt], m4_default([$1], [auto]))
254038b41dabSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254138b41dabSmrg	[Enable building unit test cases (default: ]_defopt[)]),
254238b41dabSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254338b41dabSmrgm4_undefine([_defopt])
254438b41dabSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254538b41dabSmrgAC_MSG_CHECKING([whether to build unit test cases])
254638b41dabSmrgAC_MSG_RESULT([$enable_unit_tests])
254738b41dabSmrg]) # XORG_ENABLE_UNIT_TESTS
254838b41dabSmrg
254938b41dabSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
255038b41dabSmrg# ------------------------------------------------------
255138b41dabSmrg# Minimum version: 1.17.0
255238b41dabSmrg#
255338b41dabSmrg# This macro enables a builder to enable/disable integration testing
255438b41dabSmrg# It makes no assumption about the test cases' implementation
255538b41dabSmrg# Test cases may or may not use Automake "Support for test suites"
255638b41dabSmrg#
255738b41dabSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255838b41dabSmrg# usually requires less dependencies and may be built and run under less
255938b41dabSmrg# stringent environments than integration tests.
256038b41dabSmrg#
256138b41dabSmrg# Interface to module:
256238b41dabSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256338b41dabSmrg# enable_integration_tests:   used in configure.ac for additional configuration
256438b41dabSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256538b41dabSmrg#                             'no' user instructs the module not to build tests
256638b41dabSmrg# parm1:                      specify the default value, yes or no.
256738b41dabSmrg#
256838b41dabSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256938b41dabSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
257038b41dabSmrgm4_define([_defopt], m4_default([$1], [auto]))
257138b41dabSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257238b41dabSmrg	[Enable building integration test cases (default: ]_defopt[)]),
257338b41dabSmrg	[enable_integration_tests=$enableval],
257438b41dabSmrg	[enable_integration_tests=]_defopt)
257538b41dabSmrgm4_undefine([_defopt])
257638b41dabSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257738b41dabSmrg	[test "x$enable_integration_tests" != xno])
257838b41dabSmrgAC_MSG_CHECKING([whether to build unit test cases])
257938b41dabSmrgAC_MSG_RESULT([$enable_integration_tests])
258038b41dabSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
258138b41dabSmrg
258238b41dabSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258338b41dabSmrg# ----------------------------------------
258438b41dabSmrg# Minimum version: 1.13.0
258538b41dabSmrg#
258638b41dabSmrg# GLib is a library which provides advanced data structures and functions.
258738b41dabSmrg# This macro enables a module to test for the presence of Glib.
258838b41dabSmrg#
258938b41dabSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
259038b41dabSmrg# Otherwise the value of $enable_unit_tests is blank.
259138b41dabSmrg#
259238b41dabSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259338b41dabSmrg# test support usually requires less dependencies and may be built and run under
259438b41dabSmrg# less stringent environments than integration tests.
259538b41dabSmrg#
259638b41dabSmrg# Interface to module:
259738b41dabSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
259838b41dabSmrg# with_glib: used in configure.ac to know if GLib has been found
259938b41dabSmrg# --with-glib:	'yes' user instructs the module to use glib
260038b41dabSmrg#		'no' user instructs the module not to use glib
260138b41dabSmrg#
260238b41dabSmrgAC_DEFUN([XORG_WITH_GLIB],[
260338b41dabSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260438b41dabSmrgm4_define([_defopt], m4_default([$2], [auto]))
260538b41dabSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260638b41dabSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260738b41dabSmrg	[with_glib=$withval], [with_glib=]_defopt)
260838b41dabSmrgm4_undefine([_defopt])
260938b41dabSmrg
261038b41dabSmrghave_glib=no
261138b41dabSmrg# Do not probe GLib if user explicitly disabled unit testing
261238b41dabSmrgif test "x$enable_unit_tests" != x"no"; then
261338b41dabSmrg  # Do not probe GLib if user explicitly disabled it
261438b41dabSmrg  if test "x$with_glib" != x"no"; then
261538b41dabSmrg    m4_ifval(
261638b41dabSmrg      [$1],
261738b41dabSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261838b41dabSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261938b41dabSmrg    )
262038b41dabSmrg  fi
262138b41dabSmrgfi
262238b41dabSmrg
262338b41dabSmrg# Not having GLib when unit testing has been explicitly requested is an error
262438b41dabSmrgif test "x$enable_unit_tests" = x"yes"; then
262538b41dabSmrg  if test "x$have_glib" = x"no"; then
262638b41dabSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
262738b41dabSmrg  fi
262838b41dabSmrgfi
262938b41dabSmrg
263038b41dabSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
263138b41dabSmrgif test "x$enable_unit_tests" = x"no"; then
263238b41dabSmrg  if test "x$with_glib" = x"yes"; then
263338b41dabSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263438b41dabSmrg  fi
263538b41dabSmrgfi
263638b41dabSmrg
263738b41dabSmrg# Not having GLib when it has been explicitly requested is an error
263838b41dabSmrgif test "x$with_glib" = x"yes"; then
263938b41dabSmrg  if test "x$have_glib" = x"no"; then
264038b41dabSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264138b41dabSmrg  fi
264238b41dabSmrgfi
264338b41dabSmrg
264438b41dabSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264538b41dabSmrg]) # XORG_WITH_GLIB
264638b41dabSmrg
264738b41dabSmrg# XORG_LD_WRAP([required|optional])
264838b41dabSmrg# ---------------------------------
264938b41dabSmrg# Minimum version: 1.13.0
265038b41dabSmrg#
265138b41dabSmrg# Check if linker supports -wrap, passed via compiler flags
265238b41dabSmrg#
265338b41dabSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265438b41dabSmrg# Otherwise the value of $enable_unit_tests is blank.
265538b41dabSmrg#
265638b41dabSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265738b41dabSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265838b41dabSmrg# available, an argument of "optional" allows use when some unit tests require
265938b41dabSmrg# ld -wrap and others do not.
266038b41dabSmrg#
266138b41dabSmrgAC_DEFUN([XORG_LD_WRAP],[
266238b41dabSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266338b41dabSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266438b41dabSmrg                      void __wrap_exit(int status) { return; }],
266538b41dabSmrg                     [exit(0);])])
266638b41dabSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
266738b41dabSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266838b41dabSmrg  if test "x$have_ld_wrap" = x"no"; then
266938b41dabSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
267038b41dabSmrg  fi
267138b41dabSmrgfi
267238b41dabSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267338b41dabSmrg#
267438b41dabSmrg]) # XORG_LD_WRAP
267538b41dabSmrg
267638b41dabSmrg# XORG_CHECK_LINKER_FLAGS
267738b41dabSmrg# -----------------------
267838b41dabSmrg# SYNOPSIS
267938b41dabSmrg#
268038b41dabSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268138b41dabSmrg#
268238b41dabSmrg# DESCRIPTION
268338b41dabSmrg#
268438b41dabSmrg#   Check whether the given linker FLAGS work with the current language's
268538b41dabSmrg#   linker, or whether they give an error.
268638b41dabSmrg#
268738b41dabSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268838b41dabSmrg#   success/failure.
268938b41dabSmrg#
269038b41dabSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
269138b41dabSmrg#
269238b41dabSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269338b41dabSmrg#
269438b41dabSmrg# LICENSE
269538b41dabSmrg#
269638b41dabSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269738b41dabSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269838b41dabSmrg#   Copyright (c) 2009 Matteo Frigo
269938b41dabSmrg#
270038b41dabSmrg#   This program is free software: you can redistribute it and/or modify it
270138b41dabSmrg#   under the terms of the GNU General Public License as published by the
270238b41dabSmrg#   Free Software Foundation, either version 3 of the License, or (at your
270338b41dabSmrg#   option) any later version.
270438b41dabSmrg#
270538b41dabSmrg#   This program is distributed in the hope that it will be useful, but
270638b41dabSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270738b41dabSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270838b41dabSmrg#   Public License for more details.
270938b41dabSmrg#
271038b41dabSmrg#   You should have received a copy of the GNU General Public License along
271138b41dabSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271238b41dabSmrg#
271338b41dabSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
271438b41dabSmrg#   gives unlimited permission to copy, distribute and modify the configure
271538b41dabSmrg#   scripts that are the output of Autoconf when processing the Macro. You
271638b41dabSmrg#   need not follow the terms of the GNU General Public License when using
271738b41dabSmrg#   or distributing such scripts, even though portions of the text of the
271838b41dabSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271938b41dabSmrg#   all other use of the material that constitutes the Autoconf Macro.
272038b41dabSmrg#
272138b41dabSmrg#   This special exception to the GPL applies to versions of the Autoconf
272238b41dabSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
272338b41dabSmrg#   modified version of the Autoconf Macro, you may extend this special
272438b41dabSmrg#   exception to the GPL to apply to your modified version as well.#
272538b41dabSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272638b41dabSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
272738b41dabSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272838b41dabSmrgAS_LITERAL_IF([$1],
272938b41dabSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
273038b41dabSmrg      ax_save_FLAGS=$LDFLAGS
273138b41dabSmrg      LDFLAGS="$1"
273238b41dabSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273338b41dabSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273438b41dabSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273538b41dabSmrg      LDFLAGS=$ax_save_FLAGS])],
273638b41dabSmrg  [ax_save_FLAGS=$LDFLAGS
273738b41dabSmrg   LDFLAGS="$1"
273838b41dabSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273938b41dabSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
274038b41dabSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274138b41dabSmrg   LDFLAGS=$ax_save_FLAGS])
274238b41dabSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274338b41dabSmrgAC_MSG_RESULT($xorg_check_linker_flags)
274438b41dabSmrgif test "x$xorg_check_linker_flags" = xyes; then
274538b41dabSmrg	m4_default([$2], :)
274638b41dabSmrgelse
274738b41dabSmrg	m4_default([$3], :)
274838b41dabSmrgfi
274938b41dabSmrg]) # XORG_CHECK_LINKER_FLAGS
275038b41dabSmrg
275138b41dabSmrg# XORG_MEMORY_CHECK_FLAGS
275238b41dabSmrg# -----------------------
275338b41dabSmrg# Minimum version: 1.16.0
275438b41dabSmrg#
275538b41dabSmrg# This macro attempts to find appropriate memory checking functionality
275638b41dabSmrg# for various platforms which unit testing code may use to catch various
275738b41dabSmrg# forms of memory allocation and access errors in testing.
275838b41dabSmrg#
275938b41dabSmrg# Interface to module:
276038b41dabSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276138b41dabSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276238b41dabSmrg#
276338b41dabSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276438b41dabSmrg#
276538b41dabSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
276638b41dabSmrg
276738b41dabSmrgAC_REQUIRE([AC_CANONICAL_HOST])
276838b41dabSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276938b41dabSmrg           [Environment variables to enable memory checking in tests])
277038b41dabSmrg
277138b41dabSmrg# Check for different types of support on different platforms
277238b41dabSmrgcase $host_os in
277338b41dabSmrg    solaris*)
277438b41dabSmrg        AC_CHECK_LIB([umem], [umem_alloc],
277538b41dabSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277638b41dabSmrg        ;;
277738b41dabSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277838b41dabSmrg        # both directly and inverted, so should not be 0 or 255.
277938b41dabSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
278038b41dabSmrg        ;;
278138b41dabSmrg    darwin*)
278238b41dabSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278338b41dabSmrg        ;;
278438b41dabSmrg    *bsd*)
278538b41dabSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278638b41dabSmrg        ;;
278738b41dabSmrgesac
278838b41dabSmrg
278938b41dabSmrg# User supplied flags override default flags
279038b41dabSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279138b41dabSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
279238b41dabSmrgfi
279338b41dabSmrg
279438b41dabSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279538b41dabSmrg]) # XORG_WITH_LINT
279638b41dabSmrg
279738b41dabSmrg# XORG_CHECK_MALLOC_ZERO
279838b41dabSmrg# ----------------------
279938b41dabSmrg# Minimum version: 1.0.0
280038b41dabSmrg#
280138b41dabSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280238b41dabSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280338b41dabSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280438b41dabSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280538b41dabSmrgAC_ARG_ENABLE(malloc0returnsnull,
280638b41dabSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280738b41dabSmrg		       [malloc(0) returns NULL (default: auto)]),
280838b41dabSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280938b41dabSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
281038b41dabSmrg
281138b41dabSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281238b41dabSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281338b41dabSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281438b41dabSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281538b41dabSmrg#include <stdlib.h>
281638b41dabSmrg],[
281738b41dabSmrg    char *m0, *r0, *c0, *p;
281838b41dabSmrg    m0 = malloc(0);
281938b41dabSmrg    p = malloc(10);
282038b41dabSmrg    r0 = realloc(p,0);
282138b41dabSmrg    c0 = calloc(0,10);
282238b41dabSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282338b41dabSmrg])],
282438b41dabSmrg		[xorg_cv_malloc0_returns_null=yes],
282538b41dabSmrg		[xorg_cv_malloc0_returns_null=no])])
282638b41dabSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
282738b41dabSmrgfi
282838b41dabSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
282938b41dabSmrg
283038b41dabSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283138b41dabSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283238b41dabSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283338b41dabSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
283438b41dabSmrgelse
283538b41dabSmrg	MALLOC_ZERO_CFLAGS=""
283638b41dabSmrg	XMALLOC_ZERO_CFLAGS=""
283738b41dabSmrg	XTMALLOC_ZERO_CFLAGS=""
283838b41dabSmrgfi
283938b41dabSmrg
284038b41dabSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284138b41dabSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284238b41dabSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284338b41dabSmrg]) # XORG_CHECK_MALLOC_ZERO
284438b41dabSmrg
284538b41dabSmrg# XORG_WITH_LINT()
284638b41dabSmrg# ----------------
284738b41dabSmrg# Minimum version: 1.1.0
284838b41dabSmrg#
284938b41dabSmrg# This macro enables the use of a tool that flags some suspicious and
285038b41dabSmrg# non-portable constructs (likely to be bugs) in C language source code.
285138b41dabSmrg# It will attempt to locate the tool and use appropriate options.
285238b41dabSmrg# There are various lint type tools on different platforms.
285338b41dabSmrg#
285438b41dabSmrg# Interface to module:
285538b41dabSmrg# LINT:		returns the path to the tool found on the platform
285638b41dabSmrg#		or the value set to LINT on the configure cmd line
285738b41dabSmrg#		also an Automake conditional
285838b41dabSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
285938b41dabSmrg#
286038b41dabSmrg# --with-lint:	'yes' user instructs the module to use lint
286138b41dabSmrg#		'no' user instructs the module not to use lint (default)
286238b41dabSmrg#
286338b41dabSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286438b41dabSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286538b41dabSmrg#
286638b41dabSmrgAC_DEFUN([XORG_WITH_LINT],[
286738b41dabSmrg
286838b41dabSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286938b41dabSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
287038b41dabSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287138b41dabSmrg		[Use a lint-style source code checker (default: disabled)])],
287238b41dabSmrg		[use_lint=$withval], [use_lint=no])
287338b41dabSmrg
287438b41dabSmrg# Obtain platform specific info like program name and options
287538b41dabSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287638b41dabSmrgcase $host_os in
287738b41dabSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287838b41dabSmrg	lint_name=splint
287938b41dabSmrg	lint_options="-badflag"
288038b41dabSmrg	;;
288138b41dabSmrg  *freebsd* | *netbsd*)
288238b41dabSmrg	lint_name=lint
288338b41dabSmrg	lint_options="-u -b"
288438b41dabSmrg	;;
288538b41dabSmrg  *solaris*)
288638b41dabSmrg	lint_name=lint
288738b41dabSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288838b41dabSmrg	;;
288938b41dabSmrgesac
289038b41dabSmrg
289138b41dabSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289238b41dabSmrgif test "x$use_lint" = x"yes" ; then
289338b41dabSmrg   AC_PATH_PROG([LINT], [$lint_name])
289438b41dabSmrg   if test "x$LINT" = "x"; then
289538b41dabSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289638b41dabSmrg   fi
289738b41dabSmrgelif test "x$use_lint" = x"no" ; then
289838b41dabSmrg   if test "x$LINT" != "x"; then
289938b41dabSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
290038b41dabSmrg   fi
290138b41dabSmrgelse
290238b41dabSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
290338b41dabSmrgfi
290438b41dabSmrg
290538b41dabSmrg# User supplied flags override default flags
290638b41dabSmrgif test "x$LINT_FLAGS" != "x"; then
290738b41dabSmrg   lint_options=$LINT_FLAGS
290838b41dabSmrgfi
290938b41dabSmrg
291038b41dabSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291138b41dabSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
291238b41dabSmrg
291338b41dabSmrg]) # XORG_WITH_LINT
291438b41dabSmrg
291538b41dabSmrg# XORG_LINT_LIBRARY(LIBNAME)
291638b41dabSmrg# --------------------------
291738b41dabSmrg# Minimum version: 1.1.0
291838b41dabSmrg#
291938b41dabSmrg# Sets up flags for building lint libraries for checking programs that call
292038b41dabSmrg# functions in the library.
292138b41dabSmrg#
292238b41dabSmrg# Interface to module:
292338b41dabSmrg# LINTLIB		- Automake variable with the name of lint library file to make
292438b41dabSmrg# MAKE_LINT_LIB		- Automake conditional
292538b41dabSmrg#
292638b41dabSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292738b41dabSmrg#			  - 'no' user instructs the module not to create a lint library (default)
292838b41dabSmrg
292938b41dabSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
293038b41dabSmrgAC_REQUIRE([XORG_WITH_LINT])
293138b41dabSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293238b41dabSmrg	[Create lint library (default: disabled)])],
293338b41dabSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293438b41dabSmrg
293538b41dabSmrgif test "x$make_lint_lib" = x"yes" ; then
293638b41dabSmrg   LINTLIB=llib-l$1.ln
293738b41dabSmrg   if test "x$LINT" = "x"; then
293838b41dabSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293938b41dabSmrg   fi
294038b41dabSmrgelif test "x$make_lint_lib" != x"no" ; then
294138b41dabSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
294238b41dabSmrgfi
294338b41dabSmrg
294438b41dabSmrgAC_SUBST(LINTLIB)
294538b41dabSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
294638b41dabSmrg
294738b41dabSmrg]) # XORG_LINT_LIBRARY
294838b41dabSmrg
294938b41dabSmrg# XORG_COMPILER_BRAND
295038b41dabSmrg# -------------------
295138b41dabSmrg# Minimum version: 1.14.0
295238b41dabSmrg#
295338b41dabSmrg# Checks for various brands of compilers and sets flags as appropriate:
295438b41dabSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295538b41dabSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295638b41dabSmrg#   clang compiler - sets CLANGCC to "yes"
295738b41dabSmrg#   Intel compiler - sets INTELCC to "yes"
295838b41dabSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295938b41dabSmrg#
296038b41dabSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296138b41dabSmrgAC_LANG_CASE(
296238b41dabSmrg	[C], [
296338b41dabSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
296438b41dabSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
296538b41dabSmrg		m4_version_prereq([2.70],
296638b41dabSmrg			[AC_REQUIRE([AC_PROG_CC])],
296738b41dabSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
296838b41dabSmrg	],
296938b41dabSmrg	[C++], [
297038b41dabSmrg		AC_REQUIRE([AC_PROG_CXX])
297138b41dabSmrg	]
297238b41dabSmrg)
297338b41dabSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
297438b41dabSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297538b41dabSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297638b41dabSmrg]) # XORG_COMPILER_BRAND
297738b41dabSmrg
297838b41dabSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
297938b41dabSmrg# ---------------
298038b41dabSmrg# Minimum version: 1.16.0
298138b41dabSmrg#
298238b41dabSmrg# Test if the compiler works when passed the given flag as a command line argument.
298338b41dabSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
298438b41dabSmrg# next flag in the list until there are no more options.
298538b41dabSmrg#
298638b41dabSmrg# Note that this does not guarantee that the compiler supports the flag as some
298738b41dabSmrg# compilers will simply ignore arguments that they do not understand, but we do
298838b41dabSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298938b41dabSmrg# -Werror=unused-command-line-argument
299038b41dabSmrg#
299138b41dabSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
299238b41dabSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
299338b41dabSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
299438b41dabSmrg
299538b41dabSmrgAC_LANG_COMPILER_REQUIRE
299638b41dabSmrg
299738b41dabSmrgAC_LANG_CASE(
299838b41dabSmrg	[C], [
299938b41dabSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
300038b41dabSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
300138b41dabSmrg		m4_version_prereq([2.70],
300238b41dabSmrg			[AC_REQUIRE([AC_PROG_CC])],
300338b41dabSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
300438b41dabSmrg		define([PREFIX], [C])
300538b41dabSmrg		define([CACHE_PREFIX], [cc])
300638b41dabSmrg		define([COMPILER], [$CC])
300738b41dabSmrg	],
300838b41dabSmrg	[C++], [
300938b41dabSmrg		define([PREFIX], [CXX])
301038b41dabSmrg		define([CACHE_PREFIX], [cxx])
301138b41dabSmrg		define([COMPILER], [$CXX])
301238b41dabSmrg	]
301338b41dabSmrg)
301438b41dabSmrg
301538b41dabSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
301638b41dabSmrg
301738b41dabSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
301838b41dabSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301938b41dabSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
302038b41dabSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
302138b41dabSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302238b41dabSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
302338b41dabSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
302438b41dabSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
302538b41dabSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
302638b41dabSmrgfi
302738b41dabSmrg
302838b41dabSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302938b41dabSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
303038b41dabSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303138b41dabSmrg	fi
303238b41dabSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
303338b41dabSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
303438b41dabSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
303538b41dabSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
303638b41dabSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
303738b41dabSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
303838b41dabSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303938b41dabSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
304038b41dabSmrgfi
304138b41dabSmrg
304238b41dabSmrgfound="no"
304338b41dabSmrgm4_foreach([flag], m4_cdr($@), [
304438b41dabSmrg	if test $found = "no" ; then
304538b41dabSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
304638b41dabSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
304738b41dabSmrg		fi
304838b41dabSmrg
304938b41dabSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
305038b41dabSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
305138b41dabSmrg		fi
305238b41dabSmrg
305338b41dabSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
305438b41dabSmrg
305538b41dabSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
305638b41dabSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
305738b41dabSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
305838b41dabSmrg		AC_CACHE_VAL($cacheid,
305938b41dabSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
306038b41dabSmrg					     [eval $cacheid=yes],
306138b41dabSmrg					     [eval $cacheid=no])])
306238b41dabSmrg
306338b41dabSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
306438b41dabSmrg
306538b41dabSmrg		eval supported=\$$cacheid
306638b41dabSmrg		AC_MSG_RESULT([$supported])
306738b41dabSmrg		if test "$supported" = "yes" ; then
306838b41dabSmrg			$1="$$1 ]flag["
306938b41dabSmrg			found="yes"
307038b41dabSmrg		fi
307138b41dabSmrg	fi
307238b41dabSmrg])
307338b41dabSmrg]) # XORG_TESTSET_CFLAG
307438b41dabSmrg
307538b41dabSmrg# XORG_COMPILER_FLAGS
307638b41dabSmrg# ---------------
307738b41dabSmrg# Minimum version: 1.16.0
307838b41dabSmrg#
307938b41dabSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
308038b41dabSmrg# arguments supported by the selected compiler which do NOT alter the generated
308138b41dabSmrg# code.  These arguments will cause the compiler to print various warnings
308238b41dabSmrg# during compilation AND turn a conservative set of warnings into errors.
308338b41dabSmrg#
308438b41dabSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
308538b41dabSmrg# future versions of util-macros as options are added to new compilers.
308638b41dabSmrg#
308738b41dabSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
308838b41dabSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
308938b41dabSmrg
309038b41dabSmrgAC_ARG_ENABLE(selective-werror,
309138b41dabSmrg              AS_HELP_STRING([--disable-selective-werror],
309238b41dabSmrg                             [Turn off selective compiler errors. (default: enabled)]),
309338b41dabSmrg              [SELECTIVE_WERROR=$enableval],
309438b41dabSmrg              [SELECTIVE_WERROR=yes])
309538b41dabSmrg
309638b41dabSmrgAC_LANG_CASE(
309738b41dabSmrg        [C], [
309838b41dabSmrg                define([PREFIX], [C])
309938b41dabSmrg        ],
310038b41dabSmrg        [C++], [
310138b41dabSmrg                define([PREFIX], [CXX])
310238b41dabSmrg        ]
310338b41dabSmrg)
310438b41dabSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
310538b41dabSmrgif test "x$SUNCC" = "xyes"; then
310638b41dabSmrg    [BASE_]PREFIX[FLAGS]="-v"
310738b41dabSmrgelse
310838b41dabSmrg    [BASE_]PREFIX[FLAGS]=""
310938b41dabSmrgfi
311038b41dabSmrg
311138b41dabSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
311238b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
311338b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
311438b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
311538b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
311638b41dabSmrg
311738b41dabSmrgAC_LANG_CASE(
311838b41dabSmrg	[C], [
311938b41dabSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
312038b41dabSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
312138b41dabSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
312238b41dabSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
312338b41dabSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
312438b41dabSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
312538b41dabSmrg	]
312638b41dabSmrg)
312738b41dabSmrg
312838b41dabSmrg# This chunk adds additional warnings that could catch undesired effects.
312938b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
313038b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
313138b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
313238b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
313338b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
313438b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
313538b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
313638b41dabSmrg
313738b41dabSmrg# These are currently disabled because they are noisy.  They will be enabled
313838b41dabSmrg# in the future once the codebase is sufficiently modernized to silence
313938b41dabSmrg# them.  For now, I don't want them to drown out the other warnings.
314038b41dabSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
314138b41dabSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
314238b41dabSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
314338b41dabSmrg
314438b41dabSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
314538b41dabSmrg# when there are problems that should be fixed.
314638b41dabSmrg
314738b41dabSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
314838b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314938b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
315038b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
315138b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
315238b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
315338b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
315438b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
315538b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
315638b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
315738b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
315838b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315938b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
316038b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
316138b41dabSmrgelse
316238b41dabSmrgAC_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])
316338b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
316438b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
316538b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
316638b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
316738b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
316838b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316938b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
317038b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
317138b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
317238b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
317338b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
317438b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
317538b41dabSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
317638b41dabSmrgfi
317738b41dabSmrg
317838b41dabSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317938b41dabSmrg]) # XORG_COMPILER_FLAGS
318038b41dabSmrg
318138b41dabSmrg# XORG_CWARNFLAGS
318238b41dabSmrg# ---------------
318338b41dabSmrg# Minimum version: 1.2.0
318438b41dabSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
318538b41dabSmrg#
318638b41dabSmrg# Defines CWARNFLAGS to enable C compiler warnings.
318738b41dabSmrg#
318838b41dabSmrg# This function is deprecated because it defines -fno-strict-aliasing
318938b41dabSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
319038b41dabSmrg# is needed, then it should be added explicitly in the module when
319138b41dabSmrg# it is updated to use BASE_CFLAGS.
319238b41dabSmrg#
319338b41dabSmrgAC_DEFUN([XORG_CWARNFLAGS], [
319438b41dabSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
319538b41dabSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
319638b41dabSmrgAC_LANG_CASE(
319738b41dabSmrg	[C], [
319838b41dabSmrg		CWARNFLAGS="$BASE_CFLAGS"
319938b41dabSmrg		if  test "x$GCC" = xyes ; then
320038b41dabSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
320138b41dabSmrg		fi
320238b41dabSmrg		AC_SUBST(CWARNFLAGS)
320338b41dabSmrg	]
320438b41dabSmrg)
320538b41dabSmrg]) # XORG_CWARNFLAGS
320638b41dabSmrg
320738b41dabSmrg# XORG_STRICT_OPTION
320838b41dabSmrg# -----------------------
320938b41dabSmrg# Minimum version: 1.3.0
321038b41dabSmrg#
321138b41dabSmrg# Add configure option to enable strict compilation flags, such as treating
321238b41dabSmrg# warnings as fatal errors.
321338b41dabSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
321438b41dabSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
321538b41dabSmrg#
321638b41dabSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
321738b41dabSmrg# when strict compilation is unconditionally desired.
321838b41dabSmrgAC_DEFUN([XORG_STRICT_OPTION], [
321938b41dabSmrgAC_REQUIRE([XORG_CWARNFLAGS])
322038b41dabSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
322138b41dabSmrg
322238b41dabSmrgAC_ARG_ENABLE(strict-compilation,
322338b41dabSmrg			  AS_HELP_STRING([--enable-strict-compilation],
322438b41dabSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
322538b41dabSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
322638b41dabSmrg
322738b41dabSmrgAC_LANG_CASE(
322838b41dabSmrg        [C], [
322938b41dabSmrg                define([PREFIX], [C])
323038b41dabSmrg        ],
323138b41dabSmrg        [C++], [
323238b41dabSmrg                define([PREFIX], [CXX])
323338b41dabSmrg        ]
323438b41dabSmrg)
323538b41dabSmrg
323638b41dabSmrg[STRICT_]PREFIX[FLAGS]=""
323738b41dabSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
323838b41dabSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
323938b41dabSmrg
324038b41dabSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
324138b41dabSmrg# activate it with -Werror, so we add it here explicitly.
324238b41dabSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
324338b41dabSmrg
324438b41dabSmrgif test "x$STRICT_COMPILE" = "xyes"; then
324538b41dabSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
324638b41dabSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
324738b41dabSmrgfi
324838b41dabSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324938b41dabSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
325038b41dabSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
325138b41dabSmrg]) # XORG_STRICT_OPTION
325238b41dabSmrg
325338b41dabSmrg# XORG_DEFAULT_NOCODE_OPTIONS
325438b41dabSmrg# ---------------------------
325538b41dabSmrg# Minimum version: 1.20.0
325638b41dabSmrg#
325738b41dabSmrg# Defines default options for X.Org modules which don't compile code,
325838b41dabSmrg# such as fonts, bitmaps, cursors, and docs.
325938b41dabSmrg#
326038b41dabSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
326138b41dabSmrgAC_REQUIRE([AC_PROG_INSTALL])
326238b41dabSmrgXORG_RELEASE_VERSION
326338b41dabSmrgXORG_CHANGELOG
326438b41dabSmrgXORG_INSTALL
326538b41dabSmrgXORG_MANPAGE_SECTIONS
326638b41dabSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326738b41dabSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
326838b41dabSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
326938b41dabSmrg
327038b41dabSmrg# XORG_DEFAULT_OPTIONS
327138b41dabSmrg# --------------------
327238b41dabSmrg# Minimum version: 1.3.0
327338b41dabSmrg#
327438b41dabSmrg# Defines default options for X.Org modules which compile code.
327538b41dabSmrg#
327638b41dabSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
327738b41dabSmrgAC_REQUIRE([AC_PROG_INSTALL])
327838b41dabSmrgXORG_COMPILER_FLAGS
327938b41dabSmrgXORG_CWARNFLAGS
328038b41dabSmrgXORG_STRICT_OPTION
328138b41dabSmrgXORG_DEFAULT_NOCODE_OPTIONS
328238b41dabSmrg]) # XORG_DEFAULT_OPTIONS
328338b41dabSmrg
328438b41dabSmrg# XORG_INSTALL()
328538b41dabSmrg# ----------------
328638b41dabSmrg# Minimum version: 1.4.0
328738b41dabSmrg#
328838b41dabSmrg# Defines the variable INSTALL_CMD as the command to copy
328938b41dabSmrg# INSTALL from $prefix/share/util-macros.
329038b41dabSmrg#
329138b41dabSmrgAC_DEFUN([XORG_INSTALL], [
329238b41dabSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
329338b41dabSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
329438b41dabSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
329538b41dabSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
329638b41dabSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
329738b41dabSmrgtouch \$(top_srcdir)/INSTALL; \
329838b41dabSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
329938b41dabSmrgAC_SUBST([INSTALL_CMD])
330038b41dabSmrg]) # XORG_INSTALL
330138b41dabSmrgdnl Copyright 2005 Red Hat, Inc
330238b41dabSmrgdnl
330338b41dabSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
330438b41dabSmrgdnl documentation for any purpose is hereby granted without fee, provided that
330538b41dabSmrgdnl the above copyright notice appear in all copies and that both that
330638b41dabSmrgdnl copyright notice and this permission notice appear in supporting
330738b41dabSmrgdnl documentation.
330838b41dabSmrgdnl
330938b41dabSmrgdnl The above copyright notice and this permission notice shall be included
331038b41dabSmrgdnl in all copies or substantial portions of the Software.
331138b41dabSmrgdnl
331238b41dabSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
331338b41dabSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
331438b41dabSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
331538b41dabSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
331638b41dabSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
331738b41dabSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
331838b41dabSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
331938b41dabSmrgdnl
332038b41dabSmrgdnl Except as contained in this notice, the name of the copyright holders shall
332138b41dabSmrgdnl not be used in advertising or otherwise to promote the sale, use or
332238b41dabSmrgdnl other dealings in this Software without prior written authorization
332338b41dabSmrgdnl from the copyright holders.
332438b41dabSmrgdnl
332538b41dabSmrg
332638b41dabSmrg# XORG_RELEASE_VERSION
332738b41dabSmrg# --------------------
332838b41dabSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
332938b41dabSmrg
333038b41dabSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
333138b41dabSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
333238b41dabSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
333338b41dabSmrg		[Major version of this package])
333438b41dabSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
333538b41dabSmrg	if test "x$PVM" = "x"; then
333638b41dabSmrg		PVM="0"
333738b41dabSmrg	fi
333838b41dabSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
333938b41dabSmrg		[$PVM],
334038b41dabSmrg		[Minor version of this package])
334138b41dabSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
334238b41dabSmrg	if test "x$PVP" = "x"; then
334338b41dabSmrg		PVP="0"
334438b41dabSmrg	fi
334538b41dabSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
334638b41dabSmrg		[$PVP],
334738b41dabSmrg		[Patch version of this package])
334838b41dabSmrg])
334938b41dabSmrg
335038b41dabSmrg# XORG_CHANGELOG()
335138b41dabSmrg# ----------------
335238b41dabSmrg# Minimum version: 1.2.0
335338b41dabSmrg#
335438b41dabSmrg# Defines the variable CHANGELOG_CMD as the command to generate
335538b41dabSmrg# ChangeLog from git.
335638b41dabSmrg#
335738b41dabSmrg#
335838b41dabSmrgAC_DEFUN([XORG_CHANGELOG], [
335938b41dabSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
336038b41dabSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
336138b41dabSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
336238b41dabSmrgtouch \$(top_srcdir)/ChangeLog; \
336338b41dabSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
336438b41dabSmrgAC_SUBST([CHANGELOG_CMD])
336538b41dabSmrg]) # XORG_CHANGELOG
336638b41dabSmrg
3367