aclocal.m4 revision 7b5fefc8
17b5fefc8Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
27b5fefc8Smrg
37b5fefc8Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4644fc5c1Stron
5644fc5c1Stron# This file is free software; the Free Software Foundation
6644fc5c1Stron# gives unlimited permission to copy and/or distribute it,
7644fc5c1Stron# with or without modifications, as long as this notice is preserved.
8644fc5c1Stron
9644fc5c1Stron# This program is distributed in the hope that it will be useful,
10644fc5c1Stron# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11644fc5c1Stron# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12644fc5c1Stron# PARTICULAR PURPOSE.
13644fc5c1Stron
147b5fefc8Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
152227fc13Smrgm4_ifndef([AC_AUTOCONF_VERSION],
162227fc13Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
177b5fefc8Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
187b5fefc8Smrg[m4_warning([this file was generated for autoconf 2.71.
192227fc13SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
202227fc13SmrgIf you have problems, you may need to regenerate the build system entirely.
217b5fefc8SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22644fc5c1Stron
237b5fefc8Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
242227fc13Smrg#
257b5fefc8Smrg# This file is free software; the Free Software Foundation
267b5fefc8Smrg# gives unlimited permission to copy and/or distribute it,
277b5fefc8Smrg# with or without modifications, as long as this notice is preserved.
282227fc13Smrg
297b5fefc8Smrg# AM_AUTOMAKE_VERSION(VERSION)
307b5fefc8Smrg# ----------------------------
317b5fefc8Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
327b5fefc8Smrg# generated from the m4 files accompanying Automake X.Y.
337b5fefc8Smrg# (This private macro should not be called outside this file.)
347b5fefc8SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
357b5fefc8Smrg[am__api_version='1.16'
367b5fefc8Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
377b5fefc8Smrgdnl require some minimum version.  Point them to the right macro.
387b5fefc8Smrgm4_if([$1], [1.16.5], [],
397b5fefc8Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
407b5fefc8Smrg])
412227fc13Smrg
427b5fefc8Smrg# _AM_AUTOCONF_VERSION(VERSION)
437b5fefc8Smrg# -----------------------------
447b5fefc8Smrg# aclocal traces this macro to find the Autoconf version.
457b5fefc8Smrg# This is a private macro too.  Using m4_define simplifies
467b5fefc8Smrg# the logic in aclocal, which can simply ignore this definition.
477b5fefc8Smrgm4_define([_AM_AUTOCONF_VERSION], [])
482227fc13Smrg
497b5fefc8Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
507b5fefc8Smrg# -------------------------------
517b5fefc8Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
527b5fefc8Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
537b5fefc8SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
547b5fefc8Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
557b5fefc8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
567b5fefc8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
577b5fefc8Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
582227fc13Smrg
597b5fefc8Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
602227fc13Smrg
617b5fefc8Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
627b5fefc8Smrg#
637b5fefc8Smrg# This file is free software; the Free Software Foundation
647b5fefc8Smrg# gives unlimited permission to copy and/or distribute it,
657b5fefc8Smrg# with or without modifications, as long as this notice is preserved.
662227fc13Smrg
677b5fefc8Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
687b5fefc8Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
697b5fefc8Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
702227fc13Smrg#
717b5fefc8Smrg# Of course, Automake must honor this variable whenever it calls a
727b5fefc8Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
737b5fefc8Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
747b5fefc8Smrg# depending on how configure is run.  This is pretty annoying, since
757b5fefc8Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
767b5fefc8Smrg# source directory, any form will work fine, but in subdirectories a
777b5fefc8Smrg# relative path needs to be adjusted first.
782227fc13Smrg#
797b5fefc8Smrg# $ac_aux_dir/missing
807b5fefc8Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
817b5fefc8Smrg# $top_srcdir/$ac_aux_dir/missing
827b5fefc8Smrg#    fails if $ac_aux_dir is absolute,
837b5fefc8Smrg#    fails when called from a subdirectory in a VPATH build with
847b5fefc8Smrg#          a relative $ac_aux_dir
852227fc13Smrg#
867b5fefc8Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
877b5fefc8Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
887b5fefc8Smrg# harmless because $srcdir is '.', but things will broke when you
897b5fefc8Smrg# start a VPATH build or use an absolute $srcdir.
902227fc13Smrg#
917b5fefc8Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
927b5fefc8Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
937b5fefc8Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
947b5fefc8Smrg# and then we would define $MISSING as
957b5fefc8Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
967b5fefc8Smrg# This will work as long as MISSING is not called from configure, because
977b5fefc8Smrg# unfortunately $(top_srcdir) has no meaning in configure.
987b5fefc8Smrg# However there are other variables, like CC, which are often used in
997b5fefc8Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1002227fc13Smrg#
1017b5fefc8Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1027b5fefc8Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1037b5fefc8Smrg# configured tree to be moved without reconfiguration.
1047b5fefc8Smrg
1057b5fefc8SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1067b5fefc8Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1077b5fefc8Smrg# Expand $ac_aux_dir to an absolute path.
1087b5fefc8Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1092227fc13Smrg])
110644fc5c1Stron
1117b5fefc8Smrg# Do all the work for Automake.                             -*- Autoconf -*-
112644fc5c1Stron
1137b5fefc8Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
1142227fc13Smrg#
1157b5fefc8Smrg# This file is free software; the Free Software Foundation
1167b5fefc8Smrg# gives unlimited permission to copy and/or distribute it,
1177b5fefc8Smrg# with or without modifications, as long as this notice is preserved.
118644fc5c1Stron
1197b5fefc8Smrg# This macro actually does too much.  Some checks are only needed if
1207b5fefc8Smrg# your package does certain things.  But this isn't really a big deal.
121644fc5c1Stron
1227b5fefc8Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
1237b5fefc8Smrgm4_define([AC_PROG_CC],
1247b5fefc8Smrgm4_defn([AC_PROG_CC])
1257b5fefc8Smrg[_AM_PROG_CC_C_O
1262227fc13Smrg])
127644fc5c1Stron
1287b5fefc8Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
1297b5fefc8Smrg# AM_INIT_AUTOMAKE([OPTIONS])
1307b5fefc8Smrg# -----------------------------------------------
1317b5fefc8Smrg# The call with PACKAGE and VERSION arguments is the old style
1327b5fefc8Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
1337b5fefc8Smrg# and VERSION should now be passed to AC_INIT and removed from
1347b5fefc8Smrg# the call to AM_INIT_AUTOMAKE.
1357b5fefc8Smrg# We support both call styles for the transition.  After
1367b5fefc8Smrg# the next Automake release, Autoconf can make the AC_INIT
1377b5fefc8Smrg# arguments mandatory, and then we can depend on a new Autoconf
1387b5fefc8Smrg# release and drop the old call support.
1397b5fefc8SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
1407b5fefc8Smrg[AC_PREREQ([2.65])dnl
1417b5fefc8Smrgm4_ifdef([_$0_ALREADY_INIT],
1427b5fefc8Smrg  [m4_fatal([$0 expanded multiple times
1437b5fefc8Smrg]m4_defn([_$0_ALREADY_INIT]))],
1447b5fefc8Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
1457b5fefc8Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
1467b5fefc8Smrgdnl the ones we care about.
1477b5fefc8Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
1487b5fefc8SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
1497b5fefc8SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
1507b5fefc8Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
1517b5fefc8Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
1527b5fefc8Smrg  # is not polluted with repeated "-I."
1537b5fefc8Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
1547b5fefc8Smrg  # test to see if srcdir already configured
1557b5fefc8Smrg  if test -f $srcdir/config.status; then
1567b5fefc8Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1577b5fefc8Smrg  fi
1587b5fefc8Smrgfi
159644fc5c1Stron
1607b5fefc8Smrg# test whether we have cygpath
1617b5fefc8Smrgif test -z "$CYGPATH_W"; then
1627b5fefc8Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
1637b5fefc8Smrg    CYGPATH_W='cygpath -w'
1647b5fefc8Smrg  else
1657b5fefc8Smrg    CYGPATH_W=echo
1667b5fefc8Smrg  fi
1677b5fefc8Smrgfi
1687b5fefc8SmrgAC_SUBST([CYGPATH_W])
1692227fc13Smrg
1707b5fefc8Smrg# Define the identity of the package.
1717b5fefc8Smrgdnl Distinguish between old-style and new-style calls.
1727b5fefc8Smrgm4_ifval([$2],
1737b5fefc8Smrg[AC_DIAGNOSE([obsolete],
1747b5fefc8Smrg             [$0: two- and three-arguments forms are deprecated.])
1757b5fefc8Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
1767b5fefc8Smrg AC_SUBST([PACKAGE], [$1])dnl
1777b5fefc8Smrg AC_SUBST([VERSION], [$2])],
1787b5fefc8Smrg[_AM_SET_OPTIONS([$1])dnl
1797b5fefc8Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
1807b5fefc8Smrgm4_if(
1817b5fefc8Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
1827b5fefc8Smrg  [ok:ok],,
1837b5fefc8Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
1847b5fefc8Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
1857b5fefc8Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
186644fc5c1Stron
1877b5fefc8Smrg_AM_IF_OPTION([no-define],,
1887b5fefc8Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
1897b5fefc8Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
1902227fc13Smrg
1917b5fefc8Smrg# Some tools Automake needs.
1927b5fefc8SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
1937b5fefc8SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
1947b5fefc8SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
1957b5fefc8SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
1967b5fefc8SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
1977b5fefc8SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
1987b5fefc8SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
1997b5fefc8SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2007b5fefc8SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2017b5fefc8SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
2027b5fefc8Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
2037b5fefc8Smrg# dies out for good.  For more background, see:
2047b5fefc8Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2057b5fefc8Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2067b5fefc8SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2077b5fefc8Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
2087b5fefc8Smrg# system "awk" is bad on some platforms.
2097b5fefc8SmrgAC_REQUIRE([AC_PROG_AWK])dnl
2107b5fefc8SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
2117b5fefc8SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
2127b5fefc8Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2137b5fefc8Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2147b5fefc8Smrg			     [_AM_PROG_TAR([v7])])])
2157b5fefc8Smrg_AM_IF_OPTION([no-dependencies],,
2167b5fefc8Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
2177b5fefc8Smrg		  [_AM_DEPENDENCIES([CC])],
2187b5fefc8Smrg		  [m4_define([AC_PROG_CC],
2197b5fefc8Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2207b5fefc8SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
2217b5fefc8Smrg		  [_AM_DEPENDENCIES([CXX])],
2227b5fefc8Smrg		  [m4_define([AC_PROG_CXX],
2237b5fefc8Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2247b5fefc8SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
2257b5fefc8Smrg		  [_AM_DEPENDENCIES([OBJC])],
2267b5fefc8Smrg		  [m4_define([AC_PROG_OBJC],
2277b5fefc8Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2287b5fefc8SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2297b5fefc8Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
2307b5fefc8Smrg		  [m4_define([AC_PROG_OBJCXX],
2317b5fefc8Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
232644fc5c1Stron])
2337b5fefc8Smrg# Variables for tags utilities; see am/tags.am
2347b5fefc8Smrgif test -z "$CTAGS"; then
2357b5fefc8Smrg  CTAGS=ctags
2367b5fefc8Smrgfi
2377b5fefc8SmrgAC_SUBST([CTAGS])
2387b5fefc8Smrgif test -z "$ETAGS"; then
2397b5fefc8Smrg  ETAGS=etags
2407b5fefc8Smrgfi
2417b5fefc8SmrgAC_SUBST([ETAGS])
2427b5fefc8Smrgif test -z "$CSCOPE"; then
2437b5fefc8Smrg  CSCOPE=cscope
2447b5fefc8Smrgfi
2457b5fefc8SmrgAC_SUBST([CSCOPE])
2462227fc13Smrg
2477b5fefc8SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
2487b5fefc8Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
2497b5fefc8Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2507b5fefc8Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2517b5fefc8SmrgAC_CONFIG_COMMANDS_PRE(dnl
2527b5fefc8Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
2537b5fefc8Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2542227fc13Smrg
2557b5fefc8Smrg# POSIX will say in a future version that running "rm -f" with no argument
2567b5fefc8Smrg# is OK; and we want to be able to make that assumption in our Makefile
2577b5fefc8Smrg# recipes.  So use an aggressive probe to check that the usage we want is
2587b5fefc8Smrg# actually supported "in the wild" to an acceptable degree.
2597b5fefc8Smrg# See automake bug#10828.
2607b5fefc8Smrg# To make any issue more visible, cause the running configure to be aborted
2617b5fefc8Smrg# by default if the 'rm' program in use doesn't match our expectations; the
2627b5fefc8Smrg# user can still override this though.
2637b5fefc8Smrgif rm -f && rm -fr && rm -rf; then : OK; else
2647b5fefc8Smrg  cat >&2 <<'END'
2657b5fefc8SmrgOops!
2667b5fefc8Smrg
2677b5fefc8SmrgYour 'rm' program seems unable to run without file operands specified
2687b5fefc8Smrgon the command line, even when the '-f' option is present.  This is contrary
2697b5fefc8Smrgto the behaviour of most rm programs out there, and not conforming with
2707b5fefc8Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2717b5fefc8Smrg
2727b5fefc8SmrgPlease tell bug-automake@gnu.org about your system, including the value
2737b5fefc8Smrgof your $PATH and any error possibly output before this message.  This
2747b5fefc8Smrgcan help us improve future automake versions.
2752227fc13Smrg
2767b5fefc8SmrgEND
2777b5fefc8Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
2787b5fefc8Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
2797b5fefc8Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
2807b5fefc8Smrg    echo >&2
2817b5fefc8Smrg  else
2827b5fefc8Smrg    cat >&2 <<'END'
2837b5fefc8SmrgAborting the configuration process, to ensure you take notice of the issue.
2842227fc13Smrg
2857b5fefc8SmrgYou can download and install GNU coreutils to get an 'rm' implementation
2867b5fefc8Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
2872227fc13Smrg
2887b5fefc8SmrgIf you want to complete the configuration process using your problematic
2897b5fefc8Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
2907b5fefc8Smrgto "yes", and re-run configure.
2917b5fefc8Smrg
2927b5fefc8SmrgEND
2937b5fefc8Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
2947b5fefc8Smrg  fi
2957b5fefc8Smrgfi
2967b5fefc8Smrgdnl The trailing newline in this macro's definition is deliberate, for
2977b5fefc8Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
2987b5fefc8Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
299644fc5c1Stron])
300644fc5c1Stron
3017b5fefc8Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
3027b5fefc8Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
3037b5fefc8Smrgdnl mangled by Autoconf and run in a shell conditional statement.
3047b5fefc8Smrgm4_define([_AC_COMPILER_EXEEXT],
3057b5fefc8Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
306644fc5c1Stron
3077b5fefc8Smrg# When config.status generates a header, we must update the stamp-h file.
3087b5fefc8Smrg# This file resides in the same directory as the config header
3097b5fefc8Smrg# that is generated.  The stamp files are numbered to have different names.
310644fc5c1Stron
3117b5fefc8Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
3127b5fefc8Smrg# loop where config.status creates the headers, so we can generate
3137b5fefc8Smrg# our stamp files there.
3147b5fefc8SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
3157b5fefc8Smrg[# Compute $1's index in $config_headers.
3167b5fefc8Smrg_am_arg=$1
3177b5fefc8Smrg_am_stamp_count=1
3187b5fefc8Smrgfor _am_header in $config_headers :; do
3197b5fefc8Smrg  case $_am_header in
3207b5fefc8Smrg    $_am_arg | $_am_arg:* )
3217b5fefc8Smrg      break ;;
3227b5fefc8Smrg    * )
3237b5fefc8Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
3247b5fefc8Smrg  esac
3257b5fefc8Smrgdone
3267b5fefc8Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
3272227fc13Smrg
3287b5fefc8Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
3297b5fefc8Smrg#
3307b5fefc8Smrg# This file is free software; the Free Software Foundation
3317b5fefc8Smrg# gives unlimited permission to copy and/or distribute it,
3327b5fefc8Smrg# with or without modifications, as long as this notice is preserved.
3332227fc13Smrg
3347b5fefc8Smrg# AM_PROG_INSTALL_SH
3357b5fefc8Smrg# ------------------
3367b5fefc8Smrg# Define $install_sh.
3377b5fefc8SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
3387b5fefc8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3397b5fefc8Smrgif test x"${install_sh+set}" != xset; then
3407b5fefc8Smrg  case $am_aux_dir in
3417b5fefc8Smrg  *\ * | *\	*)
3427b5fefc8Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
3437b5fefc8Smrg  *)
3447b5fefc8Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
3457b5fefc8Smrg  esac
3467b5fefc8Smrgfi
3477b5fefc8SmrgAC_SUBST([install_sh])])
3482227fc13Smrg
3497b5fefc8Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
3502227fc13Smrg#
3517b5fefc8Smrg# This file is free software; the Free Software Foundation
3527b5fefc8Smrg# gives unlimited permission to copy and/or distribute it,
3537b5fefc8Smrg# with or without modifications, as long as this notice is preserved.
3542227fc13Smrg
3557b5fefc8Smrg# Check whether the underlying file-system supports filenames
3567b5fefc8Smrg# with a leading dot.  For instance MS-DOS doesn't.
3577b5fefc8SmrgAC_DEFUN([AM_SET_LEADING_DOT],
3587b5fefc8Smrg[rm -rf .tst 2>/dev/null
3597b5fefc8Smrgmkdir .tst 2>/dev/null
3607b5fefc8Smrgif test -d .tst; then
3617b5fefc8Smrg  am__leading_dot=.
3627b5fefc8Smrgelse
3637b5fefc8Smrg  am__leading_dot=_
3647b5fefc8Smrgfi
3657b5fefc8Smrgrmdir .tst 2>/dev/null
3667b5fefc8SmrgAC_SUBST([am__leading_dot])])
3672227fc13Smrg
3687b5fefc8Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
3692227fc13Smrg
3707b5fefc8Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
3712227fc13Smrg#
3727b5fefc8Smrg# This file is free software; the Free Software Foundation
3737b5fefc8Smrg# gives unlimited permission to copy and/or distribute it,
3747b5fefc8Smrg# with or without modifications, as long as this notice is preserved.
375644fc5c1Stron
3767b5fefc8Smrg# AM_MISSING_PROG(NAME, PROGRAM)
3777b5fefc8Smrg# ------------------------------
3787b5fefc8SmrgAC_DEFUN([AM_MISSING_PROG],
3797b5fefc8Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
3807b5fefc8Smrg$1=${$1-"${am_missing_run}$2"}
3817b5fefc8SmrgAC_SUBST($1)])
3827b5fefc8Smrg
3837b5fefc8Smrg# AM_MISSING_HAS_RUN
3847b5fefc8Smrg# ------------------
3857b5fefc8Smrg# Define MISSING if not defined so far and test if it is modern enough.
3867b5fefc8Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
3877b5fefc8SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
3887b5fefc8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3897b5fefc8SmrgAC_REQUIRE_AUX_FILE([missing])dnl
3907b5fefc8Smrgif test x"${MISSING+set}" != xset; then
3917b5fefc8Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
3927b5fefc8Smrgfi
3937b5fefc8Smrg# Use eval to expand $SHELL
3947b5fefc8Smrgif eval "$MISSING --is-lightweight"; then
3957b5fefc8Smrg  am_missing_run="$MISSING "
3967b5fefc8Smrgelse
3977b5fefc8Smrg  am_missing_run=
3987b5fefc8Smrg  AC_MSG_WARN(['missing' script is too old or missing])
3997b5fefc8Smrgfi
4007b5fefc8Smrg])
4017b5fefc8Smrg
4027b5fefc8Smrg# Helper functions for option handling.                     -*- Autoconf -*-
403644fc5c1Stron
4047b5fefc8Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
4052227fc13Smrg#
4067b5fefc8Smrg# This file is free software; the Free Software Foundation
4077b5fefc8Smrg# gives unlimited permission to copy and/or distribute it,
4087b5fefc8Smrg# with or without modifications, as long as this notice is preserved.
4097b5fefc8Smrg
4107b5fefc8Smrg# _AM_MANGLE_OPTION(NAME)
4117b5fefc8Smrg# -----------------------
4127b5fefc8SmrgAC_DEFUN([_AM_MANGLE_OPTION],
4137b5fefc8Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
4147b5fefc8Smrg
4157b5fefc8Smrg# _AM_SET_OPTION(NAME)
4167b5fefc8Smrg# --------------------
4177b5fefc8Smrg# Set option NAME.  Presently that only means defining a flag for this option.
4187b5fefc8SmrgAC_DEFUN([_AM_SET_OPTION],
4197b5fefc8Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
4207b5fefc8Smrg
4217b5fefc8Smrg# _AM_SET_OPTIONS(OPTIONS)
4227b5fefc8Smrg# ------------------------
4237b5fefc8Smrg# OPTIONS is a space-separated list of Automake options.
4247b5fefc8SmrgAC_DEFUN([_AM_SET_OPTIONS],
4257b5fefc8Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
4267b5fefc8Smrg
4277b5fefc8Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
4287b5fefc8Smrg# -------------------------------------------
4297b5fefc8Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
4307b5fefc8SmrgAC_DEFUN([_AM_IF_OPTION],
4317b5fefc8Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
4327b5fefc8Smrg
4337b5fefc8Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
4347b5fefc8Smrg
4357b5fefc8Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4362227fc13Smrg#
4377b5fefc8Smrg# This file is free software; the Free Software Foundation
4387b5fefc8Smrg# gives unlimited permission to copy and/or distribute it,
4397b5fefc8Smrg# with or without modifications, as long as this notice is preserved.
4407b5fefc8Smrg
4417b5fefc8Smrg# AM_SANITY_CHECK
4427b5fefc8Smrg# ---------------
4437b5fefc8SmrgAC_DEFUN([AM_SANITY_CHECK],
4447b5fefc8Smrg[AC_MSG_CHECKING([whether build environment is sane])
4457b5fefc8Smrg# Reject unsafe characters in $srcdir or the absolute working directory
4467b5fefc8Smrg# name.  Accept space and tab only in the latter.
4477b5fefc8Smrgam_lf='
4487b5fefc8Smrg'
4497b5fefc8Smrgcase `pwd` in
4507b5fefc8Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
4517b5fefc8Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
4527b5fefc8Smrgesac
4537b5fefc8Smrgcase $srcdir in
4547b5fefc8Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
4557b5fefc8Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
4567b5fefc8Smrgesac
4577b5fefc8Smrg
4587b5fefc8Smrg# Do 'set' in a subshell so we don't clobber the current shell's
4597b5fefc8Smrg# arguments.  Must try -L first in case configure is actually a
4607b5fefc8Smrg# symlink; some systems play weird games with the mod time of symlinks
4617b5fefc8Smrg# (eg FreeBSD returns the mod time of the symlink's containing
4627b5fefc8Smrg# directory).
4637b5fefc8Smrgif (
4647b5fefc8Smrg   am_has_slept=no
4657b5fefc8Smrg   for am_try in 1 2; do
4667b5fefc8Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
4677b5fefc8Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
4687b5fefc8Smrg     if test "$[*]" = "X"; then
4697b5fefc8Smrg	# -L didn't work.
4707b5fefc8Smrg	set X `ls -t "$srcdir/configure" conftest.file`
4717b5fefc8Smrg     fi
4727b5fefc8Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
4737b5fefc8Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
4747b5fefc8Smrg
4757b5fefc8Smrg	# If neither matched, then we have a broken ls.  This can happen
4767b5fefc8Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
4777b5fefc8Smrg	# broken ls alias from the environment.  This has actually
4787b5fefc8Smrg	# happened.  Such a system could not be considered "sane".
4797b5fefc8Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
4807b5fefc8Smrg  alias in your environment])
4817b5fefc8Smrg     fi
4827b5fefc8Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
4837b5fefc8Smrg       break
4847b5fefc8Smrg     fi
4857b5fefc8Smrg     # Just in case.
4867b5fefc8Smrg     sleep 1
4877b5fefc8Smrg     am_has_slept=yes
4887b5fefc8Smrg   done
4897b5fefc8Smrg   test "$[2]" = conftest.file
4907b5fefc8Smrg   )
4917b5fefc8Smrgthen
4927b5fefc8Smrg   # Ok.
4937b5fefc8Smrg   :
4947b5fefc8Smrgelse
4957b5fefc8Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
4967b5fefc8SmrgCheck your system clock])
4977b5fefc8Smrgfi
4987b5fefc8SmrgAC_MSG_RESULT([yes])
4997b5fefc8Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
5007b5fefc8Smrg# generated files are strictly newer.
5017b5fefc8Smrgam_sleep_pid=
5027b5fefc8Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
5037b5fefc8Smrg  ( sleep 1 ) &
5047b5fefc8Smrg  am_sleep_pid=$!
5057b5fefc8Smrgfi
5067b5fefc8SmrgAC_CONFIG_COMMANDS_PRE(
5077b5fefc8Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
5087b5fefc8Smrg   if test -n "$am_sleep_pid"; then
5097b5fefc8Smrg     # Hide warnings about reused PIDs.
5107b5fefc8Smrg     wait $am_sleep_pid 2>/dev/null
5117b5fefc8Smrg   fi
5127b5fefc8Smrg   AC_MSG_RESULT([done])])
5137b5fefc8Smrgrm -f conftest.file
5147b5fefc8Smrg])
5157b5fefc8Smrg
5167b5fefc8Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
5172227fc13Smrg#
5187b5fefc8Smrg# This file is free software; the Free Software Foundation
5197b5fefc8Smrg# gives unlimited permission to copy and/or distribute it,
5207b5fefc8Smrg# with or without modifications, as long as this notice is preserved.
5217b5fefc8Smrg
5227b5fefc8Smrg# AM_SILENT_RULES([DEFAULT])
5237b5fefc8Smrg# --------------------------
5247b5fefc8Smrg# Enable less verbose build rules; with the default set to DEFAULT
5257b5fefc8Smrg# ("yes" being less verbose, "no" or empty being verbose).
5267b5fefc8SmrgAC_DEFUN([AM_SILENT_RULES],
5277b5fefc8Smrg[AC_ARG_ENABLE([silent-rules], [dnl
5287b5fefc8SmrgAS_HELP_STRING(
5297b5fefc8Smrg  [--enable-silent-rules],
5307b5fefc8Smrg  [less verbose build output (undo: "make V=1")])
5317b5fefc8SmrgAS_HELP_STRING(
5327b5fefc8Smrg  [--disable-silent-rules],
5337b5fefc8Smrg  [verbose build output (undo: "make V=0")])dnl
5347b5fefc8Smrg])
5357b5fefc8Smrgcase $enable_silent_rules in @%:@ (((
5367b5fefc8Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
5377b5fefc8Smrg   no) AM_DEFAULT_VERBOSITY=1;;
5387b5fefc8Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
5397b5fefc8Smrgesac
5407b5fefc8Smrgdnl
5417b5fefc8Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
5427b5fefc8Smrgdnl do not support nested variable expansions.
5437b5fefc8Smrgdnl See automake bug#9928 and bug#10237.
5447b5fefc8Smrgam_make=${MAKE-make}
5457b5fefc8SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
5467b5fefc8Smrg   [am_cv_make_support_nested_variables],
5477b5fefc8Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
5487b5fefc8SmrgBAR0=false
5497b5fefc8SmrgBAR1=true
5507b5fefc8SmrgV=1
5517b5fefc8Smrgam__doit:
5527b5fefc8Smrg	@$(TRUE)
5537b5fefc8Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
5547b5fefc8Smrg  am_cv_make_support_nested_variables=yes
5557b5fefc8Smrgelse
5567b5fefc8Smrg  am_cv_make_support_nested_variables=no
5577b5fefc8Smrgfi])
5587b5fefc8Smrgif test $am_cv_make_support_nested_variables = yes; then
5597b5fefc8Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
5607b5fefc8Smrg  AM_V='$(V)'
5617b5fefc8Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
5627b5fefc8Smrgelse
5637b5fefc8Smrg  AM_V=$AM_DEFAULT_VERBOSITY
5647b5fefc8Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
5657b5fefc8Smrgfi
5667b5fefc8SmrgAC_SUBST([AM_V])dnl
5677b5fefc8SmrgAM_SUBST_NOTMAKE([AM_V])dnl
5687b5fefc8SmrgAC_SUBST([AM_DEFAULT_V])dnl
5697b5fefc8SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
5707b5fefc8SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
5717b5fefc8SmrgAM_BACKSLASH='\'
5727b5fefc8SmrgAC_SUBST([AM_BACKSLASH])dnl
5737b5fefc8Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
5747b5fefc8Smrg])
5757b5fefc8Smrg
5767b5fefc8Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
5772227fc13Smrg#
5787b5fefc8Smrg# This file is free software; the Free Software Foundation
5797b5fefc8Smrg# gives unlimited permission to copy and/or distribute it,
5807b5fefc8Smrg# with or without modifications, as long as this notice is preserved.
581644fc5c1Stron
5827b5fefc8Smrg# AM_PROG_INSTALL_STRIP
5837b5fefc8Smrg# ---------------------
5847b5fefc8Smrg# One issue with vendor 'install' (even GNU) is that you can't
5857b5fefc8Smrg# specify the program used to strip binaries.  This is especially
5867b5fefc8Smrg# annoying in cross-compiling environments, where the build's strip
5877b5fefc8Smrg# is unlikely to handle the host's binaries.
5887b5fefc8Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
5897b5fefc8Smrg# always use install-sh in "make install-strip", and initialize
5907b5fefc8Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
5917b5fefc8SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
5927b5fefc8Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
5937b5fefc8Smrg# Installed binaries are usually stripped using 'strip' when the user
5947b5fefc8Smrg# run "make install-strip".  However 'strip' might not be the right
5957b5fefc8Smrg# tool to use in cross-compilation environments, therefore Automake
5967b5fefc8Smrg# will honor the 'STRIP' environment variable to overrule this program.
5977b5fefc8Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
5987b5fefc8Smrgif test "$cross_compiling" != no; then
5997b5fefc8Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
6007b5fefc8Smrgfi
6017b5fefc8SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
6027b5fefc8SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
6037b5fefc8Smrg
6047b5fefc8Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
6057b5fefc8Smrg#
6067b5fefc8Smrg# This file is free software; the Free Software Foundation
6077b5fefc8Smrg# gives unlimited permission to copy and/or distribute it,
6087b5fefc8Smrg# with or without modifications, as long as this notice is preserved.
6097b5fefc8Smrg
6107b5fefc8Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
6117b5fefc8Smrg# ---------------------------
6127b5fefc8Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
6137b5fefc8Smrg# This macro is traced by Automake.
6147b5fefc8SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
6157b5fefc8Smrg
6167b5fefc8Smrg# AM_SUBST_NOTMAKE(VARIABLE)
6177b5fefc8Smrg# --------------------------
6187b5fefc8Smrg# Public sister of _AM_SUBST_NOTMAKE.
6197b5fefc8SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
6207b5fefc8Smrg
6217b5fefc8Smrg# Check how to create a tarball.                            -*- Autoconf -*-
6227b5fefc8Smrg
6237b5fefc8Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
6247b5fefc8Smrg#
6257b5fefc8Smrg# This file is free software; the Free Software Foundation
6267b5fefc8Smrg# gives unlimited permission to copy and/or distribute it,
6277b5fefc8Smrg# with or without modifications, as long as this notice is preserved.
6287b5fefc8Smrg
6297b5fefc8Smrg# _AM_PROG_TAR(FORMAT)
6307b5fefc8Smrg# --------------------
6317b5fefc8Smrg# Check how to create a tarball in format FORMAT.
6327b5fefc8Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
6337b5fefc8Smrg#
6347b5fefc8Smrg# Substitute a variable $(am__tar) that is a command
6357b5fefc8Smrg# writing to stdout a FORMAT-tarball containing the directory
6367b5fefc8Smrg# $tardir.
6377b5fefc8Smrg#     tardir=directory && $(am__tar) > result.tar
6387b5fefc8Smrg#
6397b5fefc8Smrg# Substitute a variable $(am__untar) that extract such
6407b5fefc8Smrg# a tarball read from stdin.
6417b5fefc8Smrg#     $(am__untar) < result.tar
6427b5fefc8Smrg#
6437b5fefc8SmrgAC_DEFUN([_AM_PROG_TAR],
6447b5fefc8Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
6457b5fefc8Smrg# in the wild :-(  We should find a proper way to deprecate it ...
6467b5fefc8SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
6477b5fefc8Smrg
6487b5fefc8Smrg# We'll loop over all known methods to create a tar archive until one works.
6497b5fefc8Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
6507b5fefc8Smrg
6517b5fefc8Smrgm4_if([$1], [v7],
6527b5fefc8Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
6537b5fefc8Smrg
6547b5fefc8Smrg  [m4_case([$1],
6557b5fefc8Smrg    [ustar],
6567b5fefc8Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
6577b5fefc8Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
6587b5fefc8Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
6597b5fefc8Smrg      # and bug#13588).
6607b5fefc8Smrg      am_max_uid=2097151 # 2^21 - 1
6617b5fefc8Smrg      am_max_gid=$am_max_uid
6627b5fefc8Smrg      # The $UID and $GID variables are not portable, so we need to resort
6637b5fefc8Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
6647b5fefc8Smrg      # below are definitely unexpected, so allow the users to see them
6657b5fefc8Smrg      # (that is, avoid stderr redirection).
6667b5fefc8Smrg      am_uid=`id -u || echo unknown`
6677b5fefc8Smrg      am_gid=`id -g || echo unknown`
6687b5fefc8Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
6697b5fefc8Smrg      if test $am_uid -le $am_max_uid; then
6707b5fefc8Smrg         AC_MSG_RESULT([yes])
6717b5fefc8Smrg      else
6727b5fefc8Smrg         AC_MSG_RESULT([no])
6737b5fefc8Smrg         _am_tools=none
6747b5fefc8Smrg      fi
6757b5fefc8Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
6767b5fefc8Smrg      if test $am_gid -le $am_max_gid; then
6777b5fefc8Smrg         AC_MSG_RESULT([yes])
6787b5fefc8Smrg      else
6797b5fefc8Smrg        AC_MSG_RESULT([no])
6807b5fefc8Smrg        _am_tools=none
6817b5fefc8Smrg      fi],
6827b5fefc8Smrg
6837b5fefc8Smrg  [pax],
6847b5fefc8Smrg    [],
6857b5fefc8Smrg
6867b5fefc8Smrg  [m4_fatal([Unknown tar format])])
6877b5fefc8Smrg
6887b5fefc8Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
6897b5fefc8Smrg
6907b5fefc8Smrg  # Go ahead even if we have the value already cached.  We do so because we
6917b5fefc8Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
6927b5fefc8Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
6937b5fefc8Smrg
6947b5fefc8Smrg  for _am_tool in $_am_tools; do
6957b5fefc8Smrg    case $_am_tool in
6967b5fefc8Smrg    gnutar)
6977b5fefc8Smrg      for _am_tar in tar gnutar gtar; do
6987b5fefc8Smrg        AM_RUN_LOG([$_am_tar --version]) && break
6997b5fefc8Smrg      done
7007b5fefc8Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
7017b5fefc8Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
7027b5fefc8Smrg      am__untar="$_am_tar -xf -"
7037b5fefc8Smrg      ;;
7047b5fefc8Smrg    plaintar)
7057b5fefc8Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
7067b5fefc8Smrg      # ustar tarball either.
7077b5fefc8Smrg      (tar --version) >/dev/null 2>&1 && continue
7087b5fefc8Smrg      am__tar='tar chf - "$$tardir"'
7097b5fefc8Smrg      am__tar_='tar chf - "$tardir"'
7107b5fefc8Smrg      am__untar='tar xf -'
7117b5fefc8Smrg      ;;
7127b5fefc8Smrg    pax)
7137b5fefc8Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
7147b5fefc8Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
7157b5fefc8Smrg      am__untar='pax -r'
7167b5fefc8Smrg      ;;
7177b5fefc8Smrg    cpio)
7187b5fefc8Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
7197b5fefc8Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
7207b5fefc8Smrg      am__untar='cpio -i -H $1 -d'
7217b5fefc8Smrg      ;;
7227b5fefc8Smrg    none)
7237b5fefc8Smrg      am__tar=false
7247b5fefc8Smrg      am__tar_=false
7257b5fefc8Smrg      am__untar=false
7267b5fefc8Smrg      ;;
7277b5fefc8Smrg    esac
7287b5fefc8Smrg
7297b5fefc8Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
7307b5fefc8Smrg    # and am__untar set.
7317b5fefc8Smrg    test -n "${am_cv_prog_tar_$1}" && break
7327b5fefc8Smrg
7337b5fefc8Smrg    # tar/untar a dummy directory, and stop if the command works.
7347b5fefc8Smrg    rm -rf conftest.dir
7357b5fefc8Smrg    mkdir conftest.dir
7367b5fefc8Smrg    echo GrepMe > conftest.dir/file
7377b5fefc8Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
7387b5fefc8Smrg    rm -rf conftest.dir
7397b5fefc8Smrg    if test -s conftest.tar; then
7407b5fefc8Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
7417b5fefc8Smrg      AM_RUN_LOG([cat conftest.dir/file])
7427b5fefc8Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
7437b5fefc8Smrg    fi
7447b5fefc8Smrg  done
7457b5fefc8Smrg  rm -rf conftest.dir
7467b5fefc8Smrg
7477b5fefc8Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
7487b5fefc8Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
7497b5fefc8Smrg
7507b5fefc8SmrgAC_SUBST([am__tar])
7517b5fefc8SmrgAC_SUBST([am__untar])
7527b5fefc8Smrg]) # _AM_PROG_TAR
7537b5fefc8Smrg
7547b5fefc8Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
7557b5fefc8Smrgdnl serial 11 (pkg-config-0.29)
7567b5fefc8Smrgdnl
7577b5fefc8Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
7587b5fefc8Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
7597b5fefc8Smrgdnl
7607b5fefc8Smrgdnl This program is free software; you can redistribute it and/or modify
7617b5fefc8Smrgdnl it under the terms of the GNU General Public License as published by
7627b5fefc8Smrgdnl the Free Software Foundation; either version 2 of the License, or
7637b5fefc8Smrgdnl (at your option) any later version.
7647b5fefc8Smrgdnl
7657b5fefc8Smrgdnl This program is distributed in the hope that it will be useful, but
7667b5fefc8Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
7677b5fefc8Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7687b5fefc8Smrgdnl General Public License for more details.
7697b5fefc8Smrgdnl
7707b5fefc8Smrgdnl You should have received a copy of the GNU General Public License
7717b5fefc8Smrgdnl along with this program; if not, write to the Free Software
7727b5fefc8Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
7737b5fefc8Smrgdnl 02111-1307, USA.
7747b5fefc8Smrgdnl
7757b5fefc8Smrgdnl As a special exception to the GNU General Public License, if you
7767b5fefc8Smrgdnl distribute this file as part of a program that contains a
7777b5fefc8Smrgdnl configuration script generated by Autoconf, you may include it under
7787b5fefc8Smrgdnl the same distribution terms that you use for the rest of that
7797b5fefc8Smrgdnl program.
7807b5fefc8Smrg
7817b5fefc8Smrgdnl PKG_PREREQ(MIN-VERSION)
7827b5fefc8Smrgdnl -----------------------
7837b5fefc8Smrgdnl Since: 0.29
7847b5fefc8Smrgdnl
7857b5fefc8Smrgdnl Verify that the version of the pkg-config macros are at least
7867b5fefc8Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
7877b5fefc8Smrgdnl installed version of pkg-config, this checks the developer's version
7887b5fefc8Smrgdnl of pkg.m4 when generating configure.
7897b5fefc8Smrgdnl
7907b5fefc8Smrgdnl To ensure that this macro is defined, also add:
7917b5fefc8Smrgdnl m4_ifndef([PKG_PREREQ],
7927b5fefc8Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
7937b5fefc8Smrgdnl
7947b5fefc8Smrgdnl See the "Since" comment for each macro you use to see what version
7957b5fefc8Smrgdnl of the macros you require.
7967b5fefc8Smrgm4_defun([PKG_PREREQ],
7977b5fefc8Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
7987b5fefc8Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
7997b5fefc8Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
8007b5fefc8Smrg])dnl PKG_PREREQ
8017b5fefc8Smrg
8027b5fefc8Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
8037b5fefc8Smrgdnl ----------------------------------
8047b5fefc8Smrgdnl Since: 0.16
8057b5fefc8Smrgdnl
8067b5fefc8Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
8077b5fefc8Smrgdnl first found in the path. Checks that the version of pkg-config found
8087b5fefc8Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
8097b5fefc8Smrgdnl used since that's the first version where most current features of
8107b5fefc8Smrgdnl pkg-config existed.
8112227fc13SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8122227fc13Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8137b5fefc8Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8147b5fefc8Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
8152227fc13SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
8162227fc13SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
8172227fc13SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
8182227fc13Smrg
8192227fc13Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8202227fc13Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
8212227fc13Smrgfi
8222227fc13Smrgif test -n "$PKG_CONFIG"; then
8232227fc13Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
8242227fc13Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
8252227fc13Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
8262227fc13Smrg		AC_MSG_RESULT([yes])
8272227fc13Smrg	else
8282227fc13Smrg		AC_MSG_RESULT([no])
8292227fc13Smrg		PKG_CONFIG=""
8302227fc13Smrg	fi
8312227fc13Smrgfi[]dnl
8327b5fefc8Smrg])dnl PKG_PROG_PKG_CONFIG
833644fc5c1Stron
8347b5fefc8Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
8357b5fefc8Smrgdnl -------------------------------------------------------------------
8367b5fefc8Smrgdnl Since: 0.18
8377b5fefc8Smrgdnl
8387b5fefc8Smrgdnl Check to see whether a particular set of modules exists. Similar to
8397b5fefc8Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
8407b5fefc8Smrgdnl
8417b5fefc8Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
8427b5fefc8Smrgdnl only at the first occurence in configure.ac, so if the first place
8437b5fefc8Smrgdnl it's called might be skipped (such as if it is within an "if", you
8447b5fefc8Smrgdnl have to call PKG_CHECK_EXISTS manually
8452227fc13SmrgAC_DEFUN([PKG_CHECK_EXISTS],
8462227fc13Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
8472227fc13Smrgif test -n "$PKG_CONFIG" && \
8482227fc13Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
8492227fc13Smrg  m4_default([$2], [:])
8502227fc13Smrgm4_ifvaln([$3], [else
8512227fc13Smrg  $3])dnl
8522227fc13Smrgfi])
8532227fc13Smrg
8547b5fefc8Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
8557b5fefc8Smrgdnl ---------------------------------------------
8567b5fefc8Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
8577b5fefc8Smrgdnl pkg_failed based on the result.
8582227fc13Smrgm4_define([_PKG_CONFIG],
8592227fc13Smrg[if test -n "$$1"; then
8602227fc13Smrg    pkg_cv_[]$1="$$1"
8612227fc13Smrg elif test -n "$PKG_CONFIG"; then
8622227fc13Smrg    PKG_CHECK_EXISTS([$3],
8637b5fefc8Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
8647b5fefc8Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
8652227fc13Smrg		     [pkg_failed=yes])
8662227fc13Smrg else
8672227fc13Smrg    pkg_failed=untried
8682227fc13Smrgfi[]dnl
8697b5fefc8Smrg])dnl _PKG_CONFIG
8702227fc13Smrg
8717b5fefc8Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
8727b5fefc8Smrgdnl ---------------------------
8737b5fefc8Smrgdnl Internal check to see if pkg-config supports short errors.
8742227fc13SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
8752227fc13Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
8762227fc13Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
8772227fc13Smrg        _pkg_short_errors_supported=yes
8782227fc13Smrgelse
8792227fc13Smrg        _pkg_short_errors_supported=no
8802227fc13Smrgfi[]dnl
8817b5fefc8Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
882644fc5c1Stron
883644fc5c1Stron
8847b5fefc8Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
8857b5fefc8Smrgdnl   [ACTION-IF-NOT-FOUND])
8867b5fefc8Smrgdnl --------------------------------------------------------------
8877b5fefc8Smrgdnl Since: 0.4.0
8887b5fefc8Smrgdnl
8897b5fefc8Smrgdnl Note that if there is a possibility the first call to
8907b5fefc8Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
8917b5fefc8Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
8922227fc13SmrgAC_DEFUN([PKG_CHECK_MODULES],
8932227fc13Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
8942227fc13SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
8952227fc13SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
8962227fc13Smrg
8972227fc13Smrgpkg_failed=no
8982227fc13SmrgAC_MSG_CHECKING([for $1])
8992227fc13Smrg
9002227fc13Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
9012227fc13Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
9022227fc13Smrg
9032227fc13Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
9042227fc13Smrgand $1[]_LIBS to avoid the need to call pkg-config.
9052227fc13SmrgSee the pkg-config man page for more details.])
9062227fc13Smrg
9072227fc13Smrgif test $pkg_failed = yes; then
9082227fc13Smrg   	AC_MSG_RESULT([no])
9092227fc13Smrg        _PKG_SHORT_ERRORS_SUPPORTED
9102227fc13Smrg        if test $_pkg_short_errors_supported = yes; then
9117b5fefc8Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
9122227fc13Smrg        else 
9137b5fefc8Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
9142227fc13Smrg        fi
9152227fc13Smrg	# Put the nasty error message in config.log where it belongs
9162227fc13Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
9172227fc13Smrg
9182227fc13Smrg	m4_default([$4], [AC_MSG_ERROR(
9192227fc13Smrg[Package requirements ($2) were not met:
9202227fc13Smrg
9212227fc13Smrg$$1_PKG_ERRORS
9222227fc13Smrg
9232227fc13SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
9242227fc13Smrginstalled software in a non-standard prefix.
9252227fc13Smrg
9262227fc13Smrg_PKG_TEXT])[]dnl
9272227fc13Smrg        ])
9282227fc13Smrgelif test $pkg_failed = untried; then
9292227fc13Smrg     	AC_MSG_RESULT([no])
9302227fc13Smrg	m4_default([$4], [AC_MSG_FAILURE(
9312227fc13Smrg[The pkg-config script could not be found or is too old.  Make sure it
9322227fc13Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
9332227fc13Smrgpath to pkg-config.
9342227fc13Smrg
9352227fc13Smrg_PKG_TEXT
9362227fc13Smrg
9377b5fefc8SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
9382227fc13Smrg        ])
9392227fc13Smrgelse
9402227fc13Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
9412227fc13Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
9422227fc13Smrg        AC_MSG_RESULT([yes])
9432227fc13Smrg	$3
9442227fc13Smrgfi[]dnl
9457b5fefc8Smrg])dnl PKG_CHECK_MODULES
9462227fc13Smrg
9477b5fefc8Smrg
9487b5fefc8Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
9497b5fefc8Smrgdnl   [ACTION-IF-NOT-FOUND])
9507b5fefc8Smrgdnl ---------------------------------------------------------------------
9517b5fefc8Smrgdnl Since: 0.29
9527b5fefc8Smrgdnl
9537b5fefc8Smrgdnl Checks for existence of MODULES and gathers its build flags with
9547b5fefc8Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
9557b5fefc8Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
9567b5fefc8Smrgdnl
9577b5fefc8Smrgdnl Note that if there is a possibility the first call to
9587b5fefc8Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
9597b5fefc8Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
9607b5fefc8Smrgdnl configure.ac.
9617b5fefc8SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
9627b5fefc8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
9637b5fefc8Smrg_save_PKG_CONFIG=$PKG_CONFIG
9647b5fefc8SmrgPKG_CONFIG="$PKG_CONFIG --static"
9657b5fefc8SmrgPKG_CHECK_MODULES($@)
9667b5fefc8SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
9677b5fefc8Smrg])dnl PKG_CHECK_MODULES_STATIC
9687b5fefc8Smrg
9697b5fefc8Smrg
9707b5fefc8Smrgdnl PKG_INSTALLDIR([DIRECTORY])
9717b5fefc8Smrgdnl -------------------------
9727b5fefc8Smrgdnl Since: 0.27
9737b5fefc8Smrgdnl
9747b5fefc8Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
9757b5fefc8Smrgdnl should install pkg-config .pc files. By default the directory is
9767b5fefc8Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
9777b5fefc8Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
9787b5fefc8Smrgdnl parameter.
9797b5fefc8SmrgAC_DEFUN([PKG_INSTALLDIR],
9807b5fefc8Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
9817b5fefc8Smrgm4_pushdef([pkg_description],
9827b5fefc8Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
9837b5fefc8SmrgAC_ARG_WITH([pkgconfigdir],
9847b5fefc8Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
9857b5fefc8Smrg    [with_pkgconfigdir=]pkg_default)
9867b5fefc8SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
9877b5fefc8Smrgm4_popdef([pkg_default])
9887b5fefc8Smrgm4_popdef([pkg_description])
9897b5fefc8Smrg])dnl PKG_INSTALLDIR
9907b5fefc8Smrg
9917b5fefc8Smrg
9927b5fefc8Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
9937b5fefc8Smrgdnl --------------------------------
9947b5fefc8Smrgdnl Since: 0.27
9957b5fefc8Smrgdnl
9967b5fefc8Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
9977b5fefc8Smrgdnl module should install arch-independent pkg-config .pc files. By
9987b5fefc8Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
9997b5fefc8Smrgdnl changed by passing DIRECTORY. The user can override through the
10007b5fefc8Smrgdnl --with-noarch-pkgconfigdir parameter.
10017b5fefc8SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
10027b5fefc8Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
10037b5fefc8Smrgm4_pushdef([pkg_description],
10047b5fefc8Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
10057b5fefc8SmrgAC_ARG_WITH([noarch-pkgconfigdir],
10067b5fefc8Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
10077b5fefc8Smrg    [with_noarch_pkgconfigdir=]pkg_default)
10087b5fefc8SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
10097b5fefc8Smrgm4_popdef([pkg_default])
10107b5fefc8Smrgm4_popdef([pkg_description])
10117b5fefc8Smrg])dnl PKG_NOARCH_INSTALLDIR
10127b5fefc8Smrg
10137b5fefc8Smrg
10147b5fefc8Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
10157b5fefc8Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10167b5fefc8Smrgdnl -------------------------------------------
10177b5fefc8Smrgdnl Since: 0.28
10187b5fefc8Smrgdnl
10197b5fefc8Smrgdnl Retrieves the value of the pkg-config variable for the given module.
10207b5fefc8SmrgAC_DEFUN([PKG_CHECK_VAR],
10217b5fefc8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
10227b5fefc8SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
10237b5fefc8Smrg
10247b5fefc8Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
10257b5fefc8SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
10267b5fefc8Smrg
10277b5fefc8SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
10287b5fefc8Smrg])dnl PKG_CHECK_VAR
10297b5fefc8Smrg
10307b5fefc8Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
10317b5fefc8Smrgdnl
10327b5fefc8Smrgdnl This file comes from X.Org's font-util 1.4.0
10337b5fefc8Smrgdnl
10347b5fefc8Smrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
10352227fc13Smrgdnl
10362227fc13Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
10372227fc13Smrgdnl copy of this software and associated documentation files (the "Software"),
10382227fc13Smrgdnl to deal in the Software without restriction, including without limitation
10392227fc13Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
10402227fc13Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
10412227fc13Smrgdnl Software is furnished to do so, subject to the following conditions:
10422227fc13Smrgdnl
10432227fc13Smrgdnl The above copyright notice and this permission notice (including the next
10442227fc13Smrgdnl paragraph) shall be included in all copies or substantial portions of the
10452227fc13Smrgdnl Software.
10462227fc13Smrgdnl
10472227fc13Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10482227fc13Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10492227fc13Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
10502227fc13Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10512227fc13Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
10522227fc13Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
10532227fc13Smrgdnl DEALINGS IN THE SOFTWARE.
10547b5fefc8Smrgdnl
10557b5fefc8Smrgdnl --------------------------------------------------------------------
10567b5fefc8Smrgdnl
10577b5fefc8Smrgdnl Copyright 2005 Red Hat, Inc
10587b5fefc8Smrgdnl
10597b5fefc8Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
10607b5fefc8Smrgdnl documentation for any purpose is hereby granted without fee, provided that
10617b5fefc8Smrgdnl the above copyright notice appear in all copies and that both that
10627b5fefc8Smrgdnl copyright notice and this permission notice appear in supporting
10637b5fefc8Smrgdnl documentation.
10647b5fefc8Smrgdnl
10657b5fefc8Smrgdnl The above copyright notice and this permission notice shall be included
10667b5fefc8Smrgdnl in all copies or substantial portions of the Software.
10677b5fefc8Smrgdnl
10687b5fefc8Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10697b5fefc8Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10707b5fefc8Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
10717b5fefc8Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
10727b5fefc8Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
10737b5fefc8Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
10747b5fefc8Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
10757b5fefc8Smrgdnl
10767b5fefc8Smrgdnl Except as contained in this notice, the name of the copyright holders shall
10777b5fefc8Smrgdnl not be used in advertising or otherwise to promote the sale, use or
10787b5fefc8Smrgdnl other dealings in this Software without prior written authorization
10797b5fefc8Smrgdnl from the copyright holders.
10802227fc13Smrg
10817b5fefc8Smrg# XORG_FONT_MACROS_VERSION(required-version)
10827b5fefc8Smrg# ------------------------------------------
10832227fc13Smrg# Minimum version: 1.1.0
10842227fc13Smrg#
10852227fc13Smrg# If you're using a macro added in Version 1.1 or newer, include this in
10862227fc13Smrg# your configure.ac with the minimum required version, such as:
10877b5fefc8Smrg# XORG_FONT_MACROS_VERSION(1.1)
10882227fc13Smrg#
10892227fc13Smrg# To ensure that this macro is defined, also add:
10907b5fefc8Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
10917b5fefc8Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
10922227fc13Smrg#
10932227fc13Smrg#
10947b5fefc8Smrg# See the "minimum version" comment for each macro you use to see what
10952227fc13Smrg# version you require.
10967b5fefc8Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
10977b5fefc8Smrgm4_define([vers_have], [1.4.0])
10982227fc13Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
10992227fc13Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
11002227fc13Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
11017b5fefc8Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
11022227fc13Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
11037b5fefc8Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
11042227fc13Smrgm4_undefine([vers_have])
11052227fc13Smrgm4_undefine([maj_have])
11062227fc13Smrgm4_undefine([maj_needed])
11077b5fefc8Smrg]) # XORG_FONT_MACROS_VERSION
11082227fc13Smrg
11097b5fefc8Smrg# XORG_FONT_CHECK_{maps}()
11107b5fefc8Smrg# ------------------------
11112227fc13Smrg# Minimum version: 1.0.0
11127b5fefc8Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
11137b5fefc8Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
11142227fc13Smrg
11157b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
11167b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
11177b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
11187b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
11197b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
11207b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
11217b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
11227b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
11237b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
11247b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
11257b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
11267b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
11277b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
11287b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
11297b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
11307b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
11317b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
11327b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
1133644fc5c1Stron
11347b5fefc8Smrg# XORG_FONT_CHECK_ENCODING(encoding)
11357b5fefc8Smrg# ----------------------------------
11367b5fefc8Smrg# Minimum version: 1.1.0
11377b5fefc8Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
11387b5fefc8Smrg# It replaced individual copies of this code in the above macros in 1.1.
11397b5fefc8Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
11407b5fefc8Smrg# calls if this is not true in the future.
1141644fc5c1Stron
11427b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
11437b5fefc8Smrg	AC_ARG_ENABLE(m4_tolower($1),
11447b5fefc8Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
11457b5fefc8Smrg				[Build $1 fonts (default: yes)]),
11467b5fefc8Smrg		[AS_TR_SH($1)=$enableval])
11477b5fefc8Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
11487b5fefc8Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
11497b5fefc8Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
11507b5fefc8Smrg]) # XORG_FONT_CHECK_ENCODING
11512227fc13Smrg
11527b5fefc8Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
11537b5fefc8Smrg# -----------------------------------------------------
11547b5fefc8Smrg# Minimum version: 1.1.0
11557b5fefc8Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
11567b5fefc8Smrg# Add a shorthand --enable/disable-all-encodings option.
11572227fc13Smrg
11587b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
11597b5fefc8Smrg	AC_ARG_ENABLE([all-encodings],
11607b5fefc8Smrg		AS_HELP_STRING([--disable-all-encodings],
11617b5fefc8Smrg				[Disable building of all font encodings]),
11627b5fefc8Smrg		[m4_foreach_w([enc], [$1], [
11637b5fefc8Smrg			AS_TR_SH(enc)=$enableval
11647b5fefc8Smrg		])],
11657b5fefc8Smrg		[m4_foreach_w([enc], [$1], [
11667b5fefc8Smrg			AS_TR_SH(enc)=yes
11677b5fefc8Smrg		])])
11687b5fefc8Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
11697b5fefc8Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
1170644fc5c1Stron
11717b5fefc8Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
11727b5fefc8Smrg# ------------------------------------------
11737b5fefc8Smrg# Minimum version: 1.1.0
11747b5fefc8Smrg#
11757b5fefc8Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
11767b5fefc8Smrg#
1177644fc5c1Stron
11787b5fefc8SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
11797b5fefc8Smrg	AC_PATH_PROG($1, $2)
11807b5fefc8Smrg	if test x"$$1" = x; then
11817b5fefc8Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
11827b5fefc8Smrg	fi
11837b5fefc8Smrg])
1184644fc5c1Stron
1185644fc5c1Stron
11867b5fefc8Smrg# XORG_FONT_FCCACHE()
11877b5fefc8Smrg# -------------------
11887b5fefc8Smrg# Minimum version: 1.1.0
11897b5fefc8Smrg#
11907b5fefc8Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
11917b5fefc8Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
11927b5fefc8Smrg# to run fc-cache if found and not installing to $DESTDIR and not
11937b5fefc8Smrg# cross-compiling
11947b5fefc8Smrg#
11957b5fefc8Smrg# fc-cache is optional, not required, and should be skipped when making
11967b5fefc8Smrg# packages (installing to $DESTDIR) or cross-compiling
11977b5fefc8Smrg#
11987b5fefc8SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
11997b5fefc8Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
12007b5fefc8Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
12017b5fefc8Smrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
12027b5fefc8Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
12037b5fefc8Smrg	else
12047b5fefc8Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
12057b5fefc8Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
12067b5fefc8Smrg	fi
12077b5fefc8Smrg	AC_SUBST([RUN_FCCACHE])
12087b5fefc8Smrg])
1209644fc5c1Stron
12107b5fefc8Smrg# XORG_FONT_MKFONTDIR()
12117b5fefc8Smrg# -------------------
12127b5fefc8Smrg# Minimum version: 1.3.0
12137b5fefc8Smrg#
12147b5fefc8Smrg# Set MKFONTDIR to path to mkfontdir.
12157b5fefc8Smrg#
12167b5fefc8Smrg# If cross-compiling, and if mkdir is not found, use a shell command
12177b5fefc8Smrg# which warns mkfontdir needs to be run on the target
12187b5fefc8Smrg#
12197b5fefc8Smrg# If not cross-compiling, mkfontdir must be found
12207b5fefc8Smrg#
12217b5fefc8SmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
12227b5fefc8Smrg	if test x"$cross_compiling" != x"no" ; then
12237b5fefc8Smrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
12247b5fefc8Smrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
1225644fc5c1Stron
12267b5fefc8Smrg		if test x"$MKFONTDIR" = x; then
12277b5fefc8Smrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
12287b5fefc8Smrg		fi
12297b5fefc8Smrg	else
12307b5fefc8Smrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
12317b5fefc8Smrg	fi
1232644fc5c1Stron
12337b5fefc8Smrg	AC_SUBST([MKFONTDIR])
12347b5fefc8Smrg])
12352227fc13Smrg
12367b5fefc8Smrg# XORG_FONT_COMMON_UTILS()
12377b5fefc8Smrg# ------------------------
12387b5fefc8Smrg# Minimum version: 1.1.0
12397b5fefc8Smrg#
12407b5fefc8Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
12412227fc13Smrg
12427b5fefc8SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
12437b5fefc8Smrg	XORG_FONT_FCCACHE
12447b5fefc8Smrg	XORG_FONT_MKFONTDIR
12457b5fefc8Smrg])
12462227fc13Smrg
12477b5fefc8Smrg# XORG_FONT_SCALED_UTILS()
12482227fc13Smrg# ------------------------
12497b5fefc8Smrg# Minimum version: 1.1.0
1250644fc5c1Stron#
12517b5fefc8Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
12527b5fefc8Smrg# (TrueType, OpenType, Type1)
12532227fc13Smrg
12547b5fefc8SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
12557b5fefc8Smrg	XORG_FONT_COMMON_UTILS
12567b5fefc8Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
12577b5fefc8Smrg])
12582227fc13Smrg
12597b5fefc8Smrg# XORG_FONT_BDF_UTILS()
12607b5fefc8Smrg# ---------------------
12617b5fefc8Smrg# Minimum version: 1.1.0
1262644fc5c1Stron#
12637b5fefc8Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
12647b5fefc8Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
12657b5fefc8Smrg# PCF output files created by bdftopcf
1266644fc5c1Stron
12677b5fefc8SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
12687b5fefc8Smrg	XORG_FONT_COMMON_UTILS
12697b5fefc8Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
12707b5fefc8Smrg	XORG_FONT_CHECK_COMPRESSION
12717b5fefc8Smrg])
1272644fc5c1Stron
12737b5fefc8Smrg# XORG_FONT_CHECK_COMPRESSION()
12747b5fefc8Smrg# -----------------------------
12757b5fefc8Smrg# Minimum version: 1.1.0
12767b5fefc8Smrg#
12777b5fefc8Smrg# Offer a --with-compression flag to control what compression method is
12787b5fefc8Smrg# used for pcf font files.   Offers all the methods currently supported
12797b5fefc8Smrg# by libXfont, including no compression.
12807b5fefc8Smrg#
12817b5fefc8Smrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
12827b5fefc8Smrg# for reproducible builds, such as gzip -n to not record timestamp, will
12837b5fefc8Smrg# set COMPRESS_FLAGS to those options.
1284644fc5c1Stron
12857b5fefc8SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
12867b5fefc8Smrg	AC_MSG_CHECKING([font compression method])
12877b5fefc8Smrg	AC_ARG_WITH(compression,
12887b5fefc8Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
12897b5fefc8Smrg			 [compression method to use on pcf fonts])],
12907b5fefc8Smrg         [compression="$withval"], [compression="yes"])
12917b5fefc8Smrg	if test x"$compression" = "xyes" ; then
12927b5fefc8Smrg		compression="gzip"
12937b5fefc8Smrg	fi
12947b5fefc8Smrg	AC_MSG_RESULT([${compression}])
12957b5fefc8Smrg	case ${compression} in
12967b5fefc8Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
12977b5fefc8Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
12987b5fefc8Smrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
12997b5fefc8Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
13007b5fefc8Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
13017b5fefc8Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
13027b5fefc8Smrg	esac
13037b5fefc8Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
13047b5fefc8Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
13057b5fefc8Smrg	fi
13067b5fefc8Smrg	AC_MSG_CHECKING([options to font compression command])
13077b5fefc8Smrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
13087b5fefc8Smrg	AC_SUBST([COMPRESS_FLAGS])
13097b5fefc8Smrg	AC_SUBST([COMPRESS_SUFFIX])
13107b5fefc8Smrg])
1311644fc5c1Stron
13127b5fefc8Smrg# XORG_FONT_UCS2ANY()
13137b5fefc8Smrg# -------------------
13147b5fefc8Smrg# Minimum version: 1.1.0
13157b5fefc8Smrg#
13167b5fefc8Smrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
13177b5fefc8Smrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
13187b5fefc8Smrg# Also call pkg-config to find the directory with the encoding files needed
13197b5fefc8Smrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
1320644fc5c1Stron
13217b5fefc8SmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
13227b5fefc8Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
13237b5fefc8Smrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
13247b5fefc8Smrg	PKG_CHECK_MODULES(MAPS, [fontutil])
13257b5fefc8Smrg	AC_MSG_CHECKING([for ucs2any encoding data files])
13267b5fefc8Smrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
13277b5fefc8Smrg	AC_SUBST(MAPFILES_PATH)
13287b5fefc8Smrg	AC_MSG_RESULT([${MAPFILES_PATH}])
13297b5fefc8Smrg])
1330644fc5c1Stron
1331644fc5c1Stron
1332644fc5c1Stron
13337b5fefc8Smrg# XORG_FONT_FC_CONFDIR()
13347b5fefc8Smrg# --------------------
13357b5fefc8Smrg# Minimum version: 1.2.0
13367b5fefc8Smrg#
13377b5fefc8Smrg# Sets FC_CONFDIR to the fontconfig config directory
13387b5fefc8Smrg# (which should be --with-confdir=... when building fontconfig)
13397b5fefc8Smrg# found from:
13407b5fefc8Smrg#	--with-fc-confdir=...
13417b5fefc8Smrg#	pkg-config --variable=confdir fontconfig
13427b5fefc8Smrg#	${sysconfdir}/fonts
1343644fc5c1Stron
13447b5fefc8SmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
13457b5fefc8Smrg	dnl Ensure $PKG_CONFIG is set first
13467b5fefc8Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1347644fc5c1Stron
13487b5fefc8Smrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
13497b5fefc8Smrg	AC_ARG_WITH(fc-confdir,
13507b5fefc8Smrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
13517b5fefc8Smrg			   [Path to fontconfig's configuration directory]),
13527b5fefc8Smrg		    [FC_CONFDIR="$withval"])
13537b5fefc8Smrg	# if --with-fc-confdir was not specified
13547b5fefc8Smrg	if test "x${FC_CONFDIR}" = "x"; then
13557b5fefc8Smrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
13567b5fefc8Smrg	fi
13577b5fefc8Smrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
13587b5fefc8Smrg	if test "x${FC_CONFDIR}" = "x"; then
13597b5fefc8Smrg		FC_CONFDIR="${sysconfdir}/fonts"
13607b5fefc8Smrg	fi
13617b5fefc8Smrg	AC_SUBST(FC_CONFDIR)
13627b5fefc8Smrg	AC_MSG_RESULT([${FC_CONFDIR}])
13637b5fefc8Smrg])
1364644fc5c1Stron
1365644fc5c1Stron
13662227fc13Smrg
13677b5fefc8Smrg# XORG_FONTROOTDIR()
13687b5fefc8Smrg# --------------------
13697b5fefc8Smrg# Minimum version: 1.1.0
13707b5fefc8Smrg#
13717b5fefc8Smrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
13727b5fefc8Smrg# found from:
13737b5fefc8Smrg#	--with-fontrootdir
13747b5fefc8Smrg#	pkg-config --variable=fontrootdir fontutil
13757b5fefc8Smrg#	${datadir}/fonts/X11
13762227fc13Smrg
13777b5fefc8SmrgAC_DEFUN([XORG_FONTROOTDIR],[
13787b5fefc8Smrg	dnl Ensure $PKG_CONFIG is set first
13797b5fefc8Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
13802227fc13Smrg
13817b5fefc8Smrg	AC_MSG_CHECKING([for root directory for font files])
13827b5fefc8Smrg	AC_ARG_WITH(fontrootdir,
13837b5fefc8Smrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
13847b5fefc8Smrg			   [Path to root directory for font files]),
13857b5fefc8Smrg		    [FONTROOTDIR="$withval"])
13867b5fefc8Smrg	# if --with-fontrootdir not specified...
13877b5fefc8Smrg	if test "x${FONTROOTDIR}" = "x"; then
13887b5fefc8Smrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
13897b5fefc8Smrg	fi
13907b5fefc8Smrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
13917b5fefc8Smrg	if test "x${FONTROOTDIR}" = "x"; then
13927b5fefc8Smrg		FONTROOTDIR="${datadir}/fonts/X11"
13937b5fefc8Smrg	fi
13947b5fefc8Smrg	AC_SUBST(FONTROOTDIR)
13957b5fefc8Smrg	AC_MSG_RESULT([${FONTROOTDIR}])
13967b5fefc8Smrg])
1397644fc5c1Stron
13987b5fefc8Smrg# XORG_FONTSUBDIR(variable, flag, subdir)
13997b5fefc8Smrg# ---------------------------------------
14007b5fefc8Smrg# Minimum version: 1.1.0
14017b5fefc8Smrg#
14027b5fefc8Smrg# Offer a --with-<flag> flag to control directory for font installation
14037b5fefc8Smrg# Default is the specified <subdir> of the font root directory.
14047b5fefc8Smrg# Sets <variable> to the selected directory
1405644fc5c1Stron
14067b5fefc8SmrgAC_DEFUN([XORG_FONTSUBDIR],[
14077b5fefc8Smrg	AC_REQUIRE([XORG_FONTROOTDIR])
1408644fc5c1Stron
14097b5fefc8Smrg	AC_MSG_CHECKING([for directory for $3 files])
14107b5fefc8Smrg	AC_ARG_WITH($2,
14117b5fefc8Smrg		    [AS_HELP_STRING([--with-$2=DIR],
14127b5fefc8Smrg				    [Path to $3 files [FONTROOTDIR/$3]])],
14137b5fefc8Smrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
14147b5fefc8Smrg	AC_SUBST($1)
14157b5fefc8Smrg	AC_MSG_RESULT([${$1}])
14167b5fefc8Smrg]) # XORG_FONTSUBDIR
14172227fc13Smrg
14187b5fefc8Smrg# XORG_FONTDIR(subdir)
14197b5fefc8Smrg# --------------------
14207b5fefc8Smrg# Minimum version: 1.1.0
14217b5fefc8Smrg#
14227b5fefc8Smrg# Offer a --with-fontdir flag to control directory for font installation
14237b5fefc8Smrg# Default is the specified subdir of the font root directory.
14247b5fefc8Smrg# Sets FONTDIR to the selected directory
14252227fc13Smrg
14267b5fefc8SmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
14272227fc13Smrg
14287b5fefc8Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14297b5fefc8Smrgdnl
14307b5fefc8Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
14317b5fefc8Smrgdnl
14327b5fefc8Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14337b5fefc8Smrgdnl copy of this software and associated documentation files (the "Software"),
14347b5fefc8Smrgdnl to deal in the Software without restriction, including without limitation
14357b5fefc8Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14367b5fefc8Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
14377b5fefc8Smrgdnl Software is furnished to do so, subject to the following conditions:
14387b5fefc8Smrgdnl
14397b5fefc8Smrgdnl The above copyright notice and this permission notice (including the next
14407b5fefc8Smrgdnl paragraph) shall be included in all copies or substantial portions of the
14417b5fefc8Smrgdnl Software.
14427b5fefc8Smrgdnl
14437b5fefc8Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14447b5fefc8Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14457b5fefc8Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14467b5fefc8Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14477b5fefc8Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14487b5fefc8Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14497b5fefc8Smrgdnl DEALINGS IN THE SOFTWARE.
14507b5fefc8Smrg
14517b5fefc8Smrg# XORG_MACROS_VERSION(required-version)
14527b5fefc8Smrg# -------------------------------------
14537b5fefc8Smrg# Minimum version: 1.1.0
14542227fc13Smrg#
14557b5fefc8Smrg# If you're using a macro added in Version 1.1 or newer, include this in
14567b5fefc8Smrg# your configure.ac with the minimum required version, such as:
14577b5fefc8Smrg# XORG_MACROS_VERSION(1.1)
14582227fc13Smrg#
14597b5fefc8Smrg# To ensure that this macro is defined, also add:
14607b5fefc8Smrg# m4_ifndef([XORG_MACROS_VERSION],
14617b5fefc8Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14622227fc13Smrg#
14632227fc13Smrg#
14647b5fefc8Smrg# See the "minimum version" comment for each macro you use to see what
14657b5fefc8Smrg# version you require.
14667b5fefc8Smrgm4_defun([XORG_MACROS_VERSION],[
14677b5fefc8Smrgm4_define([vers_have], [1.20.0])
14687b5fefc8Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14697b5fefc8Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14707b5fefc8Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14717b5fefc8Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14727b5fefc8Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14737b5fefc8Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14747b5fefc8Smrgm4_undefine([vers_have])
14757b5fefc8Smrgm4_undefine([maj_have])
14767b5fefc8Smrgm4_undefine([maj_needed])
14777b5fefc8Smrg]) # XORG_MACROS_VERSION
14782227fc13Smrg
14797b5fefc8Smrg# XORG_PROG_RAWCPP()
14807b5fefc8Smrg# ------------------
14817b5fefc8Smrg# Minimum version: 1.0.0
14827b5fefc8Smrg#
14837b5fefc8Smrg# Find cpp program and necessary flags for use in pre-processing text files
14847b5fefc8Smrg# such as man pages and config files
14857b5fefc8SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14867b5fefc8SmrgAC_REQUIRE([AC_PROG_CPP])
14877b5fefc8SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14887b5fefc8Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14897b5fefc8Smrg
14907b5fefc8Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14917b5fefc8Smrg# which is not the best choice for supporting other OS'es, but covers most
14927b5fefc8Smrg# of the ones we need for now.
14937b5fefc8SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14947b5fefc8SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14957b5fefc8Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14967b5fefc8Smrg	AC_MSG_RESULT([no])
1497644fc5c1Stronelse
14987b5fefc8Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14997b5fefc8Smrg		RAWCPPFLAGS=-undef
15007b5fefc8Smrg		AC_MSG_RESULT([yes])
15017b5fefc8Smrg	# under Cygwin unix is still defined even with -undef
15027b5fefc8Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15037b5fefc8Smrg		RAWCPPFLAGS="-undef -ansi"
15047b5fefc8Smrg		AC_MSG_RESULT([yes, with -ansi])
15057b5fefc8Smrg	else
15067b5fefc8Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15077b5fefc8Smrg	fi
1508644fc5c1Stronfi
15097b5fefc8Smrgrm -f conftest.$ac_ext
1510644fc5c1Stron
15117b5fefc8SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15127b5fefc8SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15137b5fefc8Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15147b5fefc8Smrg	AC_MSG_RESULT([no])
15152227fc13Smrgelse
15167b5fefc8Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15177b5fefc8Smrg		TRADITIONALCPPFLAGS="-traditional"
15187b5fefc8Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15197b5fefc8Smrg		AC_MSG_RESULT([yes])
15207b5fefc8Smrg	else
15217b5fefc8Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15227b5fefc8Smrg	fi
15232227fc13Smrgfi
15247b5fefc8Smrgrm -f conftest.$ac_ext
15257b5fefc8SmrgAC_SUBST(RAWCPPFLAGS)
15267b5fefc8SmrgAC_SUBST(TRADITIONALCPPFLAGS)
15277b5fefc8Smrg]) # XORG_PROG_RAWCPP
15282227fc13Smrg
15297b5fefc8Smrg# XORG_MANPAGE_SECTIONS()
15307b5fefc8Smrg# -----------------------
15317b5fefc8Smrg# Minimum version: 1.0.0
15322227fc13Smrg#
15337b5fefc8Smrg# Determine which sections man pages go in for the different man page types
15347b5fefc8Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15357b5fefc8Smrg# Not sure if there's any better way than just hardcoding by OS name.
15367b5fefc8Smrg# Override default settings by setting environment variables
15377b5fefc8Smrg# Added MAN_SUBSTS in version 1.8
15387b5fefc8Smrg# Added AC_PROG_SED in version 1.8
15392227fc13Smrg
15407b5fefc8SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15417b5fefc8SmrgAC_REQUIRE([AC_CANONICAL_HOST])
15427b5fefc8SmrgAC_REQUIRE([AC_PROG_SED])
15432227fc13Smrg
15447b5fefc8Smrgcase $host_os in
15457b5fefc8Smrg    solaris*)
15467b5fefc8Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15477b5fefc8Smrg        # check for a man page file found in later versions that use
15487b5fefc8Smrg        # traditional section numbers instead
15497b5fefc8Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15507b5fefc8Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15517b5fefc8Smrg        ;;
15527b5fefc8Smrg    *) SYSV_MAN_SECTIONS=false ;;
15537b5fefc8Smrgesac
15542227fc13Smrg
15557b5fefc8Smrgif test x$APP_MAN_SUFFIX = x    ; then
15567b5fefc8Smrg    APP_MAN_SUFFIX=1
15577b5fefc8Smrgfi
15587b5fefc8Smrgif test x$APP_MAN_DIR = x    ; then
15597b5fefc8Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15602227fc13Smrgfi
1561644fc5c1Stron
15627b5fefc8Smrgif test x$LIB_MAN_SUFFIX = x    ; then
15637b5fefc8Smrg    LIB_MAN_SUFFIX=3
15647b5fefc8Smrgfi
15657b5fefc8Smrgif test x$LIB_MAN_DIR = x    ; then
15667b5fefc8Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15672227fc13Smrgfi
1568644fc5c1Stron
15697b5fefc8Smrgif test x$FILE_MAN_SUFFIX = x    ; then
15707b5fefc8Smrg    case $SYSV_MAN_SECTIONS in
15717b5fefc8Smrg	true)				FILE_MAN_SUFFIX=4  ;;
15727b5fefc8Smrg	*)				FILE_MAN_SUFFIX=5  ;;
15737b5fefc8Smrg    esac
15747b5fefc8Smrgfi
15757b5fefc8Smrgif test x$FILE_MAN_DIR = x    ; then
15767b5fefc8Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15772227fc13Smrgfi
1578644fc5c1Stron
15797b5fefc8Smrgif test x$MISC_MAN_SUFFIX = x    ; then
15807b5fefc8Smrg    case $SYSV_MAN_SECTIONS in
15817b5fefc8Smrg	true)				MISC_MAN_SUFFIX=5  ;;
15827b5fefc8Smrg	*)				MISC_MAN_SUFFIX=7  ;;
15837b5fefc8Smrg    esac
15847b5fefc8Smrgfi
15857b5fefc8Smrgif test x$MISC_MAN_DIR = x    ; then
15867b5fefc8Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15877b5fefc8Smrgfi
15882227fc13Smrg
15897b5fefc8Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15907b5fefc8Smrg    case $SYSV_MAN_SECTIONS in
15917b5fefc8Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
15927b5fefc8Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
15937b5fefc8Smrg    esac
15947b5fefc8Smrgfi
15957b5fefc8Smrgif test x$DRIVER_MAN_DIR = x    ; then
15967b5fefc8Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15977b5fefc8Smrgfi
15982227fc13Smrg
15997b5fefc8Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
16007b5fefc8Smrg    case $SYSV_MAN_SECTIONS in
16017b5fefc8Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16027b5fefc8Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16037b5fefc8Smrg    esac
16047b5fefc8Smrgfi
16057b5fefc8Smrgif test x$ADMIN_MAN_DIR = x    ; then
16067b5fefc8Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16072227fc13Smrgfi
1608644fc5c1Stron
16092227fc13Smrg
16107b5fefc8SmrgAC_SUBST([APP_MAN_SUFFIX])
16117b5fefc8SmrgAC_SUBST([LIB_MAN_SUFFIX])
16127b5fefc8SmrgAC_SUBST([FILE_MAN_SUFFIX])
16137b5fefc8SmrgAC_SUBST([MISC_MAN_SUFFIX])
16147b5fefc8SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16157b5fefc8SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16167b5fefc8SmrgAC_SUBST([APP_MAN_DIR])
16177b5fefc8SmrgAC_SUBST([LIB_MAN_DIR])
16187b5fefc8SmrgAC_SUBST([FILE_MAN_DIR])
16197b5fefc8SmrgAC_SUBST([MISC_MAN_DIR])
16207b5fefc8SmrgAC_SUBST([DRIVER_MAN_DIR])
16217b5fefc8SmrgAC_SUBST([ADMIN_MAN_DIR])
1622644fc5c1Stron
16237b5fefc8SmrgXORG_MAN_PAGE="X Version 11"
16247b5fefc8SmrgAC_SUBST([XORG_MAN_PAGE])
16257b5fefc8SmrgMAN_SUBSTS="\
16267b5fefc8Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16277b5fefc8Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16287b5fefc8Smrg	-e 's|__xservername__|Xorg|g' \
16297b5fefc8Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
16307b5fefc8Smrg	-e 's|__projectroot__|\$(prefix)|g' \
16317b5fefc8Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16327b5fefc8Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16337b5fefc8Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16347b5fefc8Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16357b5fefc8Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16367b5fefc8Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16377b5fefc8Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16387b5fefc8SmrgAC_SUBST([MAN_SUBSTS])
16392227fc13Smrg
16407b5fefc8Smrg]) # XORG_MANPAGE_SECTIONS
16412227fc13Smrg
16427b5fefc8Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16437b5fefc8Smrg# ------------------------
16447b5fefc8Smrg# Minimum version: 1.7.0
16452227fc13Smrg#
16467b5fefc8Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16477b5fefc8Smrg# provided by xorg-sgml-doctools, if installed.
16487b5fefc8SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16497b5fefc8SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16507b5fefc8SmrgXORG_SGML_PATH=
16517b5fefc8SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16527b5fefc8Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16537b5fefc8Smrg    [m4_ifval([$1],[:],
16547b5fefc8Smrg        [if test x"$cross_compiling" != x"yes" ; then
16557b5fefc8Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16567b5fefc8Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16577b5fefc8Smrg         fi])
16587b5fefc8Smrg    ])
16597b5fefc8Smrg
16607b5fefc8Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16617b5fefc8Smrg# the path and the name of the doc stylesheet
16627b5fefc8Smrgif test "x$XORG_SGML_PATH" != "x" ; then
16637b5fefc8Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16647b5fefc8Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16657b5fefc8Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16667b5fefc8Smrgelse
16677b5fefc8Smrg   AC_MSG_RESULT([no])
16687b5fefc8Smrgfi
16697b5fefc8Smrg
16707b5fefc8SmrgAC_SUBST(XORG_SGML_PATH)
16717b5fefc8SmrgAC_SUBST(STYLESHEET_SRCDIR)
16727b5fefc8SmrgAC_SUBST(XSL_STYLESHEET)
16737b5fefc8SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16747b5fefc8Smrg]) # XORG_CHECK_SGML_DOCTOOLS
16752227fc13Smrg
16767b5fefc8Smrg# XORG_CHECK_LINUXDOC
16777b5fefc8Smrg# -------------------
16782227fc13Smrg# Minimum version: 1.0.0
16792227fc13Smrg#
16807b5fefc8Smrg# Defines the variable MAKE_TEXT if the necessary tools and
16817b5fefc8Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16827b5fefc8Smrg# Whether or not the necessary tools and files are found can be checked
16837b5fefc8Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16847b5fefc8SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16857b5fefc8SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16867b5fefc8SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16872227fc13Smrg
16887b5fefc8SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16897b5fefc8Smrg
16907b5fefc8SmrgAC_MSG_CHECKING([whether to build documentation])
16917b5fefc8Smrg
16927b5fefc8Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16937b5fefc8Smrg   BUILDDOC=yes
16947b5fefc8Smrgelse
16957b5fefc8Smrg   BUILDDOC=no
16962227fc13Smrgfi
1697644fc5c1Stron
16987b5fefc8SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16997b5fefc8Smrg
17007b5fefc8SmrgAC_MSG_RESULT([$BUILDDOC])
17017b5fefc8Smrg
17027b5fefc8SmrgAC_MSG_CHECKING([whether to build pdf documentation])
17037b5fefc8Smrg
17047b5fefc8Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17057b5fefc8Smrg   BUILDPDFDOC=yes
17062227fc13Smrgelse
17077b5fefc8Smrg   BUILDPDFDOC=no
17082227fc13Smrgfi
1709644fc5c1Stron
17107b5fefc8SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1711644fc5c1Stron
17127b5fefc8SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17137b5fefc8Smrg
17147b5fefc8SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17157b5fefc8SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17167b5fefc8SmrgMAKE_PDF="$PS2PDF"
17177b5fefc8SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17187b5fefc8Smrg
17197b5fefc8SmrgAC_SUBST(MAKE_TEXT)
17207b5fefc8SmrgAC_SUBST(MAKE_PS)
17217b5fefc8SmrgAC_SUBST(MAKE_PDF)
17227b5fefc8SmrgAC_SUBST(MAKE_HTML)
17237b5fefc8Smrg]) # XORG_CHECK_LINUXDOC
17247b5fefc8Smrg
17257b5fefc8Smrg# XORG_CHECK_DOCBOOK
17267b5fefc8Smrg# -------------------
17277b5fefc8Smrg# Minimum version: 1.0.0
17287b5fefc8Smrg#
17297b5fefc8Smrg# Checks for the ability to build output formats from SGML DocBook source.
17307b5fefc8Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17317b5fefc8Smrg# indicates whether the necessary tools and files are found and, if set,
17327b5fefc8Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17337b5fefc8SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17347b5fefc8SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17357b5fefc8Smrg
17367b5fefc8SmrgBUILDTXTDOC=no
17377b5fefc8SmrgBUILDPDFDOC=no
17387b5fefc8SmrgBUILDPSDOC=no
17397b5fefc8SmrgBUILDHTMLDOC=no
17407b5fefc8Smrg
17417b5fefc8SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17427b5fefc8SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17437b5fefc8SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17447b5fefc8SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17457b5fefc8Smrg
17467b5fefc8SmrgAC_MSG_CHECKING([whether to build text documentation])
17477b5fefc8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17487b5fefc8Smrg   test x$BUILD_TXTDOC != xno; then
17497b5fefc8Smrg	BUILDTXTDOC=yes
17507b5fefc8Smrgfi
17517b5fefc8SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17527b5fefc8SmrgAC_MSG_RESULT([$BUILDTXTDOC])
17537b5fefc8Smrg
17547b5fefc8SmrgAC_MSG_CHECKING([whether to build PDF documentation])
17557b5fefc8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17567b5fefc8Smrg   test x$BUILD_PDFDOC != xno; then
17577b5fefc8Smrg	BUILDPDFDOC=yes
17587b5fefc8Smrgfi
17597b5fefc8SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17607b5fefc8SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17617b5fefc8Smrg
17627b5fefc8SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17637b5fefc8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17647b5fefc8Smrg   test x$BUILD_PSDOC != xno; then
17657b5fefc8Smrg	BUILDPSDOC=yes
17667b5fefc8Smrgfi
17677b5fefc8SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17687b5fefc8SmrgAC_MSG_RESULT([$BUILDPSDOC])
17697b5fefc8Smrg
17707b5fefc8SmrgAC_MSG_CHECKING([whether to build HTML documentation])
17717b5fefc8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17727b5fefc8Smrg   test x$BUILD_HTMLDOC != xno; then
17737b5fefc8Smrg	BUILDHTMLDOC=yes
17747b5fefc8Smrgfi
17757b5fefc8SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17767b5fefc8SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17777b5fefc8Smrg
17787b5fefc8SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17797b5fefc8SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17807b5fefc8SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17817b5fefc8SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17827b5fefc8Smrg
17837b5fefc8SmrgAC_SUBST(MAKE_TEXT)
17847b5fefc8SmrgAC_SUBST(MAKE_PS)
17857b5fefc8SmrgAC_SUBST(MAKE_PDF)
17867b5fefc8SmrgAC_SUBST(MAKE_HTML)
17877b5fefc8Smrg]) # XORG_CHECK_DOCBOOK
17887b5fefc8Smrg
17897b5fefc8Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17902227fc13Smrg# ----------------
17917b5fefc8Smrg# Minimum version: 1.5.0
17927b5fefc8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17932227fc13Smrg#
17947b5fefc8Smrg# Documentation tools are not always available on all platforms and sometimes
17957b5fefc8Smrg# not at the appropriate level. This macro enables a module to test for the
17967b5fefc8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
17977b5fefc8Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
17987b5fefc8Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17997b5fefc8Smrg# --with-xmlto assumes 'auto'.
18002227fc13Smrg#
18012227fc13Smrg# Interface to module:
18027b5fefc8Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18037b5fefc8Smrg# XMLTO:	returns the path of the xmlto program found
18047b5fefc8Smrg#		returns the path set by the user in the environment
18057b5fefc8Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18067b5fefc8Smrg#		'no' user instructs the module not to use xmlto
18072227fc13Smrg#
18087b5fefc8Smrg# Added in version 1.10.0
18097b5fefc8Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18107b5fefc8Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
18112227fc13Smrg#
18127b5fefc8Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
18132227fc13Smrg#
18147b5fefc8SmrgAC_DEFUN([XORG_WITH_XMLTO],[
18157b5fefc8SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18167b5fefc8Smrgm4_define([_defopt], m4_default([$2], [auto]))
18177b5fefc8SmrgAC_ARG_WITH(xmlto,
18187b5fefc8Smrg	AS_HELP_STRING([--with-xmlto],
18197b5fefc8Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18207b5fefc8Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18217b5fefc8Smrgm4_undefine([_defopt])
18222227fc13Smrg
18237b5fefc8Smrgif test "x$use_xmlto" = x"auto"; then
18247b5fefc8Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18257b5fefc8Smrg   if test "x$XMLTO" = "x"; then
18267b5fefc8Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18277b5fefc8Smrg	have_xmlto=no
18287b5fefc8Smrg   else
18297b5fefc8Smrg        have_xmlto=yes
18302227fc13Smrg   fi
18317b5fefc8Smrgelif test "x$use_xmlto" = x"yes" ; then
18327b5fefc8Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18337b5fefc8Smrg   if test "x$XMLTO" = "x"; then
18347b5fefc8Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18352227fc13Smrg   fi
18367b5fefc8Smrg   have_xmlto=yes
18377b5fefc8Smrgelif test "x$use_xmlto" = x"no" ; then
18387b5fefc8Smrg   if test "x$XMLTO" != "x"; then
18397b5fefc8Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18407b5fefc8Smrg   fi
18417b5fefc8Smrg   have_xmlto=no
18422227fc13Smrgelse
18437b5fefc8Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18442227fc13Smrgfi
1845644fc5c1Stron
18467b5fefc8Smrg# Test for a minimum version of xmlto, if provided.
18477b5fefc8Smrgm4_ifval([$1],
18487b5fefc8Smrg[if test "$have_xmlto" = yes; then
18497b5fefc8Smrg    # scrape the xmlto version
18507b5fefc8Smrg    AC_MSG_CHECKING([the xmlto version])
18517b5fefc8Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18527b5fefc8Smrg    AC_MSG_RESULT([$xmlto_version])
18537b5fefc8Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18547b5fefc8Smrg        [if test "x$use_xmlto" = xauto; then
18557b5fefc8Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18567b5fefc8Smrg            have_xmlto=no
18577b5fefc8Smrg        else
18587b5fefc8Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18597b5fefc8Smrg        fi])
18607b5fefc8Smrgfi])
1861644fc5c1Stron
18627b5fefc8Smrg# Test for the ability of xmlto to generate a text target
18637b5fefc8Smrg#
18647b5fefc8Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18657b5fefc8Smrg# following test for empty XML docbook files.
18667b5fefc8Smrg# For compatibility reasons use the following empty XML docbook file and if
18677b5fefc8Smrg# it fails try it again with a non-empty XML file.
18687b5fefc8Smrghave_xmlto_text=no
18697b5fefc8Smrgcat > conftest.xml << "EOF"
18707b5fefc8SmrgEOF
18717b5fefc8SmrgAS_IF([test "$have_xmlto" = yes],
18727b5fefc8Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18737b5fefc8Smrg             [have_xmlto_text=yes],
18747b5fefc8Smrg             [# Try it again with a non-empty XML file.
18757b5fefc8Smrg              cat > conftest.xml << "EOF"
18767b5fefc8Smrg<x></x>
18777b5fefc8SmrgEOF
18787b5fefc8Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18797b5fefc8Smrg                    [have_xmlto_text=yes],
18807b5fefc8Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
18817b5fefc8Smrgrm -f conftest.xml
18827b5fefc8SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18837b5fefc8SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18847b5fefc8Smrg]) # XORG_WITH_XMLTO
1885644fc5c1Stron
18867b5fefc8Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18877b5fefc8Smrg# --------------------------------------------
18887b5fefc8Smrg# Minimum version: 1.12.0
18897b5fefc8Smrg# Minimum version for optional DEFAULT argument: 1.12.0
18902227fc13Smrg#
18917b5fefc8Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18927b5fefc8Smrg# XML-based language used for the transformation of XML documents.
18937b5fefc8Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18947b5fefc8Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18957b5fefc8Smrg# The XSLT processor is often used as a standalone tool for transformations.
18967b5fefc8Smrg# It should not be assumed that this tool is used only to work with documnetation.
18977b5fefc8Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18982227fc13Smrg#
18992227fc13Smrg# Interface to module:
19007b5fefc8Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19017b5fefc8Smrg# XSLTPROC:	 returns the path of the xsltproc program found
19027b5fefc8Smrg#		 returns the path set by the user in the environment
19037b5fefc8Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19047b5fefc8Smrg#		  'no' user instructs the module not to use xsltproc
19057b5fefc8Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19062227fc13Smrg#
19077b5fefc8Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19087b5fefc8Smrg#
19097b5fefc8SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19107b5fefc8SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19117b5fefc8Smrg# Preserves the interface, should it be implemented later
19127b5fefc8Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19137b5fefc8Smrgm4_define([_defopt], m4_default([$2], [auto]))
19147b5fefc8SmrgAC_ARG_WITH(xsltproc,
19157b5fefc8Smrg	AS_HELP_STRING([--with-xsltproc],
19167b5fefc8Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19177b5fefc8Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19187b5fefc8Smrgm4_undefine([_defopt])
19192227fc13Smrg
19207b5fefc8Smrgif test "x$use_xsltproc" = x"auto"; then
19217b5fefc8Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19227b5fefc8Smrg   if test "x$XSLTPROC" = "x"; then
19237b5fefc8Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19247b5fefc8Smrg	have_xsltproc=no
19257b5fefc8Smrg   else
19267b5fefc8Smrg        have_xsltproc=yes
19272227fc13Smrg   fi
19287b5fefc8Smrgelif test "x$use_xsltproc" = x"yes" ; then
19297b5fefc8Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19307b5fefc8Smrg   if test "x$XSLTPROC" = "x"; then
19317b5fefc8Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19327b5fefc8Smrg   fi
19337b5fefc8Smrg   have_xsltproc=yes
19347b5fefc8Smrgelif test "x$use_xsltproc" = x"no" ; then
19357b5fefc8Smrg   if test "x$XSLTPROC" != "x"; then
19367b5fefc8Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19377b5fefc8Smrg   fi
19387b5fefc8Smrg   have_xsltproc=no
19397b5fefc8Smrgelse
19407b5fefc8Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19412227fc13Smrgfi
1942644fc5c1Stron
19437b5fefc8SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19447b5fefc8Smrg]) # XORG_WITH_XSLTPROC
1945644fc5c1Stron
19467b5fefc8Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19477b5fefc8Smrg# ----------------------------------------
19487b5fefc8Smrg# Minimum version: 1.15.0
19492227fc13Smrg#
19507b5fefc8Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
19517b5fefc8Smrg# scanning arbitrary text files, extracting information from those text files,
19527b5fefc8Smrg# and printing reports based on that information.
19532227fc13Smrg#
19547b5fefc8Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
19552227fc13Smrg#
19567b5fefc8Smrg# Interface to module:
19577b5fefc8Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
19587b5fefc8Smrg# PERL:	     returns the path of the perl program found
19597b5fefc8Smrg#	     returns the path set by the user in the environment
19607b5fefc8Smrg# --with-perl: 'yes' user instructs the module to use perl
19617b5fefc8Smrg#	       'no' user instructs the module not to use perl
19627b5fefc8Smrg# have_perl: returns yes if perl found in PATH or no
19637b5fefc8Smrg#
19647b5fefc8Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19657b5fefc8Smrg#
19667b5fefc8SmrgAC_DEFUN([XORG_WITH_PERL],[
19677b5fefc8SmrgAC_ARG_VAR([PERL], [Path to perl command])
19687b5fefc8Smrg# Preserves the interface, should it be implemented later
19697b5fefc8Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
19707b5fefc8Smrgm4_define([_defopt], m4_default([$2], [auto]))
19717b5fefc8SmrgAC_ARG_WITH(perl,
19727b5fefc8Smrg	AS_HELP_STRING([--with-perl],
19737b5fefc8Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
19747b5fefc8Smrg	   [use_perl=$withval], [use_perl=]_defopt)
19757b5fefc8Smrgm4_undefine([_defopt])
19762227fc13Smrg
19777b5fefc8Smrgif test "x$use_perl" = x"auto"; then
19787b5fefc8Smrg   AC_PATH_PROG([PERL], [perl])
19797b5fefc8Smrg   if test "x$PERL" = "x"; then
19807b5fefc8Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19817b5fefc8Smrg	have_perl=no
19827b5fefc8Smrg   else
19837b5fefc8Smrg        have_perl=yes
19847b5fefc8Smrg   fi
19857b5fefc8Smrgelif test "x$use_perl" = x"yes" ; then
19867b5fefc8Smrg   AC_PATH_PROG([PERL], [perl])
19877b5fefc8Smrg   if test "x$PERL" = "x"; then
19887b5fefc8Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19897b5fefc8Smrg   fi
19907b5fefc8Smrg   have_perl=yes
19917b5fefc8Smrgelif test "x$use_perl" = x"no" ; then
19927b5fefc8Smrg   if test "x$PERL" != "x"; then
19937b5fefc8Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19947b5fefc8Smrg   fi
19957b5fefc8Smrg   have_perl=no
19967b5fefc8Smrgelse
19977b5fefc8Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19982227fc13Smrgfi
1999644fc5c1Stron
20007b5fefc8SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20017b5fefc8Smrg]) # XORG_WITH_PERL
20022227fc13Smrg
20037b5fefc8Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
20042227fc13Smrg# ----------------
20057b5fefc8Smrg# Minimum version: 1.5.0
20067b5fefc8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20072227fc13Smrg#
20087b5fefc8Smrg# Documentation tools are not always available on all platforms and sometimes
20097b5fefc8Smrg# not at the appropriate level. This macro enables a module to test for the
20107b5fefc8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20117b5fefc8Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
20127b5fefc8Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20137b5fefc8Smrg# --with-asciidoc assumes 'auto'.
20142227fc13Smrg#
20157b5fefc8Smrg# Interface to module:
20167b5fefc8Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20177b5fefc8Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
20187b5fefc8Smrg#		 returns the path set by the user in the environment
20197b5fefc8Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20207b5fefc8Smrg#		  'no' user instructs the module not to use asciidoc
20217b5fefc8Smrg#
20227b5fefc8Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20237b5fefc8Smrg#
20247b5fefc8SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20257b5fefc8SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20267b5fefc8Smrgm4_define([_defopt], m4_default([$2], [auto]))
20277b5fefc8SmrgAC_ARG_WITH(asciidoc,
20287b5fefc8Smrg	AS_HELP_STRING([--with-asciidoc],
20297b5fefc8Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20307b5fefc8Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20317b5fefc8Smrgm4_undefine([_defopt])
2032644fc5c1Stron
20337b5fefc8Smrgif test "x$use_asciidoc" = x"auto"; then
20347b5fefc8Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20357b5fefc8Smrg   if test "x$ASCIIDOC" = "x"; then
20367b5fefc8Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20377b5fefc8Smrg	have_asciidoc=no
20387b5fefc8Smrg   else
20397b5fefc8Smrg        have_asciidoc=yes
20407b5fefc8Smrg   fi
20417b5fefc8Smrgelif test "x$use_asciidoc" = x"yes" ; then
20427b5fefc8Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20437b5fefc8Smrg   if test "x$ASCIIDOC" = "x"; then
20447b5fefc8Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20457b5fefc8Smrg   fi
20467b5fefc8Smrg   have_asciidoc=yes
20477b5fefc8Smrgelif test "x$use_asciidoc" = x"no" ; then
20487b5fefc8Smrg   if test "x$ASCIIDOC" != "x"; then
20497b5fefc8Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20507b5fefc8Smrg   fi
20517b5fefc8Smrg   have_asciidoc=no
20527b5fefc8Smrgelse
20537b5fefc8Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20547b5fefc8Smrgfi
20557b5fefc8Smrgm4_ifval([$1],
20567b5fefc8Smrg[if test "$have_asciidoc" = yes; then
20577b5fefc8Smrg    # scrape the asciidoc version
20587b5fefc8Smrg    AC_MSG_CHECKING([the asciidoc version])
20597b5fefc8Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20607b5fefc8Smrg    AC_MSG_RESULT([$asciidoc_version])
20617b5fefc8Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20627b5fefc8Smrg        [if test "x$use_asciidoc" = xauto; then
20637b5fefc8Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20647b5fefc8Smrg            have_asciidoc=no
20657b5fefc8Smrg        else
20667b5fefc8Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20677b5fefc8Smrg        fi])
20687b5fefc8Smrgfi])
20697b5fefc8SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20707b5fefc8Smrg]) # XORG_WITH_ASCIIDOC
2071644fc5c1Stron
20727b5fefc8Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20737b5fefc8Smrg# -------------------------------------------
20747b5fefc8Smrg# Minimum version: 1.5.0
20757b5fefc8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20767b5fefc8Smrg# Minimum version for optional DOT checking: 1.18.0
20772227fc13Smrg#
20787b5fefc8Smrg# Documentation tools are not always available on all platforms and sometimes
20797b5fefc8Smrg# not at the appropriate level. This macro enables a module to test for the
20807b5fefc8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20817b5fefc8Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
20827b5fefc8Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20837b5fefc8Smrg# --with-doxygen assumes 'auto'.
20842227fc13Smrg#
20857b5fefc8Smrg# Interface to module:
20867b5fefc8Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20877b5fefc8Smrg# DOXYGEN:	 returns the path of the doxygen program found
20887b5fefc8Smrg#		 returns the path set by the user in the environment
20897b5fefc8Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20907b5fefc8Smrg#		  'no' user instructs the module not to use doxygen
20912227fc13Smrg#
20927b5fefc8Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20932227fc13Smrg#
20947b5fefc8SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20957b5fefc8SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20967b5fefc8SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20977b5fefc8Smrgm4_define([_defopt], m4_default([$2], [auto]))
20987b5fefc8SmrgAC_ARG_WITH(doxygen,
20997b5fefc8Smrg	AS_HELP_STRING([--with-doxygen],
21007b5fefc8Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21017b5fefc8Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21027b5fefc8Smrgm4_undefine([_defopt])
2103644fc5c1Stron
21047b5fefc8Smrgif test "x$use_doxygen" = x"auto"; then
21057b5fefc8Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21067b5fefc8Smrg   if test "x$DOXYGEN" = "x"; then
21077b5fefc8Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21087b5fefc8Smrg	have_doxygen=no
21097b5fefc8Smrg   else
21107b5fefc8Smrg        have_doxygen=yes
21117b5fefc8Smrg   fi
21127b5fefc8Smrgelif test "x$use_doxygen" = x"yes" ; then
21137b5fefc8Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21147b5fefc8Smrg   if test "x$DOXYGEN" = "x"; then
21157b5fefc8Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21167b5fefc8Smrg   fi
21177b5fefc8Smrg   have_doxygen=yes
21187b5fefc8Smrgelif test "x$use_doxygen" = x"no" ; then
21197b5fefc8Smrg   if test "x$DOXYGEN" != "x"; then
21207b5fefc8Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21217b5fefc8Smrg   fi
21227b5fefc8Smrg   have_doxygen=no
21237b5fefc8Smrgelse
21247b5fefc8Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
21257b5fefc8Smrgfi
21267b5fefc8Smrgm4_ifval([$1],
21277b5fefc8Smrg[if test "$have_doxygen" = yes; then
21287b5fefc8Smrg    # scrape the doxygen version
21297b5fefc8Smrg    AC_MSG_CHECKING([the doxygen version])
21307b5fefc8Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21317b5fefc8Smrg    AC_MSG_RESULT([$doxygen_version])
21327b5fefc8Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21337b5fefc8Smrg        [if test "x$use_doxygen" = xauto; then
21347b5fefc8Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21357b5fefc8Smrg            have_doxygen=no
21367b5fefc8Smrg        else
21377b5fefc8Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21387b5fefc8Smrg        fi])
21397b5fefc8Smrgfi])
2140644fc5c1Stron
21417b5fefc8Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21427b5fefc8Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21437b5fefc8Smrgdnl 	HAVE_DOT = @HAVE_DOT@
21447b5fefc8SmrgHAVE_DOT=no
21457b5fefc8Smrgif test "x$have_doxygen" = "xyes"; then
21467b5fefc8Smrg  AC_PATH_PROG([DOT], [dot])
21477b5fefc8Smrg    if test "x$DOT" != "x"; then
21487b5fefc8Smrg      HAVE_DOT=yes
21497b5fefc8Smrg    fi
21507b5fefc8Smrgfi
2151644fc5c1Stron
21527b5fefc8SmrgAC_SUBST([HAVE_DOT])
21537b5fefc8SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21547b5fefc8SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21557b5fefc8Smrg]) # XORG_WITH_DOXYGEN
2156644fc5c1Stron
21577b5fefc8Smrg# XORG_WITH_GROFF([DEFAULT])
21587b5fefc8Smrg# ----------------
21597b5fefc8Smrg# Minimum version: 1.6.0
21607b5fefc8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21612227fc13Smrg#
21627b5fefc8Smrg# Documentation tools are not always available on all platforms and sometimes
21637b5fefc8Smrg# not at the appropriate level. This macro enables a module to test for the
21647b5fefc8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21657b5fefc8Smrg# the --with-groff option, it allows maximum flexibility in making decisions
21667b5fefc8Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
21677b5fefc8Smrg# --with-groff assumes 'auto'.
21682227fc13Smrg#
21697b5fefc8Smrg# Interface to module:
21707b5fefc8Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21717b5fefc8Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21727b5fefc8Smrg# HAVE_GROFF_MS: the -ms macros package
21737b5fefc8Smrg# GROFF:	 returns the path of the groff program found
21747b5fefc8Smrg#		 returns the path set by the user in the environment
21757b5fefc8Smrg# --with-groff:	 'yes' user instructs the module to use groff
21767b5fefc8Smrg#		 'no' user instructs the module not to use groff
21772227fc13Smrg#
21787b5fefc8Smrg# Added in version 1.9.0:
21797b5fefc8Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21807b5fefc8Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21817b5fefc8Smrg#		   psselect from the psutils package.
21827b5fefc8Smrg#		   the ghostcript package. Refer to the grohtml man pages
21832227fc13Smrg#
21847b5fefc8Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21852227fc13Smrg#
21867b5fefc8Smrg# OS and distros often splits groff in a basic and full package, the former
21877b5fefc8Smrg# having the groff program and the later having devices, fonts and macros
21887b5fefc8Smrg# Checking for the groff executable is not enough.
21892227fc13Smrg#
21907b5fefc8Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
21917b5fefc8Smrg# unset HAVE_GROFF or GROFF env variables.
21927b5fefc8Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21937b5fefc8Smrg#
21947b5fefc8SmrgAC_DEFUN([XORG_WITH_GROFF],[
21957b5fefc8SmrgAC_ARG_VAR([GROFF], [Path to groff command])
21967b5fefc8Smrgm4_define([_defopt], m4_default([$1], [auto]))
21977b5fefc8SmrgAC_ARG_WITH(groff,
21987b5fefc8Smrg	AS_HELP_STRING([--with-groff],
21997b5fefc8Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
22007b5fefc8Smrg	   [use_groff=$withval], [use_groff=]_defopt)
22017b5fefc8Smrgm4_undefine([_defopt])
2202644fc5c1Stron
22037b5fefc8Smrgif test "x$use_groff" = x"auto"; then
22047b5fefc8Smrg   AC_PATH_PROG([GROFF], [groff])
22057b5fefc8Smrg   if test "x$GROFF" = "x"; then
22067b5fefc8Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22077b5fefc8Smrg	have_groff=no
22087b5fefc8Smrg   else
22097b5fefc8Smrg        have_groff=yes
22107b5fefc8Smrg   fi
22117b5fefc8Smrgelif test "x$use_groff" = x"yes" ; then
22127b5fefc8Smrg   AC_PATH_PROG([GROFF], [groff])
22137b5fefc8Smrg   if test "x$GROFF" = "x"; then
22147b5fefc8Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22157b5fefc8Smrg   fi
22167b5fefc8Smrg   have_groff=yes
22177b5fefc8Smrgelif test "x$use_groff" = x"no" ; then
22187b5fefc8Smrg   if test "x$GROFF" != "x"; then
22197b5fefc8Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22207b5fefc8Smrg   fi
22217b5fefc8Smrg   have_groff=no
22222227fc13Smrgelse
22237b5fefc8Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22242227fc13Smrgfi
2225644fc5c1Stron
22267b5fefc8Smrg# We have groff, test for the presence of the macro packages
22277b5fefc8Smrgif test "x$have_groff" = x"yes"; then
22287b5fefc8Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22297b5fefc8Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22307b5fefc8Smrg        groff_ms_works=yes
22317b5fefc8Smrg    else
22327b5fefc8Smrg        groff_ms_works=no
2233644fc5c1Stron    fi
22347b5fefc8Smrg    AC_MSG_RESULT([$groff_ms_works])
22357b5fefc8Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22367b5fefc8Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22377b5fefc8Smrg        groff_mm_works=yes
22387b5fefc8Smrg    else
22397b5fefc8Smrg        groff_mm_works=no
22407b5fefc8Smrg    fi
22417b5fefc8Smrg    AC_MSG_RESULT([$groff_mm_works])
2242644fc5c1Stronfi
2243644fc5c1Stron
22447b5fefc8Smrg# We have groff, test for HTML dependencies, one command per package
22457b5fefc8Smrgif test "x$have_groff" = x"yes"; then
22467b5fefc8Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22477b5fefc8Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22487b5fefc8Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22497b5fefc8Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22507b5fefc8Smrg      have_groff_html=yes
22517b5fefc8Smrg   else
22527b5fefc8Smrg      have_groff_html=no
22537b5fefc8Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22547b5fefc8Smrg   fi
22557b5fefc8Smrgfi
2256644fc5c1Stron
22577b5fefc8Smrg# Set Automake conditionals for Makefiles
22587b5fefc8SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22597b5fefc8SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22607b5fefc8SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22617b5fefc8SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22627b5fefc8Smrg]) # XORG_WITH_GROFF
2263644fc5c1Stron
22647b5fefc8Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22657b5fefc8Smrg# ---------------------------------------
22667b5fefc8Smrg# Minimum version: 1.6.0
22677b5fefc8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22687b5fefc8Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
22697b5fefc8Smrg#
22707b5fefc8Smrg# Documentation tools are not always available on all platforms and sometimes
22717b5fefc8Smrg# not at the appropriate level. This macro enables a module to test for the
22727b5fefc8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22737b5fefc8Smrg# the --with-fop option, it allows maximum flexibility in making decisions
22747b5fefc8Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
22757b5fefc8Smrg# --with-fop assumes 'auto'.
22767b5fefc8Smrg#
22777b5fefc8Smrg# Interface to module:
22787b5fefc8Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22797b5fefc8Smrg# FOP:	 	returns the path of the fop program found
22807b5fefc8Smrg#		returns the path set by the user in the environment
22817b5fefc8Smrg# --with-fop: 	'yes' user instructs the module to use fop
22827b5fefc8Smrg#		'no' user instructs the module not to use fop
22837b5fefc8Smrg#
22847b5fefc8Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22857b5fefc8Smrg#
22867b5fefc8SmrgAC_DEFUN([XORG_WITH_FOP],[
22877b5fefc8SmrgAC_ARG_VAR([FOP], [Path to fop command])
22887b5fefc8Smrgm4_define([_defopt], m4_default([$2], [auto]))
22897b5fefc8SmrgAC_ARG_WITH(fop,
22907b5fefc8Smrg	AS_HELP_STRING([--with-fop],
22917b5fefc8Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22927b5fefc8Smrg	   [use_fop=$withval], [use_fop=]_defopt)
22937b5fefc8Smrgm4_undefine([_defopt])
2294644fc5c1Stron
22957b5fefc8Smrgif test "x$use_fop" = x"auto"; then
22967b5fefc8Smrg   AC_PATH_PROG([FOP], [fop])
22977b5fefc8Smrg   if test "x$FOP" = "x"; then
22987b5fefc8Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22997b5fefc8Smrg	have_fop=no
23007b5fefc8Smrg   else
23017b5fefc8Smrg        have_fop=yes
23027b5fefc8Smrg   fi
23037b5fefc8Smrgelif test "x$use_fop" = x"yes" ; then
23047b5fefc8Smrg   AC_PATH_PROG([FOP], [fop])
23057b5fefc8Smrg   if test "x$FOP" = "x"; then
23067b5fefc8Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23077b5fefc8Smrg   fi
23087b5fefc8Smrg   have_fop=yes
23097b5fefc8Smrgelif test "x$use_fop" = x"no" ; then
23107b5fefc8Smrg   if test "x$FOP" != "x"; then
23117b5fefc8Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23127b5fefc8Smrg   fi
23137b5fefc8Smrg   have_fop=no
23147b5fefc8Smrgelse
23157b5fefc8Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2316644fc5c1Stronfi
2317644fc5c1Stron
23187b5fefc8Smrg# Test for a minimum version of fop, if provided.
23197b5fefc8Smrgm4_ifval([$1],
23207b5fefc8Smrg[if test "$have_fop" = yes; then
23217b5fefc8Smrg    # scrape the fop version
23227b5fefc8Smrg    AC_MSG_CHECKING([for fop minimum version])
23237b5fefc8Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23247b5fefc8Smrg    AC_MSG_RESULT([$fop_version])
23257b5fefc8Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
23267b5fefc8Smrg        [if test "x$use_fop" = xauto; then
23277b5fefc8Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23287b5fefc8Smrg            have_fop=no
23297b5fefc8Smrg        else
23307b5fefc8Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23317b5fefc8Smrg        fi])
23327b5fefc8Smrgfi])
23337b5fefc8SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23347b5fefc8Smrg]) # XORG_WITH_FOP
2335644fc5c1Stron
23367b5fefc8Smrg# XORG_WITH_M4([MIN-VERSION])
23377b5fefc8Smrg# ---------------------------
23387b5fefc8Smrg# Minimum version: 1.19.0
23392227fc13Smrg#
23407b5fefc8Smrg# This macro attempts to locate an m4 macro processor which supports
23417b5fefc8Smrg# -I option and is only useful for modules relying on M4 in order to
23427b5fefc8Smrg# expand macros in source code files.
23432227fc13Smrg#
23447b5fefc8Smrg# Interface to module:
23457b5fefc8Smrg# M4:	 	returns the path of the m4 program found
23467b5fefc8Smrg#		returns the path set by the user in the environment
23477b5fefc8Smrg#
23487b5fefc8SmrgAC_DEFUN([XORG_WITH_M4], [
23497b5fefc8SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23507b5fefc8Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23517b5fefc8Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23527b5fefc8Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23537b5fefc8Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23547b5fefc8Smrg   [$PATH:/usr/gnu/bin])])
23552227fc13Smrg
23567b5fefc8SmrgAC_SUBST([M4], [$ac_cv_path_M4])
23577b5fefc8Smrg]) # XORG_WITH_M4
23582227fc13Smrg
23597b5fefc8Smrg# XORG_WITH_PS2PDF([DEFAULT])
23607b5fefc8Smrg# ----------------
23617b5fefc8Smrg# Minimum version: 1.6.0
23627b5fefc8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23637b5fefc8Smrg#
23647b5fefc8Smrg# Documentation tools are not always available on all platforms and sometimes
23657b5fefc8Smrg# not at the appropriate level. This macro enables a module to test for the
23667b5fefc8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23677b5fefc8Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
23687b5fefc8Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23697b5fefc8Smrg# --with-ps2pdf assumes 'auto'.
23707b5fefc8Smrg#
23717b5fefc8Smrg# Interface to module:
23727b5fefc8Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23737b5fefc8Smrg# PS2PDF:	returns the path of the ps2pdf program found
23747b5fefc8Smrg#		returns the path set by the user in the environment
23757b5fefc8Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23767b5fefc8Smrg#		 'no' user instructs the module not to use ps2pdf
23777b5fefc8Smrg#
23787b5fefc8Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23797b5fefc8Smrg#
23807b5fefc8SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23817b5fefc8SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23827b5fefc8Smrgm4_define([_defopt], m4_default([$1], [auto]))
23837b5fefc8SmrgAC_ARG_WITH(ps2pdf,
23847b5fefc8Smrg	AS_HELP_STRING([--with-ps2pdf],
23857b5fefc8Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23867b5fefc8Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23877b5fefc8Smrgm4_undefine([_defopt])
23882227fc13Smrg
23897b5fefc8Smrgif test "x$use_ps2pdf" = x"auto"; then
23907b5fefc8Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23917b5fefc8Smrg   if test "x$PS2PDF" = "x"; then
23927b5fefc8Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23937b5fefc8Smrg	have_ps2pdf=no
23947b5fefc8Smrg   else
23957b5fefc8Smrg        have_ps2pdf=yes
23967b5fefc8Smrg   fi
23977b5fefc8Smrgelif test "x$use_ps2pdf" = x"yes" ; then
23987b5fefc8Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23997b5fefc8Smrg   if test "x$PS2PDF" = "x"; then
24007b5fefc8Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24017b5fefc8Smrg   fi
24027b5fefc8Smrg   have_ps2pdf=yes
24037b5fefc8Smrgelif test "x$use_ps2pdf" = x"no" ; then
24047b5fefc8Smrg   if test "x$PS2PDF" != "x"; then
24057b5fefc8Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24067b5fefc8Smrg   fi
24077b5fefc8Smrg   have_ps2pdf=no
24087b5fefc8Smrgelse
24097b5fefc8Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
24102227fc13Smrgfi
24117b5fefc8SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24127b5fefc8Smrg]) # XORG_WITH_PS2PDF
24132227fc13Smrg
24147b5fefc8Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
24157b5fefc8Smrg# ----------------
24167b5fefc8Smrg# Minimum version: 1.6.0
24177b5fefc8Smrg#
24187b5fefc8Smrg# Documentation tools are not always available on all platforms and sometimes
24197b5fefc8Smrg# not at the appropriate level. This macro enables a builder to skip all
24207b5fefc8Smrg# documentation targets except traditional man pages.
24217b5fefc8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24227b5fefc8Smrg# maximum flexibility in controlling documentation building.
24237b5fefc8Smrg# Refer to:
24247b5fefc8Smrg# XORG_WITH_XMLTO         --with-xmlto
24257b5fefc8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24267b5fefc8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24277b5fefc8Smrg# XORG_WITH_FOP           --with-fop
24287b5fefc8Smrg# XORG_WITH_GROFF         --with-groff
24297b5fefc8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24307b5fefc8Smrg#
24317b5fefc8Smrg# Interface to module:
24327b5fefc8Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24337b5fefc8Smrg# --enable-docs: 'yes' user instructs the module to generate docs
24347b5fefc8Smrg#		 'no' user instructs the module not to generate docs
24357b5fefc8Smrg# parm1:	specify the default value, yes or no.
24367b5fefc8Smrg#
24377b5fefc8SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24387b5fefc8Smrgm4_define([docs_default], m4_default([$1], [yes]))
24397b5fefc8SmrgAC_ARG_ENABLE(docs,
24407b5fefc8Smrg	AS_HELP_STRING([--enable-docs],
24417b5fefc8Smrg	   [Enable building the documentation (default: ]docs_default[)]),
24427b5fefc8Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
24437b5fefc8Smrgm4_undefine([docs_default])
24447b5fefc8SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24457b5fefc8SmrgAC_MSG_CHECKING([whether to build documentation])
24467b5fefc8SmrgAC_MSG_RESULT([$build_docs])
24477b5fefc8Smrg]) # XORG_ENABLE_DOCS
24482227fc13Smrg
24497b5fefc8Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24507b5fefc8Smrg# ----------------
24517b5fefc8Smrg# Minimum version: 1.6.0
24527b5fefc8Smrg#
24537b5fefc8Smrg# This macro enables a builder to skip all developer documentation.
24547b5fefc8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24557b5fefc8Smrg# maximum flexibility in controlling documentation building.
24567b5fefc8Smrg# Refer to:
24577b5fefc8Smrg# XORG_WITH_XMLTO         --with-xmlto
24587b5fefc8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24597b5fefc8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24607b5fefc8Smrg# XORG_WITH_FOP           --with-fop
24617b5fefc8Smrg# XORG_WITH_GROFF         --with-groff
24627b5fefc8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24637b5fefc8Smrg#
24647b5fefc8Smrg# Interface to module:
24657b5fefc8Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24667b5fefc8Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24677b5fefc8Smrg#			'no' user instructs the module not to generate developer docs
24687b5fefc8Smrg# parm1:		specify the default value, yes or no.
24697b5fefc8Smrg#
24707b5fefc8SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24717b5fefc8Smrgm4_define([devel_default], m4_default([$1], [yes]))
24727b5fefc8SmrgAC_ARG_ENABLE(devel-docs,
24737b5fefc8Smrg	AS_HELP_STRING([--enable-devel-docs],
24747b5fefc8Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24757b5fefc8Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24767b5fefc8Smrgm4_undefine([devel_default])
24777b5fefc8SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24787b5fefc8SmrgAC_MSG_CHECKING([whether to build developer documentation])
24797b5fefc8SmrgAC_MSG_RESULT([$build_devel_docs])
24807b5fefc8Smrg]) # XORG_ENABLE_DEVEL_DOCS
24812227fc13Smrg
24827b5fefc8Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
24837b5fefc8Smrg# ----------------
24847b5fefc8Smrg# Minimum version: 1.6.0
24857b5fefc8Smrg#
24867b5fefc8Smrg# This macro enables a builder to skip all functional specification targets.
24877b5fefc8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24887b5fefc8Smrg# maximum flexibility in controlling documentation building.
24897b5fefc8Smrg# Refer to:
24907b5fefc8Smrg# XORG_WITH_XMLTO         --with-xmlto
24917b5fefc8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24927b5fefc8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24937b5fefc8Smrg# XORG_WITH_FOP           --with-fop
24947b5fefc8Smrg# XORG_WITH_GROFF         --with-groff
24957b5fefc8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24967b5fefc8Smrg#
24977b5fefc8Smrg# Interface to module:
24987b5fefc8Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24997b5fefc8Smrg# --enable-specs:	'yes' user instructs the module to generate specs
25007b5fefc8Smrg#			'no' user instructs the module not to generate specs
25017b5fefc8Smrg# parm1:		specify the default value, yes or no.
25027b5fefc8Smrg#
25037b5fefc8SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25047b5fefc8Smrgm4_define([spec_default], m4_default([$1], [yes]))
25057b5fefc8SmrgAC_ARG_ENABLE(specs,
25067b5fefc8Smrg	AS_HELP_STRING([--enable-specs],
25077b5fefc8Smrg	   [Enable building the specs (default: ]spec_default[)]),
25087b5fefc8Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
25097b5fefc8Smrgm4_undefine([spec_default])
25107b5fefc8SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25117b5fefc8SmrgAC_MSG_CHECKING([whether to build functional specifications])
25127b5fefc8SmrgAC_MSG_RESULT([$build_specs])
25137b5fefc8Smrg]) # XORG_ENABLE_SPECS
25142227fc13Smrg
25157b5fefc8Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25167b5fefc8Smrg# ----------------------------------------------
25177b5fefc8Smrg# Minimum version: 1.13.0
25187b5fefc8Smrg#
25197b5fefc8Smrg# This macro enables a builder to enable/disable unit testing
25207b5fefc8Smrg# It makes no assumption about the test cases implementation
25217b5fefc8Smrg# Test cases may or may not use Automake "Support for test suites"
25227b5fefc8Smrg# They may or may not use the software utility library GLib
25237b5fefc8Smrg#
25247b5fefc8Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25257b5fefc8Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25267b5fefc8Smrg# The variable enable_unit_tests is used by other macros in this file.
25277b5fefc8Smrg#
25287b5fefc8Smrg# Interface to module:
25297b5fefc8Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25307b5fefc8Smrg# enable_unit_tests:    used in configure.ac for additional configuration
25317b5fefc8Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25327b5fefc8Smrg#			'no' user instructs the module not to build tests
25337b5fefc8Smrg# parm1:		specify the default value, yes or no.
25347b5fefc8Smrg#
25357b5fefc8SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25367b5fefc8SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25377b5fefc8SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25387b5fefc8SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25397b5fefc8Smrgm4_define([_defopt], m4_default([$1], [auto]))
25407b5fefc8SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25417b5fefc8Smrg	[Enable building unit test cases (default: ]_defopt[)]),
25427b5fefc8Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25437b5fefc8Smrgm4_undefine([_defopt])
25447b5fefc8SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25457b5fefc8SmrgAC_MSG_CHECKING([whether to build unit test cases])
25467b5fefc8SmrgAC_MSG_RESULT([$enable_unit_tests])
25477b5fefc8Smrg]) # XORG_ENABLE_UNIT_TESTS
25482227fc13Smrg
25497b5fefc8Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25507b5fefc8Smrg# ------------------------------------------------------
25517b5fefc8Smrg# Minimum version: 1.17.0
25527b5fefc8Smrg#
25537b5fefc8Smrg# This macro enables a builder to enable/disable integration testing
25547b5fefc8Smrg# It makes no assumption about the test cases' implementation
25557b5fefc8Smrg# Test cases may or may not use Automake "Support for test suites"
25567b5fefc8Smrg#
25577b5fefc8Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25587b5fefc8Smrg# usually requires less dependencies and may be built and run under less
25597b5fefc8Smrg# stringent environments than integration tests.
25607b5fefc8Smrg#
25617b5fefc8Smrg# Interface to module:
25627b5fefc8Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25637b5fefc8Smrg# enable_integration_tests:   used in configure.ac for additional configuration
25647b5fefc8Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25657b5fefc8Smrg#                             'no' user instructs the module not to build tests
25667b5fefc8Smrg# parm1:                      specify the default value, yes or no.
25677b5fefc8Smrg#
25687b5fefc8SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
25697b5fefc8SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25707b5fefc8Smrgm4_define([_defopt], m4_default([$1], [auto]))
25717b5fefc8SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
25727b5fefc8Smrg	[Enable building integration test cases (default: ]_defopt[)]),
25737b5fefc8Smrg	[enable_integration_tests=$enableval],
25747b5fefc8Smrg	[enable_integration_tests=]_defopt)
25757b5fefc8Smrgm4_undefine([_defopt])
25767b5fefc8SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
25777b5fefc8Smrg	[test "x$enable_integration_tests" != xno])
25787b5fefc8SmrgAC_MSG_CHECKING([whether to build unit test cases])
25797b5fefc8SmrgAC_MSG_RESULT([$enable_integration_tests])
25807b5fefc8Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
25812227fc13Smrg
25827b5fefc8Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25837b5fefc8Smrg# ----------------------------------------
25847b5fefc8Smrg# Minimum version: 1.13.0
25857b5fefc8Smrg#
25867b5fefc8Smrg# GLib is a library which provides advanced data structures and functions.
25877b5fefc8Smrg# This macro enables a module to test for the presence of Glib.
25887b5fefc8Smrg#
25897b5fefc8Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25907b5fefc8Smrg# Otherwise the value of $enable_unit_tests is blank.
25917b5fefc8Smrg#
25927b5fefc8Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25937b5fefc8Smrg# test support usually requires less dependencies and may be built and run under
25947b5fefc8Smrg# less stringent environments than integration tests.
25957b5fefc8Smrg#
25967b5fefc8Smrg# Interface to module:
25977b5fefc8Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
25987b5fefc8Smrg# with_glib: used in configure.ac to know if GLib has been found
25997b5fefc8Smrg# --with-glib:	'yes' user instructs the module to use glib
26007b5fefc8Smrg#		'no' user instructs the module not to use glib
26017b5fefc8Smrg#
26027b5fefc8SmrgAC_DEFUN([XORG_WITH_GLIB],[
26037b5fefc8SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26047b5fefc8Smrgm4_define([_defopt], m4_default([$2], [auto]))
26057b5fefc8SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26067b5fefc8Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26077b5fefc8Smrg	[with_glib=$withval], [with_glib=]_defopt)
26087b5fefc8Smrgm4_undefine([_defopt])
26092227fc13Smrg
26107b5fefc8Smrghave_glib=no
26117b5fefc8Smrg# Do not probe GLib if user explicitly disabled unit testing
26127b5fefc8Smrgif test "x$enable_unit_tests" != x"no"; then
26137b5fefc8Smrg  # Do not probe GLib if user explicitly disabled it
26147b5fefc8Smrg  if test "x$with_glib" != x"no"; then
26157b5fefc8Smrg    m4_ifval(
26167b5fefc8Smrg      [$1],
26177b5fefc8Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26187b5fefc8Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26197b5fefc8Smrg    )
26207b5fefc8Smrg  fi
26217b5fefc8Smrgfi
26222227fc13Smrg
26237b5fefc8Smrg# Not having GLib when unit testing has been explicitly requested is an error
26247b5fefc8Smrgif test "x$enable_unit_tests" = x"yes"; then
26257b5fefc8Smrg  if test "x$have_glib" = x"no"; then
26267b5fefc8Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26277b5fefc8Smrg  fi
26287b5fefc8Smrgfi
26292227fc13Smrg
26307b5fefc8Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
26317b5fefc8Smrgif test "x$enable_unit_tests" = x"no"; then
26327b5fefc8Smrg  if test "x$with_glib" = x"yes"; then
26337b5fefc8Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26347b5fefc8Smrg  fi
26352227fc13Smrgfi
26362227fc13Smrg
26377b5fefc8Smrg# Not having GLib when it has been explicitly requested is an error
26387b5fefc8Smrgif test "x$with_glib" = x"yes"; then
26397b5fefc8Smrg  if test "x$have_glib" = x"no"; then
26407b5fefc8Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26417b5fefc8Smrg  fi
26427b5fefc8Smrgfi
26432227fc13Smrg
26447b5fefc8SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26457b5fefc8Smrg]) # XORG_WITH_GLIB
26462227fc13Smrg
26477b5fefc8Smrg# XORG_LD_WRAP([required|optional])
26487b5fefc8Smrg# ---------------------------------
26497b5fefc8Smrg# Minimum version: 1.13.0
26507b5fefc8Smrg#
26517b5fefc8Smrg# Check if linker supports -wrap, passed via compiler flags
26527b5fefc8Smrg#
26537b5fefc8Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26547b5fefc8Smrg# Otherwise the value of $enable_unit_tests is blank.
26557b5fefc8Smrg#
26567b5fefc8Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26577b5fefc8Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26587b5fefc8Smrg# available, an argument of "optional" allows use when some unit tests require
26597b5fefc8Smrg# ld -wrap and others do not.
26607b5fefc8Smrg#
26617b5fefc8SmrgAC_DEFUN([XORG_LD_WRAP],[
26627b5fefc8SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26637b5fefc8Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26647b5fefc8Smrg                      void __wrap_exit(int status) { return; }],
26657b5fefc8Smrg                     [exit(0);])])
26667b5fefc8Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
26677b5fefc8Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
26687b5fefc8Smrg  if test "x$have_ld_wrap" = x"no"; then
26697b5fefc8Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
26707b5fefc8Smrg  fi
26712227fc13Smrgfi
26727b5fefc8SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
26737b5fefc8Smrg#
26747b5fefc8Smrg]) # XORG_LD_WRAP
2675644fc5c1Stron
26767b5fefc8Smrg# XORG_CHECK_LINKER_FLAGS
26777b5fefc8Smrg# -----------------------
26787b5fefc8Smrg# SYNOPSIS
26797b5fefc8Smrg#
26807b5fefc8Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26817b5fefc8Smrg#
26827b5fefc8Smrg# DESCRIPTION
26837b5fefc8Smrg#
26847b5fefc8Smrg#   Check whether the given linker FLAGS work with the current language's
26857b5fefc8Smrg#   linker, or whether they give an error.
26867b5fefc8Smrg#
26877b5fefc8Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26887b5fefc8Smrg#   success/failure.
26897b5fefc8Smrg#
26907b5fefc8Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
26917b5fefc8Smrg#
26927b5fefc8Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26937b5fefc8Smrg#
26947b5fefc8Smrg# LICENSE
26957b5fefc8Smrg#
26967b5fefc8Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26977b5fefc8Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26987b5fefc8Smrg#   Copyright (c) 2009 Matteo Frigo
26997b5fefc8Smrg#
27007b5fefc8Smrg#   This program is free software: you can redistribute it and/or modify it
27017b5fefc8Smrg#   under the terms of the GNU General Public License as published by the
27027b5fefc8Smrg#   Free Software Foundation, either version 3 of the License, or (at your
27037b5fefc8Smrg#   option) any later version.
27047b5fefc8Smrg#
27057b5fefc8Smrg#   This program is distributed in the hope that it will be useful, but
27067b5fefc8Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27077b5fefc8Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27087b5fefc8Smrg#   Public License for more details.
27097b5fefc8Smrg#
27107b5fefc8Smrg#   You should have received a copy of the GNU General Public License along
27117b5fefc8Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27127b5fefc8Smrg#
27137b5fefc8Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
27147b5fefc8Smrg#   gives unlimited permission to copy, distribute and modify the configure
27157b5fefc8Smrg#   scripts that are the output of Autoconf when processing the Macro. You
27167b5fefc8Smrg#   need not follow the terms of the GNU General Public License when using
27177b5fefc8Smrg#   or distributing such scripts, even though portions of the text of the
27187b5fefc8Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27197b5fefc8Smrg#   all other use of the material that constitutes the Autoconf Macro.
27207b5fefc8Smrg#
27217b5fefc8Smrg#   This special exception to the GPL applies to versions of the Autoconf
27227b5fefc8Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
27237b5fefc8Smrg#   modified version of the Autoconf Macro, you may extend this special
27247b5fefc8Smrg#   exception to the GPL to apply to your modified version as well.#
27257b5fefc8SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27267b5fefc8Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
27277b5fefc8Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27287b5fefc8SmrgAS_LITERAL_IF([$1],
27297b5fefc8Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27307b5fefc8Smrg      ax_save_FLAGS=$LDFLAGS
27317b5fefc8Smrg      LDFLAGS="$1"
27327b5fefc8Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27337b5fefc8Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27347b5fefc8Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27357b5fefc8Smrg      LDFLAGS=$ax_save_FLAGS])],
27367b5fefc8Smrg  [ax_save_FLAGS=$LDFLAGS
27377b5fefc8Smrg   LDFLAGS="$1"
27387b5fefc8Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27397b5fefc8Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27407b5fefc8Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27417b5fefc8Smrg   LDFLAGS=$ax_save_FLAGS])
27427b5fefc8Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27437b5fefc8SmrgAC_MSG_RESULT($xorg_check_linker_flags)
27447b5fefc8Smrgif test "x$xorg_check_linker_flags" = xyes; then
27457b5fefc8Smrg	m4_default([$2], :)
27467b5fefc8Smrgelse
27477b5fefc8Smrg	m4_default([$3], :)
27487b5fefc8Smrgfi
27497b5fefc8Smrg]) # XORG_CHECK_LINKER_FLAGS
2750644fc5c1Stron
27517b5fefc8Smrg# XORG_MEMORY_CHECK_FLAGS
27527b5fefc8Smrg# -----------------------
27537b5fefc8Smrg# Minimum version: 1.16.0
2754644fc5c1Stron#
27557b5fefc8Smrg# This macro attempts to find appropriate memory checking functionality
27567b5fefc8Smrg# for various platforms which unit testing code may use to catch various
27577b5fefc8Smrg# forms of memory allocation and access errors in testing.
27587b5fefc8Smrg#
27597b5fefc8Smrg# Interface to module:
27607b5fefc8Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27617b5fefc8Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27627b5fefc8Smrg#
27637b5fefc8Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27647b5fefc8Smrg#
27657b5fefc8SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2766644fc5c1Stron
27677b5fefc8SmrgAC_REQUIRE([AC_CANONICAL_HOST])
27687b5fefc8SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
27697b5fefc8Smrg           [Environment variables to enable memory checking in tests])
2770644fc5c1Stron
27717b5fefc8Smrg# Check for different types of support on different platforms
27727b5fefc8Smrgcase $host_os in
27737b5fefc8Smrg    solaris*)
27747b5fefc8Smrg        AC_CHECK_LIB([umem], [umem_alloc],
27757b5fefc8Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
27767b5fefc8Smrg        ;;
27777b5fefc8Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
27787b5fefc8Smrg        # both directly and inverted, so should not be 0 or 255.
27797b5fefc8Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
27807b5fefc8Smrg        ;;
27817b5fefc8Smrg    darwin*)
27827b5fefc8Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
27837b5fefc8Smrg        ;;
27847b5fefc8Smrg    *bsd*)
27857b5fefc8Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27867b5fefc8Smrg        ;;
27877b5fefc8Smrgesac
2788644fc5c1Stron
27897b5fefc8Smrg# User supplied flags override default flags
27907b5fefc8Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27917b5fefc8Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27927b5fefc8Smrgfi
2793644fc5c1Stron
27947b5fefc8SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27957b5fefc8Smrg]) # XORG_WITH_LINT
2796644fc5c1Stron
27977b5fefc8Smrg# XORG_CHECK_MALLOC_ZERO
27987b5fefc8Smrg# ----------------------
27997b5fefc8Smrg# Minimum version: 1.0.0
28002227fc13Smrg#
28017b5fefc8Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28027b5fefc8Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28037b5fefc8Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28047b5fefc8SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28057b5fefc8SmrgAC_ARG_ENABLE(malloc0returnsnull,
28067b5fefc8Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28077b5fefc8Smrg		       [malloc(0) returns NULL (default: auto)]),
28087b5fefc8Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28097b5fefc8Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2810644fc5c1Stron
28117b5fefc8SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28127b5fefc8Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28137b5fefc8SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28147b5fefc8Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28157b5fefc8Smrg#include <stdlib.h>
28167b5fefc8Smrg],[
28177b5fefc8Smrg    char *m0, *r0, *c0, *p;
28187b5fefc8Smrg    m0 = malloc(0);
28197b5fefc8Smrg    p = malloc(10);
28207b5fefc8Smrg    r0 = realloc(p,0);
28217b5fefc8Smrg    c0 = calloc(0,10);
28227b5fefc8Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28237b5fefc8Smrg])],
28247b5fefc8Smrg		[xorg_cv_malloc0_returns_null=yes],
28257b5fefc8Smrg		[xorg_cv_malloc0_returns_null=no])])
28267b5fefc8SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28277b5fefc8Smrgfi
28287b5fefc8SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2829644fc5c1Stron
28307b5fefc8Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28317b5fefc8Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28327b5fefc8Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28337b5fefc8Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28347b5fefc8Smrgelse
28357b5fefc8Smrg	MALLOC_ZERO_CFLAGS=""
28367b5fefc8Smrg	XMALLOC_ZERO_CFLAGS=""
28377b5fefc8Smrg	XTMALLOC_ZERO_CFLAGS=""
28387b5fefc8Smrgfi
2839644fc5c1Stron
28407b5fefc8SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28417b5fefc8SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28427b5fefc8SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28437b5fefc8Smrg]) # XORG_CHECK_MALLOC_ZERO
2844644fc5c1Stron
28457b5fefc8Smrg# XORG_WITH_LINT()
28467b5fefc8Smrg# ----------------
28477b5fefc8Smrg# Minimum version: 1.1.0
28482227fc13Smrg#
28497b5fefc8Smrg# This macro enables the use of a tool that flags some suspicious and
28507b5fefc8Smrg# non-portable constructs (likely to be bugs) in C language source code.
28517b5fefc8Smrg# It will attempt to locate the tool and use appropriate options.
28527b5fefc8Smrg# There are various lint type tools on different platforms.
28537b5fefc8Smrg#
28547b5fefc8Smrg# Interface to module:
28557b5fefc8Smrg# LINT:		returns the path to the tool found on the platform
28567b5fefc8Smrg#		or the value set to LINT on the configure cmd line
28577b5fefc8Smrg#		also an Automake conditional
28587b5fefc8Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
28597b5fefc8Smrg#
28607b5fefc8Smrg# --with-lint:	'yes' user instructs the module to use lint
28617b5fefc8Smrg#		'no' user instructs the module not to use lint (default)
28627b5fefc8Smrg#
28637b5fefc8Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28647b5fefc8Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28657b5fefc8Smrg#
28667b5fefc8SmrgAC_DEFUN([XORG_WITH_LINT],[
2867644fc5c1Stron
28687b5fefc8SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
28697b5fefc8SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
28707b5fefc8SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
28717b5fefc8Smrg		[Use a lint-style source code checker (default: disabled)])],
28727b5fefc8Smrg		[use_lint=$withval], [use_lint=no])
2873644fc5c1Stron
28747b5fefc8Smrg# Obtain platform specific info like program name and options
28757b5fefc8Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
28767b5fefc8Smrgcase $host_os in
28777b5fefc8Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
28787b5fefc8Smrg	lint_name=splint
28797b5fefc8Smrg	lint_options="-badflag"
28807b5fefc8Smrg	;;
28817b5fefc8Smrg  *freebsd* | *netbsd*)
28827b5fefc8Smrg	lint_name=lint
28837b5fefc8Smrg	lint_options="-u -b"
28847b5fefc8Smrg	;;
28857b5fefc8Smrg  *solaris*)
28867b5fefc8Smrg	lint_name=lint
28877b5fefc8Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28887b5fefc8Smrg	;;
28897b5fefc8Smrgesac
28902227fc13Smrg
28917b5fefc8Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28927b5fefc8Smrgif test "x$use_lint" = x"yes" ; then
28937b5fefc8Smrg   AC_PATH_PROG([LINT], [$lint_name])
28947b5fefc8Smrg   if test "x$LINT" = "x"; then
28957b5fefc8Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28967b5fefc8Smrg   fi
28977b5fefc8Smrgelif test "x$use_lint" = x"no" ; then
28987b5fefc8Smrg   if test "x$LINT" != "x"; then
28997b5fefc8Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
29007b5fefc8Smrg   fi
29012227fc13Smrgelse
29027b5fefc8Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
29032227fc13Smrgfi
29042227fc13Smrg
29057b5fefc8Smrg# User supplied flags override default flags
29067b5fefc8Smrgif test "x$LINT_FLAGS" != "x"; then
29077b5fefc8Smrg   lint_options=$LINT_FLAGS
29087b5fefc8Smrgfi
29092227fc13Smrg
29107b5fefc8SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29117b5fefc8SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
29122227fc13Smrg
29137b5fefc8Smrg]) # XORG_WITH_LINT
29142227fc13Smrg
29157b5fefc8Smrg# XORG_LINT_LIBRARY(LIBNAME)
29167b5fefc8Smrg# --------------------------
29177b5fefc8Smrg# Minimum version: 1.1.0
29182227fc13Smrg#
29197b5fefc8Smrg# Sets up flags for building lint libraries for checking programs that call
29207b5fefc8Smrg# functions in the library.
29217b5fefc8Smrg#
29227b5fefc8Smrg# Interface to module:
29237b5fefc8Smrg# LINTLIB		- Automake variable with the name of lint library file to make
29247b5fefc8Smrg# MAKE_LINT_LIB		- Automake conditional
29257b5fefc8Smrg#
29267b5fefc8Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29277b5fefc8Smrg#			  - 'no' user instructs the module not to create a lint library (default)
29282227fc13Smrg
29297b5fefc8SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29307b5fefc8SmrgAC_REQUIRE([XORG_WITH_LINT])
29317b5fefc8SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29327b5fefc8Smrg	[Create lint library (default: disabled)])],
29337b5fefc8Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
29342227fc13Smrg
29357b5fefc8Smrgif test "x$make_lint_lib" = x"yes" ; then
29367b5fefc8Smrg   LINTLIB=llib-l$1.ln
29377b5fefc8Smrg   if test "x$LINT" = "x"; then
29387b5fefc8Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29397b5fefc8Smrg   fi
29407b5fefc8Smrgelif test "x$make_lint_lib" != x"no" ; then
29417b5fefc8Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29427b5fefc8Smrgfi
29432227fc13Smrg
29447b5fefc8SmrgAC_SUBST(LINTLIB)
29457b5fefc8SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29462227fc13Smrg
29477b5fefc8Smrg]) # XORG_LINT_LIBRARY
29482227fc13Smrg
29497b5fefc8Smrg# XORG_COMPILER_BRAND
29507b5fefc8Smrg# -------------------
29517b5fefc8Smrg# Minimum version: 1.14.0
29527b5fefc8Smrg#
29537b5fefc8Smrg# Checks for various brands of compilers and sets flags as appropriate:
29547b5fefc8Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29557b5fefc8Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29567b5fefc8Smrg#   clang compiler - sets CLANGCC to "yes"
29577b5fefc8Smrg#   Intel compiler - sets INTELCC to "yes"
29587b5fefc8Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29597b5fefc8Smrg#
29607b5fefc8SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29617b5fefc8SmrgAC_LANG_CASE(
29627b5fefc8Smrg	[C], [
29637b5fefc8Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29647b5fefc8Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
29657b5fefc8Smrg		m4_version_prereq([2.70],
29667b5fefc8Smrg			[AC_REQUIRE([AC_PROG_CC])],
29677b5fefc8Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
29687b5fefc8Smrg	],
29697b5fefc8Smrg	[C++], [
29707b5fefc8Smrg		AC_REQUIRE([AC_PROG_CXX])
29717b5fefc8Smrg	]
29727b5fefc8Smrg)
29737b5fefc8SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
29747b5fefc8SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
29757b5fefc8SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
29767b5fefc8Smrg]) # XORG_COMPILER_BRAND
29772227fc13Smrg
29787b5fefc8Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
29797b5fefc8Smrg# ---------------
29807b5fefc8Smrg# Minimum version: 1.16.0
29817b5fefc8Smrg#
29827b5fefc8Smrg# Test if the compiler works when passed the given flag as a command line argument.
29837b5fefc8Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
29847b5fefc8Smrg# next flag in the list until there are no more options.
29857b5fefc8Smrg#
29867b5fefc8Smrg# Note that this does not guarantee that the compiler supports the flag as some
29877b5fefc8Smrg# compilers will simply ignore arguments that they do not understand, but we do
29887b5fefc8Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29897b5fefc8Smrg# -Werror=unused-command-line-argument
29907b5fefc8Smrg#
29917b5fefc8SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29927b5fefc8Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29937b5fefc8Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29947b5fefc8Smrg
29957b5fefc8SmrgAC_LANG_COMPILER_REQUIRE
29967b5fefc8Smrg
29977b5fefc8SmrgAC_LANG_CASE(
29987b5fefc8Smrg	[C], [
29997b5fefc8Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
30007b5fefc8Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
30017b5fefc8Smrg		m4_version_prereq([2.70],
30027b5fefc8Smrg			[AC_REQUIRE([AC_PROG_CC])],
30037b5fefc8Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30047b5fefc8Smrg		define([PREFIX], [C])
30057b5fefc8Smrg		define([CACHE_PREFIX], [cc])
30067b5fefc8Smrg		define([COMPILER], [$CC])
30077b5fefc8Smrg	],
30087b5fefc8Smrg	[C++], [
30097b5fefc8Smrg		define([PREFIX], [CXX])
30107b5fefc8Smrg		define([CACHE_PREFIX], [cxx])
30117b5fefc8Smrg		define([COMPILER], [$CXX])
30127b5fefc8Smrg	]
30137b5fefc8Smrg)
3014644fc5c1Stron
30157b5fefc8Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30167b5fefc8Smrg
30177b5fefc8Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30187b5fefc8Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30197b5fefc8Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30207b5fefc8Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30217b5fefc8Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30227b5fefc8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30237b5fefc8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30247b5fefc8Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30257b5fefc8Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30267b5fefc8Smrgfi
3027644fc5c1Stron
30287b5fefc8Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30297b5fefc8Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30307b5fefc8Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30317b5fefc8Smrg	fi
30327b5fefc8Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30337b5fefc8Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30347b5fefc8Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30357b5fefc8Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30367b5fefc8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30377b5fefc8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30387b5fefc8Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30397b5fefc8Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30407b5fefc8Smrgfi
3041644fc5c1Stron
30427b5fefc8Smrgfound="no"
30437b5fefc8Smrgm4_foreach([flag], m4_cdr($@), [
30447b5fefc8Smrg	if test $found = "no" ; then
30457b5fefc8Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30467b5fefc8Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30477b5fefc8Smrg		fi
30487b5fefc8Smrg
30497b5fefc8Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30507b5fefc8Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30517b5fefc8Smrg		fi
30527b5fefc8Smrg
30537b5fefc8Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30547b5fefc8Smrg
30557b5fefc8Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30567b5fefc8Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30577b5fefc8Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30587b5fefc8Smrg		AC_CACHE_VAL($cacheid,
30597b5fefc8Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30607b5fefc8Smrg					     [eval $cacheid=yes],
30617b5fefc8Smrg					     [eval $cacheid=no])])
30627b5fefc8Smrg
30637b5fefc8Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30647b5fefc8Smrg
30657b5fefc8Smrg		eval supported=\$$cacheid
30667b5fefc8Smrg		AC_MSG_RESULT([$supported])
30677b5fefc8Smrg		if test "$supported" = "yes" ; then
30687b5fefc8Smrg			$1="$$1 ]flag["
30697b5fefc8Smrg			found="yes"
30707b5fefc8Smrg		fi
30717b5fefc8Smrg	fi
30727b5fefc8Smrg])
30737b5fefc8Smrg]) # XORG_TESTSET_CFLAG
30742227fc13Smrg
30757b5fefc8Smrg# XORG_COMPILER_FLAGS
30767b5fefc8Smrg# ---------------
30777b5fefc8Smrg# Minimum version: 1.16.0
30787b5fefc8Smrg#
30797b5fefc8Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
30807b5fefc8Smrg# arguments supported by the selected compiler which do NOT alter the generated
30817b5fefc8Smrg# code.  These arguments will cause the compiler to print various warnings
30827b5fefc8Smrg# during compilation AND turn a conservative set of warnings into errors.
30837b5fefc8Smrg#
30847b5fefc8Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
30857b5fefc8Smrg# future versions of util-macros as options are added to new compilers.
30867b5fefc8Smrg#
30877b5fefc8SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
30887b5fefc8SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30897b5fefc8Smrg
30907b5fefc8SmrgAC_ARG_ENABLE(selective-werror,
30917b5fefc8Smrg              AS_HELP_STRING([--disable-selective-werror],
30927b5fefc8Smrg                             [Turn off selective compiler errors. (default: enabled)]),
30937b5fefc8Smrg              [SELECTIVE_WERROR=$enableval],
30947b5fefc8Smrg              [SELECTIVE_WERROR=yes])
30957b5fefc8Smrg
30967b5fefc8SmrgAC_LANG_CASE(
30977b5fefc8Smrg        [C], [
30987b5fefc8Smrg                define([PREFIX], [C])
30997b5fefc8Smrg        ],
31007b5fefc8Smrg        [C++], [
31017b5fefc8Smrg                define([PREFIX], [CXX])
31027b5fefc8Smrg        ]
31037b5fefc8Smrg)
31047b5fefc8Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
31057b5fefc8Smrgif test "x$SUNCC" = "xyes"; then
31067b5fefc8Smrg    [BASE_]PREFIX[FLAGS]="-v"
3107644fc5c1Stronelse
31087b5fefc8Smrg    [BASE_]PREFIX[FLAGS]=""
3109644fc5c1Stronfi
3110644fc5c1Stron
31117b5fefc8Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31127b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31137b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31147b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31157b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31167b5fefc8Smrg
31177b5fefc8SmrgAC_LANG_CASE(
31187b5fefc8Smrg	[C], [
31197b5fefc8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31207b5fefc8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31217b5fefc8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31227b5fefc8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31237b5fefc8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31247b5fefc8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31257b5fefc8Smrg	]
31267b5fefc8Smrg)
3127644fc5c1Stron
31287b5fefc8Smrg# This chunk adds additional warnings that could catch undesired effects.
31297b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31307b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31317b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31327b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31337b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31347b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31357b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
31367b5fefc8Smrg
31377b5fefc8Smrg# These are currently disabled because they are noisy.  They will be enabled
31387b5fefc8Smrg# in the future once the codebase is sufficiently modernized to silence
31397b5fefc8Smrg# them.  For now, I don't want them to drown out the other warnings.
31407b5fefc8Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31417b5fefc8Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31427b5fefc8Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
31437b5fefc8Smrg
31447b5fefc8Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
31457b5fefc8Smrg# when there are problems that should be fixed.
31467b5fefc8Smrg
31477b5fefc8Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31487b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31497b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31507b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31517b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31527b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31537b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31547b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31557b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31567b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31577b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31587b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31597b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31607b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31617b5fefc8Smrgelse
31627b5fefc8SmrgAC_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])
31637b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31647b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31657b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31667b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
31677b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
31687b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
31697b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
31707b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
31717b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
31727b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
31737b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
31747b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
31757b5fefc8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31767b5fefc8Smrgfi
3177644fc5c1Stron
31787b5fefc8SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31797b5fefc8Smrg]) # XORG_COMPILER_FLAGS
3180644fc5c1Stron
31817b5fefc8Smrg# XORG_CWARNFLAGS
31827b5fefc8Smrg# ---------------
31837b5fefc8Smrg# Minimum version: 1.2.0
31847b5fefc8Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
31852227fc13Smrg#
31867b5fefc8Smrg# Defines CWARNFLAGS to enable C compiler warnings.
31877b5fefc8Smrg#
31887b5fefc8Smrg# This function is deprecated because it defines -fno-strict-aliasing
31897b5fefc8Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
31907b5fefc8Smrg# is needed, then it should be added explicitly in the module when
31917b5fefc8Smrg# it is updated to use BASE_CFLAGS.
31927b5fefc8Smrg#
31937b5fefc8SmrgAC_DEFUN([XORG_CWARNFLAGS], [
31947b5fefc8SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31957b5fefc8SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31967b5fefc8SmrgAC_LANG_CASE(
31977b5fefc8Smrg	[C], [
31987b5fefc8Smrg		CWARNFLAGS="$BASE_CFLAGS"
31997b5fefc8Smrg		if  test "x$GCC" = xyes ; then
32007b5fefc8Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
32017b5fefc8Smrg		fi
32027b5fefc8Smrg		AC_SUBST(CWARNFLAGS)
32037b5fefc8Smrg	]
32047b5fefc8Smrg)
32057b5fefc8Smrg]) # XORG_CWARNFLAGS
32062227fc13Smrg
32077b5fefc8Smrg# XORG_STRICT_OPTION
32087b5fefc8Smrg# -----------------------
32097b5fefc8Smrg# Minimum version: 1.3.0
32102227fc13Smrg#
32117b5fefc8Smrg# Add configure option to enable strict compilation flags, such as treating
32127b5fefc8Smrg# warnings as fatal errors.
32137b5fefc8Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32147b5fefc8Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32157b5fefc8Smrg#
32167b5fefc8Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32177b5fefc8Smrg# when strict compilation is unconditionally desired.
32187b5fefc8SmrgAC_DEFUN([XORG_STRICT_OPTION], [
32197b5fefc8SmrgAC_REQUIRE([XORG_CWARNFLAGS])
32207b5fefc8SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32217b5fefc8Smrg
32227b5fefc8SmrgAC_ARG_ENABLE(strict-compilation,
32237b5fefc8Smrg			  AS_HELP_STRING([--enable-strict-compilation],
32247b5fefc8Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32257b5fefc8Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3226644fc5c1Stron
32277b5fefc8SmrgAC_LANG_CASE(
32287b5fefc8Smrg        [C], [
32297b5fefc8Smrg                define([PREFIX], [C])
32307b5fefc8Smrg        ],
32317b5fefc8Smrg        [C++], [
32327b5fefc8Smrg                define([PREFIX], [CXX])
32337b5fefc8Smrg        ]
32347b5fefc8Smrg)
3235644fc5c1Stron
32367b5fefc8Smrg[STRICT_]PREFIX[FLAGS]=""
32377b5fefc8SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32387b5fefc8SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3239644fc5c1Stron
32407b5fefc8Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32417b5fefc8Smrg# activate it with -Werror, so we add it here explicitly.
32427b5fefc8SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3243644fc5c1Stron
32447b5fefc8Smrgif test "x$STRICT_COMPILE" = "xyes"; then
32457b5fefc8Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32467b5fefc8Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32477b5fefc8Smrgfi
32487b5fefc8SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32497b5fefc8SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32507b5fefc8SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32517b5fefc8Smrg]) # XORG_STRICT_OPTION
3252644fc5c1Stron
32537b5fefc8Smrg# XORG_DEFAULT_NOCODE_OPTIONS
32547b5fefc8Smrg# ---------------------------
32557b5fefc8Smrg# Minimum version: 1.20.0
32562227fc13Smrg#
32577b5fefc8Smrg# Defines default options for X.Org modules which don't compile code,
32587b5fefc8Smrg# such as fonts, bitmaps, cursors, and docs.
32597b5fefc8Smrg#
32607b5fefc8SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
32617b5fefc8SmrgAC_REQUIRE([AC_PROG_INSTALL])
32627b5fefc8SmrgXORG_RELEASE_VERSION
32637b5fefc8SmrgXORG_CHANGELOG
32647b5fefc8SmrgXORG_INSTALL
32657b5fefc8SmrgXORG_MANPAGE_SECTIONS
32667b5fefc8Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32677b5fefc8Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32687b5fefc8Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
32692227fc13Smrg
32707b5fefc8Smrg# XORG_DEFAULT_OPTIONS
3271644fc5c1Stron# --------------------
32727b5fefc8Smrg# Minimum version: 1.3.0
32732227fc13Smrg#
32747b5fefc8Smrg# Defines default options for X.Org modules which compile code.
32752227fc13Smrg#
32767b5fefc8SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
32777b5fefc8SmrgAC_REQUIRE([AC_PROG_INSTALL])
32787b5fefc8SmrgXORG_COMPILER_FLAGS
32797b5fefc8SmrgXORG_CWARNFLAGS
32807b5fefc8SmrgXORG_STRICT_OPTION
32817b5fefc8SmrgXORG_DEFAULT_NOCODE_OPTIONS
32827b5fefc8Smrg]) # XORG_DEFAULT_OPTIONS
32837b5fefc8Smrg
32847b5fefc8Smrg# XORG_INSTALL()
32857b5fefc8Smrg# ----------------
32867b5fefc8Smrg# Minimum version: 1.4.0
32877b5fefc8Smrg#
32887b5fefc8Smrg# Defines the variable INSTALL_CMD as the command to copy
32897b5fefc8Smrg# INSTALL from $prefix/share/util-macros.
32907b5fefc8Smrg#
32917b5fefc8SmrgAC_DEFUN([XORG_INSTALL], [
32927b5fefc8SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
32937b5fefc8Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
32947b5fefc8SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
32957b5fefc8Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
32967b5fefc8Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
32977b5fefc8Smrgtouch \$(top_srcdir)/INSTALL; \
32987b5fefc8Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
32997b5fefc8SmrgAC_SUBST([INSTALL_CMD])
33007b5fefc8Smrg]) # XORG_INSTALL
33017b5fefc8Smrgdnl Copyright 2005 Red Hat, Inc
33027b5fefc8Smrgdnl
33037b5fefc8Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
33047b5fefc8Smrgdnl documentation for any purpose is hereby granted without fee, provided that
33057b5fefc8Smrgdnl the above copyright notice appear in all copies and that both that
33067b5fefc8Smrgdnl copyright notice and this permission notice appear in supporting
33077b5fefc8Smrgdnl documentation.
33087b5fefc8Smrgdnl
33097b5fefc8Smrgdnl The above copyright notice and this permission notice shall be included
33107b5fefc8Smrgdnl in all copies or substantial portions of the Software.
33117b5fefc8Smrgdnl
33127b5fefc8Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33137b5fefc8Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33147b5fefc8Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33157b5fefc8Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
33167b5fefc8Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33177b5fefc8Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33187b5fefc8Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
33197b5fefc8Smrgdnl
33207b5fefc8Smrgdnl Except as contained in this notice, the name of the copyright holders shall
33217b5fefc8Smrgdnl not be used in advertising or otherwise to promote the sale, use or
33227b5fefc8Smrgdnl other dealings in this Software without prior written authorization
33237b5fefc8Smrgdnl from the copyright holders.
33247b5fefc8Smrgdnl
33252227fc13Smrg
33267b5fefc8Smrg# XORG_RELEASE_VERSION
33277b5fefc8Smrg# --------------------
33287b5fefc8Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33292227fc13Smrg
33307b5fefc8SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33317b5fefc8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33327b5fefc8Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33337b5fefc8Smrg		[Major version of this package])
33347b5fefc8Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33357b5fefc8Smrg	if test "x$PVM" = "x"; then
33367b5fefc8Smrg		PVM="0"
33377b5fefc8Smrg	fi
33387b5fefc8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33397b5fefc8Smrg		[$PVM],
33407b5fefc8Smrg		[Minor version of this package])
33417b5fefc8Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33427b5fefc8Smrg	if test "x$PVP" = "x"; then
33437b5fefc8Smrg		PVP="0"
33447b5fefc8Smrg	fi
33457b5fefc8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33467b5fefc8Smrg		[$PVP],
33477b5fefc8Smrg		[Patch version of this package])
33487b5fefc8Smrg])
33492227fc13Smrg
33507b5fefc8Smrg# XORG_CHANGELOG()
33517b5fefc8Smrg# ----------------
33527b5fefc8Smrg# Minimum version: 1.2.0
33537b5fefc8Smrg#
33547b5fefc8Smrg# Defines the variable CHANGELOG_CMD as the command to generate
33557b5fefc8Smrg# ChangeLog from git.
33567b5fefc8Smrg#
33577b5fefc8Smrg#
33587b5fefc8SmrgAC_DEFUN([XORG_CHANGELOG], [
33597b5fefc8SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33607b5fefc8Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33617b5fefc8Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33627b5fefc8Smrgtouch \$(top_srcdir)/ChangeLog; \
33637b5fefc8Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33647b5fefc8SmrgAC_SUBST([CHANGELOG_CMD])
33657b5fefc8Smrg]) # XORG_CHANGELOG
3366644fc5c1Stron
3367