15d10e53fSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
25d10e53fSmrg
35d10e53fSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4ed029a5fSmrg
5ed029a5fSmrg# This file is free software; the Free Software Foundation
6ed029a5fSmrg# gives unlimited permission to copy and/or distribute it,
7ed029a5fSmrg# with or without modifications, as long as this notice is preserved.
8ed029a5fSmrg
9ed029a5fSmrg# This program is distributed in the hope that it will be useful,
10ed029a5fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11ed029a5fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12ed029a5fSmrg# PARTICULAR PURPOSE.
13ed029a5fSmrg
145d10e53fSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15dd519f38Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16dd519f38Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
175d10e53fSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
185d10e53fSmrg[m4_warning([this file was generated for autoconf 2.71.
19dd519f38SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20dd519f38SmrgIf you have problems, you may need to regenerate the build system entirely.
215d10e53fSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
227973f115Smrg
235d10e53fSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
247973f115Smrg#
255d10e53fSmrg# This file is free software; the Free Software Foundation
265d10e53fSmrg# gives unlimited permission to copy and/or distribute it,
275d10e53fSmrg# with or without modifications, as long as this notice is preserved.
28ed029a5fSmrg
295d10e53fSmrg# AM_AUTOMAKE_VERSION(VERSION)
305d10e53fSmrg# ----------------------------
315d10e53fSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
325d10e53fSmrg# generated from the m4 files accompanying Automake X.Y.
335d10e53fSmrg# (This private macro should not be called outside this file.)
345d10e53fSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
355d10e53fSmrg[am__api_version='1.16'
365d10e53fSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
375d10e53fSmrgdnl require some minimum version.  Point them to the right macro.
385d10e53fSmrgm4_if([$1], [1.16.5], [],
395d10e53fSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
405d10e53fSmrg])
41ed029a5fSmrg
425d10e53fSmrg# _AM_AUTOCONF_VERSION(VERSION)
435d10e53fSmrg# -----------------------------
445d10e53fSmrg# aclocal traces this macro to find the Autoconf version.
455d10e53fSmrg# This is a private macro too.  Using m4_define simplifies
465d10e53fSmrg# the logic in aclocal, which can simply ignore this definition.
475d10e53fSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48ed029a5fSmrg
495d10e53fSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
505d10e53fSmrg# -------------------------------
515d10e53fSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
525d10e53fSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
535d10e53fSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
545d10e53fSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
555d10e53fSmrgm4_ifndef([AC_AUTOCONF_VERSION],
565d10e53fSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
575d10e53fSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58ed029a5fSmrg
595d10e53fSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
607973f115Smrg
615d10e53fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62ed029a5fSmrg#
635d10e53fSmrg# This file is free software; the Free Software Foundation
645d10e53fSmrg# gives unlimited permission to copy and/or distribute it,
655d10e53fSmrg# with or without modifications, as long as this notice is preserved.
66ed029a5fSmrg
675d10e53fSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
685d10e53fSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
695d10e53fSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70dd519f38Smrg#
715d10e53fSmrg# Of course, Automake must honor this variable whenever it calls a
725d10e53fSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
735d10e53fSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
745d10e53fSmrg# depending on how configure is run.  This is pretty annoying, since
755d10e53fSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
765d10e53fSmrg# source directory, any form will work fine, but in subdirectories a
775d10e53fSmrg# relative path needs to be adjusted first.
787973f115Smrg#
795d10e53fSmrg# $ac_aux_dir/missing
805d10e53fSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
815d10e53fSmrg# $top_srcdir/$ac_aux_dir/missing
825d10e53fSmrg#    fails if $ac_aux_dir is absolute,
835d10e53fSmrg#    fails when called from a subdirectory in a VPATH build with
845d10e53fSmrg#          a relative $ac_aux_dir
857973f115Smrg#
865d10e53fSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
875d10e53fSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
885d10e53fSmrg# harmless because $srcdir is '.', but things will broke when you
895d10e53fSmrg# start a VPATH build or use an absolute $srcdir.
90dd519f38Smrg#
915d10e53fSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
925d10e53fSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
935d10e53fSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
945d10e53fSmrg# and then we would define $MISSING as
955d10e53fSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
965d10e53fSmrg# This will work as long as MISSING is not called from configure, because
975d10e53fSmrg# unfortunately $(top_srcdir) has no meaning in configure.
985d10e53fSmrg# However there are other variables, like CC, which are often used in
995d10e53fSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1007973f115Smrg#
1015d10e53fSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1025d10e53fSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1035d10e53fSmrg# configured tree to be moved without reconfiguration.
104ed029a5fSmrg
1055d10e53fSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1065d10e53fSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1075d10e53fSmrg# Expand $ac_aux_dir to an absolute path.
1085d10e53fSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1097973f115Smrg])
110ed029a5fSmrg
1115d10e53fSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1125d10e53fSmrg
1135d10e53fSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
114ed029a5fSmrg#
1155d10e53fSmrg# This file is free software; the Free Software Foundation
1165d10e53fSmrg# gives unlimited permission to copy and/or distribute it,
1175d10e53fSmrg# with or without modifications, as long as this notice is preserved.
118ed029a5fSmrg
1195d10e53fSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1205d10e53fSmrg# -------------------------------------
1215d10e53fSmrg# Define a conditional.
1225d10e53fSmrgAC_DEFUN([AM_CONDITIONAL],
1235d10e53fSmrg[AC_PREREQ([2.52])dnl
1245d10e53fSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1255d10e53fSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1265d10e53fSmrgAC_SUBST([$1_TRUE])dnl
1275d10e53fSmrgAC_SUBST([$1_FALSE])dnl
1285d10e53fSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1295d10e53fSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1305d10e53fSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1315d10e53fSmrgif $2; then
1325d10e53fSmrg  $1_TRUE=
1335d10e53fSmrg  $1_FALSE='#'
1345d10e53fSmrgelse
1355d10e53fSmrg  $1_TRUE='#'
1365d10e53fSmrg  $1_FALSE=
1375d10e53fSmrgfi
1385d10e53fSmrgAC_CONFIG_COMMANDS_PRE(
1395d10e53fSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1405d10e53fSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1415d10e53fSmrgUsually this means the macro was only invoked conditionally.]])
1425d10e53fSmrgfi])])
143dd519f38Smrg
1445d10e53fSmrg# Do all the work for Automake.                             -*- Autoconf -*-
145ed029a5fSmrg
1465d10e53fSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
1477973f115Smrg#
1485d10e53fSmrg# This file is free software; the Free Software Foundation
1495d10e53fSmrg# gives unlimited permission to copy and/or distribute it,
1505d10e53fSmrg# with or without modifications, as long as this notice is preserved.
151ed029a5fSmrg
1525d10e53fSmrg# This macro actually does too much.  Some checks are only needed if
1535d10e53fSmrg# your package does certain things.  But this isn't really a big deal.
1545d10e53fSmrg
1555d10e53fSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
1565d10e53fSmrgm4_define([AC_PROG_CC],
1575d10e53fSmrgm4_defn([AC_PROG_CC])
1585d10e53fSmrg[_AM_PROG_CC_C_O
159ed029a5fSmrg])
160ed029a5fSmrg
1615d10e53fSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
1625d10e53fSmrg# AM_INIT_AUTOMAKE([OPTIONS])
1635d10e53fSmrg# -----------------------------------------------
1645d10e53fSmrg# The call with PACKAGE and VERSION arguments is the old style
1655d10e53fSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
1665d10e53fSmrg# and VERSION should now be passed to AC_INIT and removed from
1675d10e53fSmrg# the call to AM_INIT_AUTOMAKE.
1685d10e53fSmrg# We support both call styles for the transition.  After
1695d10e53fSmrg# the next Automake release, Autoconf can make the AC_INIT
1705d10e53fSmrg# arguments mandatory, and then we can depend on a new Autoconf
1715d10e53fSmrg# release and drop the old call support.
1725d10e53fSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
1735d10e53fSmrg[AC_PREREQ([2.65])dnl
1745d10e53fSmrgm4_ifdef([_$0_ALREADY_INIT],
1755d10e53fSmrg  [m4_fatal([$0 expanded multiple times
1765d10e53fSmrg]m4_defn([_$0_ALREADY_INIT]))],
1775d10e53fSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
1785d10e53fSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
1795d10e53fSmrgdnl the ones we care about.
1805d10e53fSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
1815d10e53fSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
1825d10e53fSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
1835d10e53fSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
1845d10e53fSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
1855d10e53fSmrg  # is not polluted with repeated "-I."
1865d10e53fSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
1875d10e53fSmrg  # test to see if srcdir already configured
1885d10e53fSmrg  if test -f $srcdir/config.status; then
1895d10e53fSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1905d10e53fSmrg  fi
1915d10e53fSmrgfi
192ed029a5fSmrg
1935d10e53fSmrg# test whether we have cygpath
1945d10e53fSmrgif test -z "$CYGPATH_W"; then
1955d10e53fSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
1965d10e53fSmrg    CYGPATH_W='cygpath -w'
1975d10e53fSmrg  else
1985d10e53fSmrg    CYGPATH_W=echo
1995d10e53fSmrg  fi
2005d10e53fSmrgfi
2015d10e53fSmrgAC_SUBST([CYGPATH_W])
202ed029a5fSmrg
2035d10e53fSmrg# Define the identity of the package.
2045d10e53fSmrgdnl Distinguish between old-style and new-style calls.
2055d10e53fSmrgm4_ifval([$2],
2065d10e53fSmrg[AC_DIAGNOSE([obsolete],
2075d10e53fSmrg             [$0: two- and three-arguments forms are deprecated.])
2085d10e53fSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2095d10e53fSmrg AC_SUBST([PACKAGE], [$1])dnl
2105d10e53fSmrg AC_SUBST([VERSION], [$2])],
2115d10e53fSmrg[_AM_SET_OPTIONS([$1])dnl
2125d10e53fSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2135d10e53fSmrgm4_if(
2145d10e53fSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
2155d10e53fSmrg  [ok:ok],,
2165d10e53fSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2175d10e53fSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2185d10e53fSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
219ed029a5fSmrg
2205d10e53fSmrg_AM_IF_OPTION([no-define],,
2215d10e53fSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
2225d10e53fSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2237973f115Smrg
2245d10e53fSmrg# Some tools Automake needs.
2255d10e53fSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
2265d10e53fSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
2275d10e53fSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
2285d10e53fSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
2295d10e53fSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
2305d10e53fSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
2315d10e53fSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
2325d10e53fSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2335d10e53fSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2345d10e53fSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
2355d10e53fSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
2365d10e53fSmrg# dies out for good.  For more background, see:
2375d10e53fSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2385d10e53fSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2395d10e53fSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2405d10e53fSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
2415d10e53fSmrg# system "awk" is bad on some platforms.
2425d10e53fSmrgAC_REQUIRE([AC_PROG_AWK])dnl
2435d10e53fSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
2445d10e53fSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
2455d10e53fSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2465d10e53fSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2475d10e53fSmrg			     [_AM_PROG_TAR([v7])])])
2485d10e53fSmrg_AM_IF_OPTION([no-dependencies],,
2495d10e53fSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
2505d10e53fSmrg		  [_AM_DEPENDENCIES([CC])],
2515d10e53fSmrg		  [m4_define([AC_PROG_CC],
2525d10e53fSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2535d10e53fSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
2545d10e53fSmrg		  [_AM_DEPENDENCIES([CXX])],
2555d10e53fSmrg		  [m4_define([AC_PROG_CXX],
2565d10e53fSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2575d10e53fSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
2585d10e53fSmrg		  [_AM_DEPENDENCIES([OBJC])],
2595d10e53fSmrg		  [m4_define([AC_PROG_OBJC],
2605d10e53fSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2615d10e53fSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2625d10e53fSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
2635d10e53fSmrg		  [m4_define([AC_PROG_OBJCXX],
2645d10e53fSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
265ed029a5fSmrg])
2665d10e53fSmrg# Variables for tags utilities; see am/tags.am
2675d10e53fSmrgif test -z "$CTAGS"; then
2685d10e53fSmrg  CTAGS=ctags
2695d10e53fSmrgfi
2705d10e53fSmrgAC_SUBST([CTAGS])
2715d10e53fSmrgif test -z "$ETAGS"; then
2725d10e53fSmrg  ETAGS=etags
2735d10e53fSmrgfi
2745d10e53fSmrgAC_SUBST([ETAGS])
2755d10e53fSmrgif test -z "$CSCOPE"; then
2765d10e53fSmrg  CSCOPE=cscope
2775d10e53fSmrgfi
2785d10e53fSmrgAC_SUBST([CSCOPE])
279ed029a5fSmrg
2805d10e53fSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
2815d10e53fSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
2825d10e53fSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2835d10e53fSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2845d10e53fSmrgAC_CONFIG_COMMANDS_PRE(dnl
2855d10e53fSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
2865d10e53fSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
287ed029a5fSmrg
2885d10e53fSmrg# POSIX will say in a future version that running "rm -f" with no argument
2895d10e53fSmrg# is OK; and we want to be able to make that assumption in our Makefile
2905d10e53fSmrg# recipes.  So use an aggressive probe to check that the usage we want is
2915d10e53fSmrg# actually supported "in the wild" to an acceptable degree.
2925d10e53fSmrg# See automake bug#10828.
2935d10e53fSmrg# To make any issue more visible, cause the running configure to be aborted
2945d10e53fSmrg# by default if the 'rm' program in use doesn't match our expectations; the
2955d10e53fSmrg# user can still override this though.
2965d10e53fSmrgif rm -f && rm -fr && rm -rf; then : OK; else
2975d10e53fSmrg  cat >&2 <<'END'
2985d10e53fSmrgOops!
2995d10e53fSmrg
3005d10e53fSmrgYour 'rm' program seems unable to run without file operands specified
3015d10e53fSmrgon the command line, even when the '-f' option is present.  This is contrary
3025d10e53fSmrgto the behaviour of most rm programs out there, and not conforming with
3035d10e53fSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
3045d10e53fSmrg
3055d10e53fSmrgPlease tell bug-automake@gnu.org about your system, including the value
3065d10e53fSmrgof your $PATH and any error possibly output before this message.  This
3075d10e53fSmrgcan help us improve future automake versions.
3087973f115Smrg
3095d10e53fSmrgEND
3105d10e53fSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
3115d10e53fSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
3125d10e53fSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
3135d10e53fSmrg    echo >&2
3145d10e53fSmrg  else
3155d10e53fSmrg    cat >&2 <<'END'
3165d10e53fSmrgAborting the configuration process, to ensure you take notice of the issue.
317ed029a5fSmrg
3185d10e53fSmrgYou can download and install GNU coreutils to get an 'rm' implementation
3195d10e53fSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
320ed029a5fSmrg
3215d10e53fSmrgIf you want to complete the configuration process using your problematic
3225d10e53fSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
3235d10e53fSmrgto "yes", and re-run configure.
3245d10e53fSmrg
3255d10e53fSmrgEND
3265d10e53fSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
3275d10e53fSmrg  fi
3285d10e53fSmrgfi
3295d10e53fSmrgdnl The trailing newline in this macro's definition is deliberate, for
3305d10e53fSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
3315d10e53fSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
3327973f115Smrg])
333ed029a5fSmrg
3345d10e53fSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
3355d10e53fSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
3365d10e53fSmrgdnl mangled by Autoconf and run in a shell conditional statement.
3375d10e53fSmrgm4_define([_AC_COMPILER_EXEEXT],
3385d10e53fSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
339ed029a5fSmrg
3405d10e53fSmrg# When config.status generates a header, we must update the stamp-h file.
3415d10e53fSmrg# This file resides in the same directory as the config header
3425d10e53fSmrg# that is generated.  The stamp files are numbered to have different names.
343dd519f38Smrg
3445d10e53fSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
3455d10e53fSmrg# loop where config.status creates the headers, so we can generate
3465d10e53fSmrg# our stamp files there.
3475d10e53fSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
3485d10e53fSmrg[# Compute $1's index in $config_headers.
3495d10e53fSmrg_am_arg=$1
3505d10e53fSmrg_am_stamp_count=1
3515d10e53fSmrgfor _am_header in $config_headers :; do
3525d10e53fSmrg  case $_am_header in
3535d10e53fSmrg    $_am_arg | $_am_arg:* )
3545d10e53fSmrg      break ;;
3555d10e53fSmrg    * )
3565d10e53fSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
3575d10e53fSmrg  esac
3585d10e53fSmrgdone
3595d10e53fSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
3607973f115Smrg
3615d10e53fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
362dd519f38Smrg#
3635d10e53fSmrg# This file is free software; the Free Software Foundation
3645d10e53fSmrg# gives unlimited permission to copy and/or distribute it,
3655d10e53fSmrg# with or without modifications, as long as this notice is preserved.
366dd519f38Smrg
3675d10e53fSmrg# AM_PROG_INSTALL_SH
3685d10e53fSmrg# ------------------
3695d10e53fSmrg# Define $install_sh.
3705d10e53fSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
3715d10e53fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3725d10e53fSmrgif test x"${install_sh+set}" != xset; then
3735d10e53fSmrg  case $am_aux_dir in
3745d10e53fSmrg  *\ * | *\	*)
3755d10e53fSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
3765d10e53fSmrg  *)
3775d10e53fSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
3785d10e53fSmrg  esac
3795d10e53fSmrgfi
3805d10e53fSmrgAC_SUBST([install_sh])])
381dd519f38Smrg
3825d10e53fSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
3835d10e53fSmrg#
3845d10e53fSmrg# This file is free software; the Free Software Foundation
3855d10e53fSmrg# gives unlimited permission to copy and/or distribute it,
3865d10e53fSmrg# with or without modifications, as long as this notice is preserved.
3875d10e53fSmrg
3885d10e53fSmrg# Check whether the underlying file-system supports filenames
3895d10e53fSmrg# with a leading dot.  For instance MS-DOS doesn't.
3905d10e53fSmrgAC_DEFUN([AM_SET_LEADING_DOT],
3915d10e53fSmrg[rm -rf .tst 2>/dev/null
3925d10e53fSmrgmkdir .tst 2>/dev/null
3935d10e53fSmrgif test -d .tst; then
3945d10e53fSmrg  am__leading_dot=.
3955d10e53fSmrgelse
3965d10e53fSmrg  am__leading_dot=_
3975d10e53fSmrgfi
3985d10e53fSmrgrmdir .tst 2>/dev/null
3995d10e53fSmrgAC_SUBST([am__leading_dot])])
4005d10e53fSmrg
4015d10e53fSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
4025d10e53fSmrg
4035d10e53fSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
4045d10e53fSmrg#
4055d10e53fSmrg# This file is free software; the Free Software Foundation
4065d10e53fSmrg# gives unlimited permission to copy and/or distribute it,
4075d10e53fSmrg# with or without modifications, as long as this notice is preserved.
4085d10e53fSmrg
4095d10e53fSmrg# AM_MISSING_PROG(NAME, PROGRAM)
4105d10e53fSmrg# ------------------------------
4115d10e53fSmrgAC_DEFUN([AM_MISSING_PROG],
4125d10e53fSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
4135d10e53fSmrg$1=${$1-"${am_missing_run}$2"}
4145d10e53fSmrgAC_SUBST($1)])
4155d10e53fSmrg
4165d10e53fSmrg# AM_MISSING_HAS_RUN
4175d10e53fSmrg# ------------------
4185d10e53fSmrg# Define MISSING if not defined so far and test if it is modern enough.
4195d10e53fSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
4205d10e53fSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
4215d10e53fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
4225d10e53fSmrgAC_REQUIRE_AUX_FILE([missing])dnl
4235d10e53fSmrgif test x"${MISSING+set}" != xset; then
4245d10e53fSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
4255d10e53fSmrgfi
4265d10e53fSmrg# Use eval to expand $SHELL
4275d10e53fSmrgif eval "$MISSING --is-lightweight"; then
4285d10e53fSmrg  am_missing_run="$MISSING "
4295d10e53fSmrgelse
4305d10e53fSmrg  am_missing_run=
4315d10e53fSmrg  AC_MSG_WARN(['missing' script is too old or missing])
4325d10e53fSmrgfi
4335d10e53fSmrg])
4345d10e53fSmrg
4355d10e53fSmrg# Helper functions for option handling.                     -*- Autoconf -*-
4365d10e53fSmrg
4375d10e53fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
4385d10e53fSmrg#
4395d10e53fSmrg# This file is free software; the Free Software Foundation
4405d10e53fSmrg# gives unlimited permission to copy and/or distribute it,
4415d10e53fSmrg# with or without modifications, as long as this notice is preserved.
4425d10e53fSmrg
4435d10e53fSmrg# _AM_MANGLE_OPTION(NAME)
4445d10e53fSmrg# -----------------------
4455d10e53fSmrgAC_DEFUN([_AM_MANGLE_OPTION],
4465d10e53fSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
4475d10e53fSmrg
4485d10e53fSmrg# _AM_SET_OPTION(NAME)
4495d10e53fSmrg# --------------------
4505d10e53fSmrg# Set option NAME.  Presently that only means defining a flag for this option.
4515d10e53fSmrgAC_DEFUN([_AM_SET_OPTION],
4525d10e53fSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
4535d10e53fSmrg
4545d10e53fSmrg# _AM_SET_OPTIONS(OPTIONS)
4555d10e53fSmrg# ------------------------
4565d10e53fSmrg# OPTIONS is a space-separated list of Automake options.
4575d10e53fSmrgAC_DEFUN([_AM_SET_OPTIONS],
4585d10e53fSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
4595d10e53fSmrg
4605d10e53fSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
4615d10e53fSmrg# -------------------------------------------
4625d10e53fSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
4635d10e53fSmrgAC_DEFUN([_AM_IF_OPTION],
4645d10e53fSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
4655d10e53fSmrg
4665d10e53fSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
4675d10e53fSmrg
4685d10e53fSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4695d10e53fSmrg#
4705d10e53fSmrg# This file is free software; the Free Software Foundation
4715d10e53fSmrg# gives unlimited permission to copy and/or distribute it,
4725d10e53fSmrg# with or without modifications, as long as this notice is preserved.
4735d10e53fSmrg
4745d10e53fSmrg# AM_SANITY_CHECK
4755d10e53fSmrg# ---------------
4765d10e53fSmrgAC_DEFUN([AM_SANITY_CHECK],
4775d10e53fSmrg[AC_MSG_CHECKING([whether build environment is sane])
4785d10e53fSmrg# Reject unsafe characters in $srcdir or the absolute working directory
4795d10e53fSmrg# name.  Accept space and tab only in the latter.
4805d10e53fSmrgam_lf='
4815d10e53fSmrg'
4825d10e53fSmrgcase `pwd` in
4835d10e53fSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
4845d10e53fSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
4855d10e53fSmrgesac
4865d10e53fSmrgcase $srcdir in
4875d10e53fSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
4885d10e53fSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
4895d10e53fSmrgesac
4905d10e53fSmrg
4915d10e53fSmrg# Do 'set' in a subshell so we don't clobber the current shell's
4925d10e53fSmrg# arguments.  Must try -L first in case configure is actually a
4935d10e53fSmrg# symlink; some systems play weird games with the mod time of symlinks
4945d10e53fSmrg# (eg FreeBSD returns the mod time of the symlink's containing
4955d10e53fSmrg# directory).
4965d10e53fSmrgif (
4975d10e53fSmrg   am_has_slept=no
4985d10e53fSmrg   for am_try in 1 2; do
4995d10e53fSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
5005d10e53fSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
5015d10e53fSmrg     if test "$[*]" = "X"; then
5025d10e53fSmrg	# -L didn't work.
5035d10e53fSmrg	set X `ls -t "$srcdir/configure" conftest.file`
5045d10e53fSmrg     fi
5055d10e53fSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
5065d10e53fSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
5075d10e53fSmrg
5085d10e53fSmrg	# If neither matched, then we have a broken ls.  This can happen
5095d10e53fSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
5105d10e53fSmrg	# broken ls alias from the environment.  This has actually
5115d10e53fSmrg	# happened.  Such a system could not be considered "sane".
5125d10e53fSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
5135d10e53fSmrg  alias in your environment])
5145d10e53fSmrg     fi
5155d10e53fSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
5165d10e53fSmrg       break
5175d10e53fSmrg     fi
5185d10e53fSmrg     # Just in case.
5195d10e53fSmrg     sleep 1
5205d10e53fSmrg     am_has_slept=yes
5215d10e53fSmrg   done
5225d10e53fSmrg   test "$[2]" = conftest.file
5235d10e53fSmrg   )
5245d10e53fSmrgthen
5255d10e53fSmrg   # Ok.
5265d10e53fSmrg   :
5275d10e53fSmrgelse
5285d10e53fSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
5295d10e53fSmrgCheck your system clock])
5305d10e53fSmrgfi
5315d10e53fSmrgAC_MSG_RESULT([yes])
5325d10e53fSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
5335d10e53fSmrg# generated files are strictly newer.
5345d10e53fSmrgam_sleep_pid=
5355d10e53fSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
5365d10e53fSmrg  ( sleep 1 ) &
5375d10e53fSmrg  am_sleep_pid=$!
5385d10e53fSmrgfi
5395d10e53fSmrgAC_CONFIG_COMMANDS_PRE(
5405d10e53fSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
5415d10e53fSmrg   if test -n "$am_sleep_pid"; then
5425d10e53fSmrg     # Hide warnings about reused PIDs.
5435d10e53fSmrg     wait $am_sleep_pid 2>/dev/null
5445d10e53fSmrg   fi
5455d10e53fSmrg   AC_MSG_RESULT([done])])
5465d10e53fSmrgrm -f conftest.file
5475d10e53fSmrg])
5485d10e53fSmrg
5495d10e53fSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
5505d10e53fSmrg#
5515d10e53fSmrg# This file is free software; the Free Software Foundation
5525d10e53fSmrg# gives unlimited permission to copy and/or distribute it,
5535d10e53fSmrg# with or without modifications, as long as this notice is preserved.
5545d10e53fSmrg
5555d10e53fSmrg# AM_SILENT_RULES([DEFAULT])
5565d10e53fSmrg# --------------------------
5575d10e53fSmrg# Enable less verbose build rules; with the default set to DEFAULT
5585d10e53fSmrg# ("yes" being less verbose, "no" or empty being verbose).
5595d10e53fSmrgAC_DEFUN([AM_SILENT_RULES],
5605d10e53fSmrg[AC_ARG_ENABLE([silent-rules], [dnl
5615d10e53fSmrgAS_HELP_STRING(
5625d10e53fSmrg  [--enable-silent-rules],
5635d10e53fSmrg  [less verbose build output (undo: "make V=1")])
5645d10e53fSmrgAS_HELP_STRING(
5655d10e53fSmrg  [--disable-silent-rules],
5665d10e53fSmrg  [verbose build output (undo: "make V=0")])dnl
5675d10e53fSmrg])
5685d10e53fSmrgcase $enable_silent_rules in @%:@ (((
5695d10e53fSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
5705d10e53fSmrg   no) AM_DEFAULT_VERBOSITY=1;;
5715d10e53fSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
5725d10e53fSmrgesac
5735d10e53fSmrgdnl
5745d10e53fSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
5755d10e53fSmrgdnl do not support nested variable expansions.
5765d10e53fSmrgdnl See automake bug#9928 and bug#10237.
5775d10e53fSmrgam_make=${MAKE-make}
5785d10e53fSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
5795d10e53fSmrg   [am_cv_make_support_nested_variables],
5805d10e53fSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
5815d10e53fSmrgBAR0=false
5825d10e53fSmrgBAR1=true
5835d10e53fSmrgV=1
5845d10e53fSmrgam__doit:
5855d10e53fSmrg	@$(TRUE)
5865d10e53fSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
5875d10e53fSmrg  am_cv_make_support_nested_variables=yes
5885d10e53fSmrgelse
5895d10e53fSmrg  am_cv_make_support_nested_variables=no
5905d10e53fSmrgfi])
5915d10e53fSmrgif test $am_cv_make_support_nested_variables = yes; then
5925d10e53fSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
5935d10e53fSmrg  AM_V='$(V)'
5945d10e53fSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
5955d10e53fSmrgelse
5965d10e53fSmrg  AM_V=$AM_DEFAULT_VERBOSITY
5975d10e53fSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
5985d10e53fSmrgfi
5995d10e53fSmrgAC_SUBST([AM_V])dnl
6005d10e53fSmrgAM_SUBST_NOTMAKE([AM_V])dnl
6015d10e53fSmrgAC_SUBST([AM_DEFAULT_V])dnl
6025d10e53fSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
6035d10e53fSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
6045d10e53fSmrgAM_BACKSLASH='\'
6055d10e53fSmrgAC_SUBST([AM_BACKSLASH])dnl
6065d10e53fSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
6075d10e53fSmrg])
6085d10e53fSmrg
6095d10e53fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6105d10e53fSmrg#
6115d10e53fSmrg# This file is free software; the Free Software Foundation
6125d10e53fSmrg# gives unlimited permission to copy and/or distribute it,
6135d10e53fSmrg# with or without modifications, as long as this notice is preserved.
6145d10e53fSmrg
6155d10e53fSmrg# AM_PROG_INSTALL_STRIP
6165d10e53fSmrg# ---------------------
6175d10e53fSmrg# One issue with vendor 'install' (even GNU) is that you can't
6185d10e53fSmrg# specify the program used to strip binaries.  This is especially
6195d10e53fSmrg# annoying in cross-compiling environments, where the build's strip
6205d10e53fSmrg# is unlikely to handle the host's binaries.
6215d10e53fSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
6225d10e53fSmrg# always use install-sh in "make install-strip", and initialize
6235d10e53fSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
6245d10e53fSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
6255d10e53fSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
6265d10e53fSmrg# Installed binaries are usually stripped using 'strip' when the user
6275d10e53fSmrg# run "make install-strip".  However 'strip' might not be the right
6285d10e53fSmrg# tool to use in cross-compilation environments, therefore Automake
6295d10e53fSmrg# will honor the 'STRIP' environment variable to overrule this program.
6305d10e53fSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
6315d10e53fSmrgif test "$cross_compiling" != no; then
6325d10e53fSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
6335d10e53fSmrgfi
6345d10e53fSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
6355d10e53fSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
6365d10e53fSmrg
6375d10e53fSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
6385d10e53fSmrg#
6395d10e53fSmrg# This file is free software; the Free Software Foundation
6405d10e53fSmrg# gives unlimited permission to copy and/or distribute it,
6415d10e53fSmrg# with or without modifications, as long as this notice is preserved.
6425d10e53fSmrg
6435d10e53fSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
6445d10e53fSmrg# ---------------------------
6455d10e53fSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
6465d10e53fSmrg# This macro is traced by Automake.
6475d10e53fSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
6485d10e53fSmrg
6495d10e53fSmrg# AM_SUBST_NOTMAKE(VARIABLE)
6505d10e53fSmrg# --------------------------
6515d10e53fSmrg# Public sister of _AM_SUBST_NOTMAKE.
6525d10e53fSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
6535d10e53fSmrg
6545d10e53fSmrg# Check how to create a tarball.                            -*- Autoconf -*-
6555d10e53fSmrg
6565d10e53fSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
6575d10e53fSmrg#
6585d10e53fSmrg# This file is free software; the Free Software Foundation
6595d10e53fSmrg# gives unlimited permission to copy and/or distribute it,
6605d10e53fSmrg# with or without modifications, as long as this notice is preserved.
6615d10e53fSmrg
6625d10e53fSmrg# _AM_PROG_TAR(FORMAT)
6635d10e53fSmrg# --------------------
6645d10e53fSmrg# Check how to create a tarball in format FORMAT.
6655d10e53fSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
6665d10e53fSmrg#
6675d10e53fSmrg# Substitute a variable $(am__tar) that is a command
6685d10e53fSmrg# writing to stdout a FORMAT-tarball containing the directory
6695d10e53fSmrg# $tardir.
6705d10e53fSmrg#     tardir=directory && $(am__tar) > result.tar
6715d10e53fSmrg#
6725d10e53fSmrg# Substitute a variable $(am__untar) that extract such
6735d10e53fSmrg# a tarball read from stdin.
6745d10e53fSmrg#     $(am__untar) < result.tar
6755d10e53fSmrg#
6765d10e53fSmrgAC_DEFUN([_AM_PROG_TAR],
6775d10e53fSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
6785d10e53fSmrg# in the wild :-(  We should find a proper way to deprecate it ...
6795d10e53fSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
6805d10e53fSmrg
6815d10e53fSmrg# We'll loop over all known methods to create a tar archive until one works.
6825d10e53fSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
6835d10e53fSmrg
6845d10e53fSmrgm4_if([$1], [v7],
6855d10e53fSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
6865d10e53fSmrg
6875d10e53fSmrg  [m4_case([$1],
6885d10e53fSmrg    [ustar],
6895d10e53fSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
6905d10e53fSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
6915d10e53fSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
6925d10e53fSmrg      # and bug#13588).
6935d10e53fSmrg      am_max_uid=2097151 # 2^21 - 1
6945d10e53fSmrg      am_max_gid=$am_max_uid
6955d10e53fSmrg      # The $UID and $GID variables are not portable, so we need to resort
6965d10e53fSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
6975d10e53fSmrg      # below are definitely unexpected, so allow the users to see them
6985d10e53fSmrg      # (that is, avoid stderr redirection).
6995d10e53fSmrg      am_uid=`id -u || echo unknown`
7005d10e53fSmrg      am_gid=`id -g || echo unknown`
7015d10e53fSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
7025d10e53fSmrg      if test $am_uid -le $am_max_uid; then
7035d10e53fSmrg         AC_MSG_RESULT([yes])
7045d10e53fSmrg      else
7055d10e53fSmrg         AC_MSG_RESULT([no])
7065d10e53fSmrg         _am_tools=none
7075d10e53fSmrg      fi
7085d10e53fSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
7095d10e53fSmrg      if test $am_gid -le $am_max_gid; then
7105d10e53fSmrg         AC_MSG_RESULT([yes])
7115d10e53fSmrg      else
7125d10e53fSmrg        AC_MSG_RESULT([no])
7135d10e53fSmrg        _am_tools=none
7145d10e53fSmrg      fi],
7155d10e53fSmrg
7165d10e53fSmrg  [pax],
7175d10e53fSmrg    [],
7185d10e53fSmrg
7195d10e53fSmrg  [m4_fatal([Unknown tar format])])
7205d10e53fSmrg
7215d10e53fSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
7225d10e53fSmrg
7235d10e53fSmrg  # Go ahead even if we have the value already cached.  We do so because we
7245d10e53fSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
7255d10e53fSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
7265d10e53fSmrg
7275d10e53fSmrg  for _am_tool in $_am_tools; do
7285d10e53fSmrg    case $_am_tool in
7295d10e53fSmrg    gnutar)
7305d10e53fSmrg      for _am_tar in tar gnutar gtar; do
7315d10e53fSmrg        AM_RUN_LOG([$_am_tar --version]) && break
7325d10e53fSmrg      done
7335d10e53fSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
7345d10e53fSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
7355d10e53fSmrg      am__untar="$_am_tar -xf -"
7365d10e53fSmrg      ;;
7375d10e53fSmrg    plaintar)
7385d10e53fSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
7395d10e53fSmrg      # ustar tarball either.
7405d10e53fSmrg      (tar --version) >/dev/null 2>&1 && continue
7415d10e53fSmrg      am__tar='tar chf - "$$tardir"'
7425d10e53fSmrg      am__tar_='tar chf - "$tardir"'
7435d10e53fSmrg      am__untar='tar xf -'
7445d10e53fSmrg      ;;
7455d10e53fSmrg    pax)
7465d10e53fSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
7475d10e53fSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
7485d10e53fSmrg      am__untar='pax -r'
7495d10e53fSmrg      ;;
7505d10e53fSmrg    cpio)
7515d10e53fSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
7525d10e53fSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
7535d10e53fSmrg      am__untar='cpio -i -H $1 -d'
7545d10e53fSmrg      ;;
7555d10e53fSmrg    none)
7565d10e53fSmrg      am__tar=false
7575d10e53fSmrg      am__tar_=false
7585d10e53fSmrg      am__untar=false
7595d10e53fSmrg      ;;
7605d10e53fSmrg    esac
7615d10e53fSmrg
7625d10e53fSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
7635d10e53fSmrg    # and am__untar set.
7645d10e53fSmrg    test -n "${am_cv_prog_tar_$1}" && break
7655d10e53fSmrg
7665d10e53fSmrg    # tar/untar a dummy directory, and stop if the command works.
7675d10e53fSmrg    rm -rf conftest.dir
7685d10e53fSmrg    mkdir conftest.dir
7695d10e53fSmrg    echo GrepMe > conftest.dir/file
7705d10e53fSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
7715d10e53fSmrg    rm -rf conftest.dir
7725d10e53fSmrg    if test -s conftest.tar; then
7735d10e53fSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
7745d10e53fSmrg      AM_RUN_LOG([cat conftest.dir/file])
7755d10e53fSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
7765d10e53fSmrg    fi
7775d10e53fSmrg  done
7785d10e53fSmrg  rm -rf conftest.dir
7795d10e53fSmrg
7805d10e53fSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
7815d10e53fSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
7825d10e53fSmrg
7835d10e53fSmrgAC_SUBST([am__tar])
7845d10e53fSmrgAC_SUBST([am__untar])
7855d10e53fSmrg]) # _AM_PROG_TAR
7865d10e53fSmrg
7875d10e53fSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
7885d10e53fSmrgdnl serial 11 (pkg-config-0.29)
7895d10e53fSmrgdnl
7905d10e53fSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
7915d10e53fSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
7925d10e53fSmrgdnl
7935d10e53fSmrgdnl This program is free software; you can redistribute it and/or modify
7945d10e53fSmrgdnl it under the terms of the GNU General Public License as published by
7955d10e53fSmrgdnl the Free Software Foundation; either version 2 of the License, or
7965d10e53fSmrgdnl (at your option) any later version.
7975d10e53fSmrgdnl
7985d10e53fSmrgdnl This program is distributed in the hope that it will be useful, but
7995d10e53fSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
8005d10e53fSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8015d10e53fSmrgdnl General Public License for more details.
8025d10e53fSmrgdnl
8035d10e53fSmrgdnl You should have received a copy of the GNU General Public License
8045d10e53fSmrgdnl along with this program; if not, write to the Free Software
8055d10e53fSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
8065d10e53fSmrgdnl 02111-1307, USA.
8075d10e53fSmrgdnl
8085d10e53fSmrgdnl As a special exception to the GNU General Public License, if you
8095d10e53fSmrgdnl distribute this file as part of a program that contains a
8105d10e53fSmrgdnl configuration script generated by Autoconf, you may include it under
8115d10e53fSmrgdnl the same distribution terms that you use for the rest of that
8125d10e53fSmrgdnl program.
8135d10e53fSmrg
8145d10e53fSmrgdnl PKG_PREREQ(MIN-VERSION)
8155d10e53fSmrgdnl -----------------------
8165d10e53fSmrgdnl Since: 0.29
8175d10e53fSmrgdnl
8185d10e53fSmrgdnl Verify that the version of the pkg-config macros are at least
8195d10e53fSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
8205d10e53fSmrgdnl installed version of pkg-config, this checks the developer's version
8215d10e53fSmrgdnl of pkg.m4 when generating configure.
8225d10e53fSmrgdnl
8235d10e53fSmrgdnl To ensure that this macro is defined, also add:
8245d10e53fSmrgdnl m4_ifndef([PKG_PREREQ],
8255d10e53fSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
8265d10e53fSmrgdnl
8275d10e53fSmrgdnl See the "Since" comment for each macro you use to see what version
8285d10e53fSmrgdnl of the macros you require.
8295d10e53fSmrgm4_defun([PKG_PREREQ],
8305d10e53fSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
8315d10e53fSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
8325d10e53fSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
8335d10e53fSmrg])dnl PKG_PREREQ
8345d10e53fSmrg
8355d10e53fSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
8365d10e53fSmrgdnl ----------------------------------
8375d10e53fSmrgdnl Since: 0.16
8385d10e53fSmrgdnl
8395d10e53fSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
8405d10e53fSmrgdnl first found in the path. Checks that the version of pkg-config found
8415d10e53fSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
8425d10e53fSmrgdnl used since that's the first version where most current features of
8435d10e53fSmrgdnl pkg-config existed.
8447973f115SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8457973f115Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8465d10e53fSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8475d10e53fSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
8487973f115SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
8497973f115SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
8507973f115SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
851dd519f38Smrg
8527973f115Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8537973f115Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
854dd519f38Smrgfi
8557973f115Smrgif test -n "$PKG_CONFIG"; then
8567973f115Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
8577973f115Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
8587973f115Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
8597973f115Smrg		AC_MSG_RESULT([yes])
8607973f115Smrg	else
8617973f115Smrg		AC_MSG_RESULT([no])
8627973f115Smrg		PKG_CONFIG=""
8637973f115Smrg	fi
8647973f115Smrgfi[]dnl
8655d10e53fSmrg])dnl PKG_PROG_PKG_CONFIG
866dd519f38Smrg
8675d10e53fSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
8685d10e53fSmrgdnl -------------------------------------------------------------------
8695d10e53fSmrgdnl Since: 0.18
8705d10e53fSmrgdnl
8715d10e53fSmrgdnl Check to see whether a particular set of modules exists. Similar to
8725d10e53fSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
8735d10e53fSmrgdnl
8745d10e53fSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
8755d10e53fSmrgdnl only at the first occurence in configure.ac, so if the first place
8765d10e53fSmrgdnl it's called might be skipped (such as if it is within an "if", you
8775d10e53fSmrgdnl have to call PKG_CHECK_EXISTS manually
8787973f115SmrgAC_DEFUN([PKG_CHECK_EXISTS],
8797973f115Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
8807973f115Smrgif test -n "$PKG_CONFIG" && \
8817973f115Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
8827973f115Smrg  m4_default([$2], [:])
8837973f115Smrgm4_ifvaln([$3], [else
8847973f115Smrg  $3])dnl
8857973f115Smrgfi])
886dd519f38Smrg
8875d10e53fSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
8885d10e53fSmrgdnl ---------------------------------------------
8895d10e53fSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
8905d10e53fSmrgdnl pkg_failed based on the result.
8917973f115Smrgm4_define([_PKG_CONFIG],
8927973f115Smrg[if test -n "$$1"; then
8937973f115Smrg    pkg_cv_[]$1="$$1"
8947973f115Smrg elif test -n "$PKG_CONFIG"; then
8957973f115Smrg    PKG_CHECK_EXISTS([$3],
8965d10e53fSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
8975d10e53fSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
8987973f115Smrg		     [pkg_failed=yes])
8997973f115Smrg else
9007973f115Smrg    pkg_failed=untried
9017973f115Smrgfi[]dnl
9025d10e53fSmrg])dnl _PKG_CONFIG
903dd519f38Smrg
9045d10e53fSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
9055d10e53fSmrgdnl ---------------------------
9065d10e53fSmrgdnl Internal check to see if pkg-config supports short errors.
9077973f115SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
9087973f115Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
9097973f115Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
9107973f115Smrg        _pkg_short_errors_supported=yes
9117973f115Smrgelse
9127973f115Smrg        _pkg_short_errors_supported=no
9137973f115Smrgfi[]dnl
9145d10e53fSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
915dd519f38Smrg
916dd519f38Smrg
9175d10e53fSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
9185d10e53fSmrgdnl   [ACTION-IF-NOT-FOUND])
9195d10e53fSmrgdnl --------------------------------------------------------------
9205d10e53fSmrgdnl Since: 0.4.0
9215d10e53fSmrgdnl
9225d10e53fSmrgdnl Note that if there is a possibility the first call to
9235d10e53fSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
9245d10e53fSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
9257973f115SmrgAC_DEFUN([PKG_CHECK_MODULES],
9267973f115Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
9277973f115SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
9287973f115SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
929dd519f38Smrg
9307973f115Smrgpkg_failed=no
9317973f115SmrgAC_MSG_CHECKING([for $1])
9327973f115Smrg
9337973f115Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
9347973f115Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
9357973f115Smrg
9367973f115Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
9377973f115Smrgand $1[]_LIBS to avoid the need to call pkg-config.
9387973f115SmrgSee the pkg-config man page for more details.])
9397973f115Smrg
9407973f115Smrgif test $pkg_failed = yes; then
9417973f115Smrg   	AC_MSG_RESULT([no])
9427973f115Smrg        _PKG_SHORT_ERRORS_SUPPORTED
9437973f115Smrg        if test $_pkg_short_errors_supported = yes; then
9445d10e53fSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
9457973f115Smrg        else 
9465d10e53fSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
9477973f115Smrg        fi
9487973f115Smrg	# Put the nasty error message in config.log where it belongs
9497973f115Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
9507973f115Smrg
9517973f115Smrg	m4_default([$4], [AC_MSG_ERROR(
9527973f115Smrg[Package requirements ($2) were not met:
9537973f115Smrg
9547973f115Smrg$$1_PKG_ERRORS
9557973f115Smrg
9567973f115SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
9577973f115Smrginstalled software in a non-standard prefix.
9587973f115Smrg
9597973f115Smrg_PKG_TEXT])[]dnl
9607973f115Smrg        ])
9617973f115Smrgelif test $pkg_failed = untried; then
9627973f115Smrg     	AC_MSG_RESULT([no])
9637973f115Smrg	m4_default([$4], [AC_MSG_FAILURE(
9647973f115Smrg[The pkg-config script could not be found or is too old.  Make sure it
9657973f115Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
9667973f115Smrgpath to pkg-config.
9677973f115Smrg
9687973f115Smrg_PKG_TEXT
9697973f115Smrg
9705d10e53fSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
9717973f115Smrg        ])
9727973f115Smrgelse
9737973f115Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
9747973f115Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
9757973f115Smrg        AC_MSG_RESULT([yes])
9767973f115Smrg	$3
9777973f115Smrgfi[]dnl
9785d10e53fSmrg])dnl PKG_CHECK_MODULES
979dd519f38Smrg
9805d10e53fSmrg
9815d10e53fSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
9825d10e53fSmrgdnl   [ACTION-IF-NOT-FOUND])
9835d10e53fSmrgdnl ---------------------------------------------------------------------
9845d10e53fSmrgdnl Since: 0.29
9857973f115Smrgdnl
9865d10e53fSmrgdnl Checks for existence of MODULES and gathers its build flags with
9875d10e53fSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
9885d10e53fSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
9895d10e53fSmrgdnl
9905d10e53fSmrgdnl Note that if there is a possibility the first call to
9915d10e53fSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
9925d10e53fSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
9935d10e53fSmrgdnl configure.ac.
9945d10e53fSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
9955d10e53fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
9965d10e53fSmrg_save_PKG_CONFIG=$PKG_CONFIG
9975d10e53fSmrgPKG_CONFIG="$PKG_CONFIG --static"
9985d10e53fSmrgPKG_CHECK_MODULES($@)
9995d10e53fSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
10005d10e53fSmrg])dnl PKG_CHECK_MODULES_STATIC
10015d10e53fSmrg
10025d10e53fSmrg
10035d10e53fSmrgdnl PKG_INSTALLDIR([DIRECTORY])
10045d10e53fSmrgdnl -------------------------
10055d10e53fSmrgdnl Since: 0.27
10065d10e53fSmrgdnl
10075d10e53fSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
10085d10e53fSmrgdnl should install pkg-config .pc files. By default the directory is
10095d10e53fSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
10105d10e53fSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
10115d10e53fSmrgdnl parameter.
10125d10e53fSmrgAC_DEFUN([PKG_INSTALLDIR],
10135d10e53fSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
10145d10e53fSmrgm4_pushdef([pkg_description],
10155d10e53fSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
10165d10e53fSmrgAC_ARG_WITH([pkgconfigdir],
10175d10e53fSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
10185d10e53fSmrg    [with_pkgconfigdir=]pkg_default)
10195d10e53fSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
10205d10e53fSmrgm4_popdef([pkg_default])
10215d10e53fSmrgm4_popdef([pkg_description])
10225d10e53fSmrg])dnl PKG_INSTALLDIR
10235d10e53fSmrg
10245d10e53fSmrg
10255d10e53fSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
10265d10e53fSmrgdnl --------------------------------
10275d10e53fSmrgdnl Since: 0.27
10285d10e53fSmrgdnl
10295d10e53fSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
10305d10e53fSmrgdnl module should install arch-independent pkg-config .pc files. By
10315d10e53fSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
10325d10e53fSmrgdnl changed by passing DIRECTORY. The user can override through the
10335d10e53fSmrgdnl --with-noarch-pkgconfigdir parameter.
10345d10e53fSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
10355d10e53fSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
10365d10e53fSmrgm4_pushdef([pkg_description],
10375d10e53fSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
10385d10e53fSmrgAC_ARG_WITH([noarch-pkgconfigdir],
10395d10e53fSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
10405d10e53fSmrg    [with_noarch_pkgconfigdir=]pkg_default)
10415d10e53fSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
10425d10e53fSmrgm4_popdef([pkg_default])
10435d10e53fSmrgm4_popdef([pkg_description])
10445d10e53fSmrg])dnl PKG_NOARCH_INSTALLDIR
10455d10e53fSmrg
10465d10e53fSmrg
10475d10e53fSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
10485d10e53fSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10495d10e53fSmrgdnl -------------------------------------------
10505d10e53fSmrgdnl Since: 0.28
10515d10e53fSmrgdnl
10525d10e53fSmrgdnl Retrieves the value of the pkg-config variable for the given module.
10535d10e53fSmrgAC_DEFUN([PKG_CHECK_VAR],
10545d10e53fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
10555d10e53fSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
10565d10e53fSmrg
10575d10e53fSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
10585d10e53fSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
10595d10e53fSmrg
10605d10e53fSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
10615d10e53fSmrg])dnl PKG_CHECK_VAR
10625d10e53fSmrg
10635d10e53fSmrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
10645d10e53fSmrgdnl
10655d10e53fSmrgdnl This file comes from X.Org's font-util 1.4.0
10665d10e53fSmrgdnl
10675d10e53fSmrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
10685d10e53fSmrgdnl
10695d10e53fSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
10705d10e53fSmrgdnl copy of this software and associated documentation files (the "Software"),
10717973f115Smrgdnl to deal in the Software without restriction, including without limitation
10727973f115Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
10737973f115Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
10747973f115Smrgdnl Software is furnished to do so, subject to the following conditions:
10757973f115Smrgdnl
10767973f115Smrgdnl The above copyright notice and this permission notice (including the next
10777973f115Smrgdnl paragraph) shall be included in all copies or substantial portions of the
10787973f115Smrgdnl Software.
10797973f115Smrgdnl
10807973f115Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10817973f115Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10827973f115Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
10837973f115Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10847973f115Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
10857973f115Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
10867973f115Smrgdnl DEALINGS IN THE SOFTWARE.
10875d10e53fSmrgdnl
10885d10e53fSmrgdnl --------------------------------------------------------------------
10895d10e53fSmrgdnl
10905d10e53fSmrgdnl Copyright 2005 Red Hat, Inc
10915d10e53fSmrgdnl
10925d10e53fSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
10935d10e53fSmrgdnl documentation for any purpose is hereby granted without fee, provided that
10945d10e53fSmrgdnl the above copyright notice appear in all copies and that both that
10955d10e53fSmrgdnl copyright notice and this permission notice appear in supporting
10965d10e53fSmrgdnl documentation.
10975d10e53fSmrgdnl
10985d10e53fSmrgdnl The above copyright notice and this permission notice shall be included
10995d10e53fSmrgdnl in all copies or substantial portions of the Software.
11005d10e53fSmrgdnl
11015d10e53fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
11025d10e53fSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11035d10e53fSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
11045d10e53fSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
11055d10e53fSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
11065d10e53fSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
11075d10e53fSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
11085d10e53fSmrgdnl
11095d10e53fSmrgdnl Except as contained in this notice, the name of the copyright holders shall
11105d10e53fSmrgdnl not be used in advertising or otherwise to promote the sale, use or
11115d10e53fSmrgdnl other dealings in this Software without prior written authorization
11125d10e53fSmrgdnl from the copyright holders.
1113dd519f38Smrg
11145d10e53fSmrg# XORG_FONT_MACROS_VERSION(required-version)
11155d10e53fSmrg# ------------------------------------------
11167973f115Smrg# Minimum version: 1.1.0
1117dd519f38Smrg#
11187973f115Smrg# If you're using a macro added in Version 1.1 or newer, include this in
11197973f115Smrg# your configure.ac with the minimum required version, such as:
11205d10e53fSmrg# XORG_FONT_MACROS_VERSION(1.1)
11217973f115Smrg#
11227973f115Smrg# To ensure that this macro is defined, also add:
11235d10e53fSmrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
11245d10e53fSmrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
11257973f115Smrg#
11267973f115Smrg#
11275d10e53fSmrg# See the "minimum version" comment for each macro you use to see what
11287973f115Smrg# version you require.
11295d10e53fSmrgm4_defun([XORG_FONT_MACROS_VERSION],[
11305d10e53fSmrgm4_define([vers_have], [1.4.0])
11317973f115Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
11327973f115Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
11337973f115Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
11345d10e53fSmrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
11357973f115Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
11365d10e53fSmrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
11377973f115Smrgm4_undefine([vers_have])
11387973f115Smrgm4_undefine([maj_have])
11397973f115Smrgm4_undefine([maj_needed])
11405d10e53fSmrg]) # XORG_FONT_MACROS_VERSION
1141dd519f38Smrg
11425d10e53fSmrg# XORG_FONT_CHECK_{maps}()
11435d10e53fSmrg# ------------------------
11447973f115Smrg# Minimum version: 1.0.0
11455d10e53fSmrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
11465d10e53fSmrg# JISX0201 or KOI8_R.  By default, they are all enabled.
11475d10e53fSmrg
11485d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
11495d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
11505d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
11515d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
11525d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
11535d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
11545d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
11555d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
11565d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
11575d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
11585d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
11595d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
11605d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
11615d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
11625d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
11635d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
11645d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
11655d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
11665d10e53fSmrg
11675d10e53fSmrg# XORG_FONT_CHECK_ENCODING(encoding)
11685d10e53fSmrg# ----------------------------------
11695d10e53fSmrg# Minimum version: 1.1.0
11705d10e53fSmrg# This macro adds --enable/disable-<encoding>, enabled by default.
11715d10e53fSmrg# It replaced individual copies of this code in the above macros in 1.1.
11725d10e53fSmrg# Currently assumes encoding names will be all upper-case - add m4_toupper
11735d10e53fSmrg# calls if this is not true in the future.
11745d10e53fSmrg
11755d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
11765d10e53fSmrg	AC_ARG_ENABLE(m4_tolower($1),
11775d10e53fSmrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
11785d10e53fSmrg				[Build $1 fonts (default: yes)]),
11795d10e53fSmrg		[AS_TR_SH($1)=$enableval])
11805d10e53fSmrg	AC_MSG_CHECKING([whether to build $1 fonts])
11815d10e53fSmrg	AC_MSG_RESULT($[AS_TR_SH($1)])
11825d10e53fSmrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
11835d10e53fSmrg]) # XORG_FONT_CHECK_ENCODING
11845d10e53fSmrg
11855d10e53fSmrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
11865d10e53fSmrg# -----------------------------------------------------
11875d10e53fSmrg# Minimum version: 1.1.0
11885d10e53fSmrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
11895d10e53fSmrg# Add a shorthand --enable/disable-all-encodings option.
11905d10e53fSmrg
11915d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
11925d10e53fSmrg	AC_ARG_ENABLE([all-encodings],
11935d10e53fSmrg		AS_HELP_STRING([--disable-all-encodings],
11945d10e53fSmrg				[Disable building of all font encodings]),
11955d10e53fSmrg		[m4_foreach_w([enc], [$1], [
11965d10e53fSmrg			AS_TR_SH(enc)=$enableval
11975d10e53fSmrg		])],
11985d10e53fSmrg		[m4_foreach_w([enc], [$1], [
11995d10e53fSmrg			AS_TR_SH(enc)=yes
12005d10e53fSmrg		])])
12015d10e53fSmrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
12025d10e53fSmrg]) # XORG_FONT_CHECK_ENCODING_LIST
12035d10e53fSmrg
12045d10e53fSmrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
12055d10e53fSmrg# ------------------------------------------
12065d10e53fSmrg# Minimum version: 1.1.0
12075d10e53fSmrg#
12085d10e53fSmrg# Simple wrapper around AC_PATH_PROG that errors if not found
1209dd519f38Smrg#
1210dd519f38Smrg
12115d10e53fSmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
12125d10e53fSmrg	AC_PATH_PROG($1, $2)
12135d10e53fSmrg	if test x"$$1" = x; then
12145d10e53fSmrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
12157973f115Smrg	fi
12165d10e53fSmrg])
1217dd519f38Smrg
12185d10e53fSmrg
12195d10e53fSmrg# XORG_FONT_FCCACHE()
12205d10e53fSmrg# -------------------
12215d10e53fSmrg# Minimum version: 1.1.0
12225d10e53fSmrg#
12235d10e53fSmrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
12245d10e53fSmrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
12255d10e53fSmrg# to run fc-cache if found and not installing to $DESTDIR and not
12265d10e53fSmrg# cross-compiling
12275d10e53fSmrg#
12285d10e53fSmrg# fc-cache is optional, not required, and should be skipped when making
12295d10e53fSmrg# packages (installing to $DESTDIR) or cross-compiling
12305d10e53fSmrg#
12315d10e53fSmrgAC_DEFUN([XORG_FONT_FCCACHE],[
12325d10e53fSmrg	AC_PATH_PROG(FCCACHE, fc-cache)
12335d10e53fSmrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
12345d10e53fSmrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
12355d10e53fSmrg		RUN_FCCACHE="${FCCACHE_WARN}"
12367973f115Smrg	else
12375d10e53fSmrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
12385d10e53fSmrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
12397973f115Smrg	fi
12405d10e53fSmrg	AC_SUBST([RUN_FCCACHE])
12415d10e53fSmrg])
1242dd519f38Smrg
12435d10e53fSmrg# XORG_FONT_MKFONTDIR()
12445d10e53fSmrg# -------------------
12455d10e53fSmrg# Minimum version: 1.3.0
1246dd519f38Smrg#
12475d10e53fSmrg# Set MKFONTDIR to path to mkfontdir.
12485d10e53fSmrg#
12495d10e53fSmrg# If cross-compiling, and if mkdir is not found, use a shell command
12505d10e53fSmrg# which warns mkfontdir needs to be run on the target
12515d10e53fSmrg#
12525d10e53fSmrg# If not cross-compiling, mkfontdir must be found
12535d10e53fSmrg#
12545d10e53fSmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
12555d10e53fSmrg	if test x"$cross_compiling" != x"no" ; then
12565d10e53fSmrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
12575d10e53fSmrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
1258dd519f38Smrg
12595d10e53fSmrg		if test x"$MKFONTDIR" = x; then
12605d10e53fSmrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
12615d10e53fSmrg		fi
12625d10e53fSmrg	else
12635d10e53fSmrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
12645d10e53fSmrg	fi
1265dd519f38Smrg
12665d10e53fSmrg	AC_SUBST([MKFONTDIR])
12675d10e53fSmrg])
1268dd519f38Smrg
12695d10e53fSmrg# XORG_FONT_COMMON_UTILS()
12705d10e53fSmrg# ------------------------
12715d10e53fSmrg# Minimum version: 1.1.0
12725d10e53fSmrg#
12735d10e53fSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
1274dd519f38Smrg
12755d10e53fSmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
12765d10e53fSmrg	XORG_FONT_FCCACHE
12775d10e53fSmrg	XORG_FONT_MKFONTDIR
12785d10e53fSmrg])
1279ed029a5fSmrg
12805d10e53fSmrg# XORG_FONT_SCALED_UTILS()
12815d10e53fSmrg# ------------------------
12825d10e53fSmrg# Minimum version: 1.1.0
12835d10e53fSmrg#
12845d10e53fSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
12855d10e53fSmrg# (TrueType, OpenType, Type1)
1286dd519f38Smrg
12875d10e53fSmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
12885d10e53fSmrg	XORG_FONT_COMMON_UTILS
12895d10e53fSmrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
12905d10e53fSmrg])
1291dd519f38Smrg
12925d10e53fSmrg# XORG_FONT_BDF_UTILS()
12935d10e53fSmrg# ---------------------
12945d10e53fSmrg# Minimum version: 1.1.0
12955d10e53fSmrg#
12965d10e53fSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
12975d10e53fSmrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
12985d10e53fSmrg# PCF output files created by bdftopcf
1299dd519f38Smrg
13005d10e53fSmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
13015d10e53fSmrg	XORG_FONT_COMMON_UTILS
13025d10e53fSmrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
13035d10e53fSmrg	XORG_FONT_CHECK_COMPRESSION
13045d10e53fSmrg])
1305dd519f38Smrg
13065d10e53fSmrg# XORG_FONT_CHECK_COMPRESSION()
13075d10e53fSmrg# -----------------------------
13085d10e53fSmrg# Minimum version: 1.1.0
13097973f115Smrg#
13105d10e53fSmrg# Offer a --with-compression flag to control what compression method is
13115d10e53fSmrg# used for pcf font files.   Offers all the methods currently supported
13125d10e53fSmrg# by libXfont, including no compression.
13135d10e53fSmrg#
13145d10e53fSmrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
13155d10e53fSmrg# for reproducible builds, such as gzip -n to not record timestamp, will
13165d10e53fSmrg# set COMPRESS_FLAGS to those options.
1317dd519f38Smrg
13185d10e53fSmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
13195d10e53fSmrg	AC_MSG_CHECKING([font compression method])
13205d10e53fSmrg	AC_ARG_WITH(compression,
13215d10e53fSmrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
13225d10e53fSmrg			 [compression method to use on pcf fonts])],
13235d10e53fSmrg         [compression="$withval"], [compression="yes"])
13245d10e53fSmrg	if test x"$compression" = "xyes" ; then
13255d10e53fSmrg		compression="gzip"
13265d10e53fSmrg	fi
13275d10e53fSmrg	AC_MSG_RESULT([${compression}])
13285d10e53fSmrg	case ${compression} in
13295d10e53fSmrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
13305d10e53fSmrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
13315d10e53fSmrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
13325d10e53fSmrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
13335d10e53fSmrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
13345d10e53fSmrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
13355d10e53fSmrg	esac
13365d10e53fSmrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
13375d10e53fSmrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
13385d10e53fSmrg	fi
13395d10e53fSmrg	AC_MSG_CHECKING([options to font compression command])
13405d10e53fSmrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
13415d10e53fSmrg	AC_SUBST([COMPRESS_FLAGS])
13425d10e53fSmrg	AC_SUBST([COMPRESS_SUFFIX])
13435d10e53fSmrg])
13447973f115Smrg
13455d10e53fSmrg# XORG_FONT_UCS2ANY()
13467973f115Smrg# -------------------
13475d10e53fSmrg# Minimum version: 1.1.0
1348dd519f38Smrg#
13495d10e53fSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
13505d10e53fSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
13515d10e53fSmrg# Also call pkg-config to find the directory with the encoding files needed
13525d10e53fSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
1353dd519f38Smrg
13545d10e53fSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
13555d10e53fSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
13565d10e53fSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
13575d10e53fSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
13585d10e53fSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
13595d10e53fSmrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
13605d10e53fSmrg	AC_SUBST(MAPFILES_PATH)
13615d10e53fSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
13625d10e53fSmrg])
1363dd519f38Smrg
1364dd519f38Smrg
1365dd519f38Smrg
13665d10e53fSmrg# XORG_FONT_FC_CONFDIR()
13675d10e53fSmrg# --------------------
13685d10e53fSmrg# Minimum version: 1.2.0
13695d10e53fSmrg#
13705d10e53fSmrg# Sets FC_CONFDIR to the fontconfig config directory
13715d10e53fSmrg# (which should be --with-confdir=... when building fontconfig)
13725d10e53fSmrg# found from:
13735d10e53fSmrg#	--with-fc-confdir=...
13745d10e53fSmrg#	pkg-config --variable=confdir fontconfig
13755d10e53fSmrg#	${sysconfdir}/fonts
1376dd519f38Smrg
13775d10e53fSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
13785d10e53fSmrg	dnl Ensure $PKG_CONFIG is set first
13795d10e53fSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1380dd519f38Smrg
13815d10e53fSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
13825d10e53fSmrg	AC_ARG_WITH(fc-confdir,
13835d10e53fSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
13845d10e53fSmrg			   [Path to fontconfig's configuration directory]),
13855d10e53fSmrg		    [FC_CONFDIR="$withval"])
13865d10e53fSmrg	# if --with-fc-confdir was not specified
13875d10e53fSmrg	if test "x${FC_CONFDIR}" = "x"; then
13885d10e53fSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
13895d10e53fSmrg	fi
13905d10e53fSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
13915d10e53fSmrg	if test "x${FC_CONFDIR}" = "x"; then
13925d10e53fSmrg		FC_CONFDIR="${sysconfdir}/fonts"
13935d10e53fSmrg	fi
13945d10e53fSmrg	AC_SUBST(FC_CONFDIR)
13955d10e53fSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
13965d10e53fSmrg])
1397dd519f38Smrg
1398dd519f38Smrg
1399dd519f38Smrg
14005d10e53fSmrg# XORG_FONTROOTDIR()
14015d10e53fSmrg# --------------------
14025d10e53fSmrg# Minimum version: 1.1.0
14035d10e53fSmrg#
14045d10e53fSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
14055d10e53fSmrg# found from:
14065d10e53fSmrg#	--with-fontrootdir
14075d10e53fSmrg#	pkg-config --variable=fontrootdir fontutil
14085d10e53fSmrg#	${datadir}/fonts/X11
1409dd519f38Smrg
14105d10e53fSmrgAC_DEFUN([XORG_FONTROOTDIR],[
14115d10e53fSmrg	dnl Ensure $PKG_CONFIG is set first
14125d10e53fSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1413dd519f38Smrg
14145d10e53fSmrg	AC_MSG_CHECKING([for root directory for font files])
14155d10e53fSmrg	AC_ARG_WITH(fontrootdir,
14165d10e53fSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
14175d10e53fSmrg			   [Path to root directory for font files]),
14185d10e53fSmrg		    [FONTROOTDIR="$withval"])
14195d10e53fSmrg	# if --with-fontrootdir not specified...
14205d10e53fSmrg	if test "x${FONTROOTDIR}" = "x"; then
14215d10e53fSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
14225d10e53fSmrg	fi
14235d10e53fSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
14245d10e53fSmrg	if test "x${FONTROOTDIR}" = "x"; then
14255d10e53fSmrg		FONTROOTDIR="${datadir}/fonts/X11"
14265d10e53fSmrg	fi
14275d10e53fSmrg	AC_SUBST(FONTROOTDIR)
14285d10e53fSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
14295d10e53fSmrg])
1430dd519f38Smrg
14315d10e53fSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
14325d10e53fSmrg# ---------------------------------------
14335d10e53fSmrg# Minimum version: 1.1.0
14347973f115Smrg#
14355d10e53fSmrg# Offer a --with-<flag> flag to control directory for font installation
14365d10e53fSmrg# Default is the specified <subdir> of the font root directory.
14375d10e53fSmrg# Sets <variable> to the selected directory
1438dd519f38Smrg
14395d10e53fSmrgAC_DEFUN([XORG_FONTSUBDIR],[
14405d10e53fSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
1441dd519f38Smrg
14425d10e53fSmrg	AC_MSG_CHECKING([for directory for $3 files])
14435d10e53fSmrg	AC_ARG_WITH($2,
14445d10e53fSmrg		    [AS_HELP_STRING([--with-$2=DIR],
14455d10e53fSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
14465d10e53fSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
14475d10e53fSmrg	AC_SUBST($1)
14485d10e53fSmrg	AC_MSG_RESULT([${$1}])
14495d10e53fSmrg]) # XORG_FONTSUBDIR
1450dd519f38Smrg
14515d10e53fSmrg# XORG_FONTDIR(subdir)
14525d10e53fSmrg# --------------------
14535d10e53fSmrg# Minimum version: 1.1.0
14545d10e53fSmrg#
14555d10e53fSmrg# Offer a --with-fontdir flag to control directory for font installation
14565d10e53fSmrg# Default is the specified subdir of the font root directory.
14575d10e53fSmrg# Sets FONTDIR to the selected directory
14587973f115Smrg
14595d10e53fSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
1460dd519f38Smrg
14615d10e53fSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14625d10e53fSmrgdnl
14635d10e53fSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
14645d10e53fSmrgdnl
14655d10e53fSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14665d10e53fSmrgdnl copy of this software and associated documentation files (the "Software"),
14675d10e53fSmrgdnl to deal in the Software without restriction, including without limitation
14685d10e53fSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14695d10e53fSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
14705d10e53fSmrgdnl Software is furnished to do so, subject to the following conditions:
14715d10e53fSmrgdnl
14725d10e53fSmrgdnl The above copyright notice and this permission notice (including the next
14735d10e53fSmrgdnl paragraph) shall be included in all copies or substantial portions of the
14745d10e53fSmrgdnl Software.
14755d10e53fSmrgdnl
14765d10e53fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14775d10e53fSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14785d10e53fSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14795d10e53fSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14805d10e53fSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14815d10e53fSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14825d10e53fSmrgdnl DEALINGS IN THE SOFTWARE.
1483dd519f38Smrg
14845d10e53fSmrg# XORG_MACROS_VERSION(required-version)
14855d10e53fSmrg# -------------------------------------
14865d10e53fSmrg# Minimum version: 1.1.0
14877973f115Smrg#
14885d10e53fSmrg# If you're using a macro added in Version 1.1 or newer, include this in
14895d10e53fSmrg# your configure.ac with the minimum required version, such as:
14905d10e53fSmrg# XORG_MACROS_VERSION(1.1)
14917973f115Smrg#
14925d10e53fSmrg# To ensure that this macro is defined, also add:
14935d10e53fSmrg# m4_ifndef([XORG_MACROS_VERSION],
14945d10e53fSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14957973f115Smrg#
14967973f115Smrg#
14975d10e53fSmrg# See the "minimum version" comment for each macro you use to see what
14985d10e53fSmrg# version you require.
14995d10e53fSmrgm4_defun([XORG_MACROS_VERSION],[
15005d10e53fSmrgm4_define([vers_have], [1.20.0])
15015d10e53fSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
15025d10e53fSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
15035d10e53fSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
15045d10e53fSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
15055d10e53fSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
15065d10e53fSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
15075d10e53fSmrgm4_undefine([vers_have])
15085d10e53fSmrgm4_undefine([maj_have])
15095d10e53fSmrgm4_undefine([maj_needed])
15105d10e53fSmrg]) # XORG_MACROS_VERSION
15115d10e53fSmrg
15125d10e53fSmrg# XORG_PROG_RAWCPP()
15135d10e53fSmrg# ------------------
15145d10e53fSmrg# Minimum version: 1.0.0
15157973f115Smrg#
15165d10e53fSmrg# Find cpp program and necessary flags for use in pre-processing text files
15175d10e53fSmrg# such as man pages and config files
15185d10e53fSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
15195d10e53fSmrgAC_REQUIRE([AC_PROG_CPP])
15205d10e53fSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
15215d10e53fSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
15227973f115Smrg
15235d10e53fSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
15245d10e53fSmrg# which is not the best choice for supporting other OS'es, but covers most
15255d10e53fSmrg# of the ones we need for now.
15265d10e53fSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
15275d10e53fSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
15285d10e53fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15295d10e53fSmrg	AC_MSG_RESULT([no])
15307973f115Smrgelse
15315d10e53fSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15325d10e53fSmrg		RAWCPPFLAGS=-undef
15335d10e53fSmrg		AC_MSG_RESULT([yes])
15345d10e53fSmrg	# under Cygwin unix is still defined even with -undef
15355d10e53fSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15365d10e53fSmrg		RAWCPPFLAGS="-undef -ansi"
15375d10e53fSmrg		AC_MSG_RESULT([yes, with -ansi])
15385d10e53fSmrg	else
15395d10e53fSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15405d10e53fSmrg	fi
1541dd519f38Smrgfi
15425d10e53fSmrgrm -f conftest.$ac_ext
1543dd519f38Smrg
15445d10e53fSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15455d10e53fSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15465d10e53fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15475d10e53fSmrg	AC_MSG_RESULT([no])
15485d10e53fSmrgelse
15495d10e53fSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15505d10e53fSmrg		TRADITIONALCPPFLAGS="-traditional"
15515d10e53fSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15525d10e53fSmrg		AC_MSG_RESULT([yes])
15535d10e53fSmrg	else
15545d10e53fSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15555d10e53fSmrg	fi
15565d10e53fSmrgfi
15575d10e53fSmrgrm -f conftest.$ac_ext
15585d10e53fSmrgAC_SUBST(RAWCPPFLAGS)
15595d10e53fSmrgAC_SUBST(TRADITIONALCPPFLAGS)
15605d10e53fSmrg]) # XORG_PROG_RAWCPP
15617973f115Smrg
15625d10e53fSmrg# XORG_MANPAGE_SECTIONS()
15635d10e53fSmrg# -----------------------
15645d10e53fSmrg# Minimum version: 1.0.0
15657973f115Smrg#
15665d10e53fSmrg# Determine which sections man pages go in for the different man page types
15675d10e53fSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15685d10e53fSmrg# Not sure if there's any better way than just hardcoding by OS name.
15695d10e53fSmrg# Override default settings by setting environment variables
15705d10e53fSmrg# Added MAN_SUBSTS in version 1.8
15715d10e53fSmrg# Added AC_PROG_SED in version 1.8
15727973f115Smrg
15735d10e53fSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15745d10e53fSmrgAC_REQUIRE([AC_CANONICAL_HOST])
15755d10e53fSmrgAC_REQUIRE([AC_PROG_SED])
15767973f115Smrg
15775d10e53fSmrgcase $host_os in
15785d10e53fSmrg    solaris*)
15795d10e53fSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15805d10e53fSmrg        # check for a man page file found in later versions that use
15815d10e53fSmrg        # traditional section numbers instead
15825d10e53fSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15835d10e53fSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15845d10e53fSmrg        ;;
15855d10e53fSmrg    *) SYSV_MAN_SECTIONS=false ;;
15865d10e53fSmrgesac
15877973f115Smrg
15885d10e53fSmrgif test x$APP_MAN_SUFFIX = x    ; then
15895d10e53fSmrg    APP_MAN_SUFFIX=1
15905d10e53fSmrgfi
15915d10e53fSmrgif test x$APP_MAN_DIR = x    ; then
15925d10e53fSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15937973f115Smrgfi
1594dd519f38Smrg
15955d10e53fSmrgif test x$LIB_MAN_SUFFIX = x    ; then
15965d10e53fSmrg    LIB_MAN_SUFFIX=3
15975d10e53fSmrgfi
15985d10e53fSmrgif test x$LIB_MAN_DIR = x    ; then
15995d10e53fSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
16005d10e53fSmrgfi
16017973f115Smrg
16025d10e53fSmrgif test x$FILE_MAN_SUFFIX = x    ; then
16035d10e53fSmrg    case $SYSV_MAN_SECTIONS in
16045d10e53fSmrg	true)				FILE_MAN_SUFFIX=4  ;;
16055d10e53fSmrg	*)				FILE_MAN_SUFFIX=5  ;;
16065d10e53fSmrg    esac
16075d10e53fSmrgfi
16085d10e53fSmrgif test x$FILE_MAN_DIR = x    ; then
16095d10e53fSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
16107973f115Smrgfi
1611dd519f38Smrg
16125d10e53fSmrgif test x$MISC_MAN_SUFFIX = x    ; then
16135d10e53fSmrg    case $SYSV_MAN_SECTIONS in
16145d10e53fSmrg	true)				MISC_MAN_SUFFIX=5  ;;
16155d10e53fSmrg	*)				MISC_MAN_SUFFIX=7  ;;
16165d10e53fSmrg    esac
16175d10e53fSmrgfi
16185d10e53fSmrgif test x$MISC_MAN_DIR = x    ; then
16195d10e53fSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
16207973f115Smrgfi
1621dd519f38Smrg
16225d10e53fSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
16235d10e53fSmrg    case $SYSV_MAN_SECTIONS in
16245d10e53fSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
16255d10e53fSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
16265d10e53fSmrg    esac
16275d10e53fSmrgfi
16285d10e53fSmrgif test x$DRIVER_MAN_DIR = x    ; then
16295d10e53fSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
16307973f115Smrgfi
1631dd519f38Smrg
16325d10e53fSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
16335d10e53fSmrg    case $SYSV_MAN_SECTIONS in
16345d10e53fSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16355d10e53fSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16365d10e53fSmrg    esac
16375d10e53fSmrgfi
16385d10e53fSmrgif test x$ADMIN_MAN_DIR = x    ; then
16395d10e53fSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16405d10e53fSmrgfi
1641dd519f38Smrg
16427973f115Smrg
16435d10e53fSmrgAC_SUBST([APP_MAN_SUFFIX])
16445d10e53fSmrgAC_SUBST([LIB_MAN_SUFFIX])
16455d10e53fSmrgAC_SUBST([FILE_MAN_SUFFIX])
16465d10e53fSmrgAC_SUBST([MISC_MAN_SUFFIX])
16475d10e53fSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16485d10e53fSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16495d10e53fSmrgAC_SUBST([APP_MAN_DIR])
16505d10e53fSmrgAC_SUBST([LIB_MAN_DIR])
16515d10e53fSmrgAC_SUBST([FILE_MAN_DIR])
16525d10e53fSmrgAC_SUBST([MISC_MAN_DIR])
16535d10e53fSmrgAC_SUBST([DRIVER_MAN_DIR])
16545d10e53fSmrgAC_SUBST([ADMIN_MAN_DIR])
1655dd519f38Smrg
16565d10e53fSmrgXORG_MAN_PAGE="X Version 11"
16575d10e53fSmrgAC_SUBST([XORG_MAN_PAGE])
16585d10e53fSmrgMAN_SUBSTS="\
16595d10e53fSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16605d10e53fSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16615d10e53fSmrg	-e 's|__xservername__|Xorg|g' \
16625d10e53fSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
16635d10e53fSmrg	-e 's|__projectroot__|\$(prefix)|g' \
16645d10e53fSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16655d10e53fSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16665d10e53fSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16675d10e53fSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16685d10e53fSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16695d10e53fSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16705d10e53fSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16715d10e53fSmrgAC_SUBST([MAN_SUBSTS])
16725d10e53fSmrg
16735d10e53fSmrg]) # XORG_MANPAGE_SECTIONS
16745d10e53fSmrg
16755d10e53fSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16765d10e53fSmrg# ------------------------
16775d10e53fSmrg# Minimum version: 1.7.0
16787973f115Smrg#
16795d10e53fSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16805d10e53fSmrg# provided by xorg-sgml-doctools, if installed.
16815d10e53fSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16825d10e53fSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16835d10e53fSmrgXORG_SGML_PATH=
16845d10e53fSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16855d10e53fSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16865d10e53fSmrg    [m4_ifval([$1],[:],
16875d10e53fSmrg        [if test x"$cross_compiling" != x"yes" ; then
16885d10e53fSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16895d10e53fSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16905d10e53fSmrg         fi])
16915d10e53fSmrg    ])
16927973f115Smrg
16935d10e53fSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16945d10e53fSmrg# the path and the name of the doc stylesheet
16955d10e53fSmrgif test "x$XORG_SGML_PATH" != "x" ; then
16965d10e53fSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16975d10e53fSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16985d10e53fSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16997973f115Smrgelse
17005d10e53fSmrg   AC_MSG_RESULT([no])
17017973f115Smrgfi
1702dd519f38Smrg
17035d10e53fSmrgAC_SUBST(XORG_SGML_PATH)
17045d10e53fSmrgAC_SUBST(STYLESHEET_SRCDIR)
17055d10e53fSmrgAC_SUBST(XSL_STYLESHEET)
17065d10e53fSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
17075d10e53fSmrg]) # XORG_CHECK_SGML_DOCTOOLS
17085d10e53fSmrg
17095d10e53fSmrg# XORG_CHECK_LINUXDOC
17105d10e53fSmrg# -------------------
17115d10e53fSmrg# Minimum version: 1.0.0
17127973f115Smrg#
17135d10e53fSmrg# Defines the variable MAKE_TEXT if the necessary tools and
17145d10e53fSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
17155d10e53fSmrg# Whether or not the necessary tools and files are found can be checked
17165d10e53fSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
17175d10e53fSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
17185d10e53fSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17195d10e53fSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
17205d10e53fSmrg
17215d10e53fSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
17225d10e53fSmrg
17237973f115SmrgAC_MSG_CHECKING([whether to build documentation])
17247973f115Smrg
17255d10e53fSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
17265d10e53fSmrg   BUILDDOC=yes
17275d10e53fSmrgelse
17285d10e53fSmrg   BUILDDOC=no
17295d10e53fSmrgfi
17307973f115Smrg
17315d10e53fSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1732dd519f38Smrg
17335d10e53fSmrgAC_MSG_RESULT([$BUILDDOC])
17345d10e53fSmrg
17355d10e53fSmrgAC_MSG_CHECKING([whether to build pdf documentation])
17365d10e53fSmrg
17375d10e53fSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17385d10e53fSmrg   BUILDPDFDOC=yes
17395d10e53fSmrgelse
17405d10e53fSmrg   BUILDPDFDOC=no
17415d10e53fSmrgfi
17425d10e53fSmrg
17435d10e53fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17445d10e53fSmrg
17455d10e53fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17465d10e53fSmrg
17475d10e53fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17485d10e53fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17495d10e53fSmrgMAKE_PDF="$PS2PDF"
17505d10e53fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17515d10e53fSmrg
17525d10e53fSmrgAC_SUBST(MAKE_TEXT)
17535d10e53fSmrgAC_SUBST(MAKE_PS)
17545d10e53fSmrgAC_SUBST(MAKE_PDF)
17555d10e53fSmrgAC_SUBST(MAKE_HTML)
17565d10e53fSmrg]) # XORG_CHECK_LINUXDOC
17575d10e53fSmrg
17585d10e53fSmrg# XORG_CHECK_DOCBOOK
17595d10e53fSmrg# -------------------
17607973f115Smrg# Minimum version: 1.0.0
17617973f115Smrg#
17625d10e53fSmrg# Checks for the ability to build output formats from SGML DocBook source.
17635d10e53fSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17645d10e53fSmrg# indicates whether the necessary tools and files are found and, if set,
17655d10e53fSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17665d10e53fSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17675d10e53fSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1768dd519f38Smrg
17695d10e53fSmrgBUILDTXTDOC=no
17705d10e53fSmrgBUILDPDFDOC=no
17715d10e53fSmrgBUILDPSDOC=no
17725d10e53fSmrgBUILDHTMLDOC=no
17735d10e53fSmrg
17745d10e53fSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17755d10e53fSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17765d10e53fSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17775d10e53fSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17785d10e53fSmrg
17795d10e53fSmrgAC_MSG_CHECKING([whether to build text documentation])
17805d10e53fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17815d10e53fSmrg   test x$BUILD_TXTDOC != xno; then
17825d10e53fSmrg	BUILDTXTDOC=yes
17837973f115Smrgfi
17845d10e53fSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17855d10e53fSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1786dd519f38Smrg
17875d10e53fSmrgAC_MSG_CHECKING([whether to build PDF documentation])
17885d10e53fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17895d10e53fSmrg   test x$BUILD_PDFDOC != xno; then
17905d10e53fSmrg	BUILDPDFDOC=yes
17917973f115Smrgfi
17925d10e53fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17935d10e53fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17947973f115Smrg
17955d10e53fSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17965d10e53fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17975d10e53fSmrg   test x$BUILD_PSDOC != xno; then
17985d10e53fSmrg	BUILDPSDOC=yes
17995d10e53fSmrgfi
18005d10e53fSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
18015d10e53fSmrgAC_MSG_RESULT([$BUILDPSDOC])
1802dd519f38Smrg
18035d10e53fSmrgAC_MSG_CHECKING([whether to build HTML documentation])
18045d10e53fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
18055d10e53fSmrg   test x$BUILD_HTMLDOC != xno; then
18065d10e53fSmrg	BUILDHTMLDOC=yes
18075d10e53fSmrgfi
18085d10e53fSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
18095d10e53fSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
18105d10e53fSmrg
18115d10e53fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
18125d10e53fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
18135d10e53fSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
18145d10e53fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
18155d10e53fSmrg
18165d10e53fSmrgAC_SUBST(MAKE_TEXT)
18175d10e53fSmrgAC_SUBST(MAKE_PS)
18185d10e53fSmrgAC_SUBST(MAKE_PDF)
18195d10e53fSmrgAC_SUBST(MAKE_HTML)
18205d10e53fSmrg]) # XORG_CHECK_DOCBOOK
18215d10e53fSmrg
18225d10e53fSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
18237973f115Smrg# ----------------
18245d10e53fSmrg# Minimum version: 1.5.0
18255d10e53fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1826dd519f38Smrg#
18275d10e53fSmrg# Documentation tools are not always available on all platforms and sometimes
18285d10e53fSmrg# not at the appropriate level. This macro enables a module to test for the
18295d10e53fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
18305d10e53fSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
18315d10e53fSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
18325d10e53fSmrg# --with-xmlto assumes 'auto'.
1833dd519f38Smrg#
18347973f115Smrg# Interface to module:
18355d10e53fSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18365d10e53fSmrg# XMLTO:	returns the path of the xmlto program found
18375d10e53fSmrg#		returns the path set by the user in the environment
18385d10e53fSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18395d10e53fSmrg#		'no' user instructs the module not to use xmlto
1840dd519f38Smrg#
18415d10e53fSmrg# Added in version 1.10.0
18425d10e53fSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18435d10e53fSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1844dd519f38Smrg#
18455d10e53fSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
18467973f115Smrg#
18475d10e53fSmrgAC_DEFUN([XORG_WITH_XMLTO],[
18485d10e53fSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18495d10e53fSmrgm4_define([_defopt], m4_default([$2], [auto]))
18505d10e53fSmrgAC_ARG_WITH(xmlto,
18515d10e53fSmrg	AS_HELP_STRING([--with-xmlto],
18525d10e53fSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18535d10e53fSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18545d10e53fSmrgm4_undefine([_defopt])
1855dd519f38Smrg
18565d10e53fSmrgif test "x$use_xmlto" = x"auto"; then
18575d10e53fSmrg   AC_PATH_PROG([XMLTO], [xmlto])
18585d10e53fSmrg   if test "x$XMLTO" = "x"; then
18595d10e53fSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18605d10e53fSmrg	have_xmlto=no
18615d10e53fSmrg   else
18625d10e53fSmrg        have_xmlto=yes
18637973f115Smrg   fi
18645d10e53fSmrgelif test "x$use_xmlto" = x"yes" ; then
18655d10e53fSmrg   AC_PATH_PROG([XMLTO], [xmlto])
18665d10e53fSmrg   if test "x$XMLTO" = "x"; then
18675d10e53fSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18685d10e53fSmrg   fi
18695d10e53fSmrg   have_xmlto=yes
18705d10e53fSmrgelif test "x$use_xmlto" = x"no" ; then
18715d10e53fSmrg   if test "x$XMLTO" != "x"; then
18725d10e53fSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18737973f115Smrg   fi
18745d10e53fSmrg   have_xmlto=no
18757973f115Smrgelse
18765d10e53fSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18777973f115Smrgfi
1878dd519f38Smrg
18795d10e53fSmrg# Test for a minimum version of xmlto, if provided.
18805d10e53fSmrgm4_ifval([$1],
18815d10e53fSmrg[if test "$have_xmlto" = yes; then
18825d10e53fSmrg    # scrape the xmlto version
18835d10e53fSmrg    AC_MSG_CHECKING([the xmlto version])
18845d10e53fSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18855d10e53fSmrg    AC_MSG_RESULT([$xmlto_version])
18865d10e53fSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18875d10e53fSmrg        [if test "x$use_xmlto" = xauto; then
18885d10e53fSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18895d10e53fSmrg            have_xmlto=no
18905d10e53fSmrg        else
18915d10e53fSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18925d10e53fSmrg        fi])
18935d10e53fSmrgfi])
1894dd519f38Smrg
18955d10e53fSmrg# Test for the ability of xmlto to generate a text target
1896dd519f38Smrg#
18975d10e53fSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18985d10e53fSmrg# following test for empty XML docbook files.
18995d10e53fSmrg# For compatibility reasons use the following empty XML docbook file and if
19005d10e53fSmrg# it fails try it again with a non-empty XML file.
19015d10e53fSmrghave_xmlto_text=no
19025d10e53fSmrgcat > conftest.xml << "EOF"
19035d10e53fSmrgEOF
19045d10e53fSmrgAS_IF([test "$have_xmlto" = yes],
19055d10e53fSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
19065d10e53fSmrg             [have_xmlto_text=yes],
19075d10e53fSmrg             [# Try it again with a non-empty XML file.
19085d10e53fSmrg              cat > conftest.xml << "EOF"
19095d10e53fSmrg<x></x>
19105d10e53fSmrgEOF
19115d10e53fSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
19125d10e53fSmrg                    [have_xmlto_text=yes],
19135d10e53fSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
19145d10e53fSmrgrm -f conftest.xml
19155d10e53fSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
19165d10e53fSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
19175d10e53fSmrg]) # XORG_WITH_XMLTO
1918dd519f38Smrg
19195d10e53fSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
19205d10e53fSmrg# --------------------------------------------
19215d10e53fSmrg# Minimum version: 1.12.0
19225d10e53fSmrg# Minimum version for optional DEFAULT argument: 1.12.0
19235d10e53fSmrg#
19245d10e53fSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
19255d10e53fSmrg# XML-based language used for the transformation of XML documents.
19265d10e53fSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
19275d10e53fSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
19285d10e53fSmrg# The XSLT processor is often used as a standalone tool for transformations.
19295d10e53fSmrg# It should not be assumed that this tool is used only to work with documnetation.
19305d10e53fSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
19315d10e53fSmrg#
19325d10e53fSmrg# Interface to module:
19335d10e53fSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19345d10e53fSmrg# XSLTPROC:	 returns the path of the xsltproc program found
19355d10e53fSmrg#		 returns the path set by the user in the environment
19365d10e53fSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19375d10e53fSmrg#		  'no' user instructs the module not to use xsltproc
19385d10e53fSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19395d10e53fSmrg#
19405d10e53fSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19415d10e53fSmrg#
19425d10e53fSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19435d10e53fSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19445d10e53fSmrg# Preserves the interface, should it be implemented later
19455d10e53fSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19465d10e53fSmrgm4_define([_defopt], m4_default([$2], [auto]))
19475d10e53fSmrgAC_ARG_WITH(xsltproc,
19485d10e53fSmrg	AS_HELP_STRING([--with-xsltproc],
19495d10e53fSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19505d10e53fSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19515d10e53fSmrgm4_undefine([_defopt])
1952dd519f38Smrg
19535d10e53fSmrgif test "x$use_xsltproc" = x"auto"; then
19545d10e53fSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19555d10e53fSmrg   if test "x$XSLTPROC" = "x"; then
19565d10e53fSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19575d10e53fSmrg	have_xsltproc=no
19585d10e53fSmrg   else
19595d10e53fSmrg        have_xsltproc=yes
19607973f115Smrg   fi
19615d10e53fSmrgelif test "x$use_xsltproc" = x"yes" ; then
19625d10e53fSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19635d10e53fSmrg   if test "x$XSLTPROC" = "x"; then
19645d10e53fSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19655d10e53fSmrg   fi
19665d10e53fSmrg   have_xsltproc=yes
19675d10e53fSmrgelif test "x$use_xsltproc" = x"no" ; then
19685d10e53fSmrg   if test "x$XSLTPROC" != "x"; then
19695d10e53fSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19705d10e53fSmrg   fi
19715d10e53fSmrg   have_xsltproc=no
19725d10e53fSmrgelse
19735d10e53fSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19747973f115Smrgfi
1975dd519f38Smrg
19765d10e53fSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19775d10e53fSmrg]) # XORG_WITH_XSLTPROC
1978dd519f38Smrg
19795d10e53fSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19805d10e53fSmrg# ----------------------------------------
19815d10e53fSmrg# Minimum version: 1.15.0
1982dd519f38Smrg#
19835d10e53fSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
19845d10e53fSmrg# scanning arbitrary text files, extracting information from those text files,
19855d10e53fSmrg# and printing reports based on that information.
1986dd519f38Smrg#
19875d10e53fSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1988dd519f38Smrg#
19895d10e53fSmrg# Interface to module:
19905d10e53fSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
19915d10e53fSmrg# PERL:	     returns the path of the perl program found
19925d10e53fSmrg#	     returns the path set by the user in the environment
19935d10e53fSmrg# --with-perl: 'yes' user instructs the module to use perl
19945d10e53fSmrg#	       'no' user instructs the module not to use perl
19955d10e53fSmrg# have_perl: returns yes if perl found in PATH or no
19965d10e53fSmrg#
19975d10e53fSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19985d10e53fSmrg#
19995d10e53fSmrgAC_DEFUN([XORG_WITH_PERL],[
20005d10e53fSmrgAC_ARG_VAR([PERL], [Path to perl command])
20015d10e53fSmrg# Preserves the interface, should it be implemented later
20025d10e53fSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
20035d10e53fSmrgm4_define([_defopt], m4_default([$2], [auto]))
20045d10e53fSmrgAC_ARG_WITH(perl,
20055d10e53fSmrg	AS_HELP_STRING([--with-perl],
20065d10e53fSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
20075d10e53fSmrg	   [use_perl=$withval], [use_perl=]_defopt)
20085d10e53fSmrgm4_undefine([_defopt])
2009dd519f38Smrg
20105d10e53fSmrgif test "x$use_perl" = x"auto"; then
20115d10e53fSmrg   AC_PATH_PROG([PERL], [perl])
20125d10e53fSmrg   if test "x$PERL" = "x"; then
20135d10e53fSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
20145d10e53fSmrg	have_perl=no
20155d10e53fSmrg   else
20165d10e53fSmrg        have_perl=yes
20175d10e53fSmrg   fi
20185d10e53fSmrgelif test "x$use_perl" = x"yes" ; then
20195d10e53fSmrg   AC_PATH_PROG([PERL], [perl])
20205d10e53fSmrg   if test "x$PERL" = "x"; then
20215d10e53fSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
20225d10e53fSmrg   fi
20235d10e53fSmrg   have_perl=yes
20245d10e53fSmrgelif test "x$use_perl" = x"no" ; then
20255d10e53fSmrg   if test "x$PERL" != "x"; then
20265d10e53fSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
20275d10e53fSmrg   fi
20285d10e53fSmrg   have_perl=no
20295d10e53fSmrgelse
20305d10e53fSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
20317973f115Smrgfi
2032dd519f38Smrg
20335d10e53fSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20345d10e53fSmrg]) # XORG_WITH_PERL
2035dd519f38Smrg
20365d10e53fSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
20377973f115Smrg# ----------------
20385d10e53fSmrg# Minimum version: 1.5.0
20395d10e53fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20407973f115Smrg#
20415d10e53fSmrg# Documentation tools are not always available on all platforms and sometimes
20425d10e53fSmrg# not at the appropriate level. This macro enables a module to test for the
20435d10e53fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20445d10e53fSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
20455d10e53fSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20465d10e53fSmrg# --with-asciidoc assumes 'auto'.
20477973f115Smrg#
20485d10e53fSmrg# Interface to module:
20495d10e53fSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20505d10e53fSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
20515d10e53fSmrg#		 returns the path set by the user in the environment
20525d10e53fSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20535d10e53fSmrg#		  'no' user instructs the module not to use asciidoc
20545d10e53fSmrg#
20555d10e53fSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20565d10e53fSmrg#
20575d10e53fSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20585d10e53fSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20595d10e53fSmrgm4_define([_defopt], m4_default([$2], [auto]))
20605d10e53fSmrgAC_ARG_WITH(asciidoc,
20615d10e53fSmrg	AS_HELP_STRING([--with-asciidoc],
20625d10e53fSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20635d10e53fSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20645d10e53fSmrgm4_undefine([_defopt])
2065dd519f38Smrg
20665d10e53fSmrgif test "x$use_asciidoc" = x"auto"; then
20675d10e53fSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20685d10e53fSmrg   if test "x$ASCIIDOC" = "x"; then
20695d10e53fSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20705d10e53fSmrg	have_asciidoc=no
20715d10e53fSmrg   else
20725d10e53fSmrg        have_asciidoc=yes
20735d10e53fSmrg   fi
20745d10e53fSmrgelif test "x$use_asciidoc" = x"yes" ; then
20755d10e53fSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20765d10e53fSmrg   if test "x$ASCIIDOC" = "x"; then
20775d10e53fSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20785d10e53fSmrg   fi
20795d10e53fSmrg   have_asciidoc=yes
20805d10e53fSmrgelif test "x$use_asciidoc" = x"no" ; then
20815d10e53fSmrg   if test "x$ASCIIDOC" != "x"; then
20825d10e53fSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20835d10e53fSmrg   fi
20845d10e53fSmrg   have_asciidoc=no
20855d10e53fSmrgelse
20865d10e53fSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20875d10e53fSmrgfi
20885d10e53fSmrgm4_ifval([$1],
20895d10e53fSmrg[if test "$have_asciidoc" = yes; then
20905d10e53fSmrg    # scrape the asciidoc version
20915d10e53fSmrg    AC_MSG_CHECKING([the asciidoc version])
20925d10e53fSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20935d10e53fSmrg    AC_MSG_RESULT([$asciidoc_version])
20945d10e53fSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20955d10e53fSmrg        [if test "x$use_asciidoc" = xauto; then
20965d10e53fSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20975d10e53fSmrg            have_asciidoc=no
20985d10e53fSmrg        else
20995d10e53fSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
21005d10e53fSmrg        fi])
21015d10e53fSmrgfi])
21025d10e53fSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
21035d10e53fSmrg]) # XORG_WITH_ASCIIDOC
2104dd519f38Smrg
21055d10e53fSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
21065d10e53fSmrg# -------------------------------------------
21075d10e53fSmrg# Minimum version: 1.5.0
21085d10e53fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
21095d10e53fSmrg# Minimum version for optional DOT checking: 1.18.0
2110dd519f38Smrg#
21115d10e53fSmrg# Documentation tools are not always available on all platforms and sometimes
21125d10e53fSmrg# not at the appropriate level. This macro enables a module to test for the
21135d10e53fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
21145d10e53fSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
21155d10e53fSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
21165d10e53fSmrg# --with-doxygen assumes 'auto'.
21177973f115Smrg#
21185d10e53fSmrg# Interface to module:
21195d10e53fSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
21205d10e53fSmrg# DOXYGEN:	 returns the path of the doxygen program found
21215d10e53fSmrg#		 returns the path set by the user in the environment
21225d10e53fSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
21235d10e53fSmrg#		  'no' user instructs the module not to use doxygen
21247973f115Smrg#
21255d10e53fSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
21267973f115Smrg#
21275d10e53fSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
21285d10e53fSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
21295d10e53fSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
21305d10e53fSmrgm4_define([_defopt], m4_default([$2], [auto]))
21315d10e53fSmrgAC_ARG_WITH(doxygen,
21325d10e53fSmrg	AS_HELP_STRING([--with-doxygen],
21335d10e53fSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21345d10e53fSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21355d10e53fSmrgm4_undefine([_defopt])
2136dd519f38Smrg
21375d10e53fSmrgif test "x$use_doxygen" = x"auto"; then
21385d10e53fSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21395d10e53fSmrg   if test "x$DOXYGEN" = "x"; then
21405d10e53fSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21415d10e53fSmrg	have_doxygen=no
21425d10e53fSmrg   else
21435d10e53fSmrg        have_doxygen=yes
21445d10e53fSmrg   fi
21455d10e53fSmrgelif test "x$use_doxygen" = x"yes" ; then
21465d10e53fSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21475d10e53fSmrg   if test "x$DOXYGEN" = "x"; then
21485d10e53fSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21495d10e53fSmrg   fi
21505d10e53fSmrg   have_doxygen=yes
21515d10e53fSmrgelif test "x$use_doxygen" = x"no" ; then
21525d10e53fSmrg   if test "x$DOXYGEN" != "x"; then
21535d10e53fSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21545d10e53fSmrg   fi
21555d10e53fSmrg   have_doxygen=no
21565d10e53fSmrgelse
21575d10e53fSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
21585d10e53fSmrgfi
21595d10e53fSmrgm4_ifval([$1],
21605d10e53fSmrg[if test "$have_doxygen" = yes; then
21615d10e53fSmrg    # scrape the doxygen version
21625d10e53fSmrg    AC_MSG_CHECKING([the doxygen version])
21635d10e53fSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21645d10e53fSmrg    AC_MSG_RESULT([$doxygen_version])
21655d10e53fSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21665d10e53fSmrg        [if test "x$use_doxygen" = xauto; then
21675d10e53fSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21685d10e53fSmrg            have_doxygen=no
21695d10e53fSmrg        else
21705d10e53fSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21715d10e53fSmrg        fi])
21725d10e53fSmrgfi])
2173dd519f38Smrg
21745d10e53fSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21755d10e53fSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21765d10e53fSmrgdnl 	HAVE_DOT = @HAVE_DOT@
21775d10e53fSmrgHAVE_DOT=no
21785d10e53fSmrgif test "x$have_doxygen" = "xyes"; then
21795d10e53fSmrg  AC_PATH_PROG([DOT], [dot])
21805d10e53fSmrg    if test "x$DOT" != "x"; then
21815d10e53fSmrg      HAVE_DOT=yes
21825d10e53fSmrg    fi
21835d10e53fSmrgfi
2184dd519f38Smrg
21855d10e53fSmrgAC_SUBST([HAVE_DOT])
21865d10e53fSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21875d10e53fSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21885d10e53fSmrg]) # XORG_WITH_DOXYGEN
2189dd519f38Smrg
21905d10e53fSmrg# XORG_WITH_GROFF([DEFAULT])
21915d10e53fSmrg# ----------------
21925d10e53fSmrg# Minimum version: 1.6.0
21935d10e53fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2194dd519f38Smrg#
21955d10e53fSmrg# Documentation tools are not always available on all platforms and sometimes
21965d10e53fSmrg# not at the appropriate level. This macro enables a module to test for the
21975d10e53fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
21985d10e53fSmrg# the --with-groff option, it allows maximum flexibility in making decisions
21995d10e53fSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
22005d10e53fSmrg# --with-groff assumes 'auto'.
2201dd519f38Smrg#
22025d10e53fSmrg# Interface to module:
22035d10e53fSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
22045d10e53fSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
22055d10e53fSmrg# HAVE_GROFF_MS: the -ms macros package
22065d10e53fSmrg# GROFF:	 returns the path of the groff program found
22075d10e53fSmrg#		 returns the path set by the user in the environment
22085d10e53fSmrg# --with-groff:	 'yes' user instructs the module to use groff
22095d10e53fSmrg#		 'no' user instructs the module not to use groff
2210dd519f38Smrg#
22115d10e53fSmrg# Added in version 1.9.0:
22125d10e53fSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
22135d10e53fSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
22145d10e53fSmrg#		   psselect from the psutils package.
22155d10e53fSmrg#		   the ghostcript package. Refer to the grohtml man pages
2216dd519f38Smrg#
22175d10e53fSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2218dd519f38Smrg#
22195d10e53fSmrg# OS and distros often splits groff in a basic and full package, the former
22205d10e53fSmrg# having the groff program and the later having devices, fonts and macros
22215d10e53fSmrg# Checking for the groff executable is not enough.
22227973f115Smrg#
22235d10e53fSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
22245d10e53fSmrg# unset HAVE_GROFF or GROFF env variables.
22255d10e53fSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
22267973f115Smrg#
22275d10e53fSmrgAC_DEFUN([XORG_WITH_GROFF],[
22285d10e53fSmrgAC_ARG_VAR([GROFF], [Path to groff command])
22295d10e53fSmrgm4_define([_defopt], m4_default([$1], [auto]))
22305d10e53fSmrgAC_ARG_WITH(groff,
22315d10e53fSmrg	AS_HELP_STRING([--with-groff],
22325d10e53fSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
22335d10e53fSmrg	   [use_groff=$withval], [use_groff=]_defopt)
22345d10e53fSmrgm4_undefine([_defopt])
22357973f115Smrg
22365d10e53fSmrgif test "x$use_groff" = x"auto"; then
22375d10e53fSmrg   AC_PATH_PROG([GROFF], [groff])
22385d10e53fSmrg   if test "x$GROFF" = "x"; then
22395d10e53fSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22405d10e53fSmrg	have_groff=no
22415d10e53fSmrg   else
22425d10e53fSmrg        have_groff=yes
22435d10e53fSmrg   fi
22445d10e53fSmrgelif test "x$use_groff" = x"yes" ; then
22455d10e53fSmrg   AC_PATH_PROG([GROFF], [groff])
22465d10e53fSmrg   if test "x$GROFF" = "x"; then
22475d10e53fSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22485d10e53fSmrg   fi
22495d10e53fSmrg   have_groff=yes
22505d10e53fSmrgelif test "x$use_groff" = x"no" ; then
22515d10e53fSmrg   if test "x$GROFF" != "x"; then
22525d10e53fSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22535d10e53fSmrg   fi
22545d10e53fSmrg   have_groff=no
2255dd519f38Smrgelse
22565d10e53fSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2257dd519f38Smrgfi
2258dd519f38Smrg
22595d10e53fSmrg# We have groff, test for the presence of the macro packages
22605d10e53fSmrgif test "x$have_groff" = x"yes"; then
22615d10e53fSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22625d10e53fSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22635d10e53fSmrg        groff_ms_works=yes
22645d10e53fSmrg    else
22655d10e53fSmrg        groff_ms_works=no
22667973f115Smrg    fi
22675d10e53fSmrg    AC_MSG_RESULT([$groff_ms_works])
22685d10e53fSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22695d10e53fSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22705d10e53fSmrg        groff_mm_works=yes
22715d10e53fSmrg    else
22725d10e53fSmrg        groff_mm_works=no
22735d10e53fSmrg    fi
22745d10e53fSmrg    AC_MSG_RESULT([$groff_mm_works])
2275dd519f38Smrgfi
22767973f115Smrg
22775d10e53fSmrg# We have groff, test for HTML dependencies, one command per package
22785d10e53fSmrgif test "x$have_groff" = x"yes"; then
22795d10e53fSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22805d10e53fSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22815d10e53fSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22825d10e53fSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22835d10e53fSmrg      have_groff_html=yes
22845d10e53fSmrg   else
22855d10e53fSmrg      have_groff_html=no
22865d10e53fSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22875d10e53fSmrg   fi
22885d10e53fSmrgfi
22897973f115Smrg
22905d10e53fSmrg# Set Automake conditionals for Makefiles
22915d10e53fSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22925d10e53fSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22935d10e53fSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22945d10e53fSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22955d10e53fSmrg]) # XORG_WITH_GROFF
22967973f115Smrg
22975d10e53fSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22985d10e53fSmrg# ---------------------------------------
22995d10e53fSmrg# Minimum version: 1.6.0
23005d10e53fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
23015d10e53fSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
23025d10e53fSmrg#
23035d10e53fSmrg# Documentation tools are not always available on all platforms and sometimes
23045d10e53fSmrg# not at the appropriate level. This macro enables a module to test for the
23055d10e53fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
23065d10e53fSmrg# the --with-fop option, it allows maximum flexibility in making decisions
23075d10e53fSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
23085d10e53fSmrg# --with-fop assumes 'auto'.
23095d10e53fSmrg#
23105d10e53fSmrg# Interface to module:
23115d10e53fSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
23125d10e53fSmrg# FOP:	 	returns the path of the fop program found
23135d10e53fSmrg#		returns the path set by the user in the environment
23145d10e53fSmrg# --with-fop: 	'yes' user instructs the module to use fop
23155d10e53fSmrg#		'no' user instructs the module not to use fop
23165d10e53fSmrg#
23175d10e53fSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
23185d10e53fSmrg#
23195d10e53fSmrgAC_DEFUN([XORG_WITH_FOP],[
23205d10e53fSmrgAC_ARG_VAR([FOP], [Path to fop command])
23215d10e53fSmrgm4_define([_defopt], m4_default([$2], [auto]))
23225d10e53fSmrgAC_ARG_WITH(fop,
23235d10e53fSmrg	AS_HELP_STRING([--with-fop],
23245d10e53fSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
23255d10e53fSmrg	   [use_fop=$withval], [use_fop=]_defopt)
23265d10e53fSmrgm4_undefine([_defopt])
23277973f115Smrg
23285d10e53fSmrgif test "x$use_fop" = x"auto"; then
23295d10e53fSmrg   AC_PATH_PROG([FOP], [fop])
23305d10e53fSmrg   if test "x$FOP" = "x"; then
23315d10e53fSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
23325d10e53fSmrg	have_fop=no
23335d10e53fSmrg   else
23345d10e53fSmrg        have_fop=yes
23355d10e53fSmrg   fi
23365d10e53fSmrgelif test "x$use_fop" = x"yes" ; then
23375d10e53fSmrg   AC_PATH_PROG([FOP], [fop])
23385d10e53fSmrg   if test "x$FOP" = "x"; then
23395d10e53fSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23405d10e53fSmrg   fi
23415d10e53fSmrg   have_fop=yes
23425d10e53fSmrgelif test "x$use_fop" = x"no" ; then
23435d10e53fSmrg   if test "x$FOP" != "x"; then
23445d10e53fSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23455d10e53fSmrg   fi
23465d10e53fSmrg   have_fop=no
23475d10e53fSmrgelse
23485d10e53fSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2349dd519f38Smrgfi
2350dd519f38Smrg
23515d10e53fSmrg# Test for a minimum version of fop, if provided.
23525d10e53fSmrgm4_ifval([$1],
23535d10e53fSmrg[if test "$have_fop" = yes; then
23545d10e53fSmrg    # scrape the fop version
23555d10e53fSmrg    AC_MSG_CHECKING([for fop minimum version])
23565d10e53fSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23575d10e53fSmrg    AC_MSG_RESULT([$fop_version])
23585d10e53fSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
23595d10e53fSmrg        [if test "x$use_fop" = xauto; then
23605d10e53fSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23615d10e53fSmrg            have_fop=no
23625d10e53fSmrg        else
23635d10e53fSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23645d10e53fSmrg        fi])
23655d10e53fSmrgfi])
23665d10e53fSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23675d10e53fSmrg]) # XORG_WITH_FOP
2368dd519f38Smrg
23695d10e53fSmrg# XORG_WITH_M4([MIN-VERSION])
23705d10e53fSmrg# ---------------------------
23715d10e53fSmrg# Minimum version: 1.19.0
2372dd519f38Smrg#
23735d10e53fSmrg# This macro attempts to locate an m4 macro processor which supports
23745d10e53fSmrg# -I option and is only useful for modules relying on M4 in order to
23755d10e53fSmrg# expand macros in source code files.
23767973f115Smrg#
23775d10e53fSmrg# Interface to module:
23785d10e53fSmrg# M4:	 	returns the path of the m4 program found
23795d10e53fSmrg#		returns the path set by the user in the environment
23805d10e53fSmrg#
23815d10e53fSmrgAC_DEFUN([XORG_WITH_M4], [
23825d10e53fSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23835d10e53fSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23845d10e53fSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23855d10e53fSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23865d10e53fSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23875d10e53fSmrg   [$PATH:/usr/gnu/bin])])
2388dd519f38Smrg
23895d10e53fSmrgAC_SUBST([M4], [$ac_cv_path_M4])
23905d10e53fSmrg]) # XORG_WITH_M4
2391dd519f38Smrg
23925d10e53fSmrg# XORG_WITH_PS2PDF([DEFAULT])
23935d10e53fSmrg# ----------------
23945d10e53fSmrg# Minimum version: 1.6.0
23955d10e53fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
23965d10e53fSmrg#
23975d10e53fSmrg# Documentation tools are not always available on all platforms and sometimes
23985d10e53fSmrg# not at the appropriate level. This macro enables a module to test for the
23995d10e53fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
24005d10e53fSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
24015d10e53fSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
24025d10e53fSmrg# --with-ps2pdf assumes 'auto'.
24035d10e53fSmrg#
24045d10e53fSmrg# Interface to module:
24055d10e53fSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
24065d10e53fSmrg# PS2PDF:	returns the path of the ps2pdf program found
24075d10e53fSmrg#		returns the path set by the user in the environment
24085d10e53fSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
24095d10e53fSmrg#		 'no' user instructs the module not to use ps2pdf
24105d10e53fSmrg#
24115d10e53fSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
24125d10e53fSmrg#
24135d10e53fSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
24145d10e53fSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
24155d10e53fSmrgm4_define([_defopt], m4_default([$1], [auto]))
24165d10e53fSmrgAC_ARG_WITH(ps2pdf,
24175d10e53fSmrg	AS_HELP_STRING([--with-ps2pdf],
24185d10e53fSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
24195d10e53fSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
24205d10e53fSmrgm4_undefine([_defopt])
2421ed029a5fSmrg
24225d10e53fSmrgif test "x$use_ps2pdf" = x"auto"; then
24235d10e53fSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
24245d10e53fSmrg   if test "x$PS2PDF" = "x"; then
24255d10e53fSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
24265d10e53fSmrg	have_ps2pdf=no
24275d10e53fSmrg   else
24285d10e53fSmrg        have_ps2pdf=yes
24295d10e53fSmrg   fi
24305d10e53fSmrgelif test "x$use_ps2pdf" = x"yes" ; then
24315d10e53fSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
24325d10e53fSmrg   if test "x$PS2PDF" = "x"; then
24335d10e53fSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24345d10e53fSmrg   fi
24355d10e53fSmrg   have_ps2pdf=yes
24365d10e53fSmrgelif test "x$use_ps2pdf" = x"no" ; then
24375d10e53fSmrg   if test "x$PS2PDF" != "x"; then
24385d10e53fSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24395d10e53fSmrg   fi
24405d10e53fSmrg   have_ps2pdf=no
24415d10e53fSmrgelse
24425d10e53fSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
24437973f115Smrgfi
24445d10e53fSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24455d10e53fSmrg]) # XORG_WITH_PS2PDF
2446ed029a5fSmrg
24475d10e53fSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
24485d10e53fSmrg# ----------------
24495d10e53fSmrg# Minimum version: 1.6.0
24505d10e53fSmrg#
24515d10e53fSmrg# Documentation tools are not always available on all platforms and sometimes
24525d10e53fSmrg# not at the appropriate level. This macro enables a builder to skip all
24535d10e53fSmrg# documentation targets except traditional man pages.
24545d10e53fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24555d10e53fSmrg# maximum flexibility in controlling documentation building.
24565d10e53fSmrg# Refer to:
24575d10e53fSmrg# XORG_WITH_XMLTO         --with-xmlto
24585d10e53fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24595d10e53fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24605d10e53fSmrg# XORG_WITH_FOP           --with-fop
24615d10e53fSmrg# XORG_WITH_GROFF         --with-groff
24625d10e53fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24635d10e53fSmrg#
24645d10e53fSmrg# Interface to module:
24655d10e53fSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24665d10e53fSmrg# --enable-docs: 'yes' user instructs the module to generate docs
24675d10e53fSmrg#		 'no' user instructs the module not to generate docs
24685d10e53fSmrg# parm1:	specify the default value, yes or no.
24695d10e53fSmrg#
24705d10e53fSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24715d10e53fSmrgm4_define([docs_default], m4_default([$1], [yes]))
24725d10e53fSmrgAC_ARG_ENABLE(docs,
24735d10e53fSmrg	AS_HELP_STRING([--enable-docs],
24745d10e53fSmrg	   [Enable building the documentation (default: ]docs_default[)]),
24755d10e53fSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
24765d10e53fSmrgm4_undefine([docs_default])
24775d10e53fSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24785d10e53fSmrgAC_MSG_CHECKING([whether to build documentation])
24795d10e53fSmrgAC_MSG_RESULT([$build_docs])
24805d10e53fSmrg]) # XORG_ENABLE_DOCS
2481ed029a5fSmrg
24825d10e53fSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24835d10e53fSmrg# ----------------
24845d10e53fSmrg# Minimum version: 1.6.0
24855d10e53fSmrg#
24865d10e53fSmrg# This macro enables a builder to skip all developer documentation.
24875d10e53fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24885d10e53fSmrg# maximum flexibility in controlling documentation building.
24895d10e53fSmrg# Refer to:
24905d10e53fSmrg# XORG_WITH_XMLTO         --with-xmlto
24915d10e53fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24925d10e53fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24935d10e53fSmrg# XORG_WITH_FOP           --with-fop
24945d10e53fSmrg# XORG_WITH_GROFF         --with-groff
24955d10e53fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24965d10e53fSmrg#
24975d10e53fSmrg# Interface to module:
24985d10e53fSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24995d10e53fSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
25005d10e53fSmrg#			'no' user instructs the module not to generate developer docs
25015d10e53fSmrg# parm1:		specify the default value, yes or no.
25025d10e53fSmrg#
25035d10e53fSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
25045d10e53fSmrgm4_define([devel_default], m4_default([$1], [yes]))
25055d10e53fSmrgAC_ARG_ENABLE(devel-docs,
25065d10e53fSmrg	AS_HELP_STRING([--enable-devel-docs],
25075d10e53fSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
25085d10e53fSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
25095d10e53fSmrgm4_undefine([devel_default])
25105d10e53fSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
25115d10e53fSmrgAC_MSG_CHECKING([whether to build developer documentation])
25125d10e53fSmrgAC_MSG_RESULT([$build_devel_docs])
25135d10e53fSmrg]) # XORG_ENABLE_DEVEL_DOCS
2514ed029a5fSmrg
25155d10e53fSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
25165d10e53fSmrg# ----------------
25175d10e53fSmrg# Minimum version: 1.6.0
25185d10e53fSmrg#
25195d10e53fSmrg# This macro enables a builder to skip all functional specification targets.
25205d10e53fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
25215d10e53fSmrg# maximum flexibility in controlling documentation building.
25225d10e53fSmrg# Refer to:
25235d10e53fSmrg# XORG_WITH_XMLTO         --with-xmlto
25245d10e53fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
25255d10e53fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
25265d10e53fSmrg# XORG_WITH_FOP           --with-fop
25275d10e53fSmrg# XORG_WITH_GROFF         --with-groff
25285d10e53fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
25295d10e53fSmrg#
25305d10e53fSmrg# Interface to module:
25315d10e53fSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
25325d10e53fSmrg# --enable-specs:	'yes' user instructs the module to generate specs
25335d10e53fSmrg#			'no' user instructs the module not to generate specs
25345d10e53fSmrg# parm1:		specify the default value, yes or no.
25355d10e53fSmrg#
25365d10e53fSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25375d10e53fSmrgm4_define([spec_default], m4_default([$1], [yes]))
25385d10e53fSmrgAC_ARG_ENABLE(specs,
25395d10e53fSmrg	AS_HELP_STRING([--enable-specs],
25405d10e53fSmrg	   [Enable building the specs (default: ]spec_default[)]),
25415d10e53fSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
25425d10e53fSmrgm4_undefine([spec_default])
25435d10e53fSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25445d10e53fSmrgAC_MSG_CHECKING([whether to build functional specifications])
25455d10e53fSmrgAC_MSG_RESULT([$build_specs])
25465d10e53fSmrg]) # XORG_ENABLE_SPECS
2547ed029a5fSmrg
25485d10e53fSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25495d10e53fSmrg# ----------------------------------------------
25505d10e53fSmrg# Minimum version: 1.13.0
25515d10e53fSmrg#
25525d10e53fSmrg# This macro enables a builder to enable/disable unit testing
25535d10e53fSmrg# It makes no assumption about the test cases implementation
25545d10e53fSmrg# Test cases may or may not use Automake "Support for test suites"
25555d10e53fSmrg# They may or may not use the software utility library GLib
25565d10e53fSmrg#
25575d10e53fSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25585d10e53fSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25595d10e53fSmrg# The variable enable_unit_tests is used by other macros in this file.
25605d10e53fSmrg#
25615d10e53fSmrg# Interface to module:
25625d10e53fSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25635d10e53fSmrg# enable_unit_tests:    used in configure.ac for additional configuration
25645d10e53fSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25655d10e53fSmrg#			'no' user instructs the module not to build tests
25665d10e53fSmrg# parm1:		specify the default value, yes or no.
25675d10e53fSmrg#
25685d10e53fSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25695d10e53fSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25705d10e53fSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25715d10e53fSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25725d10e53fSmrgm4_define([_defopt], m4_default([$1], [auto]))
25735d10e53fSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25745d10e53fSmrg	[Enable building unit test cases (default: ]_defopt[)]),
25755d10e53fSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25765d10e53fSmrgm4_undefine([_defopt])
25775d10e53fSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25785d10e53fSmrgAC_MSG_CHECKING([whether to build unit test cases])
25795d10e53fSmrgAC_MSG_RESULT([$enable_unit_tests])
25805d10e53fSmrg]) # XORG_ENABLE_UNIT_TESTS
25817973f115Smrg
25825d10e53fSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25835d10e53fSmrg# ------------------------------------------------------
25845d10e53fSmrg# Minimum version: 1.17.0
25855d10e53fSmrg#
25865d10e53fSmrg# This macro enables a builder to enable/disable integration testing
25875d10e53fSmrg# It makes no assumption about the test cases' implementation
25885d10e53fSmrg# Test cases may or may not use Automake "Support for test suites"
25895d10e53fSmrg#
25905d10e53fSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25915d10e53fSmrg# usually requires less dependencies and may be built and run under less
25925d10e53fSmrg# stringent environments than integration tests.
25935d10e53fSmrg#
25945d10e53fSmrg# Interface to module:
25955d10e53fSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25965d10e53fSmrg# enable_integration_tests:   used in configure.ac for additional configuration
25975d10e53fSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25985d10e53fSmrg#                             'no' user instructs the module not to build tests
25995d10e53fSmrg# parm1:                      specify the default value, yes or no.
26005d10e53fSmrg#
26015d10e53fSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
26025d10e53fSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
26035d10e53fSmrgm4_define([_defopt], m4_default([$1], [auto]))
26045d10e53fSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
26055d10e53fSmrg	[Enable building integration test cases (default: ]_defopt[)]),
26065d10e53fSmrg	[enable_integration_tests=$enableval],
26075d10e53fSmrg	[enable_integration_tests=]_defopt)
26085d10e53fSmrgm4_undefine([_defopt])
26095d10e53fSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
26105d10e53fSmrg	[test "x$enable_integration_tests" != xno])
26115d10e53fSmrgAC_MSG_CHECKING([whether to build unit test cases])
26125d10e53fSmrgAC_MSG_RESULT([$enable_integration_tests])
26135d10e53fSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
26147973f115Smrg
26155d10e53fSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
26165d10e53fSmrg# ----------------------------------------
26175d10e53fSmrg# Minimum version: 1.13.0
26185d10e53fSmrg#
26195d10e53fSmrg# GLib is a library which provides advanced data structures and functions.
26205d10e53fSmrg# This macro enables a module to test for the presence of Glib.
26215d10e53fSmrg#
26225d10e53fSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
26235d10e53fSmrg# Otherwise the value of $enable_unit_tests is blank.
26245d10e53fSmrg#
26255d10e53fSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
26265d10e53fSmrg# test support usually requires less dependencies and may be built and run under
26275d10e53fSmrg# less stringent environments than integration tests.
26285d10e53fSmrg#
26295d10e53fSmrg# Interface to module:
26305d10e53fSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
26315d10e53fSmrg# with_glib: used in configure.ac to know if GLib has been found
26325d10e53fSmrg# --with-glib:	'yes' user instructs the module to use glib
26335d10e53fSmrg#		'no' user instructs the module not to use glib
26345d10e53fSmrg#
26355d10e53fSmrgAC_DEFUN([XORG_WITH_GLIB],[
26365d10e53fSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26375d10e53fSmrgm4_define([_defopt], m4_default([$2], [auto]))
26385d10e53fSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26395d10e53fSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26405d10e53fSmrg	[with_glib=$withval], [with_glib=]_defopt)
26415d10e53fSmrgm4_undefine([_defopt])
26427973f115Smrg
26435d10e53fSmrghave_glib=no
26445d10e53fSmrg# Do not probe GLib if user explicitly disabled unit testing
26455d10e53fSmrgif test "x$enable_unit_tests" != x"no"; then
26465d10e53fSmrg  # Do not probe GLib if user explicitly disabled it
26475d10e53fSmrg  if test "x$with_glib" != x"no"; then
26485d10e53fSmrg    m4_ifval(
26495d10e53fSmrg      [$1],
26505d10e53fSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26515d10e53fSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26525d10e53fSmrg    )
26535d10e53fSmrg  fi
26545d10e53fSmrgfi
26557973f115Smrg
26565d10e53fSmrg# Not having GLib when unit testing has been explicitly requested is an error
26575d10e53fSmrgif test "x$enable_unit_tests" = x"yes"; then
26585d10e53fSmrg  if test "x$have_glib" = x"no"; then
26595d10e53fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26605d10e53fSmrg  fi
26615d10e53fSmrgfi
26627973f115Smrg
26635d10e53fSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
26645d10e53fSmrgif test "x$enable_unit_tests" = x"no"; then
26655d10e53fSmrg  if test "x$with_glib" = x"yes"; then
26665d10e53fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26675d10e53fSmrg  fi
2668ed029a5fSmrgfi
2669dd519f38Smrg
26705d10e53fSmrg# Not having GLib when it has been explicitly requested is an error
26715d10e53fSmrgif test "x$with_glib" = x"yes"; then
26725d10e53fSmrg  if test "x$have_glib" = x"no"; then
26735d10e53fSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26745d10e53fSmrg  fi
26755d10e53fSmrgfi
2676dd519f38Smrg
26775d10e53fSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26785d10e53fSmrg]) # XORG_WITH_GLIB
2679dd519f38Smrg
26805d10e53fSmrg# XORG_LD_WRAP([required|optional])
26815d10e53fSmrg# ---------------------------------
26825d10e53fSmrg# Minimum version: 1.13.0
26835d10e53fSmrg#
26845d10e53fSmrg# Check if linker supports -wrap, passed via compiler flags
26855d10e53fSmrg#
26865d10e53fSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26875d10e53fSmrg# Otherwise the value of $enable_unit_tests is blank.
26885d10e53fSmrg#
26895d10e53fSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26905d10e53fSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26915d10e53fSmrg# available, an argument of "optional" allows use when some unit tests require
26925d10e53fSmrg# ld -wrap and others do not.
26935d10e53fSmrg#
26945d10e53fSmrgAC_DEFUN([XORG_LD_WRAP],[
26955d10e53fSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26965d10e53fSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26975d10e53fSmrg                      void __wrap_exit(int status) { return; }],
26985d10e53fSmrg                     [exit(0);])])
26995d10e53fSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
27005d10e53fSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
27015d10e53fSmrg  if test "x$have_ld_wrap" = x"no"; then
27025d10e53fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
27035d10e53fSmrg  fi
2704ed029a5fSmrgfi
27055d10e53fSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
27065d10e53fSmrg#
27075d10e53fSmrg]) # XORG_LD_WRAP
2708ed029a5fSmrg
27095d10e53fSmrg# XORG_CHECK_LINKER_FLAGS
27105d10e53fSmrg# -----------------------
27115d10e53fSmrg# SYNOPSIS
27125d10e53fSmrg#
27135d10e53fSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
27145d10e53fSmrg#
27155d10e53fSmrg# DESCRIPTION
27165d10e53fSmrg#
27175d10e53fSmrg#   Check whether the given linker FLAGS work with the current language's
27185d10e53fSmrg#   linker, or whether they give an error.
27195d10e53fSmrg#
27205d10e53fSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
27215d10e53fSmrg#   success/failure.
27225d10e53fSmrg#
27235d10e53fSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
27245d10e53fSmrg#
27255d10e53fSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
27265d10e53fSmrg#
27275d10e53fSmrg# LICENSE
27285d10e53fSmrg#
27295d10e53fSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
27305d10e53fSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
27315d10e53fSmrg#   Copyright (c) 2009 Matteo Frigo
27325d10e53fSmrg#
27335d10e53fSmrg#   This program is free software: you can redistribute it and/or modify it
27345d10e53fSmrg#   under the terms of the GNU General Public License as published by the
27355d10e53fSmrg#   Free Software Foundation, either version 3 of the License, or (at your
27365d10e53fSmrg#   option) any later version.
27375d10e53fSmrg#
27385d10e53fSmrg#   This program is distributed in the hope that it will be useful, but
27395d10e53fSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27405d10e53fSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27415d10e53fSmrg#   Public License for more details.
27425d10e53fSmrg#
27435d10e53fSmrg#   You should have received a copy of the GNU General Public License along
27445d10e53fSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27455d10e53fSmrg#
27465d10e53fSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
27475d10e53fSmrg#   gives unlimited permission to copy, distribute and modify the configure
27485d10e53fSmrg#   scripts that are the output of Autoconf when processing the Macro. You
27495d10e53fSmrg#   need not follow the terms of the GNU General Public License when using
27505d10e53fSmrg#   or distributing such scripts, even though portions of the text of the
27515d10e53fSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27525d10e53fSmrg#   all other use of the material that constitutes the Autoconf Macro.
27535d10e53fSmrg#
27545d10e53fSmrg#   This special exception to the GPL applies to versions of the Autoconf
27555d10e53fSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
27565d10e53fSmrg#   modified version of the Autoconf Macro, you may extend this special
27575d10e53fSmrg#   exception to the GPL to apply to your modified version as well.#
27585d10e53fSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27595d10e53fSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
27605d10e53fSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27615d10e53fSmrgAS_LITERAL_IF([$1],
27625d10e53fSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27635d10e53fSmrg      ax_save_FLAGS=$LDFLAGS
27645d10e53fSmrg      LDFLAGS="$1"
27655d10e53fSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27665d10e53fSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27675d10e53fSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27685d10e53fSmrg      LDFLAGS=$ax_save_FLAGS])],
27695d10e53fSmrg  [ax_save_FLAGS=$LDFLAGS
27705d10e53fSmrg   LDFLAGS="$1"
27715d10e53fSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27725d10e53fSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27735d10e53fSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27745d10e53fSmrg   LDFLAGS=$ax_save_FLAGS])
27755d10e53fSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27765d10e53fSmrgAC_MSG_RESULT($xorg_check_linker_flags)
27775d10e53fSmrgif test "x$xorg_check_linker_flags" = xyes; then
27785d10e53fSmrg	m4_default([$2], :)
27795d10e53fSmrgelse
27805d10e53fSmrg	m4_default([$3], :)
27815d10e53fSmrgfi
27825d10e53fSmrg]) # XORG_CHECK_LINKER_FLAGS
2783ed029a5fSmrg
27845d10e53fSmrg# XORG_MEMORY_CHECK_FLAGS
27855d10e53fSmrg# -----------------------
27865d10e53fSmrg# Minimum version: 1.16.0
27877973f115Smrg#
27885d10e53fSmrg# This macro attempts to find appropriate memory checking functionality
27895d10e53fSmrg# for various platforms which unit testing code may use to catch various
27905d10e53fSmrg# forms of memory allocation and access errors in testing.
27915d10e53fSmrg#
27925d10e53fSmrg# Interface to module:
27935d10e53fSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27945d10e53fSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27955d10e53fSmrg#
27965d10e53fSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27975d10e53fSmrg#
27985d10e53fSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2799ed029a5fSmrg
28005d10e53fSmrgAC_REQUIRE([AC_CANONICAL_HOST])
28015d10e53fSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
28025d10e53fSmrg           [Environment variables to enable memory checking in tests])
2803ed029a5fSmrg
28045d10e53fSmrg# Check for different types of support on different platforms
28055d10e53fSmrgcase $host_os in
28065d10e53fSmrg    solaris*)
28075d10e53fSmrg        AC_CHECK_LIB([umem], [umem_alloc],
28085d10e53fSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
28095d10e53fSmrg        ;;
28105d10e53fSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
28115d10e53fSmrg        # both directly and inverted, so should not be 0 or 255.
28125d10e53fSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
28135d10e53fSmrg        ;;
28145d10e53fSmrg    darwin*)
28155d10e53fSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
28165d10e53fSmrg        ;;
28175d10e53fSmrg    *bsd*)
28185d10e53fSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
28195d10e53fSmrg        ;;
28205d10e53fSmrgesac
2821ed029a5fSmrg
28225d10e53fSmrg# User supplied flags override default flags
28235d10e53fSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
28245d10e53fSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
28255d10e53fSmrgfi
2826ed029a5fSmrg
28275d10e53fSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
28285d10e53fSmrg]) # XORG_WITH_LINT
28297973f115Smrg
28305d10e53fSmrg# XORG_CHECK_MALLOC_ZERO
28315d10e53fSmrg# ----------------------
28325d10e53fSmrg# Minimum version: 1.0.0
2833dd519f38Smrg#
28345d10e53fSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28355d10e53fSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28365d10e53fSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28375d10e53fSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28385d10e53fSmrgAC_ARG_ENABLE(malloc0returnsnull,
28395d10e53fSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28405d10e53fSmrg		       [malloc(0) returns NULL (default: auto)]),
28415d10e53fSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28425d10e53fSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2843dd519f38Smrg
28445d10e53fSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28455d10e53fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28465d10e53fSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28475d10e53fSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28485d10e53fSmrg#include <stdlib.h>
28495d10e53fSmrg],[
28505d10e53fSmrg    char *m0, *r0, *c0, *p;
28515d10e53fSmrg    m0 = malloc(0);
28525d10e53fSmrg    p = malloc(10);
28535d10e53fSmrg    r0 = realloc(p,0);
28545d10e53fSmrg    c0 = calloc(0,10);
28555d10e53fSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28565d10e53fSmrg])],
28575d10e53fSmrg		[xorg_cv_malloc0_returns_null=yes],
28585d10e53fSmrg		[xorg_cv_malloc0_returns_null=no])])
28595d10e53fSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28605d10e53fSmrgfi
28615d10e53fSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2862ed029a5fSmrg
28635d10e53fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28645d10e53fSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28655d10e53fSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28665d10e53fSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28675d10e53fSmrgelse
28685d10e53fSmrg	MALLOC_ZERO_CFLAGS=""
28695d10e53fSmrg	XMALLOC_ZERO_CFLAGS=""
28705d10e53fSmrg	XTMALLOC_ZERO_CFLAGS=""
28715d10e53fSmrgfi
2872ed029a5fSmrg
28735d10e53fSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28745d10e53fSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28755d10e53fSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28765d10e53fSmrg]) # XORG_CHECK_MALLOC_ZERO
2877dd519f38Smrg
28785d10e53fSmrg# XORG_WITH_LINT()
28795d10e53fSmrg# ----------------
28805d10e53fSmrg# Minimum version: 1.1.0
2881dd519f38Smrg#
28825d10e53fSmrg# This macro enables the use of a tool that flags some suspicious and
28835d10e53fSmrg# non-portable constructs (likely to be bugs) in C language source code.
28845d10e53fSmrg# It will attempt to locate the tool and use appropriate options.
28855d10e53fSmrg# There are various lint type tools on different platforms.
28865d10e53fSmrg#
28875d10e53fSmrg# Interface to module:
28885d10e53fSmrg# LINT:		returns the path to the tool found on the platform
28895d10e53fSmrg#		or the value set to LINT on the configure cmd line
28905d10e53fSmrg#		also an Automake conditional
28915d10e53fSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
28925d10e53fSmrg#
28935d10e53fSmrg# --with-lint:	'yes' user instructs the module to use lint
28945d10e53fSmrg#		'no' user instructs the module not to use lint (default)
28955d10e53fSmrg#
28965d10e53fSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28975d10e53fSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28985d10e53fSmrg#
28995d10e53fSmrgAC_DEFUN([XORG_WITH_LINT],[
2900ed029a5fSmrg
29015d10e53fSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
29025d10e53fSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
29035d10e53fSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
29045d10e53fSmrg		[Use a lint-style source code checker (default: disabled)])],
29055d10e53fSmrg		[use_lint=$withval], [use_lint=no])
2906ed029a5fSmrg
29075d10e53fSmrg# Obtain platform specific info like program name and options
29085d10e53fSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
29095d10e53fSmrgcase $host_os in
29105d10e53fSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
29115d10e53fSmrg	lint_name=splint
29125d10e53fSmrg	lint_options="-badflag"
29135d10e53fSmrg	;;
29145d10e53fSmrg  *freebsd* | *netbsd*)
29155d10e53fSmrg	lint_name=lint
29165d10e53fSmrg	lint_options="-u -b"
29175d10e53fSmrg	;;
29185d10e53fSmrg  *solaris*)
29195d10e53fSmrg	lint_name=lint
29205d10e53fSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
29215d10e53fSmrg	;;
29225d10e53fSmrgesac
2923ed029a5fSmrg
29245d10e53fSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
29255d10e53fSmrgif test "x$use_lint" = x"yes" ; then
29265d10e53fSmrg   AC_PATH_PROG([LINT], [$lint_name])
29275d10e53fSmrg   if test "x$LINT" = "x"; then
29285d10e53fSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
29295d10e53fSmrg   fi
29305d10e53fSmrgelif test "x$use_lint" = x"no" ; then
29315d10e53fSmrg   if test "x$LINT" != "x"; then
29325d10e53fSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
29335d10e53fSmrg   fi
29347973f115Smrgelse
29355d10e53fSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
29367973f115Smrgfi
2937ed029a5fSmrg
29385d10e53fSmrg# User supplied flags override default flags
29395d10e53fSmrgif test "x$LINT_FLAGS" != "x"; then
29405d10e53fSmrg   lint_options=$LINT_FLAGS
29415d10e53fSmrgfi
2942ed029a5fSmrg
29435d10e53fSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29445d10e53fSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
29457973f115Smrg
29465d10e53fSmrg]) # XORG_WITH_LINT
29477973f115Smrg
29485d10e53fSmrg# XORG_LINT_LIBRARY(LIBNAME)
29495d10e53fSmrg# --------------------------
29505d10e53fSmrg# Minimum version: 1.1.0
2951dd519f38Smrg#
29525d10e53fSmrg# Sets up flags for building lint libraries for checking programs that call
29535d10e53fSmrg# functions in the library.
29545d10e53fSmrg#
29555d10e53fSmrg# Interface to module:
29565d10e53fSmrg# LINTLIB		- Automake variable with the name of lint library file to make
29575d10e53fSmrg# MAKE_LINT_LIB		- Automake conditional
29585d10e53fSmrg#
29595d10e53fSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29605d10e53fSmrg#			  - 'no' user instructs the module not to create a lint library (default)
29617973f115Smrg
29625d10e53fSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29635d10e53fSmrgAC_REQUIRE([XORG_WITH_LINT])
29645d10e53fSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29655d10e53fSmrg	[Create lint library (default: disabled)])],
29665d10e53fSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2967dd519f38Smrg
29685d10e53fSmrgif test "x$make_lint_lib" = x"yes" ; then
29695d10e53fSmrg   LINTLIB=llib-l$1.ln
29705d10e53fSmrg   if test "x$LINT" = "x"; then
29715d10e53fSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29725d10e53fSmrg   fi
29735d10e53fSmrgelif test "x$make_lint_lib" != x"no" ; then
29745d10e53fSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29755d10e53fSmrgfi
2976ed029a5fSmrg
29775d10e53fSmrgAC_SUBST(LINTLIB)
29785d10e53fSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2979dd519f38Smrg
29805d10e53fSmrg]) # XORG_LINT_LIBRARY
2981dd519f38Smrg
29825d10e53fSmrg# XORG_COMPILER_BRAND
29835d10e53fSmrg# -------------------
29845d10e53fSmrg# Minimum version: 1.14.0
29855d10e53fSmrg#
29865d10e53fSmrg# Checks for various brands of compilers and sets flags as appropriate:
29875d10e53fSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29885d10e53fSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29895d10e53fSmrg#   clang compiler - sets CLANGCC to "yes"
29905d10e53fSmrg#   Intel compiler - sets INTELCC to "yes"
29915d10e53fSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29925d10e53fSmrg#
29935d10e53fSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29945d10e53fSmrgAC_LANG_CASE(
29955d10e53fSmrg	[C], [
29965d10e53fSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29975d10e53fSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
29985d10e53fSmrg		m4_version_prereq([2.70],
29995d10e53fSmrg			[AC_REQUIRE([AC_PROG_CC])],
30005d10e53fSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30015d10e53fSmrg	],
30025d10e53fSmrg	[C++], [
30035d10e53fSmrg		AC_REQUIRE([AC_PROG_CXX])
30045d10e53fSmrg	]
30055d10e53fSmrg)
30065d10e53fSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
30075d10e53fSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
30085d10e53fSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
30095d10e53fSmrg]) # XORG_COMPILER_BRAND
3010ed029a5fSmrg
30115d10e53fSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
30125d10e53fSmrg# ---------------
30135d10e53fSmrg# Minimum version: 1.16.0
30145d10e53fSmrg#
30155d10e53fSmrg# Test if the compiler works when passed the given flag as a command line argument.
30165d10e53fSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
30175d10e53fSmrg# next flag in the list until there are no more options.
30185d10e53fSmrg#
30195d10e53fSmrg# Note that this does not guarantee that the compiler supports the flag as some
30205d10e53fSmrg# compilers will simply ignore arguments that they do not understand, but we do
30215d10e53fSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
30225d10e53fSmrg# -Werror=unused-command-line-argument
30235d10e53fSmrg#
30245d10e53fSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
30255d10e53fSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
30265d10e53fSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
30275d10e53fSmrg
30285d10e53fSmrgAC_LANG_COMPILER_REQUIRE
30295d10e53fSmrg
30305d10e53fSmrgAC_LANG_CASE(
30315d10e53fSmrg	[C], [
30325d10e53fSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
30335d10e53fSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
30345d10e53fSmrg		m4_version_prereq([2.70],
30355d10e53fSmrg			[AC_REQUIRE([AC_PROG_CC])],
30365d10e53fSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30375d10e53fSmrg		define([PREFIX], [C])
30385d10e53fSmrg		define([CACHE_PREFIX], [cc])
30395d10e53fSmrg		define([COMPILER], [$CC])
30405d10e53fSmrg	],
30415d10e53fSmrg	[C++], [
30425d10e53fSmrg		define([PREFIX], [CXX])
30435d10e53fSmrg		define([CACHE_PREFIX], [cxx])
30445d10e53fSmrg		define([COMPILER], [$CXX])
30455d10e53fSmrg	]
30465d10e53fSmrg)
3047ed029a5fSmrg
30485d10e53fSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30495d10e53fSmrg
30505d10e53fSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30515d10e53fSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30525d10e53fSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30535d10e53fSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30545d10e53fSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30555d10e53fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30565d10e53fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30575d10e53fSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30585d10e53fSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30595d10e53fSmrgfi
30607973f115Smrg
30615d10e53fSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30625d10e53fSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30635d10e53fSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30645d10e53fSmrg	fi
30655d10e53fSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30665d10e53fSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30675d10e53fSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30685d10e53fSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30695d10e53fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30705d10e53fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30715d10e53fSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30725d10e53fSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30735d10e53fSmrgfi
30747973f115Smrg
30755d10e53fSmrgfound="no"
30765d10e53fSmrgm4_foreach([flag], m4_cdr($@), [
30775d10e53fSmrg	if test $found = "no" ; then
30785d10e53fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30795d10e53fSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30805d10e53fSmrg		fi
30815d10e53fSmrg
30825d10e53fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30835d10e53fSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30845d10e53fSmrg		fi
30855d10e53fSmrg
30865d10e53fSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30875d10e53fSmrg
30885d10e53fSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30895d10e53fSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30905d10e53fSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30915d10e53fSmrg		AC_CACHE_VAL($cacheid,
30925d10e53fSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30935d10e53fSmrg					     [eval $cacheid=yes],
30945d10e53fSmrg					     [eval $cacheid=no])])
30955d10e53fSmrg
30965d10e53fSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30975d10e53fSmrg
30985d10e53fSmrg		eval supported=\$$cacheid
30995d10e53fSmrg		AC_MSG_RESULT([$supported])
31005d10e53fSmrg		if test "$supported" = "yes" ; then
31015d10e53fSmrg			$1="$$1 ]flag["
31025d10e53fSmrg			found="yes"
31035d10e53fSmrg		fi
31045d10e53fSmrg	fi
31055d10e53fSmrg])
31065d10e53fSmrg]) # XORG_TESTSET_CFLAG
31077973f115Smrg
31085d10e53fSmrg# XORG_COMPILER_FLAGS
31095d10e53fSmrg# ---------------
31105d10e53fSmrg# Minimum version: 1.16.0
31115d10e53fSmrg#
31125d10e53fSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
31135d10e53fSmrg# arguments supported by the selected compiler which do NOT alter the generated
31145d10e53fSmrg# code.  These arguments will cause the compiler to print various warnings
31155d10e53fSmrg# during compilation AND turn a conservative set of warnings into errors.
31165d10e53fSmrg#
31175d10e53fSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
31185d10e53fSmrg# future versions of util-macros as options are added to new compilers.
31195d10e53fSmrg#
31205d10e53fSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
31215d10e53fSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31225d10e53fSmrg
31235d10e53fSmrgAC_ARG_ENABLE(selective-werror,
31245d10e53fSmrg              AS_HELP_STRING([--disable-selective-werror],
31255d10e53fSmrg                             [Turn off selective compiler errors. (default: enabled)]),
31265d10e53fSmrg              [SELECTIVE_WERROR=$enableval],
31275d10e53fSmrg              [SELECTIVE_WERROR=yes])
31285d10e53fSmrg
31295d10e53fSmrgAC_LANG_CASE(
31305d10e53fSmrg        [C], [
31315d10e53fSmrg                define([PREFIX], [C])
31325d10e53fSmrg        ],
31335d10e53fSmrg        [C++], [
31345d10e53fSmrg                define([PREFIX], [CXX])
31355d10e53fSmrg        ]
31365d10e53fSmrg)
31375d10e53fSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
31385d10e53fSmrgif test "x$SUNCC" = "xyes"; then
31395d10e53fSmrg    [BASE_]PREFIX[FLAGS]="-v"
31407973f115Smrgelse
31415d10e53fSmrg    [BASE_]PREFIX[FLAGS]=""
3142ed029a5fSmrgfi
3143ed029a5fSmrg
31445d10e53fSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31455d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31465d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31475d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31485d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31495d10e53fSmrg
31505d10e53fSmrgAC_LANG_CASE(
31515d10e53fSmrg	[C], [
31525d10e53fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31535d10e53fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31545d10e53fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31555d10e53fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31565d10e53fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31575d10e53fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31585d10e53fSmrg	]
31595d10e53fSmrg)
3160ed029a5fSmrg
31615d10e53fSmrg# This chunk adds additional warnings that could catch undesired effects.
31625d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31635d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31645d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31655d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31665d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31675d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31685d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
31695d10e53fSmrg
31705d10e53fSmrg# These are currently disabled because they are noisy.  They will be enabled
31715d10e53fSmrg# in the future once the codebase is sufficiently modernized to silence
31725d10e53fSmrg# them.  For now, I don't want them to drown out the other warnings.
31735d10e53fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31745d10e53fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31755d10e53fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
31765d10e53fSmrg
31775d10e53fSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
31785d10e53fSmrg# when there are problems that should be fixed.
31795d10e53fSmrg
31805d10e53fSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31815d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31825d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31835d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31845d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31855d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31865d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31875d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31885d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31895d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31905d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31915d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31925d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31935d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31945d10e53fSmrgelse
31955d10e53fSmrgAC_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])
31965d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31975d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31985d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31995d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
32005d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
32015d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
32025d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
32035d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
32045d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
32055d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
32065d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
32075d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
32085d10e53fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
32095d10e53fSmrgfi
3210ed029a5fSmrg
32115d10e53fSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32125d10e53fSmrg]) # XORG_COMPILER_FLAGS
3213ed029a5fSmrg
32145d10e53fSmrg# XORG_CWARNFLAGS
32155d10e53fSmrg# ---------------
32165d10e53fSmrg# Minimum version: 1.2.0
32175d10e53fSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
32187973f115Smrg#
32195d10e53fSmrg# Defines CWARNFLAGS to enable C compiler warnings.
32205d10e53fSmrg#
32215d10e53fSmrg# This function is deprecated because it defines -fno-strict-aliasing
32225d10e53fSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
32235d10e53fSmrg# is needed, then it should be added explicitly in the module when
32245d10e53fSmrg# it is updated to use BASE_CFLAGS.
32255d10e53fSmrg#
32265d10e53fSmrgAC_DEFUN([XORG_CWARNFLAGS], [
32275d10e53fSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32285d10e53fSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
32295d10e53fSmrgAC_LANG_CASE(
32305d10e53fSmrg	[C], [
32315d10e53fSmrg		CWARNFLAGS="$BASE_CFLAGS"
32325d10e53fSmrg		if  test "x$GCC" = xyes ; then
32335d10e53fSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
32345d10e53fSmrg		fi
32355d10e53fSmrg		AC_SUBST(CWARNFLAGS)
32365d10e53fSmrg	]
32375d10e53fSmrg)
32385d10e53fSmrg]) # XORG_CWARNFLAGS
3239ed029a5fSmrg
32405d10e53fSmrg# XORG_STRICT_OPTION
32415d10e53fSmrg# -----------------------
32425d10e53fSmrg# Minimum version: 1.3.0
3243ed029a5fSmrg#
32445d10e53fSmrg# Add configure option to enable strict compilation flags, such as treating
32455d10e53fSmrg# warnings as fatal errors.
32465d10e53fSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32475d10e53fSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32485d10e53fSmrg#
32495d10e53fSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32505d10e53fSmrg# when strict compilation is unconditionally desired.
32515d10e53fSmrgAC_DEFUN([XORG_STRICT_OPTION], [
32525d10e53fSmrgAC_REQUIRE([XORG_CWARNFLAGS])
32535d10e53fSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32545d10e53fSmrg
32555d10e53fSmrgAC_ARG_ENABLE(strict-compilation,
32565d10e53fSmrg			  AS_HELP_STRING([--enable-strict-compilation],
32575d10e53fSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32585d10e53fSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3259ed029a5fSmrg
32605d10e53fSmrgAC_LANG_CASE(
32615d10e53fSmrg        [C], [
32625d10e53fSmrg                define([PREFIX], [C])
32635d10e53fSmrg        ],
32645d10e53fSmrg        [C++], [
32655d10e53fSmrg                define([PREFIX], [CXX])
32665d10e53fSmrg        ]
32675d10e53fSmrg)
3268ed029a5fSmrg
32695d10e53fSmrg[STRICT_]PREFIX[FLAGS]=""
32705d10e53fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32715d10e53fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3272ed029a5fSmrg
32735d10e53fSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32745d10e53fSmrg# activate it with -Werror, so we add it here explicitly.
32755d10e53fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3276ed029a5fSmrg
32775d10e53fSmrgif test "x$STRICT_COMPILE" = "xyes"; then
32785d10e53fSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32795d10e53fSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32805d10e53fSmrgfi
32815d10e53fSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32825d10e53fSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32835d10e53fSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32845d10e53fSmrg]) # XORG_STRICT_OPTION
3285ed029a5fSmrg
32865d10e53fSmrg# XORG_DEFAULT_NOCODE_OPTIONS
32875d10e53fSmrg# ---------------------------
32885d10e53fSmrg# Minimum version: 1.20.0
32897973f115Smrg#
32905d10e53fSmrg# Defines default options for X.Org modules which don't compile code,
32915d10e53fSmrg# such as fonts, bitmaps, cursors, and docs.
32925d10e53fSmrg#
32935d10e53fSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
32945d10e53fSmrgAC_REQUIRE([AC_PROG_INSTALL])
32955d10e53fSmrgXORG_RELEASE_VERSION
32965d10e53fSmrgXORG_CHANGELOG
32975d10e53fSmrgXORG_INSTALL
32985d10e53fSmrgXORG_MANPAGE_SECTIONS
32995d10e53fSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
33005d10e53fSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
33015d10e53fSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3302ed029a5fSmrg
33035d10e53fSmrg# XORG_DEFAULT_OPTIONS
33047973f115Smrg# --------------------
33055d10e53fSmrg# Minimum version: 1.3.0
33067973f115Smrg#
33075d10e53fSmrg# Defines default options for X.Org modules which compile code.
33087973f115Smrg#
33095d10e53fSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
33105d10e53fSmrgAC_REQUIRE([AC_PROG_INSTALL])
33115d10e53fSmrgXORG_COMPILER_FLAGS
33125d10e53fSmrgXORG_CWARNFLAGS
33135d10e53fSmrgXORG_STRICT_OPTION
33145d10e53fSmrgXORG_DEFAULT_NOCODE_OPTIONS
33155d10e53fSmrg]) # XORG_DEFAULT_OPTIONS
33165d10e53fSmrg
33175d10e53fSmrg# XORG_INSTALL()
33185d10e53fSmrg# ----------------
33195d10e53fSmrg# Minimum version: 1.4.0
33205d10e53fSmrg#
33215d10e53fSmrg# Defines the variable INSTALL_CMD as the command to copy
33225d10e53fSmrg# INSTALL from $prefix/share/util-macros.
33235d10e53fSmrg#
33245d10e53fSmrgAC_DEFUN([XORG_INSTALL], [
33255d10e53fSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
33265d10e53fSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
33275d10e53fSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
33285d10e53fSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
33295d10e53fSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
33305d10e53fSmrgtouch \$(top_srcdir)/INSTALL; \
33315d10e53fSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
33325d10e53fSmrgAC_SUBST([INSTALL_CMD])
33335d10e53fSmrg]) # XORG_INSTALL
33345d10e53fSmrgdnl Copyright 2005 Red Hat, Inc
33355d10e53fSmrgdnl
33365d10e53fSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
33375d10e53fSmrgdnl documentation for any purpose is hereby granted without fee, provided that
33385d10e53fSmrgdnl the above copyright notice appear in all copies and that both that
33395d10e53fSmrgdnl copyright notice and this permission notice appear in supporting
33405d10e53fSmrgdnl documentation.
33415d10e53fSmrgdnl
33425d10e53fSmrgdnl The above copyright notice and this permission notice shall be included
33435d10e53fSmrgdnl in all copies or substantial portions of the Software.
33445d10e53fSmrgdnl
33455d10e53fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33465d10e53fSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33475d10e53fSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33485d10e53fSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
33495d10e53fSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33505d10e53fSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33515d10e53fSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
33525d10e53fSmrgdnl
33535d10e53fSmrgdnl Except as contained in this notice, the name of the copyright holders shall
33545d10e53fSmrgdnl not be used in advertising or otherwise to promote the sale, use or
33555d10e53fSmrgdnl other dealings in this Software without prior written authorization
33565d10e53fSmrgdnl from the copyright holders.
33575d10e53fSmrgdnl
3358ed029a5fSmrg
33595d10e53fSmrg# XORG_RELEASE_VERSION
33605d10e53fSmrg# --------------------
33615d10e53fSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3362ed029a5fSmrg
33635d10e53fSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33645d10e53fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33655d10e53fSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33665d10e53fSmrg		[Major version of this package])
33675d10e53fSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33685d10e53fSmrg	if test "x$PVM" = "x"; then
33695d10e53fSmrg		PVM="0"
33705d10e53fSmrg	fi
33715d10e53fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33725d10e53fSmrg		[$PVM],
33735d10e53fSmrg		[Minor version of this package])
33745d10e53fSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33755d10e53fSmrg	if test "x$PVP" = "x"; then
33765d10e53fSmrg		PVP="0"
33775d10e53fSmrg	fi
33785d10e53fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33795d10e53fSmrg		[$PVP],
33805d10e53fSmrg		[Patch version of this package])
33815d10e53fSmrg])
3382ed029a5fSmrg
33835d10e53fSmrg# XORG_CHANGELOG()
33845d10e53fSmrg# ----------------
33855d10e53fSmrg# Minimum version: 1.2.0
33865d10e53fSmrg#
33875d10e53fSmrg# Defines the variable CHANGELOG_CMD as the command to generate
33885d10e53fSmrg# ChangeLog from git.
33895d10e53fSmrg#
33905d10e53fSmrg#
33915d10e53fSmrgAC_DEFUN([XORG_CHANGELOG], [
33925d10e53fSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33935d10e53fSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33945d10e53fSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33955d10e53fSmrgtouch \$(top_srcdir)/ChangeLog; \
33965d10e53fSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33975d10e53fSmrgAC_SUBST([CHANGELOG_CMD])
33985d10e53fSmrg]) # XORG_CHANGELOG
3399ed029a5fSmrg
3400