16728f30eSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
274a3f230Smrg
374b97a6cSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4b3307321Smrg
5b3307321Smrg# This file is free software; the Free Software Foundation
6b3307321Smrg# gives unlimited permission to copy and/or distribute it,
7b3307321Smrg# with or without modifications, as long as this notice is preserved.
8b3307321Smrg
9b3307321Smrg# This program is distributed in the hope that it will be useful,
10b3307321Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11b3307321Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12b3307321Smrg# PARTICULAR PURPOSE.
13b3307321Smrg
1474a3f230Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15afe13c8eSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16afe13c8eSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1774b97a6cSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
1874b97a6cSmrg[m4_warning([this file was generated for autoconf 2.71.
19afe13c8eSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20afe13c8eSmrgIf you have problems, you may need to regenerate the build system entirely.
2174a3f230SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22b3307321Smrg
2374b97a6cSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2474b97a6cSmrg#
2574b97a6cSmrg# This file is free software; the Free Software Foundation
2674b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
2774b97a6cSmrg# with or without modifications, as long as this notice is preserved.
2806ef0fecSmrg
2974b97a6cSmrg# AM_AUTOMAKE_VERSION(VERSION)
3074b97a6cSmrg# ----------------------------
3174b97a6cSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3274b97a6cSmrg# generated from the m4 files accompanying Automake X.Y.
3374b97a6cSmrg# (This private macro should not be called outside this file.)
3474b97a6cSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3574b97a6cSmrg[am__api_version='1.16'
3674b97a6cSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3774b97a6cSmrgdnl require some minimum version.  Point them to the right macro.
386728f30eSmrgm4_if([$1], [1.16.5], [],
3974b97a6cSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4074b97a6cSmrg])
4106ef0fecSmrg
4274b97a6cSmrg# _AM_AUTOCONF_VERSION(VERSION)
4374b97a6cSmrg# -----------------------------
4474b97a6cSmrg# aclocal traces this macro to find the Autoconf version.
4574b97a6cSmrg# This is a private macro too.  Using m4_define simplifies
4674b97a6cSmrg# the logic in aclocal, which can simply ignore this definition.
4774b97a6cSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48b3307321Smrg
4974b97a6cSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5074b97a6cSmrg# -------------------------------
5174b97a6cSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5274b97a6cSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5374b97a6cSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
546728f30eSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5574b97a6cSmrgm4_ifndef([AC_AUTOCONF_VERSION],
5674b97a6cSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5774b97a6cSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58b3307321Smrg
5974b97a6cSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60b3307321Smrg
6174b97a6cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6274b97a6cSmrg#
6374b97a6cSmrg# This file is free software; the Free Software Foundation
6474b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
6574b97a6cSmrg# with or without modifications, as long as this notice is preserved.
66b3307321Smrg
6774b97a6cSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6874b97a6cSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6974b97a6cSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7074b97a6cSmrg#
7174b97a6cSmrg# Of course, Automake must honor this variable whenever it calls a
7274b97a6cSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7374b97a6cSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7474b97a6cSmrg# depending on how configure is run.  This is pretty annoying, since
7574b97a6cSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7674b97a6cSmrg# source directory, any form will work fine, but in subdirectories a
7774b97a6cSmrg# relative path needs to be adjusted first.
7874b97a6cSmrg#
7974b97a6cSmrg# $ac_aux_dir/missing
8074b97a6cSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8174b97a6cSmrg# $top_srcdir/$ac_aux_dir/missing
8274b97a6cSmrg#    fails if $ac_aux_dir is absolute,
8374b97a6cSmrg#    fails when called from a subdirectory in a VPATH build with
8474b97a6cSmrg#          a relative $ac_aux_dir
8574b97a6cSmrg#
8674b97a6cSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8774b97a6cSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
8874b97a6cSmrg# harmless because $srcdir is '.', but things will broke when you
8974b97a6cSmrg# start a VPATH build or use an absolute $srcdir.
9074b97a6cSmrg#
9174b97a6cSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9274b97a6cSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9374b97a6cSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9474b97a6cSmrg# and then we would define $MISSING as
9574b97a6cSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9674b97a6cSmrg# This will work as long as MISSING is not called from configure, because
9774b97a6cSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9874b97a6cSmrg# However there are other variables, like CC, which are often used in
9974b97a6cSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10074b97a6cSmrg#
10174b97a6cSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10274b97a6cSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10374b97a6cSmrg# configured tree to be moved without reconfiguration.
104b3307321Smrg
10574b97a6cSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10674b97a6cSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10774b97a6cSmrg# Expand $ac_aux_dir to an absolute path.
10874b97a6cSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10974b97a6cSmrg])
110b3307321Smrg
11174b97a6cSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112b3307321Smrg
11374b97a6cSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11474b97a6cSmrg#
11574b97a6cSmrg# This file is free software; the Free Software Foundation
11674b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
11774b97a6cSmrg# with or without modifications, as long as this notice is preserved.
118b3307321Smrg
11974b97a6cSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12074b97a6cSmrg# -------------------------------------
12174b97a6cSmrg# Define a conditional.
12274b97a6cSmrgAC_DEFUN([AM_CONDITIONAL],
12374b97a6cSmrg[AC_PREREQ([2.52])dnl
12474b97a6cSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12574b97a6cSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12674b97a6cSmrgAC_SUBST([$1_TRUE])dnl
12774b97a6cSmrgAC_SUBST([$1_FALSE])dnl
12874b97a6cSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12974b97a6cSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13074b97a6cSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13174b97a6cSmrgif $2; then
13274b97a6cSmrg  $1_TRUE=
13374b97a6cSmrg  $1_FALSE='#'
13474b97a6cSmrgelse
13574b97a6cSmrg  $1_TRUE='#'
13674b97a6cSmrg  $1_FALSE=
13774b97a6cSmrgfi
13874b97a6cSmrgAC_CONFIG_COMMANDS_PRE(
13974b97a6cSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14074b97a6cSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14174b97a6cSmrgUsually this means the macro was only invoked conditionally.]])
14274b97a6cSmrgfi])])
143b3307321Smrg
14474b97a6cSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14574b97a6cSmrg#
14674b97a6cSmrg# This file is free software; the Free Software Foundation
14774b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
14874b97a6cSmrg# with or without modifications, as long as this notice is preserved.
149b3307321Smrg
150b3307321Smrg
15174b97a6cSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15274b97a6cSmrg# written in clear, in which case automake, when reading aclocal.m4,
15374b97a6cSmrg# will think it sees a *use*, and therefore will trigger all it's
15474b97a6cSmrg# C support machinery.  Also note that it means that autoscan, seeing
15574b97a6cSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156b3307321Smrg
157b3307321Smrg
15874b97a6cSmrg# _AM_DEPENDENCIES(NAME)
15974b97a6cSmrg# ----------------------
16074b97a6cSmrg# See how the compiler implements dependency checking.
16174b97a6cSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16274b97a6cSmrg# We try a few techniques and use that to set a single cache variable.
16374b97a6cSmrg#
16474b97a6cSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16574b97a6cSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16674b97a6cSmrg# dependency, and given that the user is not expected to run this macro,
16774b97a6cSmrg# just rely on AC_PROG_CC.
16874b97a6cSmrgAC_DEFUN([_AM_DEPENDENCIES],
16974b97a6cSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17074b97a6cSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17174b97a6cSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17274b97a6cSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173b3307321Smrg
17474b97a6cSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17574b97a6cSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17674b97a6cSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17774b97a6cSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17874b97a6cSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17974b97a6cSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18074b97a6cSmrg                    [depcc="$$1"   am_compiler_list=])
181b3307321Smrg
18274b97a6cSmrgAC_CACHE_CHECK([dependency style of $depcc],
18374b97a6cSmrg               [am_cv_$1_dependencies_compiler_type],
18474b97a6cSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18574b97a6cSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
18674b97a6cSmrg  # making bogus files that we don't know about and never remove.  For
18774b97a6cSmrg  # instance it was reported that on HP-UX the gcc test will end up
18874b97a6cSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18974b97a6cSmrg  # in D".
19074b97a6cSmrg  rm -rf conftest.dir
19174b97a6cSmrg  mkdir conftest.dir
19274b97a6cSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19374b97a6cSmrg  # using a relative directory.
19474b97a6cSmrg  cp "$am_depcomp" conftest.dir
19574b97a6cSmrg  cd conftest.dir
19674b97a6cSmrg  # We will build objects and dependencies in a subdirectory because
19774b97a6cSmrg  # it helps to detect inapplicable dependency modes.  For instance
19874b97a6cSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19974b97a6cSmrg  # side effect of compilation, but ICC will put the dependencies in
20074b97a6cSmrg  # the current directory while Tru64 will put them in the object
20174b97a6cSmrg  # directory.
20274b97a6cSmrg  mkdir sub
203b3307321Smrg
20474b97a6cSmrg  am_cv_$1_dependencies_compiler_type=none
20574b97a6cSmrg  if test "$am_compiler_list" = ""; then
20674b97a6cSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20774b97a6cSmrg  fi
20874b97a6cSmrg  am__universal=false
20974b97a6cSmrg  m4_case([$1], [CC],
21074b97a6cSmrg    [case " $depcc " in #(
21174b97a6cSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21274b97a6cSmrg     esac],
21374b97a6cSmrg    [CXX],
21474b97a6cSmrg    [case " $depcc " in #(
21574b97a6cSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21674b97a6cSmrg     esac])
217b3307321Smrg
21874b97a6cSmrg  for depmode in $am_compiler_list; do
21974b97a6cSmrg    # Setup a source with many dependencies, because some compilers
22074b97a6cSmrg    # like to wrap large dependency lists on column 80 (with \), and
22174b97a6cSmrg    # we should not choose a depcomp mode which is confused by this.
22274b97a6cSmrg    #
22374b97a6cSmrg    # We need to recreate these files for each test, as the compiler may
22474b97a6cSmrg    # overwrite some of them when testing with obscure command lines.
22574b97a6cSmrg    # This happens at least with the AIX C compiler.
22674b97a6cSmrg    : > sub/conftest.c
22774b97a6cSmrg    for i in 1 2 3 4 5 6; do
22874b97a6cSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22974b97a6cSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23074b97a6cSmrg      # Solaris 10 /bin/sh.
23174b97a6cSmrg      echo '/* dummy */' > sub/conftst$i.h
23274b97a6cSmrg    done
23374b97a6cSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2345e358ecaSmrg
23574b97a6cSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23674b97a6cSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23774b97a6cSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23874b97a6cSmrg    # versions had trouble with output in subdirs.
23974b97a6cSmrg    am__obj=sub/conftest.${OBJEXT-o}
24074b97a6cSmrg    am__minus_obj="-o $am__obj"
24174b97a6cSmrg    case $depmode in
24274b97a6cSmrg    gcc)
24374b97a6cSmrg      # This depmode causes a compiler race in universal mode.
24474b97a6cSmrg      test "$am__universal" = false || continue
24574b97a6cSmrg      ;;
24674b97a6cSmrg    nosideeffect)
24774b97a6cSmrg      # After this tag, mechanisms are not by side-effect, so they'll
24874b97a6cSmrg      # only be used when explicitly requested.
24974b97a6cSmrg      if test "x$enable_dependency_tracking" = xyes; then
25074b97a6cSmrg	continue
25174b97a6cSmrg      else
25274b97a6cSmrg	break
25374b97a6cSmrg      fi
25474b97a6cSmrg      ;;
25574b97a6cSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25674b97a6cSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
25774b97a6cSmrg      # not run yet.  These depmodes are late enough in the game, and
25874b97a6cSmrg      # so weak that their functioning should not be impacted.
25974b97a6cSmrg      am__obj=conftest.${OBJEXT-o}
26074b97a6cSmrg      am__minus_obj=
26174b97a6cSmrg      ;;
26274b97a6cSmrg    none) break ;;
26374b97a6cSmrg    esac
26474b97a6cSmrg    if depmode=$depmode \
26574b97a6cSmrg       source=sub/conftest.c object=$am__obj \
26674b97a6cSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26774b97a6cSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26874b97a6cSmrg         >/dev/null 2>conftest.err &&
26974b97a6cSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27074b97a6cSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27174b97a6cSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27274b97a6cSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27374b97a6cSmrg      # icc doesn't choke on unknown options, it will just issue warnings
27474b97a6cSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
27574b97a6cSmrg      # that says an option was ignored or not supported.
27674b97a6cSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27774b97a6cSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27874b97a6cSmrg      # The diagnosis changed in icc 8.0:
27974b97a6cSmrg      #   icc: Command line remark: option '-MP' not supported
28074b97a6cSmrg      if (grep 'ignoring option' conftest.err ||
28174b97a6cSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28274b97a6cSmrg        am_cv_$1_dependencies_compiler_type=$depmode
28374b97a6cSmrg        break
28474b97a6cSmrg      fi
28574b97a6cSmrg    fi
28674b97a6cSmrg  done
2875e358ecaSmrg
28874b97a6cSmrg  cd ..
28974b97a6cSmrg  rm -rf conftest.dir
29074b97a6cSmrgelse
29174b97a6cSmrg  am_cv_$1_dependencies_compiler_type=none
29274b97a6cSmrgfi
29374b97a6cSmrg])
29474b97a6cSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29574b97a6cSmrgAM_CONDITIONAL([am__fastdep$1], [
29674b97a6cSmrg  test "x$enable_dependency_tracking" != xno \
29774b97a6cSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29874b97a6cSmrg])
2995e358ecaSmrg
30006ef0fecSmrg
30174b97a6cSmrg# AM_SET_DEPDIR
30274b97a6cSmrg# -------------
30374b97a6cSmrg# Choose a directory name for dependency files.
30474b97a6cSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30574b97a6cSmrgAC_DEFUN([AM_SET_DEPDIR],
30674b97a6cSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30774b97a6cSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30874b97a6cSmrg])
30906ef0fecSmrg
31006ef0fecSmrg
31174b97a6cSmrg# AM_DEP_TRACK
31274b97a6cSmrg# ------------
31374b97a6cSmrgAC_DEFUN([AM_DEP_TRACK],
31474b97a6cSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31574b97a6cSmrgAS_HELP_STRING(
31674b97a6cSmrg  [--enable-dependency-tracking],
31774b97a6cSmrg  [do not reject slow dependency extractors])
31874b97a6cSmrgAS_HELP_STRING(
31974b97a6cSmrg  [--disable-dependency-tracking],
32074b97a6cSmrg  [speeds up one-time build])])
32174b97a6cSmrgif test "x$enable_dependency_tracking" != xno; then
32274b97a6cSmrg  am_depcomp="$ac_aux_dir/depcomp"
32374b97a6cSmrg  AMDEPBACKSLASH='\'
32474b97a6cSmrg  am__nodep='_no'
32574b97a6cSmrgfi
32674b97a6cSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32774b97a6cSmrgAC_SUBST([AMDEPBACKSLASH])dnl
32874b97a6cSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32974b97a6cSmrgAC_SUBST([am__nodep])dnl
33074b97a6cSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33174b97a6cSmrg])
33206ef0fecSmrg
33374b97a6cSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33406ef0fecSmrg
33574b97a6cSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
33606ef0fecSmrg#
33774b97a6cSmrg# This file is free software; the Free Software Foundation
33874b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
33974b97a6cSmrg# with or without modifications, as long as this notice is preserved.
34006ef0fecSmrg
34174b97a6cSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34274b97a6cSmrg# ------------------------------
34374b97a6cSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34474b97a6cSmrg[{
34574b97a6cSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
34674b97a6cSmrg  # are listed without --file.  Let's play safe and only enable the eval
34774b97a6cSmrg  # if we detect the quoting.
34874b97a6cSmrg  # TODO: see whether this extra hack can be removed once we start
34974b97a6cSmrg  # requiring Autoconf 2.70 or later.
35074b97a6cSmrg  AS_CASE([$CONFIG_FILES],
35174b97a6cSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
35274b97a6cSmrg          [*], [set x $CONFIG_FILES])
35374b97a6cSmrg  shift
35474b97a6cSmrg  # Used to flag and report bootstrapping failures.
35574b97a6cSmrg  am_rc=0
35674b97a6cSmrg  for am_mf
35774b97a6cSmrg  do
35874b97a6cSmrg    # Strip MF so we end up with the name of the file.
35974b97a6cSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36074b97a6cSmrg    # Check whether this is an Automake generated Makefile which includes
36174b97a6cSmrg    # dependency-tracking related rules and includes.
36274b97a6cSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36374b97a6cSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
36474b97a6cSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36574b97a6cSmrg      || continue
36674b97a6cSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36774b97a6cSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36874b97a6cSmrg    AM_RUN_LOG([cd "$am_dirpart" \
36974b97a6cSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37074b97a6cSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37174b97a6cSmrg  done
37274b97a6cSmrg  if test $am_rc -ne 0; then
37374b97a6cSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37474b97a6cSmrg    for automatic dependency tracking.  If GNU make was not used, consider
37574b97a6cSmrg    re-running the configure script with MAKE="gmake" (or whatever is
37674b97a6cSmrg    necessary).  You can also try re-running configure with the
37774b97a6cSmrg    '--disable-dependency-tracking' option to at least be able to build
37874b97a6cSmrg    the package (albeit without support for automatic dependency tracking).])
37974b97a6cSmrg  fi
38074b97a6cSmrg  AS_UNSET([am_dirpart])
38174b97a6cSmrg  AS_UNSET([am_filepart])
38274b97a6cSmrg  AS_UNSET([am_mf])
38374b97a6cSmrg  AS_UNSET([am_rc])
38474b97a6cSmrg  rm -f conftest-deps.mk
38574b97a6cSmrg}
38674b97a6cSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387b3307321Smrg
3885e358ecaSmrg
38974b97a6cSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39074b97a6cSmrg# -----------------------------
39174b97a6cSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
39206ef0fecSmrg#
39374b97a6cSmrg# This code is only required when automatic dependency tracking is enabled.
39474b97a6cSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39574b97a6cSmrg# order to bootstrap the dependency handling code.
39674b97a6cSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39774b97a6cSmrg[AC_CONFIG_COMMANDS([depfiles],
39874b97a6cSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39974b97a6cSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4005e358ecaSmrg
40174b97a6cSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4025e358ecaSmrg
40374b97a6cSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40474b97a6cSmrg#
40574b97a6cSmrg# This file is free software; the Free Software Foundation
40674b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
40774b97a6cSmrg# with or without modifications, as long as this notice is preserved.
408b3307321Smrg
40974b97a6cSmrg# This macro actually does too much.  Some checks are only needed if
41074b97a6cSmrg# your package does certain things.  But this isn't really a big deal.
4115e358ecaSmrg
41274b97a6cSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41374b97a6cSmrgm4_define([AC_PROG_CC],
41474b97a6cSmrgm4_defn([AC_PROG_CC])
41574b97a6cSmrg[_AM_PROG_CC_C_O
41674b97a6cSmrg])
417b3307321Smrg
41874b97a6cSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41974b97a6cSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42074b97a6cSmrg# -----------------------------------------------
42174b97a6cSmrg# The call with PACKAGE and VERSION arguments is the old style
42274b97a6cSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42374b97a6cSmrg# and VERSION should now be passed to AC_INIT and removed from
42474b97a6cSmrg# the call to AM_INIT_AUTOMAKE.
42574b97a6cSmrg# We support both call styles for the transition.  After
42674b97a6cSmrg# the next Automake release, Autoconf can make the AC_INIT
42774b97a6cSmrg# arguments mandatory, and then we can depend on a new Autoconf
42874b97a6cSmrg# release and drop the old call support.
42974b97a6cSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43074b97a6cSmrg[AC_PREREQ([2.65])dnl
4316728f30eSmrgm4_ifdef([_$0_ALREADY_INIT],
4326728f30eSmrg  [m4_fatal([$0 expanded multiple times
4336728f30eSmrg]m4_defn([_$0_ALREADY_INIT]))],
4346728f30eSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43574b97a6cSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43674b97a6cSmrgdnl the ones we care about.
43774b97a6cSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43874b97a6cSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43974b97a6cSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44074b97a6cSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44174b97a6cSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44274b97a6cSmrg  # is not polluted with repeated "-I."
44374b97a6cSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44474b97a6cSmrg  # test to see if srcdir already configured
44574b97a6cSmrg  if test -f $srcdir/config.status; then
44674b97a6cSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44774b97a6cSmrg  fi
44806ef0fecSmrgfi
449b3307321Smrg
45074b97a6cSmrg# test whether we have cygpath
45174b97a6cSmrgif test -z "$CYGPATH_W"; then
45274b97a6cSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45374b97a6cSmrg    CYGPATH_W='cygpath -w'
45474b97a6cSmrg  else
45574b97a6cSmrg    CYGPATH_W=echo
45674b97a6cSmrg  fi
45706ef0fecSmrgfi
45874b97a6cSmrgAC_SUBST([CYGPATH_W])
45906ef0fecSmrg
46074b97a6cSmrg# Define the identity of the package.
46174b97a6cSmrgdnl Distinguish between old-style and new-style calls.
46274b97a6cSmrgm4_ifval([$2],
46374b97a6cSmrg[AC_DIAGNOSE([obsolete],
46474b97a6cSmrg             [$0: two- and three-arguments forms are deprecated.])
46574b97a6cSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46674b97a6cSmrg AC_SUBST([PACKAGE], [$1])dnl
46774b97a6cSmrg AC_SUBST([VERSION], [$2])],
46874b97a6cSmrg[_AM_SET_OPTIONS([$1])dnl
46974b97a6cSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47074b97a6cSmrgm4_if(
47174b97a6cSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47274b97a6cSmrg  [ok:ok],,
47374b97a6cSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47474b97a6cSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47574b97a6cSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476b3307321Smrg
47774b97a6cSmrg_AM_IF_OPTION([no-define],,
47874b97a6cSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47974b97a6cSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480b3307321Smrg
48174b97a6cSmrg# Some tools Automake needs.
48274b97a6cSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48374b97a6cSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48474b97a6cSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48574b97a6cSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48674b97a6cSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48774b97a6cSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48874b97a6cSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48974b97a6cSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49074b97a6cSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49174b97a6cSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49274b97a6cSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
49374b97a6cSmrg# dies out for good.  For more background, see:
49474b97a6cSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49574b97a6cSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49674b97a6cSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49774b97a6cSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
49874b97a6cSmrg# system "awk" is bad on some platforms.
49974b97a6cSmrgAC_REQUIRE([AC_PROG_AWK])dnl
50074b97a6cSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50174b97a6cSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50274b97a6cSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50374b97a6cSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50474b97a6cSmrg			     [_AM_PROG_TAR([v7])])])
50574b97a6cSmrg_AM_IF_OPTION([no-dependencies],,
50674b97a6cSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50774b97a6cSmrg		  [_AM_DEPENDENCIES([CC])],
50874b97a6cSmrg		  [m4_define([AC_PROG_CC],
50974b97a6cSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51074b97a6cSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51174b97a6cSmrg		  [_AM_DEPENDENCIES([CXX])],
51274b97a6cSmrg		  [m4_define([AC_PROG_CXX],
51374b97a6cSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51474b97a6cSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51574b97a6cSmrg		  [_AM_DEPENDENCIES([OBJC])],
51674b97a6cSmrg		  [m4_define([AC_PROG_OBJC],
51774b97a6cSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51874b97a6cSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51974b97a6cSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
52074b97a6cSmrg		  [m4_define([AC_PROG_OBJCXX],
52174b97a6cSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52274b97a6cSmrg])
52374b97a6cSmrg# Variables for tags utilities; see am/tags.am
52474b97a6cSmrgif test -z "$CTAGS"; then
52574b97a6cSmrg  CTAGS=ctags
52674b97a6cSmrgfi
52774b97a6cSmrgAC_SUBST([CTAGS])
52874b97a6cSmrgif test -z "$ETAGS"; then
52974b97a6cSmrg  ETAGS=etags
53074b97a6cSmrgfi
53174b97a6cSmrgAC_SUBST([ETAGS])
53274b97a6cSmrgif test -z "$CSCOPE"; then
53374b97a6cSmrg  CSCOPE=cscope
53474b97a6cSmrgfi
53574b97a6cSmrgAC_SUBST([CSCOPE])
53606ef0fecSmrg
53774b97a6cSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53874b97a6cSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
53974b97a6cSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54074b97a6cSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54174b97a6cSmrgAC_CONFIG_COMMANDS_PRE(dnl
54274b97a6cSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54374b97a6cSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
54406ef0fecSmrg
54574b97a6cSmrg# POSIX will say in a future version that running "rm -f" with no argument
54674b97a6cSmrg# is OK; and we want to be able to make that assumption in our Makefile
54774b97a6cSmrg# recipes.  So use an aggressive probe to check that the usage we want is
54874b97a6cSmrg# actually supported "in the wild" to an acceptable degree.
54974b97a6cSmrg# See automake bug#10828.
55074b97a6cSmrg# To make any issue more visible, cause the running configure to be aborted
55174b97a6cSmrg# by default if the 'rm' program in use doesn't match our expectations; the
55274b97a6cSmrg# user can still override this though.
55374b97a6cSmrgif rm -f && rm -fr && rm -rf; then : OK; else
55474b97a6cSmrg  cat >&2 <<'END'
55574b97a6cSmrgOops!
556b3307321Smrg
55774b97a6cSmrgYour 'rm' program seems unable to run without file operands specified
55874b97a6cSmrgon the command line, even when the '-f' option is present.  This is contrary
55974b97a6cSmrgto the behaviour of most rm programs out there, and not conforming with
56074b97a6cSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5615e358ecaSmrg
56274b97a6cSmrgPlease tell bug-automake@gnu.org about your system, including the value
56374b97a6cSmrgof your $PATH and any error possibly output before this message.  This
56474b97a6cSmrgcan help us improve future automake versions.
56506ef0fecSmrg
56674b97a6cSmrgEND
56774b97a6cSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56874b97a6cSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56974b97a6cSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57074b97a6cSmrg    echo >&2
57174b97a6cSmrg  else
57274b97a6cSmrg    cat >&2 <<'END'
57374b97a6cSmrgAborting the configuration process, to ensure you take notice of the issue.
5745e358ecaSmrg
57574b97a6cSmrgYou can download and install GNU coreutils to get an 'rm' implementation
57674b97a6cSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
5775e358ecaSmrg
57874b97a6cSmrgIf you want to complete the configuration process using your problematic
57974b97a6cSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58074b97a6cSmrgto "yes", and re-run configure.
58174a3f230Smrg
58274b97a6cSmrgEND
58374b97a6cSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58474b97a6cSmrg  fi
585afe13c8eSmrgfi
58674b97a6cSmrgdnl The trailing newline in this macro's definition is deliberate, for
58774b97a6cSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58874b97a6cSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58974b97a6cSmrg])
5905e358ecaSmrg
59174b97a6cSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59274b97a6cSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59374b97a6cSmrgdnl mangled by Autoconf and run in a shell conditional statement.
59474b97a6cSmrgm4_define([_AC_COMPILER_EXEEXT],
59574b97a6cSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
59606ef0fecSmrg
59774b97a6cSmrg# When config.status generates a header, we must update the stamp-h file.
59874b97a6cSmrg# This file resides in the same directory as the config header
59974b97a6cSmrg# that is generated.  The stamp files are numbered to have different names.
60006ef0fecSmrg
60174b97a6cSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60274b97a6cSmrg# loop where config.status creates the headers, so we can generate
60374b97a6cSmrg# our stamp files there.
60474b97a6cSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60574b97a6cSmrg[# Compute $1's index in $config_headers.
60674b97a6cSmrg_am_arg=$1
60774b97a6cSmrg_am_stamp_count=1
60874b97a6cSmrgfor _am_header in $config_headers :; do
60974b97a6cSmrg  case $_am_header in
61074b97a6cSmrg    $_am_arg | $_am_arg:* )
61174b97a6cSmrg      break ;;
61274b97a6cSmrg    * )
61374b97a6cSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61474b97a6cSmrg  esac
61574b97a6cSmrgdone
61674b97a6cSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
61706ef0fecSmrg
61874b97a6cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61974b97a6cSmrg#
62074b97a6cSmrg# This file is free software; the Free Software Foundation
62174b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
62274b97a6cSmrg# with or without modifications, as long as this notice is preserved.
62374b97a6cSmrg
62474b97a6cSmrg# AM_PROG_INSTALL_SH
62574b97a6cSmrg# ------------------
62674b97a6cSmrg# Define $install_sh.
62774b97a6cSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62874b97a6cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62974b97a6cSmrgif test x"${install_sh+set}" != xset; then
63074b97a6cSmrg  case $am_aux_dir in
63174b97a6cSmrg  *\ * | *\	*)
63274b97a6cSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63374b97a6cSmrg  *)
63474b97a6cSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63574b97a6cSmrg  esac
63674b97a6cSmrgfi
63774b97a6cSmrgAC_SUBST([install_sh])])
63874b97a6cSmrg
63974b97a6cSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64074b97a6cSmrg#
64174b97a6cSmrg# This file is free software; the Free Software Foundation
64274b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
64374b97a6cSmrg# with or without modifications, as long as this notice is preserved.
64474b97a6cSmrg
64574b97a6cSmrg# Check whether the underlying file-system supports filenames
64674b97a6cSmrg# with a leading dot.  For instance MS-DOS doesn't.
64774b97a6cSmrgAC_DEFUN([AM_SET_LEADING_DOT],
64874b97a6cSmrg[rm -rf .tst 2>/dev/null
64974b97a6cSmrgmkdir .tst 2>/dev/null
65074b97a6cSmrgif test -d .tst; then
65174b97a6cSmrg  am__leading_dot=.
65206ef0fecSmrgelse
65374b97a6cSmrg  am__leading_dot=_
654b3307321Smrgfi
65574b97a6cSmrgrmdir .tst 2>/dev/null
65674b97a6cSmrgAC_SUBST([am__leading_dot])])
657b3307321Smrg
65874b97a6cSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659b3307321Smrg
66074b97a6cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66174b97a6cSmrg#
66274b97a6cSmrg# This file is free software; the Free Software Foundation
66374b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
66474b97a6cSmrg# with or without modifications, as long as this notice is preserved.
665b3307321Smrg
66674b97a6cSmrg# AM_MAKE_INCLUDE()
66774b97a6cSmrg# -----------------
66874b97a6cSmrg# Check whether make has an 'include' directive that can support all
66974b97a6cSmrg# the idioms we need for our automatic dependency tracking code.
67074b97a6cSmrgAC_DEFUN([AM_MAKE_INCLUDE],
67174b97a6cSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
67274b97a6cSmrgcat > confinc.mk << 'END'
67374b97a6cSmrgam__doit:
67474b97a6cSmrg	@echo this is the am__doit target >confinc.out
67574b97a6cSmrg.PHONY: am__doit
67674b97a6cSmrgEND
67774b97a6cSmrgam__include="#"
67874b97a6cSmrgam__quote=
67974b97a6cSmrg# BSD make does it like this.
68074b97a6cSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
68174b97a6cSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
68274b97a6cSmrgecho 'include confinc.mk # ignored' > confmf.GNU
68374b97a6cSmrg_am_result=no
68474b97a6cSmrgfor s in GNU BSD; do
68574b97a6cSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
68674b97a6cSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
68774b97a6cSmrg      ['0:this is the am__doit target'],
68874b97a6cSmrg      [AS_CASE([$s],
68974b97a6cSmrg          [BSD], [am__include='.include' am__quote='"'],
69074b97a6cSmrg          [am__include='include' am__quote=''])])
69174b97a6cSmrg  if test "$am__include" != "#"; then
69274b97a6cSmrg    _am_result="yes ($s style)"
69374b97a6cSmrg    break
69474b97a6cSmrg  fi
69574b97a6cSmrgdone
69674b97a6cSmrgrm -f confinc.* confmf.*
69774b97a6cSmrgAC_MSG_RESULT([${_am_result}])
69874b97a6cSmrgAC_SUBST([am__include])])
69974b97a6cSmrgAC_SUBST([am__quote])])
700b3307321Smrg
70174b97a6cSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
70274a3f230Smrg
70374b97a6cSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
70406ef0fecSmrg#
70574b97a6cSmrg# This file is free software; the Free Software Foundation
70674b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
70774b97a6cSmrg# with or without modifications, as long as this notice is preserved.
70874a3f230Smrg
70974b97a6cSmrg# AM_MISSING_PROG(NAME, PROGRAM)
71074b97a6cSmrg# ------------------------------
71174b97a6cSmrgAC_DEFUN([AM_MISSING_PROG],
71274b97a6cSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71374b97a6cSmrg$1=${$1-"${am_missing_run}$2"}
71474b97a6cSmrgAC_SUBST($1)])
71574a3f230Smrg
71674b97a6cSmrg# AM_MISSING_HAS_RUN
71774b97a6cSmrg# ------------------
71874b97a6cSmrg# Define MISSING if not defined so far and test if it is modern enough.
71974b97a6cSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72074b97a6cSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72174b97a6cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72274b97a6cSmrgAC_REQUIRE_AUX_FILE([missing])dnl
72374b97a6cSmrgif test x"${MISSING+set}" != xset; then
72474b97a6cSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
72506ef0fecSmrgfi
72674b97a6cSmrg# Use eval to expand $SHELL
72774b97a6cSmrgif eval "$MISSING --is-lightweight"; then
72874b97a6cSmrg  am_missing_run="$MISSING "
72974b97a6cSmrgelse
73074b97a6cSmrg  am_missing_run=
73174b97a6cSmrg  AC_MSG_WARN(['missing' script is too old or missing])
73206ef0fecSmrgfi
73374b97a6cSmrg])
73474a3f230Smrg
73574b97a6cSmrg# Helper functions for option handling.                     -*- Autoconf -*-
73674a3f230Smrg
73774b97a6cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73874b97a6cSmrg#
73974b97a6cSmrg# This file is free software; the Free Software Foundation
74074b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
74174b97a6cSmrg# with or without modifications, as long as this notice is preserved.
742b3307321Smrg
74374b97a6cSmrg# _AM_MANGLE_OPTION(NAME)
74474b97a6cSmrg# -----------------------
74574b97a6cSmrgAC_DEFUN([_AM_MANGLE_OPTION],
74674b97a6cSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7475e358ecaSmrg
74874b97a6cSmrg# _AM_SET_OPTION(NAME)
74974b97a6cSmrg# --------------------
75074b97a6cSmrg# Set option NAME.  Presently that only means defining a flag for this option.
75174b97a6cSmrgAC_DEFUN([_AM_SET_OPTION],
75274b97a6cSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7535e358ecaSmrg
75474b97a6cSmrg# _AM_SET_OPTIONS(OPTIONS)
75574b97a6cSmrg# ------------------------
75674b97a6cSmrg# OPTIONS is a space-separated list of Automake options.
75774b97a6cSmrgAC_DEFUN([_AM_SET_OPTIONS],
75874b97a6cSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75974b97a6cSmrg
76074b97a6cSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76174b97a6cSmrg# -------------------------------------------
76274b97a6cSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76374b97a6cSmrgAC_DEFUN([_AM_IF_OPTION],
76474b97a6cSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76574b97a6cSmrg
76674b97a6cSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
76706ef0fecSmrg#
76874b97a6cSmrg# This file is free software; the Free Software Foundation
76974b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
77074b97a6cSmrg# with or without modifications, as long as this notice is preserved.
771b3307321Smrg
77274b97a6cSmrg# _AM_PROG_CC_C_O
77374b97a6cSmrg# ---------------
77474b97a6cSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77574b97a6cSmrg# to automatically call this.
77674b97a6cSmrgAC_DEFUN([_AM_PROG_CC_C_O],
77774b97a6cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77874b97a6cSmrgAC_REQUIRE_AUX_FILE([compile])dnl
77974b97a6cSmrgAC_LANG_PUSH([C])dnl
78074b97a6cSmrgAC_CACHE_CHECK(
78174b97a6cSmrg  [whether $CC understands -c and -o together],
78274b97a6cSmrg  [am_cv_prog_cc_c_o],
78374b97a6cSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78474b97a6cSmrg  # Make sure it works both with $CC and with simple cc.
78574b97a6cSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78674b97a6cSmrg  # compilers refuse to overwrite an existing .o file with -o,
78774b97a6cSmrg  # though they will create one.
78874b97a6cSmrg  am_cv_prog_cc_c_o=yes
78974b97a6cSmrg  for am_i in 1 2; do
79074b97a6cSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79174b97a6cSmrg         && test -f conftest2.$ac_objext; then
79274b97a6cSmrg      : OK
79374b97a6cSmrg    else
79474b97a6cSmrg      am_cv_prog_cc_c_o=no
79574b97a6cSmrg      break
79674b97a6cSmrg    fi
79774b97a6cSmrg  done
79874b97a6cSmrg  rm -f core conftest*
79974b97a6cSmrg  unset am_i])
80074b97a6cSmrgif test "$am_cv_prog_cc_c_o" != yes; then
80174b97a6cSmrg   # Losing compiler, so override with the script.
80274b97a6cSmrg   # FIXME: It is wrong to rewrite CC.
80374b97a6cSmrg   # But if we don't then we get into trouble of one sort or another.
80474b97a6cSmrg   # A longer-term fix would be to have automake use am__CC in this case,
80574b97a6cSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80674b97a6cSmrg   CC="$am_aux_dir/compile $CC"
807b3307321Smrgfi
80874b97a6cSmrgAC_LANG_POP([C])])
809b3307321Smrg
81074b97a6cSmrg# For backward compatibility.
81174b97a6cSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812b3307321Smrg
81374b97a6cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
8145e358ecaSmrg#
81574b97a6cSmrg# This file is free software; the Free Software Foundation
81674b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
81774b97a6cSmrg# with or without modifications, as long as this notice is preserved.
818afe13c8eSmrg
81974b97a6cSmrg# AM_RUN_LOG(COMMAND)
82074b97a6cSmrg# -------------------
82174b97a6cSmrg# Run COMMAND, save the exit status in ac_status, and log it.
82274b97a6cSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82374b97a6cSmrgAC_DEFUN([AM_RUN_LOG],
82474b97a6cSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82574b97a6cSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82674b97a6cSmrg   ac_status=$?
82774b97a6cSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82874b97a6cSmrg   (exit $ac_status); }])
82974b97a6cSmrg
83074b97a6cSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83174b97a6cSmrg
83274b97a6cSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8335e358ecaSmrg#
83474b97a6cSmrg# This file is free software; the Free Software Foundation
83574b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
83674b97a6cSmrg# with or without modifications, as long as this notice is preserved.
837b3307321Smrg
83874b97a6cSmrg# AM_SANITY_CHECK
83974b97a6cSmrg# ---------------
84074b97a6cSmrgAC_DEFUN([AM_SANITY_CHECK],
84174b97a6cSmrg[AC_MSG_CHECKING([whether build environment is sane])
84274b97a6cSmrg# Reject unsafe characters in $srcdir or the absolute working directory
84374b97a6cSmrg# name.  Accept space and tab only in the latter.
84474b97a6cSmrgam_lf='
84574b97a6cSmrg'
84674b97a6cSmrgcase `pwd` in
84774b97a6cSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84874b97a6cSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84974b97a6cSmrgesac
85074b97a6cSmrgcase $srcdir in
85174b97a6cSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85274b97a6cSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85374b97a6cSmrgesac
85474b97a6cSmrg
85574b97a6cSmrg# Do 'set' in a subshell so we don't clobber the current shell's
85674b97a6cSmrg# arguments.  Must try -L first in case configure is actually a
85774b97a6cSmrg# symlink; some systems play weird games with the mod time of symlinks
85874b97a6cSmrg# (eg FreeBSD returns the mod time of the symlink's containing
85974b97a6cSmrg# directory).
86074b97a6cSmrgif (
86174b97a6cSmrg   am_has_slept=no
86274b97a6cSmrg   for am_try in 1 2; do
86374b97a6cSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86474b97a6cSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86574b97a6cSmrg     if test "$[*]" = "X"; then
86674b97a6cSmrg	# -L didn't work.
86774b97a6cSmrg	set X `ls -t "$srcdir/configure" conftest.file`
86874b97a6cSmrg     fi
86974b97a6cSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87074b97a6cSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87174b97a6cSmrg
87274b97a6cSmrg	# If neither matched, then we have a broken ls.  This can happen
87374b97a6cSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87474b97a6cSmrg	# broken ls alias from the environment.  This has actually
87574b97a6cSmrg	# happened.  Such a system could not be considered "sane".
87674b97a6cSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87774b97a6cSmrg  alias in your environment])
87874b97a6cSmrg     fi
87974b97a6cSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88074b97a6cSmrg       break
88174b97a6cSmrg     fi
88274b97a6cSmrg     # Just in case.
88374b97a6cSmrg     sleep 1
88474b97a6cSmrg     am_has_slept=yes
88574b97a6cSmrg   done
88674b97a6cSmrg   test "$[2]" = conftest.file
88774b97a6cSmrg   )
88874b97a6cSmrgthen
88974b97a6cSmrg   # Ok.
89074b97a6cSmrg   :
891afe13c8eSmrgelse
89274b97a6cSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
89374b97a6cSmrgCheck your system clock])
894afe13c8eSmrgfi
89574b97a6cSmrgAC_MSG_RESULT([yes])
89674b97a6cSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89774b97a6cSmrg# generated files are strictly newer.
89874b97a6cSmrgam_sleep_pid=
89974b97a6cSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90074b97a6cSmrg  ( sleep 1 ) &
90174b97a6cSmrg  am_sleep_pid=$!
90274b97a6cSmrgfi
90374b97a6cSmrgAC_CONFIG_COMMANDS_PRE(
90474b97a6cSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90574b97a6cSmrg   if test -n "$am_sleep_pid"; then
90674b97a6cSmrg     # Hide warnings about reused PIDs.
90774b97a6cSmrg     wait $am_sleep_pid 2>/dev/null
90874b97a6cSmrg   fi
90974b97a6cSmrg   AC_MSG_RESULT([done])])
91074b97a6cSmrgrm -f conftest.file
91174b97a6cSmrg])
912b3307321Smrg
91374b97a6cSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
91406ef0fecSmrg#
91574b97a6cSmrg# This file is free software; the Free Software Foundation
91674b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
91774b97a6cSmrg# with or without modifications, as long as this notice is preserved.
9185e358ecaSmrg
91974b97a6cSmrg# AM_SILENT_RULES([DEFAULT])
92074b97a6cSmrg# --------------------------
92174b97a6cSmrg# Enable less verbose build rules; with the default set to DEFAULT
92274b97a6cSmrg# ("yes" being less verbose, "no" or empty being verbose).
92374b97a6cSmrgAC_DEFUN([AM_SILENT_RULES],
92474b97a6cSmrg[AC_ARG_ENABLE([silent-rules], [dnl
92574b97a6cSmrgAS_HELP_STRING(
92674b97a6cSmrg  [--enable-silent-rules],
92774b97a6cSmrg  [less verbose build output (undo: "make V=1")])
92874b97a6cSmrgAS_HELP_STRING(
92974b97a6cSmrg  [--disable-silent-rules],
93074b97a6cSmrg  [verbose build output (undo: "make V=0")])dnl
93174b97a6cSmrg])
93274b97a6cSmrgcase $enable_silent_rules in @%:@ (((
93374b97a6cSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
93474b97a6cSmrg   no) AM_DEFAULT_VERBOSITY=1;;
93574b97a6cSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93674b97a6cSmrgesac
93774b97a6cSmrgdnl
93874b97a6cSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93974b97a6cSmrgdnl do not support nested variable expansions.
94074b97a6cSmrgdnl See automake bug#9928 and bug#10237.
94174b97a6cSmrgam_make=${MAKE-make}
94274b97a6cSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94374b97a6cSmrg   [am_cv_make_support_nested_variables],
94474b97a6cSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94574b97a6cSmrgBAR0=false
94674b97a6cSmrgBAR1=true
94774b97a6cSmrgV=1
94874b97a6cSmrgam__doit:
94974b97a6cSmrg	@$(TRUE)
95074b97a6cSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95174b97a6cSmrg  am_cv_make_support_nested_variables=yes
95206ef0fecSmrgelse
95374b97a6cSmrg  am_cv_make_support_nested_variables=no
95474b97a6cSmrgfi])
95574b97a6cSmrgif test $am_cv_make_support_nested_variables = yes; then
95674b97a6cSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95774b97a6cSmrg  AM_V='$(V)'
95874b97a6cSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95974b97a6cSmrgelse
96074b97a6cSmrg  AM_V=$AM_DEFAULT_VERBOSITY
96174b97a6cSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
96274a3f230Smrgfi
96374b97a6cSmrgAC_SUBST([AM_V])dnl
96474b97a6cSmrgAM_SUBST_NOTMAKE([AM_V])dnl
96574b97a6cSmrgAC_SUBST([AM_DEFAULT_V])dnl
96674b97a6cSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96774b97a6cSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96874b97a6cSmrgAM_BACKSLASH='\'
96974b97a6cSmrgAC_SUBST([AM_BACKSLASH])dnl
97074b97a6cSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97174b97a6cSmrg])
97274a3f230Smrg
97374b97a6cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
97406ef0fecSmrg#
97574b97a6cSmrg# This file is free software; the Free Software Foundation
97674b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
97774b97a6cSmrg# with or without modifications, as long as this notice is preserved.
97874a3f230Smrg
97974b97a6cSmrg# AM_PROG_INSTALL_STRIP
98074b97a6cSmrg# ---------------------
98174b97a6cSmrg# One issue with vendor 'install' (even GNU) is that you can't
98274b97a6cSmrg# specify the program used to strip binaries.  This is especially
98374b97a6cSmrg# annoying in cross-compiling environments, where the build's strip
98474b97a6cSmrg# is unlikely to handle the host's binaries.
98574b97a6cSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98674b97a6cSmrg# always use install-sh in "make install-strip", and initialize
98774b97a6cSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
98874b97a6cSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98974b97a6cSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99074b97a6cSmrg# Installed binaries are usually stripped using 'strip' when the user
99174b97a6cSmrg# run "make install-strip".  However 'strip' might not be the right
99274b97a6cSmrg# tool to use in cross-compilation environments, therefore Automake
99374b97a6cSmrg# will honor the 'STRIP' environment variable to overrule this program.
99474b97a6cSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99574b97a6cSmrgif test "$cross_compiling" != no; then
99674b97a6cSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
99774a3f230Smrgfi
99874b97a6cSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99974b97a6cSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10005e358ecaSmrg
100174b97a6cSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
100206ef0fecSmrg#
100374b97a6cSmrg# This file is free software; the Free Software Foundation
100474b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
100574b97a6cSmrg# with or without modifications, as long as this notice is preserved.
1006b3307321Smrg
100774b97a6cSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
100874b97a6cSmrg# ---------------------------
100974b97a6cSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101074b97a6cSmrg# This macro is traced by Automake.
101174b97a6cSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101206ef0fecSmrg
101374b97a6cSmrg# AM_SUBST_NOTMAKE(VARIABLE)
101474b97a6cSmrg# --------------------------
101574b97a6cSmrg# Public sister of _AM_SUBST_NOTMAKE.
101674b97a6cSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017afe13c8eSmrg
101874b97a6cSmrg# Check how to create a tarball.                            -*- Autoconf -*-
101906ef0fecSmrg
102074b97a6cSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
102106ef0fecSmrg#
102274b97a6cSmrg# This file is free software; the Free Software Foundation
102374b97a6cSmrg# gives unlimited permission to copy and/or distribute it,
102474b97a6cSmrg# with or without modifications, as long as this notice is preserved.
102574b97a6cSmrg
102674b97a6cSmrg# _AM_PROG_TAR(FORMAT)
102774b97a6cSmrg# --------------------
102874b97a6cSmrg# Check how to create a tarball in format FORMAT.
102974b97a6cSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
103006ef0fecSmrg#
103174b97a6cSmrg# Substitute a variable $(am__tar) that is a command
103274b97a6cSmrg# writing to stdout a FORMAT-tarball containing the directory
103374b97a6cSmrg# $tardir.
103474b97a6cSmrg#     tardir=directory && $(am__tar) > result.tar
103506ef0fecSmrg#
103674b97a6cSmrg# Substitute a variable $(am__untar) that extract such
103774b97a6cSmrg# a tarball read from stdin.
103874b97a6cSmrg#     $(am__untar) < result.tar
103906ef0fecSmrg#
104074b97a6cSmrgAC_DEFUN([_AM_PROG_TAR],
104174b97a6cSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104274b97a6cSmrg# in the wild :-(  We should find a proper way to deprecate it ...
104374b97a6cSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10445e358ecaSmrg
104574b97a6cSmrg# We'll loop over all known methods to create a tar archive until one works.
104674b97a6cSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047afe13c8eSmrg
104874b97a6cSmrgm4_if([$1], [v7],
104974b97a6cSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050afe13c8eSmrg
105174b97a6cSmrg  [m4_case([$1],
105274b97a6cSmrg    [ustar],
105374b97a6cSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105474b97a6cSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105574b97a6cSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105674b97a6cSmrg      # and bug#13588).
105774b97a6cSmrg      am_max_uid=2097151 # 2^21 - 1
105874b97a6cSmrg      am_max_gid=$am_max_uid
105974b97a6cSmrg      # The $UID and $GID variables are not portable, so we need to resort
106074b97a6cSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106174b97a6cSmrg      # below are definitely unexpected, so allow the users to see them
106274b97a6cSmrg      # (that is, avoid stderr redirection).
106374b97a6cSmrg      am_uid=`id -u || echo unknown`
106474b97a6cSmrg      am_gid=`id -g || echo unknown`
106574b97a6cSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106674b97a6cSmrg      if test $am_uid -le $am_max_uid; then
106774b97a6cSmrg         AC_MSG_RESULT([yes])
106874b97a6cSmrg      else
106974b97a6cSmrg         AC_MSG_RESULT([no])
107074b97a6cSmrg         _am_tools=none
107174b97a6cSmrg      fi
107274b97a6cSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107374b97a6cSmrg      if test $am_gid -le $am_max_gid; then
107474b97a6cSmrg         AC_MSG_RESULT([yes])
107574b97a6cSmrg      else
107674b97a6cSmrg        AC_MSG_RESULT([no])
107774b97a6cSmrg        _am_tools=none
107874b97a6cSmrg      fi],
1079320e696bSmrg
108074b97a6cSmrg  [pax],
108174b97a6cSmrg    [],
1082320e696bSmrg
108374b97a6cSmrg  [m4_fatal([Unknown tar format])])
1084320e696bSmrg
108574b97a6cSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086320e696bSmrg
108774b97a6cSmrg  # Go ahead even if we have the value already cached.  We do so because we
108874b97a6cSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108974b97a6cSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090320e696bSmrg
109174b97a6cSmrg  for _am_tool in $_am_tools; do
109274b97a6cSmrg    case $_am_tool in
109374b97a6cSmrg    gnutar)
109474b97a6cSmrg      for _am_tar in tar gnutar gtar; do
109574b97a6cSmrg        AM_RUN_LOG([$_am_tar --version]) && break
109674b97a6cSmrg      done
109774b97a6cSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109874b97a6cSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109974b97a6cSmrg      am__untar="$_am_tar -xf -"
110074b97a6cSmrg      ;;
110174b97a6cSmrg    plaintar)
110274b97a6cSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110374b97a6cSmrg      # ustar tarball either.
110474b97a6cSmrg      (tar --version) >/dev/null 2>&1 && continue
110574b97a6cSmrg      am__tar='tar chf - "$$tardir"'
110674b97a6cSmrg      am__tar_='tar chf - "$tardir"'
110774b97a6cSmrg      am__untar='tar xf -'
110874b97a6cSmrg      ;;
110974b97a6cSmrg    pax)
111074b97a6cSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
111174b97a6cSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
111274b97a6cSmrg      am__untar='pax -r'
111374b97a6cSmrg      ;;
111474b97a6cSmrg    cpio)
111574b97a6cSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111674b97a6cSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111774b97a6cSmrg      am__untar='cpio -i -H $1 -d'
111874b97a6cSmrg      ;;
111974b97a6cSmrg    none)
112074b97a6cSmrg      am__tar=false
112174b97a6cSmrg      am__tar_=false
112274b97a6cSmrg      am__untar=false
112374b97a6cSmrg      ;;
112474b97a6cSmrg    esac
1125b3307321Smrg
112674b97a6cSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
112774b97a6cSmrg    # and am__untar set.
112874b97a6cSmrg    test -n "${am_cv_prog_tar_$1}" && break
1129b3307321Smrg
113074b97a6cSmrg    # tar/untar a dummy directory, and stop if the command works.
113174b97a6cSmrg    rm -rf conftest.dir
113274b97a6cSmrg    mkdir conftest.dir
113374b97a6cSmrg    echo GrepMe > conftest.dir/file
113474b97a6cSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113574b97a6cSmrg    rm -rf conftest.dir
113674b97a6cSmrg    if test -s conftest.tar; then
113774b97a6cSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
113874b97a6cSmrg      AM_RUN_LOG([cat conftest.dir/file])
113974b97a6cSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114074b97a6cSmrg    fi
114174b97a6cSmrg  done
114274b97a6cSmrg  rm -rf conftest.dir
1143b3307321Smrg
114474b97a6cSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114574b97a6cSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146b3307321Smrg
114774b97a6cSmrgAC_SUBST([am__tar])
114874b97a6cSmrgAC_SUBST([am__untar])
114974b97a6cSmrg]) # _AM_PROG_TAR
1150b3307321Smrg
115174b97a6cSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
115274b97a6cSmrgdnl serial 11 (pkg-config-0.29)
115374b97a6cSmrgdnl
115474b97a6cSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115574b97a6cSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
115674b97a6cSmrgdnl
115774b97a6cSmrgdnl This program is free software; you can redistribute it and/or modify
115874b97a6cSmrgdnl it under the terms of the GNU General Public License as published by
115974b97a6cSmrgdnl the Free Software Foundation; either version 2 of the License, or
116074b97a6cSmrgdnl (at your option) any later version.
116174b97a6cSmrgdnl
116274b97a6cSmrgdnl This program is distributed in the hope that it will be useful, but
116374b97a6cSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
116474b97a6cSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
116574b97a6cSmrgdnl General Public License for more details.
116674b97a6cSmrgdnl
116774b97a6cSmrgdnl You should have received a copy of the GNU General Public License
116874b97a6cSmrgdnl along with this program; if not, write to the Free Software
116974b97a6cSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
117074b97a6cSmrgdnl 02111-1307, USA.
117174b97a6cSmrgdnl
117274b97a6cSmrgdnl As a special exception to the GNU General Public License, if you
117374b97a6cSmrgdnl distribute this file as part of a program that contains a
117474b97a6cSmrgdnl configuration script generated by Autoconf, you may include it under
117574b97a6cSmrgdnl the same distribution terms that you use for the rest of that
117674b97a6cSmrgdnl program.
1177b3307321Smrg
117874b97a6cSmrgdnl PKG_PREREQ(MIN-VERSION)
117974b97a6cSmrgdnl -----------------------
118074b97a6cSmrgdnl Since: 0.29
118174b97a6cSmrgdnl
118274b97a6cSmrgdnl Verify that the version of the pkg-config macros are at least
118374b97a6cSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
118474b97a6cSmrgdnl installed version of pkg-config, this checks the developer's version
118574b97a6cSmrgdnl of pkg.m4 when generating configure.
118674b97a6cSmrgdnl
118774b97a6cSmrgdnl To ensure that this macro is defined, also add:
118874b97a6cSmrgdnl m4_ifndef([PKG_PREREQ],
118974b97a6cSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
119074b97a6cSmrgdnl
119174b97a6cSmrgdnl See the "Since" comment for each macro you use to see what version
119274b97a6cSmrgdnl of the macros you require.
119374b97a6cSmrgm4_defun([PKG_PREREQ],
119474b97a6cSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
119574b97a6cSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
119674b97a6cSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
119774b97a6cSmrg])dnl PKG_PREREQ
1198b3307321Smrg
119974b97a6cSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
120074b97a6cSmrgdnl ----------------------------------
120174b97a6cSmrgdnl Since: 0.16
120274b97a6cSmrgdnl
120374b97a6cSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
120474b97a6cSmrgdnl first found in the path. Checks that the version of pkg-config found
120574b97a6cSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
120674b97a6cSmrgdnl used since that's the first version where most current features of
120774b97a6cSmrgdnl pkg-config existed.
120874b97a6cSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120974b97a6cSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
121074b97a6cSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
121174b97a6cSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
121274b97a6cSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
121374b97a6cSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
121474b97a6cSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215b3307321Smrg
121674b97a6cSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121774b97a6cSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12185e358ecaSmrgfi
121974b97a6cSmrgif test -n "$PKG_CONFIG"; then
122074b97a6cSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
122174b97a6cSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122274b97a6cSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122374b97a6cSmrg		AC_MSG_RESULT([yes])
122474b97a6cSmrg	else
122574b97a6cSmrg		AC_MSG_RESULT([no])
122674b97a6cSmrg		PKG_CONFIG=""
122774b97a6cSmrg	fi
122874b97a6cSmrgfi[]dnl
122974b97a6cSmrg])dnl PKG_PROG_PKG_CONFIG
1230b3307321Smrg
123174b97a6cSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
123274b97a6cSmrgdnl -------------------------------------------------------------------
123374b97a6cSmrgdnl Since: 0.18
123474b97a6cSmrgdnl
123574b97a6cSmrgdnl Check to see whether a particular set of modules exists. Similar to
123674b97a6cSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
123774b97a6cSmrgdnl
123874b97a6cSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123974b97a6cSmrgdnl only at the first occurence in configure.ac, so if the first place
124074b97a6cSmrgdnl it's called might be skipped (such as if it is within an "if", you
124174b97a6cSmrgdnl have to call PKG_CHECK_EXISTS manually
124274b97a6cSmrgAC_DEFUN([PKG_CHECK_EXISTS],
124374b97a6cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124474b97a6cSmrgif test -n "$PKG_CONFIG" && \
124574b97a6cSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
124674b97a6cSmrg  m4_default([$2], [:])
124774b97a6cSmrgm4_ifvaln([$3], [else
124874b97a6cSmrg  $3])dnl
124974b97a6cSmrgfi])
125074b97a6cSmrg
125174b97a6cSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
125274b97a6cSmrgdnl ---------------------------------------------
125374b97a6cSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
125474b97a6cSmrgdnl pkg_failed based on the result.
125574b97a6cSmrgm4_define([_PKG_CONFIG],
125674b97a6cSmrg[if test -n "$$1"; then
125774b97a6cSmrg    pkg_cv_[]$1="$$1"
125874b97a6cSmrg elif test -n "$PKG_CONFIG"; then
125974b97a6cSmrg    PKG_CHECK_EXISTS([$3],
126074b97a6cSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
126174b97a6cSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
126274b97a6cSmrg		     [pkg_failed=yes])
126374b97a6cSmrg else
126474b97a6cSmrg    pkg_failed=untried
126574b97a6cSmrgfi[]dnl
126674b97a6cSmrg])dnl _PKG_CONFIG
126774b97a6cSmrg
126874b97a6cSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
126974b97a6cSmrgdnl ---------------------------
127074b97a6cSmrgdnl Internal check to see if pkg-config supports short errors.
127174b97a6cSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127274b97a6cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127374b97a6cSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127474b97a6cSmrg        _pkg_short_errors_supported=yes
127506ef0fecSmrgelse
127674b97a6cSmrg        _pkg_short_errors_supported=no
127774b97a6cSmrgfi[]dnl
127874b97a6cSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279b3307321Smrg
1280b3307321Smrg
128174b97a6cSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
128274b97a6cSmrgdnl   [ACTION-IF-NOT-FOUND])
128374b97a6cSmrgdnl --------------------------------------------------------------
128474b97a6cSmrgdnl Since: 0.4.0
128574b97a6cSmrgdnl
128674b97a6cSmrgdnl Note that if there is a possibility the first call to
128774b97a6cSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
128874b97a6cSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128974b97a6cSmrgAC_DEFUN([PKG_CHECK_MODULES],
129074b97a6cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129174b97a6cSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129274b97a6cSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12935e358ecaSmrg
129474b97a6cSmrgpkg_failed=no
129574b97a6cSmrgAC_MSG_CHECKING([for $1])
129629cb5710Smrg
129774b97a6cSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129874b97a6cSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
129929cb5710Smrg
130074b97a6cSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130174b97a6cSmrgand $1[]_LIBS to avoid the need to call pkg-config.
130274b97a6cSmrgSee the pkg-config man page for more details.])
130329cb5710Smrg
130474b97a6cSmrgif test $pkg_failed = yes; then
130574b97a6cSmrg   	AC_MSG_RESULT([no])
130674b97a6cSmrg        _PKG_SHORT_ERRORS_SUPPORTED
130774b97a6cSmrg        if test $_pkg_short_errors_supported = yes; then
130874b97a6cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130974b97a6cSmrg        else 
131074b97a6cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131174b97a6cSmrg        fi
131274b97a6cSmrg	# Put the nasty error message in config.log where it belongs
131374b97a6cSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314afe13c8eSmrg
131574b97a6cSmrg	m4_default([$4], [AC_MSG_ERROR(
131674b97a6cSmrg[Package requirements ($2) were not met:
1317afe13c8eSmrg
131874b97a6cSmrg$$1_PKG_ERRORS
131974b97a6cSmrg
132074b97a6cSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132174b97a6cSmrginstalled software in a non-standard prefix.
132274b97a6cSmrg
132374b97a6cSmrg_PKG_TEXT])[]dnl
132474b97a6cSmrg        ])
132574b97a6cSmrgelif test $pkg_failed = untried; then
132674b97a6cSmrg     	AC_MSG_RESULT([no])
132774b97a6cSmrg	m4_default([$4], [AC_MSG_FAILURE(
132874b97a6cSmrg[The pkg-config script could not be found or is too old.  Make sure it
132974b97a6cSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
133074b97a6cSmrgpath to pkg-config.
133174b97a6cSmrg
133274b97a6cSmrg_PKG_TEXT
133374b97a6cSmrg
133474b97a6cSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
133574b97a6cSmrg        ])
13365e358ecaSmrgelse
133774b97a6cSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133874b97a6cSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133974b97a6cSmrg        AC_MSG_RESULT([yes])
134074b97a6cSmrg	$3
134174b97a6cSmrgfi[]dnl
134274b97a6cSmrg])dnl PKG_CHECK_MODULES
1343afe13c8eSmrg
1344afe13c8eSmrg
134574b97a6cSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
134674b97a6cSmrgdnl   [ACTION-IF-NOT-FOUND])
134774b97a6cSmrgdnl ---------------------------------------------------------------------
134874b97a6cSmrgdnl Since: 0.29
134974b97a6cSmrgdnl
135074b97a6cSmrgdnl Checks for existence of MODULES and gathers its build flags with
135174b97a6cSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
135274b97a6cSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
135374b97a6cSmrgdnl
135474b97a6cSmrgdnl Note that if there is a possibility the first call to
135574b97a6cSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
135674b97a6cSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
135774b97a6cSmrgdnl configure.ac.
135874b97a6cSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
135974b97a6cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
136074b97a6cSmrg_save_PKG_CONFIG=$PKG_CONFIG
136174b97a6cSmrgPKG_CONFIG="$PKG_CONFIG --static"
136274b97a6cSmrgPKG_CHECK_MODULES($@)
136374b97a6cSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
136474b97a6cSmrg])dnl PKG_CHECK_MODULES_STATIC
1365afe13c8eSmrg
1366afe13c8eSmrg
136774b97a6cSmrgdnl PKG_INSTALLDIR([DIRECTORY])
136874b97a6cSmrgdnl -------------------------
136974b97a6cSmrgdnl Since: 0.27
137074b97a6cSmrgdnl
137174b97a6cSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
137274b97a6cSmrgdnl should install pkg-config .pc files. By default the directory is
137374b97a6cSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
137474b97a6cSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
137574b97a6cSmrgdnl parameter.
137674b97a6cSmrgAC_DEFUN([PKG_INSTALLDIR],
137774b97a6cSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
137874b97a6cSmrgm4_pushdef([pkg_description],
137974b97a6cSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
138074b97a6cSmrgAC_ARG_WITH([pkgconfigdir],
138174b97a6cSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
138274b97a6cSmrg    [with_pkgconfigdir=]pkg_default)
138374b97a6cSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
138474b97a6cSmrgm4_popdef([pkg_default])
138574b97a6cSmrgm4_popdef([pkg_description])
138674b97a6cSmrg])dnl PKG_INSTALLDIR
138774b97a6cSmrg
138874b97a6cSmrg
138974b97a6cSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
139074b97a6cSmrgdnl --------------------------------
139174b97a6cSmrgdnl Since: 0.27
139274b97a6cSmrgdnl
139374b97a6cSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
139474b97a6cSmrgdnl module should install arch-independent pkg-config .pc files. By
139574b97a6cSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
139674b97a6cSmrgdnl changed by passing DIRECTORY. The user can override through the
139774b97a6cSmrgdnl --with-noarch-pkgconfigdir parameter.
139874b97a6cSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
139974b97a6cSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
140074b97a6cSmrgm4_pushdef([pkg_description],
140174b97a6cSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
140274b97a6cSmrgAC_ARG_WITH([noarch-pkgconfigdir],
140374b97a6cSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
140474b97a6cSmrg    [with_noarch_pkgconfigdir=]pkg_default)
140574b97a6cSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
140674b97a6cSmrgm4_popdef([pkg_default])
140774b97a6cSmrgm4_popdef([pkg_description])
140874b97a6cSmrg])dnl PKG_NOARCH_INSTALLDIR
140974b97a6cSmrg
1410afe13c8eSmrg
141174b97a6cSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
141274b97a6cSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
141374b97a6cSmrgdnl -------------------------------------------
141474b97a6cSmrgdnl Since: 0.28
141574b97a6cSmrgdnl
141674b97a6cSmrgdnl Retrieves the value of the pkg-config variable for the given module.
141774b97a6cSmrgAC_DEFUN([PKG_CHECK_VAR],
141874b97a6cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
141974b97a6cSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420afe13c8eSmrg
142174b97a6cSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
142274b97a6cSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423afe13c8eSmrg
142474b97a6cSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
142574b97a6cSmrg])dnl PKG_CHECK_VAR
1426afe13c8eSmrg
142774b97a6cSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142874b97a6cSmrgdnl
14296728f30eSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
143074b97a6cSmrgdnl
143174b97a6cSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143274b97a6cSmrgdnl copy of this software and associated documentation files (the "Software"),
143374b97a6cSmrgdnl to deal in the Software without restriction, including without limitation
143474b97a6cSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143574b97a6cSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
143674b97a6cSmrgdnl Software is furnished to do so, subject to the following conditions:
143774b97a6cSmrgdnl
143874b97a6cSmrgdnl The above copyright notice and this permission notice (including the next
143974b97a6cSmrgdnl paragraph) shall be included in all copies or substantial portions of the
144074b97a6cSmrgdnl Software.
144174b97a6cSmrgdnl
144274b97a6cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144374b97a6cSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144474b97a6cSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144574b97a6cSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144674b97a6cSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144774b97a6cSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144874b97a6cSmrgdnl DEALINGS IN THE SOFTWARE.
1449afe13c8eSmrg
145074b97a6cSmrg# XORG_MACROS_VERSION(required-version)
145174b97a6cSmrg# -------------------------------------
145206ef0fecSmrg# Minimum version: 1.1.0
145329cb5710Smrg#
145474b97a6cSmrg# If you're using a macro added in Version 1.1 or newer, include this in
145574b97a6cSmrg# your configure.ac with the minimum required version, such as:
145674b97a6cSmrg# XORG_MACROS_VERSION(1.1)
145729cb5710Smrg#
145874b97a6cSmrg# To ensure that this macro is defined, also add:
145974b97a6cSmrg# m4_ifndef([XORG_MACROS_VERSION],
146074b97a6cSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
146129cb5710Smrg#
146274b97a6cSmrg#
146374b97a6cSmrg# See the "minimum version" comment for each macro you use to see what
146474b97a6cSmrg# version you require.
146574b97a6cSmrgm4_defun([XORG_MACROS_VERSION],[
14666728f30eSmrgm4_define([vers_have], [1.20.0])
146774b97a6cSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146874b97a6cSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
146974b97a6cSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147074b97a6cSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147174b97a6cSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147274b97a6cSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147374b97a6cSmrgm4_undefine([vers_have])
147474b97a6cSmrgm4_undefine([maj_have])
147574b97a6cSmrgm4_undefine([maj_needed])
147674b97a6cSmrg]) # XORG_MACROS_VERSION
147729cb5710Smrg
147874b97a6cSmrg# XORG_PROG_RAWCPP()
147974b97a6cSmrg# ------------------
148074b97a6cSmrg# Minimum version: 1.0.0
148174b97a6cSmrg#
148274b97a6cSmrg# Find cpp program and necessary flags for use in pre-processing text files
148374b97a6cSmrg# such as man pages and config files
148474b97a6cSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148574b97a6cSmrgAC_REQUIRE([AC_PROG_CPP])
148674b97a6cSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148774b97a6cSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
148806ef0fecSmrg
148974b97a6cSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149074b97a6cSmrg# which is not the best choice for supporting other OS'es, but covers most
149174b97a6cSmrg# of the ones we need for now.
149274b97a6cSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149374b97a6cSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149474b97a6cSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149574b97a6cSmrg	AC_MSG_RESULT([no])
149674b97a6cSmrgelse
149774b97a6cSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149874b97a6cSmrg		RAWCPPFLAGS=-undef
149974b97a6cSmrg		AC_MSG_RESULT([yes])
150074b97a6cSmrg	# under Cygwin unix is still defined even with -undef
150174b97a6cSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150274b97a6cSmrg		RAWCPPFLAGS="-undef -ansi"
150374b97a6cSmrg		AC_MSG_RESULT([yes, with -ansi])
150474b97a6cSmrg	else
150574b97a6cSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150674b97a6cSmrg	fi
150729cb5710Smrgfi
150874b97a6cSmrgrm -f conftest.$ac_ext
150929cb5710Smrg
151074b97a6cSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151174b97a6cSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151274b97a6cSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151374b97a6cSmrg	AC_MSG_RESULT([no])
151474b97a6cSmrgelse
151574b97a6cSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151674b97a6cSmrg		TRADITIONALCPPFLAGS="-traditional"
151774b97a6cSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151874b97a6cSmrg		AC_MSG_RESULT([yes])
151974b97a6cSmrg	else
152074b97a6cSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152174b97a6cSmrg	fi
152274b97a6cSmrgfi
152374b97a6cSmrgrm -f conftest.$ac_ext
152474b97a6cSmrgAC_SUBST(RAWCPPFLAGS)
152574b97a6cSmrgAC_SUBST(TRADITIONALCPPFLAGS)
152674b97a6cSmrg]) # XORG_PROG_RAWCPP
152729cb5710Smrg
152874b97a6cSmrg# XORG_MANPAGE_SECTIONS()
152974b97a6cSmrg# -----------------------
153074b97a6cSmrg# Minimum version: 1.0.0
1531320e696bSmrg#
153274b97a6cSmrg# Determine which sections man pages go in for the different man page types
153374b97a6cSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153474b97a6cSmrg# Not sure if there's any better way than just hardcoding by OS name.
153574b97a6cSmrg# Override default settings by setting environment variables
153674b97a6cSmrg# Added MAN_SUBSTS in version 1.8
153774b97a6cSmrg# Added AC_PROG_SED in version 1.8
153806ef0fecSmrg
153974b97a6cSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154074b97a6cSmrgAC_REQUIRE([AC_CANONICAL_HOST])
154174b97a6cSmrgAC_REQUIRE([AC_PROG_SED])
1542320e696bSmrg
154374b97a6cSmrgcase $host_os in
154474b97a6cSmrg    solaris*)
154574b97a6cSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
154674b97a6cSmrg        # check for a man page file found in later versions that use
154774b97a6cSmrg        # traditional section numbers instead
154874b97a6cSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
154974b97a6cSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
155074b97a6cSmrg        ;;
155174b97a6cSmrg    *) SYSV_MAN_SECTIONS=false ;;
155274b97a6cSmrgesac
1553320e696bSmrg
155474b97a6cSmrgif test x$APP_MAN_SUFFIX = x    ; then
155574b97a6cSmrg    APP_MAN_SUFFIX=1
155674b97a6cSmrgfi
155774b97a6cSmrgif test x$APP_MAN_DIR = x    ; then
155874b97a6cSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
155974b97a6cSmrgfi
1560320e696bSmrg
156174b97a6cSmrgif test x$LIB_MAN_SUFFIX = x    ; then
156274b97a6cSmrg    LIB_MAN_SUFFIX=3
156374b97a6cSmrgfi
156474b97a6cSmrgif test x$LIB_MAN_DIR = x    ; then
156574b97a6cSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
156674b97a6cSmrgfi
1567320e696bSmrg
156874b97a6cSmrgif test x$FILE_MAN_SUFFIX = x    ; then
156974b97a6cSmrg    case $SYSV_MAN_SECTIONS in
157074b97a6cSmrg	true)				FILE_MAN_SUFFIX=4  ;;
157174b97a6cSmrg	*)				FILE_MAN_SUFFIX=5  ;;
157274b97a6cSmrg    esac
157374b97a6cSmrgfi
157474b97a6cSmrgif test x$FILE_MAN_DIR = x    ; then
157574b97a6cSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576320e696bSmrgfi
1577320e696bSmrg
157874b97a6cSmrgif test x$MISC_MAN_SUFFIX = x    ; then
157974b97a6cSmrg    case $SYSV_MAN_SECTIONS in
158074b97a6cSmrg	true)				MISC_MAN_SUFFIX=5  ;;
158174b97a6cSmrg	*)				MISC_MAN_SUFFIX=7  ;;
158274b97a6cSmrg    esac
158374b97a6cSmrgfi
158474b97a6cSmrgif test x$MISC_MAN_DIR = x    ; then
158574b97a6cSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
158606ef0fecSmrgfi
1587320e696bSmrg
158874b97a6cSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
158974b97a6cSmrg    case $SYSV_MAN_SECTIONS in
159074b97a6cSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
159174b97a6cSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159274b97a6cSmrg    esac
159374b97a6cSmrgfi
159474b97a6cSmrgif test x$DRIVER_MAN_DIR = x    ; then
159574b97a6cSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159674b97a6cSmrgfi
159706ef0fecSmrg
159874b97a6cSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
159974b97a6cSmrg    case $SYSV_MAN_SECTIONS in
160074b97a6cSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
160174b97a6cSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160274b97a6cSmrg    esac
160374b97a6cSmrgfi
160474b97a6cSmrgif test x$ADMIN_MAN_DIR = x    ; then
160574b97a6cSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160674b97a6cSmrgfi
160706ef0fecSmrg
160806ef0fecSmrg
160974b97a6cSmrgAC_SUBST([APP_MAN_SUFFIX])
161074b97a6cSmrgAC_SUBST([LIB_MAN_SUFFIX])
161174b97a6cSmrgAC_SUBST([FILE_MAN_SUFFIX])
161274b97a6cSmrgAC_SUBST([MISC_MAN_SUFFIX])
161374b97a6cSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161474b97a6cSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161574b97a6cSmrgAC_SUBST([APP_MAN_DIR])
161674b97a6cSmrgAC_SUBST([LIB_MAN_DIR])
161774b97a6cSmrgAC_SUBST([FILE_MAN_DIR])
161874b97a6cSmrgAC_SUBST([MISC_MAN_DIR])
161974b97a6cSmrgAC_SUBST([DRIVER_MAN_DIR])
162074b97a6cSmrgAC_SUBST([ADMIN_MAN_DIR])
162106ef0fecSmrg
162274b97a6cSmrgXORG_MAN_PAGE="X Version 11"
162374b97a6cSmrgAC_SUBST([XORG_MAN_PAGE])
162474b97a6cSmrgMAN_SUBSTS="\
162574b97a6cSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162674b97a6cSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162774b97a6cSmrg	-e 's|__xservername__|Xorg|g' \
162874b97a6cSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
162974b97a6cSmrg	-e 's|__projectroot__|\$(prefix)|g' \
163074b97a6cSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163174b97a6cSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163274b97a6cSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163374b97a6cSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163474b97a6cSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163574b97a6cSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163674b97a6cSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163774b97a6cSmrgAC_SUBST([MAN_SUBSTS])
163806ef0fecSmrg
163974b97a6cSmrg]) # XORG_MANPAGE_SECTIONS
164006ef0fecSmrg
164174b97a6cSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164274b97a6cSmrg# ------------------------
164374b97a6cSmrg# Minimum version: 1.7.0
164429cb5710Smrg#
164574b97a6cSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164674b97a6cSmrg# provided by xorg-sgml-doctools, if installed.
164774b97a6cSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164874b97a6cSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164974b97a6cSmrgXORG_SGML_PATH=
165074b97a6cSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165174b97a6cSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165274b97a6cSmrg    [m4_ifval([$1],[:],
165374b97a6cSmrg        [if test x"$cross_compiling" != x"yes" ; then
165474b97a6cSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165574b97a6cSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165674b97a6cSmrg         fi])
165774b97a6cSmrg    ])
165874b97a6cSmrg
165974b97a6cSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166074b97a6cSmrg# the path and the name of the doc stylesheet
166174b97a6cSmrgif test "x$XORG_SGML_PATH" != "x" ; then
166274b97a6cSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166374b97a6cSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166474b97a6cSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166574b97a6cSmrgelse
166674b97a6cSmrg   AC_MSG_RESULT([no])
166774b97a6cSmrgfi
166874b97a6cSmrg
166974b97a6cSmrgAC_SUBST(XORG_SGML_PATH)
167074b97a6cSmrgAC_SUBST(STYLESHEET_SRCDIR)
167174b97a6cSmrgAC_SUBST(XSL_STYLESHEET)
167274b97a6cSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167374b97a6cSmrg]) # XORG_CHECK_SGML_DOCTOOLS
167474b97a6cSmrg
167574b97a6cSmrg# XORG_CHECK_LINUXDOC
167674b97a6cSmrg# -------------------
167774b97a6cSmrg# Minimum version: 1.0.0
167829cb5710Smrg#
167974b97a6cSmrg# Defines the variable MAKE_TEXT if the necessary tools and
168074b97a6cSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168174b97a6cSmrg# Whether or not the necessary tools and files are found can be checked
168274b97a6cSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168374b97a6cSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168474b97a6cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168574b97a6cSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
168629cb5710Smrg
168774b97a6cSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
168806ef0fecSmrg
168974b97a6cSmrgAC_MSG_CHECKING([whether to build documentation])
169074b97a6cSmrg
169174b97a6cSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169274b97a6cSmrg   BUILDDOC=yes
169329cb5710Smrgelse
169474b97a6cSmrg   BUILDDOC=no
169529cb5710Smrgfi
169629cb5710Smrg
169774b97a6cSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
169829cb5710Smrg
169974b97a6cSmrgAC_MSG_RESULT([$BUILDDOC])
170006ef0fecSmrg
170174b97a6cSmrgAC_MSG_CHECKING([whether to build pdf documentation])
170274b97a6cSmrg
170374b97a6cSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170474b97a6cSmrg   BUILDPDFDOC=yes
170574b97a6cSmrgelse
170674b97a6cSmrg   BUILDPDFDOC=no
170774b97a6cSmrgfi
170874b97a6cSmrg
170974b97a6cSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171074b97a6cSmrg
171174b97a6cSmrgAC_MSG_RESULT([$BUILDPDFDOC])
171274b97a6cSmrg
171374b97a6cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171474b97a6cSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171574b97a6cSmrgMAKE_PDF="$PS2PDF"
171674b97a6cSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171774b97a6cSmrg
171874b97a6cSmrgAC_SUBST(MAKE_TEXT)
171974b97a6cSmrgAC_SUBST(MAKE_PS)
172074b97a6cSmrgAC_SUBST(MAKE_PDF)
172174b97a6cSmrgAC_SUBST(MAKE_HTML)
172274b97a6cSmrg]) # XORG_CHECK_LINUXDOC
172374b97a6cSmrg
172474b97a6cSmrg# XORG_CHECK_DOCBOOK
172574b97a6cSmrg# -------------------
172674b97a6cSmrg# Minimum version: 1.0.0
172774b97a6cSmrg#
172874b97a6cSmrg# Checks for the ability to build output formats from SGML DocBook source.
172974b97a6cSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173074b97a6cSmrg# indicates whether the necessary tools and files are found and, if set,
173174b97a6cSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173274b97a6cSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173374b97a6cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
173474b97a6cSmrg
173574b97a6cSmrgBUILDTXTDOC=no
173674b97a6cSmrgBUILDPDFDOC=no
173774b97a6cSmrgBUILDPSDOC=no
173874b97a6cSmrgBUILDHTMLDOC=no
173974b97a6cSmrg
174074b97a6cSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174174b97a6cSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174274b97a6cSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174374b97a6cSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
174406ef0fecSmrg
174574b97a6cSmrgAC_MSG_CHECKING([whether to build text documentation])
174674b97a6cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174774b97a6cSmrg   test x$BUILD_TXTDOC != xno; then
174874b97a6cSmrg	BUILDTXTDOC=yes
174974b97a6cSmrgfi
175074b97a6cSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175174b97a6cSmrgAC_MSG_RESULT([$BUILDTXTDOC])
175206ef0fecSmrg
175374b97a6cSmrgAC_MSG_CHECKING([whether to build PDF documentation])
175474b97a6cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175574b97a6cSmrg   test x$BUILD_PDFDOC != xno; then
175674b97a6cSmrg	BUILDPDFDOC=yes
175774b97a6cSmrgfi
175874b97a6cSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175974b97a6cSmrgAC_MSG_RESULT([$BUILDPDFDOC])
176006ef0fecSmrg
176174b97a6cSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176274b97a6cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176374b97a6cSmrg   test x$BUILD_PSDOC != xno; then
176474b97a6cSmrg	BUILDPSDOC=yes
176529cb5710Smrgfi
176674b97a6cSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176774b97a6cSmrgAC_MSG_RESULT([$BUILDPSDOC])
176829cb5710Smrg
176974b97a6cSmrgAC_MSG_CHECKING([whether to build HTML documentation])
177074b97a6cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177174b97a6cSmrg   test x$BUILD_HTMLDOC != xno; then
177274b97a6cSmrg	BUILDHTMLDOC=yes
177374b97a6cSmrgfi
177474b97a6cSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177574b97a6cSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
177606ef0fecSmrg
177774b97a6cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177874b97a6cSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177974b97a6cSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178074b97a6cSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178174b97a6cSmrg
178274b97a6cSmrgAC_SUBST(MAKE_TEXT)
178374b97a6cSmrgAC_SUBST(MAKE_PS)
178474b97a6cSmrgAC_SUBST(MAKE_PDF)
178574b97a6cSmrgAC_SUBST(MAKE_HTML)
178674b97a6cSmrg]) # XORG_CHECK_DOCBOOK
178774b97a6cSmrg
178874b97a6cSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178974b97a6cSmrg# ----------------
179074b97a6cSmrg# Minimum version: 1.5.0
179174b97a6cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
179229cb5710Smrg#
179374b97a6cSmrg# Documentation tools are not always available on all platforms and sometimes
179474b97a6cSmrg# not at the appropriate level. This macro enables a module to test for the
179574b97a6cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
17966728f30eSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
179774b97a6cSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179874b97a6cSmrg# --with-xmlto assumes 'auto'.
179929cb5710Smrg#
180074b97a6cSmrg# Interface to module:
180174b97a6cSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180274b97a6cSmrg# XMLTO:	returns the path of the xmlto program found
180374b97a6cSmrg#		returns the path set by the user in the environment
180474b97a6cSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180574b97a6cSmrg#		'no' user instructs the module not to use xmlto
180629cb5710Smrg#
180774b97a6cSmrg# Added in version 1.10.0
180874b97a6cSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180974b97a6cSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
181029cb5710Smrg#
181174b97a6cSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
181229cb5710Smrg#
181374b97a6cSmrgAC_DEFUN([XORG_WITH_XMLTO],[
181474b97a6cSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181574b97a6cSmrgm4_define([_defopt], m4_default([$2], [auto]))
181674b97a6cSmrgAC_ARG_WITH(xmlto,
181774b97a6cSmrg	AS_HELP_STRING([--with-xmlto],
181874b97a6cSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181974b97a6cSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182074b97a6cSmrgm4_undefine([_defopt])
182129cb5710Smrg
182274b97a6cSmrgif test "x$use_xmlto" = x"auto"; then
182374b97a6cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
182474b97a6cSmrg   if test "x$XMLTO" = "x"; then
182574b97a6cSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182674b97a6cSmrg	have_xmlto=no
182774b97a6cSmrg   else
182874b97a6cSmrg        have_xmlto=yes
182974b97a6cSmrg   fi
183074b97a6cSmrgelif test "x$use_xmlto" = x"yes" ; then
183174b97a6cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
183274b97a6cSmrg   if test "x$XMLTO" = "x"; then
183374b97a6cSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183474b97a6cSmrg   fi
183574b97a6cSmrg   have_xmlto=yes
183674b97a6cSmrgelif test "x$use_xmlto" = x"no" ; then
183774b97a6cSmrg   if test "x$XMLTO" != "x"; then
183874b97a6cSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183974b97a6cSmrg   fi
184074b97a6cSmrg   have_xmlto=no
184174b97a6cSmrgelse
184274b97a6cSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184374b97a6cSmrgfi
184429cb5710Smrg
184574b97a6cSmrg# Test for a minimum version of xmlto, if provided.
184674b97a6cSmrgm4_ifval([$1],
184774b97a6cSmrg[if test "$have_xmlto" = yes; then
184874b97a6cSmrg    # scrape the xmlto version
184974b97a6cSmrg    AC_MSG_CHECKING([the xmlto version])
185074b97a6cSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185174b97a6cSmrg    AC_MSG_RESULT([$xmlto_version])
185274b97a6cSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185374b97a6cSmrg        [if test "x$use_xmlto" = xauto; then
185474b97a6cSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185574b97a6cSmrg            have_xmlto=no
185674b97a6cSmrg        else
185774b97a6cSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185874b97a6cSmrg        fi])
185974b97a6cSmrgfi])
186029cb5710Smrg
186174b97a6cSmrg# Test for the ability of xmlto to generate a text target
186274b97a6cSmrg#
186374b97a6cSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
186474b97a6cSmrg# following test for empty XML docbook files.
186574b97a6cSmrg# For compatibility reasons use the following empty XML docbook file and if
186674b97a6cSmrg# it fails try it again with a non-empty XML file.
186774b97a6cSmrghave_xmlto_text=no
186874b97a6cSmrgcat > conftest.xml << "EOF"
186974b97a6cSmrgEOF
187074b97a6cSmrgAS_IF([test "$have_xmlto" = yes],
187174b97a6cSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187274b97a6cSmrg             [have_xmlto_text=yes],
187374b97a6cSmrg             [# Try it again with a non-empty XML file.
187474b97a6cSmrg              cat > conftest.xml << "EOF"
187574b97a6cSmrg<x></x>
187674b97a6cSmrgEOF
187774b97a6cSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187874b97a6cSmrg                    [have_xmlto_text=yes],
187974b97a6cSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188074b97a6cSmrgrm -f conftest.xml
188174b97a6cSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188274b97a6cSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188374b97a6cSmrg]) # XORG_WITH_XMLTO
188429cb5710Smrg
188574b97a6cSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188674b97a6cSmrg# --------------------------------------------
188774b97a6cSmrg# Minimum version: 1.12.0
188874b97a6cSmrg# Minimum version for optional DEFAULT argument: 1.12.0
188974b97a6cSmrg#
189074b97a6cSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189174b97a6cSmrg# XML-based language used for the transformation of XML documents.
189274b97a6cSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189374b97a6cSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189474b97a6cSmrg# The XSLT processor is often used as a standalone tool for transformations.
189574b97a6cSmrg# It should not be assumed that this tool is used only to work with documnetation.
189674b97a6cSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189774b97a6cSmrg#
189874b97a6cSmrg# Interface to module:
189974b97a6cSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190074b97a6cSmrg# XSLTPROC:	 returns the path of the xsltproc program found
190174b97a6cSmrg#		 returns the path set by the user in the environment
190274b97a6cSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190374b97a6cSmrg#		  'no' user instructs the module not to use xsltproc
190474b97a6cSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190574b97a6cSmrg#
190674b97a6cSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190774b97a6cSmrg#
190874b97a6cSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190974b97a6cSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191074b97a6cSmrg# Preserves the interface, should it be implemented later
191174b97a6cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191274b97a6cSmrgm4_define([_defopt], m4_default([$2], [auto]))
191374b97a6cSmrgAC_ARG_WITH(xsltproc,
191474b97a6cSmrg	AS_HELP_STRING([--with-xsltproc],
191574b97a6cSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191674b97a6cSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191774b97a6cSmrgm4_undefine([_defopt])
191829cb5710Smrg
191974b97a6cSmrgif test "x$use_xsltproc" = x"auto"; then
192074b97a6cSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192174b97a6cSmrg   if test "x$XSLTPROC" = "x"; then
192274b97a6cSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192374b97a6cSmrg	have_xsltproc=no
192474b97a6cSmrg   else
192574b97a6cSmrg        have_xsltproc=yes
192674b97a6cSmrg   fi
192774b97a6cSmrgelif test "x$use_xsltproc" = x"yes" ; then
192874b97a6cSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192974b97a6cSmrg   if test "x$XSLTPROC" = "x"; then
193074b97a6cSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193174b97a6cSmrg   fi
193274b97a6cSmrg   have_xsltproc=yes
193374b97a6cSmrgelif test "x$use_xsltproc" = x"no" ; then
193474b97a6cSmrg   if test "x$XSLTPROC" != "x"; then
193574b97a6cSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193674b97a6cSmrg   fi
193774b97a6cSmrg   have_xsltproc=no
193874b97a6cSmrgelse
193974b97a6cSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
194006ef0fecSmrgfi
194106ef0fecSmrg
194274b97a6cSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194374b97a6cSmrg]) # XORG_WITH_XSLTPROC
194474b97a6cSmrg
194574b97a6cSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194674b97a6cSmrg# ----------------------------------------
194774b97a6cSmrg# Minimum version: 1.15.0
194829cb5710Smrg#
194974b97a6cSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
195074b97a6cSmrg# scanning arbitrary text files, extracting information from those text files,
195174b97a6cSmrg# and printing reports based on that information.
195229cb5710Smrg#
195374b97a6cSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
195429cb5710Smrg#
195574b97a6cSmrg# Interface to module:
195674b97a6cSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
195774b97a6cSmrg# PERL:	     returns the path of the perl program found
195874b97a6cSmrg#	     returns the path set by the user in the environment
195974b97a6cSmrg# --with-perl: 'yes' user instructs the module to use perl
196074b97a6cSmrg#	       'no' user instructs the module not to use perl
196174b97a6cSmrg# have_perl: returns yes if perl found in PATH or no
196229cb5710Smrg#
196374b97a6cSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196474b97a6cSmrg#
196574b97a6cSmrgAC_DEFUN([XORG_WITH_PERL],[
196674b97a6cSmrgAC_ARG_VAR([PERL], [Path to perl command])
196774b97a6cSmrg# Preserves the interface, should it be implemented later
196874b97a6cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196974b97a6cSmrgm4_define([_defopt], m4_default([$2], [auto]))
197074b97a6cSmrgAC_ARG_WITH(perl,
197174b97a6cSmrg	AS_HELP_STRING([--with-perl],
197274b97a6cSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197374b97a6cSmrg	   [use_perl=$withval], [use_perl=]_defopt)
197474b97a6cSmrgm4_undefine([_defopt])
197529cb5710Smrg
197674b97a6cSmrgif test "x$use_perl" = x"auto"; then
197774b97a6cSmrg   AC_PATH_PROG([PERL], [perl])
197874b97a6cSmrg   if test "x$PERL" = "x"; then
197974b97a6cSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198074b97a6cSmrg	have_perl=no
198174b97a6cSmrg   else
198274b97a6cSmrg        have_perl=yes
198374b97a6cSmrg   fi
198474b97a6cSmrgelif test "x$use_perl" = x"yes" ; then
198574b97a6cSmrg   AC_PATH_PROG([PERL], [perl])
198674b97a6cSmrg   if test "x$PERL" = "x"; then
198774b97a6cSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198874b97a6cSmrg   fi
198974b97a6cSmrg   have_perl=yes
199074b97a6cSmrgelif test "x$use_perl" = x"no" ; then
199174b97a6cSmrg   if test "x$PERL" != "x"; then
199274b97a6cSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199374b97a6cSmrg   fi
199474b97a6cSmrg   have_perl=no
199574b97a6cSmrgelse
199674b97a6cSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199774b97a6cSmrgfi
1998320e696bSmrg
199974b97a6cSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200074b97a6cSmrg]) # XORG_WITH_PERL
200129cb5710Smrg
200274b97a6cSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
200329cb5710Smrg# ----------------
200474b97a6cSmrg# Minimum version: 1.5.0
200574b97a6cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
200629cb5710Smrg#
200774b97a6cSmrg# Documentation tools are not always available on all platforms and sometimes
200874b97a6cSmrg# not at the appropriate level. This macro enables a module to test for the
200974b97a6cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20106728f30eSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
201174b97a6cSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201274b97a6cSmrg# --with-asciidoc assumes 'auto'.
201329cb5710Smrg#
201474b97a6cSmrg# Interface to module:
201574b97a6cSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201674b97a6cSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
201774b97a6cSmrg#		 returns the path set by the user in the environment
201874b97a6cSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201974b97a6cSmrg#		  'no' user instructs the module not to use asciidoc
202029cb5710Smrg#
202174b97a6cSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
202229cb5710Smrg#
202374b97a6cSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202474b97a6cSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202574b97a6cSmrgm4_define([_defopt], m4_default([$2], [auto]))
202674b97a6cSmrgAC_ARG_WITH(asciidoc,
202774b97a6cSmrg	AS_HELP_STRING([--with-asciidoc],
202874b97a6cSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202974b97a6cSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203074b97a6cSmrgm4_undefine([_defopt])
203106ef0fecSmrg
203274b97a6cSmrgif test "x$use_asciidoc" = x"auto"; then
203374b97a6cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203474b97a6cSmrg   if test "x$ASCIIDOC" = "x"; then
203574b97a6cSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203674b97a6cSmrg	have_asciidoc=no
203774b97a6cSmrg   else
203874b97a6cSmrg        have_asciidoc=yes
203974b97a6cSmrg   fi
204074b97a6cSmrgelif test "x$use_asciidoc" = x"yes" ; then
204174b97a6cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204274b97a6cSmrg   if test "x$ASCIIDOC" = "x"; then
204374b97a6cSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204474b97a6cSmrg   fi
204574b97a6cSmrg   have_asciidoc=yes
204674b97a6cSmrgelif test "x$use_asciidoc" = x"no" ; then
204774b97a6cSmrg   if test "x$ASCIIDOC" != "x"; then
204874b97a6cSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204974b97a6cSmrg   fi
205074b97a6cSmrg   have_asciidoc=no
205174b97a6cSmrgelse
205274b97a6cSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205374b97a6cSmrgfi
205474b97a6cSmrgm4_ifval([$1],
205574b97a6cSmrg[if test "$have_asciidoc" = yes; then
205674b97a6cSmrg    # scrape the asciidoc version
205774b97a6cSmrg    AC_MSG_CHECKING([the asciidoc version])
205874b97a6cSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205974b97a6cSmrg    AC_MSG_RESULT([$asciidoc_version])
206074b97a6cSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206174b97a6cSmrg        [if test "x$use_asciidoc" = xauto; then
206274b97a6cSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206374b97a6cSmrg            have_asciidoc=no
206474b97a6cSmrg        else
206574b97a6cSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206674b97a6cSmrg        fi])
206774b97a6cSmrgfi])
206874b97a6cSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206974b97a6cSmrg]) # XORG_WITH_ASCIIDOC
207006ef0fecSmrg
207174b97a6cSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207274b97a6cSmrg# -------------------------------------------
207374b97a6cSmrg# Minimum version: 1.5.0
207474b97a6cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
207574b97a6cSmrg# Minimum version for optional DOT checking: 1.18.0
207629cb5710Smrg#
207774b97a6cSmrg# Documentation tools are not always available on all platforms and sometimes
207874b97a6cSmrg# not at the appropriate level. This macro enables a module to test for the
207974b97a6cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20806728f30eSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
208174b97a6cSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208274b97a6cSmrg# --with-doxygen assumes 'auto'.
208329cb5710Smrg#
208474b97a6cSmrg# Interface to module:
208574b97a6cSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208674b97a6cSmrg# DOXYGEN:	 returns the path of the doxygen program found
208774b97a6cSmrg#		 returns the path set by the user in the environment
208874b97a6cSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208974b97a6cSmrg#		  'no' user instructs the module not to use doxygen
209029cb5710Smrg#
209174b97a6cSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
209229cb5710Smrg#
209374b97a6cSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209474b97a6cSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209574b97a6cSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209674b97a6cSmrgm4_define([_defopt], m4_default([$2], [auto]))
209774b97a6cSmrgAC_ARG_WITH(doxygen,
209874b97a6cSmrg	AS_HELP_STRING([--with-doxygen],
209974b97a6cSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210074b97a6cSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210174b97a6cSmrgm4_undefine([_defopt])
210206ef0fecSmrg
210374b97a6cSmrgif test "x$use_doxygen" = x"auto"; then
210474b97a6cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210574b97a6cSmrg   if test "x$DOXYGEN" = "x"; then
210674b97a6cSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210774b97a6cSmrg	have_doxygen=no
210874b97a6cSmrg   else
210974b97a6cSmrg        have_doxygen=yes
211074b97a6cSmrg   fi
211174b97a6cSmrgelif test "x$use_doxygen" = x"yes" ; then
211274b97a6cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211374b97a6cSmrg   if test "x$DOXYGEN" = "x"; then
211474b97a6cSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211574b97a6cSmrg   fi
211674b97a6cSmrg   have_doxygen=yes
211774b97a6cSmrgelif test "x$use_doxygen" = x"no" ; then
211874b97a6cSmrg   if test "x$DOXYGEN" != "x"; then
211974b97a6cSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212074b97a6cSmrg   fi
212174b97a6cSmrg   have_doxygen=no
212206ef0fecSmrgelse
212374b97a6cSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
212406ef0fecSmrgfi
212574b97a6cSmrgm4_ifval([$1],
212674b97a6cSmrg[if test "$have_doxygen" = yes; then
212774b97a6cSmrg    # scrape the doxygen version
212874b97a6cSmrg    AC_MSG_CHECKING([the doxygen version])
212974b97a6cSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213074b97a6cSmrg    AC_MSG_RESULT([$doxygen_version])
213174b97a6cSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213274b97a6cSmrg        [if test "x$use_doxygen" = xauto; then
213374b97a6cSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213474b97a6cSmrg            have_doxygen=no
213574b97a6cSmrg        else
213674b97a6cSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213774b97a6cSmrg        fi])
213874b97a6cSmrgfi])
213906ef0fecSmrg
214074b97a6cSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214174b97a6cSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214274b97a6cSmrgdnl 	HAVE_DOT = @HAVE_DOT@
214374b97a6cSmrgHAVE_DOT=no
214474b97a6cSmrgif test "x$have_doxygen" = "xyes"; then
214574b97a6cSmrg  AC_PATH_PROG([DOT], [dot])
214674b97a6cSmrg    if test "x$DOT" != "x"; then
214774b97a6cSmrg      HAVE_DOT=yes
214874b97a6cSmrg    fi
214974b97a6cSmrgfi
215006ef0fecSmrg
215174b97a6cSmrgAC_SUBST([HAVE_DOT])
215274b97a6cSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215374b97a6cSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215474b97a6cSmrg]) # XORG_WITH_DOXYGEN
215506ef0fecSmrg
215674b97a6cSmrg# XORG_WITH_GROFF([DEFAULT])
215774b97a6cSmrg# ----------------
215874b97a6cSmrg# Minimum version: 1.6.0
215974b97a6cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2160320e696bSmrg#
216174b97a6cSmrg# Documentation tools are not always available on all platforms and sometimes
216274b97a6cSmrg# not at the appropriate level. This macro enables a module to test for the
216374b97a6cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
21646728f30eSmrg# the --with-groff option, it allows maximum flexibility in making decisions
216574b97a6cSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
216674b97a6cSmrg# --with-groff assumes 'auto'.
216774b97a6cSmrg#
216874b97a6cSmrg# Interface to module:
216974b97a6cSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217074b97a6cSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217174b97a6cSmrg# HAVE_GROFF_MS: the -ms macros package
217274b97a6cSmrg# GROFF:	 returns the path of the groff program found
217374b97a6cSmrg#		 returns the path set by the user in the environment
217474b97a6cSmrg# --with-groff:	 'yes' user instructs the module to use groff
217574b97a6cSmrg#		 'no' user instructs the module not to use groff
217674b97a6cSmrg#
217774b97a6cSmrg# Added in version 1.9.0:
217874b97a6cSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217974b97a6cSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218074b97a6cSmrg#		   psselect from the psutils package.
218174b97a6cSmrg#		   the ghostcript package. Refer to the grohtml man pages
218274b97a6cSmrg#
218374b97a6cSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218474b97a6cSmrg#
218574b97a6cSmrg# OS and distros often splits groff in a basic and full package, the former
218674b97a6cSmrg# having the groff program and the later having devices, fonts and macros
218774b97a6cSmrg# Checking for the groff executable is not enough.
218874b97a6cSmrg#
218974b97a6cSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
219074b97a6cSmrg# unset HAVE_GROFF or GROFF env variables.
219174b97a6cSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219274b97a6cSmrg#
219374b97a6cSmrgAC_DEFUN([XORG_WITH_GROFF],[
219474b97a6cSmrgAC_ARG_VAR([GROFF], [Path to groff command])
219574b97a6cSmrgm4_define([_defopt], m4_default([$1], [auto]))
219674b97a6cSmrgAC_ARG_WITH(groff,
219774b97a6cSmrg	AS_HELP_STRING([--with-groff],
219874b97a6cSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219974b97a6cSmrg	   [use_groff=$withval], [use_groff=]_defopt)
220074b97a6cSmrgm4_undefine([_defopt])
220106ef0fecSmrg
220274b97a6cSmrgif test "x$use_groff" = x"auto"; then
220374b97a6cSmrg   AC_PATH_PROG([GROFF], [groff])
220474b97a6cSmrg   if test "x$GROFF" = "x"; then
220574b97a6cSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220674b97a6cSmrg	have_groff=no
220774b97a6cSmrg   else
220874b97a6cSmrg        have_groff=yes
220974b97a6cSmrg   fi
221074b97a6cSmrgelif test "x$use_groff" = x"yes" ; then
221174b97a6cSmrg   AC_PATH_PROG([GROFF], [groff])
221274b97a6cSmrg   if test "x$GROFF" = "x"; then
221374b97a6cSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221474b97a6cSmrg   fi
221574b97a6cSmrg   have_groff=yes
221674b97a6cSmrgelif test "x$use_groff" = x"no" ; then
221774b97a6cSmrg   if test "x$GROFF" != "x"; then
221874b97a6cSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221974b97a6cSmrg   fi
222074b97a6cSmrg   have_groff=no
222174b97a6cSmrgelse
222274b97a6cSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222374b97a6cSmrgfi
222406ef0fecSmrg
222574b97a6cSmrg# We have groff, test for the presence of the macro packages
222674b97a6cSmrgif test "x$have_groff" = x"yes"; then
222774b97a6cSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222874b97a6cSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222974b97a6cSmrg        groff_ms_works=yes
223074b97a6cSmrg    else
223174b97a6cSmrg        groff_ms_works=no
223206ef0fecSmrg    fi
223374b97a6cSmrg    AC_MSG_RESULT([$groff_ms_works])
223474b97a6cSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223574b97a6cSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223674b97a6cSmrg        groff_mm_works=yes
223774b97a6cSmrg    else
223874b97a6cSmrg        groff_mm_works=no
223974b97a6cSmrg    fi
224074b97a6cSmrg    AC_MSG_RESULT([$groff_mm_works])
224174b97a6cSmrgfi
224206ef0fecSmrg
224374b97a6cSmrg# We have groff, test for HTML dependencies, one command per package
224474b97a6cSmrgif test "x$have_groff" = x"yes"; then
224574b97a6cSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224674b97a6cSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224774b97a6cSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224874b97a6cSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224974b97a6cSmrg      have_groff_html=yes
225074b97a6cSmrg   else
225174b97a6cSmrg      have_groff_html=no
225274b97a6cSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225374b97a6cSmrg   fi
225474b97a6cSmrgfi
225574b97a6cSmrg
225674b97a6cSmrg# Set Automake conditionals for Makefiles
225774b97a6cSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225874b97a6cSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225974b97a6cSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226074b97a6cSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226174b97a6cSmrg]) # XORG_WITH_GROFF
226274b97a6cSmrg
226374b97a6cSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226474b97a6cSmrg# ---------------------------------------
226574b97a6cSmrg# Minimum version: 1.6.0
226674b97a6cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
226774b97a6cSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226874b97a6cSmrg#
226974b97a6cSmrg# Documentation tools are not always available on all platforms and sometimes
227074b97a6cSmrg# not at the appropriate level. This macro enables a module to test for the
227174b97a6cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
22726728f30eSmrg# the --with-fop option, it allows maximum flexibility in making decisions
227374b97a6cSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
227474b97a6cSmrg# --with-fop assumes 'auto'.
227574b97a6cSmrg#
227674b97a6cSmrg# Interface to module:
227774b97a6cSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227874b97a6cSmrg# FOP:	 	returns the path of the fop program found
227974b97a6cSmrg#		returns the path set by the user in the environment
228074b97a6cSmrg# --with-fop: 	'yes' user instructs the module to use fop
228174b97a6cSmrg#		'no' user instructs the module not to use fop
228274b97a6cSmrg#
228374b97a6cSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228474b97a6cSmrg#
228574b97a6cSmrgAC_DEFUN([XORG_WITH_FOP],[
228674b97a6cSmrgAC_ARG_VAR([FOP], [Path to fop command])
228774b97a6cSmrgm4_define([_defopt], m4_default([$2], [auto]))
228874b97a6cSmrgAC_ARG_WITH(fop,
228974b97a6cSmrg	AS_HELP_STRING([--with-fop],
229074b97a6cSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229174b97a6cSmrg	   [use_fop=$withval], [use_fop=]_defopt)
229274b97a6cSmrgm4_undefine([_defopt])
229374b97a6cSmrg
229474b97a6cSmrgif test "x$use_fop" = x"auto"; then
229574b97a6cSmrg   AC_PATH_PROG([FOP], [fop])
229674b97a6cSmrg   if test "x$FOP" = "x"; then
229774b97a6cSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229874b97a6cSmrg	have_fop=no
229974b97a6cSmrg   else
230074b97a6cSmrg        have_fop=yes
230174b97a6cSmrg   fi
230274b97a6cSmrgelif test "x$use_fop" = x"yes" ; then
230374b97a6cSmrg   AC_PATH_PROG([FOP], [fop])
230474b97a6cSmrg   if test "x$FOP" = "x"; then
230574b97a6cSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230674b97a6cSmrg   fi
230774b97a6cSmrg   have_fop=yes
230874b97a6cSmrgelif test "x$use_fop" = x"no" ; then
230974b97a6cSmrg   if test "x$FOP" != "x"; then
231074b97a6cSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231174b97a6cSmrg   fi
231274b97a6cSmrg   have_fop=no
231306ef0fecSmrgelse
231474b97a6cSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315320e696bSmrgfi
2316320e696bSmrg
231774b97a6cSmrg# Test for a minimum version of fop, if provided.
231874b97a6cSmrgm4_ifval([$1],
231974b97a6cSmrg[if test "$have_fop" = yes; then
232074b97a6cSmrg    # scrape the fop version
232174b97a6cSmrg    AC_MSG_CHECKING([for fop minimum version])
232274b97a6cSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232374b97a6cSmrg    AC_MSG_RESULT([$fop_version])
232474b97a6cSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
232574b97a6cSmrg        [if test "x$use_fop" = xauto; then
232674b97a6cSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232774b97a6cSmrg            have_fop=no
232874b97a6cSmrg        else
232974b97a6cSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233074b97a6cSmrg        fi])
233174b97a6cSmrgfi])
233274b97a6cSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233374b97a6cSmrg]) # XORG_WITH_FOP
233474b97a6cSmrg
233574b97a6cSmrg# XORG_WITH_M4([MIN-VERSION])
233674b97a6cSmrg# ---------------------------
233774b97a6cSmrg# Minimum version: 1.19.0
233874b97a6cSmrg#
233974b97a6cSmrg# This macro attempts to locate an m4 macro processor which supports
234074b97a6cSmrg# -I option and is only useful for modules relying on M4 in order to
234174b97a6cSmrg# expand macros in source code files.
234274b97a6cSmrg#
234374b97a6cSmrg# Interface to module:
234474b97a6cSmrg# M4:	 	returns the path of the m4 program found
234574b97a6cSmrg#		returns the path set by the user in the environment
234674b97a6cSmrg#
234774b97a6cSmrgAC_DEFUN([XORG_WITH_M4], [
234874b97a6cSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234974b97a6cSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235074b97a6cSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235174b97a6cSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235274b97a6cSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235374b97a6cSmrg   [$PATH:/usr/gnu/bin])])
235406ef0fecSmrg
235574b97a6cSmrgAC_SUBST([M4], [$ac_cv_path_M4])
235674b97a6cSmrg]) # XORG_WITH_M4
235706ef0fecSmrg
235874b97a6cSmrg# XORG_WITH_PS2PDF([DEFAULT])
235974b97a6cSmrg# ----------------
236074b97a6cSmrg# Minimum version: 1.6.0
236174b97a6cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
236274b97a6cSmrg#
236374b97a6cSmrg# Documentation tools are not always available on all platforms and sometimes
236474b97a6cSmrg# not at the appropriate level. This macro enables a module to test for the
236574b97a6cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
23666728f30eSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
236774b97a6cSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236874b97a6cSmrg# --with-ps2pdf assumes 'auto'.
236974b97a6cSmrg#
237074b97a6cSmrg# Interface to module:
237174b97a6cSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237274b97a6cSmrg# PS2PDF:	returns the path of the ps2pdf program found
237374b97a6cSmrg#		returns the path set by the user in the environment
237474b97a6cSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237574b97a6cSmrg#		 'no' user instructs the module not to use ps2pdf
237674b97a6cSmrg#
237774b97a6cSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237874b97a6cSmrg#
237974b97a6cSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238074b97a6cSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238174b97a6cSmrgm4_define([_defopt], m4_default([$1], [auto]))
238274b97a6cSmrgAC_ARG_WITH(ps2pdf,
238374b97a6cSmrg	AS_HELP_STRING([--with-ps2pdf],
238474b97a6cSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238574b97a6cSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238674b97a6cSmrgm4_undefine([_defopt])
238706ef0fecSmrg
238874b97a6cSmrgif test "x$use_ps2pdf" = x"auto"; then
238974b97a6cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239074b97a6cSmrg   if test "x$PS2PDF" = "x"; then
239174b97a6cSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239274b97a6cSmrg	have_ps2pdf=no
239374b97a6cSmrg   else
239474b97a6cSmrg        have_ps2pdf=yes
239574b97a6cSmrg   fi
239674b97a6cSmrgelif test "x$use_ps2pdf" = x"yes" ; then
239774b97a6cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239874b97a6cSmrg   if test "x$PS2PDF" = "x"; then
239974b97a6cSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240074b97a6cSmrg   fi
240174b97a6cSmrg   have_ps2pdf=yes
240274b97a6cSmrgelif test "x$use_ps2pdf" = x"no" ; then
240374b97a6cSmrg   if test "x$PS2PDF" != "x"; then
240474b97a6cSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240574b97a6cSmrg   fi
240674b97a6cSmrg   have_ps2pdf=no
240774b97a6cSmrgelse
240874b97a6cSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409320e696bSmrgfi
241074b97a6cSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241174b97a6cSmrg]) # XORG_WITH_PS2PDF
241206ef0fecSmrg
241374b97a6cSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
241474b97a6cSmrg# ----------------
241574b97a6cSmrg# Minimum version: 1.6.0
241606ef0fecSmrg#
241774b97a6cSmrg# Documentation tools are not always available on all platforms and sometimes
241874b97a6cSmrg# not at the appropriate level. This macro enables a builder to skip all
241974b97a6cSmrg# documentation targets except traditional man pages.
242074b97a6cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24216728f30eSmrg# maximum flexibility in controlling documentation building.
242274b97a6cSmrg# Refer to:
242374b97a6cSmrg# XORG_WITH_XMLTO         --with-xmlto
242474b97a6cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242574b97a6cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
242674b97a6cSmrg# XORG_WITH_FOP           --with-fop
242774b97a6cSmrg# XORG_WITH_GROFF         --with-groff
242874b97a6cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
242974b97a6cSmrg#
243074b97a6cSmrg# Interface to module:
243174b97a6cSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243274b97a6cSmrg# --enable-docs: 'yes' user instructs the module to generate docs
243374b97a6cSmrg#		 'no' user instructs the module not to generate docs
243474b97a6cSmrg# parm1:	specify the default value, yes or no.
243574b97a6cSmrg#
243674b97a6cSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243774b97a6cSmrgm4_define([docs_default], m4_default([$1], [yes]))
243874b97a6cSmrgAC_ARG_ENABLE(docs,
243974b97a6cSmrg	AS_HELP_STRING([--enable-docs],
244074b97a6cSmrg	   [Enable building the documentation (default: ]docs_default[)]),
244174b97a6cSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
244274b97a6cSmrgm4_undefine([docs_default])
244374b97a6cSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244474b97a6cSmrgAC_MSG_CHECKING([whether to build documentation])
244574b97a6cSmrgAC_MSG_RESULT([$build_docs])
244674b97a6cSmrg]) # XORG_ENABLE_DOCS
244706ef0fecSmrg
244874b97a6cSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244974b97a6cSmrg# ----------------
245074b97a6cSmrg# Minimum version: 1.6.0
245174b97a6cSmrg#
245274b97a6cSmrg# This macro enables a builder to skip all developer documentation.
245374b97a6cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24546728f30eSmrg# maximum flexibility in controlling documentation building.
245574b97a6cSmrg# Refer to:
245674b97a6cSmrg# XORG_WITH_XMLTO         --with-xmlto
245774b97a6cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245874b97a6cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
245974b97a6cSmrg# XORG_WITH_FOP           --with-fop
246074b97a6cSmrg# XORG_WITH_GROFF         --with-groff
246174b97a6cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
246274b97a6cSmrg#
246374b97a6cSmrg# Interface to module:
246474b97a6cSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246574b97a6cSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246674b97a6cSmrg#			'no' user instructs the module not to generate developer docs
246774b97a6cSmrg# parm1:		specify the default value, yes or no.
246874b97a6cSmrg#
246974b97a6cSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247074b97a6cSmrgm4_define([devel_default], m4_default([$1], [yes]))
247174b97a6cSmrgAC_ARG_ENABLE(devel-docs,
247274b97a6cSmrg	AS_HELP_STRING([--enable-devel-docs],
247374b97a6cSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247474b97a6cSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247574b97a6cSmrgm4_undefine([devel_default])
247674b97a6cSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247774b97a6cSmrgAC_MSG_CHECKING([whether to build developer documentation])
247874b97a6cSmrgAC_MSG_RESULT([$build_devel_docs])
247974b97a6cSmrg]) # XORG_ENABLE_DEVEL_DOCS
248006ef0fecSmrg
248174b97a6cSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
248274b97a6cSmrg# ----------------
248374b97a6cSmrg# Minimum version: 1.6.0
248474b97a6cSmrg#
248574b97a6cSmrg# This macro enables a builder to skip all functional specification targets.
248674b97a6cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24876728f30eSmrg# maximum flexibility in controlling documentation building.
248874b97a6cSmrg# Refer to:
248974b97a6cSmrg# XORG_WITH_XMLTO         --with-xmlto
249074b97a6cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249174b97a6cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
249274b97a6cSmrg# XORG_WITH_FOP           --with-fop
249374b97a6cSmrg# XORG_WITH_GROFF         --with-groff
249474b97a6cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
249574b97a6cSmrg#
249674b97a6cSmrg# Interface to module:
249774b97a6cSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249874b97a6cSmrg# --enable-specs:	'yes' user instructs the module to generate specs
249974b97a6cSmrg#			'no' user instructs the module not to generate specs
250074b97a6cSmrg# parm1:		specify the default value, yes or no.
250174b97a6cSmrg#
250274b97a6cSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250374b97a6cSmrgm4_define([spec_default], m4_default([$1], [yes]))
250474b97a6cSmrgAC_ARG_ENABLE(specs,
250574b97a6cSmrg	AS_HELP_STRING([--enable-specs],
250674b97a6cSmrg	   [Enable building the specs (default: ]spec_default[)]),
250774b97a6cSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
250874b97a6cSmrgm4_undefine([spec_default])
250974b97a6cSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251074b97a6cSmrgAC_MSG_CHECKING([whether to build functional specifications])
251174b97a6cSmrgAC_MSG_RESULT([$build_specs])
251274b97a6cSmrg]) # XORG_ENABLE_SPECS
251306ef0fecSmrg
251474b97a6cSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251574b97a6cSmrg# ----------------------------------------------
251674b97a6cSmrg# Minimum version: 1.13.0
251706ef0fecSmrg#
251874b97a6cSmrg# This macro enables a builder to enable/disable unit testing
251974b97a6cSmrg# It makes no assumption about the test cases implementation
252074b97a6cSmrg# Test cases may or may not use Automake "Support for test suites"
252174b97a6cSmrg# They may or may not use the software utility library GLib
252274b97a6cSmrg#
252374b97a6cSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252474b97a6cSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252574b97a6cSmrg# The variable enable_unit_tests is used by other macros in this file.
252674b97a6cSmrg#
252774b97a6cSmrg# Interface to module:
252874b97a6cSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252974b97a6cSmrg# enable_unit_tests:    used in configure.ac for additional configuration
253074b97a6cSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253174b97a6cSmrg#			'no' user instructs the module not to build tests
253274b97a6cSmrg# parm1:		specify the default value, yes or no.
253374b97a6cSmrg#
253474b97a6cSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253574b97a6cSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253674b97a6cSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253774b97a6cSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253874b97a6cSmrgm4_define([_defopt], m4_default([$1], [auto]))
253974b97a6cSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254074b97a6cSmrg	[Enable building unit test cases (default: ]_defopt[)]),
254174b97a6cSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254274b97a6cSmrgm4_undefine([_defopt])
254374b97a6cSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254474b97a6cSmrgAC_MSG_CHECKING([whether to build unit test cases])
254574b97a6cSmrgAC_MSG_RESULT([$enable_unit_tests])
254674b97a6cSmrg]) # XORG_ENABLE_UNIT_TESTS
254706ef0fecSmrg
254874b97a6cSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254974b97a6cSmrg# ------------------------------------------------------
255074b97a6cSmrg# Minimum version: 1.17.0
255174b97a6cSmrg#
255274b97a6cSmrg# This macro enables a builder to enable/disable integration testing
255374b97a6cSmrg# It makes no assumption about the test cases' implementation
255474b97a6cSmrg# Test cases may or may not use Automake "Support for test suites"
255574b97a6cSmrg#
255674b97a6cSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255774b97a6cSmrg# usually requires less dependencies and may be built and run under less
255874b97a6cSmrg# stringent environments than integration tests.
255974b97a6cSmrg#
256074b97a6cSmrg# Interface to module:
256174b97a6cSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256274b97a6cSmrg# enable_integration_tests:   used in configure.ac for additional configuration
256374b97a6cSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256474b97a6cSmrg#                             'no' user instructs the module not to build tests
256574b97a6cSmrg# parm1:                      specify the default value, yes or no.
256674b97a6cSmrg#
256774b97a6cSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256874b97a6cSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256974b97a6cSmrgm4_define([_defopt], m4_default([$1], [auto]))
257074b97a6cSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257174b97a6cSmrg	[Enable building integration test cases (default: ]_defopt[)]),
257274b97a6cSmrg	[enable_integration_tests=$enableval],
257374b97a6cSmrg	[enable_integration_tests=]_defopt)
257474b97a6cSmrgm4_undefine([_defopt])
257574b97a6cSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257674b97a6cSmrg	[test "x$enable_integration_tests" != xno])
257774b97a6cSmrgAC_MSG_CHECKING([whether to build unit test cases])
257874b97a6cSmrgAC_MSG_RESULT([$enable_integration_tests])
257974b97a6cSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
258006ef0fecSmrg
258174b97a6cSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258274b97a6cSmrg# ----------------------------------------
258374b97a6cSmrg# Minimum version: 1.13.0
258474b97a6cSmrg#
258574b97a6cSmrg# GLib is a library which provides advanced data structures and functions.
258674b97a6cSmrg# This macro enables a module to test for the presence of Glib.
258774b97a6cSmrg#
258874b97a6cSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258974b97a6cSmrg# Otherwise the value of $enable_unit_tests is blank.
259074b97a6cSmrg#
259174b97a6cSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259274b97a6cSmrg# test support usually requires less dependencies and may be built and run under
259374b97a6cSmrg# less stringent environments than integration tests.
259406ef0fecSmrg#
259574b97a6cSmrg# Interface to module:
259674b97a6cSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
259774b97a6cSmrg# with_glib: used in configure.ac to know if GLib has been found
259874b97a6cSmrg# --with-glib:	'yes' user instructs the module to use glib
259974b97a6cSmrg#		'no' user instructs the module not to use glib
260074b97a6cSmrg#
260174b97a6cSmrgAC_DEFUN([XORG_WITH_GLIB],[
260274b97a6cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260374b97a6cSmrgm4_define([_defopt], m4_default([$2], [auto]))
260474b97a6cSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260574b97a6cSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260674b97a6cSmrg	[with_glib=$withval], [with_glib=]_defopt)
260774b97a6cSmrgm4_undefine([_defopt])
260806ef0fecSmrg
260974b97a6cSmrghave_glib=no
261074b97a6cSmrg# Do not probe GLib if user explicitly disabled unit testing
261174b97a6cSmrgif test "x$enable_unit_tests" != x"no"; then
261274b97a6cSmrg  # Do not probe GLib if user explicitly disabled it
261374b97a6cSmrg  if test "x$with_glib" != x"no"; then
261474b97a6cSmrg    m4_ifval(
261574b97a6cSmrg      [$1],
261674b97a6cSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261774b97a6cSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261874b97a6cSmrg    )
2619320e696bSmrg  fi
2620320e696bSmrgfi
2621320e696bSmrg
262274b97a6cSmrg# Not having GLib when unit testing has been explicitly requested is an error
262374b97a6cSmrgif test "x$enable_unit_tests" = x"yes"; then
262474b97a6cSmrg  if test "x$have_glib" = x"no"; then
262574b97a6cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626320e696bSmrg  fi
2627320e696bSmrgfi
2628320e696bSmrg
262974b97a6cSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
263074b97a6cSmrgif test "x$enable_unit_tests" = x"no"; then
263174b97a6cSmrg  if test "x$with_glib" = x"yes"; then
263274b97a6cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263374b97a6cSmrg  fi
263474b97a6cSmrgfi
2635320e696bSmrg
263674b97a6cSmrg# Not having GLib when it has been explicitly requested is an error
263774b97a6cSmrgif test "x$with_glib" = x"yes"; then
263874b97a6cSmrg  if test "x$have_glib" = x"no"; then
263974b97a6cSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264074b97a6cSmrg  fi
264174b97a6cSmrgfi
2642320e696bSmrg
264374b97a6cSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264474b97a6cSmrg]) # XORG_WITH_GLIB
2645320e696bSmrg
264674b97a6cSmrg# XORG_LD_WRAP([required|optional])
264774b97a6cSmrg# ---------------------------------
264874b97a6cSmrg# Minimum version: 1.13.0
264974b97a6cSmrg#
265074b97a6cSmrg# Check if linker supports -wrap, passed via compiler flags
265174b97a6cSmrg#
265274b97a6cSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265374b97a6cSmrg# Otherwise the value of $enable_unit_tests is blank.
265474b97a6cSmrg#
265574b97a6cSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265674b97a6cSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265774b97a6cSmrg# available, an argument of "optional" allows use when some unit tests require
265874b97a6cSmrg# ld -wrap and others do not.
265974b97a6cSmrg#
266074b97a6cSmrgAC_DEFUN([XORG_LD_WRAP],[
266174b97a6cSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266274b97a6cSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266374b97a6cSmrg                      void __wrap_exit(int status) { return; }],
266474b97a6cSmrg                     [exit(0);])])
266574b97a6cSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
266674b97a6cSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266774b97a6cSmrg  if test "x$have_ld_wrap" = x"no"; then
266874b97a6cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266974b97a6cSmrg  fi
267074b97a6cSmrgfi
267174b97a6cSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267274b97a6cSmrg#
267374b97a6cSmrg]) # XORG_LD_WRAP
2674320e696bSmrg
267574b97a6cSmrg# XORG_CHECK_LINKER_FLAGS
267674b97a6cSmrg# -----------------------
267774b97a6cSmrg# SYNOPSIS
267874b97a6cSmrg#
267974b97a6cSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268074b97a6cSmrg#
268174b97a6cSmrg# DESCRIPTION
268274b97a6cSmrg#
268374b97a6cSmrg#   Check whether the given linker FLAGS work with the current language's
268474b97a6cSmrg#   linker, or whether they give an error.
268574b97a6cSmrg#
268674b97a6cSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268774b97a6cSmrg#   success/failure.
268874b97a6cSmrg#
268974b97a6cSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
269074b97a6cSmrg#
269174b97a6cSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269274b97a6cSmrg#
269374b97a6cSmrg# LICENSE
269474b97a6cSmrg#
269574b97a6cSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269674b97a6cSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269774b97a6cSmrg#   Copyright (c) 2009 Matteo Frigo
269874b97a6cSmrg#
269974b97a6cSmrg#   This program is free software: you can redistribute it and/or modify it
270074b97a6cSmrg#   under the terms of the GNU General Public License as published by the
270174b97a6cSmrg#   Free Software Foundation, either version 3 of the License, or (at your
270274b97a6cSmrg#   option) any later version.
270374b97a6cSmrg#
270474b97a6cSmrg#   This program is distributed in the hope that it will be useful, but
270574b97a6cSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270674b97a6cSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270774b97a6cSmrg#   Public License for more details.
270874b97a6cSmrg#
270974b97a6cSmrg#   You should have received a copy of the GNU General Public License along
271074b97a6cSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271174b97a6cSmrg#
271274b97a6cSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
271374b97a6cSmrg#   gives unlimited permission to copy, distribute and modify the configure
271474b97a6cSmrg#   scripts that are the output of Autoconf when processing the Macro. You
271574b97a6cSmrg#   need not follow the terms of the GNU General Public License when using
271674b97a6cSmrg#   or distributing such scripts, even though portions of the text of the
271774b97a6cSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271874b97a6cSmrg#   all other use of the material that constitutes the Autoconf Macro.
271974b97a6cSmrg#
272074b97a6cSmrg#   This special exception to the GPL applies to versions of the Autoconf
272174b97a6cSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
272274b97a6cSmrg#   modified version of the Autoconf Macro, you may extend this special
272374b97a6cSmrg#   exception to the GPL to apply to your modified version as well.#
272474b97a6cSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272574b97a6cSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
272674b97a6cSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272774b97a6cSmrgAS_LITERAL_IF([$1],
272874b97a6cSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272974b97a6cSmrg      ax_save_FLAGS=$LDFLAGS
273074b97a6cSmrg      LDFLAGS="$1"
273174b97a6cSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273274b97a6cSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273374b97a6cSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273474b97a6cSmrg      LDFLAGS=$ax_save_FLAGS])],
273574b97a6cSmrg  [ax_save_FLAGS=$LDFLAGS
273674b97a6cSmrg   LDFLAGS="$1"
273774b97a6cSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273874b97a6cSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273974b97a6cSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274074b97a6cSmrg   LDFLAGS=$ax_save_FLAGS])
274174b97a6cSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274274b97a6cSmrgAC_MSG_RESULT($xorg_check_linker_flags)
274374b97a6cSmrgif test "x$xorg_check_linker_flags" = xyes; then
274474b97a6cSmrg	m4_default([$2], :)
274574b97a6cSmrgelse
274674b97a6cSmrg	m4_default([$3], :)
274774b97a6cSmrgfi
274874b97a6cSmrg]) # XORG_CHECK_LINKER_FLAGS
2749320e696bSmrg
275074b97a6cSmrg# XORG_MEMORY_CHECK_FLAGS
275174b97a6cSmrg# -----------------------
275274b97a6cSmrg# Minimum version: 1.16.0
275374b97a6cSmrg#
275474b97a6cSmrg# This macro attempts to find appropriate memory checking functionality
275574b97a6cSmrg# for various platforms which unit testing code may use to catch various
275674b97a6cSmrg# forms of memory allocation and access errors in testing.
275774b97a6cSmrg#
275874b97a6cSmrg# Interface to module:
275974b97a6cSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276074b97a6cSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276174b97a6cSmrg#
276274b97a6cSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276374b97a6cSmrg#
276474b97a6cSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765afe13c8eSmrg
276674b97a6cSmrgAC_REQUIRE([AC_CANONICAL_HOST])
276774b97a6cSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276874b97a6cSmrg           [Environment variables to enable memory checking in tests])
27695e358ecaSmrg
277074b97a6cSmrg# Check for different types of support on different platforms
277174b97a6cSmrgcase $host_os in
277274b97a6cSmrg    solaris*)
277374b97a6cSmrg        AC_CHECK_LIB([umem], [umem_alloc],
277474b97a6cSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277574b97a6cSmrg        ;;
277674b97a6cSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277774b97a6cSmrg        # both directly and inverted, so should not be 0 or 255.
277874b97a6cSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
277974b97a6cSmrg        ;;
278074b97a6cSmrg    darwin*)
278174b97a6cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278274b97a6cSmrg        ;;
278374b97a6cSmrg    *bsd*)
278474b97a6cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278574b97a6cSmrg        ;;
278674b97a6cSmrgesac
278706ef0fecSmrg
278874b97a6cSmrg# User supplied flags override default flags
278974b97a6cSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279074b97a6cSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791b3307321Smrgfi
2792b3307321Smrg
279374b97a6cSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279474b97a6cSmrg]) # XORG_WITH_LINT
279529cb5710Smrg
279674b97a6cSmrg# XORG_CHECK_MALLOC_ZERO
279774b97a6cSmrg# ----------------------
279874b97a6cSmrg# Minimum version: 1.0.0
279906ef0fecSmrg#
280074b97a6cSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280174b97a6cSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280274b97a6cSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280374b97a6cSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280474b97a6cSmrgAC_ARG_ENABLE(malloc0returnsnull,
280574b97a6cSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280674b97a6cSmrg		       [malloc(0) returns NULL (default: auto)]),
280774b97a6cSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280874b97a6cSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
280929cb5710Smrg
281074b97a6cSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281174b97a6cSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281274b97a6cSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281374b97a6cSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281474b97a6cSmrg#include <stdlib.h>
281574b97a6cSmrg],[
281674b97a6cSmrg    char *m0, *r0, *c0, *p;
281774b97a6cSmrg    m0 = malloc(0);
281874b97a6cSmrg    p = malloc(10);
281974b97a6cSmrg    r0 = realloc(p,0);
282074b97a6cSmrg    c0 = calloc(0,10);
282174b97a6cSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282274b97a6cSmrg])],
282374b97a6cSmrg		[xorg_cv_malloc0_returns_null=yes],
282474b97a6cSmrg		[xorg_cv_malloc0_returns_null=no])])
282574b97a6cSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28265e358ecaSmrgfi
282774b97a6cSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828b3307321Smrg
282974b97a6cSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283074b97a6cSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283174b97a6cSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283274b97a6cSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
283306ef0fecSmrgelse
283474b97a6cSmrg	MALLOC_ZERO_CFLAGS=""
283574b97a6cSmrg	XMALLOC_ZERO_CFLAGS=""
283674b97a6cSmrg	XTMALLOC_ZERO_CFLAGS=""
283706ef0fecSmrgfi
2838b3307321Smrg
283974b97a6cSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284074b97a6cSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284174b97a6cSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284274b97a6cSmrg]) # XORG_CHECK_MALLOC_ZERO
2843b3307321Smrg
284474b97a6cSmrg# XORG_WITH_LINT()
284574b97a6cSmrg# ----------------
284674b97a6cSmrg# Minimum version: 1.1.0
28475e358ecaSmrg#
284874b97a6cSmrg# This macro enables the use of a tool that flags some suspicious and
284974b97a6cSmrg# non-portable constructs (likely to be bugs) in C language source code.
285074b97a6cSmrg# It will attempt to locate the tool and use appropriate options.
285174b97a6cSmrg# There are various lint type tools on different platforms.
2852320e696bSmrg#
285374b97a6cSmrg# Interface to module:
285474b97a6cSmrg# LINT:		returns the path to the tool found on the platform
285574b97a6cSmrg#		or the value set to LINT on the configure cmd line
285674b97a6cSmrg#		also an Automake conditional
285774b97a6cSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
285874b97a6cSmrg#
285974b97a6cSmrg# --with-lint:	'yes' user instructs the module to use lint
286074b97a6cSmrg#		'no' user instructs the module not to use lint (default)
286174b97a6cSmrg#
286274b97a6cSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286374b97a6cSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286474b97a6cSmrg#
286574b97a6cSmrgAC_DEFUN([XORG_WITH_LINT],[
286674a3f230Smrg
286774b97a6cSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286874b97a6cSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286974b97a6cSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287074b97a6cSmrg		[Use a lint-style source code checker (default: disabled)])],
287174b97a6cSmrg		[use_lint=$withval], [use_lint=no])
2872320e696bSmrg
287374b97a6cSmrg# Obtain platform specific info like program name and options
287474b97a6cSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287574b97a6cSmrgcase $host_os in
287674b97a6cSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287774b97a6cSmrg	lint_name=splint
287874b97a6cSmrg	lint_options="-badflag"
287974b97a6cSmrg	;;
288074b97a6cSmrg  *freebsd* | *netbsd*)
288174b97a6cSmrg	lint_name=lint
288274b97a6cSmrg	lint_options="-u -b"
288374b97a6cSmrg	;;
288474b97a6cSmrg  *solaris*)
288574b97a6cSmrg	lint_name=lint
288674b97a6cSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288774b97a6cSmrg	;;
288874b97a6cSmrgesac
288974b97a6cSmrg
289074b97a6cSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289174b97a6cSmrgif test "x$use_lint" = x"yes" ; then
289274b97a6cSmrg   AC_PATH_PROG([LINT], [$lint_name])
289374b97a6cSmrg   if test "x$LINT" = "x"; then
289474b97a6cSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289574b97a6cSmrg   fi
289674b97a6cSmrgelif test "x$use_lint" = x"no" ; then
289774b97a6cSmrg   if test "x$LINT" != "x"; then
289874b97a6cSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289974b97a6cSmrg   fi
290006ef0fecSmrgelse
290174b97a6cSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902320e696bSmrgfi
2903320e696bSmrg
290474b97a6cSmrg# User supplied flags override default flags
290574b97a6cSmrgif test "x$LINT_FLAGS" != "x"; then
290674b97a6cSmrg   lint_options=$LINT_FLAGS
290774b97a6cSmrgfi
2908320e696bSmrg
290974b97a6cSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291074b97a6cSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911320e696bSmrg
291274b97a6cSmrg]) # XORG_WITH_LINT
2913320e696bSmrg
291474b97a6cSmrg# XORG_LINT_LIBRARY(LIBNAME)
291574b97a6cSmrg# --------------------------
291674b97a6cSmrg# Minimum version: 1.1.0
2917320e696bSmrg#
291874b97a6cSmrg# Sets up flags for building lint libraries for checking programs that call
291974b97a6cSmrg# functions in the library.
292074b97a6cSmrg#
292174b97a6cSmrg# Interface to module:
292274b97a6cSmrg# LINTLIB		- Automake variable with the name of lint library file to make
292374b97a6cSmrg# MAKE_LINT_LIB		- Automake conditional
292474b97a6cSmrg#
292574b97a6cSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292674b97a6cSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2927320e696bSmrg
292874b97a6cSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292974b97a6cSmrgAC_REQUIRE([XORG_WITH_LINT])
293074b97a6cSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293174b97a6cSmrg	[Create lint library (default: disabled)])],
293274b97a6cSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293374b97a6cSmrg
293474b97a6cSmrgif test "x$make_lint_lib" = x"yes" ; then
293574b97a6cSmrg   LINTLIB=llib-l$1.ln
293674b97a6cSmrg   if test "x$LINT" = "x"; then
293774b97a6cSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293874b97a6cSmrg   fi
293974b97a6cSmrgelif test "x$make_lint_lib" != x"no" ; then
294074b97a6cSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941320e696bSmrgfi
2942320e696bSmrg
294374b97a6cSmrgAC_SUBST(LINTLIB)
294474b97a6cSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
294506ef0fecSmrg
294674b97a6cSmrg]) # XORG_LINT_LIBRARY
294706ef0fecSmrg
294874b97a6cSmrg# XORG_COMPILER_BRAND
294906ef0fecSmrg# -------------------
295074b97a6cSmrg# Minimum version: 1.14.0
295106ef0fecSmrg#
295274b97a6cSmrg# Checks for various brands of compilers and sets flags as appropriate:
295374b97a6cSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295474b97a6cSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295574b97a6cSmrg#   clang compiler - sets CLANGCC to "yes"
295674b97a6cSmrg#   Intel compiler - sets INTELCC to "yes"
295774b97a6cSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295874b97a6cSmrg#
295974b97a6cSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296074b97a6cSmrgAC_LANG_CASE(
296174b97a6cSmrg	[C], [
29626728f30eSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29636728f30eSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
29646728f30eSmrg		m4_version_prereq([2.70],
29656728f30eSmrg			[AC_REQUIRE([AC_PROG_CC])],
29666728f30eSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
296774b97a6cSmrg	],
296874b97a6cSmrg	[C++], [
296974b97a6cSmrg		AC_REQUIRE([AC_PROG_CXX])
297074b97a6cSmrg	]
297174b97a6cSmrg)
297274b97a6cSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
297374b97a6cSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297474b97a6cSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297574b97a6cSmrg]) # XORG_COMPILER_BRAND
2976320e696bSmrg
297774b97a6cSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
297806ef0fecSmrg# ---------------
297974b97a6cSmrg# Minimum version: 1.16.0
298074b97a6cSmrg#
298174b97a6cSmrg# Test if the compiler works when passed the given flag as a command line argument.
29826728f30eSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
298374b97a6cSmrg# next flag in the list until there are no more options.
298474b97a6cSmrg#
298574b97a6cSmrg# Note that this does not guarantee that the compiler supports the flag as some
298674b97a6cSmrg# compilers will simply ignore arguments that they do not understand, but we do
298774b97a6cSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298874b97a6cSmrg# -Werror=unused-command-line-argument
298974b97a6cSmrg#
299074b97a6cSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
299174b97a6cSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
299274b97a6cSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993320e696bSmrg
299474b97a6cSmrgAC_LANG_COMPILER_REQUIRE
2995320e696bSmrg
299674b97a6cSmrgAC_LANG_CASE(
299774b97a6cSmrg	[C], [
29986728f30eSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29996728f30eSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
30006728f30eSmrg		m4_version_prereq([2.70],
30016728f30eSmrg			[AC_REQUIRE([AC_PROG_CC])],
30026728f30eSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
300374b97a6cSmrg		define([PREFIX], [C])
300474b97a6cSmrg		define([CACHE_PREFIX], [cc])
300574b97a6cSmrg		define([COMPILER], [$CC])
300674b97a6cSmrg	],
300774b97a6cSmrg	[C++], [
300874b97a6cSmrg		define([PREFIX], [CXX])
300974b97a6cSmrg		define([CACHE_PREFIX], [cxx])
301074b97a6cSmrg		define([COMPILER], [$CXX])
301174b97a6cSmrg	]
301274b97a6cSmrg)
301374b97a6cSmrg
301474b97a6cSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
301574b97a6cSmrg
301674b97a6cSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
301774b97a6cSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301874b97a6cSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301974b97a6cSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
302074b97a6cSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302174b97a6cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
302274b97a6cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
302374b97a6cSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
302474b97a6cSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
302506ef0fecSmrgfi
302674b97a6cSmrg
302774b97a6cSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302874b97a6cSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302974b97a6cSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303074b97a6cSmrg	fi
303174b97a6cSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
303274b97a6cSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
303374b97a6cSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
303474b97a6cSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
303574b97a6cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
303674b97a6cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
303774b97a6cSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303874b97a6cSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303974b97a6cSmrgfi
304074b97a6cSmrg
304174b97a6cSmrgfound="no"
304274b97a6cSmrgm4_foreach([flag], m4_cdr($@), [
304374b97a6cSmrg	if test $found = "no" ; then
304474b97a6cSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
304574b97a6cSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
304674b97a6cSmrg		fi
304774b97a6cSmrg
304874b97a6cSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304974b97a6cSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
305074b97a6cSmrg		fi
305174b97a6cSmrg
305274b97a6cSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
305374b97a6cSmrg
305474b97a6cSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
305574b97a6cSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
305674b97a6cSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
305774b97a6cSmrg		AC_CACHE_VAL($cacheid,
305874b97a6cSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305974b97a6cSmrg					     [eval $cacheid=yes],
306074b97a6cSmrg					     [eval $cacheid=no])])
306174b97a6cSmrg
306274b97a6cSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
306374b97a6cSmrg
306474b97a6cSmrg		eval supported=\$$cacheid
306574b97a6cSmrg		AC_MSG_RESULT([$supported])
306674b97a6cSmrg		if test "$supported" = "yes" ; then
306774b97a6cSmrg			$1="$$1 ]flag["
306874b97a6cSmrg			found="yes"
306974b97a6cSmrg		fi
307074b97a6cSmrg	fi
307106ef0fecSmrg])
307274b97a6cSmrg]) # XORG_TESTSET_CFLAG
307374a3f230Smrg
307474b97a6cSmrg# XORG_COMPILER_FLAGS
307574b97a6cSmrg# ---------------
307674b97a6cSmrg# Minimum version: 1.16.0
3077320e696bSmrg#
307874b97a6cSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307974b97a6cSmrg# arguments supported by the selected compiler which do NOT alter the generated
308074b97a6cSmrg# code.  These arguments will cause the compiler to print various warnings
308174b97a6cSmrg# during compilation AND turn a conservative set of warnings into errors.
308274b97a6cSmrg#
308374b97a6cSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
308474b97a6cSmrg# future versions of util-macros as options are added to new compilers.
308574b97a6cSmrg#
308674b97a6cSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
308774b97a6cSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3088b3307321Smrg
308974b97a6cSmrgAC_ARG_ENABLE(selective-werror,
309074b97a6cSmrg              AS_HELP_STRING([--disable-selective-werror],
309174b97a6cSmrg                             [Turn off selective compiler errors. (default: enabled)]),
309274b97a6cSmrg              [SELECTIVE_WERROR=$enableval],
309374b97a6cSmrg              [SELECTIVE_WERROR=yes])
309474b97a6cSmrg
309574b97a6cSmrgAC_LANG_CASE(
309674b97a6cSmrg        [C], [
309774b97a6cSmrg                define([PREFIX], [C])
309874b97a6cSmrg        ],
309974b97a6cSmrg        [C++], [
310074b97a6cSmrg                define([PREFIX], [CXX])
310174b97a6cSmrg        ]
310274b97a6cSmrg)
310374b97a6cSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
310474b97a6cSmrgif test "x$SUNCC" = "xyes"; then
310574b97a6cSmrg    [BASE_]PREFIX[FLAGS]="-v"
310606ef0fecSmrgelse
310774b97a6cSmrg    [BASE_]PREFIX[FLAGS]=""
310806ef0fecSmrgfi
310906ef0fecSmrg
311074b97a6cSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
311174b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
311274b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
311374b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
311474b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
311506ef0fecSmrg
311674b97a6cSmrgAC_LANG_CASE(
311774b97a6cSmrg	[C], [
311874b97a6cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311974b97a6cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
312074b97a6cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
312174b97a6cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
312274b97a6cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
312374b97a6cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
312474b97a6cSmrg	]
312574b97a6cSmrg)
31265e358ecaSmrg
312774b97a6cSmrg# This chunk adds additional warnings that could catch undesired effects.
312874b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312974b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
313074b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
313174b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
313274b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
313374b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
313474b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3135320e696bSmrg
313674b97a6cSmrg# These are currently disabled because they are noisy.  They will be enabled
313774b97a6cSmrg# in the future once the codebase is sufficiently modernized to silence
313874b97a6cSmrg# them.  For now, I don't want them to drown out the other warnings.
313974b97a6cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
314074b97a6cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
314174b97a6cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
314274a3f230Smrg
31436728f30eSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
314474b97a6cSmrg# when there are problems that should be fixed.
3145320e696bSmrg
314674b97a6cSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
314774b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314874b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314974b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
315074b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
315174b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
315274b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
315374b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
315474b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
315574b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
315674b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
315774b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315874b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315974b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
316074b97a6cSmrgelse
316174b97a6cSmrgAC_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])
316274b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
316374b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
316474b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
316574b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
316674b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
316774b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316874b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316974b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
317074b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
317174b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
317274b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
317374b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
317474b97a6cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
317574b97a6cSmrgfi
3176320e696bSmrg
317774b97a6cSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317874b97a6cSmrg]) # XORG_COMPILER_FLAGS
3179b3307321Smrg
318074b97a6cSmrg# XORG_CWARNFLAGS
318174b97a6cSmrg# ---------------
318274b97a6cSmrg# Minimum version: 1.2.0
318374b97a6cSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
31845e358ecaSmrg#
318574b97a6cSmrg# Defines CWARNFLAGS to enable C compiler warnings.
318629cb5710Smrg#
318774b97a6cSmrg# This function is deprecated because it defines -fno-strict-aliasing
318874b97a6cSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318974b97a6cSmrg# is needed, then it should be added explicitly in the module when
319074b97a6cSmrg# it is updated to use BASE_CFLAGS.
319129cb5710Smrg#
319274b97a6cSmrgAC_DEFUN([XORG_CWARNFLAGS], [
319374b97a6cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
319474b97a6cSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
319574b97a6cSmrgAC_LANG_CASE(
319674b97a6cSmrg	[C], [
319774b97a6cSmrg		CWARNFLAGS="$BASE_CFLAGS"
319874b97a6cSmrg		if  test "x$GCC" = xyes ; then
319974b97a6cSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
320074b97a6cSmrg		fi
320174b97a6cSmrg		AC_SUBST(CWARNFLAGS)
320274b97a6cSmrg	]
320374b97a6cSmrg)
320474b97a6cSmrg]) # XORG_CWARNFLAGS
3205b3307321Smrg
320674b97a6cSmrg# XORG_STRICT_OPTION
320774b97a6cSmrg# -----------------------
320874b97a6cSmrg# Minimum version: 1.3.0
320974b97a6cSmrg#
321074b97a6cSmrg# Add configure option to enable strict compilation flags, such as treating
321174b97a6cSmrg# warnings as fatal errors.
321274b97a6cSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
321374b97a6cSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
321474b97a6cSmrg#
321574b97a6cSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
321674b97a6cSmrg# when strict compilation is unconditionally desired.
321774b97a6cSmrgAC_DEFUN([XORG_STRICT_OPTION], [
321874b97a6cSmrgAC_REQUIRE([XORG_CWARNFLAGS])
321974b97a6cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
322006ef0fecSmrg
322174b97a6cSmrgAC_ARG_ENABLE(strict-compilation,
322274b97a6cSmrg			  AS_HELP_STRING([--enable-strict-compilation],
322374b97a6cSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
322474b97a6cSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
322506ef0fecSmrg
322674b97a6cSmrgAC_LANG_CASE(
322774b97a6cSmrg        [C], [
322874b97a6cSmrg                define([PREFIX], [C])
322974b97a6cSmrg        ],
323074b97a6cSmrg        [C++], [
323174b97a6cSmrg                define([PREFIX], [CXX])
323274b97a6cSmrg        ]
323374b97a6cSmrg)
323406ef0fecSmrg
323574b97a6cSmrg[STRICT_]PREFIX[FLAGS]=""
323674b97a6cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
323774b97a6cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
323806ef0fecSmrg
323974b97a6cSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
324074b97a6cSmrg# activate it with -Werror, so we add it here explicitly.
324174b97a6cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
324206ef0fecSmrg
324374b97a6cSmrgif test "x$STRICT_COMPILE" = "xyes"; then
324474b97a6cSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
324574b97a6cSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
324674b97a6cSmrgfi
324774b97a6cSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324874b97a6cSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324974b97a6cSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
325074b97a6cSmrg]) # XORG_STRICT_OPTION
325106ef0fecSmrg
32526728f30eSmrg# XORG_DEFAULT_NOCODE_OPTIONS
32536728f30eSmrg# ---------------------------
32546728f30eSmrg# Minimum version: 1.20.0
32556728f30eSmrg#
32566728f30eSmrg# Defines default options for X.Org modules which don't compile code,
32576728f30eSmrg# such as fonts, bitmaps, cursors, and docs.
32586728f30eSmrg#
32596728f30eSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
32606728f30eSmrgAC_REQUIRE([AC_PROG_INSTALL])
32616728f30eSmrgXORG_RELEASE_VERSION
32626728f30eSmrgXORG_CHANGELOG
32636728f30eSmrgXORG_INSTALL
32646728f30eSmrgXORG_MANPAGE_SECTIONS
32656728f30eSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32666728f30eSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32676728f30eSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
32686728f30eSmrg
326974b97a6cSmrg# XORG_DEFAULT_OPTIONS
327074b97a6cSmrg# --------------------
327174b97a6cSmrg# Minimum version: 1.3.0
327274b97a6cSmrg#
32736728f30eSmrg# Defines default options for X.Org modules which compile code.
327474b97a6cSmrg#
327574b97a6cSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
327674b97a6cSmrgAC_REQUIRE([AC_PROG_INSTALL])
327774b97a6cSmrgXORG_COMPILER_FLAGS
327874b97a6cSmrgXORG_CWARNFLAGS
327974b97a6cSmrgXORG_STRICT_OPTION
32806728f30eSmrgXORG_DEFAULT_NOCODE_OPTIONS
328174b97a6cSmrg]) # XORG_DEFAULT_OPTIONS
328206ef0fecSmrg
328374b97a6cSmrg# XORG_INSTALL()
328474b97a6cSmrg# ----------------
328574b97a6cSmrg# Minimum version: 1.4.0
328674b97a6cSmrg#
328774b97a6cSmrg# Defines the variable INSTALL_CMD as the command to copy
328874b97a6cSmrg# INSTALL from $prefix/share/util-macros.
328974b97a6cSmrg#
329074b97a6cSmrgAC_DEFUN([XORG_INSTALL], [
329174b97a6cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
329274b97a6cSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
329374b97a6cSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
329474b97a6cSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
329574b97a6cSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
329674b97a6cSmrgtouch \$(top_srcdir)/INSTALL; \
329774b97a6cSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
329874b97a6cSmrgAC_SUBST([INSTALL_CMD])
329974b97a6cSmrg]) # XORG_INSTALL
330074b97a6cSmrgdnl Copyright 2005 Red Hat, Inc
330174b97a6cSmrgdnl
330274b97a6cSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
330374b97a6cSmrgdnl documentation for any purpose is hereby granted without fee, provided that
330474b97a6cSmrgdnl the above copyright notice appear in all copies and that both that
330574b97a6cSmrgdnl copyright notice and this permission notice appear in supporting
330674b97a6cSmrgdnl documentation.
330774b97a6cSmrgdnl
330874b97a6cSmrgdnl The above copyright notice and this permission notice shall be included
330974b97a6cSmrgdnl in all copies or substantial portions of the Software.
331074b97a6cSmrgdnl
331174b97a6cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
331274b97a6cSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
331374b97a6cSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
331474b97a6cSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
331574b97a6cSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
331674b97a6cSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
331774b97a6cSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
331874b97a6cSmrgdnl
331974b97a6cSmrgdnl Except as contained in this notice, the name of the copyright holders shall
332074b97a6cSmrgdnl not be used in advertising or otherwise to promote the sale, use or
332174b97a6cSmrgdnl other dealings in this Software without prior written authorization
332274b97a6cSmrgdnl from the copyright holders.
332374b97a6cSmrgdnl
332406ef0fecSmrg
332574b97a6cSmrg# XORG_RELEASE_VERSION
332674b97a6cSmrg# --------------------
332774b97a6cSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
332806ef0fecSmrg
332974b97a6cSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
333074b97a6cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
333174b97a6cSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
333274b97a6cSmrg		[Major version of this package])
333374b97a6cSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
333474b97a6cSmrg	if test "x$PVM" = "x"; then
333574b97a6cSmrg		PVM="0"
333674b97a6cSmrg	fi
333774b97a6cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
333874b97a6cSmrg		[$PVM],
333974b97a6cSmrg		[Minor version of this package])
334074b97a6cSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
334174b97a6cSmrg	if test "x$PVP" = "x"; then
334274b97a6cSmrg		PVP="0"
334374b97a6cSmrg	fi
334474b97a6cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
334574b97a6cSmrg		[$PVP],
334674b97a6cSmrg		[Patch version of this package])
334774b97a6cSmrg])
334806ef0fecSmrg
334974b97a6cSmrg# XORG_CHANGELOG()
335074b97a6cSmrg# ----------------
335174b97a6cSmrg# Minimum version: 1.2.0
335274b97a6cSmrg#
335374b97a6cSmrg# Defines the variable CHANGELOG_CMD as the command to generate
335474b97a6cSmrg# ChangeLog from git.
335574b97a6cSmrg#
335674b97a6cSmrg#
335774b97a6cSmrgAC_DEFUN([XORG_CHANGELOG], [
335874b97a6cSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
335974b97a6cSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
336074b97a6cSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
336174b97a6cSmrgtouch \$(top_srcdir)/ChangeLog; \
336274b97a6cSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
336374b97a6cSmrgAC_SUBST([CHANGELOG_CMD])
336474b97a6cSmrg]) # XORG_CHANGELOG
3365b3307321Smrg
3366