aclocal.m4 revision 944bff83
1944bff83Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
21c80d5b0Smrg
3b8df70beSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
411d341caSmrg
511d341caSmrg# This file is free software; the Free Software Foundation
611d341caSmrg# gives unlimited permission to copy and/or distribute it,
711d341caSmrg# with or without modifications, as long as this notice is preserved.
811d341caSmrg
911d341caSmrg# This program is distributed in the hope that it will be useful,
1011d341caSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1111d341caSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1211d341caSmrg# PARTICULAR PURPOSE.
1311d341caSmrg
141c80d5b0Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
154c61c93dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
164c61c93dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17b8df70beSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18b8df70beSmrg[m4_warning([this file was generated for autoconf 2.71.
194c61c93dSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
204c61c93dSmrgIf you have problems, you may need to regenerate the build system entirely.
211c80d5b0SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2211d341caSmrg
23b8df70beSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2411d341caSmrg#
2511d341caSmrg# This file is free software; the Free Software Foundation
2611d341caSmrg# gives unlimited permission to copy and/or distribute it,
2711d341caSmrg# with or without modifications, as long as this notice is preserved.
2811d341caSmrg
2911d341caSmrg# AM_AUTOMAKE_VERSION(VERSION)
3011d341caSmrg# ----------------------------
3111d341caSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3211d341caSmrg# generated from the m4 files accompanying Automake X.Y.
334c61c93dSmrg# (This private macro should not be called outside this file.)
344c61c93dSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35b8df70beSmrg[am__api_version='1.16'
364c61c93dSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
374c61c93dSmrgdnl require some minimum version.  Point them to the right macro.
38944bff83Smrgm4_if([$1], [1.16.5], [],
394c61c93dSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
404c61c93dSmrg])
414c61c93dSmrg
424c61c93dSmrg# _AM_AUTOCONF_VERSION(VERSION)
434c61c93dSmrg# -----------------------------
444c61c93dSmrg# aclocal traces this macro to find the Autoconf version.
454c61c93dSmrg# This is a private macro too.  Using m4_define simplifies
464c61c93dSmrg# the logic in aclocal, which can simply ignore this definition.
474c61c93dSmrgm4_define([_AM_AUTOCONF_VERSION], [])
4811d341caSmrg
4911d341caSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5011d341caSmrg# -------------------------------
514c61c93dSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
524c61c93dSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5311d341caSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54944bff83Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
554c61c93dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
564c61c93dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
574c61c93dSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5811d341caSmrg
5911d341caSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6011d341caSmrg
61b8df70beSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6211d341caSmrg#
6311d341caSmrg# This file is free software; the Free Software Foundation
6411d341caSmrg# gives unlimited permission to copy and/or distribute it,
6511d341caSmrg# with or without modifications, as long as this notice is preserved.
6611d341caSmrg
6711d341caSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
681c80d5b0Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
691c80d5b0Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7011d341caSmrg#
7111d341caSmrg# Of course, Automake must honor this variable whenever it calls a
7211d341caSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7311d341caSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7411d341caSmrg# depending on how configure is run.  This is pretty annoying, since
7511d341caSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7611d341caSmrg# source directory, any form will work fine, but in subdirectories a
7711d341caSmrg# relative path needs to be adjusted first.
7811d341caSmrg#
7911d341caSmrg# $ac_aux_dir/missing
8011d341caSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8111d341caSmrg# $top_srcdir/$ac_aux_dir/missing
8211d341caSmrg#    fails if $ac_aux_dir is absolute,
8311d341caSmrg#    fails when called from a subdirectory in a VPATH build with
8411d341caSmrg#          a relative $ac_aux_dir
8511d341caSmrg#
8611d341caSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8711d341caSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
881c80d5b0Smrg# harmless because $srcdir is '.', but things will broke when you
8911d341caSmrg# start a VPATH build or use an absolute $srcdir.
9011d341caSmrg#
9111d341caSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9211d341caSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9311d341caSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9411d341caSmrg# and then we would define $MISSING as
9511d341caSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9611d341caSmrg# This will work as long as MISSING is not called from configure, because
9711d341caSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9811d341caSmrg# However there are other variables, like CC, which are often used in
9911d341caSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10011d341caSmrg#
10111d341caSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10211d341caSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10311d341caSmrg# configured tree to be moved without reconfiguration.
10411d341caSmrg
10511d341caSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10641fe0c2aSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10741fe0c2aSmrg# Expand $ac_aux_dir to an absolute path.
10841fe0c2aSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10911d341caSmrg])
11011d341caSmrg
1114c61c93dSmrg# Do all the work for Automake.                             -*- Autoconf -*-
1124c61c93dSmrg
113b8df70beSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
1144c61c93dSmrg#
1154c61c93dSmrg# This file is free software; the Free Software Foundation
1164c61c93dSmrg# gives unlimited permission to copy and/or distribute it,
1174c61c93dSmrg# with or without modifications, as long as this notice is preserved.
1184c61c93dSmrg
11911d341caSmrg# This macro actually does too much.  Some checks are only needed if
12011d341caSmrg# your package does certain things.  But this isn't really a big deal.
12111d341caSmrg
1221c80d5b0Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
1231c80d5b0Smrgm4_define([AC_PROG_CC],
1241c80d5b0Smrgm4_defn([AC_PROG_CC])
1251c80d5b0Smrg[_AM_PROG_CC_C_O
1261c80d5b0Smrg])
1271c80d5b0Smrg
12811d341caSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
12911d341caSmrg# AM_INIT_AUTOMAKE([OPTIONS])
13011d341caSmrg# -----------------------------------------------
13111d341caSmrg# The call with PACKAGE and VERSION arguments is the old style
13211d341caSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
13311d341caSmrg# and VERSION should now be passed to AC_INIT and removed from
13411d341caSmrg# the call to AM_INIT_AUTOMAKE.
13511d341caSmrg# We support both call styles for the transition.  After
13611d341caSmrg# the next Automake release, Autoconf can make the AC_INIT
13711d341caSmrg# arguments mandatory, and then we can depend on a new Autoconf
13811d341caSmrg# release and drop the old call support.
13911d341caSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
1401c80d5b0Smrg[AC_PREREQ([2.65])dnl
141944bff83Smrgm4_ifdef([_$0_ALREADY_INIT],
142944bff83Smrg  [m4_fatal([$0 expanded multiple times
143944bff83Smrg]m4_defn([_$0_ALREADY_INIT]))],
144944bff83Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
14511d341caSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
14611d341caSmrgdnl the ones we care about.
14711d341caSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
14811d341caSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
14911d341caSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
1504c61c93dSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
1514c61c93dSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
1524c61c93dSmrg  # is not polluted with repeated "-I."
1534c61c93dSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
1544c61c93dSmrg  # test to see if srcdir already configured
1554c61c93dSmrg  if test -f $srcdir/config.status; then
1564c61c93dSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1574c61c93dSmrg  fi
15811d341caSmrgfi
15911d341caSmrg
16011d341caSmrg# test whether we have cygpath
16111d341caSmrgif test -z "$CYGPATH_W"; then
16211d341caSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
16311d341caSmrg    CYGPATH_W='cygpath -w'
16411d341caSmrg  else
16511d341caSmrg    CYGPATH_W=echo
16611d341caSmrg  fi
16711d341caSmrgfi
16811d341caSmrgAC_SUBST([CYGPATH_W])
16911d341caSmrg
17011d341caSmrg# Define the identity of the package.
17111d341caSmrgdnl Distinguish between old-style and new-style calls.
17211d341caSmrgm4_ifval([$2],
1731c80d5b0Smrg[AC_DIAGNOSE([obsolete],
1741c80d5b0Smrg             [$0: two- and three-arguments forms are deprecated.])
1751c80d5b0Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
17611d341caSmrg AC_SUBST([PACKAGE], [$1])dnl
17711d341caSmrg AC_SUBST([VERSION], [$2])],
17811d341caSmrg[_AM_SET_OPTIONS([$1])dnl
1794c61c93dSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
1801c80d5b0Smrgm4_if(
181b8df70beSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
1821c80d5b0Smrg  [ok:ok],,
1834c61c93dSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
18411d341caSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
18511d341caSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
18611d341caSmrg
18711d341caSmrg_AM_IF_OPTION([no-define],,
1881c80d5b0Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
1891c80d5b0Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
19011d341caSmrg
19111d341caSmrg# Some tools Automake needs.
19211d341caSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
19311d341caSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
1941c80d5b0SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
1951c80d5b0SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
1961c80d5b0SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
1971c80d5b0SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
1981c80d5b0SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
1994c61c93dSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2004c61c93dSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2011c80d5b0SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
2021c80d5b0Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
2031c80d5b0Smrg# dies out for good.  For more background, see:
204b8df70beSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
205b8df70beSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2061c80d5b0SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
20741fe0c2aSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
20841fe0c2aSmrg# system "awk" is bad on some platforms.
20911d341caSmrgAC_REQUIRE([AC_PROG_AWK])dnl
21011d341caSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
21111d341caSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
21211d341caSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2134c61c93dSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2144c61c93dSmrg			     [_AM_PROG_TAR([v7])])])
21511d341caSmrg_AM_IF_OPTION([no-dependencies],,
21611d341caSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
2171c80d5b0Smrg		  [_AM_DEPENDENCIES([CC])],
2181c80d5b0Smrg		  [m4_define([AC_PROG_CC],
2191c80d5b0Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
22011d341caSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
2211c80d5b0Smrg		  [_AM_DEPENDENCIES([CXX])],
2221c80d5b0Smrg		  [m4_define([AC_PROG_CXX],
2231c80d5b0Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2244c61c93dSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
2251c80d5b0Smrg		  [_AM_DEPENDENCIES([OBJC])],
2261c80d5b0Smrg		  [m4_define([AC_PROG_OBJC],
2271c80d5b0Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2281c80d5b0SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2291c80d5b0Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
2301c80d5b0Smrg		  [m4_define([AC_PROG_OBJCXX],
2311c80d5b0Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
23211d341caSmrg])
233b8df70beSmrg# Variables for tags utilities; see am/tags.am
234b8df70beSmrgif test -z "$CTAGS"; then
235b8df70beSmrg  CTAGS=ctags
236b8df70beSmrgfi
237b8df70beSmrgAC_SUBST([CTAGS])
238b8df70beSmrgif test -z "$ETAGS"; then
239b8df70beSmrg  ETAGS=etags
240b8df70beSmrgfi
241b8df70beSmrgAC_SUBST([ETAGS])
242b8df70beSmrgif test -z "$CSCOPE"; then
243b8df70beSmrg  CSCOPE=cscope
244b8df70beSmrgfi
245b8df70beSmrgAC_SUBST([CSCOPE])
246b8df70beSmrg
2471c80d5b0SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
2481c80d5b0Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
2491c80d5b0Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2501c80d5b0Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2514c61c93dSmrgAC_CONFIG_COMMANDS_PRE(dnl
2524c61c93dSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
2534c61c93dSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
25411d341caSmrg
2551c80d5b0Smrg# POSIX will say in a future version that running "rm -f" with no argument
2561c80d5b0Smrg# is OK; and we want to be able to make that assumption in our Makefile
2571c80d5b0Smrg# recipes.  So use an aggressive probe to check that the usage we want is
2581c80d5b0Smrg# actually supported "in the wild" to an acceptable degree.
2591c80d5b0Smrg# See automake bug#10828.
2601c80d5b0Smrg# To make any issue more visible, cause the running configure to be aborted
2611c80d5b0Smrg# by default if the 'rm' program in use doesn't match our expectations; the
2621c80d5b0Smrg# user can still override this though.
2631c80d5b0Smrgif rm -f && rm -fr && rm -rf; then : OK; else
2641c80d5b0Smrg  cat >&2 <<'END'
2651c80d5b0SmrgOops!
2661c80d5b0Smrg
2671c80d5b0SmrgYour 'rm' program seems unable to run without file operands specified
2681c80d5b0Smrgon the command line, even when the '-f' option is present.  This is contrary
2691c80d5b0Smrgto the behaviour of most rm programs out there, and not conforming with
2701c80d5b0Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2711c80d5b0Smrg
2721c80d5b0SmrgPlease tell bug-automake@gnu.org about your system, including the value
2731c80d5b0Smrgof your $PATH and any error possibly output before this message.  This
2741c80d5b0Smrgcan help us improve future automake versions.
2751c80d5b0Smrg
2761c80d5b0SmrgEND
2771c80d5b0Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
2781c80d5b0Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
2791c80d5b0Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
2801c80d5b0Smrg    echo >&2
2811c80d5b0Smrg  else
2821c80d5b0Smrg    cat >&2 <<'END'
2831c80d5b0SmrgAborting the configuration process, to ensure you take notice of the issue.
2841c80d5b0Smrg
2851c80d5b0SmrgYou can download and install GNU coreutils to get an 'rm' implementation
286b8df70beSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
2871c80d5b0Smrg
2881c80d5b0SmrgIf you want to complete the configuration process using your problematic
2891c80d5b0Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
2901c80d5b0Smrgto "yes", and re-run configure.
2911c80d5b0Smrg
2921c80d5b0SmrgEND
2931c80d5b0Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
2941c80d5b0Smrg  fi
29541fe0c2aSmrgfi
29641fe0c2aSmrgdnl The trailing newline in this macro's definition is deliberate, for
29741fe0c2aSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
29841fe0c2aSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
29941fe0c2aSmrg])
3001c80d5b0Smrg
3011c80d5b0Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
3024c61c93dSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
3034c61c93dSmrgdnl mangled by Autoconf and run in a shell conditional statement.
3044c61c93dSmrgm4_define([_AC_COMPILER_EXEEXT],
3054c61c93dSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
3064c61c93dSmrg
30711d341caSmrg# When config.status generates a header, we must update the stamp-h file.
30811d341caSmrg# This file resides in the same directory as the config header
30911d341caSmrg# that is generated.  The stamp files are numbered to have different names.
31011d341caSmrg
31111d341caSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
31211d341caSmrg# loop where config.status creates the headers, so we can generate
31311d341caSmrg# our stamp files there.
31411d341caSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
31511d341caSmrg[# Compute $1's index in $config_headers.
3164c61c93dSmrg_am_arg=$1
31711d341caSmrg_am_stamp_count=1
31811d341caSmrgfor _am_header in $config_headers :; do
31911d341caSmrg  case $_am_header in
3204c61c93dSmrg    $_am_arg | $_am_arg:* )
32111d341caSmrg      break ;;
32211d341caSmrg    * )
32311d341caSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
32411d341caSmrg  esac
32511d341caSmrgdone
3264c61c93dSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
32711d341caSmrg
328b8df70beSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
32911d341caSmrg#
33011d341caSmrg# This file is free software; the Free Software Foundation
33111d341caSmrg# gives unlimited permission to copy and/or distribute it,
33211d341caSmrg# with or without modifications, as long as this notice is preserved.
33311d341caSmrg
33411d341caSmrg# AM_PROG_INSTALL_SH
33511d341caSmrg# ------------------
33611d341caSmrg# Define $install_sh.
33711d341caSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
33811d341caSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
33941fe0c2aSmrgif test x"${install_sh+set}" != xset; then
3404c61c93dSmrg  case $am_aux_dir in
3414c61c93dSmrg  *\ * | *\	*)
3424c61c93dSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
3434c61c93dSmrg  *)
3444c61c93dSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
3454c61c93dSmrg  esac
3464c61c93dSmrgfi
3471c80d5b0SmrgAC_SUBST([install_sh])])
34811d341caSmrg
349b8df70beSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
35011d341caSmrg#
35111d341caSmrg# This file is free software; the Free Software Foundation
35211d341caSmrg# gives unlimited permission to copy and/or distribute it,
35311d341caSmrg# with or without modifications, as long as this notice is preserved.
35411d341caSmrg
35511d341caSmrg# Check whether the underlying file-system supports filenames
35611d341caSmrg# with a leading dot.  For instance MS-DOS doesn't.
35711d341caSmrgAC_DEFUN([AM_SET_LEADING_DOT],
35811d341caSmrg[rm -rf .tst 2>/dev/null
35911d341caSmrgmkdir .tst 2>/dev/null
36011d341caSmrgif test -d .tst; then
36111d341caSmrg  am__leading_dot=.
36211d341caSmrgelse
36311d341caSmrg  am__leading_dot=_
36411d341caSmrgfi
36511d341caSmrgrmdir .tst 2>/dev/null
36611d341caSmrgAC_SUBST([am__leading_dot])])
36711d341caSmrg
36811d341caSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
36911d341caSmrg
370b8df70beSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
37111d341caSmrg#
37211d341caSmrg# This file is free software; the Free Software Foundation
37311d341caSmrg# gives unlimited permission to copy and/or distribute it,
37411d341caSmrg# with or without modifications, as long as this notice is preserved.
37511d341caSmrg
37611d341caSmrg# AM_MISSING_PROG(NAME, PROGRAM)
37711d341caSmrg# ------------------------------
37811d341caSmrgAC_DEFUN([AM_MISSING_PROG],
37911d341caSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
38011d341caSmrg$1=${$1-"${am_missing_run}$2"}
38111d341caSmrgAC_SUBST($1)])
38211d341caSmrg
38311d341caSmrg# AM_MISSING_HAS_RUN
38411d341caSmrg# ------------------
3851c80d5b0Smrg# Define MISSING if not defined so far and test if it is modern enough.
3861c80d5b0Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
38711d341caSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
38811d341caSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3894c61c93dSmrgAC_REQUIRE_AUX_FILE([missing])dnl
3904c61c93dSmrgif test x"${MISSING+set}" != xset; then
391b8df70beSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
3924c61c93dSmrgfi
39311d341caSmrg# Use eval to expand $SHELL
3941c80d5b0Smrgif eval "$MISSING --is-lightweight"; then
3951c80d5b0Smrg  am_missing_run="$MISSING "
39611d341caSmrgelse
39711d341caSmrg  am_missing_run=
3981c80d5b0Smrg  AC_MSG_WARN(['missing' script is too old or missing])
39911d341caSmrgfi
40011d341caSmrg])
40111d341caSmrg
40211d341caSmrg# Helper functions for option handling.                     -*- Autoconf -*-
40311d341caSmrg
404b8df70beSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
40511d341caSmrg#
40611d341caSmrg# This file is free software; the Free Software Foundation
40711d341caSmrg# gives unlimited permission to copy and/or distribute it,
40811d341caSmrg# with or without modifications, as long as this notice is preserved.
40911d341caSmrg
41011d341caSmrg# _AM_MANGLE_OPTION(NAME)
41111d341caSmrg# -----------------------
41211d341caSmrgAC_DEFUN([_AM_MANGLE_OPTION],
41311d341caSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
41411d341caSmrg
41511d341caSmrg# _AM_SET_OPTION(NAME)
4161c80d5b0Smrg# --------------------
41711d341caSmrg# Set option NAME.  Presently that only means defining a flag for this option.
41811d341caSmrgAC_DEFUN([_AM_SET_OPTION],
4191c80d5b0Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
42011d341caSmrg
42111d341caSmrg# _AM_SET_OPTIONS(OPTIONS)
4221c80d5b0Smrg# ------------------------
42311d341caSmrg# OPTIONS is a space-separated list of Automake options.
42411d341caSmrgAC_DEFUN([_AM_SET_OPTIONS],
4254c61c93dSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
42611d341caSmrg
42711d341caSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
42811d341caSmrg# -------------------------------------------
42911d341caSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
43011d341caSmrgAC_DEFUN([_AM_IF_OPTION],
43111d341caSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
43211d341caSmrg
4331c80d5b0Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
4341c80d5b0Smrg
435b8df70beSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4361c80d5b0Smrg#
4371c80d5b0Smrg# This file is free software; the Free Software Foundation
4381c80d5b0Smrg# gives unlimited permission to copy and/or distribute it,
4391c80d5b0Smrg# with or without modifications, as long as this notice is preserved.
44011d341caSmrg
44111d341caSmrg# AM_SANITY_CHECK
44211d341caSmrg# ---------------
44311d341caSmrgAC_DEFUN([AM_SANITY_CHECK],
44411d341caSmrg[AC_MSG_CHECKING([whether build environment is sane])
4454c61c93dSmrg# Reject unsafe characters in $srcdir or the absolute working directory
4464c61c93dSmrg# name.  Accept space and tab only in the latter.
4474c61c93dSmrgam_lf='
4484c61c93dSmrg'
4494c61c93dSmrgcase `pwd` in
4504c61c93dSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
4514c61c93dSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
4524c61c93dSmrgesac
4534c61c93dSmrgcase $srcdir in
4544c61c93dSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
4551c80d5b0Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
4564c61c93dSmrgesac
4574c61c93dSmrg
4581c80d5b0Smrg# Do 'set' in a subshell so we don't clobber the current shell's
45911d341caSmrg# arguments.  Must try -L first in case configure is actually a
46011d341caSmrg# symlink; some systems play weird games with the mod time of symlinks
46111d341caSmrg# (eg FreeBSD returns the mod time of the symlink's containing
46211d341caSmrg# directory).
46311d341caSmrgif (
4641c80d5b0Smrg   am_has_slept=no
4651c80d5b0Smrg   for am_try in 1 2; do
4661c80d5b0Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
4671c80d5b0Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
4681c80d5b0Smrg     if test "$[*]" = "X"; then
4691c80d5b0Smrg	# -L didn't work.
4701c80d5b0Smrg	set X `ls -t "$srcdir/configure" conftest.file`
4711c80d5b0Smrg     fi
4721c80d5b0Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
4731c80d5b0Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
4741c80d5b0Smrg
4751c80d5b0Smrg	# If neither matched, then we have a broken ls.  This can happen
4761c80d5b0Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
4771c80d5b0Smrg	# broken ls alias from the environment.  This has actually
4781c80d5b0Smrg	# happened.  Such a system could not be considered "sane".
4791c80d5b0Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
4801c80d5b0Smrg  alias in your environment])
4811c80d5b0Smrg     fi
4821c80d5b0Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
4831c80d5b0Smrg       break
4841c80d5b0Smrg     fi
4851c80d5b0Smrg     # Just in case.
4861c80d5b0Smrg     sleep 1
4871c80d5b0Smrg     am_has_slept=yes
4881c80d5b0Smrg   done
48911d341caSmrg   test "$[2]" = conftest.file
49011d341caSmrg   )
49111d341caSmrgthen
49211d341caSmrg   # Ok.
49311d341caSmrg   :
49411d341caSmrgelse
49511d341caSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
49611d341caSmrgCheck your system clock])
49711d341caSmrgfi
4981c80d5b0SmrgAC_MSG_RESULT([yes])
4991c80d5b0Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
5001c80d5b0Smrg# generated files are strictly newer.
5011c80d5b0Smrgam_sleep_pid=
5021c80d5b0Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
5031c80d5b0Smrg  ( sleep 1 ) &
5041c80d5b0Smrg  am_sleep_pid=$!
5051c80d5b0Smrgfi
5061c80d5b0SmrgAC_CONFIG_COMMANDS_PRE(
5071c80d5b0Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
5081c80d5b0Smrg   if test -n "$am_sleep_pid"; then
5091c80d5b0Smrg     # Hide warnings about reused PIDs.
5101c80d5b0Smrg     wait $am_sleep_pid 2>/dev/null
5111c80d5b0Smrg   fi
5121c80d5b0Smrg   AC_MSG_RESULT([done])])
5131c80d5b0Smrgrm -f conftest.file
5141c80d5b0Smrg])
51511d341caSmrg
516b8df70beSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
5174c61c93dSmrg#
5184c61c93dSmrg# This file is free software; the Free Software Foundation
5194c61c93dSmrg# gives unlimited permission to copy and/or distribute it,
5204c61c93dSmrg# with or without modifications, as long as this notice is preserved.
5214c61c93dSmrg
5224c61c93dSmrg# AM_SILENT_RULES([DEFAULT])
5234c61c93dSmrg# --------------------------
5244c61c93dSmrg# Enable less verbose build rules; with the default set to DEFAULT
5251c80d5b0Smrg# ("yes" being less verbose, "no" or empty being verbose).
5264c61c93dSmrgAC_DEFUN([AM_SILENT_RULES],
5271c80d5b0Smrg[AC_ARG_ENABLE([silent-rules], [dnl
5281c80d5b0SmrgAS_HELP_STRING(
5291c80d5b0Smrg  [--enable-silent-rules],
5301c80d5b0Smrg  [less verbose build output (undo: "make V=1")])
5311c80d5b0SmrgAS_HELP_STRING(
5321c80d5b0Smrg  [--disable-silent-rules],
5331c80d5b0Smrg  [verbose build output (undo: "make V=0")])dnl
5341c80d5b0Smrg])
5351c80d5b0Smrgcase $enable_silent_rules in @%:@ (((
5361c80d5b0Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
5371c80d5b0Smrg   no) AM_DEFAULT_VERBOSITY=1;;
5381c80d5b0Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
5394c61c93dSmrgesac
5401c80d5b0Smrgdnl
5411c80d5b0Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
5421c80d5b0Smrgdnl do not support nested variable expansions.
5431c80d5b0Smrgdnl See automake bug#9928 and bug#10237.
5441c80d5b0Smrgam_make=${MAKE-make}
5451c80d5b0SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
5461c80d5b0Smrg   [am_cv_make_support_nested_variables],
5471c80d5b0Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
5481c80d5b0SmrgBAR0=false
5491c80d5b0SmrgBAR1=true
5501c80d5b0SmrgV=1
5511c80d5b0Smrgam__doit:
5521c80d5b0Smrg	@$(TRUE)
5531c80d5b0Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
5541c80d5b0Smrg  am_cv_make_support_nested_variables=yes
5551c80d5b0Smrgelse
5561c80d5b0Smrg  am_cv_make_support_nested_variables=no
5571c80d5b0Smrgfi])
5581c80d5b0Smrgif test $am_cv_make_support_nested_variables = yes; then
5591c80d5b0Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
5601c80d5b0Smrg  AM_V='$(V)'
5611c80d5b0Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
5621c80d5b0Smrgelse
5631c80d5b0Smrg  AM_V=$AM_DEFAULT_VERBOSITY
5641c80d5b0Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
5651c80d5b0Smrgfi
5661c80d5b0SmrgAC_SUBST([AM_V])dnl
5671c80d5b0SmrgAM_SUBST_NOTMAKE([AM_V])dnl
5681c80d5b0SmrgAC_SUBST([AM_DEFAULT_V])dnl
5691c80d5b0SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
5704c61c93dSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
5714c61c93dSmrgAM_BACKSLASH='\'
5724c61c93dSmrgAC_SUBST([AM_BACKSLASH])dnl
5734c61c93dSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
5744c61c93dSmrg])
5754c61c93dSmrg
576b8df70beSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
57711d341caSmrg#
57811d341caSmrg# This file is free software; the Free Software Foundation
57911d341caSmrg# gives unlimited permission to copy and/or distribute it,
58011d341caSmrg# with or without modifications, as long as this notice is preserved.
58111d341caSmrg
58211d341caSmrg# AM_PROG_INSTALL_STRIP
58311d341caSmrg# ---------------------
5841c80d5b0Smrg# One issue with vendor 'install' (even GNU) is that you can't
58511d341caSmrg# specify the program used to strip binaries.  This is especially
58611d341caSmrg# annoying in cross-compiling environments, where the build's strip
58711d341caSmrg# is unlikely to handle the host's binaries.
58811d341caSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
5891c80d5b0Smrg# always use install-sh in "make install-strip", and initialize
59011d341caSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
59111d341caSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
59211d341caSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
5931c80d5b0Smrg# Installed binaries are usually stripped using 'strip' when the user
5941c80d5b0Smrg# run "make install-strip".  However 'strip' might not be the right
59511d341caSmrg# tool to use in cross-compilation environments, therefore Automake
5961c80d5b0Smrg# will honor the 'STRIP' environment variable to overrule this program.
5971c80d5b0Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
59811d341caSmrgif test "$cross_compiling" != no; then
59911d341caSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
60011d341caSmrgfi
6014c61c93dSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
60211d341caSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
60311d341caSmrg
604b8df70beSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
6054c61c93dSmrg#
6064c61c93dSmrg# This file is free software; the Free Software Foundation
6074c61c93dSmrg# gives unlimited permission to copy and/or distribute it,
6084c61c93dSmrg# with or without modifications, as long as this notice is preserved.
6094c61c93dSmrg
6104c61c93dSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
6114c61c93dSmrg# ---------------------------
6124c61c93dSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
6134c61c93dSmrg# This macro is traced by Automake.
6144c61c93dSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
6154c61c93dSmrg
6164c61c93dSmrg# AM_SUBST_NOTMAKE(VARIABLE)
6171c80d5b0Smrg# --------------------------
6184c61c93dSmrg# Public sister of _AM_SUBST_NOTMAKE.
6194c61c93dSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
6204c61c93dSmrg
62111d341caSmrg# Check how to create a tarball.                            -*- Autoconf -*-
62211d341caSmrg
623b8df70beSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
62411d341caSmrg#
62511d341caSmrg# This file is free software; the Free Software Foundation
62611d341caSmrg# gives unlimited permission to copy and/or distribute it,
62711d341caSmrg# with or without modifications, as long as this notice is preserved.
62811d341caSmrg
62911d341caSmrg# _AM_PROG_TAR(FORMAT)
63011d341caSmrg# --------------------
63111d341caSmrg# Check how to create a tarball in format FORMAT.
6321c80d5b0Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
63311d341caSmrg#
63411d341caSmrg# Substitute a variable $(am__tar) that is a command
63511d341caSmrg# writing to stdout a FORMAT-tarball containing the directory
63611d341caSmrg# $tardir.
63711d341caSmrg#     tardir=directory && $(am__tar) > result.tar
63811d341caSmrg#
63911d341caSmrg# Substitute a variable $(am__untar) that extract such
64011d341caSmrg# a tarball read from stdin.
64111d341caSmrg#     $(am__untar) < result.tar
6421c80d5b0Smrg#
64311d341caSmrgAC_DEFUN([_AM_PROG_TAR],
6441c80d5b0Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
6451c80d5b0Smrg# in the wild :-(  We should find a proper way to deprecate it ...
6461c80d5b0SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
6471c80d5b0Smrg
6481c80d5b0Smrg# We'll loop over all known methods to create a tar archive until one works.
64911d341caSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
65011d341caSmrg
6511c80d5b0Smrgm4_if([$1], [v7],
6521c80d5b0Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
6531c80d5b0Smrg
6541c80d5b0Smrg  [m4_case([$1],
6551c80d5b0Smrg    [ustar],
6561c80d5b0Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
6571c80d5b0Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
6581c80d5b0Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
6591c80d5b0Smrg      # and bug#13588).
6601c80d5b0Smrg      am_max_uid=2097151 # 2^21 - 1
6611c80d5b0Smrg      am_max_gid=$am_max_uid
6621c80d5b0Smrg      # The $UID and $GID variables are not portable, so we need to resort
6631c80d5b0Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
6641c80d5b0Smrg      # below are definitely unexpected, so allow the users to see them
6651c80d5b0Smrg      # (that is, avoid stderr redirection).
6661c80d5b0Smrg      am_uid=`id -u || echo unknown`
6671c80d5b0Smrg      am_gid=`id -g || echo unknown`
6681c80d5b0Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
6691c80d5b0Smrg      if test $am_uid -le $am_max_uid; then
6701c80d5b0Smrg         AC_MSG_RESULT([yes])
6711c80d5b0Smrg      else
6721c80d5b0Smrg         AC_MSG_RESULT([no])
6731c80d5b0Smrg         _am_tools=none
6741c80d5b0Smrg      fi
6751c80d5b0Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
6761c80d5b0Smrg      if test $am_gid -le $am_max_gid; then
6771c80d5b0Smrg         AC_MSG_RESULT([yes])
6781c80d5b0Smrg      else
6791c80d5b0Smrg        AC_MSG_RESULT([no])
6801c80d5b0Smrg        _am_tools=none
6811c80d5b0Smrg      fi],
6821c80d5b0Smrg
6831c80d5b0Smrg  [pax],
6841c80d5b0Smrg    [],
6851c80d5b0Smrg
6861c80d5b0Smrg  [m4_fatal([Unknown tar format])])
6871c80d5b0Smrg
6881c80d5b0Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
6891c80d5b0Smrg
6901c80d5b0Smrg  # Go ahead even if we have the value already cached.  We do so because we
6911c80d5b0Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
6921c80d5b0Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
6931c80d5b0Smrg
6941c80d5b0Smrg  for _am_tool in $_am_tools; do
6951c80d5b0Smrg    case $_am_tool in
6961c80d5b0Smrg    gnutar)
6971c80d5b0Smrg      for _am_tar in tar gnutar gtar; do
6981c80d5b0Smrg        AM_RUN_LOG([$_am_tar --version]) && break
6991c80d5b0Smrg      done
7001c80d5b0Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
7011c80d5b0Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
7021c80d5b0Smrg      am__untar="$_am_tar -xf -"
7031c80d5b0Smrg      ;;
7041c80d5b0Smrg    plaintar)
7051c80d5b0Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
7061c80d5b0Smrg      # ustar tarball either.
7071c80d5b0Smrg      (tar --version) >/dev/null 2>&1 && continue
7081c80d5b0Smrg      am__tar='tar chf - "$$tardir"'
7091c80d5b0Smrg      am__tar_='tar chf - "$tardir"'
7101c80d5b0Smrg      am__untar='tar xf -'
7111c80d5b0Smrg      ;;
7121c80d5b0Smrg    pax)
7131c80d5b0Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
7141c80d5b0Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
7151c80d5b0Smrg      am__untar='pax -r'
7161c80d5b0Smrg      ;;
7171c80d5b0Smrg    cpio)
7181c80d5b0Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
7191c80d5b0Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
7201c80d5b0Smrg      am__untar='cpio -i -H $1 -d'
7211c80d5b0Smrg      ;;
7221c80d5b0Smrg    none)
7231c80d5b0Smrg      am__tar=false
7241c80d5b0Smrg      am__tar_=false
7251c80d5b0Smrg      am__untar=false
7261c80d5b0Smrg      ;;
7271c80d5b0Smrg    esac
72811d341caSmrg
7291c80d5b0Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
7301c80d5b0Smrg    # and am__untar set.
7311c80d5b0Smrg    test -n "${am_cv_prog_tar_$1}" && break
7321c80d5b0Smrg
7331c80d5b0Smrg    # tar/untar a dummy directory, and stop if the command works.
7341c80d5b0Smrg    rm -rf conftest.dir
7351c80d5b0Smrg    mkdir conftest.dir
7361c80d5b0Smrg    echo GrepMe > conftest.dir/file
7371c80d5b0Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
7381c80d5b0Smrg    rm -rf conftest.dir
7391c80d5b0Smrg    if test -s conftest.tar; then
7401c80d5b0Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
7411c80d5b0Smrg      AM_RUN_LOG([cat conftest.dir/file])
7421c80d5b0Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
7431c80d5b0Smrg    fi
7441c80d5b0Smrg  done
74511d341caSmrg  rm -rf conftest.dir
74611d341caSmrg
7471c80d5b0Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
7481c80d5b0Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
7491c80d5b0Smrg
75011d341caSmrgAC_SUBST([am__tar])
75111d341caSmrgAC_SUBST([am__untar])
75211d341caSmrg]) # _AM_PROG_TAR
75311d341caSmrg
754b8df70beSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
755b8df70beSmrgdnl serial 11 (pkg-config-0.29)
756b8df70beSmrgdnl
757b8df70beSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
758b8df70beSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
759b8df70beSmrgdnl
760b8df70beSmrgdnl This program is free software; you can redistribute it and/or modify
761b8df70beSmrgdnl it under the terms of the GNU General Public License as published by
762b8df70beSmrgdnl the Free Software Foundation; either version 2 of the License, or
763b8df70beSmrgdnl (at your option) any later version.
764b8df70beSmrgdnl
765b8df70beSmrgdnl This program is distributed in the hope that it will be useful, but
766b8df70beSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
767b8df70beSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
768b8df70beSmrgdnl General Public License for more details.
769b8df70beSmrgdnl
770b8df70beSmrgdnl You should have received a copy of the GNU General Public License
771b8df70beSmrgdnl along with this program; if not, write to the Free Software
772b8df70beSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
773b8df70beSmrgdnl 02111-1307, USA.
774b8df70beSmrgdnl
775b8df70beSmrgdnl As a special exception to the GNU General Public License, if you
776b8df70beSmrgdnl distribute this file as part of a program that contains a
777b8df70beSmrgdnl configuration script generated by Autoconf, you may include it under
778b8df70beSmrgdnl the same distribution terms that you use for the rest of that
779b8df70beSmrgdnl program.
780b8df70beSmrg
781b8df70beSmrgdnl PKG_PREREQ(MIN-VERSION)
782b8df70beSmrgdnl -----------------------
783b8df70beSmrgdnl Since: 0.29
784b8df70beSmrgdnl
785b8df70beSmrgdnl Verify that the version of the pkg-config macros are at least
786b8df70beSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
787b8df70beSmrgdnl installed version of pkg-config, this checks the developer's version
788b8df70beSmrgdnl of pkg.m4 when generating configure.
789b8df70beSmrgdnl
790b8df70beSmrgdnl To ensure that this macro is defined, also add:
791b8df70beSmrgdnl m4_ifndef([PKG_PREREQ],
792b8df70beSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
793b8df70beSmrgdnl
794b8df70beSmrgdnl See the "Since" comment for each macro you use to see what version
795b8df70beSmrgdnl of the macros you require.
796b8df70beSmrgm4_defun([PKG_PREREQ],
797b8df70beSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
798b8df70beSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
799b8df70beSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
800b8df70beSmrg])dnl PKG_PREREQ
801b8df70beSmrg
802b8df70beSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
803b8df70beSmrgdnl ----------------------------------
804b8df70beSmrgdnl Since: 0.16
805b8df70beSmrgdnl
806b8df70beSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
807b8df70beSmrgdnl first found in the path. Checks that the version of pkg-config found
808b8df70beSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
809b8df70beSmrgdnl used since that's the first version where most current features of
810b8df70beSmrgdnl pkg-config existed.
8111c80d5b0SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8121c80d5b0Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
813b8df70beSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
814b8df70beSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
815b8df70beSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
816b8df70beSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
817b8df70beSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
818b8df70beSmrg
8191c80d5b0Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8201c80d5b0Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
8211c80d5b0Smrgfi
8221c80d5b0Smrgif test -n "$PKG_CONFIG"; then
8231c80d5b0Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
8241c80d5b0Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
8251c80d5b0Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
8261c80d5b0Smrg		AC_MSG_RESULT([yes])
8271c80d5b0Smrg	else
8281c80d5b0Smrg		AC_MSG_RESULT([no])
8291c80d5b0Smrg		PKG_CONFIG=""
8301c80d5b0Smrg	fi
8311c80d5b0Smrgfi[]dnl
832b8df70beSmrg])dnl PKG_PROG_PKG_CONFIG
833d7ffce2aSmrg
834b8df70beSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
835b8df70beSmrgdnl -------------------------------------------------------------------
836b8df70beSmrgdnl Since: 0.18
837b8df70beSmrgdnl
838b8df70beSmrgdnl Check to see whether a particular set of modules exists. Similar to
839b8df70beSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
840b8df70beSmrgdnl
841b8df70beSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
842b8df70beSmrgdnl only at the first occurence in configure.ac, so if the first place
843b8df70beSmrgdnl it's called might be skipped (such as if it is within an "if", you
844b8df70beSmrgdnl have to call PKG_CHECK_EXISTS manually
8451c80d5b0SmrgAC_DEFUN([PKG_CHECK_EXISTS],
8461c80d5b0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
8471c80d5b0Smrgif test -n "$PKG_CONFIG" && \
8481c80d5b0Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
849b8df70beSmrg  m4_default([$2], [:])
8501c80d5b0Smrgm4_ifvaln([$3], [else
8511c80d5b0Smrg  $3])dnl
8521c80d5b0Smrgfi])
8531c80d5b0Smrg
854b8df70beSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
855b8df70beSmrgdnl ---------------------------------------------
856b8df70beSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
857b8df70beSmrgdnl pkg_failed based on the result.
8581c80d5b0Smrgm4_define([_PKG_CONFIG],
8591c80d5b0Smrg[if test -n "$$1"; then
8601c80d5b0Smrg    pkg_cv_[]$1="$$1"
8611c80d5b0Smrg elif test -n "$PKG_CONFIG"; then
8621c80d5b0Smrg    PKG_CHECK_EXISTS([$3],
863b8df70beSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
864b8df70beSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
8651c80d5b0Smrg		     [pkg_failed=yes])
8661c80d5b0Smrg else
8671c80d5b0Smrg    pkg_failed=untried
8681c80d5b0Smrgfi[]dnl
869b8df70beSmrg])dnl _PKG_CONFIG
8701c80d5b0Smrg
871b8df70beSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
872b8df70beSmrgdnl ---------------------------
873b8df70beSmrgdnl Internal check to see if pkg-config supports short errors.
8741c80d5b0SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
8751c80d5b0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
8761c80d5b0Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
8771c80d5b0Smrg        _pkg_short_errors_supported=yes
8781c80d5b0Smrgelse
8791c80d5b0Smrg        _pkg_short_errors_supported=no
8801c80d5b0Smrgfi[]dnl
881b8df70beSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
8821c80d5b0Smrg
8831c80d5b0Smrg
884b8df70beSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
885b8df70beSmrgdnl   [ACTION-IF-NOT-FOUND])
886b8df70beSmrgdnl --------------------------------------------------------------
887b8df70beSmrgdnl Since: 0.4.0
888b8df70beSmrgdnl
889b8df70beSmrgdnl Note that if there is a possibility the first call to
890b8df70beSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
891b8df70beSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
8921c80d5b0SmrgAC_DEFUN([PKG_CHECK_MODULES],
8931c80d5b0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
8941c80d5b0SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
8951c80d5b0SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
8961c80d5b0Smrg
8971c80d5b0Smrgpkg_failed=no
8981c80d5b0SmrgAC_MSG_CHECKING([for $1])
8991c80d5b0Smrg
9001c80d5b0Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
9011c80d5b0Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
9021c80d5b0Smrg
9031c80d5b0Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
9041c80d5b0Smrgand $1[]_LIBS to avoid the need to call pkg-config.
9051c80d5b0SmrgSee the pkg-config man page for more details.])
9061c80d5b0Smrg
9071c80d5b0Smrgif test $pkg_failed = yes; then
908b8df70beSmrg   	AC_MSG_RESULT([no])
9091c80d5b0Smrg        _PKG_SHORT_ERRORS_SUPPORTED
9101c80d5b0Smrg        if test $_pkg_short_errors_supported = yes; then
911b8df70beSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
9121c80d5b0Smrg        else 
913b8df70beSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
9141c80d5b0Smrg        fi
9151c80d5b0Smrg	# Put the nasty error message in config.log where it belongs
9161c80d5b0Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
9171c80d5b0Smrg
918b8df70beSmrg	m4_default([$4], [AC_MSG_ERROR(
9191c80d5b0Smrg[Package requirements ($2) were not met:
9201c80d5b0Smrg
9211c80d5b0Smrg$$1_PKG_ERRORS
9221c80d5b0Smrg
9231c80d5b0SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
9241c80d5b0Smrginstalled software in a non-standard prefix.
9251c80d5b0Smrg
926b8df70beSmrg_PKG_TEXT])[]dnl
927b8df70beSmrg        ])
9281c80d5b0Smrgelif test $pkg_failed = untried; then
929b8df70beSmrg     	AC_MSG_RESULT([no])
930b8df70beSmrg	m4_default([$4], [AC_MSG_FAILURE(
9311c80d5b0Smrg[The pkg-config script could not be found or is too old.  Make sure it
9321c80d5b0Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
9331c80d5b0Smrgpath to pkg-config.
9341c80d5b0Smrg
9351c80d5b0Smrg_PKG_TEXT
9361c80d5b0Smrg
937b8df70beSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
938b8df70beSmrg        ])
9391c80d5b0Smrgelse
9401c80d5b0Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
9411c80d5b0Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
9421c80d5b0Smrg        AC_MSG_RESULT([yes])
943b8df70beSmrg	$3
9441c80d5b0Smrgfi[]dnl
945b8df70beSmrg])dnl PKG_CHECK_MODULES
946b8df70beSmrg
947b8df70beSmrg
948b8df70beSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
949b8df70beSmrgdnl   [ACTION-IF-NOT-FOUND])
950b8df70beSmrgdnl ---------------------------------------------------------------------
951b8df70beSmrgdnl Since: 0.29
952b8df70beSmrgdnl
953b8df70beSmrgdnl Checks for existence of MODULES and gathers its build flags with
954b8df70beSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
955b8df70beSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
956b8df70beSmrgdnl
957b8df70beSmrgdnl Note that if there is a possibility the first call to
958b8df70beSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
959b8df70beSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
960b8df70beSmrgdnl configure.ac.
961b8df70beSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
962b8df70beSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
963b8df70beSmrg_save_PKG_CONFIG=$PKG_CONFIG
964b8df70beSmrgPKG_CONFIG="$PKG_CONFIG --static"
965b8df70beSmrgPKG_CHECK_MODULES($@)
966b8df70beSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
967b8df70beSmrg])dnl PKG_CHECK_MODULES_STATIC
968b8df70beSmrg
969b8df70beSmrg
970b8df70beSmrgdnl PKG_INSTALLDIR([DIRECTORY])
971b8df70beSmrgdnl -------------------------
972b8df70beSmrgdnl Since: 0.27
973b8df70beSmrgdnl
974b8df70beSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
975b8df70beSmrgdnl should install pkg-config .pc files. By default the directory is
976b8df70beSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
977b8df70beSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
978b8df70beSmrgdnl parameter.
979b8df70beSmrgAC_DEFUN([PKG_INSTALLDIR],
980b8df70beSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
981b8df70beSmrgm4_pushdef([pkg_description],
982b8df70beSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
983b8df70beSmrgAC_ARG_WITH([pkgconfigdir],
984b8df70beSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
985b8df70beSmrg    [with_pkgconfigdir=]pkg_default)
986b8df70beSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
987b8df70beSmrgm4_popdef([pkg_default])
988b8df70beSmrgm4_popdef([pkg_description])
989b8df70beSmrg])dnl PKG_INSTALLDIR
990b8df70beSmrg
991b8df70beSmrg
992b8df70beSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
993b8df70beSmrgdnl --------------------------------
994b8df70beSmrgdnl Since: 0.27
995b8df70beSmrgdnl
996b8df70beSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
997b8df70beSmrgdnl module should install arch-independent pkg-config .pc files. By
998b8df70beSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
999b8df70beSmrgdnl changed by passing DIRECTORY. The user can override through the
1000b8df70beSmrgdnl --with-noarch-pkgconfigdir parameter.
1001b8df70beSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1002b8df70beSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1003b8df70beSmrgm4_pushdef([pkg_description],
1004b8df70beSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1005b8df70beSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1006b8df70beSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1007b8df70beSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1008b8df70beSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1009b8df70beSmrgm4_popdef([pkg_default])
1010b8df70beSmrgm4_popdef([pkg_description])
1011b8df70beSmrg])dnl PKG_NOARCH_INSTALLDIR
1012b8df70beSmrg
1013b8df70beSmrg
1014b8df70beSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1015b8df70beSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1016b8df70beSmrgdnl -------------------------------------------
1017b8df70beSmrgdnl Since: 0.28
1018b8df70beSmrgdnl
1019b8df70beSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1020b8df70beSmrgAC_DEFUN([PKG_CHECK_VAR],
1021b8df70beSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1022b8df70beSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1023b8df70beSmrg
1024b8df70beSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1025b8df70beSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1026b8df70beSmrg
1027b8df70beSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1028b8df70beSmrg])dnl PKG_CHECK_VAR
10291c80d5b0Smrg
10301c80d5b0Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
10311c80d5b0Smrgdnl
1032944bff83Smrgdnl This file comes from X.Org's font-util 1.3.3
10331c80d5b0Smrgdnl
10341c80d5b0Smrgdnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
10351c80d5b0Smrgdnl
10361c80d5b0Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
10371c80d5b0Smrgdnl copy of this software and associated documentation files (the "Software"),
10381c80d5b0Smrgdnl to deal in the Software without restriction, including without limitation
10391c80d5b0Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
10401c80d5b0Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
10411c80d5b0Smrgdnl Software is furnished to do so, subject to the following conditions:
10421c80d5b0Smrgdnl
10431c80d5b0Smrgdnl The above copyright notice and this permission notice (including the next
10441c80d5b0Smrgdnl paragraph) shall be included in all copies or substantial portions of the
10451c80d5b0Smrgdnl Software.
10461c80d5b0Smrgdnl
10471c80d5b0Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10481c80d5b0Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10491c80d5b0Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
10501c80d5b0Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10511c80d5b0Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
10521c80d5b0Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
10531c80d5b0Smrgdnl DEALINGS IN THE SOFTWARE.
10541c80d5b0Smrgdnl
10551c80d5b0Smrgdnl --------------------------------------------------------------------
10561c80d5b0Smrgdnl
10571c80d5b0Smrgdnl Copyright 2005 Red Hat, Inc
10581c80d5b0Smrgdnl
10591c80d5b0Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
10601c80d5b0Smrgdnl documentation for any purpose is hereby granted without fee, provided that
10611c80d5b0Smrgdnl the above copyright notice appear in all copies and that both that
10621c80d5b0Smrgdnl copyright notice and this permission notice appear in supporting
10631c80d5b0Smrgdnl documentation.
10641c80d5b0Smrgdnl
10651c80d5b0Smrgdnl The above copyright notice and this permission notice shall be included
10661c80d5b0Smrgdnl in all copies or substantial portions of the Software.
10671c80d5b0Smrgdnl
10681c80d5b0Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10691c80d5b0Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10701c80d5b0Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
10711c80d5b0Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
10721c80d5b0Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
10731c80d5b0Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
10741c80d5b0Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
10751c80d5b0Smrgdnl
10761c80d5b0Smrgdnl Except as contained in this notice, the name of the copyright holders shall
10771c80d5b0Smrgdnl not be used in advertising or otherwise to promote the sale, use or
10781c80d5b0Smrgdnl other dealings in this Software without prior written authorization
10791c80d5b0Smrgdnl from the copyright holders.
10801c80d5b0Smrg
10811c80d5b0Smrg# XORG_FONT_MACROS_VERSION(required-version)
10821c80d5b0Smrg# ------------------------------------------
10831c80d5b0Smrg# Minimum version: 1.1.0
10841c80d5b0Smrg#
10851c80d5b0Smrg# If you're using a macro added in Version 1.1 or newer, include this in
10861c80d5b0Smrg# your configure.ac with the minimum required version, such as:
10871c80d5b0Smrg# XORG_FONT_MACROS_VERSION(1.1)
10881c80d5b0Smrg#
10891c80d5b0Smrg# To ensure that this macro is defined, also add:
10901c80d5b0Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
10911c80d5b0Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
10921c80d5b0Smrg#
10931c80d5b0Smrg#
10941c80d5b0Smrg# See the "minimum version" comment for each macro you use to see what
10951c80d5b0Smrg# version you require.
10961c80d5b0Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
1097944bff83Smrgm4_define([vers_have], [1.3.3])
10981c80d5b0Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
10991c80d5b0Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
11001c80d5b0Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
11011c80d5b0Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
11021c80d5b0Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
11031c80d5b0Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
11041c80d5b0Smrgm4_undefine([vers_have])
11051c80d5b0Smrgm4_undefine([maj_have])
11061c80d5b0Smrgm4_undefine([maj_needed])
11071c80d5b0Smrg]) # XORG_FONT_MACROS_VERSION
11081c80d5b0Smrg
11091c80d5b0Smrg# XORG_FONT_CHECK_{maps}()
11101c80d5b0Smrg# ------------------------
11111c80d5b0Smrg# Minimum version: 1.0.0
11121c80d5b0Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
11131c80d5b0Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
11141c80d5b0Smrg
11151c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
11161c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
11171c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
11181c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
11191c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
11201c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
11211c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
11221c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
11231c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
11241c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
11251c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
11261c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
11271c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
11281c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
11291c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
11301c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
11311c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
11321c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
11331c80d5b0Smrg
11341c80d5b0Smrg# XORG_FONT_CHECK_ENCODING(encoding)
11351c80d5b0Smrg# ----------------------------------
11361c80d5b0Smrg# Minimum version: 1.1.0
11371c80d5b0Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
11381c80d5b0Smrg# It replaced individual copies of this code in the above macros in 1.1.
11391c80d5b0Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
11401c80d5b0Smrg# calls if this is not true in the future.
11411c80d5b0Smrg
11421c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
11431c80d5b0Smrg	AC_ARG_ENABLE(m4_tolower($1),
11441c80d5b0Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
11451c80d5b0Smrg				[Build $1 fonts (default: yes)]),
11461c80d5b0Smrg		[AS_TR_SH($1)=$enableval])
11471c80d5b0Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
11481c80d5b0Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
11491c80d5b0Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
11501c80d5b0Smrg]) # XORG_FONT_CHECK_ENCODING
11511c80d5b0Smrg
11521c80d5b0Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
11531c80d5b0Smrg# -----------------------------------------------------
11541c80d5b0Smrg# Minimum version: 1.1.0
1155d7ffce2aSmrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
1156d7ffce2aSmrg# Add a shorthand --enable/disable-all-encodings option.
1157d7ffce2aSmrg
1158d7ffce2aSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
1159d7ffce2aSmrg	AC_ARG_ENABLE([all-encodings],
1160d7ffce2aSmrg		AS_HELP_STRING([--disable-all-encodings],
1161d7ffce2aSmrg				[Disable building of all font encodings]),
1162d7ffce2aSmrg		[m4_foreach_w([enc], [$1], [
1163d7ffce2aSmrg			AS_TR_SH(enc)=$enableval
1164d7ffce2aSmrg		])],
1165d7ffce2aSmrg		[m4_foreach_w([enc], [$1], [
1166d7ffce2aSmrg			AS_TR_SH(enc)=yes
1167d7ffce2aSmrg		])])
1168d7ffce2aSmrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
1169d7ffce2aSmrg]) # XORG_FONT_CHECK_ENCODING_LIST
1170d7ffce2aSmrg
1171d7ffce2aSmrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
1172d7ffce2aSmrg# ------------------------------------------
1173d7ffce2aSmrg# Minimum version: 1.1.0
1174d7ffce2aSmrg#
1175d7ffce2aSmrg# Simple wrapper around AC_PATH_PROG that errors if not found
1176d7ffce2aSmrg#
1177d7ffce2aSmrg
1178d7ffce2aSmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
1179d7ffce2aSmrg	AC_PATH_PROG($1, $2)
1180d7ffce2aSmrg	if test x"$$1" = x; then
1181d7ffce2aSmrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
1182d7ffce2aSmrg	fi
1183d7ffce2aSmrg])
1184d7ffce2aSmrg
1185d7ffce2aSmrg
1186d7ffce2aSmrg# XORG_FONT_FCCACHE()
1187d7ffce2aSmrg# -------------------
1188d7ffce2aSmrg# Minimum version: 1.1.0
1189d7ffce2aSmrg#
1190d7ffce2aSmrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
1191d7ffce2aSmrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
11921c80d5b0Smrg# to run fc-cache if found and not installing to $DESTDIR and not
11931c80d5b0Smrg# cross-compiling
1194d7ffce2aSmrg#
1195d7ffce2aSmrg# fc-cache is optional, not required, and should be skipped when making
11961c80d5b0Smrg# packages (installing to $DESTDIR) or cross-compiling
1197d7ffce2aSmrg#
1198d7ffce2aSmrgAC_DEFUN([XORG_FONT_FCCACHE],[
1199d7ffce2aSmrg	AC_PATH_PROG(FCCACHE, fc-cache)
1200d7ffce2aSmrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
12011c80d5b0Smrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
1202d7ffce2aSmrg		RUN_FCCACHE="${FCCACHE_WARN}"
1203d7ffce2aSmrg	else
1204d7ffce2aSmrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
1205d7ffce2aSmrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
1206d7ffce2aSmrg	fi
1207d7ffce2aSmrg	AC_SUBST([RUN_FCCACHE])
1208d7ffce2aSmrg])
1209d7ffce2aSmrg
12101c80d5b0Smrg# XORG_FONT_MKFONTDIR()
12111c80d5b0Smrg# -------------------
12121c80d5b0Smrg# Minimum version: 1.3.0
12131c80d5b0Smrg#
12141c80d5b0Smrg# Set MKFONTDIR to path to mkfontdir.
12151c80d5b0Smrg#
12161c80d5b0Smrg# If cross-compiling, and if mkdir is not found, use a shell command
12171c80d5b0Smrg# which warns mkfontdir needs to be run on the target
12181c80d5b0Smrg#
12191c80d5b0Smrg# If not cross-compiling, mkfontdir must be found
12201c80d5b0Smrg#
12211c80d5b0SmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
12221c80d5b0Smrg	if test x"$cross_compiling" != x"no" ; then
12231c80d5b0Smrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
12241c80d5b0Smrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
12251c80d5b0Smrg
12261c80d5b0Smrg		if test x"$MKFONTDIR" = x; then
12271c80d5b0Smrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
12281c80d5b0Smrg		fi
12291c80d5b0Smrg	else
12301c80d5b0Smrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
12311c80d5b0Smrg	fi
12321c80d5b0Smrg
12331c80d5b0Smrg	AC_SUBST([MKFONTDIR])
12341c80d5b0Smrg])
1235d7ffce2aSmrg
1236d7ffce2aSmrg# XORG_FONT_COMMON_UTILS()
1237d7ffce2aSmrg# ------------------------
1238d7ffce2aSmrg# Minimum version: 1.1.0
1239d7ffce2aSmrg#
1240d7ffce2aSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
1241d7ffce2aSmrg
1242d7ffce2aSmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
1243d7ffce2aSmrg	XORG_FONT_FCCACHE
12441c80d5b0Smrg	XORG_FONT_MKFONTDIR
1245d7ffce2aSmrg])
1246d7ffce2aSmrg
1247d7ffce2aSmrg# XORG_FONT_SCALED_UTILS()
1248d7ffce2aSmrg# ------------------------
1249d7ffce2aSmrg# Minimum version: 1.1.0
1250d7ffce2aSmrg#
1251d7ffce2aSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
1252d7ffce2aSmrg# (TrueType, OpenType, Type1)
1253d7ffce2aSmrg
1254d7ffce2aSmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
1255d7ffce2aSmrg	XORG_FONT_COMMON_UTILS
1256d7ffce2aSmrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
1257d7ffce2aSmrg])
1258d7ffce2aSmrg
1259d7ffce2aSmrg# XORG_FONT_BDF_UTILS()
1260d7ffce2aSmrg# ---------------------
1261d7ffce2aSmrg# Minimum version: 1.1.0
1262d7ffce2aSmrg#
1263d7ffce2aSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
1264d7ffce2aSmrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
1265d7ffce2aSmrg# PCF output files created by bdftopcf
1266d7ffce2aSmrg
1267d7ffce2aSmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
1268d7ffce2aSmrg	XORG_FONT_COMMON_UTILS
1269d7ffce2aSmrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
1270d7ffce2aSmrg	XORG_FONT_CHECK_COMPRESSION
1271d7ffce2aSmrg])
1272d7ffce2aSmrg
1273d7ffce2aSmrg# XORG_FONT_CHECK_COMPRESSION()
1274d7ffce2aSmrg# -----------------------------
1275d7ffce2aSmrg# Minimum version: 1.1.0
1276d7ffce2aSmrg#
1277d7ffce2aSmrg# Offer a --with-compression flag to control what compression method is
1278d7ffce2aSmrg# used for pcf font files.   Offers all the methods currently supported
1279d7ffce2aSmrg# by libXfont, including no compression.
1280944bff83Smrg#
1281944bff83Smrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
1282944bff83Smrg# for reproducible builds, such as gzip -n to not record timestamp, will
1283944bff83Smrg# set COMPRESS_FLAGS to those options.
1284d7ffce2aSmrg
1285d7ffce2aSmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
1286d7ffce2aSmrg	AC_MSG_CHECKING([font compression method])
1287d7ffce2aSmrg	AC_ARG_WITH(compression,
1288d7ffce2aSmrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
1289d7ffce2aSmrg			 [compression method to use on pcf fonts])],
1290d7ffce2aSmrg         [compression="$withval"], [compression="yes"])
1291d7ffce2aSmrg	if test x"$compression" = "xyes" ; then
1292d7ffce2aSmrg		compression="gzip"
1293d7ffce2aSmrg	fi
1294d7ffce2aSmrg	AC_MSG_RESULT([${compression}])
1295d7ffce2aSmrg	case ${compression} in
1296d7ffce2aSmrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
1297944bff83Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
1298944bff83Smrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
1299d7ffce2aSmrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
1300d7ffce2aSmrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
1301d7ffce2aSmrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
1302d7ffce2aSmrg	esac
1303d7ffce2aSmrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
1304d7ffce2aSmrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
1305d7ffce2aSmrg	fi
1306944bff83Smrg	AC_MSG_CHECKING([options to font compression command])
1307944bff83Smrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
1308944bff83Smrg	AC_SUBST([COMPRESS_FLAGS])
1309d7ffce2aSmrg	AC_SUBST([COMPRESS_SUFFIX])
1310d7ffce2aSmrg])
1311d7ffce2aSmrg
1312d7ffce2aSmrg# XORG_FONT_UCS2ANY()
1313d7ffce2aSmrg# -------------------
1314d7ffce2aSmrg# Minimum version: 1.1.0
1315d7ffce2aSmrg#
1316d7ffce2aSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
1317d7ffce2aSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
1318d7ffce2aSmrg# Also call pkg-config to find the directory with the encoding files needed
1319d7ffce2aSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
1320d7ffce2aSmrg
1321d7ffce2aSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
132241fe0c2aSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1323d7ffce2aSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
1324d7ffce2aSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
1325d7ffce2aSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
132641fe0c2aSmrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
1327d7ffce2aSmrg	AC_SUBST(MAPFILES_PATH)
1328d7ffce2aSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
1329d7ffce2aSmrg])
1330d7ffce2aSmrg
1331d7ffce2aSmrg
1332d7ffce2aSmrg
1333d7ffce2aSmrg# XORG_FONT_FC_CONFDIR()
1334d7ffce2aSmrg# --------------------
1335d7ffce2aSmrg# Minimum version: 1.2.0
1336d7ffce2aSmrg#
1337d7ffce2aSmrg# Sets FC_CONFDIR to the fontconfig config directory
1338d7ffce2aSmrg# (which should be --with-confdir=... when building fontconfig)
1339d7ffce2aSmrg# found from:
1340d7ffce2aSmrg#	--with-fc-confdir=...
1341d7ffce2aSmrg#	pkg-config --variable=confdir fontconfig
1342d7ffce2aSmrg#	${sysconfdir}/fonts
1343d7ffce2aSmrg
1344d7ffce2aSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
1345d7ffce2aSmrg	dnl Ensure $PKG_CONFIG is set first
1346d7ffce2aSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1347d7ffce2aSmrg
1348d7ffce2aSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
1349d7ffce2aSmrg	AC_ARG_WITH(fc-confdir,
1350d7ffce2aSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
1351d7ffce2aSmrg			   [Path to fontconfig's configuration directory]),
1352d7ffce2aSmrg		    [FC_CONFDIR="$withval"])
1353d7ffce2aSmrg	# if --with-fc-confdir was not specified
1354d7ffce2aSmrg	if test "x${FC_CONFDIR}" = "x"; then
1355d7ffce2aSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
1356d7ffce2aSmrg	fi
1357d7ffce2aSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
1358d7ffce2aSmrg	if test "x${FC_CONFDIR}" = "x"; then
1359d7ffce2aSmrg		FC_CONFDIR="${sysconfdir}/fonts"
1360d7ffce2aSmrg	fi
1361d7ffce2aSmrg	AC_SUBST(FC_CONFDIR)
1362d7ffce2aSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
1363d7ffce2aSmrg])
1364d7ffce2aSmrg
1365d7ffce2aSmrg
1366d7ffce2aSmrg
1367d7ffce2aSmrg# XORG_FONTROOTDIR()
1368d7ffce2aSmrg# --------------------
1369d7ffce2aSmrg# Minimum version: 1.1.0
1370d7ffce2aSmrg#
1371d7ffce2aSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
1372d7ffce2aSmrg# found from:
1373d7ffce2aSmrg#	--with-fontrootdir
1374d7ffce2aSmrg#	pkg-config --variable=fontrootdir fontutil
1375d7ffce2aSmrg#	${datadir}/fonts/X11
1376d7ffce2aSmrg
1377d7ffce2aSmrgAC_DEFUN([XORG_FONTROOTDIR],[
1378d7ffce2aSmrg	dnl Ensure $PKG_CONFIG is set first
1379d7ffce2aSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1380d7ffce2aSmrg
1381d7ffce2aSmrg	AC_MSG_CHECKING([for root directory for font files])
1382d7ffce2aSmrg	AC_ARG_WITH(fontrootdir,
1383d7ffce2aSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
1384d7ffce2aSmrg			   [Path to root directory for font files]),
1385d7ffce2aSmrg		    [FONTROOTDIR="$withval"])
1386d7ffce2aSmrg	# if --with-fontrootdir not specified...
1387d7ffce2aSmrg	if test "x${FONTROOTDIR}" = "x"; then
1388d7ffce2aSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
1389d7ffce2aSmrg	fi
1390d7ffce2aSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
1391d7ffce2aSmrg	if test "x${FONTROOTDIR}" = "x"; then
1392d7ffce2aSmrg		FONTROOTDIR="${datadir}/fonts/X11"
1393d7ffce2aSmrg	fi
1394d7ffce2aSmrg	AC_SUBST(FONTROOTDIR)
1395d7ffce2aSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
1396d7ffce2aSmrg])
1397d7ffce2aSmrg
1398d7ffce2aSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
1399d7ffce2aSmrg# ---------------------------------------
1400d7ffce2aSmrg# Minimum version: 1.1.0
1401d7ffce2aSmrg#
1402d7ffce2aSmrg# Offer a --with-<flag> flag to control directory for font installation
1403d7ffce2aSmrg# Default is the specified <subdir> of the font root directory.
1404d7ffce2aSmrg# Sets <variable> to the selected directory
1405d7ffce2aSmrg
1406d7ffce2aSmrgAC_DEFUN([XORG_FONTSUBDIR],[
1407d7ffce2aSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
1408d7ffce2aSmrg
1409d7ffce2aSmrg	AC_MSG_CHECKING([for directory for $3 files])
1410d7ffce2aSmrg	AC_ARG_WITH($2,
1411d7ffce2aSmrg		    [AS_HELP_STRING([--with-$2=DIR],
1412d7ffce2aSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
1413d7ffce2aSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
1414d7ffce2aSmrg	AC_SUBST($1)
1415d7ffce2aSmrg	AC_MSG_RESULT([${$1}])
1416d7ffce2aSmrg]) # XORG_FONTSUBDIR
1417d7ffce2aSmrg
1418d7ffce2aSmrg# XORG_FONTDIR(subdir)
1419d7ffce2aSmrg# --------------------
1420d7ffce2aSmrg# Minimum version: 1.1.0
1421d7ffce2aSmrg#
1422d7ffce2aSmrg# Offer a --with-fontdir flag to control directory for font installation
1423d7ffce2aSmrg# Default is the specified subdir of the font root directory.
1424d7ffce2aSmrg# Sets FONTDIR to the selected directory
1425d7ffce2aSmrg
1426d7ffce2aSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
1427d7ffce2aSmrg
1428d7ffce2aSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14294c61c93dSmrgdnl
1430944bff83Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
143141fe0c2aSmrgdnl
1432d7ffce2aSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1433d7ffce2aSmrgdnl copy of this software and associated documentation files (the "Software"),
1434d7ffce2aSmrgdnl to deal in the Software without restriction, including without limitation
1435d7ffce2aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1436d7ffce2aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1437d7ffce2aSmrgdnl Software is furnished to do so, subject to the following conditions:
1438d7ffce2aSmrgdnl
1439d7ffce2aSmrgdnl The above copyright notice and this permission notice (including the next
1440d7ffce2aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1441d7ffce2aSmrgdnl Software.
1442d7ffce2aSmrgdnl
1443d7ffce2aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1444d7ffce2aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1445d7ffce2aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1446d7ffce2aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1447d7ffce2aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1448d7ffce2aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1449d7ffce2aSmrgdnl DEALINGS IN THE SOFTWARE.
14504c61c93dSmrg
14514c61c93dSmrg# XORG_MACROS_VERSION(required-version)
14524c61c93dSmrg# -------------------------------------
14534c61c93dSmrg# Minimum version: 1.1.0
14544c61c93dSmrg#
14554c61c93dSmrg# If you're using a macro added in Version 1.1 or newer, include this in
14564c61c93dSmrg# your configure.ac with the minimum required version, such as:
14574c61c93dSmrg# XORG_MACROS_VERSION(1.1)
14584c61c93dSmrg#
14594c61c93dSmrg# To ensure that this macro is defined, also add:
14604c61c93dSmrg# m4_ifndef([XORG_MACROS_VERSION],
14614c61c93dSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14624c61c93dSmrg#
14634c61c93dSmrg#
146441fe0c2aSmrg# See the "minimum version" comment for each macro you use to see what
14654c61c93dSmrg# version you require.
14664c61c93dSmrgm4_defun([XORG_MACROS_VERSION],[
1467944bff83Smrgm4_define([vers_have], [1.20.0])
14684c61c93dSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14694c61c93dSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14704c61c93dSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14714c61c93dSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14724c61c93dSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14734c61c93dSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14744c61c93dSmrgm4_undefine([vers_have])
14754c61c93dSmrgm4_undefine([maj_have])
14764c61c93dSmrgm4_undefine([maj_needed])
14774c61c93dSmrg]) # XORG_MACROS_VERSION
14784c61c93dSmrg
14794c61c93dSmrg# XORG_PROG_RAWCPP()
14804c61c93dSmrg# ------------------
14814c61c93dSmrg# Minimum version: 1.0.0
14824c61c93dSmrg#
14834c61c93dSmrg# Find cpp program and necessary flags for use in pre-processing text files
14844c61c93dSmrg# such as man pages and config files
14854c61c93dSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14864c61c93dSmrgAC_REQUIRE([AC_PROG_CPP])
1487b8df70beSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14884c61c93dSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14894c61c93dSmrg
14904c61c93dSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14914c61c93dSmrg# which is not the best choice for supporting other OS'es, but covers most
14924c61c93dSmrg# of the ones we need for now.
14934c61c93dSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14941c80d5b0SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14954c61c93dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14964c61c93dSmrg	AC_MSG_RESULT([no])
14974c61c93dSmrgelse
14984c61c93dSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14994c61c93dSmrg		RAWCPPFLAGS=-undef
15004c61c93dSmrg		AC_MSG_RESULT([yes])
15014c61c93dSmrg	# under Cygwin unix is still defined even with -undef
15024c61c93dSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15034c61c93dSmrg		RAWCPPFLAGS="-undef -ansi"
15044c61c93dSmrg		AC_MSG_RESULT([yes, with -ansi])
15054c61c93dSmrg	else
15064c61c93dSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15074c61c93dSmrg	fi
15084c61c93dSmrgfi
15094c61c93dSmrgrm -f conftest.$ac_ext
15104c61c93dSmrg
15114c61c93dSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15121c80d5b0SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15134c61c93dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15144c61c93dSmrg	AC_MSG_RESULT([no])
15154c61c93dSmrgelse
15164c61c93dSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151741fe0c2aSmrg		TRADITIONALCPPFLAGS="-traditional"
15184c61c93dSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15194c61c93dSmrg		AC_MSG_RESULT([yes])
15204c61c93dSmrg	else
15214c61c93dSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15224c61c93dSmrg	fi
15234c61c93dSmrgfi
15244c61c93dSmrgrm -f conftest.$ac_ext
15254c61c93dSmrgAC_SUBST(RAWCPPFLAGS)
152641fe0c2aSmrgAC_SUBST(TRADITIONALCPPFLAGS)
15274c61c93dSmrg]) # XORG_PROG_RAWCPP
15284c61c93dSmrg
15294c61c93dSmrg# XORG_MANPAGE_SECTIONS()
15304c61c93dSmrg# -----------------------
15314c61c93dSmrg# Minimum version: 1.0.0
15324c61c93dSmrg#
15334c61c93dSmrg# Determine which sections man pages go in for the different man page types
15344c61c93dSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15354c61c93dSmrg# Not sure if there's any better way than just hardcoding by OS name.
15364c61c93dSmrg# Override default settings by setting environment variables
1537d7ffce2aSmrg# Added MAN_SUBSTS in version 1.8
1538d7ffce2aSmrg# Added AC_PROG_SED in version 1.8
15394c61c93dSmrg
15404c61c93dSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15414c61c93dSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1542d7ffce2aSmrgAC_REQUIRE([AC_PROG_SED])
15434c61c93dSmrg
1544b8df70beSmrgcase $host_os in
1545b8df70beSmrg    solaris*)
1546b8df70beSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1547b8df70beSmrg        # check for a man page file found in later versions that use
1548b8df70beSmrg        # traditional section numbers instead
1549b8df70beSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1550b8df70beSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1551b8df70beSmrg        ;;
1552b8df70beSmrg    *) SYSV_MAN_SECTIONS=false ;;
1553b8df70beSmrgesac
1554b8df70beSmrg
15554c61c93dSmrgif test x$APP_MAN_SUFFIX = x    ; then
15564c61c93dSmrg    APP_MAN_SUFFIX=1
15574c61c93dSmrgfi
15584c61c93dSmrgif test x$APP_MAN_DIR = x    ; then
15594c61c93dSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15604c61c93dSmrgfi
15614c61c93dSmrg
15624c61c93dSmrgif test x$LIB_MAN_SUFFIX = x    ; then
15634c61c93dSmrg    LIB_MAN_SUFFIX=3
15644c61c93dSmrgfi
15654c61c93dSmrgif test x$LIB_MAN_DIR = x    ; then
15664c61c93dSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15674c61c93dSmrgfi
15684c61c93dSmrg
15694c61c93dSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1570b8df70beSmrg    case $SYSV_MAN_SECTIONS in
1571b8df70beSmrg	true)				FILE_MAN_SUFFIX=4  ;;
157241fe0c2aSmrg	*)				FILE_MAN_SUFFIX=5  ;;
15734c61c93dSmrg    esac
15744c61c93dSmrgfi
15754c61c93dSmrgif test x$FILE_MAN_DIR = x    ; then
15764c61c93dSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15774c61c93dSmrgfi
15784c61c93dSmrg
15794c61c93dSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1580b8df70beSmrg    case $SYSV_MAN_SECTIONS in
1581b8df70beSmrg	true)				MISC_MAN_SUFFIX=5  ;;
158241fe0c2aSmrg	*)				MISC_MAN_SUFFIX=7  ;;
15834c61c93dSmrg    esac
15844c61c93dSmrgfi
15854c61c93dSmrgif test x$MISC_MAN_DIR = x    ; then
15864c61c93dSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15874c61c93dSmrgfi
15884c61c93dSmrg
15894c61c93dSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1590b8df70beSmrg    case $SYSV_MAN_SECTIONS in
1591b8df70beSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
159241fe0c2aSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
15934c61c93dSmrg    esac
15944c61c93dSmrgfi
15954c61c93dSmrgif test x$DRIVER_MAN_DIR = x    ; then
15964c61c93dSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15974c61c93dSmrgfi
15984c61c93dSmrg
15994c61c93dSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1600b8df70beSmrg    case $SYSV_MAN_SECTIONS in
1601b8df70beSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
160241fe0c2aSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16034c61c93dSmrg    esac
16044c61c93dSmrgfi
16054c61c93dSmrgif test x$ADMIN_MAN_DIR = x    ; then
16064c61c93dSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16074c61c93dSmrgfi
16084c61c93dSmrg
16094c61c93dSmrg
16104c61c93dSmrgAC_SUBST([APP_MAN_SUFFIX])
16114c61c93dSmrgAC_SUBST([LIB_MAN_SUFFIX])
16124c61c93dSmrgAC_SUBST([FILE_MAN_SUFFIX])
16134c61c93dSmrgAC_SUBST([MISC_MAN_SUFFIX])
16144c61c93dSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16154c61c93dSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16164c61c93dSmrgAC_SUBST([APP_MAN_DIR])
16174c61c93dSmrgAC_SUBST([LIB_MAN_DIR])
16184c61c93dSmrgAC_SUBST([FILE_MAN_DIR])
16194c61c93dSmrgAC_SUBST([MISC_MAN_DIR])
16204c61c93dSmrgAC_SUBST([DRIVER_MAN_DIR])
16214c61c93dSmrgAC_SUBST([ADMIN_MAN_DIR])
1622d7ffce2aSmrg
1623d7ffce2aSmrgXORG_MAN_PAGE="X Version 11"
1624d7ffce2aSmrgAC_SUBST([XORG_MAN_PAGE])
1625d7ffce2aSmrgMAN_SUBSTS="\
1626d7ffce2aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1627d7ffce2aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1628d7ffce2aSmrg	-e 's|__xservername__|Xorg|g' \
1629d7ffce2aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1630d7ffce2aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1631d7ffce2aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1632d7ffce2aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1633d7ffce2aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1634d7ffce2aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1635d7ffce2aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1636d7ffce2aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1637d7ffce2aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1638d7ffce2aSmrgAC_SUBST([MAN_SUBSTS])
1639d7ffce2aSmrg
16404c61c93dSmrg]) # XORG_MANPAGE_SECTIONS
16414c61c93dSmrg
1642d7ffce2aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1643d7ffce2aSmrg# ------------------------
1644d7ffce2aSmrg# Minimum version: 1.7.0
1645d7ffce2aSmrg#
1646d7ffce2aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1647d7ffce2aSmrg# provided by xorg-sgml-doctools, if installed.
1648d7ffce2aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1649d7ffce2aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1650d7ffce2aSmrgXORG_SGML_PATH=
1651d7ffce2aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1652d7ffce2aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1653d7ffce2aSmrg    [m4_ifval([$1],[:],
1654d7ffce2aSmrg        [if test x"$cross_compiling" != x"yes" ; then
1655d7ffce2aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1656d7ffce2aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1657d7ffce2aSmrg         fi])
1658d7ffce2aSmrg    ])
1659d7ffce2aSmrg
1660d7ffce2aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1661d7ffce2aSmrg# the path and the name of the doc stylesheet
1662d7ffce2aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1663d7ffce2aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1664d7ffce2aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1665d7ffce2aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1666d7ffce2aSmrgelse
1667d7ffce2aSmrg   AC_MSG_RESULT([no])
1668d7ffce2aSmrgfi
1669d7ffce2aSmrg
1670d7ffce2aSmrgAC_SUBST(XORG_SGML_PATH)
1671d7ffce2aSmrgAC_SUBST(STYLESHEET_SRCDIR)
1672d7ffce2aSmrgAC_SUBST(XSL_STYLESHEET)
1673d7ffce2aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1674d7ffce2aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1675d7ffce2aSmrg
16764c61c93dSmrg# XORG_CHECK_LINUXDOC
16774c61c93dSmrg# -------------------
16784c61c93dSmrg# Minimum version: 1.0.0
16794c61c93dSmrg#
16804c61c93dSmrg# Defines the variable MAKE_TEXT if the necessary tools and
16814c61c93dSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16824c61c93dSmrg# Whether or not the necessary tools and files are found can be checked
16834c61c93dSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16844c61c93dSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1685d7ffce2aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1686d7ffce2aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16874c61c93dSmrg
16884c61c93dSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16894c61c93dSmrg
1690d7ffce2aSmrgAC_MSG_CHECKING([whether to build documentation])
16914c61c93dSmrg
1692d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16934c61c93dSmrg   BUILDDOC=yes
16944c61c93dSmrgelse
16954c61c93dSmrg   BUILDDOC=no
16964c61c93dSmrgfi
16974c61c93dSmrg
16984c61c93dSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16994c61c93dSmrg
17004c61c93dSmrgAC_MSG_RESULT([$BUILDDOC])
17014c61c93dSmrg
1702d7ffce2aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
17034c61c93dSmrg
1704d7ffce2aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17054c61c93dSmrg   BUILDPDFDOC=yes
17064c61c93dSmrgelse
17074c61c93dSmrg   BUILDPDFDOC=no
17084c61c93dSmrgfi
17094c61c93dSmrg
17104c61c93dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17114c61c93dSmrg
17124c61c93dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17134c61c93dSmrg
1714d7ffce2aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17154c61c93dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17164c61c93dSmrgMAKE_PDF="$PS2PDF"
17174c61c93dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17184c61c93dSmrg
17194c61c93dSmrgAC_SUBST(MAKE_TEXT)
17204c61c93dSmrgAC_SUBST(MAKE_PS)
17214c61c93dSmrgAC_SUBST(MAKE_PDF)
17224c61c93dSmrgAC_SUBST(MAKE_HTML)
17234c61c93dSmrg]) # XORG_CHECK_LINUXDOC
17244c61c93dSmrg
17254c61c93dSmrg# XORG_CHECK_DOCBOOK
17264c61c93dSmrg# -------------------
17274c61c93dSmrg# Minimum version: 1.0.0
17284c61c93dSmrg#
17294c61c93dSmrg# Checks for the ability to build output formats from SGML DocBook source.
17304c61c93dSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17314c61c93dSmrg# indicates whether the necessary tools and files are found and, if set,
17324c61c93dSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17334c61c93dSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1734d7ffce2aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1735d7ffce2aSmrg
17364c61c93dSmrgBUILDTXTDOC=no
17374c61c93dSmrgBUILDPDFDOC=no
17384c61c93dSmrgBUILDPSDOC=no
17394c61c93dSmrgBUILDHTMLDOC=no
17404c61c93dSmrg
17414c61c93dSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17424c61c93dSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17434c61c93dSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17444c61c93dSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17454c61c93dSmrg
1746d7ffce2aSmrgAC_MSG_CHECKING([whether to build text documentation])
1747d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17484c61c93dSmrg   test x$BUILD_TXTDOC != xno; then
17494c61c93dSmrg	BUILDTXTDOC=yes
17504c61c93dSmrgfi
17514c61c93dSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17524c61c93dSmrgAC_MSG_RESULT([$BUILDTXTDOC])
17534c61c93dSmrg
1754d7ffce2aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1755d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17564c61c93dSmrg   test x$BUILD_PDFDOC != xno; then
17574c61c93dSmrg	BUILDPDFDOC=yes
17584c61c93dSmrgfi
17594c61c93dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17604c61c93dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17614c61c93dSmrg
1762d7ffce2aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1763d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17644c61c93dSmrg   test x$BUILD_PSDOC != xno; then
17654c61c93dSmrg	BUILDPSDOC=yes
17664c61c93dSmrgfi
17674c61c93dSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17684c61c93dSmrgAC_MSG_RESULT([$BUILDPSDOC])
17694c61c93dSmrg
1770d7ffce2aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1771d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17724c61c93dSmrg   test x$BUILD_HTMLDOC != xno; then
17734c61c93dSmrg	BUILDHTMLDOC=yes
17744c61c93dSmrgfi
17754c61c93dSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17764c61c93dSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17774c61c93dSmrg
17784c61c93dSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17794c61c93dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17804c61c93dSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17814c61c93dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17824c61c93dSmrg
17834c61c93dSmrgAC_SUBST(MAKE_TEXT)
17844c61c93dSmrgAC_SUBST(MAKE_PS)
17854c61c93dSmrgAC_SUBST(MAKE_PDF)
17864c61c93dSmrgAC_SUBST(MAKE_HTML)
17874c61c93dSmrg]) # XORG_CHECK_DOCBOOK
17884c61c93dSmrg
1789d7ffce2aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1790d7ffce2aSmrg# ----------------
1791d7ffce2aSmrg# Minimum version: 1.5.0
1792d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1793d7ffce2aSmrg#
1794d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
1795d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
1796d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1797944bff83Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1798d7ffce2aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1799d7ffce2aSmrg# --with-xmlto assumes 'auto'.
1800d7ffce2aSmrg#
1801d7ffce2aSmrg# Interface to module:
1802d7ffce2aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1803d7ffce2aSmrg# XMLTO:	returns the path of the xmlto program found
1804d7ffce2aSmrg#		returns the path set by the user in the environment
1805d7ffce2aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1806d7ffce2aSmrg#		'no' user instructs the module not to use xmlto
1807d7ffce2aSmrg#
1808d7ffce2aSmrg# Added in version 1.10.0
1809d7ffce2aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1810d7ffce2aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1811d7ffce2aSmrg#
1812d7ffce2aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1813d7ffce2aSmrg#
1814d7ffce2aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1815d7ffce2aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1816d7ffce2aSmrgm4_define([_defopt], m4_default([$2], [auto]))
1817d7ffce2aSmrgAC_ARG_WITH(xmlto,
1818d7ffce2aSmrg	AS_HELP_STRING([--with-xmlto],
1819d7ffce2aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1820d7ffce2aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1821d7ffce2aSmrgm4_undefine([_defopt])
1822d7ffce2aSmrg
1823d7ffce2aSmrgif test "x$use_xmlto" = x"auto"; then
1824d7ffce2aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1825d7ffce2aSmrg   if test "x$XMLTO" = "x"; then
1826d7ffce2aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1827d7ffce2aSmrg	have_xmlto=no
1828d7ffce2aSmrg   else
1829d7ffce2aSmrg        have_xmlto=yes
1830d7ffce2aSmrg   fi
1831d7ffce2aSmrgelif test "x$use_xmlto" = x"yes" ; then
1832d7ffce2aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1833d7ffce2aSmrg   if test "x$XMLTO" = "x"; then
1834d7ffce2aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1835d7ffce2aSmrg   fi
1836d7ffce2aSmrg   have_xmlto=yes
1837d7ffce2aSmrgelif test "x$use_xmlto" = x"no" ; then
1838d7ffce2aSmrg   if test "x$XMLTO" != "x"; then
1839d7ffce2aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1840d7ffce2aSmrg   fi
1841d7ffce2aSmrg   have_xmlto=no
1842d7ffce2aSmrgelse
1843d7ffce2aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1844d7ffce2aSmrgfi
1845d7ffce2aSmrg
1846d7ffce2aSmrg# Test for a minimum version of xmlto, if provided.
1847d7ffce2aSmrgm4_ifval([$1],
1848d7ffce2aSmrg[if test "$have_xmlto" = yes; then
1849d7ffce2aSmrg    # scrape the xmlto version
1850d7ffce2aSmrg    AC_MSG_CHECKING([the xmlto version])
1851d7ffce2aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1852d7ffce2aSmrg    AC_MSG_RESULT([$xmlto_version])
1853d7ffce2aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1854d7ffce2aSmrg        [if test "x$use_xmlto" = xauto; then
1855d7ffce2aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1856d7ffce2aSmrg            have_xmlto=no
1857d7ffce2aSmrg        else
1858d7ffce2aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1859d7ffce2aSmrg        fi])
1860d7ffce2aSmrgfi])
1861d7ffce2aSmrg
1862d7ffce2aSmrg# Test for the ability of xmlto to generate a text target
1863b8df70beSmrg#
1864b8df70beSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1865b8df70beSmrg# following test for empty XML docbook files.
1866b8df70beSmrg# For compatibility reasons use the following empty XML docbook file and if
1867b8df70beSmrg# it fails try it again with a non-empty XML file.
1868d7ffce2aSmrghave_xmlto_text=no
1869d7ffce2aSmrgcat > conftest.xml << "EOF"
1870d7ffce2aSmrgEOF
1871d7ffce2aSmrgAS_IF([test "$have_xmlto" = yes],
1872d7ffce2aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1873d7ffce2aSmrg             [have_xmlto_text=yes],
1874b8df70beSmrg             [# Try it again with a non-empty XML file.
1875b8df70beSmrg              cat > conftest.xml << "EOF"
1876b8df70beSmrg<x></x>
1877b8df70beSmrgEOF
1878b8df70beSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1879b8df70beSmrg                    [have_xmlto_text=yes],
1880b8df70beSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1881d7ffce2aSmrgrm -f conftest.xml
1882d7ffce2aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1883d7ffce2aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1884d7ffce2aSmrg]) # XORG_WITH_XMLTO
1885d7ffce2aSmrg
18861c80d5b0Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18871c80d5b0Smrg# --------------------------------------------
18881c80d5b0Smrg# Minimum version: 1.12.0
18891c80d5b0Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1890d7ffce2aSmrg#
18911c80d5b0Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18921c80d5b0Smrg# XML-based language used for the transformation of XML documents.
18931c80d5b0Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18941c80d5b0Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18951c80d5b0Smrg# The XSLT processor is often used as a standalone tool for transformations.
18961c80d5b0Smrg# It should not be assumed that this tool is used only to work with documnetation.
18971c80d5b0Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1898d7ffce2aSmrg#
1899d7ffce2aSmrg# Interface to module:
19001c80d5b0Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19011c80d5b0Smrg# XSLTPROC:	 returns the path of the xsltproc program found
19021c80d5b0Smrg#		 returns the path set by the user in the environment
19031c80d5b0Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19041c80d5b0Smrg#		  'no' user instructs the module not to use xsltproc
19051c80d5b0Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19061c80d5b0Smrg#
19071c80d5b0Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19081c80d5b0Smrg#
19091c80d5b0SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19101c80d5b0SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19111c80d5b0Smrg# Preserves the interface, should it be implemented later
19121c80d5b0Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19131c80d5b0Smrgm4_define([_defopt], m4_default([$2], [auto]))
19141c80d5b0SmrgAC_ARG_WITH(xsltproc,
19151c80d5b0Smrg	AS_HELP_STRING([--with-xsltproc],
19161c80d5b0Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19171c80d5b0Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19181c80d5b0Smrgm4_undefine([_defopt])
19191c80d5b0Smrg
19201c80d5b0Smrgif test "x$use_xsltproc" = x"auto"; then
19211c80d5b0Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19221c80d5b0Smrg   if test "x$XSLTPROC" = "x"; then
19231c80d5b0Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19241c80d5b0Smrg	have_xsltproc=no
19251c80d5b0Smrg   else
19261c80d5b0Smrg        have_xsltproc=yes
19271c80d5b0Smrg   fi
19281c80d5b0Smrgelif test "x$use_xsltproc" = x"yes" ; then
19291c80d5b0Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19301c80d5b0Smrg   if test "x$XSLTPROC" = "x"; then
19311c80d5b0Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19321c80d5b0Smrg   fi
19331c80d5b0Smrg   have_xsltproc=yes
19341c80d5b0Smrgelif test "x$use_xsltproc" = x"no" ; then
19351c80d5b0Smrg   if test "x$XSLTPROC" != "x"; then
19361c80d5b0Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19371c80d5b0Smrg   fi
19381c80d5b0Smrg   have_xsltproc=no
19391c80d5b0Smrgelse
19401c80d5b0Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19411c80d5b0Smrgfi
19421c80d5b0Smrg
19431c80d5b0SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19441c80d5b0Smrg]) # XORG_WITH_XSLTPROC
19451c80d5b0Smrg
19461c80d5b0Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19471c80d5b0Smrg# ----------------------------------------
19481c80d5b0Smrg# Minimum version: 1.15.0
19491c80d5b0Smrg#
19501c80d5b0Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
19511c80d5b0Smrg# scanning arbitrary text files, extracting information from those text files,
19521c80d5b0Smrg# and printing reports based on that information.
19531c80d5b0Smrg#
19541c80d5b0Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
19551c80d5b0Smrg#
19561c80d5b0Smrg# Interface to module:
19571c80d5b0Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
19581c80d5b0Smrg# PERL:	     returns the path of the perl program found
19591c80d5b0Smrg#	     returns the path set by the user in the environment
19601c80d5b0Smrg# --with-perl: 'yes' user instructs the module to use perl
19611c80d5b0Smrg#	       'no' user instructs the module not to use perl
19621c80d5b0Smrg# have_perl: returns yes if perl found in PATH or no
19631c80d5b0Smrg#
19641c80d5b0Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19651c80d5b0Smrg#
19661c80d5b0SmrgAC_DEFUN([XORG_WITH_PERL],[
19671c80d5b0SmrgAC_ARG_VAR([PERL], [Path to perl command])
19681c80d5b0Smrg# Preserves the interface, should it be implemented later
19691c80d5b0Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
19701c80d5b0Smrgm4_define([_defopt], m4_default([$2], [auto]))
19711c80d5b0SmrgAC_ARG_WITH(perl,
19721c80d5b0Smrg	AS_HELP_STRING([--with-perl],
19731c80d5b0Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
19741c80d5b0Smrg	   [use_perl=$withval], [use_perl=]_defopt)
19751c80d5b0Smrgm4_undefine([_defopt])
19761c80d5b0Smrg
19771c80d5b0Smrgif test "x$use_perl" = x"auto"; then
19781c80d5b0Smrg   AC_PATH_PROG([PERL], [perl])
19791c80d5b0Smrg   if test "x$PERL" = "x"; then
19801c80d5b0Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19811c80d5b0Smrg	have_perl=no
19821c80d5b0Smrg   else
19831c80d5b0Smrg        have_perl=yes
19841c80d5b0Smrg   fi
19851c80d5b0Smrgelif test "x$use_perl" = x"yes" ; then
19861c80d5b0Smrg   AC_PATH_PROG([PERL], [perl])
19871c80d5b0Smrg   if test "x$PERL" = "x"; then
19881c80d5b0Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19891c80d5b0Smrg   fi
19901c80d5b0Smrg   have_perl=yes
19911c80d5b0Smrgelif test "x$use_perl" = x"no" ; then
19921c80d5b0Smrg   if test "x$PERL" != "x"; then
19931c80d5b0Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19941c80d5b0Smrg   fi
19951c80d5b0Smrg   have_perl=no
19961c80d5b0Smrgelse
19971c80d5b0Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19981c80d5b0Smrgfi
19991c80d5b0Smrg
20001c80d5b0SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20011c80d5b0Smrg]) # XORG_WITH_PERL
20021c80d5b0Smrg
20031c80d5b0Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
20041c80d5b0Smrg# ----------------
20051c80d5b0Smrg# Minimum version: 1.5.0
20061c80d5b0Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20071c80d5b0Smrg#
20081c80d5b0Smrg# Documentation tools are not always available on all platforms and sometimes
20091c80d5b0Smrg# not at the appropriate level. This macro enables a module to test for the
20101c80d5b0Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2011944bff83Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
20121c80d5b0Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20131c80d5b0Smrg# --with-asciidoc assumes 'auto'.
20141c80d5b0Smrg#
20151c80d5b0Smrg# Interface to module:
20161c80d5b0Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2017d7ffce2aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
2018d7ffce2aSmrg#		 returns the path set by the user in the environment
2019d7ffce2aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2020d7ffce2aSmrg#		  'no' user instructs the module not to use asciidoc
2021d7ffce2aSmrg#
2022d7ffce2aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2023d7ffce2aSmrg#
2024d7ffce2aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2025d7ffce2aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2026d7ffce2aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2027d7ffce2aSmrgAC_ARG_WITH(asciidoc,
2028d7ffce2aSmrg	AS_HELP_STRING([--with-asciidoc],
2029d7ffce2aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2030d7ffce2aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2031d7ffce2aSmrgm4_undefine([_defopt])
2032d7ffce2aSmrg
2033d7ffce2aSmrgif test "x$use_asciidoc" = x"auto"; then
2034d7ffce2aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2035d7ffce2aSmrg   if test "x$ASCIIDOC" = "x"; then
2036d7ffce2aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2037d7ffce2aSmrg	have_asciidoc=no
2038d7ffce2aSmrg   else
2039d7ffce2aSmrg        have_asciidoc=yes
2040d7ffce2aSmrg   fi
2041d7ffce2aSmrgelif test "x$use_asciidoc" = x"yes" ; then
2042d7ffce2aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2043d7ffce2aSmrg   if test "x$ASCIIDOC" = "x"; then
2044d7ffce2aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2045d7ffce2aSmrg   fi
2046d7ffce2aSmrg   have_asciidoc=yes
2047d7ffce2aSmrgelif test "x$use_asciidoc" = x"no" ; then
2048d7ffce2aSmrg   if test "x$ASCIIDOC" != "x"; then
2049d7ffce2aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2050d7ffce2aSmrg   fi
2051d7ffce2aSmrg   have_asciidoc=no
2052d7ffce2aSmrgelse
2053d7ffce2aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2054d7ffce2aSmrgfi
2055d7ffce2aSmrgm4_ifval([$1],
2056d7ffce2aSmrg[if test "$have_asciidoc" = yes; then
2057d7ffce2aSmrg    # scrape the asciidoc version
2058d7ffce2aSmrg    AC_MSG_CHECKING([the asciidoc version])
2059d7ffce2aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2060d7ffce2aSmrg    AC_MSG_RESULT([$asciidoc_version])
2061d7ffce2aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2062d7ffce2aSmrg        [if test "x$use_asciidoc" = xauto; then
2063d7ffce2aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2064d7ffce2aSmrg            have_asciidoc=no
2065d7ffce2aSmrg        else
2066d7ffce2aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2067d7ffce2aSmrg        fi])
2068d7ffce2aSmrgfi])
2069d7ffce2aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2070d7ffce2aSmrg]) # XORG_WITH_ASCIIDOC
2071d7ffce2aSmrg
2072d7ffce2aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207341fe0c2aSmrg# -------------------------------------------
2074d7ffce2aSmrg# Minimum version: 1.5.0
2075d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
207641fe0c2aSmrg# Minimum version for optional DOT checking: 1.18.0
2077d7ffce2aSmrg#
2078d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2079d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
2080d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2081944bff83Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2082d7ffce2aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2083d7ffce2aSmrg# --with-doxygen assumes 'auto'.
2084d7ffce2aSmrg#
2085d7ffce2aSmrg# Interface to module:
2086d7ffce2aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2087d7ffce2aSmrg# DOXYGEN:	 returns the path of the doxygen program found
2088d7ffce2aSmrg#		 returns the path set by the user in the environment
2089d7ffce2aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2090d7ffce2aSmrg#		  'no' user instructs the module not to use doxygen
2091d7ffce2aSmrg#
2092d7ffce2aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2093d7ffce2aSmrg#
2094d7ffce2aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2095d7ffce2aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209641fe0c2aSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2097d7ffce2aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2098d7ffce2aSmrgAC_ARG_WITH(doxygen,
2099d7ffce2aSmrg	AS_HELP_STRING([--with-doxygen],
2100d7ffce2aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2101d7ffce2aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2102d7ffce2aSmrgm4_undefine([_defopt])
2103d7ffce2aSmrg
2104d7ffce2aSmrgif test "x$use_doxygen" = x"auto"; then
2105d7ffce2aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2106d7ffce2aSmrg   if test "x$DOXYGEN" = "x"; then
2107d7ffce2aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2108d7ffce2aSmrg	have_doxygen=no
2109d7ffce2aSmrg   else
2110d7ffce2aSmrg        have_doxygen=yes
2111d7ffce2aSmrg   fi
2112d7ffce2aSmrgelif test "x$use_doxygen" = x"yes" ; then
2113d7ffce2aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2114d7ffce2aSmrg   if test "x$DOXYGEN" = "x"; then
2115d7ffce2aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2116d7ffce2aSmrg   fi
2117d7ffce2aSmrg   have_doxygen=yes
2118d7ffce2aSmrgelif test "x$use_doxygen" = x"no" ; then
2119d7ffce2aSmrg   if test "x$DOXYGEN" != "x"; then
2120d7ffce2aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2121d7ffce2aSmrg   fi
2122d7ffce2aSmrg   have_doxygen=no
2123d7ffce2aSmrgelse
2124d7ffce2aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2125d7ffce2aSmrgfi
2126d7ffce2aSmrgm4_ifval([$1],
2127d7ffce2aSmrg[if test "$have_doxygen" = yes; then
2128d7ffce2aSmrg    # scrape the doxygen version
2129d7ffce2aSmrg    AC_MSG_CHECKING([the doxygen version])
2130d7ffce2aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2131d7ffce2aSmrg    AC_MSG_RESULT([$doxygen_version])
2132d7ffce2aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2133d7ffce2aSmrg        [if test "x$use_doxygen" = xauto; then
2134d7ffce2aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2135d7ffce2aSmrg            have_doxygen=no
2136d7ffce2aSmrg        else
2137d7ffce2aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2138d7ffce2aSmrg        fi])
2139d7ffce2aSmrgfi])
214041fe0c2aSmrg
214141fe0c2aSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214241fe0c2aSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214341fe0c2aSmrgdnl 	HAVE_DOT = @HAVE_DOT@
214441fe0c2aSmrgHAVE_DOT=no
214541fe0c2aSmrgif test "x$have_doxygen" = "xyes"; then
214641fe0c2aSmrg  AC_PATH_PROG([DOT], [dot])
214741fe0c2aSmrg    if test "x$DOT" != "x"; then
214841fe0c2aSmrg      HAVE_DOT=yes
214941fe0c2aSmrg    fi
215041fe0c2aSmrgfi
215141fe0c2aSmrg
215241fe0c2aSmrgAC_SUBST([HAVE_DOT])
215341fe0c2aSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2154d7ffce2aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2155d7ffce2aSmrg]) # XORG_WITH_DOXYGEN
2156d7ffce2aSmrg
2157d7ffce2aSmrg# XORG_WITH_GROFF([DEFAULT])
2158d7ffce2aSmrg# ----------------
2159d7ffce2aSmrg# Minimum version: 1.6.0
2160d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2161d7ffce2aSmrg#
2162d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2163d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
2164d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2165944bff83Smrg# the --with-groff option, it allows maximum flexibility in making decisions
2166d7ffce2aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2167d7ffce2aSmrg# --with-groff assumes 'auto'.
2168d7ffce2aSmrg#
2169d7ffce2aSmrg# Interface to module:
2170d7ffce2aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2171d7ffce2aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2172d7ffce2aSmrg# HAVE_GROFF_MS: the -ms macros package
2173d7ffce2aSmrg# GROFF:	 returns the path of the groff program found
2174d7ffce2aSmrg#		 returns the path set by the user in the environment
2175d7ffce2aSmrg# --with-groff:	 'yes' user instructs the module to use groff
2176d7ffce2aSmrg#		 'no' user instructs the module not to use groff
2177d7ffce2aSmrg#
2178d7ffce2aSmrg# Added in version 1.9.0:
2179d7ffce2aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2180d7ffce2aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2181d7ffce2aSmrg#		   psselect from the psutils package.
2182d7ffce2aSmrg#		   the ghostcript package. Refer to the grohtml man pages
2183d7ffce2aSmrg#
2184d7ffce2aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2185d7ffce2aSmrg#
2186d7ffce2aSmrg# OS and distros often splits groff in a basic and full package, the former
2187d7ffce2aSmrg# having the groff program and the later having devices, fonts and macros
2188d7ffce2aSmrg# Checking for the groff executable is not enough.
2189d7ffce2aSmrg#
2190d7ffce2aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2191d7ffce2aSmrg# unset HAVE_GROFF or GROFF env variables.
2192d7ffce2aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2193d7ffce2aSmrg#
2194d7ffce2aSmrgAC_DEFUN([XORG_WITH_GROFF],[
2195d7ffce2aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2196d7ffce2aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2197d7ffce2aSmrgAC_ARG_WITH(groff,
2198d7ffce2aSmrg	AS_HELP_STRING([--with-groff],
2199d7ffce2aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2200d7ffce2aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2201d7ffce2aSmrgm4_undefine([_defopt])
2202d7ffce2aSmrg
2203d7ffce2aSmrgif test "x$use_groff" = x"auto"; then
2204d7ffce2aSmrg   AC_PATH_PROG([GROFF], [groff])
2205d7ffce2aSmrg   if test "x$GROFF" = "x"; then
2206d7ffce2aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2207d7ffce2aSmrg	have_groff=no
2208d7ffce2aSmrg   else
2209d7ffce2aSmrg        have_groff=yes
2210d7ffce2aSmrg   fi
2211d7ffce2aSmrgelif test "x$use_groff" = x"yes" ; then
2212d7ffce2aSmrg   AC_PATH_PROG([GROFF], [groff])
2213d7ffce2aSmrg   if test "x$GROFF" = "x"; then
2214d7ffce2aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2215d7ffce2aSmrg   fi
2216d7ffce2aSmrg   have_groff=yes
2217d7ffce2aSmrgelif test "x$use_groff" = x"no" ; then
2218d7ffce2aSmrg   if test "x$GROFF" != "x"; then
2219d7ffce2aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2220d7ffce2aSmrg   fi
2221d7ffce2aSmrg   have_groff=no
2222d7ffce2aSmrgelse
2223d7ffce2aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2224d7ffce2aSmrgfi
2225d7ffce2aSmrg
2226d7ffce2aSmrg# We have groff, test for the presence of the macro packages
2227d7ffce2aSmrgif test "x$have_groff" = x"yes"; then
2228d7ffce2aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2229d7ffce2aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2230d7ffce2aSmrg        groff_ms_works=yes
2231d7ffce2aSmrg    else
2232d7ffce2aSmrg        groff_ms_works=no
2233d7ffce2aSmrg    fi
2234d7ffce2aSmrg    AC_MSG_RESULT([$groff_ms_works])
2235d7ffce2aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2236d7ffce2aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2237d7ffce2aSmrg        groff_mm_works=yes
2238d7ffce2aSmrg    else
2239d7ffce2aSmrg        groff_mm_works=no
2240d7ffce2aSmrg    fi
2241d7ffce2aSmrg    AC_MSG_RESULT([$groff_mm_works])
2242d7ffce2aSmrgfi
2243d7ffce2aSmrg
2244d7ffce2aSmrg# We have groff, test for HTML dependencies, one command per package
2245d7ffce2aSmrgif test "x$have_groff" = x"yes"; then
2246d7ffce2aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2247d7ffce2aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2248d7ffce2aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2249d7ffce2aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2250d7ffce2aSmrg      have_groff_html=yes
2251d7ffce2aSmrg   else
2252d7ffce2aSmrg      have_groff_html=no
2253d7ffce2aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2254d7ffce2aSmrg   fi
2255d7ffce2aSmrgfi
2256d7ffce2aSmrg
2257d7ffce2aSmrg# Set Automake conditionals for Makefiles
2258d7ffce2aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2259d7ffce2aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2260d7ffce2aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2261d7ffce2aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2262d7ffce2aSmrg]) # XORG_WITH_GROFF
2263d7ffce2aSmrg
22641c80d5b0Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22651c80d5b0Smrg# ---------------------------------------
2266d7ffce2aSmrg# Minimum version: 1.6.0
2267d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
22681c80d5b0Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2269d7ffce2aSmrg#
2270d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2271d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
2272d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2273944bff83Smrg# the --with-fop option, it allows maximum flexibility in making decisions
2274d7ffce2aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2275d7ffce2aSmrg# --with-fop assumes 'auto'.
2276d7ffce2aSmrg#
2277d7ffce2aSmrg# Interface to module:
2278d7ffce2aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2279d7ffce2aSmrg# FOP:	 	returns the path of the fop program found
2280d7ffce2aSmrg#		returns the path set by the user in the environment
2281d7ffce2aSmrg# --with-fop: 	'yes' user instructs the module to use fop
2282d7ffce2aSmrg#		'no' user instructs the module not to use fop
2283d7ffce2aSmrg#
2284d7ffce2aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2285d7ffce2aSmrg#
2286d7ffce2aSmrgAC_DEFUN([XORG_WITH_FOP],[
2287d7ffce2aSmrgAC_ARG_VAR([FOP], [Path to fop command])
22881c80d5b0Smrgm4_define([_defopt], m4_default([$2], [auto]))
2289d7ffce2aSmrgAC_ARG_WITH(fop,
2290d7ffce2aSmrg	AS_HELP_STRING([--with-fop],
2291d7ffce2aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2292d7ffce2aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2293d7ffce2aSmrgm4_undefine([_defopt])
2294d7ffce2aSmrg
2295d7ffce2aSmrgif test "x$use_fop" = x"auto"; then
2296d7ffce2aSmrg   AC_PATH_PROG([FOP], [fop])
2297d7ffce2aSmrg   if test "x$FOP" = "x"; then
2298d7ffce2aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2299d7ffce2aSmrg	have_fop=no
2300d7ffce2aSmrg   else
2301d7ffce2aSmrg        have_fop=yes
2302d7ffce2aSmrg   fi
2303d7ffce2aSmrgelif test "x$use_fop" = x"yes" ; then
2304d7ffce2aSmrg   AC_PATH_PROG([FOP], [fop])
2305d7ffce2aSmrg   if test "x$FOP" = "x"; then
2306d7ffce2aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2307d7ffce2aSmrg   fi
2308d7ffce2aSmrg   have_fop=yes
2309d7ffce2aSmrgelif test "x$use_fop" = x"no" ; then
2310d7ffce2aSmrg   if test "x$FOP" != "x"; then
2311d7ffce2aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2312d7ffce2aSmrg   fi
2313d7ffce2aSmrg   have_fop=no
2314d7ffce2aSmrgelse
2315d7ffce2aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2316d7ffce2aSmrgfi
23171c80d5b0Smrg
23181c80d5b0Smrg# Test for a minimum version of fop, if provided.
23191c80d5b0Smrgm4_ifval([$1],
23201c80d5b0Smrg[if test "$have_fop" = yes; then
23211c80d5b0Smrg    # scrape the fop version
23221c80d5b0Smrg    AC_MSG_CHECKING([for fop minimum version])
23231c80d5b0Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23241c80d5b0Smrg    AC_MSG_RESULT([$fop_version])
23251c80d5b0Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
23261c80d5b0Smrg        [if test "x$use_fop" = xauto; then
23271c80d5b0Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23281c80d5b0Smrg            have_fop=no
23291c80d5b0Smrg        else
23301c80d5b0Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23311c80d5b0Smrg        fi])
23321c80d5b0Smrgfi])
2333d7ffce2aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2334d7ffce2aSmrg]) # XORG_WITH_FOP
2335d7ffce2aSmrg
233641fe0c2aSmrg# XORG_WITH_M4([MIN-VERSION])
233741fe0c2aSmrg# ---------------------------
233841fe0c2aSmrg# Minimum version: 1.19.0
233941fe0c2aSmrg#
234041fe0c2aSmrg# This macro attempts to locate an m4 macro processor which supports
234141fe0c2aSmrg# -I option and is only useful for modules relying on M4 in order to
234241fe0c2aSmrg# expand macros in source code files.
234341fe0c2aSmrg#
234441fe0c2aSmrg# Interface to module:
234541fe0c2aSmrg# M4:	 	returns the path of the m4 program found
234641fe0c2aSmrg#		returns the path set by the user in the environment
234741fe0c2aSmrg#
234841fe0c2aSmrgAC_DEFUN([XORG_WITH_M4], [
234941fe0c2aSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
235041fe0c2aSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235141fe0c2aSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235241fe0c2aSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235341fe0c2aSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235441fe0c2aSmrg   [$PATH:/usr/gnu/bin])])
235541fe0c2aSmrg
235641fe0c2aSmrgAC_SUBST([M4], [$ac_cv_path_M4])
235741fe0c2aSmrg]) # XORG_WITH_M4
235841fe0c2aSmrg
2359d7ffce2aSmrg# XORG_WITH_PS2PDF([DEFAULT])
2360d7ffce2aSmrg# ----------------
2361d7ffce2aSmrg# Minimum version: 1.6.0
2362d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2363d7ffce2aSmrg#
2364d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2365d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
2366d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2367944bff83Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2368d7ffce2aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2369d7ffce2aSmrg# --with-ps2pdf assumes 'auto'.
2370d7ffce2aSmrg#
2371d7ffce2aSmrg# Interface to module:
2372d7ffce2aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2373d7ffce2aSmrg# PS2PDF:	returns the path of the ps2pdf program found
2374d7ffce2aSmrg#		returns the path set by the user in the environment
2375d7ffce2aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2376d7ffce2aSmrg#		 'no' user instructs the module not to use ps2pdf
2377d7ffce2aSmrg#
2378d7ffce2aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2379d7ffce2aSmrg#
2380d7ffce2aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2381d7ffce2aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2382d7ffce2aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2383d7ffce2aSmrgAC_ARG_WITH(ps2pdf,
2384d7ffce2aSmrg	AS_HELP_STRING([--with-ps2pdf],
2385d7ffce2aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2386d7ffce2aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2387d7ffce2aSmrgm4_undefine([_defopt])
2388d7ffce2aSmrg
2389d7ffce2aSmrgif test "x$use_ps2pdf" = x"auto"; then
2390d7ffce2aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2391d7ffce2aSmrg   if test "x$PS2PDF" = "x"; then
2392d7ffce2aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2393d7ffce2aSmrg	have_ps2pdf=no
2394d7ffce2aSmrg   else
2395d7ffce2aSmrg        have_ps2pdf=yes
2396d7ffce2aSmrg   fi
2397d7ffce2aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2398d7ffce2aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2399d7ffce2aSmrg   if test "x$PS2PDF" = "x"; then
2400d7ffce2aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2401d7ffce2aSmrg   fi
2402d7ffce2aSmrg   have_ps2pdf=yes
2403d7ffce2aSmrgelif test "x$use_ps2pdf" = x"no" ; then
2404d7ffce2aSmrg   if test "x$PS2PDF" != "x"; then
2405d7ffce2aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2406d7ffce2aSmrg   fi
2407d7ffce2aSmrg   have_ps2pdf=no
2408d7ffce2aSmrgelse
2409d7ffce2aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2410d7ffce2aSmrgfi
2411d7ffce2aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2412d7ffce2aSmrg]) # XORG_WITH_PS2PDF
2413d7ffce2aSmrg
2414d7ffce2aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2415d7ffce2aSmrg# ----------------
2416d7ffce2aSmrg# Minimum version: 1.6.0
2417d7ffce2aSmrg#
2418d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2419d7ffce2aSmrg# not at the appropriate level. This macro enables a builder to skip all
2420d7ffce2aSmrg# documentation targets except traditional man pages.
2421d7ffce2aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2422944bff83Smrg# maximum flexibility in controlling documentation building.
2423d7ffce2aSmrg# Refer to:
2424d7ffce2aSmrg# XORG_WITH_XMLTO         --with-xmlto
2425d7ffce2aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2426d7ffce2aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2427d7ffce2aSmrg# XORG_WITH_FOP           --with-fop
2428d7ffce2aSmrg# XORG_WITH_GROFF         --with-groff
2429d7ffce2aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2430d7ffce2aSmrg#
2431d7ffce2aSmrg# Interface to module:
2432d7ffce2aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2433d7ffce2aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2434d7ffce2aSmrg#		 'no' user instructs the module not to generate docs
2435d7ffce2aSmrg# parm1:	specify the default value, yes or no.
2436d7ffce2aSmrg#
2437d7ffce2aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2438d7ffce2aSmrgm4_define([docs_default], m4_default([$1], [yes]))
2439d7ffce2aSmrgAC_ARG_ENABLE(docs,
2440d7ffce2aSmrg	AS_HELP_STRING([--enable-docs],
2441d7ffce2aSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2442d7ffce2aSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2443d7ffce2aSmrgm4_undefine([docs_default])
2444d7ffce2aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2445d7ffce2aSmrgAC_MSG_CHECKING([whether to build documentation])
2446d7ffce2aSmrgAC_MSG_RESULT([$build_docs])
2447d7ffce2aSmrg]) # XORG_ENABLE_DOCS
2448d7ffce2aSmrg
2449d7ffce2aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2450d7ffce2aSmrg# ----------------
2451d7ffce2aSmrg# Minimum version: 1.6.0
2452d7ffce2aSmrg#
2453d7ffce2aSmrg# This macro enables a builder to skip all developer documentation.
2454d7ffce2aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2455944bff83Smrg# maximum flexibility in controlling documentation building.
2456d7ffce2aSmrg# Refer to:
2457d7ffce2aSmrg# XORG_WITH_XMLTO         --with-xmlto
2458d7ffce2aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2459d7ffce2aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2460d7ffce2aSmrg# XORG_WITH_FOP           --with-fop
2461d7ffce2aSmrg# XORG_WITH_GROFF         --with-groff
2462d7ffce2aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2463d7ffce2aSmrg#
2464d7ffce2aSmrg# Interface to module:
2465d7ffce2aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2466d7ffce2aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2467d7ffce2aSmrg#			'no' user instructs the module not to generate developer docs
2468d7ffce2aSmrg# parm1:		specify the default value, yes or no.
2469d7ffce2aSmrg#
2470d7ffce2aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2471d7ffce2aSmrgm4_define([devel_default], m4_default([$1], [yes]))
2472d7ffce2aSmrgAC_ARG_ENABLE(devel-docs,
2473d7ffce2aSmrg	AS_HELP_STRING([--enable-devel-docs],
2474d7ffce2aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2475d7ffce2aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2476d7ffce2aSmrgm4_undefine([devel_default])
2477d7ffce2aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2478d7ffce2aSmrgAC_MSG_CHECKING([whether to build developer documentation])
2479d7ffce2aSmrgAC_MSG_RESULT([$build_devel_docs])
2480d7ffce2aSmrg]) # XORG_ENABLE_DEVEL_DOCS
2481d7ffce2aSmrg
2482d7ffce2aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2483d7ffce2aSmrg# ----------------
2484d7ffce2aSmrg# Minimum version: 1.6.0
2485d7ffce2aSmrg#
2486d7ffce2aSmrg# This macro enables a builder to skip all functional specification targets.
2487d7ffce2aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2488944bff83Smrg# maximum flexibility in controlling documentation building.
2489d7ffce2aSmrg# Refer to:
2490d7ffce2aSmrg# XORG_WITH_XMLTO         --with-xmlto
2491d7ffce2aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2492d7ffce2aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2493d7ffce2aSmrg# XORG_WITH_FOP           --with-fop
2494d7ffce2aSmrg# XORG_WITH_GROFF         --with-groff
2495d7ffce2aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2496d7ffce2aSmrg#
2497d7ffce2aSmrg# Interface to module:
2498d7ffce2aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2499d7ffce2aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2500d7ffce2aSmrg#			'no' user instructs the module not to generate specs
2501d7ffce2aSmrg# parm1:		specify the default value, yes or no.
2502d7ffce2aSmrg#
2503d7ffce2aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2504d7ffce2aSmrgm4_define([spec_default], m4_default([$1], [yes]))
2505d7ffce2aSmrgAC_ARG_ENABLE(specs,
2506d7ffce2aSmrg	AS_HELP_STRING([--enable-specs],
2507d7ffce2aSmrg	   [Enable building the specs (default: ]spec_default[)]),
2508d7ffce2aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2509d7ffce2aSmrgm4_undefine([spec_default])
2510d7ffce2aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2511d7ffce2aSmrgAC_MSG_CHECKING([whether to build functional specifications])
2512d7ffce2aSmrgAC_MSG_RESULT([$build_specs])
2513d7ffce2aSmrg]) # XORG_ENABLE_SPECS
2514d7ffce2aSmrg
25151c80d5b0Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25161c80d5b0Smrg# ----------------------------------------------
25171c80d5b0Smrg# Minimum version: 1.13.0
25181c80d5b0Smrg#
25191c80d5b0Smrg# This macro enables a builder to enable/disable unit testing
25201c80d5b0Smrg# It makes no assumption about the test cases implementation
25211c80d5b0Smrg# Test cases may or may not use Automake "Support for test suites"
25221c80d5b0Smrg# They may or may not use the software utility library GLib
25231c80d5b0Smrg#
25241c80d5b0Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25251c80d5b0Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25261c80d5b0Smrg# The variable enable_unit_tests is used by other macros in this file.
25271c80d5b0Smrg#
25281c80d5b0Smrg# Interface to module:
25291c80d5b0Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25301c80d5b0Smrg# enable_unit_tests:    used in configure.ac for additional configuration
25311c80d5b0Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25321c80d5b0Smrg#			'no' user instructs the module not to build tests
25331c80d5b0Smrg# parm1:		specify the default value, yes or no.
25341c80d5b0Smrg#
25351c80d5b0SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25361c80d5b0SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25371c80d5b0SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25381c80d5b0SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25391c80d5b0Smrgm4_define([_defopt], m4_default([$1], [auto]))
25401c80d5b0SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25411c80d5b0Smrg	[Enable building unit test cases (default: ]_defopt[)]),
25421c80d5b0Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25431c80d5b0Smrgm4_undefine([_defopt])
25441c80d5b0SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25451c80d5b0SmrgAC_MSG_CHECKING([whether to build unit test cases])
25461c80d5b0SmrgAC_MSG_RESULT([$enable_unit_tests])
25471c80d5b0Smrg]) # XORG_ENABLE_UNIT_TESTS
25481c80d5b0Smrg
25491c80d5b0Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25501c80d5b0Smrg# ------------------------------------------------------
25511c80d5b0Smrg# Minimum version: 1.17.0
25521c80d5b0Smrg#
25531c80d5b0Smrg# This macro enables a builder to enable/disable integration testing
25541c80d5b0Smrg# It makes no assumption about the test cases' implementation
25551c80d5b0Smrg# Test cases may or may not use Automake "Support for test suites"
25561c80d5b0Smrg#
25571c80d5b0Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25581c80d5b0Smrg# usually requires less dependencies and may be built and run under less
25591c80d5b0Smrg# stringent environments than integration tests.
25601c80d5b0Smrg#
25611c80d5b0Smrg# Interface to module:
25621c80d5b0Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25631c80d5b0Smrg# enable_integration_tests:   used in configure.ac for additional configuration
25641c80d5b0Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25651c80d5b0Smrg#                             'no' user instructs the module not to build tests
25661c80d5b0Smrg# parm1:                      specify the default value, yes or no.
25671c80d5b0Smrg#
25681c80d5b0SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
25691c80d5b0SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25701c80d5b0Smrgm4_define([_defopt], m4_default([$1], [auto]))
25711c80d5b0SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
25721c80d5b0Smrg	[Enable building integration test cases (default: ]_defopt[)]),
25731c80d5b0Smrg	[enable_integration_tests=$enableval],
25741c80d5b0Smrg	[enable_integration_tests=]_defopt)
25751c80d5b0Smrgm4_undefine([_defopt])
25761c80d5b0SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
25771c80d5b0Smrg	[test "x$enable_integration_tests" != xno])
25781c80d5b0SmrgAC_MSG_CHECKING([whether to build unit test cases])
25791c80d5b0SmrgAC_MSG_RESULT([$enable_integration_tests])
25801c80d5b0Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
25811c80d5b0Smrg
25821c80d5b0Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25831c80d5b0Smrg# ----------------------------------------
25841c80d5b0Smrg# Minimum version: 1.13.0
25851c80d5b0Smrg#
25861c80d5b0Smrg# GLib is a library which provides advanced data structures and functions.
25871c80d5b0Smrg# This macro enables a module to test for the presence of Glib.
25881c80d5b0Smrg#
25891c80d5b0Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25901c80d5b0Smrg# Otherwise the value of $enable_unit_tests is blank.
25911c80d5b0Smrg#
25921c80d5b0Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25931c80d5b0Smrg# test support usually requires less dependencies and may be built and run under
25941c80d5b0Smrg# less stringent environments than integration tests.
25951c80d5b0Smrg#
25961c80d5b0Smrg# Interface to module:
25971c80d5b0Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
25981c80d5b0Smrg# with_glib: used in configure.ac to know if GLib has been found
25991c80d5b0Smrg# --with-glib:	'yes' user instructs the module to use glib
26001c80d5b0Smrg#		'no' user instructs the module not to use glib
26011c80d5b0Smrg#
26021c80d5b0SmrgAC_DEFUN([XORG_WITH_GLIB],[
26031c80d5b0SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26041c80d5b0Smrgm4_define([_defopt], m4_default([$2], [auto]))
26051c80d5b0SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26061c80d5b0Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26071c80d5b0Smrg	[with_glib=$withval], [with_glib=]_defopt)
26081c80d5b0Smrgm4_undefine([_defopt])
26091c80d5b0Smrg
26101c80d5b0Smrghave_glib=no
26111c80d5b0Smrg# Do not probe GLib if user explicitly disabled unit testing
26121c80d5b0Smrgif test "x$enable_unit_tests" != x"no"; then
26131c80d5b0Smrg  # Do not probe GLib if user explicitly disabled it
26141c80d5b0Smrg  if test "x$with_glib" != x"no"; then
26151c80d5b0Smrg    m4_ifval(
26161c80d5b0Smrg      [$1],
26171c80d5b0Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26181c80d5b0Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26191c80d5b0Smrg    )
26201c80d5b0Smrg  fi
26211c80d5b0Smrgfi
26221c80d5b0Smrg
26231c80d5b0Smrg# Not having GLib when unit testing has been explicitly requested is an error
26241c80d5b0Smrgif test "x$enable_unit_tests" = x"yes"; then
26251c80d5b0Smrg  if test "x$have_glib" = x"no"; then
26261c80d5b0Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26271c80d5b0Smrg  fi
26281c80d5b0Smrgfi
26291c80d5b0Smrg
26301c80d5b0Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
26311c80d5b0Smrgif test "x$enable_unit_tests" = x"no"; then
26321c80d5b0Smrg  if test "x$with_glib" = x"yes"; then
26331c80d5b0Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26341c80d5b0Smrg  fi
26351c80d5b0Smrgfi
26361c80d5b0Smrg
26371c80d5b0Smrg# Not having GLib when it has been explicitly requested is an error
26381c80d5b0Smrgif test "x$with_glib" = x"yes"; then
26391c80d5b0Smrg  if test "x$have_glib" = x"no"; then
26401c80d5b0Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26411c80d5b0Smrg  fi
26421c80d5b0Smrgfi
26431c80d5b0Smrg
26441c80d5b0SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26451c80d5b0Smrg]) # XORG_WITH_GLIB
26461c80d5b0Smrg
26471c80d5b0Smrg# XORG_LD_WRAP([required|optional])
26481c80d5b0Smrg# ---------------------------------
26491c80d5b0Smrg# Minimum version: 1.13.0
26501c80d5b0Smrg#
26511c80d5b0Smrg# Check if linker supports -wrap, passed via compiler flags
26521c80d5b0Smrg#
26531c80d5b0Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26541c80d5b0Smrg# Otherwise the value of $enable_unit_tests is blank.
26551c80d5b0Smrg#
26561c80d5b0Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26571c80d5b0Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26581c80d5b0Smrg# available, an argument of "optional" allows use when some unit tests require
26591c80d5b0Smrg# ld -wrap and others do not.
26601c80d5b0Smrg#
26611c80d5b0SmrgAC_DEFUN([XORG_LD_WRAP],[
26621c80d5b0SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26631c80d5b0Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26641c80d5b0Smrg                      void __wrap_exit(int status) { return; }],
26651c80d5b0Smrg                     [exit(0);])])
26661c80d5b0Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
26671c80d5b0Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
26681c80d5b0Smrg  if test "x$have_ld_wrap" = x"no"; then
26691c80d5b0Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
26701c80d5b0Smrg  fi
26711c80d5b0Smrgfi
26721c80d5b0SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
26731c80d5b0Smrg#
26741c80d5b0Smrg]) # XORG_LD_WRAP
26751c80d5b0Smrg
26761c80d5b0Smrg# XORG_CHECK_LINKER_FLAGS
26771c80d5b0Smrg# -----------------------
26781c80d5b0Smrg# SYNOPSIS
26791c80d5b0Smrg#
26801c80d5b0Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26811c80d5b0Smrg#
26821c80d5b0Smrg# DESCRIPTION
26831c80d5b0Smrg#
26841c80d5b0Smrg#   Check whether the given linker FLAGS work with the current language's
26851c80d5b0Smrg#   linker, or whether they give an error.
26861c80d5b0Smrg#
26871c80d5b0Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26881c80d5b0Smrg#   success/failure.
26891c80d5b0Smrg#
26901c80d5b0Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
26911c80d5b0Smrg#
26921c80d5b0Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26931c80d5b0Smrg#
26941c80d5b0Smrg# LICENSE
26951c80d5b0Smrg#
26961c80d5b0Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26971c80d5b0Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26981c80d5b0Smrg#   Copyright (c) 2009 Matteo Frigo
26991c80d5b0Smrg#
27001c80d5b0Smrg#   This program is free software: you can redistribute it and/or modify it
27011c80d5b0Smrg#   under the terms of the GNU General Public License as published by the
27021c80d5b0Smrg#   Free Software Foundation, either version 3 of the License, or (at your
27031c80d5b0Smrg#   option) any later version.
27041c80d5b0Smrg#
27051c80d5b0Smrg#   This program is distributed in the hope that it will be useful, but
27061c80d5b0Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27071c80d5b0Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27081c80d5b0Smrg#   Public License for more details.
27091c80d5b0Smrg#
27101c80d5b0Smrg#   You should have received a copy of the GNU General Public License along
27111c80d5b0Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27121c80d5b0Smrg#
27131c80d5b0Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
27141c80d5b0Smrg#   gives unlimited permission to copy, distribute and modify the configure
27151c80d5b0Smrg#   scripts that are the output of Autoconf when processing the Macro. You
27161c80d5b0Smrg#   need not follow the terms of the GNU General Public License when using
27171c80d5b0Smrg#   or distributing such scripts, even though portions of the text of the
27181c80d5b0Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27191c80d5b0Smrg#   all other use of the material that constitutes the Autoconf Macro.
27201c80d5b0Smrg#
27211c80d5b0Smrg#   This special exception to the GPL applies to versions of the Autoconf
27221c80d5b0Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
27231c80d5b0Smrg#   modified version of the Autoconf Macro, you may extend this special
27241c80d5b0Smrg#   exception to the GPL to apply to your modified version as well.#
27251c80d5b0SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27261c80d5b0Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
27271c80d5b0Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27281c80d5b0SmrgAS_LITERAL_IF([$1],
27291c80d5b0Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27301c80d5b0Smrg      ax_save_FLAGS=$LDFLAGS
27311c80d5b0Smrg      LDFLAGS="$1"
27321c80d5b0Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27331c80d5b0Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27341c80d5b0Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27351c80d5b0Smrg      LDFLAGS=$ax_save_FLAGS])],
27361c80d5b0Smrg  [ax_save_FLAGS=$LDFLAGS
27371c80d5b0Smrg   LDFLAGS="$1"
27381c80d5b0Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27391c80d5b0Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27401c80d5b0Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27411c80d5b0Smrg   LDFLAGS=$ax_save_FLAGS])
27421c80d5b0Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27431c80d5b0SmrgAC_MSG_RESULT($xorg_check_linker_flags)
27441c80d5b0Smrgif test "x$xorg_check_linker_flags" = xyes; then
27451c80d5b0Smrg	m4_default([$2], :)
27461c80d5b0Smrgelse
27471c80d5b0Smrg	m4_default([$3], :)
27481c80d5b0Smrgfi
27491c80d5b0Smrg]) # XORG_CHECK_LINKER_FLAGS
27501c80d5b0Smrg
27511c80d5b0Smrg# XORG_MEMORY_CHECK_FLAGS
27521c80d5b0Smrg# -----------------------
27531c80d5b0Smrg# Minimum version: 1.16.0
27541c80d5b0Smrg#
27551c80d5b0Smrg# This macro attempts to find appropriate memory checking functionality
27561c80d5b0Smrg# for various platforms which unit testing code may use to catch various
27571c80d5b0Smrg# forms of memory allocation and access errors in testing.
27581c80d5b0Smrg#
27591c80d5b0Smrg# Interface to module:
27601c80d5b0Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27611c80d5b0Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27621c80d5b0Smrg#
27631c80d5b0Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27641c80d5b0Smrg#
27651c80d5b0SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
27661c80d5b0Smrg
27671c80d5b0SmrgAC_REQUIRE([AC_CANONICAL_HOST])
27681c80d5b0SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
27691c80d5b0Smrg           [Environment variables to enable memory checking in tests])
27701c80d5b0Smrg
27711c80d5b0Smrg# Check for different types of support on different platforms
27721c80d5b0Smrgcase $host_os in
27731c80d5b0Smrg    solaris*)
27741c80d5b0Smrg        AC_CHECK_LIB([umem], [umem_alloc],
27751c80d5b0Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
27761c80d5b0Smrg        ;;
27771c80d5b0Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
27781c80d5b0Smrg        # both directly and inverted, so should not be 0 or 255.
27791c80d5b0Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
27801c80d5b0Smrg        ;;
27811c80d5b0Smrg    darwin*)
27821c80d5b0Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
27831c80d5b0Smrg        ;;
27841c80d5b0Smrg    *bsd*)
27851c80d5b0Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27861c80d5b0Smrg        ;;
27871c80d5b0Smrgesac
27881c80d5b0Smrg
27891c80d5b0Smrg# User supplied flags override default flags
27901c80d5b0Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27911c80d5b0Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27921c80d5b0Smrgfi
27931c80d5b0Smrg
27941c80d5b0SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27951c80d5b0Smrg]) # XORG_WITH_LINT
27961c80d5b0Smrg
27974c61c93dSmrg# XORG_CHECK_MALLOC_ZERO
27984c61c93dSmrg# ----------------------
27994c61c93dSmrg# Minimum version: 1.0.0
28004c61c93dSmrg#
28014c61c93dSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28024c61c93dSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28034c61c93dSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28044c61c93dSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28054c61c93dSmrgAC_ARG_ENABLE(malloc0returnsnull,
28064c61c93dSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28074c61c93dSmrg		       [malloc(0) returns NULL (default: auto)]),
28084c61c93dSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28094c61c93dSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
28104c61c93dSmrg
28114c61c93dSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28124c61c93dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281341fe0c2aSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281441fe0c2aSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2815d7ffce2aSmrg#include <stdlib.h>
2816d7ffce2aSmrg],[
28174c61c93dSmrg    char *m0, *r0, *c0, *p;
28184c61c93dSmrg    m0 = malloc(0);
28194c61c93dSmrg    p = malloc(10);
28204c61c93dSmrg    r0 = realloc(p,0);
2821d7ffce2aSmrg    c0 = calloc(0,10);
2822d7ffce2aSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2823d7ffce2aSmrg])],
282441fe0c2aSmrg		[xorg_cv_malloc0_returns_null=yes],
282541fe0c2aSmrg		[xorg_cv_malloc0_returns_null=no])])
282641fe0c2aSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28274c61c93dSmrgfi
28284c61c93dSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
28294c61c93dSmrg
28304c61c93dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28314c61c93dSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28324c61c93dSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28334c61c93dSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28344c61c93dSmrgelse
28354c61c93dSmrg	MALLOC_ZERO_CFLAGS=""
28364c61c93dSmrg	XMALLOC_ZERO_CFLAGS=""
28374c61c93dSmrg	XTMALLOC_ZERO_CFLAGS=""
28384c61c93dSmrgfi
28394c61c93dSmrg
28404c61c93dSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28414c61c93dSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28424c61c93dSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28434c61c93dSmrg]) # XORG_CHECK_MALLOC_ZERO
28444c61c93dSmrg
28454c61c93dSmrg# XORG_WITH_LINT()
28464c61c93dSmrg# ----------------
28474c61c93dSmrg# Minimum version: 1.1.0
28484c61c93dSmrg#
2849d7ffce2aSmrg# This macro enables the use of a tool that flags some suspicious and
2850d7ffce2aSmrg# non-portable constructs (likely to be bugs) in C language source code.
2851d7ffce2aSmrg# It will attempt to locate the tool and use appropriate options.
2852d7ffce2aSmrg# There are various lint type tools on different platforms.
2853d7ffce2aSmrg#
2854d7ffce2aSmrg# Interface to module:
2855d7ffce2aSmrg# LINT:		returns the path to the tool found on the platform
2856d7ffce2aSmrg#		or the value set to LINT on the configure cmd line
2857d7ffce2aSmrg#		also an Automake conditional
2858d7ffce2aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2859d7ffce2aSmrg#
2860d7ffce2aSmrg# --with-lint:	'yes' user instructs the module to use lint
2861d7ffce2aSmrg#		'no' user instructs the module not to use lint (default)
2862d7ffce2aSmrg#
2863d7ffce2aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2864d7ffce2aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28654c61c93dSmrg#
28664c61c93dSmrgAC_DEFUN([XORG_WITH_LINT],[
28674c61c93dSmrg
2868d7ffce2aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2869d7ffce2aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
28704c61c93dSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
28714c61c93dSmrg		[Use a lint-style source code checker (default: disabled)])],
28724c61c93dSmrg		[use_lint=$withval], [use_lint=no])
2873d7ffce2aSmrg
2874d7ffce2aSmrg# Obtain platform specific info like program name and options
2875d7ffce2aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2876d7ffce2aSmrgcase $host_os in
2877d7ffce2aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2878d7ffce2aSmrg	lint_name=splint
2879d7ffce2aSmrg	lint_options="-badflag"
2880d7ffce2aSmrg	;;
2881d7ffce2aSmrg  *freebsd* | *netbsd*)
2882d7ffce2aSmrg	lint_name=lint
2883d7ffce2aSmrg	lint_options="-u -b"
2884d7ffce2aSmrg	;;
2885d7ffce2aSmrg  *solaris*)
2886d7ffce2aSmrg	lint_name=lint
2887d7ffce2aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2888d7ffce2aSmrg	;;
2889d7ffce2aSmrgesac
2890d7ffce2aSmrg
2891d7ffce2aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2892d7ffce2aSmrgif test "x$use_lint" = x"yes" ; then
2893d7ffce2aSmrg   AC_PATH_PROG([LINT], [$lint_name])
2894d7ffce2aSmrg   if test "x$LINT" = "x"; then
2895d7ffce2aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2896d7ffce2aSmrg   fi
2897d7ffce2aSmrgelif test "x$use_lint" = x"no" ; then
2898d7ffce2aSmrg   if test "x$LINT" != "x"; then
2899d7ffce2aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2900d7ffce2aSmrg   fi
29014c61c93dSmrgelse
2902d7ffce2aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
29034c61c93dSmrgfi
2904d7ffce2aSmrg
2905d7ffce2aSmrg# User supplied flags override default flags
2906d7ffce2aSmrgif test "x$LINT_FLAGS" != "x"; then
2907d7ffce2aSmrg   lint_options=$LINT_FLAGS
29084c61c93dSmrgfi
29094c61c93dSmrg
2910d7ffce2aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2911d7ffce2aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
29124c61c93dSmrg
29134c61c93dSmrg]) # XORG_WITH_LINT
29144c61c93dSmrg
29154c61c93dSmrg# XORG_LINT_LIBRARY(LIBNAME)
29164c61c93dSmrg# --------------------------
29174c61c93dSmrg# Minimum version: 1.1.0
29184c61c93dSmrg#
29194c61c93dSmrg# Sets up flags for building lint libraries for checking programs that call
29204c61c93dSmrg# functions in the library.
29214c61c93dSmrg#
2922d7ffce2aSmrg# Interface to module:
2923d7ffce2aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2924d7ffce2aSmrg# MAKE_LINT_LIB		- Automake conditional
2925d7ffce2aSmrg#
2926d7ffce2aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2927d7ffce2aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
29284c61c93dSmrg
29294c61c93dSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29304c61c93dSmrgAC_REQUIRE([XORG_WITH_LINT])
29314c61c93dSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29324c61c93dSmrg	[Create lint library (default: disabled)])],
29334c61c93dSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2934d7ffce2aSmrg
2935d7ffce2aSmrgif test "x$make_lint_lib" = x"yes" ; then
2936d7ffce2aSmrg   LINTLIB=llib-l$1.ln
2937d7ffce2aSmrg   if test "x$LINT" = "x"; then
2938d7ffce2aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2939d7ffce2aSmrg   fi
2940d7ffce2aSmrgelif test "x$make_lint_lib" != x"no" ; then
2941d7ffce2aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29424c61c93dSmrgfi
2943d7ffce2aSmrg
29444c61c93dSmrgAC_SUBST(LINTLIB)
29454c61c93dSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29464c61c93dSmrg
29474c61c93dSmrg]) # XORG_LINT_LIBRARY
29484c61c93dSmrg
29491c80d5b0Smrg# XORG_COMPILER_BRAND
29501c80d5b0Smrg# -------------------
29511c80d5b0Smrg# Minimum version: 1.14.0
29521c80d5b0Smrg#
29531c80d5b0Smrg# Checks for various brands of compilers and sets flags as appropriate:
29541c80d5b0Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29551c80d5b0Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29561c80d5b0Smrg#   clang compiler - sets CLANGCC to "yes"
29571c80d5b0Smrg#   Intel compiler - sets INTELCC to "yes"
29581c80d5b0Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29591c80d5b0Smrg#
29601c80d5b0SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29611c80d5b0SmrgAC_LANG_CASE(
29621c80d5b0Smrg	[C], [
2963944bff83Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2964944bff83Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2965944bff83Smrg		m4_version_prereq([2.70],
2966944bff83Smrg			[AC_REQUIRE([AC_PROG_CC])],
2967944bff83Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
29681c80d5b0Smrg	],
29691c80d5b0Smrg	[C++], [
29701c80d5b0Smrg		AC_REQUIRE([AC_PROG_CXX])
29711c80d5b0Smrg	]
29721c80d5b0Smrg)
29731c80d5b0SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
29741c80d5b0SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
29751c80d5b0SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
29761c80d5b0Smrg]) # XORG_COMPILER_BRAND
29771c80d5b0Smrg
29781c80d5b0Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
29791c80d5b0Smrg# ---------------
29801c80d5b0Smrg# Minimum version: 1.16.0
29811c80d5b0Smrg#
29821c80d5b0Smrg# Test if the compiler works when passed the given flag as a command line argument.
2983944bff83Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
29841c80d5b0Smrg# next flag in the list until there are no more options.
29851c80d5b0Smrg#
29861c80d5b0Smrg# Note that this does not guarantee that the compiler supports the flag as some
29871c80d5b0Smrg# compilers will simply ignore arguments that they do not understand, but we do
29881c80d5b0Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29891c80d5b0Smrg# -Werror=unused-command-line-argument
29901c80d5b0Smrg#
29911c80d5b0SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29921c80d5b0Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29931c80d5b0Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29941c80d5b0Smrg
29951c80d5b0SmrgAC_LANG_COMPILER_REQUIRE
29961c80d5b0Smrg
29971c80d5b0SmrgAC_LANG_CASE(
29981c80d5b0Smrg	[C], [
2999944bff83Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3000944bff83Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3001944bff83Smrg		m4_version_prereq([2.70],
3002944bff83Smrg			[AC_REQUIRE([AC_PROG_CC])],
3003944bff83Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30041c80d5b0Smrg		define([PREFIX], [C])
30051c80d5b0Smrg		define([CACHE_PREFIX], [cc])
30061c80d5b0Smrg		define([COMPILER], [$CC])
30071c80d5b0Smrg	],
30081c80d5b0Smrg	[C++], [
30091c80d5b0Smrg		define([PREFIX], [CXX])
30101c80d5b0Smrg		define([CACHE_PREFIX], [cxx])
30111c80d5b0Smrg		define([COMPILER], [$CXX])
30121c80d5b0Smrg	]
30131c80d5b0Smrg)
30141c80d5b0Smrg
30151c80d5b0Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30161c80d5b0Smrg
30171c80d5b0Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30181c80d5b0Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30191c80d5b0Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30201c80d5b0Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30211c80d5b0Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30221c80d5b0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30231c80d5b0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30241c80d5b0Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30251c80d5b0Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30261c80d5b0Smrgfi
30271c80d5b0Smrg
30281c80d5b0Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30291c80d5b0Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30301c80d5b0Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30311c80d5b0Smrg	fi
30321c80d5b0Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30331c80d5b0Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30341c80d5b0Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30351c80d5b0Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30361c80d5b0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30371c80d5b0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30381c80d5b0Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30391c80d5b0Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30401c80d5b0Smrgfi
30411c80d5b0Smrg
30421c80d5b0Smrgfound="no"
30431c80d5b0Smrgm4_foreach([flag], m4_cdr($@), [
30441c80d5b0Smrg	if test $found = "no" ; then
304541fe0c2aSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30461c80d5b0Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30471c80d5b0Smrg		fi
30481c80d5b0Smrg
304941fe0c2aSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30501c80d5b0Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30511c80d5b0Smrg		fi
30521c80d5b0Smrg
30531c80d5b0Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30541c80d5b0Smrg
30551c80d5b0Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30561c80d5b0Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30571c80d5b0Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30581c80d5b0Smrg		AC_CACHE_VAL($cacheid,
30591c80d5b0Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30601c80d5b0Smrg					     [eval $cacheid=yes],
30611c80d5b0Smrg					     [eval $cacheid=no])])
30621c80d5b0Smrg
30631c80d5b0Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30641c80d5b0Smrg
30651c80d5b0Smrg		eval supported=\$$cacheid
30661c80d5b0Smrg		AC_MSG_RESULT([$supported])
30671c80d5b0Smrg		if test "$supported" = "yes" ; then
30681c80d5b0Smrg			$1="$$1 ]flag["
30691c80d5b0Smrg			found="yes"
30701c80d5b0Smrg		fi
30711c80d5b0Smrg	fi
30721c80d5b0Smrg])
30731c80d5b0Smrg]) # XORG_TESTSET_CFLAG
30741c80d5b0Smrg
30751c80d5b0Smrg# XORG_COMPILER_FLAGS
30761c80d5b0Smrg# ---------------
30771c80d5b0Smrg# Minimum version: 1.16.0
30781c80d5b0Smrg#
30791c80d5b0Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
30801c80d5b0Smrg# arguments supported by the selected compiler which do NOT alter the generated
30811c80d5b0Smrg# code.  These arguments will cause the compiler to print various warnings
30821c80d5b0Smrg# during compilation AND turn a conservative set of warnings into errors.
30831c80d5b0Smrg#
30841c80d5b0Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
30851c80d5b0Smrg# future versions of util-macros as options are added to new compilers.
30861c80d5b0Smrg#
30871c80d5b0SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
30881c80d5b0SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30891c80d5b0Smrg
30901c80d5b0SmrgAC_ARG_ENABLE(selective-werror,
30911c80d5b0Smrg              AS_HELP_STRING([--disable-selective-werror],
30921c80d5b0Smrg                             [Turn off selective compiler errors. (default: enabled)]),
30931c80d5b0Smrg              [SELECTIVE_WERROR=$enableval],
30941c80d5b0Smrg              [SELECTIVE_WERROR=yes])
30951c80d5b0Smrg
30961c80d5b0SmrgAC_LANG_CASE(
30971c80d5b0Smrg        [C], [
30981c80d5b0Smrg                define([PREFIX], [C])
30991c80d5b0Smrg        ],
31001c80d5b0Smrg        [C++], [
31011c80d5b0Smrg                define([PREFIX], [CXX])
31021c80d5b0Smrg        ]
31031c80d5b0Smrg)
31041c80d5b0Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
31051c80d5b0Smrgif test "x$SUNCC" = "xyes"; then
31061c80d5b0Smrg    [BASE_]PREFIX[FLAGS]="-v"
31071c80d5b0Smrgelse
31081c80d5b0Smrg    [BASE_]PREFIX[FLAGS]=""
31091c80d5b0Smrgfi
31101c80d5b0Smrg
31111c80d5b0Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31121c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31131c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31141c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31151c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31161c80d5b0Smrg
31171c80d5b0SmrgAC_LANG_CASE(
31181c80d5b0Smrg	[C], [
31191c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31201c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31211c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31221c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
312341fe0c2aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31241c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31251c80d5b0Smrg	]
31261c80d5b0Smrg)
31271c80d5b0Smrg
31281c80d5b0Smrg# This chunk adds additional warnings that could catch undesired effects.
31291c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31301c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31311c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31321c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31331c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31341c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
313541fe0c2aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
31361c80d5b0Smrg
31371c80d5b0Smrg# These are currently disabled because they are noisy.  They will be enabled
31381c80d5b0Smrg# in the future once the codebase is sufficiently modernized to silence
31391c80d5b0Smrg# them.  For now, I don't want them to drown out the other warnings.
31401c80d5b0Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31411c80d5b0Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
314241fe0c2aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
31431c80d5b0Smrg
3144944bff83Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
31451c80d5b0Smrg# when there are problems that should be fixed.
31461c80d5b0Smrg
31471c80d5b0Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31481c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31491c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31501c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31511c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31521c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31531c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31541c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31551c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31561c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31571c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31581c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31591c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31601c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31611c80d5b0Smrgelse
31621c80d5b0SmrgAC_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])
31631c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31641c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31651c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31661c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
31671c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
31681c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
31691c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
31701c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
31711c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
31721c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
31731c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
31741c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
31751c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31761c80d5b0Smrgfi
31771c80d5b0Smrg
31781c80d5b0SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31791c80d5b0Smrg]) # XORG_COMPILER_FLAGS
31801c80d5b0Smrg
31814c61c93dSmrg# XORG_CWARNFLAGS
31824c61c93dSmrg# ---------------
31834c61c93dSmrg# Minimum version: 1.2.0
31841c80d5b0Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
31854c61c93dSmrg#
31864c61c93dSmrg# Defines CWARNFLAGS to enable C compiler warnings.
31874c61c93dSmrg#
31881c80d5b0Smrg# This function is deprecated because it defines -fno-strict-aliasing
31891c80d5b0Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
31901c80d5b0Smrg# is needed, then it should be added explicitly in the module when
31911c80d5b0Smrg# it is updated to use BASE_CFLAGS.
31921c80d5b0Smrg#
31934c61c93dSmrgAC_DEFUN([XORG_CWARNFLAGS], [
31941c80d5b0SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31951c80d5b0SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31961c80d5b0SmrgAC_LANG_CASE(
31971c80d5b0Smrg	[C], [
31981c80d5b0Smrg		CWARNFLAGS="$BASE_CFLAGS"
31991c80d5b0Smrg		if  test "x$GCC" = xyes ; then
32001c80d5b0Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
32011c80d5b0Smrg		fi
32021c80d5b0Smrg		AC_SUBST(CWARNFLAGS)
32031c80d5b0Smrg	]
32041c80d5b0Smrg)
32054c61c93dSmrg]) # XORG_CWARNFLAGS
32064c61c93dSmrg
32074c61c93dSmrg# XORG_STRICT_OPTION
32084c61c93dSmrg# -----------------------
32094c61c93dSmrg# Minimum version: 1.3.0
32104c61c93dSmrg#
32111c80d5b0Smrg# Add configure option to enable strict compilation flags, such as treating
32121c80d5b0Smrg# warnings as fatal errors.
32131c80d5b0Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32141c80d5b0Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32151c80d5b0Smrg#
32161c80d5b0Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32171c80d5b0Smrg# when strict compilation is unconditionally desired.
32184c61c93dSmrgAC_DEFUN([XORG_STRICT_OPTION], [
32194c61c93dSmrgAC_REQUIRE([XORG_CWARNFLAGS])
32201c80d5b0SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32214c61c93dSmrg
32224c61c93dSmrgAC_ARG_ENABLE(strict-compilation,
32234c61c93dSmrg			  AS_HELP_STRING([--enable-strict-compilation],
32244c61c93dSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32254c61c93dSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
32261c80d5b0Smrg
32271c80d5b0SmrgAC_LANG_CASE(
32281c80d5b0Smrg        [C], [
32291c80d5b0Smrg                define([PREFIX], [C])
32301c80d5b0Smrg        ],
32311c80d5b0Smrg        [C++], [
32321c80d5b0Smrg                define([PREFIX], [CXX])
32331c80d5b0Smrg        ]
32341c80d5b0Smrg)
32351c80d5b0Smrg
32361c80d5b0Smrg[STRICT_]PREFIX[FLAGS]=""
32371c80d5b0SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32381c80d5b0SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
32391c80d5b0Smrg
32401c80d5b0Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32411c80d5b0Smrg# activate it with -Werror, so we add it here explicitly.
32421c80d5b0SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
32431c80d5b0Smrg
32444c61c93dSmrgif test "x$STRICT_COMPILE" = "xyes"; then
32451c80d5b0Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32461c80d5b0Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32474c61c93dSmrgfi
32481c80d5b0SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32491c80d5b0SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32501c80d5b0SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32514c61c93dSmrg]) # XORG_STRICT_OPTION
32524c61c93dSmrg
3253944bff83Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3254944bff83Smrg# ---------------------------
3255944bff83Smrg# Minimum version: 1.20.0
3256944bff83Smrg#
3257944bff83Smrg# Defines default options for X.Org modules which don't compile code,
3258944bff83Smrg# such as fonts, bitmaps, cursors, and docs.
3259944bff83Smrg#
3260944bff83SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3261944bff83SmrgAC_REQUIRE([AC_PROG_INSTALL])
3262944bff83SmrgXORG_RELEASE_VERSION
3263944bff83SmrgXORG_CHANGELOG
3264944bff83SmrgXORG_INSTALL
3265944bff83SmrgXORG_MANPAGE_SECTIONS
3266944bff83Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3267944bff83Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3268944bff83Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3269944bff83Smrg
32704c61c93dSmrg# XORG_DEFAULT_OPTIONS
32714c61c93dSmrg# --------------------
32724c61c93dSmrg# Minimum version: 1.3.0
32734c61c93dSmrg#
3274944bff83Smrg# Defines default options for X.Org modules which compile code.
32754c61c93dSmrg#
32764c61c93dSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3277d7ffce2aSmrgAC_REQUIRE([AC_PROG_INSTALL])
32781c80d5b0SmrgXORG_COMPILER_FLAGS
32794c61c93dSmrgXORG_CWARNFLAGS
32804c61c93dSmrgXORG_STRICT_OPTION
3281944bff83SmrgXORG_DEFAULT_NOCODE_OPTIONS
32824c61c93dSmrg]) # XORG_DEFAULT_OPTIONS
3283d7ffce2aSmrg
3284d7ffce2aSmrg# XORG_INSTALL()
3285d7ffce2aSmrg# ----------------
3286d7ffce2aSmrg# Minimum version: 1.4.0
3287d7ffce2aSmrg#
3288d7ffce2aSmrg# Defines the variable INSTALL_CMD as the command to copy
3289d7ffce2aSmrg# INSTALL from $prefix/share/util-macros.
3290d7ffce2aSmrg#
3291d7ffce2aSmrgAC_DEFUN([XORG_INSTALL], [
3292d7ffce2aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3293d7ffce2aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3294d7ffce2aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3295d7ffce2aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3296b8df70beSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3297b8df70beSmrgtouch \$(top_srcdir)/INSTALL; \
3298b8df70beSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3299d7ffce2aSmrgAC_SUBST([INSTALL_CMD])
3300d7ffce2aSmrg]) # XORG_INSTALL
33014c61c93dSmrgdnl Copyright 2005 Red Hat, Inc
33024c61c93dSmrgdnl
33034c61c93dSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
33044c61c93dSmrgdnl documentation for any purpose is hereby granted without fee, provided that
33054c61c93dSmrgdnl the above copyright notice appear in all copies and that both that
33064c61c93dSmrgdnl copyright notice and this permission notice appear in supporting
33074c61c93dSmrgdnl documentation.
33084c61c93dSmrgdnl
33094c61c93dSmrgdnl The above copyright notice and this permission notice shall be included
33104c61c93dSmrgdnl in all copies or substantial portions of the Software.
33114c61c93dSmrgdnl
33124c61c93dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33134c61c93dSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33144c61c93dSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33154c61c93dSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
33164c61c93dSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33174c61c93dSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33184c61c93dSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
33194c61c93dSmrgdnl
33204c61c93dSmrgdnl Except as contained in this notice, the name of the copyright holders shall
33214c61c93dSmrgdnl not be used in advertising or otherwise to promote the sale, use or
33224c61c93dSmrgdnl other dealings in this Software without prior written authorization
33234c61c93dSmrgdnl from the copyright holders.
33244c61c93dSmrgdnl
33254c61c93dSmrg
33264c61c93dSmrg# XORG_RELEASE_VERSION
33274c61c93dSmrg# --------------------
3328d7ffce2aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
332941fe0c2aSmrg
33304c61c93dSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33314c61c93dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33324c61c93dSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33334c61c93dSmrg		[Major version of this package])
33344c61c93dSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33354c61c93dSmrg	if test "x$PVM" = "x"; then
33364c61c93dSmrg		PVM="0"
33374c61c93dSmrg	fi
33384c61c93dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33394c61c93dSmrg		[$PVM],
33404c61c93dSmrg		[Minor version of this package])
33414c61c93dSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33424c61c93dSmrg	if test "x$PVP" = "x"; then
33434c61c93dSmrg		PVP="0"
33444c61c93dSmrg	fi
33454c61c93dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33464c61c93dSmrg		[$PVP],
33474c61c93dSmrg		[Patch version of this package])
33484c61c93dSmrg])
33494c61c93dSmrg
33504c61c93dSmrg# XORG_CHANGELOG()
33514c61c93dSmrg# ----------------
33524c61c93dSmrg# Minimum version: 1.2.0
33534c61c93dSmrg#
33544c61c93dSmrg# Defines the variable CHANGELOG_CMD as the command to generate
33554c61c93dSmrg# ChangeLog from git.
33564c61c93dSmrg#
33574c61c93dSmrg#
33584c61c93dSmrgAC_DEFUN([XORG_CHANGELOG], [
3359b8df70beSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3360d7ffce2aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3361b8df70beSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3362b8df70beSmrgtouch \$(top_srcdir)/ChangeLog; \
3363b8df70beSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33644c61c93dSmrgAC_SUBST([CHANGELOG_CMD])
33654c61c93dSmrg]) # XORG_CHANGELOG
33664c61c93dSmrg
3367