aclocal.m4 revision 7591dea4
17591dea4Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
27591dea4Smrg
37591dea4Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
456f6b22bSmrg
556f6b22bSmrg# This file is free software; the Free Software Foundation
656f6b22bSmrg# gives unlimited permission to copy and/or distribute it,
756f6b22bSmrg# with or without modifications, as long as this notice is preserved.
856f6b22bSmrg
956f6b22bSmrg# This program is distributed in the hope that it will be useful,
1056f6b22bSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1156f6b22bSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1256f6b22bSmrg# PARTICULAR PURPOSE.
1356f6b22bSmrg
147591dea4Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15ef7198c0Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16ef7198c0Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
177591dea4Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
187591dea4Smrg[m4_warning([this file was generated for autoconf 2.71.
19ef7198c0SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20ef7198c0SmrgIf you have problems, you may need to regenerate the build system entirely.
217591dea4SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
223a67387eSmrg
237591dea4Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
243a67387eSmrg#
257591dea4Smrg# This file is free software; the Free Software Foundation
267591dea4Smrg# gives unlimited permission to copy and/or distribute it,
277591dea4Smrg# with or without modifications, as long as this notice is preserved.
28ef7198c0Smrg
297591dea4Smrg# AM_AUTOMAKE_VERSION(VERSION)
307591dea4Smrg# ----------------------------
317591dea4Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
327591dea4Smrg# generated from the m4 files accompanying Automake X.Y.
337591dea4Smrg# (This private macro should not be called outside this file.)
347591dea4SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
357591dea4Smrg[am__api_version='1.16'
367591dea4Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
377591dea4Smrgdnl require some minimum version.  Point them to the right macro.
387591dea4Smrgm4_if([$1], [1.16.5], [],
397591dea4Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
407591dea4Smrg])
4156f6b22bSmrg
427591dea4Smrg# _AM_AUTOCONF_VERSION(VERSION)
437591dea4Smrg# -----------------------------
447591dea4Smrg# aclocal traces this macro to find the Autoconf version.
457591dea4Smrg# This is a private macro too.  Using m4_define simplifies
467591dea4Smrg# the logic in aclocal, which can simply ignore this definition.
477591dea4Smrgm4_define([_AM_AUTOCONF_VERSION], [])
4856f6b22bSmrg
497591dea4Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
507591dea4Smrg# -------------------------------
517591dea4Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
527591dea4Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
537591dea4SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
547591dea4Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
557591dea4Smrgm4_ifndef([AC_AUTOCONF_VERSION],
567591dea4Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
577591dea4Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5856f6b22bSmrg
597591dea4Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6056f6b22bSmrg
617591dea4Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
627591dea4Smrg#
637591dea4Smrg# This file is free software; the Free Software Foundation
647591dea4Smrg# gives unlimited permission to copy and/or distribute it,
657591dea4Smrg# with or without modifications, as long as this notice is preserved.
663a67387eSmrg
677591dea4Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
687591dea4Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
697591dea4Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7056f6b22bSmrg#
717591dea4Smrg# Of course, Automake must honor this variable whenever it calls a
727591dea4Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
737591dea4Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
747591dea4Smrg# depending on how configure is run.  This is pretty annoying, since
757591dea4Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
767591dea4Smrg# source directory, any form will work fine, but in subdirectories a
777591dea4Smrg# relative path needs to be adjusted first.
7856f6b22bSmrg#
797591dea4Smrg# $ac_aux_dir/missing
807591dea4Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
817591dea4Smrg# $top_srcdir/$ac_aux_dir/missing
827591dea4Smrg#    fails if $ac_aux_dir is absolute,
837591dea4Smrg#    fails when called from a subdirectory in a VPATH build with
847591dea4Smrg#          a relative $ac_aux_dir
85ef7198c0Smrg#
867591dea4Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
877591dea4Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
887591dea4Smrg# harmless because $srcdir is '.', but things will broke when you
897591dea4Smrg# start a VPATH build or use an absolute $srcdir.
903a67387eSmrg#
917591dea4Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
927591dea4Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
937591dea4Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
947591dea4Smrg# and then we would define $MISSING as
957591dea4Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
967591dea4Smrg# This will work as long as MISSING is not called from configure, because
977591dea4Smrg# unfortunately $(top_srcdir) has no meaning in configure.
987591dea4Smrg# However there are other variables, like CC, which are often used in
997591dea4Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1003a67387eSmrg#
1017591dea4Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1027591dea4Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1037591dea4Smrg# configured tree to be moved without reconfiguration.
1047591dea4Smrg
1057591dea4SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1067591dea4Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1077591dea4Smrg# Expand $ac_aux_dir to an absolute path.
1087591dea4Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1093a67387eSmrg])
11056f6b22bSmrg
1117591dea4Smrg# Do all the work for Automake.                             -*- Autoconf -*-
11256f6b22bSmrg
1137591dea4Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
114ef7198c0Smrg#
1157591dea4Smrg# This file is free software; the Free Software Foundation
1167591dea4Smrg# gives unlimited permission to copy and/or distribute it,
1177591dea4Smrg# with or without modifications, as long as this notice is preserved.
11856f6b22bSmrg
1197591dea4Smrg# This macro actually does too much.  Some checks are only needed if
1207591dea4Smrg# your package does certain things.  But this isn't really a big deal.
12156f6b22bSmrg
1227591dea4Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
1237591dea4Smrgm4_define([AC_PROG_CC],
1247591dea4Smrgm4_defn([AC_PROG_CC])
1257591dea4Smrg[_AM_PROG_CC_C_O
1263a67387eSmrg])
12756f6b22bSmrg
1287591dea4Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
1297591dea4Smrg# AM_INIT_AUTOMAKE([OPTIONS])
1307591dea4Smrg# -----------------------------------------------
1317591dea4Smrg# The call with PACKAGE and VERSION arguments is the old style
1327591dea4Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
1337591dea4Smrg# and VERSION should now be passed to AC_INIT and removed from
1347591dea4Smrg# the call to AM_INIT_AUTOMAKE.
1357591dea4Smrg# We support both call styles for the transition.  After
1367591dea4Smrg# the next Automake release, Autoconf can make the AC_INIT
1377591dea4Smrg# arguments mandatory, and then we can depend on a new Autoconf
1387591dea4Smrg# release and drop the old call support.
1397591dea4SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
1407591dea4Smrg[AC_PREREQ([2.65])dnl
1417591dea4Smrgm4_ifdef([_$0_ALREADY_INIT],
1427591dea4Smrg  [m4_fatal([$0 expanded multiple times
1437591dea4Smrg]m4_defn([_$0_ALREADY_INIT]))],
1447591dea4Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
1457591dea4Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
1467591dea4Smrgdnl the ones we care about.
1477591dea4Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
1487591dea4SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
1497591dea4SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
1507591dea4Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
1517591dea4Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
1527591dea4Smrg  # is not polluted with repeated "-I."
1537591dea4Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
1547591dea4Smrg  # test to see if srcdir already configured
1557591dea4Smrg  if test -f $srcdir/config.status; then
1567591dea4Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1577591dea4Smrg  fi
1587591dea4Smrgfi
15956f6b22bSmrg
1607591dea4Smrg# test whether we have cygpath
1617591dea4Smrgif test -z "$CYGPATH_W"; then
1627591dea4Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
1637591dea4Smrg    CYGPATH_W='cygpath -w'
1647591dea4Smrg  else
1657591dea4Smrg    CYGPATH_W=echo
1667591dea4Smrg  fi
1677591dea4Smrgfi
1687591dea4SmrgAC_SUBST([CYGPATH_W])
169ef7198c0Smrg
1707591dea4Smrg# Define the identity of the package.
1717591dea4Smrgdnl Distinguish between old-style and new-style calls.
1727591dea4Smrgm4_ifval([$2],
1737591dea4Smrg[AC_DIAGNOSE([obsolete],
1747591dea4Smrg             [$0: two- and three-arguments forms are deprecated.])
1757591dea4Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
1767591dea4Smrg AC_SUBST([PACKAGE], [$1])dnl
1777591dea4Smrg AC_SUBST([VERSION], [$2])],
1787591dea4Smrg[_AM_SET_OPTIONS([$1])dnl
1797591dea4Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
1807591dea4Smrgm4_if(
1817591dea4Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
1827591dea4Smrg  [ok:ok],,
1837591dea4Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
1847591dea4Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
1857591dea4Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
18656f6b22bSmrg
1877591dea4Smrg_AM_IF_OPTION([no-define],,
1887591dea4Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
1897591dea4Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
19056f6b22bSmrg
1917591dea4Smrg# Some tools Automake needs.
1927591dea4SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
1937591dea4SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
1947591dea4SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
1957591dea4SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
1967591dea4SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
1977591dea4SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
1987591dea4SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
1997591dea4SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2007591dea4SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2017591dea4SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
2027591dea4Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
2037591dea4Smrg# dies out for good.  For more background, see:
2047591dea4Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2057591dea4Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2067591dea4SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2077591dea4Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
2087591dea4Smrg# system "awk" is bad on some platforms.
2097591dea4SmrgAC_REQUIRE([AC_PROG_AWK])dnl
2107591dea4SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
2117591dea4SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
2127591dea4Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2137591dea4Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2147591dea4Smrg			     [_AM_PROG_TAR([v7])])])
2157591dea4Smrg_AM_IF_OPTION([no-dependencies],,
2167591dea4Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
2177591dea4Smrg		  [_AM_DEPENDENCIES([CC])],
2187591dea4Smrg		  [m4_define([AC_PROG_CC],
2197591dea4Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2207591dea4SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
2217591dea4Smrg		  [_AM_DEPENDENCIES([CXX])],
2227591dea4Smrg		  [m4_define([AC_PROG_CXX],
2237591dea4Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2247591dea4SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
2257591dea4Smrg		  [_AM_DEPENDENCIES([OBJC])],
2267591dea4Smrg		  [m4_define([AC_PROG_OBJC],
2277591dea4Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2287591dea4SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2297591dea4Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
2307591dea4Smrg		  [m4_define([AC_PROG_OBJCXX],
2317591dea4Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
232ef7198c0Smrg])
2337591dea4Smrg# Variables for tags utilities; see am/tags.am
2347591dea4Smrgif test -z "$CTAGS"; then
2357591dea4Smrg  CTAGS=ctags
2367591dea4Smrgfi
2377591dea4SmrgAC_SUBST([CTAGS])
2387591dea4Smrgif test -z "$ETAGS"; then
2397591dea4Smrg  ETAGS=etags
2407591dea4Smrgfi
2417591dea4SmrgAC_SUBST([ETAGS])
2427591dea4Smrgif test -z "$CSCOPE"; then
2437591dea4Smrg  CSCOPE=cscope
2447591dea4Smrgfi
2457591dea4SmrgAC_SUBST([CSCOPE])
246ef7198c0Smrg
2477591dea4SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
2487591dea4Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
2497591dea4Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2507591dea4Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2517591dea4SmrgAC_CONFIG_COMMANDS_PRE(dnl
2527591dea4Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
2537591dea4Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
254ef7198c0Smrg
2557591dea4Smrg# POSIX will say in a future version that running "rm -f" with no argument
2567591dea4Smrg# is OK; and we want to be able to make that assumption in our Makefile
2577591dea4Smrg# recipes.  So use an aggressive probe to check that the usage we want is
2587591dea4Smrg# actually supported "in the wild" to an acceptable degree.
2597591dea4Smrg# See automake bug#10828.
2607591dea4Smrg# To make any issue more visible, cause the running configure to be aborted
2617591dea4Smrg# by default if the 'rm' program in use doesn't match our expectations; the
2627591dea4Smrg# user can still override this though.
2637591dea4Smrgif rm -f && rm -fr && rm -rf; then : OK; else
2647591dea4Smrg  cat >&2 <<'END'
2657591dea4SmrgOops!
2667591dea4Smrg
2677591dea4SmrgYour 'rm' program seems unable to run without file operands specified
2687591dea4Smrgon the command line, even when the '-f' option is present.  This is contrary
2697591dea4Smrgto the behaviour of most rm programs out there, and not conforming with
2707591dea4Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2717591dea4Smrg
2727591dea4SmrgPlease tell bug-automake@gnu.org about your system, including the value
2737591dea4Smrgof your $PATH and any error possibly output before this message.  This
2747591dea4Smrgcan help us improve future automake versions.
275ef7198c0Smrg
2767591dea4SmrgEND
2777591dea4Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
2787591dea4Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
2797591dea4Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
2807591dea4Smrg    echo >&2
2817591dea4Smrg  else
2827591dea4Smrg    cat >&2 <<'END'
2837591dea4SmrgAborting the configuration process, to ensure you take notice of the issue.
284ef7198c0Smrg
2857591dea4SmrgYou can download and install GNU coreutils to get an 'rm' implementation
2867591dea4Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
2873a67387eSmrg
2887591dea4SmrgIf you want to complete the configuration process using your problematic
2897591dea4Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
2907591dea4Smrgto "yes", and re-run configure.
2917591dea4Smrg
2927591dea4SmrgEND
2937591dea4Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
2947591dea4Smrg  fi
2957591dea4Smrgfi
2967591dea4Smrgdnl The trailing newline in this macro's definition is deliberate, for
2977591dea4Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
2987591dea4Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
299ef7198c0Smrg])
300ef7198c0Smrg
3017591dea4Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
3027591dea4Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
3037591dea4Smrgdnl mangled by Autoconf and run in a shell conditional statement.
3047591dea4Smrgm4_define([_AC_COMPILER_EXEEXT],
3057591dea4Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
306ef7198c0Smrg
3077591dea4Smrg# When config.status generates a header, we must update the stamp-h file.
3087591dea4Smrg# This file resides in the same directory as the config header
3097591dea4Smrg# that is generated.  The stamp files are numbered to have different names.
3103a67387eSmrg
3117591dea4Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
3127591dea4Smrg# loop where config.status creates the headers, so we can generate
3137591dea4Smrg# our stamp files there.
3147591dea4SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
3157591dea4Smrg[# Compute $1's index in $config_headers.
3167591dea4Smrg_am_arg=$1
3177591dea4Smrg_am_stamp_count=1
3187591dea4Smrgfor _am_header in $config_headers :; do
3197591dea4Smrg  case $_am_header in
3207591dea4Smrg    $_am_arg | $_am_arg:* )
3217591dea4Smrg      break ;;
3227591dea4Smrg    * )
3237591dea4Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
3247591dea4Smrg  esac
3257591dea4Smrgdone
3267591dea4Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
327ef7198c0Smrg
3287591dea4Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
3297591dea4Smrg#
3307591dea4Smrg# This file is free software; the Free Software Foundation
3317591dea4Smrg# gives unlimited permission to copy and/or distribute it,
3327591dea4Smrg# with or without modifications, as long as this notice is preserved.
333ef7198c0Smrg
3347591dea4Smrg# AM_PROG_INSTALL_SH
3357591dea4Smrg# ------------------
3367591dea4Smrg# Define $install_sh.
3377591dea4SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
3387591dea4Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3397591dea4Smrgif test x"${install_sh+set}" != xset; then
3407591dea4Smrg  case $am_aux_dir in
3417591dea4Smrg  *\ * | *\	*)
3427591dea4Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
3437591dea4Smrg  *)
3447591dea4Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
3457591dea4Smrg  esac
3467591dea4Smrgfi
3477591dea4SmrgAC_SUBST([install_sh])])
348ef7198c0Smrg
3497591dea4Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
350ef7198c0Smrg#
3517591dea4Smrg# This file is free software; the Free Software Foundation
3527591dea4Smrg# gives unlimited permission to copy and/or distribute it,
3537591dea4Smrg# with or without modifications, as long as this notice is preserved.
354ef7198c0Smrg
3557591dea4Smrg# Check whether the underlying file-system supports filenames
3567591dea4Smrg# with a leading dot.  For instance MS-DOS doesn't.
3577591dea4SmrgAC_DEFUN([AM_SET_LEADING_DOT],
3587591dea4Smrg[rm -rf .tst 2>/dev/null
3597591dea4Smrgmkdir .tst 2>/dev/null
3607591dea4Smrgif test -d .tst; then
3617591dea4Smrg  am__leading_dot=.
3627591dea4Smrgelse
3637591dea4Smrg  am__leading_dot=_
3647591dea4Smrgfi
3657591dea4Smrgrmdir .tst 2>/dev/null
3667591dea4SmrgAC_SUBST([am__leading_dot])])
367ef7198c0Smrg
3687591dea4Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
3693a67387eSmrg
3707591dea4Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
371ef7198c0Smrg#
3727591dea4Smrg# This file is free software; the Free Software Foundation
3737591dea4Smrg# gives unlimited permission to copy and/or distribute it,
3747591dea4Smrg# with or without modifications, as long as this notice is preserved.
375ef7198c0Smrg
3767591dea4Smrg# AM_MISSING_PROG(NAME, PROGRAM)
3777591dea4Smrg# ------------------------------
3787591dea4SmrgAC_DEFUN([AM_MISSING_PROG],
3797591dea4Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
3807591dea4Smrg$1=${$1-"${am_missing_run}$2"}
3817591dea4SmrgAC_SUBST($1)])
3827591dea4Smrg
3837591dea4Smrg# AM_MISSING_HAS_RUN
3847591dea4Smrg# ------------------
3857591dea4Smrg# Define MISSING if not defined so far and test if it is modern enough.
3867591dea4Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
3877591dea4SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
3887591dea4Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3897591dea4SmrgAC_REQUIRE_AUX_FILE([missing])dnl
3907591dea4Smrgif test x"${MISSING+set}" != xset; then
3917591dea4Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
3927591dea4Smrgfi
3937591dea4Smrg# Use eval to expand $SHELL
3947591dea4Smrgif eval "$MISSING --is-lightweight"; then
3957591dea4Smrg  am_missing_run="$MISSING "
3967591dea4Smrgelse
3977591dea4Smrg  am_missing_run=
3987591dea4Smrg  AC_MSG_WARN(['missing' script is too old or missing])
3997591dea4Smrgfi
4007591dea4Smrg])
4017591dea4Smrg
4027591dea4Smrg# Helper functions for option handling.                     -*- Autoconf -*-
403ef7198c0Smrg
4047591dea4Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
4053a67387eSmrg#
4067591dea4Smrg# This file is free software; the Free Software Foundation
4077591dea4Smrg# gives unlimited permission to copy and/or distribute it,
4087591dea4Smrg# with or without modifications, as long as this notice is preserved.
4097591dea4Smrg
4107591dea4Smrg# _AM_MANGLE_OPTION(NAME)
4117591dea4Smrg# -----------------------
4127591dea4SmrgAC_DEFUN([_AM_MANGLE_OPTION],
4137591dea4Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
4147591dea4Smrg
4157591dea4Smrg# _AM_SET_OPTION(NAME)
4167591dea4Smrg# --------------------
4177591dea4Smrg# Set option NAME.  Presently that only means defining a flag for this option.
4187591dea4SmrgAC_DEFUN([_AM_SET_OPTION],
4197591dea4Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
4207591dea4Smrg
4217591dea4Smrg# _AM_SET_OPTIONS(OPTIONS)
4227591dea4Smrg# ------------------------
4237591dea4Smrg# OPTIONS is a space-separated list of Automake options.
4247591dea4SmrgAC_DEFUN([_AM_SET_OPTIONS],
4257591dea4Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
4267591dea4Smrg
4277591dea4Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
4287591dea4Smrg# -------------------------------------------
4297591dea4Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
4307591dea4SmrgAC_DEFUN([_AM_IF_OPTION],
4317591dea4Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
4327591dea4Smrg
4337591dea4Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
4347591dea4Smrg
4357591dea4Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4363a67387eSmrg#
4377591dea4Smrg# This file is free software; the Free Software Foundation
4387591dea4Smrg# gives unlimited permission to copy and/or distribute it,
4397591dea4Smrg# with or without modifications, as long as this notice is preserved.
4407591dea4Smrg
4417591dea4Smrg# AM_SANITY_CHECK
4427591dea4Smrg# ---------------
4437591dea4SmrgAC_DEFUN([AM_SANITY_CHECK],
4447591dea4Smrg[AC_MSG_CHECKING([whether build environment is sane])
4457591dea4Smrg# Reject unsafe characters in $srcdir or the absolute working directory
4467591dea4Smrg# name.  Accept space and tab only in the latter.
4477591dea4Smrgam_lf='
4487591dea4Smrg'
4497591dea4Smrgcase `pwd` in
4507591dea4Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
4517591dea4Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
4527591dea4Smrgesac
4537591dea4Smrgcase $srcdir in
4547591dea4Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
4557591dea4Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
4567591dea4Smrgesac
4577591dea4Smrg
4587591dea4Smrg# Do 'set' in a subshell so we don't clobber the current shell's
4597591dea4Smrg# arguments.  Must try -L first in case configure is actually a
4607591dea4Smrg# symlink; some systems play weird games with the mod time of symlinks
4617591dea4Smrg# (eg FreeBSD returns the mod time of the symlink's containing
4627591dea4Smrg# directory).
4637591dea4Smrgif (
4647591dea4Smrg   am_has_slept=no
4657591dea4Smrg   for am_try in 1 2; do
4667591dea4Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
4677591dea4Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
4687591dea4Smrg     if test "$[*]" = "X"; then
4697591dea4Smrg	# -L didn't work.
4707591dea4Smrg	set X `ls -t "$srcdir/configure" conftest.file`
4717591dea4Smrg     fi
4727591dea4Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
4737591dea4Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
4747591dea4Smrg
4757591dea4Smrg	# If neither matched, then we have a broken ls.  This can happen
4767591dea4Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
4777591dea4Smrg	# broken ls alias from the environment.  This has actually
4787591dea4Smrg	# happened.  Such a system could not be considered "sane".
4797591dea4Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
4807591dea4Smrg  alias in your environment])
4817591dea4Smrg     fi
4827591dea4Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
4837591dea4Smrg       break
4847591dea4Smrg     fi
4857591dea4Smrg     # Just in case.
4867591dea4Smrg     sleep 1
4877591dea4Smrg     am_has_slept=yes
4887591dea4Smrg   done
4897591dea4Smrg   test "$[2]" = conftest.file
4907591dea4Smrg   )
4917591dea4Smrgthen
4927591dea4Smrg   # Ok.
4937591dea4Smrg   :
4947591dea4Smrgelse
4957591dea4Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
4967591dea4SmrgCheck your system clock])
4977591dea4Smrgfi
4987591dea4SmrgAC_MSG_RESULT([yes])
4997591dea4Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
5007591dea4Smrg# generated files are strictly newer.
5017591dea4Smrgam_sleep_pid=
5027591dea4Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
5037591dea4Smrg  ( sleep 1 ) &
5047591dea4Smrg  am_sleep_pid=$!
5057591dea4Smrgfi
5067591dea4SmrgAC_CONFIG_COMMANDS_PRE(
5077591dea4Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
5087591dea4Smrg   if test -n "$am_sleep_pid"; then
5097591dea4Smrg     # Hide warnings about reused PIDs.
5107591dea4Smrg     wait $am_sleep_pid 2>/dev/null
5117591dea4Smrg   fi
5127591dea4Smrg   AC_MSG_RESULT([done])])
5137591dea4Smrgrm -f conftest.file
5147591dea4Smrg])
5157591dea4Smrg
5167591dea4Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
5173a67387eSmrg#
5187591dea4Smrg# This file is free software; the Free Software Foundation
5197591dea4Smrg# gives unlimited permission to copy and/or distribute it,
5207591dea4Smrg# with or without modifications, as long as this notice is preserved.
5217591dea4Smrg
5227591dea4Smrg# AM_SILENT_RULES([DEFAULT])
5237591dea4Smrg# --------------------------
5247591dea4Smrg# Enable less verbose build rules; with the default set to DEFAULT
5257591dea4Smrg# ("yes" being less verbose, "no" or empty being verbose).
5267591dea4SmrgAC_DEFUN([AM_SILENT_RULES],
5277591dea4Smrg[AC_ARG_ENABLE([silent-rules], [dnl
5287591dea4SmrgAS_HELP_STRING(
5297591dea4Smrg  [--enable-silent-rules],
5307591dea4Smrg  [less verbose build output (undo: "make V=1")])
5317591dea4SmrgAS_HELP_STRING(
5327591dea4Smrg  [--disable-silent-rules],
5337591dea4Smrg  [verbose build output (undo: "make V=0")])dnl
5347591dea4Smrg])
5357591dea4Smrgcase $enable_silent_rules in @%:@ (((
5367591dea4Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
5377591dea4Smrg   no) AM_DEFAULT_VERBOSITY=1;;
5387591dea4Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
5397591dea4Smrgesac
5407591dea4Smrgdnl
5417591dea4Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
5427591dea4Smrgdnl do not support nested variable expansions.
5437591dea4Smrgdnl See automake bug#9928 and bug#10237.
5447591dea4Smrgam_make=${MAKE-make}
5457591dea4SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
5467591dea4Smrg   [am_cv_make_support_nested_variables],
5477591dea4Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
5487591dea4SmrgBAR0=false
5497591dea4SmrgBAR1=true
5507591dea4SmrgV=1
5517591dea4Smrgam__doit:
5527591dea4Smrg	@$(TRUE)
5537591dea4Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
5547591dea4Smrg  am_cv_make_support_nested_variables=yes
5557591dea4Smrgelse
5567591dea4Smrg  am_cv_make_support_nested_variables=no
5577591dea4Smrgfi])
5587591dea4Smrgif test $am_cv_make_support_nested_variables = yes; then
5597591dea4Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
5607591dea4Smrg  AM_V='$(V)'
5617591dea4Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
5627591dea4Smrgelse
5637591dea4Smrg  AM_V=$AM_DEFAULT_VERBOSITY
5647591dea4Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
5657591dea4Smrgfi
5667591dea4SmrgAC_SUBST([AM_V])dnl
5677591dea4SmrgAM_SUBST_NOTMAKE([AM_V])dnl
5687591dea4SmrgAC_SUBST([AM_DEFAULT_V])dnl
5697591dea4SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
5707591dea4SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
5717591dea4SmrgAM_BACKSLASH='\'
5727591dea4SmrgAC_SUBST([AM_BACKSLASH])dnl
5737591dea4Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
5747591dea4Smrg])
5757591dea4Smrg
5767591dea4Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
5773a67387eSmrg#
5787591dea4Smrg# This file is free software; the Free Software Foundation
5797591dea4Smrg# gives unlimited permission to copy and/or distribute it,
5807591dea4Smrg# with or without modifications, as long as this notice is preserved.
581ef7198c0Smrg
5827591dea4Smrg# AM_PROG_INSTALL_STRIP
5837591dea4Smrg# ---------------------
5847591dea4Smrg# One issue with vendor 'install' (even GNU) is that you can't
5857591dea4Smrg# specify the program used to strip binaries.  This is especially
5867591dea4Smrg# annoying in cross-compiling environments, where the build's strip
5877591dea4Smrg# is unlikely to handle the host's binaries.
5887591dea4Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
5897591dea4Smrg# always use install-sh in "make install-strip", and initialize
5907591dea4Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
5917591dea4SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
5927591dea4Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
5937591dea4Smrg# Installed binaries are usually stripped using 'strip' when the user
5947591dea4Smrg# run "make install-strip".  However 'strip' might not be the right
5957591dea4Smrg# tool to use in cross-compilation environments, therefore Automake
5967591dea4Smrg# will honor the 'STRIP' environment variable to overrule this program.
5977591dea4Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
5987591dea4Smrgif test "$cross_compiling" != no; then
5997591dea4Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
6007591dea4Smrgfi
6017591dea4SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
6027591dea4SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
6037591dea4Smrg
6047591dea4Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
6057591dea4Smrg#
6067591dea4Smrg# This file is free software; the Free Software Foundation
6077591dea4Smrg# gives unlimited permission to copy and/or distribute it,
6087591dea4Smrg# with or without modifications, as long as this notice is preserved.
6097591dea4Smrg
6107591dea4Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
6117591dea4Smrg# ---------------------------
6127591dea4Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
6137591dea4Smrg# This macro is traced by Automake.
6147591dea4SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
6157591dea4Smrg
6167591dea4Smrg# AM_SUBST_NOTMAKE(VARIABLE)
6177591dea4Smrg# --------------------------
6187591dea4Smrg# Public sister of _AM_SUBST_NOTMAKE.
6197591dea4SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
6207591dea4Smrg
6217591dea4Smrg# Check how to create a tarball.                            -*- Autoconf -*-
6227591dea4Smrg
6237591dea4Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
6247591dea4Smrg#
6257591dea4Smrg# This file is free software; the Free Software Foundation
6267591dea4Smrg# gives unlimited permission to copy and/or distribute it,
6277591dea4Smrg# with or without modifications, as long as this notice is preserved.
6287591dea4Smrg
6297591dea4Smrg# _AM_PROG_TAR(FORMAT)
6307591dea4Smrg# --------------------
6317591dea4Smrg# Check how to create a tarball in format FORMAT.
6327591dea4Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
6337591dea4Smrg#
6347591dea4Smrg# Substitute a variable $(am__tar) that is a command
6357591dea4Smrg# writing to stdout a FORMAT-tarball containing the directory
6367591dea4Smrg# $tardir.
6377591dea4Smrg#     tardir=directory && $(am__tar) > result.tar
6387591dea4Smrg#
6397591dea4Smrg# Substitute a variable $(am__untar) that extract such
6407591dea4Smrg# a tarball read from stdin.
6417591dea4Smrg#     $(am__untar) < result.tar
6427591dea4Smrg#
6437591dea4SmrgAC_DEFUN([_AM_PROG_TAR],
6447591dea4Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
6457591dea4Smrg# in the wild :-(  We should find a proper way to deprecate it ...
6467591dea4SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
6477591dea4Smrg
6487591dea4Smrg# We'll loop over all known methods to create a tar archive until one works.
6497591dea4Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
6507591dea4Smrg
6517591dea4Smrgm4_if([$1], [v7],
6527591dea4Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
6537591dea4Smrg
6547591dea4Smrg  [m4_case([$1],
6557591dea4Smrg    [ustar],
6567591dea4Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
6577591dea4Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
6587591dea4Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
6597591dea4Smrg      # and bug#13588).
6607591dea4Smrg      am_max_uid=2097151 # 2^21 - 1
6617591dea4Smrg      am_max_gid=$am_max_uid
6627591dea4Smrg      # The $UID and $GID variables are not portable, so we need to resort
6637591dea4Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
6647591dea4Smrg      # below are definitely unexpected, so allow the users to see them
6657591dea4Smrg      # (that is, avoid stderr redirection).
6667591dea4Smrg      am_uid=`id -u || echo unknown`
6677591dea4Smrg      am_gid=`id -g || echo unknown`
6687591dea4Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
6697591dea4Smrg      if test $am_uid -le $am_max_uid; then
6707591dea4Smrg         AC_MSG_RESULT([yes])
6717591dea4Smrg      else
6727591dea4Smrg         AC_MSG_RESULT([no])
6737591dea4Smrg         _am_tools=none
6747591dea4Smrg      fi
6757591dea4Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
6767591dea4Smrg      if test $am_gid -le $am_max_gid; then
6777591dea4Smrg         AC_MSG_RESULT([yes])
6787591dea4Smrg      else
6797591dea4Smrg        AC_MSG_RESULT([no])
6807591dea4Smrg        _am_tools=none
6817591dea4Smrg      fi],
6827591dea4Smrg
6837591dea4Smrg  [pax],
6847591dea4Smrg    [],
6857591dea4Smrg
6867591dea4Smrg  [m4_fatal([Unknown tar format])])
6877591dea4Smrg
6887591dea4Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
6897591dea4Smrg
6907591dea4Smrg  # Go ahead even if we have the value already cached.  We do so because we
6917591dea4Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
6927591dea4Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
6937591dea4Smrg
6947591dea4Smrg  for _am_tool in $_am_tools; do
6957591dea4Smrg    case $_am_tool in
6967591dea4Smrg    gnutar)
6977591dea4Smrg      for _am_tar in tar gnutar gtar; do
6987591dea4Smrg        AM_RUN_LOG([$_am_tar --version]) && break
6997591dea4Smrg      done
7007591dea4Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
7017591dea4Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
7027591dea4Smrg      am__untar="$_am_tar -xf -"
7037591dea4Smrg      ;;
7047591dea4Smrg    plaintar)
7057591dea4Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
7067591dea4Smrg      # ustar tarball either.
7077591dea4Smrg      (tar --version) >/dev/null 2>&1 && continue
7087591dea4Smrg      am__tar='tar chf - "$$tardir"'
7097591dea4Smrg      am__tar_='tar chf - "$tardir"'
7107591dea4Smrg      am__untar='tar xf -'
7117591dea4Smrg      ;;
7127591dea4Smrg    pax)
7137591dea4Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
7147591dea4Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
7157591dea4Smrg      am__untar='pax -r'
7167591dea4Smrg      ;;
7177591dea4Smrg    cpio)
7187591dea4Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
7197591dea4Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
7207591dea4Smrg      am__untar='cpio -i -H $1 -d'
7217591dea4Smrg      ;;
7227591dea4Smrg    none)
7237591dea4Smrg      am__tar=false
7247591dea4Smrg      am__tar_=false
7257591dea4Smrg      am__untar=false
7267591dea4Smrg      ;;
7277591dea4Smrg    esac
7287591dea4Smrg
7297591dea4Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
7307591dea4Smrg    # and am__untar set.
7317591dea4Smrg    test -n "${am_cv_prog_tar_$1}" && break
7327591dea4Smrg
7337591dea4Smrg    # tar/untar a dummy directory, and stop if the command works.
7347591dea4Smrg    rm -rf conftest.dir
7357591dea4Smrg    mkdir conftest.dir
7367591dea4Smrg    echo GrepMe > conftest.dir/file
7377591dea4Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
7387591dea4Smrg    rm -rf conftest.dir
7397591dea4Smrg    if test -s conftest.tar; then
7407591dea4Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
7417591dea4Smrg      AM_RUN_LOG([cat conftest.dir/file])
7427591dea4Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
7437591dea4Smrg    fi
7447591dea4Smrg  done
7457591dea4Smrg  rm -rf conftest.dir
7467591dea4Smrg
7477591dea4Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
7487591dea4Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
7497591dea4Smrg
7507591dea4SmrgAC_SUBST([am__tar])
7517591dea4SmrgAC_SUBST([am__untar])
7527591dea4Smrg]) # _AM_PROG_TAR
7537591dea4Smrg
7547591dea4Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
7557591dea4Smrgdnl serial 11 (pkg-config-0.29)
7567591dea4Smrgdnl
7577591dea4Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
7587591dea4Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
7597591dea4Smrgdnl
7607591dea4Smrgdnl This program is free software; you can redistribute it and/or modify
7617591dea4Smrgdnl it under the terms of the GNU General Public License as published by
7627591dea4Smrgdnl the Free Software Foundation; either version 2 of the License, or
7637591dea4Smrgdnl (at your option) any later version.
7647591dea4Smrgdnl
7657591dea4Smrgdnl This program is distributed in the hope that it will be useful, but
7667591dea4Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
7677591dea4Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7687591dea4Smrgdnl General Public License for more details.
7697591dea4Smrgdnl
7707591dea4Smrgdnl You should have received a copy of the GNU General Public License
7717591dea4Smrgdnl along with this program; if not, write to the Free Software
7727591dea4Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
7737591dea4Smrgdnl 02111-1307, USA.
7747591dea4Smrgdnl
7757591dea4Smrgdnl As a special exception to the GNU General Public License, if you
7767591dea4Smrgdnl distribute this file as part of a program that contains a
7777591dea4Smrgdnl configuration script generated by Autoconf, you may include it under
7787591dea4Smrgdnl the same distribution terms that you use for the rest of that
7797591dea4Smrgdnl program.
7807591dea4Smrg
7817591dea4Smrgdnl PKG_PREREQ(MIN-VERSION)
7827591dea4Smrgdnl -----------------------
7837591dea4Smrgdnl Since: 0.29
7847591dea4Smrgdnl
7857591dea4Smrgdnl Verify that the version of the pkg-config macros are at least
7867591dea4Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
7877591dea4Smrgdnl installed version of pkg-config, this checks the developer's version
7887591dea4Smrgdnl of pkg.m4 when generating configure.
7897591dea4Smrgdnl
7907591dea4Smrgdnl To ensure that this macro is defined, also add:
7917591dea4Smrgdnl m4_ifndef([PKG_PREREQ],
7927591dea4Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
7937591dea4Smrgdnl
7947591dea4Smrgdnl See the "Since" comment for each macro you use to see what version
7957591dea4Smrgdnl of the macros you require.
7967591dea4Smrgm4_defun([PKG_PREREQ],
7977591dea4Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
7987591dea4Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
7997591dea4Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
8007591dea4Smrg])dnl PKG_PREREQ
8017591dea4Smrg
8027591dea4Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
8037591dea4Smrgdnl ----------------------------------
8047591dea4Smrgdnl Since: 0.16
8057591dea4Smrgdnl
8067591dea4Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
8077591dea4Smrgdnl first found in the path. Checks that the version of pkg-config found
8087591dea4Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
8097591dea4Smrgdnl used since that's the first version where most current features of
8107591dea4Smrgdnl pkg-config existed.
8113a67387eSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8123a67387eSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8137591dea4Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8147591dea4Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
8153a67387eSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
8163a67387eSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
8173a67387eSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
818ef7198c0Smrg
8193a67387eSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8203a67387eSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
821ef7198c0Smrgfi
8223a67387eSmrgif test -n "$PKG_CONFIG"; then
8233a67387eSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
8243a67387eSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
8253a67387eSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
8263a67387eSmrg		AC_MSG_RESULT([yes])
8273a67387eSmrg	else
8283a67387eSmrg		AC_MSG_RESULT([no])
8293a67387eSmrg		PKG_CONFIG=""
8303a67387eSmrg	fi
8313a67387eSmrgfi[]dnl
8327591dea4Smrg])dnl PKG_PROG_PKG_CONFIG
833ef7198c0Smrg
8347591dea4Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
8357591dea4Smrgdnl -------------------------------------------------------------------
8367591dea4Smrgdnl Since: 0.18
8377591dea4Smrgdnl
8387591dea4Smrgdnl Check to see whether a particular set of modules exists. Similar to
8397591dea4Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
8407591dea4Smrgdnl
8417591dea4Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
8427591dea4Smrgdnl only at the first occurence in configure.ac, so if the first place
8437591dea4Smrgdnl it's called might be skipped (such as if it is within an "if", you
8447591dea4Smrgdnl have to call PKG_CHECK_EXISTS manually
8453a67387eSmrgAC_DEFUN([PKG_CHECK_EXISTS],
8463a67387eSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
8473a67387eSmrgif test -n "$PKG_CONFIG" && \
8483a67387eSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
8493a67387eSmrg  m4_default([$2], [:])
8503a67387eSmrgm4_ifvaln([$3], [else
8513a67387eSmrg  $3])dnl
8523a67387eSmrgfi])
853ef7198c0Smrg
8547591dea4Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
8557591dea4Smrgdnl ---------------------------------------------
8567591dea4Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
8577591dea4Smrgdnl pkg_failed based on the result.
8583a67387eSmrgm4_define([_PKG_CONFIG],
8593a67387eSmrg[if test -n "$$1"; then
8603a67387eSmrg    pkg_cv_[]$1="$$1"
8613a67387eSmrg elif test -n "$PKG_CONFIG"; then
8623a67387eSmrg    PKG_CHECK_EXISTS([$3],
8637591dea4Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
8647591dea4Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
8653a67387eSmrg		     [pkg_failed=yes])
8663a67387eSmrg else
8673a67387eSmrg    pkg_failed=untried
8683a67387eSmrgfi[]dnl
8697591dea4Smrg])dnl _PKG_CONFIG
870ef7198c0Smrg
8717591dea4Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
8727591dea4Smrgdnl ---------------------------
8737591dea4Smrgdnl Internal check to see if pkg-config supports short errors.
8743a67387eSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
8753a67387eSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
8763a67387eSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
8773a67387eSmrg        _pkg_short_errors_supported=yes
8783a67387eSmrgelse
8793a67387eSmrg        _pkg_short_errors_supported=no
8803a67387eSmrgfi[]dnl
8817591dea4Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
882ef7198c0Smrg
883ef7198c0Smrg
8847591dea4Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
8857591dea4Smrgdnl   [ACTION-IF-NOT-FOUND])
8867591dea4Smrgdnl --------------------------------------------------------------
8877591dea4Smrgdnl Since: 0.4.0
8887591dea4Smrgdnl
8897591dea4Smrgdnl Note that if there is a possibility the first call to
8907591dea4Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
8917591dea4Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
8923a67387eSmrgAC_DEFUN([PKG_CHECK_MODULES],
8933a67387eSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
8943a67387eSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
8953a67387eSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
896ef7198c0Smrg
8973a67387eSmrgpkg_failed=no
8983a67387eSmrgAC_MSG_CHECKING([for $1])
8993a67387eSmrg
9003a67387eSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
9013a67387eSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
9023a67387eSmrg
9033a67387eSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
9043a67387eSmrgand $1[]_LIBS to avoid the need to call pkg-config.
9053a67387eSmrgSee the pkg-config man page for more details.])
9063a67387eSmrg
9073a67387eSmrgif test $pkg_failed = yes; then
9083a67387eSmrg   	AC_MSG_RESULT([no])
9093a67387eSmrg        _PKG_SHORT_ERRORS_SUPPORTED
9103a67387eSmrg        if test $_pkg_short_errors_supported = yes; then
9117591dea4Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
9123a67387eSmrg        else 
9137591dea4Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
9143a67387eSmrg        fi
9153a67387eSmrg	# Put the nasty error message in config.log where it belongs
9163a67387eSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
9173a67387eSmrg
9183a67387eSmrg	m4_default([$4], [AC_MSG_ERROR(
9193a67387eSmrg[Package requirements ($2) were not met:
9203a67387eSmrg
9213a67387eSmrg$$1_PKG_ERRORS
9223a67387eSmrg
9233a67387eSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
9243a67387eSmrginstalled software in a non-standard prefix.
9253a67387eSmrg
9263a67387eSmrg_PKG_TEXT])[]dnl
9273a67387eSmrg        ])
9283a67387eSmrgelif test $pkg_failed = untried; then
9293a67387eSmrg     	AC_MSG_RESULT([no])
9303a67387eSmrg	m4_default([$4], [AC_MSG_FAILURE(
9313a67387eSmrg[The pkg-config script could not be found or is too old.  Make sure it
9323a67387eSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
9333a67387eSmrgpath to pkg-config.
9343a67387eSmrg
9353a67387eSmrg_PKG_TEXT
9363a67387eSmrg
9377591dea4SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
9383a67387eSmrg        ])
9393a67387eSmrgelse
9403a67387eSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
9413a67387eSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
9423a67387eSmrg        AC_MSG_RESULT([yes])
9433a67387eSmrg	$3
9443a67387eSmrgfi[]dnl
9457591dea4Smrg])dnl PKG_CHECK_MODULES
946ef7198c0Smrg
9477591dea4Smrg
9487591dea4Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
9497591dea4Smrgdnl   [ACTION-IF-NOT-FOUND])
9507591dea4Smrgdnl ---------------------------------------------------------------------
9517591dea4Smrgdnl Since: 0.29
9527591dea4Smrgdnl
9537591dea4Smrgdnl Checks for existence of MODULES and gathers its build flags with
9547591dea4Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
9557591dea4Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
9567591dea4Smrgdnl
9577591dea4Smrgdnl Note that if there is a possibility the first call to
9587591dea4Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
9597591dea4Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
9607591dea4Smrgdnl configure.ac.
9617591dea4SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
9627591dea4Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
9637591dea4Smrg_save_PKG_CONFIG=$PKG_CONFIG
9647591dea4SmrgPKG_CONFIG="$PKG_CONFIG --static"
9657591dea4SmrgPKG_CHECK_MODULES($@)
9667591dea4SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
9677591dea4Smrg])dnl PKG_CHECK_MODULES_STATIC
9687591dea4Smrg
9697591dea4Smrg
9707591dea4Smrgdnl PKG_INSTALLDIR([DIRECTORY])
9717591dea4Smrgdnl -------------------------
9727591dea4Smrgdnl Since: 0.27
9737591dea4Smrgdnl
9747591dea4Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
9757591dea4Smrgdnl should install pkg-config .pc files. By default the directory is
9767591dea4Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
9777591dea4Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
9787591dea4Smrgdnl parameter.
9797591dea4SmrgAC_DEFUN([PKG_INSTALLDIR],
9807591dea4Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
9817591dea4Smrgm4_pushdef([pkg_description],
9827591dea4Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
9837591dea4SmrgAC_ARG_WITH([pkgconfigdir],
9847591dea4Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
9857591dea4Smrg    [with_pkgconfigdir=]pkg_default)
9867591dea4SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
9877591dea4Smrgm4_popdef([pkg_default])
9887591dea4Smrgm4_popdef([pkg_description])
9897591dea4Smrg])dnl PKG_INSTALLDIR
9907591dea4Smrg
9917591dea4Smrg
9927591dea4Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
9937591dea4Smrgdnl --------------------------------
9947591dea4Smrgdnl Since: 0.27
9957591dea4Smrgdnl
9967591dea4Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
9977591dea4Smrgdnl module should install arch-independent pkg-config .pc files. By
9987591dea4Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
9997591dea4Smrgdnl changed by passing DIRECTORY. The user can override through the
10007591dea4Smrgdnl --with-noarch-pkgconfigdir parameter.
10017591dea4SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
10027591dea4Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
10037591dea4Smrgm4_pushdef([pkg_description],
10047591dea4Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
10057591dea4SmrgAC_ARG_WITH([noarch-pkgconfigdir],
10067591dea4Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
10077591dea4Smrg    [with_noarch_pkgconfigdir=]pkg_default)
10087591dea4SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
10097591dea4Smrgm4_popdef([pkg_default])
10107591dea4Smrgm4_popdef([pkg_description])
10117591dea4Smrg])dnl PKG_NOARCH_INSTALLDIR
10127591dea4Smrg
10137591dea4Smrg
10147591dea4Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
10157591dea4Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10167591dea4Smrgdnl -------------------------------------------
10177591dea4Smrgdnl Since: 0.28
10187591dea4Smrgdnl
10197591dea4Smrgdnl Retrieves the value of the pkg-config variable for the given module.
10207591dea4SmrgAC_DEFUN([PKG_CHECK_VAR],
10217591dea4Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
10227591dea4SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
10237591dea4Smrg
10247591dea4Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
10257591dea4SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
10267591dea4Smrg
10277591dea4SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
10287591dea4Smrg])dnl PKG_CHECK_VAR
10297591dea4Smrg
10307591dea4Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
10317591dea4Smrgdnl
10327591dea4Smrgdnl This file comes from X.Org's font-util 1.4.0
10337591dea4Smrgdnl
10347591dea4Smrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
10353a67387eSmrgdnl
10363a67387eSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
10373a67387eSmrgdnl copy of this software and associated documentation files (the "Software"),
10383a67387eSmrgdnl to deal in the Software without restriction, including without limitation
10393a67387eSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
10403a67387eSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
10413a67387eSmrgdnl Software is furnished to do so, subject to the following conditions:
10423a67387eSmrgdnl
10433a67387eSmrgdnl The above copyright notice and this permission notice (including the next
10443a67387eSmrgdnl paragraph) shall be included in all copies or substantial portions of the
10453a67387eSmrgdnl Software.
10463a67387eSmrgdnl
10473a67387eSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10483a67387eSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10493a67387eSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
10503a67387eSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10513a67387eSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
10523a67387eSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
10533a67387eSmrgdnl DEALINGS IN THE SOFTWARE.
10547591dea4Smrgdnl
10557591dea4Smrgdnl --------------------------------------------------------------------
10567591dea4Smrgdnl
10577591dea4Smrgdnl Copyright 2005 Red Hat, Inc
10587591dea4Smrgdnl
10597591dea4Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
10607591dea4Smrgdnl documentation for any purpose is hereby granted without fee, provided that
10617591dea4Smrgdnl the above copyright notice appear in all copies and that both that
10627591dea4Smrgdnl copyright notice and this permission notice appear in supporting
10637591dea4Smrgdnl documentation.
10647591dea4Smrgdnl
10657591dea4Smrgdnl The above copyright notice and this permission notice shall be included
10667591dea4Smrgdnl in all copies or substantial portions of the Software.
10677591dea4Smrgdnl
10687591dea4Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10697591dea4Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10707591dea4Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
10717591dea4Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
10727591dea4Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
10737591dea4Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
10747591dea4Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
10757591dea4Smrgdnl
10767591dea4Smrgdnl Except as contained in this notice, the name of the copyright holders shall
10777591dea4Smrgdnl not be used in advertising or otherwise to promote the sale, use or
10787591dea4Smrgdnl other dealings in this Software without prior written authorization
10797591dea4Smrgdnl from the copyright holders.
1080ef7198c0Smrg
10817591dea4Smrg# XORG_FONT_MACROS_VERSION(required-version)
10827591dea4Smrg# ------------------------------------------
10833a67387eSmrg# Minimum version: 1.1.0
1084ef7198c0Smrg#
10853a67387eSmrg# If you're using a macro added in Version 1.1 or newer, include this in
10863a67387eSmrg# your configure.ac with the minimum required version, such as:
10877591dea4Smrg# XORG_FONT_MACROS_VERSION(1.1)
10883a67387eSmrg#
10893a67387eSmrg# To ensure that this macro is defined, also add:
10907591dea4Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
10917591dea4Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
10923a67387eSmrg#
10933a67387eSmrg#
10947591dea4Smrg# See the "minimum version" comment for each macro you use to see what
10953a67387eSmrg# version you require.
10967591dea4Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
10977591dea4Smrgm4_define([vers_have], [1.4.0])
10983a67387eSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
10993a67387eSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
11003a67387eSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
11017591dea4Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
11023a67387eSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
11037591dea4Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
11043a67387eSmrgm4_undefine([vers_have])
11053a67387eSmrgm4_undefine([maj_have])
11063a67387eSmrgm4_undefine([maj_needed])
11077591dea4Smrg]) # XORG_FONT_MACROS_VERSION
1108ef7198c0Smrg
11097591dea4Smrg# XORG_FONT_CHECK_{maps}()
11107591dea4Smrg# ------------------------
11113a67387eSmrg# Minimum version: 1.0.0
11127591dea4Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
11137591dea4Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
1114ef7198c0Smrg
11157591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
11167591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
11177591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
11187591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
11197591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
11207591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
11217591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
11227591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
11237591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
11247591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
11257591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
11267591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
11277591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
11287591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
11297591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
11307591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
11317591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
11327591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
1133ef7198c0Smrg
11347591dea4Smrg# XORG_FONT_CHECK_ENCODING(encoding)
11357591dea4Smrg# ----------------------------------
11367591dea4Smrg# Minimum version: 1.1.0
11377591dea4Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
11387591dea4Smrg# It replaced individual copies of this code in the above macros in 1.1.
11397591dea4Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
11407591dea4Smrg# calls if this is not true in the future.
1141ef7198c0Smrg
11427591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
11437591dea4Smrg	AC_ARG_ENABLE(m4_tolower($1),
11447591dea4Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
11457591dea4Smrg				[Build $1 fonts (default: yes)]),
11467591dea4Smrg		[AS_TR_SH($1)=$enableval])
11477591dea4Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
11487591dea4Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
11497591dea4Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
11507591dea4Smrg]) # XORG_FONT_CHECK_ENCODING
1151ef7198c0Smrg
11527591dea4Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
11537591dea4Smrg# -----------------------------------------------------
11547591dea4Smrg# Minimum version: 1.1.0
11557591dea4Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
11567591dea4Smrg# Add a shorthand --enable/disable-all-encodings option.
1157ef7198c0Smrg
11587591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
11597591dea4Smrg	AC_ARG_ENABLE([all-encodings],
11607591dea4Smrg		AS_HELP_STRING([--disable-all-encodings],
11617591dea4Smrg				[Disable building of all font encodings]),
11627591dea4Smrg		[m4_foreach_w([enc], [$1], [
11637591dea4Smrg			AS_TR_SH(enc)=$enableval
11647591dea4Smrg		])],
11657591dea4Smrg		[m4_foreach_w([enc], [$1], [
11667591dea4Smrg			AS_TR_SH(enc)=yes
11677591dea4Smrg		])])
11687591dea4Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
11697591dea4Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
1170ef7198c0Smrg
11717591dea4Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
11727591dea4Smrg# ------------------------------------------
11737591dea4Smrg# Minimum version: 1.1.0
11747591dea4Smrg#
11757591dea4Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
11767591dea4Smrg#
1177ef7198c0Smrg
11787591dea4SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
11797591dea4Smrg	AC_PATH_PROG($1, $2)
11807591dea4Smrg	if test x"$$1" = x; then
11817591dea4Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
11827591dea4Smrg	fi
11837591dea4Smrg])
1184ef7198c0Smrg
1185ef7198c0Smrg
11867591dea4Smrg# XORG_FONT_FCCACHE()
11877591dea4Smrg# -------------------
11887591dea4Smrg# Minimum version: 1.1.0
11897591dea4Smrg#
11907591dea4Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
11917591dea4Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
11927591dea4Smrg# to run fc-cache if found and not installing to $DESTDIR and not
11937591dea4Smrg# cross-compiling
11947591dea4Smrg#
11957591dea4Smrg# fc-cache is optional, not required, and should be skipped when making
11967591dea4Smrg# packages (installing to $DESTDIR) or cross-compiling
11977591dea4Smrg#
11987591dea4SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
11997591dea4Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
12007591dea4Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
12017591dea4Smrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
12027591dea4Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
12037591dea4Smrg	else
12047591dea4Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
12057591dea4Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
12067591dea4Smrg	fi
12077591dea4Smrg	AC_SUBST([RUN_FCCACHE])
12087591dea4Smrg])
1209ef7198c0Smrg
12107591dea4Smrg# XORG_FONT_MKFONTDIR()
12117591dea4Smrg# -------------------
12127591dea4Smrg# Minimum version: 1.3.0
12137591dea4Smrg#
12147591dea4Smrg# Set MKFONTDIR to path to mkfontdir.
12157591dea4Smrg#
12167591dea4Smrg# If cross-compiling, and if mkdir is not found, use a shell command
12177591dea4Smrg# which warns mkfontdir needs to be run on the target
12187591dea4Smrg#
12197591dea4Smrg# If not cross-compiling, mkfontdir must be found
12207591dea4Smrg#
12217591dea4SmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
12227591dea4Smrg	if test x"$cross_compiling" != x"no" ; then
12237591dea4Smrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
12247591dea4Smrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
1225ef7198c0Smrg
12267591dea4Smrg		if test x"$MKFONTDIR" = x; then
12277591dea4Smrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
12287591dea4Smrg		fi
12297591dea4Smrg	else
12307591dea4Smrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
12317591dea4Smrg	fi
1232ef7198c0Smrg
12337591dea4Smrg	AC_SUBST([MKFONTDIR])
12347591dea4Smrg])
1235ef7198c0Smrg
12367591dea4Smrg# XORG_FONT_COMMON_UTILS()
12377591dea4Smrg# ------------------------
12387591dea4Smrg# Minimum version: 1.1.0
12397591dea4Smrg#
12407591dea4Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
1241ef7198c0Smrg
12427591dea4SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
12437591dea4Smrg	XORG_FONT_FCCACHE
12447591dea4Smrg	XORG_FONT_MKFONTDIR
12457591dea4Smrg])
1246ef7198c0Smrg
12477591dea4Smrg# XORG_FONT_SCALED_UTILS()
12483a67387eSmrg# ------------------------
12497591dea4Smrg# Minimum version: 1.1.0
12503a67387eSmrg#
12517591dea4Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
12527591dea4Smrg# (TrueType, OpenType, Type1)
12533a67387eSmrg
12547591dea4SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
12557591dea4Smrg	XORG_FONT_COMMON_UTILS
12567591dea4Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
12577591dea4Smrg])
12583a67387eSmrg
12597591dea4Smrg# XORG_FONT_BDF_UTILS()
12607591dea4Smrg# ---------------------
12617591dea4Smrg# Minimum version: 1.1.0
1262ef7198c0Smrg#
12637591dea4Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
12647591dea4Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
12657591dea4Smrg# PCF output files created by bdftopcf
1266ef7198c0Smrg
12677591dea4SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
12687591dea4Smrg	XORG_FONT_COMMON_UTILS
12697591dea4Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
12707591dea4Smrg	XORG_FONT_CHECK_COMPRESSION
12717591dea4Smrg])
1272ef7198c0Smrg
12737591dea4Smrg# XORG_FONT_CHECK_COMPRESSION()
12747591dea4Smrg# -----------------------------
12757591dea4Smrg# Minimum version: 1.1.0
12767591dea4Smrg#
12777591dea4Smrg# Offer a --with-compression flag to control what compression method is
12787591dea4Smrg# used for pcf font files.   Offers all the methods currently supported
12797591dea4Smrg# by libXfont, including no compression.
12807591dea4Smrg#
12817591dea4Smrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
12827591dea4Smrg# for reproducible builds, such as gzip -n to not record timestamp, will
12837591dea4Smrg# set COMPRESS_FLAGS to those options.
1284ef7198c0Smrg
12857591dea4SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
12867591dea4Smrg	AC_MSG_CHECKING([font compression method])
12877591dea4Smrg	AC_ARG_WITH(compression,
12887591dea4Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
12897591dea4Smrg			 [compression method to use on pcf fonts])],
12907591dea4Smrg         [compression="$withval"], [compression="yes"])
12917591dea4Smrg	if test x"$compression" = "xyes" ; then
12927591dea4Smrg		compression="gzip"
12937591dea4Smrg	fi
12947591dea4Smrg	AC_MSG_RESULT([${compression}])
12957591dea4Smrg	case ${compression} in
12967591dea4Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
12977591dea4Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
12987591dea4Smrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
12997591dea4Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
13007591dea4Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
13017591dea4Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
13027591dea4Smrg	esac
13037591dea4Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
13047591dea4Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
13057591dea4Smrg	fi
13067591dea4Smrg	AC_MSG_CHECKING([options to font compression command])
13077591dea4Smrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
13087591dea4Smrg	AC_SUBST([COMPRESS_FLAGS])
13097591dea4Smrg	AC_SUBST([COMPRESS_SUFFIX])
13107591dea4Smrg])
1311ef7198c0Smrg
13127591dea4Smrg# XORG_FONT_UCS2ANY()
13137591dea4Smrg# -------------------
13147591dea4Smrg# Minimum version: 1.1.0
13157591dea4Smrg#
13167591dea4Smrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
13177591dea4Smrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
13187591dea4Smrg# Also call pkg-config to find the directory with the encoding files needed
13197591dea4Smrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
1320ef7198c0Smrg
13217591dea4SmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
13227591dea4Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
13237591dea4Smrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
13247591dea4Smrg	PKG_CHECK_MODULES(MAPS, [fontutil])
13257591dea4Smrg	AC_MSG_CHECKING([for ucs2any encoding data files])
13267591dea4Smrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
13277591dea4Smrg	AC_SUBST(MAPFILES_PATH)
13287591dea4Smrg	AC_MSG_RESULT([${MAPFILES_PATH}])
13297591dea4Smrg])
1330ef7198c0Smrg
1331ef7198c0Smrg
1332ef7198c0Smrg
13337591dea4Smrg# XORG_FONT_FC_CONFDIR()
13347591dea4Smrg# --------------------
13357591dea4Smrg# Minimum version: 1.2.0
13367591dea4Smrg#
13377591dea4Smrg# Sets FC_CONFDIR to the fontconfig config directory
13387591dea4Smrg# (which should be --with-confdir=... when building fontconfig)
13397591dea4Smrg# found from:
13407591dea4Smrg#	--with-fc-confdir=...
13417591dea4Smrg#	pkg-config --variable=confdir fontconfig
13427591dea4Smrg#	${sysconfdir}/fonts
1343ef7198c0Smrg
13447591dea4SmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
13457591dea4Smrg	dnl Ensure $PKG_CONFIG is set first
13467591dea4Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1347ef7198c0Smrg
13487591dea4Smrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
13497591dea4Smrg	AC_ARG_WITH(fc-confdir,
13507591dea4Smrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
13517591dea4Smrg			   [Path to fontconfig's configuration directory]),
13527591dea4Smrg		    [FC_CONFDIR="$withval"])
13537591dea4Smrg	# if --with-fc-confdir was not specified
13547591dea4Smrg	if test "x${FC_CONFDIR}" = "x"; then
13557591dea4Smrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
13567591dea4Smrg	fi
13577591dea4Smrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
13587591dea4Smrg	if test "x${FC_CONFDIR}" = "x"; then
13597591dea4Smrg		FC_CONFDIR="${sysconfdir}/fonts"
13607591dea4Smrg	fi
13617591dea4Smrg	AC_SUBST(FC_CONFDIR)
13627591dea4Smrg	AC_MSG_RESULT([${FC_CONFDIR}])
13637591dea4Smrg])
1364ef7198c0Smrg
1365ef7198c0Smrg
1366ef7198c0Smrg
13677591dea4Smrg# XORG_FONTROOTDIR()
13687591dea4Smrg# --------------------
13697591dea4Smrg# Minimum version: 1.1.0
13707591dea4Smrg#
13717591dea4Smrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
13727591dea4Smrg# found from:
13737591dea4Smrg#	--with-fontrootdir
13747591dea4Smrg#	pkg-config --variable=fontrootdir fontutil
13757591dea4Smrg#	${datadir}/fonts/X11
1376ef7198c0Smrg
13777591dea4SmrgAC_DEFUN([XORG_FONTROOTDIR],[
13787591dea4Smrg	dnl Ensure $PKG_CONFIG is set first
13797591dea4Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1380ef7198c0Smrg
13817591dea4Smrg	AC_MSG_CHECKING([for root directory for font files])
13827591dea4Smrg	AC_ARG_WITH(fontrootdir,
13837591dea4Smrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
13847591dea4Smrg			   [Path to root directory for font files]),
13857591dea4Smrg		    [FONTROOTDIR="$withval"])
13867591dea4Smrg	# if --with-fontrootdir not specified...
13877591dea4Smrg	if test "x${FONTROOTDIR}" = "x"; then
13887591dea4Smrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
13897591dea4Smrg	fi
13907591dea4Smrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
13917591dea4Smrg	if test "x${FONTROOTDIR}" = "x"; then
13927591dea4Smrg		FONTROOTDIR="${datadir}/fonts/X11"
13937591dea4Smrg	fi
13947591dea4Smrg	AC_SUBST(FONTROOTDIR)
13957591dea4Smrg	AC_MSG_RESULT([${FONTROOTDIR}])
13967591dea4Smrg])
1397ef7198c0Smrg
13987591dea4Smrg# XORG_FONTSUBDIR(variable, flag, subdir)
13997591dea4Smrg# ---------------------------------------
14007591dea4Smrg# Minimum version: 1.1.0
14017591dea4Smrg#
14027591dea4Smrg# Offer a --with-<flag> flag to control directory for font installation
14037591dea4Smrg# Default is the specified <subdir> of the font root directory.
14047591dea4Smrg# Sets <variable> to the selected directory
1405ef7198c0Smrg
14067591dea4SmrgAC_DEFUN([XORG_FONTSUBDIR],[
14077591dea4Smrg	AC_REQUIRE([XORG_FONTROOTDIR])
1408ef7198c0Smrg
14097591dea4Smrg	AC_MSG_CHECKING([for directory for $3 files])
14107591dea4Smrg	AC_ARG_WITH($2,
14117591dea4Smrg		    [AS_HELP_STRING([--with-$2=DIR],
14127591dea4Smrg				    [Path to $3 files [FONTROOTDIR/$3]])],
14137591dea4Smrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
14147591dea4Smrg	AC_SUBST($1)
14157591dea4Smrg	AC_MSG_RESULT([${$1}])
14167591dea4Smrg]) # XORG_FONTSUBDIR
14173a67387eSmrg
14187591dea4Smrg# XORG_FONTDIR(subdir)
14197591dea4Smrg# --------------------
14207591dea4Smrg# Minimum version: 1.1.0
14217591dea4Smrg#
14227591dea4Smrg# Offer a --with-fontdir flag to control directory for font installation
14237591dea4Smrg# Default is the specified subdir of the font root directory.
14247591dea4Smrg# Sets FONTDIR to the selected directory
1425ef7198c0Smrg
14267591dea4SmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
1427ef7198c0Smrg
14287591dea4Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14297591dea4Smrgdnl
14307591dea4Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
14317591dea4Smrgdnl
14327591dea4Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14337591dea4Smrgdnl copy of this software and associated documentation files (the "Software"),
14347591dea4Smrgdnl to deal in the Software without restriction, including without limitation
14357591dea4Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14367591dea4Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
14377591dea4Smrgdnl Software is furnished to do so, subject to the following conditions:
14387591dea4Smrgdnl
14397591dea4Smrgdnl The above copyright notice and this permission notice (including the next
14407591dea4Smrgdnl paragraph) shall be included in all copies or substantial portions of the
14417591dea4Smrgdnl Software.
14427591dea4Smrgdnl
14437591dea4Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14447591dea4Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14457591dea4Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14467591dea4Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14477591dea4Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14487591dea4Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14497591dea4Smrgdnl DEALINGS IN THE SOFTWARE.
14507591dea4Smrg
14517591dea4Smrg# XORG_MACROS_VERSION(required-version)
14527591dea4Smrg# -------------------------------------
14537591dea4Smrg# Minimum version: 1.1.0
14543a67387eSmrg#
14557591dea4Smrg# If you're using a macro added in Version 1.1 or newer, include this in
14567591dea4Smrg# your configure.ac with the minimum required version, such as:
14577591dea4Smrg# XORG_MACROS_VERSION(1.1)
14583a67387eSmrg#
14597591dea4Smrg# To ensure that this macro is defined, also add:
14607591dea4Smrg# m4_ifndef([XORG_MACROS_VERSION],
14617591dea4Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14623a67387eSmrg#
14633a67387eSmrg#
14647591dea4Smrg# See the "minimum version" comment for each macro you use to see what
14657591dea4Smrg# version you require.
14667591dea4Smrgm4_defun([XORG_MACROS_VERSION],[
14677591dea4Smrgm4_define([vers_have], [1.20.0])
14687591dea4Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14697591dea4Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14707591dea4Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14717591dea4Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14727591dea4Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14737591dea4Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14747591dea4Smrgm4_undefine([vers_have])
14757591dea4Smrgm4_undefine([maj_have])
14767591dea4Smrgm4_undefine([maj_needed])
14777591dea4Smrg]) # XORG_MACROS_VERSION
14783a67387eSmrg
14797591dea4Smrg# XORG_PROG_RAWCPP()
14807591dea4Smrg# ------------------
14817591dea4Smrg# Minimum version: 1.0.0
14827591dea4Smrg#
14837591dea4Smrg# Find cpp program and necessary flags for use in pre-processing text files
14847591dea4Smrg# such as man pages and config files
14857591dea4SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14867591dea4SmrgAC_REQUIRE([AC_PROG_CPP])
14877591dea4SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14887591dea4Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14897591dea4Smrg
14907591dea4Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14917591dea4Smrg# which is not the best choice for supporting other OS'es, but covers most
14927591dea4Smrg# of the ones we need for now.
14937591dea4SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14947591dea4SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14957591dea4Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14967591dea4Smrg	AC_MSG_RESULT([no])
14973a67387eSmrgelse
14987591dea4Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14997591dea4Smrg		RAWCPPFLAGS=-undef
15007591dea4Smrg		AC_MSG_RESULT([yes])
15017591dea4Smrg	# under Cygwin unix is still defined even with -undef
15027591dea4Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15037591dea4Smrg		RAWCPPFLAGS="-undef -ansi"
15047591dea4Smrg		AC_MSG_RESULT([yes, with -ansi])
15057591dea4Smrg	else
15067591dea4Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15077591dea4Smrg	fi
1508ef7198c0Smrgfi
15097591dea4Smrgrm -f conftest.$ac_ext
1510ef7198c0Smrg
15117591dea4SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15127591dea4SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15137591dea4Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15147591dea4Smrg	AC_MSG_RESULT([no])
15153a67387eSmrgelse
15167591dea4Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15177591dea4Smrg		TRADITIONALCPPFLAGS="-traditional"
15187591dea4Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15197591dea4Smrg		AC_MSG_RESULT([yes])
15207591dea4Smrg	else
15217591dea4Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15227591dea4Smrg	fi
15233a67387eSmrgfi
15247591dea4Smrgrm -f conftest.$ac_ext
15257591dea4SmrgAC_SUBST(RAWCPPFLAGS)
15267591dea4SmrgAC_SUBST(TRADITIONALCPPFLAGS)
15277591dea4Smrg]) # XORG_PROG_RAWCPP
15283a67387eSmrg
15297591dea4Smrg# XORG_MANPAGE_SECTIONS()
15307591dea4Smrg# -----------------------
15317591dea4Smrg# Minimum version: 1.0.0
15323a67387eSmrg#
15337591dea4Smrg# Determine which sections man pages go in for the different man page types
15347591dea4Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15357591dea4Smrg# Not sure if there's any better way than just hardcoding by OS name.
15367591dea4Smrg# Override default settings by setting environment variables
15377591dea4Smrg# Added MAN_SUBSTS in version 1.8
15387591dea4Smrg# Added AC_PROG_SED in version 1.8
15393a67387eSmrg
15407591dea4SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15417591dea4SmrgAC_REQUIRE([AC_CANONICAL_HOST])
15427591dea4SmrgAC_REQUIRE([AC_PROG_SED])
1543ef7198c0Smrg
15447591dea4Smrgcase $host_os in
15457591dea4Smrg    solaris*)
15467591dea4Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15477591dea4Smrg        # check for a man page file found in later versions that use
15487591dea4Smrg        # traditional section numbers instead
15497591dea4Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15507591dea4Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15517591dea4Smrg        ;;
15527591dea4Smrg    *) SYSV_MAN_SECTIONS=false ;;
15537591dea4Smrgesac
15543a67387eSmrg
15557591dea4Smrgif test x$APP_MAN_SUFFIX = x    ; then
15567591dea4Smrg    APP_MAN_SUFFIX=1
15577591dea4Smrgfi
15587591dea4Smrgif test x$APP_MAN_DIR = x    ; then
15597591dea4Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15603a67387eSmrgfi
1561ef7198c0Smrg
15627591dea4Smrgif test x$LIB_MAN_SUFFIX = x    ; then
15637591dea4Smrg    LIB_MAN_SUFFIX=3
15647591dea4Smrgfi
15657591dea4Smrgif test x$LIB_MAN_DIR = x    ; then
15667591dea4Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15673a67387eSmrgfi
1568ef7198c0Smrg
15697591dea4Smrgif test x$FILE_MAN_SUFFIX = x    ; then
15707591dea4Smrg    case $SYSV_MAN_SECTIONS in
15717591dea4Smrg	true)				FILE_MAN_SUFFIX=4  ;;
15727591dea4Smrg	*)				FILE_MAN_SUFFIX=5  ;;
15737591dea4Smrg    esac
15747591dea4Smrgfi
15757591dea4Smrgif test x$FILE_MAN_DIR = x    ; then
15767591dea4Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15773a67387eSmrgfi
1578ef7198c0Smrg
15797591dea4Smrgif test x$MISC_MAN_SUFFIX = x    ; then
15807591dea4Smrg    case $SYSV_MAN_SECTIONS in
15817591dea4Smrg	true)				MISC_MAN_SUFFIX=5  ;;
15827591dea4Smrg	*)				MISC_MAN_SUFFIX=7  ;;
15837591dea4Smrg    esac
15847591dea4Smrgfi
15857591dea4Smrgif test x$MISC_MAN_DIR = x    ; then
15867591dea4Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15877591dea4Smrgfi
1588ef7198c0Smrg
15897591dea4Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15907591dea4Smrg    case $SYSV_MAN_SECTIONS in
15917591dea4Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
15927591dea4Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
15937591dea4Smrg    esac
15947591dea4Smrgfi
15957591dea4Smrgif test x$DRIVER_MAN_DIR = x    ; then
15967591dea4Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15977591dea4Smrgfi
15983a67387eSmrg
15997591dea4Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
16007591dea4Smrg    case $SYSV_MAN_SECTIONS in
16017591dea4Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16027591dea4Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16037591dea4Smrg    esac
16047591dea4Smrgfi
16057591dea4Smrgif test x$ADMIN_MAN_DIR = x    ; then
16067591dea4Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16073a67387eSmrgfi
1608ef7198c0Smrg
16093a67387eSmrg
16107591dea4SmrgAC_SUBST([APP_MAN_SUFFIX])
16117591dea4SmrgAC_SUBST([LIB_MAN_SUFFIX])
16127591dea4SmrgAC_SUBST([FILE_MAN_SUFFIX])
16137591dea4SmrgAC_SUBST([MISC_MAN_SUFFIX])
16147591dea4SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16157591dea4SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16167591dea4SmrgAC_SUBST([APP_MAN_DIR])
16177591dea4SmrgAC_SUBST([LIB_MAN_DIR])
16187591dea4SmrgAC_SUBST([FILE_MAN_DIR])
16197591dea4SmrgAC_SUBST([MISC_MAN_DIR])
16207591dea4SmrgAC_SUBST([DRIVER_MAN_DIR])
16217591dea4SmrgAC_SUBST([ADMIN_MAN_DIR])
1622ef7198c0Smrg
16237591dea4SmrgXORG_MAN_PAGE="X Version 11"
16247591dea4SmrgAC_SUBST([XORG_MAN_PAGE])
16257591dea4SmrgMAN_SUBSTS="\
16267591dea4Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16277591dea4Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16287591dea4Smrg	-e 's|__xservername__|Xorg|g' \
16297591dea4Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
16307591dea4Smrg	-e 's|__projectroot__|\$(prefix)|g' \
16317591dea4Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16327591dea4Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16337591dea4Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16347591dea4Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16357591dea4Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16367591dea4Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16377591dea4Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16387591dea4SmrgAC_SUBST([MAN_SUBSTS])
16393a67387eSmrg
16407591dea4Smrg]) # XORG_MANPAGE_SECTIONS
16413a67387eSmrg
16427591dea4Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16437591dea4Smrg# ------------------------
16447591dea4Smrg# Minimum version: 1.7.0
16453a67387eSmrg#
16467591dea4Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16477591dea4Smrg# provided by xorg-sgml-doctools, if installed.
16487591dea4SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16497591dea4SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16507591dea4SmrgXORG_SGML_PATH=
16517591dea4SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16527591dea4Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16537591dea4Smrg    [m4_ifval([$1],[:],
16547591dea4Smrg        [if test x"$cross_compiling" != x"yes" ; then
16557591dea4Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16567591dea4Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16577591dea4Smrg         fi])
16587591dea4Smrg    ])
16597591dea4Smrg
16607591dea4Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16617591dea4Smrg# the path and the name of the doc stylesheet
16627591dea4Smrgif test "x$XORG_SGML_PATH" != "x" ; then
16637591dea4Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16647591dea4Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16657591dea4Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16667591dea4Smrgelse
16677591dea4Smrg   AC_MSG_RESULT([no])
16687591dea4Smrgfi
16697591dea4Smrg
16707591dea4SmrgAC_SUBST(XORG_SGML_PATH)
16717591dea4SmrgAC_SUBST(STYLESHEET_SRCDIR)
16727591dea4SmrgAC_SUBST(XSL_STYLESHEET)
16737591dea4SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16747591dea4Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1675ef7198c0Smrg
16767591dea4Smrg# XORG_CHECK_LINUXDOC
16777591dea4Smrg# -------------------
16783a67387eSmrg# Minimum version: 1.0.0
16793a67387eSmrg#
16807591dea4Smrg# Defines the variable MAKE_TEXT if the necessary tools and
16817591dea4Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16827591dea4Smrg# Whether or not the necessary tools and files are found can be checked
16837591dea4Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16847591dea4SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16857591dea4SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16867591dea4SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1687ef7198c0Smrg
16887591dea4SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16897591dea4Smrg
16907591dea4SmrgAC_MSG_CHECKING([whether to build documentation])
16917591dea4Smrg
16927591dea4Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16937591dea4Smrg   BUILDDOC=yes
16947591dea4Smrgelse
16957591dea4Smrg   BUILDDOC=no
16963a67387eSmrgfi
1697ef7198c0Smrg
16987591dea4SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16997591dea4Smrg
17007591dea4SmrgAC_MSG_RESULT([$BUILDDOC])
17017591dea4Smrg
17027591dea4SmrgAC_MSG_CHECKING([whether to build pdf documentation])
17037591dea4Smrg
17047591dea4Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17057591dea4Smrg   BUILDPDFDOC=yes
17063a67387eSmrgelse
17077591dea4Smrg   BUILDPDFDOC=no
17083a67387eSmrgfi
17093a67387eSmrg
17107591dea4SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1711ef7198c0Smrg
17127591dea4SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17137591dea4Smrg
17147591dea4SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17157591dea4SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17167591dea4SmrgMAKE_PDF="$PS2PDF"
17177591dea4SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17187591dea4Smrg
17197591dea4SmrgAC_SUBST(MAKE_TEXT)
17207591dea4SmrgAC_SUBST(MAKE_PS)
17217591dea4SmrgAC_SUBST(MAKE_PDF)
17227591dea4SmrgAC_SUBST(MAKE_HTML)
17237591dea4Smrg]) # XORG_CHECK_LINUXDOC
17247591dea4Smrg
17257591dea4Smrg# XORG_CHECK_DOCBOOK
17267591dea4Smrg# -------------------
17277591dea4Smrg# Minimum version: 1.0.0
17287591dea4Smrg#
17297591dea4Smrg# Checks for the ability to build output formats from SGML DocBook source.
17307591dea4Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17317591dea4Smrg# indicates whether the necessary tools and files are found and, if set,
17327591dea4Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17337591dea4SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17347591dea4SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17357591dea4Smrg
17367591dea4SmrgBUILDTXTDOC=no
17377591dea4SmrgBUILDPDFDOC=no
17387591dea4SmrgBUILDPSDOC=no
17397591dea4SmrgBUILDHTMLDOC=no
17407591dea4Smrg
17417591dea4SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17427591dea4SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17437591dea4SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17447591dea4SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17457591dea4Smrg
17467591dea4SmrgAC_MSG_CHECKING([whether to build text documentation])
17477591dea4Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17487591dea4Smrg   test x$BUILD_TXTDOC != xno; then
17497591dea4Smrg	BUILDTXTDOC=yes
17507591dea4Smrgfi
17517591dea4SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17527591dea4SmrgAC_MSG_RESULT([$BUILDTXTDOC])
17537591dea4Smrg
17547591dea4SmrgAC_MSG_CHECKING([whether to build PDF documentation])
17557591dea4Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17567591dea4Smrg   test x$BUILD_PDFDOC != xno; then
17577591dea4Smrg	BUILDPDFDOC=yes
17587591dea4Smrgfi
17597591dea4SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17607591dea4SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17617591dea4Smrg
17627591dea4SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17637591dea4Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17647591dea4Smrg   test x$BUILD_PSDOC != xno; then
17657591dea4Smrg	BUILDPSDOC=yes
17667591dea4Smrgfi
17677591dea4SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17687591dea4SmrgAC_MSG_RESULT([$BUILDPSDOC])
17697591dea4Smrg
17707591dea4SmrgAC_MSG_CHECKING([whether to build HTML documentation])
17717591dea4Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17727591dea4Smrg   test x$BUILD_HTMLDOC != xno; then
17737591dea4Smrg	BUILDHTMLDOC=yes
17747591dea4Smrgfi
17757591dea4SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17767591dea4SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17777591dea4Smrg
17787591dea4SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17797591dea4SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17807591dea4SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17817591dea4SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17827591dea4Smrg
17837591dea4SmrgAC_SUBST(MAKE_TEXT)
17847591dea4SmrgAC_SUBST(MAKE_PS)
17857591dea4SmrgAC_SUBST(MAKE_PDF)
17867591dea4SmrgAC_SUBST(MAKE_HTML)
17877591dea4Smrg]) # XORG_CHECK_DOCBOOK
17887591dea4Smrg
17897591dea4Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17903a67387eSmrg# ----------------
17917591dea4Smrg# Minimum version: 1.5.0
17927591dea4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1793ef7198c0Smrg#
17947591dea4Smrg# Documentation tools are not always available on all platforms and sometimes
17957591dea4Smrg# not at the appropriate level. This macro enables a module to test for the
17967591dea4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
17977591dea4Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
17987591dea4Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17997591dea4Smrg# --with-xmlto assumes 'auto'.
1800ef7198c0Smrg#
18013a67387eSmrg# Interface to module:
18027591dea4Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18037591dea4Smrg# XMLTO:	returns the path of the xmlto program found
18047591dea4Smrg#		returns the path set by the user in the environment
18057591dea4Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18067591dea4Smrg#		'no' user instructs the module not to use xmlto
1807ef7198c0Smrg#
18087591dea4Smrg# Added in version 1.10.0
18097591dea4Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18107591dea4Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1811ef7198c0Smrg#
18127591dea4Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
18133a67387eSmrg#
18147591dea4SmrgAC_DEFUN([XORG_WITH_XMLTO],[
18157591dea4SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18167591dea4Smrgm4_define([_defopt], m4_default([$2], [auto]))
18177591dea4SmrgAC_ARG_WITH(xmlto,
18187591dea4Smrg	AS_HELP_STRING([--with-xmlto],
18197591dea4Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18207591dea4Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18217591dea4Smrgm4_undefine([_defopt])
1822ef7198c0Smrg
18237591dea4Smrgif test "x$use_xmlto" = x"auto"; then
18247591dea4Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18257591dea4Smrg   if test "x$XMLTO" = "x"; then
18267591dea4Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18277591dea4Smrg	have_xmlto=no
18287591dea4Smrg   else
18297591dea4Smrg        have_xmlto=yes
18303a67387eSmrg   fi
18317591dea4Smrgelif test "x$use_xmlto" = x"yes" ; then
18327591dea4Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18337591dea4Smrg   if test "x$XMLTO" = "x"; then
18347591dea4Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18353a67387eSmrg   fi
18367591dea4Smrg   have_xmlto=yes
18377591dea4Smrgelif test "x$use_xmlto" = x"no" ; then
18387591dea4Smrg   if test "x$XMLTO" != "x"; then
18397591dea4Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18407591dea4Smrg   fi
18417591dea4Smrg   have_xmlto=no
18423a67387eSmrgelse
18437591dea4Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18443a67387eSmrgfi
1845ef7198c0Smrg
18467591dea4Smrg# Test for a minimum version of xmlto, if provided.
18477591dea4Smrgm4_ifval([$1],
18487591dea4Smrg[if test "$have_xmlto" = yes; then
18497591dea4Smrg    # scrape the xmlto version
18507591dea4Smrg    AC_MSG_CHECKING([the xmlto version])
18517591dea4Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18527591dea4Smrg    AC_MSG_RESULT([$xmlto_version])
18537591dea4Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18547591dea4Smrg        [if test "x$use_xmlto" = xauto; then
18557591dea4Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18567591dea4Smrg            have_xmlto=no
18577591dea4Smrg        else
18587591dea4Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18597591dea4Smrg        fi])
18607591dea4Smrgfi])
1861ef7198c0Smrg
18627591dea4Smrg# Test for the ability of xmlto to generate a text target
18637591dea4Smrg#
18647591dea4Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18657591dea4Smrg# following test for empty XML docbook files.
18667591dea4Smrg# For compatibility reasons use the following empty XML docbook file and if
18677591dea4Smrg# it fails try it again with a non-empty XML file.
18687591dea4Smrghave_xmlto_text=no
18697591dea4Smrgcat > conftest.xml << "EOF"
18707591dea4SmrgEOF
18717591dea4SmrgAS_IF([test "$have_xmlto" = yes],
18727591dea4Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18737591dea4Smrg             [have_xmlto_text=yes],
18747591dea4Smrg             [# Try it again with a non-empty XML file.
18757591dea4Smrg              cat > conftest.xml << "EOF"
18767591dea4Smrg<x></x>
18777591dea4SmrgEOF
18787591dea4Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18797591dea4Smrg                    [have_xmlto_text=yes],
18807591dea4Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
18817591dea4Smrgrm -f conftest.xml
18827591dea4SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18837591dea4SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18847591dea4Smrg]) # XORG_WITH_XMLTO
1885ef7198c0Smrg
18867591dea4Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18877591dea4Smrg# --------------------------------------------
18887591dea4Smrg# Minimum version: 1.12.0
18897591dea4Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1890ef7198c0Smrg#
18917591dea4Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18927591dea4Smrg# XML-based language used for the transformation of XML documents.
18937591dea4Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18947591dea4Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18957591dea4Smrg# The XSLT processor is often used as a standalone tool for transformations.
18967591dea4Smrg# It should not be assumed that this tool is used only to work with documnetation.
18977591dea4Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1898ef7198c0Smrg#
18993a67387eSmrg# Interface to module:
19007591dea4Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19017591dea4Smrg# XSLTPROC:	 returns the path of the xsltproc program found
19027591dea4Smrg#		 returns the path set by the user in the environment
19037591dea4Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19047591dea4Smrg#		  'no' user instructs the module not to use xsltproc
19057591dea4Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1906ef7198c0Smrg#
19077591dea4Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19087591dea4Smrg#
19097591dea4SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19107591dea4SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19117591dea4Smrg# Preserves the interface, should it be implemented later
19127591dea4Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19137591dea4Smrgm4_define([_defopt], m4_default([$2], [auto]))
19147591dea4SmrgAC_ARG_WITH(xsltproc,
19157591dea4Smrg	AS_HELP_STRING([--with-xsltproc],
19167591dea4Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19177591dea4Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19187591dea4Smrgm4_undefine([_defopt])
191956f6b22bSmrg
19207591dea4Smrgif test "x$use_xsltproc" = x"auto"; then
19217591dea4Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19227591dea4Smrg   if test "x$XSLTPROC" = "x"; then
19237591dea4Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19247591dea4Smrg	have_xsltproc=no
19257591dea4Smrg   else
19267591dea4Smrg        have_xsltproc=yes
19273a67387eSmrg   fi
19287591dea4Smrgelif test "x$use_xsltproc" = x"yes" ; then
19297591dea4Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19307591dea4Smrg   if test "x$XSLTPROC" = "x"; then
19317591dea4Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19327591dea4Smrg   fi
19337591dea4Smrg   have_xsltproc=yes
19347591dea4Smrgelif test "x$use_xsltproc" = x"no" ; then
19357591dea4Smrg   if test "x$XSLTPROC" != "x"; then
19367591dea4Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19377591dea4Smrg   fi
19387591dea4Smrg   have_xsltproc=no
19397591dea4Smrgelse
19407591dea4Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19413a67387eSmrgfi
194256f6b22bSmrg
19437591dea4SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19447591dea4Smrg]) # XORG_WITH_XSLTPROC
194556f6b22bSmrg
19467591dea4Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19477591dea4Smrg# ----------------------------------------
19487591dea4Smrg# Minimum version: 1.15.0
1949ef7198c0Smrg#
19507591dea4Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
19517591dea4Smrg# scanning arbitrary text files, extracting information from those text files,
19527591dea4Smrg# and printing reports based on that information.
1953ef7198c0Smrg#
19547591dea4Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1955ef7198c0Smrg#
19567591dea4Smrg# Interface to module:
19577591dea4Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
19587591dea4Smrg# PERL:	     returns the path of the perl program found
19597591dea4Smrg#	     returns the path set by the user in the environment
19607591dea4Smrg# --with-perl: 'yes' user instructs the module to use perl
19617591dea4Smrg#	       'no' user instructs the module not to use perl
19627591dea4Smrg# have_perl: returns yes if perl found in PATH or no
19637591dea4Smrg#
19647591dea4Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19657591dea4Smrg#
19667591dea4SmrgAC_DEFUN([XORG_WITH_PERL],[
19677591dea4SmrgAC_ARG_VAR([PERL], [Path to perl command])
19687591dea4Smrg# Preserves the interface, should it be implemented later
19697591dea4Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
19707591dea4Smrgm4_define([_defopt], m4_default([$2], [auto]))
19717591dea4SmrgAC_ARG_WITH(perl,
19727591dea4Smrg	AS_HELP_STRING([--with-perl],
19737591dea4Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
19747591dea4Smrg	   [use_perl=$withval], [use_perl=]_defopt)
19757591dea4Smrgm4_undefine([_defopt])
197656f6b22bSmrg
19777591dea4Smrgif test "x$use_perl" = x"auto"; then
19787591dea4Smrg   AC_PATH_PROG([PERL], [perl])
19797591dea4Smrg   if test "x$PERL" = "x"; then
19807591dea4Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19817591dea4Smrg	have_perl=no
19827591dea4Smrg   else
19837591dea4Smrg        have_perl=yes
19847591dea4Smrg   fi
19857591dea4Smrgelif test "x$use_perl" = x"yes" ; then
19867591dea4Smrg   AC_PATH_PROG([PERL], [perl])
19877591dea4Smrg   if test "x$PERL" = "x"; then
19887591dea4Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19897591dea4Smrg   fi
19907591dea4Smrg   have_perl=yes
19917591dea4Smrgelif test "x$use_perl" = x"no" ; then
19927591dea4Smrg   if test "x$PERL" != "x"; then
19937591dea4Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19947591dea4Smrg   fi
19957591dea4Smrg   have_perl=no
19967591dea4Smrgelse
19977591dea4Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19983a67387eSmrgfi
199956f6b22bSmrg
20007591dea4SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20017591dea4Smrg]) # XORG_WITH_PERL
2002ef7198c0Smrg
20037591dea4Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
20043a67387eSmrg# ----------------
20057591dea4Smrg# Minimum version: 1.5.0
20067591dea4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20073a67387eSmrg#
20087591dea4Smrg# Documentation tools are not always available on all platforms and sometimes
20097591dea4Smrg# not at the appropriate level. This macro enables a module to test for the
20107591dea4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20117591dea4Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
20127591dea4Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20137591dea4Smrg# --with-asciidoc assumes 'auto'.
20143a67387eSmrg#
20157591dea4Smrg# Interface to module:
20167591dea4Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20177591dea4Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
20187591dea4Smrg#		 returns the path set by the user in the environment
20197591dea4Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20207591dea4Smrg#		  'no' user instructs the module not to use asciidoc
20217591dea4Smrg#
20227591dea4Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20237591dea4Smrg#
20247591dea4SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20257591dea4SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20267591dea4Smrgm4_define([_defopt], m4_default([$2], [auto]))
20277591dea4SmrgAC_ARG_WITH(asciidoc,
20287591dea4Smrg	AS_HELP_STRING([--with-asciidoc],
20297591dea4Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20307591dea4Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20317591dea4Smrgm4_undefine([_defopt])
2032ef7198c0Smrg
20337591dea4Smrgif test "x$use_asciidoc" = x"auto"; then
20347591dea4Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20357591dea4Smrg   if test "x$ASCIIDOC" = "x"; then
20367591dea4Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20377591dea4Smrg	have_asciidoc=no
20387591dea4Smrg   else
20397591dea4Smrg        have_asciidoc=yes
20407591dea4Smrg   fi
20417591dea4Smrgelif test "x$use_asciidoc" = x"yes" ; then
20427591dea4Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20437591dea4Smrg   if test "x$ASCIIDOC" = "x"; then
20447591dea4Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20457591dea4Smrg   fi
20467591dea4Smrg   have_asciidoc=yes
20477591dea4Smrgelif test "x$use_asciidoc" = x"no" ; then
20487591dea4Smrg   if test "x$ASCIIDOC" != "x"; then
20497591dea4Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20507591dea4Smrg   fi
20517591dea4Smrg   have_asciidoc=no
20527591dea4Smrgelse
20537591dea4Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20547591dea4Smrgfi
20557591dea4Smrgm4_ifval([$1],
20567591dea4Smrg[if test "$have_asciidoc" = yes; then
20577591dea4Smrg    # scrape the asciidoc version
20587591dea4Smrg    AC_MSG_CHECKING([the asciidoc version])
20597591dea4Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20607591dea4Smrg    AC_MSG_RESULT([$asciidoc_version])
20617591dea4Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20627591dea4Smrg        [if test "x$use_asciidoc" = xauto; then
20637591dea4Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20647591dea4Smrg            have_asciidoc=no
20657591dea4Smrg        else
20667591dea4Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20677591dea4Smrg        fi])
20687591dea4Smrgfi])
20697591dea4SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20707591dea4Smrg]) # XORG_WITH_ASCIIDOC
207156f6b22bSmrg
20727591dea4Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20737591dea4Smrg# -------------------------------------------
20747591dea4Smrg# Minimum version: 1.5.0
20757591dea4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20767591dea4Smrg# Minimum version for optional DOT checking: 1.18.0
2077ef7198c0Smrg#
20787591dea4Smrg# Documentation tools are not always available on all platforms and sometimes
20797591dea4Smrg# not at the appropriate level. This macro enables a module to test for the
20807591dea4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20817591dea4Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
20827591dea4Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20837591dea4Smrg# --with-doxygen assumes 'auto'.
20843a67387eSmrg#
20857591dea4Smrg# Interface to module:
20867591dea4Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20877591dea4Smrg# DOXYGEN:	 returns the path of the doxygen program found
20887591dea4Smrg#		 returns the path set by the user in the environment
20897591dea4Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20907591dea4Smrg#		  'no' user instructs the module not to use doxygen
20913a67387eSmrg#
20927591dea4Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20933a67387eSmrg#
20947591dea4SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20957591dea4SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20967591dea4SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20977591dea4Smrgm4_define([_defopt], m4_default([$2], [auto]))
20987591dea4SmrgAC_ARG_WITH(doxygen,
20997591dea4Smrg	AS_HELP_STRING([--with-doxygen],
21007591dea4Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21017591dea4Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21027591dea4Smrgm4_undefine([_defopt])
210356f6b22bSmrg
21047591dea4Smrgif test "x$use_doxygen" = x"auto"; then
21057591dea4Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21067591dea4Smrg   if test "x$DOXYGEN" = "x"; then
21077591dea4Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21087591dea4Smrg	have_doxygen=no
21097591dea4Smrg   else
21107591dea4Smrg        have_doxygen=yes
21117591dea4Smrg   fi
21127591dea4Smrgelif test "x$use_doxygen" = x"yes" ; then
21137591dea4Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21147591dea4Smrg   if test "x$DOXYGEN" = "x"; then
21157591dea4Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21167591dea4Smrg   fi
21177591dea4Smrg   have_doxygen=yes
21187591dea4Smrgelif test "x$use_doxygen" = x"no" ; then
21197591dea4Smrg   if test "x$DOXYGEN" != "x"; then
21207591dea4Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21217591dea4Smrg   fi
21227591dea4Smrg   have_doxygen=no
21237591dea4Smrgelse
21247591dea4Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
21257591dea4Smrgfi
21267591dea4Smrgm4_ifval([$1],
21277591dea4Smrg[if test "$have_doxygen" = yes; then
21287591dea4Smrg    # scrape the doxygen version
21297591dea4Smrg    AC_MSG_CHECKING([the doxygen version])
21307591dea4Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21317591dea4Smrg    AC_MSG_RESULT([$doxygen_version])
21327591dea4Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21337591dea4Smrg        [if test "x$use_doxygen" = xauto; then
21347591dea4Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21357591dea4Smrg            have_doxygen=no
21367591dea4Smrg        else
21377591dea4Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21387591dea4Smrg        fi])
21397591dea4Smrgfi])
214056f6b22bSmrg
21417591dea4Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21427591dea4Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21437591dea4Smrgdnl 	HAVE_DOT = @HAVE_DOT@
21447591dea4SmrgHAVE_DOT=no
21457591dea4Smrgif test "x$have_doxygen" = "xyes"; then
21467591dea4Smrg  AC_PATH_PROG([DOT], [dot])
21477591dea4Smrg    if test "x$DOT" != "x"; then
21487591dea4Smrg      HAVE_DOT=yes
21497591dea4Smrg    fi
21507591dea4Smrgfi
2151ef7198c0Smrg
21527591dea4SmrgAC_SUBST([HAVE_DOT])
21537591dea4SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21547591dea4SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21557591dea4Smrg]) # XORG_WITH_DOXYGEN
21563a67387eSmrg
21577591dea4Smrg# XORG_WITH_GROFF([DEFAULT])
21587591dea4Smrg# ----------------
21597591dea4Smrg# Minimum version: 1.6.0
21607591dea4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2161ef7198c0Smrg#
21627591dea4Smrg# Documentation tools are not always available on all platforms and sometimes
21637591dea4Smrg# not at the appropriate level. This macro enables a module to test for the
21647591dea4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21657591dea4Smrg# the --with-groff option, it allows maximum flexibility in making decisions
21667591dea4Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
21677591dea4Smrg# --with-groff assumes 'auto'.
2168ef7198c0Smrg#
21697591dea4Smrg# Interface to module:
21707591dea4Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21717591dea4Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21727591dea4Smrg# HAVE_GROFF_MS: the -ms macros package
21737591dea4Smrg# GROFF:	 returns the path of the groff program found
21747591dea4Smrg#		 returns the path set by the user in the environment
21757591dea4Smrg# --with-groff:	 'yes' user instructs the module to use groff
21767591dea4Smrg#		 'no' user instructs the module not to use groff
2177ef7198c0Smrg#
21787591dea4Smrg# Added in version 1.9.0:
21797591dea4Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21807591dea4Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21817591dea4Smrg#		   psselect from the psutils package.
21827591dea4Smrg#		   the ghostcript package. Refer to the grohtml man pages
2183ef7198c0Smrg#
21847591dea4Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21853a67387eSmrg#
21867591dea4Smrg# OS and distros often splits groff in a basic and full package, the former
21877591dea4Smrg# having the groff program and the later having devices, fonts and macros
21887591dea4Smrg# Checking for the groff executable is not enough.
21893a67387eSmrg#
21907591dea4Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
21917591dea4Smrg# unset HAVE_GROFF or GROFF env variables.
21927591dea4Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21937591dea4Smrg#
21947591dea4SmrgAC_DEFUN([XORG_WITH_GROFF],[
21957591dea4SmrgAC_ARG_VAR([GROFF], [Path to groff command])
21967591dea4Smrgm4_define([_defopt], m4_default([$1], [auto]))
21977591dea4SmrgAC_ARG_WITH(groff,
21987591dea4Smrg	AS_HELP_STRING([--with-groff],
21997591dea4Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
22007591dea4Smrg	   [use_groff=$withval], [use_groff=]_defopt)
22017591dea4Smrgm4_undefine([_defopt])
22023a67387eSmrg
22037591dea4Smrgif test "x$use_groff" = x"auto"; then
22047591dea4Smrg   AC_PATH_PROG([GROFF], [groff])
22057591dea4Smrg   if test "x$GROFF" = "x"; then
22067591dea4Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22077591dea4Smrg	have_groff=no
22087591dea4Smrg   else
22097591dea4Smrg        have_groff=yes
22107591dea4Smrg   fi
22117591dea4Smrgelif test "x$use_groff" = x"yes" ; then
22127591dea4Smrg   AC_PATH_PROG([GROFF], [groff])
22137591dea4Smrg   if test "x$GROFF" = "x"; then
22147591dea4Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22157591dea4Smrg   fi
22167591dea4Smrg   have_groff=yes
22177591dea4Smrgelif test "x$use_groff" = x"no" ; then
22187591dea4Smrg   if test "x$GROFF" != "x"; then
22197591dea4Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22207591dea4Smrg   fi
22217591dea4Smrg   have_groff=no
2222ef7198c0Smrgelse
22237591dea4Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2224ef7198c0Smrgfi
222556f6b22bSmrg
22267591dea4Smrg# We have groff, test for the presence of the macro packages
22277591dea4Smrgif test "x$have_groff" = x"yes"; then
22287591dea4Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22297591dea4Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22307591dea4Smrg        groff_ms_works=yes
22317591dea4Smrg    else
22327591dea4Smrg        groff_ms_works=no
22333a67387eSmrg    fi
22347591dea4Smrg    AC_MSG_RESULT([$groff_ms_works])
22357591dea4Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22367591dea4Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22377591dea4Smrg        groff_mm_works=yes
22387591dea4Smrg    else
22397591dea4Smrg        groff_mm_works=no
22407591dea4Smrg    fi
22417591dea4Smrg    AC_MSG_RESULT([$groff_mm_works])
2242ef7198c0Smrgfi
22433a67387eSmrg
22447591dea4Smrg# We have groff, test for HTML dependencies, one command per package
22457591dea4Smrgif test "x$have_groff" = x"yes"; then
22467591dea4Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22477591dea4Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22487591dea4Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22497591dea4Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22507591dea4Smrg      have_groff_html=yes
22517591dea4Smrg   else
22527591dea4Smrg      have_groff_html=no
22537591dea4Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22547591dea4Smrg   fi
22557591dea4Smrgfi
22563a67387eSmrg
22577591dea4Smrg# Set Automake conditionals for Makefiles
22587591dea4SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22597591dea4SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22607591dea4SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22617591dea4SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22627591dea4Smrg]) # XORG_WITH_GROFF
22633a67387eSmrg
22647591dea4Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22657591dea4Smrg# ---------------------------------------
22667591dea4Smrg# Minimum version: 1.6.0
22677591dea4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22687591dea4Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
22697591dea4Smrg#
22707591dea4Smrg# Documentation tools are not always available on all platforms and sometimes
22717591dea4Smrg# not at the appropriate level. This macro enables a module to test for the
22727591dea4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22737591dea4Smrg# the --with-fop option, it allows maximum flexibility in making decisions
22747591dea4Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
22757591dea4Smrg# --with-fop assumes 'auto'.
22767591dea4Smrg#
22777591dea4Smrg# Interface to module:
22787591dea4Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22797591dea4Smrg# FOP:	 	returns the path of the fop program found
22807591dea4Smrg#		returns the path set by the user in the environment
22817591dea4Smrg# --with-fop: 	'yes' user instructs the module to use fop
22827591dea4Smrg#		'no' user instructs the module not to use fop
22837591dea4Smrg#
22847591dea4Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22857591dea4Smrg#
22867591dea4SmrgAC_DEFUN([XORG_WITH_FOP],[
22877591dea4SmrgAC_ARG_VAR([FOP], [Path to fop command])
22887591dea4Smrgm4_define([_defopt], m4_default([$2], [auto]))
22897591dea4SmrgAC_ARG_WITH(fop,
22907591dea4Smrg	AS_HELP_STRING([--with-fop],
22917591dea4Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22927591dea4Smrg	   [use_fop=$withval], [use_fop=]_defopt)
22937591dea4Smrgm4_undefine([_defopt])
22943a67387eSmrg
22957591dea4Smrgif test "x$use_fop" = x"auto"; then
22967591dea4Smrg   AC_PATH_PROG([FOP], [fop])
22977591dea4Smrg   if test "x$FOP" = "x"; then
22987591dea4Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22997591dea4Smrg	have_fop=no
23007591dea4Smrg   else
23017591dea4Smrg        have_fop=yes
23027591dea4Smrg   fi
23037591dea4Smrgelif test "x$use_fop" = x"yes" ; then
23047591dea4Smrg   AC_PATH_PROG([FOP], [fop])
23057591dea4Smrg   if test "x$FOP" = "x"; then
23067591dea4Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23077591dea4Smrg   fi
23087591dea4Smrg   have_fop=yes
23097591dea4Smrgelif test "x$use_fop" = x"no" ; then
23107591dea4Smrg   if test "x$FOP" != "x"; then
23117591dea4Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23127591dea4Smrg   fi
23137591dea4Smrg   have_fop=no
23147591dea4Smrgelse
23157591dea4Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2316ef7198c0Smrgfi
231756f6b22bSmrg
23187591dea4Smrg# Test for a minimum version of fop, if provided.
23197591dea4Smrgm4_ifval([$1],
23207591dea4Smrg[if test "$have_fop" = yes; then
23217591dea4Smrg    # scrape the fop version
23227591dea4Smrg    AC_MSG_CHECKING([for fop minimum version])
23237591dea4Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23247591dea4Smrg    AC_MSG_RESULT([$fop_version])
23257591dea4Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
23267591dea4Smrg        [if test "x$use_fop" = xauto; then
23277591dea4Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23287591dea4Smrg            have_fop=no
23297591dea4Smrg        else
23307591dea4Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23317591dea4Smrg        fi])
23327591dea4Smrgfi])
23337591dea4SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23347591dea4Smrg]) # XORG_WITH_FOP
233556f6b22bSmrg
23367591dea4Smrg# XORG_WITH_M4([MIN-VERSION])
23377591dea4Smrg# ---------------------------
23387591dea4Smrg# Minimum version: 1.19.0
2339ef7198c0Smrg#
23407591dea4Smrg# This macro attempts to locate an m4 macro processor which supports
23417591dea4Smrg# -I option and is only useful for modules relying on M4 in order to
23427591dea4Smrg# expand macros in source code files.
23433a67387eSmrg#
23447591dea4Smrg# Interface to module:
23457591dea4Smrg# M4:	 	returns the path of the m4 program found
23467591dea4Smrg#		returns the path set by the user in the environment
23477591dea4Smrg#
23487591dea4SmrgAC_DEFUN([XORG_WITH_M4], [
23497591dea4SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23507591dea4Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23517591dea4Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23527591dea4Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23537591dea4Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23547591dea4Smrg   [$PATH:/usr/gnu/bin])])
235556f6b22bSmrg
23567591dea4SmrgAC_SUBST([M4], [$ac_cv_path_M4])
23577591dea4Smrg]) # XORG_WITH_M4
235856f6b22bSmrg
23597591dea4Smrg# XORG_WITH_PS2PDF([DEFAULT])
23607591dea4Smrg# ----------------
23617591dea4Smrg# Minimum version: 1.6.0
23627591dea4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23637591dea4Smrg#
23647591dea4Smrg# Documentation tools are not always available on all platforms and sometimes
23657591dea4Smrg# not at the appropriate level. This macro enables a module to test for the
23667591dea4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23677591dea4Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
23687591dea4Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23697591dea4Smrg# --with-ps2pdf assumes 'auto'.
23707591dea4Smrg#
23717591dea4Smrg# Interface to module:
23727591dea4Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23737591dea4Smrg# PS2PDF:	returns the path of the ps2pdf program found
23747591dea4Smrg#		returns the path set by the user in the environment
23757591dea4Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23767591dea4Smrg#		 'no' user instructs the module not to use ps2pdf
23777591dea4Smrg#
23787591dea4Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23797591dea4Smrg#
23807591dea4SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23817591dea4SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23827591dea4Smrgm4_define([_defopt], m4_default([$1], [auto]))
23837591dea4SmrgAC_ARG_WITH(ps2pdf,
23847591dea4Smrg	AS_HELP_STRING([--with-ps2pdf],
23857591dea4Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23867591dea4Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23877591dea4Smrgm4_undefine([_defopt])
238856f6b22bSmrg
23897591dea4Smrgif test "x$use_ps2pdf" = x"auto"; then
23907591dea4Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23917591dea4Smrg   if test "x$PS2PDF" = "x"; then
23927591dea4Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23937591dea4Smrg	have_ps2pdf=no
23947591dea4Smrg   else
23957591dea4Smrg        have_ps2pdf=yes
23967591dea4Smrg   fi
23977591dea4Smrgelif test "x$use_ps2pdf" = x"yes" ; then
23987591dea4Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23997591dea4Smrg   if test "x$PS2PDF" = "x"; then
24007591dea4Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24017591dea4Smrg   fi
24027591dea4Smrg   have_ps2pdf=yes
24037591dea4Smrgelif test "x$use_ps2pdf" = x"no" ; then
24047591dea4Smrg   if test "x$PS2PDF" != "x"; then
24057591dea4Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24067591dea4Smrg   fi
24077591dea4Smrg   have_ps2pdf=no
24087591dea4Smrgelse
24097591dea4Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
24103a67387eSmrgfi
24117591dea4SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24127591dea4Smrg]) # XORG_WITH_PS2PDF
241356f6b22bSmrg
24147591dea4Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
24157591dea4Smrg# ----------------
24167591dea4Smrg# Minimum version: 1.6.0
24177591dea4Smrg#
24187591dea4Smrg# Documentation tools are not always available on all platforms and sometimes
24197591dea4Smrg# not at the appropriate level. This macro enables a builder to skip all
24207591dea4Smrg# documentation targets except traditional man pages.
24217591dea4Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24227591dea4Smrg# maximum flexibility in controlling documentation building.
24237591dea4Smrg# Refer to:
24247591dea4Smrg# XORG_WITH_XMLTO         --with-xmlto
24257591dea4Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24267591dea4Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24277591dea4Smrg# XORG_WITH_FOP           --with-fop
24287591dea4Smrg# XORG_WITH_GROFF         --with-groff
24297591dea4Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24307591dea4Smrg#
24317591dea4Smrg# Interface to module:
24327591dea4Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24337591dea4Smrg# --enable-docs: 'yes' user instructs the module to generate docs
24347591dea4Smrg#		 'no' user instructs the module not to generate docs
24357591dea4Smrg# parm1:	specify the default value, yes or no.
24367591dea4Smrg#
24377591dea4SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24387591dea4Smrgm4_define([docs_default], m4_default([$1], [yes]))
24397591dea4SmrgAC_ARG_ENABLE(docs,
24407591dea4Smrg	AS_HELP_STRING([--enable-docs],
24417591dea4Smrg	   [Enable building the documentation (default: ]docs_default[)]),
24427591dea4Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
24437591dea4Smrgm4_undefine([docs_default])
24447591dea4SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24457591dea4SmrgAC_MSG_CHECKING([whether to build documentation])
24467591dea4SmrgAC_MSG_RESULT([$build_docs])
24477591dea4Smrg]) # XORG_ENABLE_DOCS
244856f6b22bSmrg
24497591dea4Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24507591dea4Smrg# ----------------
24517591dea4Smrg# Minimum version: 1.6.0
24527591dea4Smrg#
24537591dea4Smrg# This macro enables a builder to skip all developer documentation.
24547591dea4Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24557591dea4Smrg# maximum flexibility in controlling documentation building.
24567591dea4Smrg# Refer to:
24577591dea4Smrg# XORG_WITH_XMLTO         --with-xmlto
24587591dea4Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24597591dea4Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24607591dea4Smrg# XORG_WITH_FOP           --with-fop
24617591dea4Smrg# XORG_WITH_GROFF         --with-groff
24627591dea4Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24637591dea4Smrg#
24647591dea4Smrg# Interface to module:
24657591dea4Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24667591dea4Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24677591dea4Smrg#			'no' user instructs the module not to generate developer docs
24687591dea4Smrg# parm1:		specify the default value, yes or no.
24697591dea4Smrg#
24707591dea4SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24717591dea4Smrgm4_define([devel_default], m4_default([$1], [yes]))
24727591dea4SmrgAC_ARG_ENABLE(devel-docs,
24737591dea4Smrg	AS_HELP_STRING([--enable-devel-docs],
24747591dea4Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24757591dea4Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24767591dea4Smrgm4_undefine([devel_default])
24777591dea4SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24787591dea4SmrgAC_MSG_CHECKING([whether to build developer documentation])
24797591dea4SmrgAC_MSG_RESULT([$build_devel_docs])
24807591dea4Smrg]) # XORG_ENABLE_DEVEL_DOCS
248156f6b22bSmrg
24827591dea4Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
24837591dea4Smrg# ----------------
24847591dea4Smrg# Minimum version: 1.6.0
24857591dea4Smrg#
24867591dea4Smrg# This macro enables a builder to skip all functional specification targets.
24877591dea4Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24887591dea4Smrg# maximum flexibility in controlling documentation building.
24897591dea4Smrg# Refer to:
24907591dea4Smrg# XORG_WITH_XMLTO         --with-xmlto
24917591dea4Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24927591dea4Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24937591dea4Smrg# XORG_WITH_FOP           --with-fop
24947591dea4Smrg# XORG_WITH_GROFF         --with-groff
24957591dea4Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24967591dea4Smrg#
24977591dea4Smrg# Interface to module:
24987591dea4Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24997591dea4Smrg# --enable-specs:	'yes' user instructs the module to generate specs
25007591dea4Smrg#			'no' user instructs the module not to generate specs
25017591dea4Smrg# parm1:		specify the default value, yes or no.
25027591dea4Smrg#
25037591dea4SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25047591dea4Smrgm4_define([spec_default], m4_default([$1], [yes]))
25057591dea4SmrgAC_ARG_ENABLE(specs,
25067591dea4Smrg	AS_HELP_STRING([--enable-specs],
25077591dea4Smrg	   [Enable building the specs (default: ]spec_default[)]),
25087591dea4Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
25097591dea4Smrgm4_undefine([spec_default])
25107591dea4SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25117591dea4SmrgAC_MSG_CHECKING([whether to build functional specifications])
25127591dea4SmrgAC_MSG_RESULT([$build_specs])
25137591dea4Smrg]) # XORG_ENABLE_SPECS
2514ef7198c0Smrg
25157591dea4Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25167591dea4Smrg# ----------------------------------------------
25177591dea4Smrg# Minimum version: 1.13.0
25187591dea4Smrg#
25197591dea4Smrg# This macro enables a builder to enable/disable unit testing
25207591dea4Smrg# It makes no assumption about the test cases implementation
25217591dea4Smrg# Test cases may or may not use Automake "Support for test suites"
25227591dea4Smrg# They may or may not use the software utility library GLib
25237591dea4Smrg#
25247591dea4Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25257591dea4Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25267591dea4Smrg# The variable enable_unit_tests is used by other macros in this file.
25277591dea4Smrg#
25287591dea4Smrg# Interface to module:
25297591dea4Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25307591dea4Smrg# enable_unit_tests:    used in configure.ac for additional configuration
25317591dea4Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25327591dea4Smrg#			'no' user instructs the module not to build tests
25337591dea4Smrg# parm1:		specify the default value, yes or no.
25347591dea4Smrg#
25357591dea4SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25367591dea4SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25377591dea4SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25387591dea4SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25397591dea4Smrgm4_define([_defopt], m4_default([$1], [auto]))
25407591dea4SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25417591dea4Smrg	[Enable building unit test cases (default: ]_defopt[)]),
25427591dea4Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25437591dea4Smrgm4_undefine([_defopt])
25447591dea4SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25457591dea4SmrgAC_MSG_CHECKING([whether to build unit test cases])
25467591dea4SmrgAC_MSG_RESULT([$enable_unit_tests])
25477591dea4Smrg]) # XORG_ENABLE_UNIT_TESTS
25483a67387eSmrg
25497591dea4Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25507591dea4Smrg# ------------------------------------------------------
25517591dea4Smrg# Minimum version: 1.17.0
25527591dea4Smrg#
25537591dea4Smrg# This macro enables a builder to enable/disable integration testing
25547591dea4Smrg# It makes no assumption about the test cases' implementation
25557591dea4Smrg# Test cases may or may not use Automake "Support for test suites"
25567591dea4Smrg#
25577591dea4Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25587591dea4Smrg# usually requires less dependencies and may be built and run under less
25597591dea4Smrg# stringent environments than integration tests.
25607591dea4Smrg#
25617591dea4Smrg# Interface to module:
25627591dea4Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25637591dea4Smrg# enable_integration_tests:   used in configure.ac for additional configuration
25647591dea4Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25657591dea4Smrg#                             'no' user instructs the module not to build tests
25667591dea4Smrg# parm1:                      specify the default value, yes or no.
25677591dea4Smrg#
25687591dea4SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
25697591dea4SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25707591dea4Smrgm4_define([_defopt], m4_default([$1], [auto]))
25717591dea4SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
25727591dea4Smrg	[Enable building integration test cases (default: ]_defopt[)]),
25737591dea4Smrg	[enable_integration_tests=$enableval],
25747591dea4Smrg	[enable_integration_tests=]_defopt)
25757591dea4Smrgm4_undefine([_defopt])
25767591dea4SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
25777591dea4Smrg	[test "x$enable_integration_tests" != xno])
25787591dea4SmrgAC_MSG_CHECKING([whether to build unit test cases])
25797591dea4SmrgAC_MSG_RESULT([$enable_integration_tests])
25807591dea4Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
25813a67387eSmrg
25827591dea4Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25837591dea4Smrg# ----------------------------------------
25847591dea4Smrg# Minimum version: 1.13.0
25857591dea4Smrg#
25867591dea4Smrg# GLib is a library which provides advanced data structures and functions.
25877591dea4Smrg# This macro enables a module to test for the presence of Glib.
25887591dea4Smrg#
25897591dea4Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25907591dea4Smrg# Otherwise the value of $enable_unit_tests is blank.
25917591dea4Smrg#
25927591dea4Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25937591dea4Smrg# test support usually requires less dependencies and may be built and run under
25947591dea4Smrg# less stringent environments than integration tests.
25957591dea4Smrg#
25967591dea4Smrg# Interface to module:
25977591dea4Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
25987591dea4Smrg# with_glib: used in configure.ac to know if GLib has been found
25997591dea4Smrg# --with-glib:	'yes' user instructs the module to use glib
26007591dea4Smrg#		'no' user instructs the module not to use glib
26017591dea4Smrg#
26027591dea4SmrgAC_DEFUN([XORG_WITH_GLIB],[
26037591dea4SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26047591dea4Smrgm4_define([_defopt], m4_default([$2], [auto]))
26057591dea4SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26067591dea4Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26077591dea4Smrg	[with_glib=$withval], [with_glib=]_defopt)
26087591dea4Smrgm4_undefine([_defopt])
26093a67387eSmrg
26107591dea4Smrghave_glib=no
26117591dea4Smrg# Do not probe GLib if user explicitly disabled unit testing
26127591dea4Smrgif test "x$enable_unit_tests" != x"no"; then
26137591dea4Smrg  # Do not probe GLib if user explicitly disabled it
26147591dea4Smrg  if test "x$with_glib" != x"no"; then
26157591dea4Smrg    m4_ifval(
26167591dea4Smrg      [$1],
26177591dea4Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26187591dea4Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26197591dea4Smrg    )
26207591dea4Smrg  fi
26217591dea4Smrgfi
26223a67387eSmrg
26237591dea4Smrg# Not having GLib when unit testing has been explicitly requested is an error
26247591dea4Smrgif test "x$enable_unit_tests" = x"yes"; then
26257591dea4Smrg  if test "x$have_glib" = x"no"; then
26267591dea4Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26277591dea4Smrg  fi
26287591dea4Smrgfi
26293a67387eSmrg
26307591dea4Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
26317591dea4Smrgif test "x$enable_unit_tests" = x"no"; then
26327591dea4Smrg  if test "x$with_glib" = x"yes"; then
26337591dea4Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26347591dea4Smrg  fi
2635ef7198c0Smrgfi
2636ef7198c0Smrg
26377591dea4Smrg# Not having GLib when it has been explicitly requested is an error
26387591dea4Smrgif test "x$with_glib" = x"yes"; then
26397591dea4Smrg  if test "x$have_glib" = x"no"; then
26407591dea4Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26417591dea4Smrg  fi
26427591dea4Smrgfi
2643ef7198c0Smrg
26447591dea4SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26457591dea4Smrg]) # XORG_WITH_GLIB
2646ef7198c0Smrg
26477591dea4Smrg# XORG_LD_WRAP([required|optional])
26487591dea4Smrg# ---------------------------------
26497591dea4Smrg# Minimum version: 1.13.0
26507591dea4Smrg#
26517591dea4Smrg# Check if linker supports -wrap, passed via compiler flags
26527591dea4Smrg#
26537591dea4Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26547591dea4Smrg# Otherwise the value of $enable_unit_tests is blank.
26557591dea4Smrg#
26567591dea4Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26577591dea4Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26587591dea4Smrg# available, an argument of "optional" allows use when some unit tests require
26597591dea4Smrg# ld -wrap and others do not.
26607591dea4Smrg#
26617591dea4SmrgAC_DEFUN([XORG_LD_WRAP],[
26627591dea4SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26637591dea4Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26647591dea4Smrg                      void __wrap_exit(int status) { return; }],
26657591dea4Smrg                     [exit(0);])])
26667591dea4Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
26677591dea4Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
26687591dea4Smrg  if test "x$have_ld_wrap" = x"no"; then
26697591dea4Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
26707591dea4Smrg  fi
2671ef7198c0Smrgfi
26727591dea4SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
26737591dea4Smrg#
26747591dea4Smrg]) # XORG_LD_WRAP
2675ef7198c0Smrg
26767591dea4Smrg# XORG_CHECK_LINKER_FLAGS
26777591dea4Smrg# -----------------------
26787591dea4Smrg# SYNOPSIS
26797591dea4Smrg#
26807591dea4Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26817591dea4Smrg#
26827591dea4Smrg# DESCRIPTION
26837591dea4Smrg#
26847591dea4Smrg#   Check whether the given linker FLAGS work with the current language's
26857591dea4Smrg#   linker, or whether they give an error.
26867591dea4Smrg#
26877591dea4Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26887591dea4Smrg#   success/failure.
26897591dea4Smrg#
26907591dea4Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
26917591dea4Smrg#
26927591dea4Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26937591dea4Smrg#
26947591dea4Smrg# LICENSE
26957591dea4Smrg#
26967591dea4Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26977591dea4Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26987591dea4Smrg#   Copyright (c) 2009 Matteo Frigo
26997591dea4Smrg#
27007591dea4Smrg#   This program is free software: you can redistribute it and/or modify it
27017591dea4Smrg#   under the terms of the GNU General Public License as published by the
27027591dea4Smrg#   Free Software Foundation, either version 3 of the License, or (at your
27037591dea4Smrg#   option) any later version.
27047591dea4Smrg#
27057591dea4Smrg#   This program is distributed in the hope that it will be useful, but
27067591dea4Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27077591dea4Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27087591dea4Smrg#   Public License for more details.
27097591dea4Smrg#
27107591dea4Smrg#   You should have received a copy of the GNU General Public License along
27117591dea4Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27127591dea4Smrg#
27137591dea4Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
27147591dea4Smrg#   gives unlimited permission to copy, distribute and modify the configure
27157591dea4Smrg#   scripts that are the output of Autoconf when processing the Macro. You
27167591dea4Smrg#   need not follow the terms of the GNU General Public License when using
27177591dea4Smrg#   or distributing such scripts, even though portions of the text of the
27187591dea4Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27197591dea4Smrg#   all other use of the material that constitutes the Autoconf Macro.
27207591dea4Smrg#
27217591dea4Smrg#   This special exception to the GPL applies to versions of the Autoconf
27227591dea4Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
27237591dea4Smrg#   modified version of the Autoconf Macro, you may extend this special
27247591dea4Smrg#   exception to the GPL to apply to your modified version as well.#
27257591dea4SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27267591dea4Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
27277591dea4Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27287591dea4SmrgAS_LITERAL_IF([$1],
27297591dea4Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27307591dea4Smrg      ax_save_FLAGS=$LDFLAGS
27317591dea4Smrg      LDFLAGS="$1"
27327591dea4Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27337591dea4Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27347591dea4Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27357591dea4Smrg      LDFLAGS=$ax_save_FLAGS])],
27367591dea4Smrg  [ax_save_FLAGS=$LDFLAGS
27377591dea4Smrg   LDFLAGS="$1"
27387591dea4Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27397591dea4Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27407591dea4Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27417591dea4Smrg   LDFLAGS=$ax_save_FLAGS])
27427591dea4Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27437591dea4SmrgAC_MSG_RESULT($xorg_check_linker_flags)
27447591dea4Smrgif test "x$xorg_check_linker_flags" = xyes; then
27457591dea4Smrg	m4_default([$2], :)
27467591dea4Smrgelse
27477591dea4Smrg	m4_default([$3], :)
27487591dea4Smrgfi
27497591dea4Smrg]) # XORG_CHECK_LINKER_FLAGS
2750ef7198c0Smrg
27517591dea4Smrg# XORG_MEMORY_CHECK_FLAGS
27527591dea4Smrg# -----------------------
27537591dea4Smrg# Minimum version: 1.16.0
27543a67387eSmrg#
27557591dea4Smrg# This macro attempts to find appropriate memory checking functionality
27567591dea4Smrg# for various platforms which unit testing code may use to catch various
27577591dea4Smrg# forms of memory allocation and access errors in testing.
27587591dea4Smrg#
27597591dea4Smrg# Interface to module:
27607591dea4Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27617591dea4Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27627591dea4Smrg#
27637591dea4Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27647591dea4Smrg#
27657591dea4SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2766ef7198c0Smrg
27677591dea4SmrgAC_REQUIRE([AC_CANONICAL_HOST])
27687591dea4SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
27697591dea4Smrg           [Environment variables to enable memory checking in tests])
2770ef7198c0Smrg
27717591dea4Smrg# Check for different types of support on different platforms
27727591dea4Smrgcase $host_os in
27737591dea4Smrg    solaris*)
27747591dea4Smrg        AC_CHECK_LIB([umem], [umem_alloc],
27757591dea4Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
27767591dea4Smrg        ;;
27777591dea4Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
27787591dea4Smrg        # both directly and inverted, so should not be 0 or 255.
27797591dea4Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
27807591dea4Smrg        ;;
27817591dea4Smrg    darwin*)
27827591dea4Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
27837591dea4Smrg        ;;
27847591dea4Smrg    *bsd*)
27857591dea4Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27867591dea4Smrg        ;;
27877591dea4Smrgesac
2788ef7198c0Smrg
27897591dea4Smrg# User supplied flags override default flags
27907591dea4Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27917591dea4Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27927591dea4Smrgfi
2793ef7198c0Smrg
27947591dea4SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27957591dea4Smrg]) # XORG_WITH_LINT
27963a67387eSmrg
27977591dea4Smrg# XORG_CHECK_MALLOC_ZERO
27987591dea4Smrg# ----------------------
27997591dea4Smrg# Minimum version: 1.0.0
2800ef7198c0Smrg#
28017591dea4Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28027591dea4Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28037591dea4Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28047591dea4SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28057591dea4SmrgAC_ARG_ENABLE(malloc0returnsnull,
28067591dea4Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28077591dea4Smrg		       [malloc(0) returns NULL (default: auto)]),
28087591dea4Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28097591dea4Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2810ef7198c0Smrg
28117591dea4SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28127591dea4Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28137591dea4SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28147591dea4Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28157591dea4Smrg#include <stdlib.h>
28167591dea4Smrg],[
28177591dea4Smrg    char *m0, *r0, *c0, *p;
28187591dea4Smrg    m0 = malloc(0);
28197591dea4Smrg    p = malloc(10);
28207591dea4Smrg    r0 = realloc(p,0);
28217591dea4Smrg    c0 = calloc(0,10);
28227591dea4Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28237591dea4Smrg])],
28247591dea4Smrg		[xorg_cv_malloc0_returns_null=yes],
28257591dea4Smrg		[xorg_cv_malloc0_returns_null=no])])
28267591dea4SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28277591dea4Smrgfi
28287591dea4SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2829ef7198c0Smrg
28307591dea4Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28317591dea4Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28327591dea4Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28337591dea4Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28347591dea4Smrgelse
28357591dea4Smrg	MALLOC_ZERO_CFLAGS=""
28367591dea4Smrg	XMALLOC_ZERO_CFLAGS=""
28377591dea4Smrg	XTMALLOC_ZERO_CFLAGS=""
28387591dea4Smrgfi
2839ef7198c0Smrg
28407591dea4SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28417591dea4SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28427591dea4SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28437591dea4Smrg]) # XORG_CHECK_MALLOC_ZERO
284456f6b22bSmrg
28457591dea4Smrg# XORG_WITH_LINT()
28467591dea4Smrg# ----------------
28477591dea4Smrg# Minimum version: 1.1.0
2848ef7198c0Smrg#
28497591dea4Smrg# This macro enables the use of a tool that flags some suspicious and
28507591dea4Smrg# non-portable constructs (likely to be bugs) in C language source code.
28517591dea4Smrg# It will attempt to locate the tool and use appropriate options.
28527591dea4Smrg# There are various lint type tools on different platforms.
28537591dea4Smrg#
28547591dea4Smrg# Interface to module:
28557591dea4Smrg# LINT:		returns the path to the tool found on the platform
28567591dea4Smrg#		or the value set to LINT on the configure cmd line
28577591dea4Smrg#		also an Automake conditional
28587591dea4Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
28597591dea4Smrg#
28607591dea4Smrg# --with-lint:	'yes' user instructs the module to use lint
28617591dea4Smrg#		'no' user instructs the module not to use lint (default)
28627591dea4Smrg#
28637591dea4Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28647591dea4Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28657591dea4Smrg#
28667591dea4SmrgAC_DEFUN([XORG_WITH_LINT],[
2867ef7198c0Smrg
28687591dea4SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
28697591dea4SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
28707591dea4SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
28717591dea4Smrg		[Use a lint-style source code checker (default: disabled)])],
28727591dea4Smrg		[use_lint=$withval], [use_lint=no])
2873ef7198c0Smrg
28747591dea4Smrg# Obtain platform specific info like program name and options
28757591dea4Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
28767591dea4Smrgcase $host_os in
28777591dea4Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
28787591dea4Smrg	lint_name=splint
28797591dea4Smrg	lint_options="-badflag"
28807591dea4Smrg	;;
28817591dea4Smrg  *freebsd* | *netbsd*)
28827591dea4Smrg	lint_name=lint
28837591dea4Smrg	lint_options="-u -b"
28847591dea4Smrg	;;
28857591dea4Smrg  *solaris*)
28867591dea4Smrg	lint_name=lint
28877591dea4Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28887591dea4Smrg	;;
28897591dea4Smrgesac
2890ef7198c0Smrg
28917591dea4Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28927591dea4Smrgif test "x$use_lint" = x"yes" ; then
28937591dea4Smrg   AC_PATH_PROG([LINT], [$lint_name])
28947591dea4Smrg   if test "x$LINT" = "x"; then
28957591dea4Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28967591dea4Smrg   fi
28977591dea4Smrgelif test "x$use_lint" = x"no" ; then
28987591dea4Smrg   if test "x$LINT" != "x"; then
28997591dea4Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
29007591dea4Smrg   fi
29013a67387eSmrgelse
29027591dea4Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
29033a67387eSmrgfi
2904ef7198c0Smrg
29057591dea4Smrg# User supplied flags override default flags
29067591dea4Smrgif test "x$LINT_FLAGS" != "x"; then
29077591dea4Smrg   lint_options=$LINT_FLAGS
29087591dea4Smrgfi
2909ef7198c0Smrg
29107591dea4SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29117591dea4SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
29123a67387eSmrg
29137591dea4Smrg]) # XORG_WITH_LINT
29143a67387eSmrg
29157591dea4Smrg# XORG_LINT_LIBRARY(LIBNAME)
29167591dea4Smrg# --------------------------
29177591dea4Smrg# Minimum version: 1.1.0
2918ef7198c0Smrg#
29197591dea4Smrg# Sets up flags for building lint libraries for checking programs that call
29207591dea4Smrg# functions in the library.
29217591dea4Smrg#
29227591dea4Smrg# Interface to module:
29237591dea4Smrg# LINTLIB		- Automake variable with the name of lint library file to make
29247591dea4Smrg# MAKE_LINT_LIB		- Automake conditional
29257591dea4Smrg#
29267591dea4Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29277591dea4Smrg#			  - 'no' user instructs the module not to create a lint library (default)
29283a67387eSmrg
29297591dea4SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29307591dea4SmrgAC_REQUIRE([XORG_WITH_LINT])
29317591dea4SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29327591dea4Smrg	[Create lint library (default: disabled)])],
29337591dea4Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2934ef7198c0Smrg
29357591dea4Smrgif test "x$make_lint_lib" = x"yes" ; then
29367591dea4Smrg   LINTLIB=llib-l$1.ln
29377591dea4Smrg   if test "x$LINT" = "x"; then
29387591dea4Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29397591dea4Smrg   fi
29407591dea4Smrgelif test "x$make_lint_lib" != x"no" ; then
29417591dea4Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29427591dea4Smrgfi
2943ef7198c0Smrg
29447591dea4SmrgAC_SUBST(LINTLIB)
29457591dea4SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
294656f6b22bSmrg
29477591dea4Smrg]) # XORG_LINT_LIBRARY
294856f6b22bSmrg
29497591dea4Smrg# XORG_COMPILER_BRAND
29507591dea4Smrg# -------------------
29517591dea4Smrg# Minimum version: 1.14.0
29527591dea4Smrg#
29537591dea4Smrg# Checks for various brands of compilers and sets flags as appropriate:
29547591dea4Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29557591dea4Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29567591dea4Smrg#   clang compiler - sets CLANGCC to "yes"
29577591dea4Smrg#   Intel compiler - sets INTELCC to "yes"
29587591dea4Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29597591dea4Smrg#
29607591dea4SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29617591dea4SmrgAC_LANG_CASE(
29627591dea4Smrg	[C], [
29637591dea4Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29647591dea4Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
29657591dea4Smrg		m4_version_prereq([2.70],
29667591dea4Smrg			[AC_REQUIRE([AC_PROG_CC])],
29677591dea4Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
29687591dea4Smrg	],
29697591dea4Smrg	[C++], [
29707591dea4Smrg		AC_REQUIRE([AC_PROG_CXX])
29717591dea4Smrg	]
29727591dea4Smrg)
29737591dea4SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
29747591dea4SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
29757591dea4SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
29767591dea4Smrg]) # XORG_COMPILER_BRAND
2977ef7198c0Smrg
29787591dea4Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
29797591dea4Smrg# ---------------
29807591dea4Smrg# Minimum version: 1.16.0
29817591dea4Smrg#
29827591dea4Smrg# Test if the compiler works when passed the given flag as a command line argument.
29837591dea4Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
29847591dea4Smrg# next flag in the list until there are no more options.
29857591dea4Smrg#
29867591dea4Smrg# Note that this does not guarantee that the compiler supports the flag as some
29877591dea4Smrg# compilers will simply ignore arguments that they do not understand, but we do
29887591dea4Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29897591dea4Smrg# -Werror=unused-command-line-argument
29907591dea4Smrg#
29917591dea4SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29927591dea4Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29937591dea4Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29947591dea4Smrg
29957591dea4SmrgAC_LANG_COMPILER_REQUIRE
29967591dea4Smrg
29977591dea4SmrgAC_LANG_CASE(
29987591dea4Smrg	[C], [
29997591dea4Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
30007591dea4Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
30017591dea4Smrg		m4_version_prereq([2.70],
30027591dea4Smrg			[AC_REQUIRE([AC_PROG_CC])],
30037591dea4Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30047591dea4Smrg		define([PREFIX], [C])
30057591dea4Smrg		define([CACHE_PREFIX], [cc])
30067591dea4Smrg		define([COMPILER], [$CC])
30077591dea4Smrg	],
30087591dea4Smrg	[C++], [
30097591dea4Smrg		define([PREFIX], [CXX])
30107591dea4Smrg		define([CACHE_PREFIX], [cxx])
30117591dea4Smrg		define([COMPILER], [$CXX])
30127591dea4Smrg	]
30137591dea4Smrg)
3014ef7198c0Smrg
30157591dea4Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30167591dea4Smrg
30177591dea4Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30187591dea4Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30197591dea4Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30207591dea4Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30217591dea4Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30227591dea4Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30237591dea4Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30247591dea4Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30257591dea4Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30267591dea4Smrgfi
30273a67387eSmrg
30287591dea4Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30297591dea4Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30307591dea4Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30317591dea4Smrg	fi
30327591dea4Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30337591dea4Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30347591dea4Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30357591dea4Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30367591dea4Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30377591dea4Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30387591dea4Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30397591dea4Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30407591dea4Smrgfi
30413a67387eSmrg
30427591dea4Smrgfound="no"
30437591dea4Smrgm4_foreach([flag], m4_cdr($@), [
30447591dea4Smrg	if test $found = "no" ; then
30457591dea4Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30467591dea4Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30477591dea4Smrg		fi
30487591dea4Smrg
30497591dea4Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30507591dea4Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30517591dea4Smrg		fi
30527591dea4Smrg
30537591dea4Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30547591dea4Smrg
30557591dea4Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30567591dea4Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30577591dea4Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30587591dea4Smrg		AC_CACHE_VAL($cacheid,
30597591dea4Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30607591dea4Smrg					     [eval $cacheid=yes],
30617591dea4Smrg					     [eval $cacheid=no])])
30627591dea4Smrg
30637591dea4Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30647591dea4Smrg
30657591dea4Smrg		eval supported=\$$cacheid
30667591dea4Smrg		AC_MSG_RESULT([$supported])
30677591dea4Smrg		if test "$supported" = "yes" ; then
30687591dea4Smrg			$1="$$1 ]flag["
30697591dea4Smrg			found="yes"
30707591dea4Smrg		fi
30717591dea4Smrg	fi
30727591dea4Smrg])
30737591dea4Smrg]) # XORG_TESTSET_CFLAG
30743a67387eSmrg
30757591dea4Smrg# XORG_COMPILER_FLAGS
30767591dea4Smrg# ---------------
30777591dea4Smrg# Minimum version: 1.16.0
30787591dea4Smrg#
30797591dea4Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
30807591dea4Smrg# arguments supported by the selected compiler which do NOT alter the generated
30817591dea4Smrg# code.  These arguments will cause the compiler to print various warnings
30827591dea4Smrg# during compilation AND turn a conservative set of warnings into errors.
30837591dea4Smrg#
30847591dea4Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
30857591dea4Smrg# future versions of util-macros as options are added to new compilers.
30867591dea4Smrg#
30877591dea4SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
30887591dea4SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30897591dea4Smrg
30907591dea4SmrgAC_ARG_ENABLE(selective-werror,
30917591dea4Smrg              AS_HELP_STRING([--disable-selective-werror],
30927591dea4Smrg                             [Turn off selective compiler errors. (default: enabled)]),
30937591dea4Smrg              [SELECTIVE_WERROR=$enableval],
30947591dea4Smrg              [SELECTIVE_WERROR=yes])
30957591dea4Smrg
30967591dea4SmrgAC_LANG_CASE(
30977591dea4Smrg        [C], [
30987591dea4Smrg                define([PREFIX], [C])
30997591dea4Smrg        ],
31007591dea4Smrg        [C++], [
31017591dea4Smrg                define([PREFIX], [CXX])
31027591dea4Smrg        ]
31037591dea4Smrg)
31047591dea4Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
31057591dea4Smrgif test "x$SUNCC" = "xyes"; then
31067591dea4Smrg    [BASE_]PREFIX[FLAGS]="-v"
31073a67387eSmrgelse
31087591dea4Smrg    [BASE_]PREFIX[FLAGS]=""
3109ef7198c0Smrgfi
3110ef7198c0Smrg
31117591dea4Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31127591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31137591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31147591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31157591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31167591dea4Smrg
31177591dea4SmrgAC_LANG_CASE(
31187591dea4Smrg	[C], [
31197591dea4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31207591dea4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31217591dea4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31227591dea4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31237591dea4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31247591dea4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31257591dea4Smrg	]
31267591dea4Smrg)
3127ef7198c0Smrg
31287591dea4Smrg# This chunk adds additional warnings that could catch undesired effects.
31297591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31307591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31317591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31327591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31337591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31347591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31357591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
31367591dea4Smrg
31377591dea4Smrg# These are currently disabled because they are noisy.  They will be enabled
31387591dea4Smrg# in the future once the codebase is sufficiently modernized to silence
31397591dea4Smrg# them.  For now, I don't want them to drown out the other warnings.
31407591dea4Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31417591dea4Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31427591dea4Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
31437591dea4Smrg
31447591dea4Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
31457591dea4Smrg# when there are problems that should be fixed.
31467591dea4Smrg
31477591dea4Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31487591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31497591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31507591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31517591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31527591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31537591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31547591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31557591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31567591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31577591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31587591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31597591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31607591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31617591dea4Smrgelse
31627591dea4SmrgAC_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])
31637591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31647591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31657591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31667591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
31677591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
31687591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
31697591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
31707591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
31717591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
31727591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
31737591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
31747591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
31757591dea4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31767591dea4Smrgfi
3177ef7198c0Smrg
31787591dea4SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31797591dea4Smrg]) # XORG_COMPILER_FLAGS
3180ef7198c0Smrg
31817591dea4Smrg# XORG_CWARNFLAGS
31827591dea4Smrg# ---------------
31837591dea4Smrg# Minimum version: 1.2.0
31847591dea4Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
31853a67387eSmrg#
31867591dea4Smrg# Defines CWARNFLAGS to enable C compiler warnings.
31877591dea4Smrg#
31887591dea4Smrg# This function is deprecated because it defines -fno-strict-aliasing
31897591dea4Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
31907591dea4Smrg# is needed, then it should be added explicitly in the module when
31917591dea4Smrg# it is updated to use BASE_CFLAGS.
31927591dea4Smrg#
31937591dea4SmrgAC_DEFUN([XORG_CWARNFLAGS], [
31947591dea4SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31957591dea4SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31967591dea4SmrgAC_LANG_CASE(
31977591dea4Smrg	[C], [
31987591dea4Smrg		CWARNFLAGS="$BASE_CFLAGS"
31997591dea4Smrg		if  test "x$GCC" = xyes ; then
32007591dea4Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
32017591dea4Smrg		fi
32027591dea4Smrg		AC_SUBST(CWARNFLAGS)
32037591dea4Smrg	]
32047591dea4Smrg)
32057591dea4Smrg]) # XORG_CWARNFLAGS
3206ef7198c0Smrg
32077591dea4Smrg# XORG_STRICT_OPTION
32087591dea4Smrg# -----------------------
32097591dea4Smrg# Minimum version: 1.3.0
3210ef7198c0Smrg#
32117591dea4Smrg# Add configure option to enable strict compilation flags, such as treating
32127591dea4Smrg# warnings as fatal errors.
32137591dea4Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32147591dea4Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32157591dea4Smrg#
32167591dea4Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32177591dea4Smrg# when strict compilation is unconditionally desired.
32187591dea4SmrgAC_DEFUN([XORG_STRICT_OPTION], [
32197591dea4SmrgAC_REQUIRE([XORG_CWARNFLAGS])
32207591dea4SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32217591dea4Smrg
32227591dea4SmrgAC_ARG_ENABLE(strict-compilation,
32237591dea4Smrg			  AS_HELP_STRING([--enable-strict-compilation],
32247591dea4Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32257591dea4Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3226ef7198c0Smrg
32277591dea4SmrgAC_LANG_CASE(
32287591dea4Smrg        [C], [
32297591dea4Smrg                define([PREFIX], [C])
32307591dea4Smrg        ],
32317591dea4Smrg        [C++], [
32327591dea4Smrg                define([PREFIX], [CXX])
32337591dea4Smrg        ]
32347591dea4Smrg)
3235ef7198c0Smrg
32367591dea4Smrg[STRICT_]PREFIX[FLAGS]=""
32377591dea4SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32387591dea4SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3239ef7198c0Smrg
32407591dea4Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32417591dea4Smrg# activate it with -Werror, so we add it here explicitly.
32427591dea4SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3243ef7198c0Smrg
32447591dea4Smrgif test "x$STRICT_COMPILE" = "xyes"; then
32457591dea4Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32467591dea4Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32477591dea4Smrgfi
32487591dea4SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32497591dea4SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32507591dea4SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32517591dea4Smrg]) # XORG_STRICT_OPTION
3252ef7198c0Smrg
32537591dea4Smrg# XORG_DEFAULT_NOCODE_OPTIONS
32547591dea4Smrg# ---------------------------
32557591dea4Smrg# Minimum version: 1.20.0
32563a67387eSmrg#
32577591dea4Smrg# Defines default options for X.Org modules which don't compile code,
32587591dea4Smrg# such as fonts, bitmaps, cursors, and docs.
32597591dea4Smrg#
32607591dea4SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
32617591dea4SmrgAC_REQUIRE([AC_PROG_INSTALL])
32627591dea4SmrgXORG_RELEASE_VERSION
32637591dea4SmrgXORG_CHANGELOG
32647591dea4SmrgXORG_INSTALL
32657591dea4SmrgXORG_MANPAGE_SECTIONS
32667591dea4Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32677591dea4Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32687591dea4Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3269ef7198c0Smrg
32707591dea4Smrg# XORG_DEFAULT_OPTIONS
32713a67387eSmrg# --------------------
32727591dea4Smrg# Minimum version: 1.3.0
32733a67387eSmrg#
32747591dea4Smrg# Defines default options for X.Org modules which compile code.
32753a67387eSmrg#
32767591dea4SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
32777591dea4SmrgAC_REQUIRE([AC_PROG_INSTALL])
32787591dea4SmrgXORG_COMPILER_FLAGS
32797591dea4SmrgXORG_CWARNFLAGS
32807591dea4SmrgXORG_STRICT_OPTION
32817591dea4SmrgXORG_DEFAULT_NOCODE_OPTIONS
32827591dea4Smrg]) # XORG_DEFAULT_OPTIONS
32837591dea4Smrg
32847591dea4Smrg# XORG_INSTALL()
32857591dea4Smrg# ----------------
32867591dea4Smrg# Minimum version: 1.4.0
32877591dea4Smrg#
32887591dea4Smrg# Defines the variable INSTALL_CMD as the command to copy
32897591dea4Smrg# INSTALL from $prefix/share/util-macros.
32907591dea4Smrg#
32917591dea4SmrgAC_DEFUN([XORG_INSTALL], [
32927591dea4SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
32937591dea4Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
32947591dea4SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
32957591dea4Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
32967591dea4Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
32977591dea4Smrgtouch \$(top_srcdir)/INSTALL; \
32987591dea4Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
32997591dea4SmrgAC_SUBST([INSTALL_CMD])
33007591dea4Smrg]) # XORG_INSTALL
33017591dea4Smrgdnl Copyright 2005 Red Hat, Inc
33027591dea4Smrgdnl
33037591dea4Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
33047591dea4Smrgdnl documentation for any purpose is hereby granted without fee, provided that
33057591dea4Smrgdnl the above copyright notice appear in all copies and that both that
33067591dea4Smrgdnl copyright notice and this permission notice appear in supporting
33077591dea4Smrgdnl documentation.
33087591dea4Smrgdnl
33097591dea4Smrgdnl The above copyright notice and this permission notice shall be included
33107591dea4Smrgdnl in all copies or substantial portions of the Software.
33117591dea4Smrgdnl
33127591dea4Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33137591dea4Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33147591dea4Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33157591dea4Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
33167591dea4Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33177591dea4Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33187591dea4Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
33197591dea4Smrgdnl
33207591dea4Smrgdnl Except as contained in this notice, the name of the copyright holders shall
33217591dea4Smrgdnl not be used in advertising or otherwise to promote the sale, use or
33227591dea4Smrgdnl other dealings in this Software without prior written authorization
33237591dea4Smrgdnl from the copyright holders.
33247591dea4Smrgdnl
3325ef7198c0Smrg
33267591dea4Smrg# XORG_RELEASE_VERSION
33277591dea4Smrg# --------------------
33287591dea4Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3329ef7198c0Smrg
33307591dea4SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33317591dea4Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33327591dea4Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33337591dea4Smrg		[Major version of this package])
33347591dea4Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33357591dea4Smrg	if test "x$PVM" = "x"; then
33367591dea4Smrg		PVM="0"
33377591dea4Smrg	fi
33387591dea4Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33397591dea4Smrg		[$PVM],
33407591dea4Smrg		[Minor version of this package])
33417591dea4Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33427591dea4Smrg	if test "x$PVP" = "x"; then
33437591dea4Smrg		PVP="0"
33447591dea4Smrg	fi
33457591dea4Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33467591dea4Smrg		[$PVP],
33477591dea4Smrg		[Patch version of this package])
33487591dea4Smrg])
3349ef7198c0Smrg
33507591dea4Smrg# XORG_CHANGELOG()
33517591dea4Smrg# ----------------
33527591dea4Smrg# Minimum version: 1.2.0
33537591dea4Smrg#
33547591dea4Smrg# Defines the variable CHANGELOG_CMD as the command to generate
33557591dea4Smrg# ChangeLog from git.
33567591dea4Smrg#
33577591dea4Smrg#
33587591dea4SmrgAC_DEFUN([XORG_CHANGELOG], [
33597591dea4SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33607591dea4Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33617591dea4Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33627591dea4Smrgtouch \$(top_srcdir)/ChangeLog; \
33637591dea4Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33647591dea4SmrgAC_SUBST([CHANGELOG_CMD])
33657591dea4Smrg]) # XORG_CHANGELOG
3366ef7198c0Smrg
3367