13bee1c92Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2054b3d00Smrg
326df5c7cSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4a1d141d5Smrg
5a1d141d5Smrg# This file is free software; the Free Software Foundation
6a1d141d5Smrg# gives unlimited permission to copy and/or distribute it,
7a1d141d5Smrg# with or without modifications, as long as this notice is preserved.
8a1d141d5Smrg
9a1d141d5Smrg# This program is distributed in the hope that it will be useful,
10a1d141d5Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a1d141d5Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a1d141d5Smrg# PARTICULAR PURPOSE.
13a1d141d5Smrg
14054b3d00Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
152ddb6cf1Smrgm4_ifndef([AC_AUTOCONF_VERSION],
162ddb6cf1Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1726df5c7cSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
1826df5c7cSmrg[m4_warning([this file was generated for autoconf 2.71.
192ddb6cf1SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
202ddb6cf1SmrgIf you have problems, you may need to regenerate the build system entirely.
21054b3d00SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22a1d141d5Smrg
2326df5c7cSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2426df5c7cSmrg#
2526df5c7cSmrg# This file is free software; the Free Software Foundation
2626df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
2726df5c7cSmrg# with or without modifications, as long as this notice is preserved.
28054b3d00Smrg
2926df5c7cSmrg# AM_AUTOMAKE_VERSION(VERSION)
3026df5c7cSmrg# ----------------------------
3126df5c7cSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3226df5c7cSmrg# generated from the m4 files accompanying Automake X.Y.
3326df5c7cSmrg# (This private macro should not be called outside this file.)
3426df5c7cSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3526df5c7cSmrg[am__api_version='1.16'
3626df5c7cSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3726df5c7cSmrgdnl require some minimum version.  Point them to the right macro.
383bee1c92Smrgm4_if([$1], [1.16.5], [],
3926df5c7cSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4026df5c7cSmrg])
41054b3d00Smrg
4226df5c7cSmrg# _AM_AUTOCONF_VERSION(VERSION)
4326df5c7cSmrg# -----------------------------
4426df5c7cSmrg# aclocal traces this macro to find the Autoconf version.
4526df5c7cSmrg# This is a private macro too.  Using m4_define simplifies
4626df5c7cSmrg# the logic in aclocal, which can simply ignore this definition.
4726df5c7cSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48a1d141d5Smrg
4926df5c7cSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5026df5c7cSmrg# -------------------------------
5126df5c7cSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5226df5c7cSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5326df5c7cSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
543bee1c92Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5526df5c7cSmrgm4_ifndef([AC_AUTOCONF_VERSION],
5626df5c7cSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5726df5c7cSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58a1d141d5Smrg
5926df5c7cSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60a1d141d5Smrg
6126df5c7cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6226df5c7cSmrg#
6326df5c7cSmrg# This file is free software; the Free Software Foundation
6426df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
6526df5c7cSmrg# with or without modifications, as long as this notice is preserved.
66a1d141d5Smrg
6726df5c7cSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6826df5c7cSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6926df5c7cSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7026df5c7cSmrg#
7126df5c7cSmrg# Of course, Automake must honor this variable whenever it calls a
7226df5c7cSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7326df5c7cSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7426df5c7cSmrg# depending on how configure is run.  This is pretty annoying, since
7526df5c7cSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7626df5c7cSmrg# source directory, any form will work fine, but in subdirectories a
7726df5c7cSmrg# relative path needs to be adjusted first.
7826df5c7cSmrg#
7926df5c7cSmrg# $ac_aux_dir/missing
8026df5c7cSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8126df5c7cSmrg# $top_srcdir/$ac_aux_dir/missing
8226df5c7cSmrg#    fails if $ac_aux_dir is absolute,
8326df5c7cSmrg#    fails when called from a subdirectory in a VPATH build with
8426df5c7cSmrg#          a relative $ac_aux_dir
8526df5c7cSmrg#
8626df5c7cSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8726df5c7cSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
8826df5c7cSmrg# harmless because $srcdir is '.', but things will broke when you
8926df5c7cSmrg# start a VPATH build or use an absolute $srcdir.
9026df5c7cSmrg#
9126df5c7cSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9226df5c7cSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9326df5c7cSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9426df5c7cSmrg# and then we would define $MISSING as
9526df5c7cSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9626df5c7cSmrg# This will work as long as MISSING is not called from configure, because
9726df5c7cSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9826df5c7cSmrg# However there are other variables, like CC, which are often used in
9926df5c7cSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10026df5c7cSmrg#
10126df5c7cSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10226df5c7cSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10326df5c7cSmrg# configured tree to be moved without reconfiguration.
104a1d141d5Smrg
10526df5c7cSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10626df5c7cSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10726df5c7cSmrg# Expand $ac_aux_dir to an absolute path.
10826df5c7cSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10926df5c7cSmrg])
110a1d141d5Smrg
11126df5c7cSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112a1d141d5Smrg
11326df5c7cSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11426df5c7cSmrg#
11526df5c7cSmrg# This file is free software; the Free Software Foundation
11626df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
11726df5c7cSmrg# with or without modifications, as long as this notice is preserved.
118a1d141d5Smrg
11926df5c7cSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12026df5c7cSmrg# -------------------------------------
12126df5c7cSmrg# Define a conditional.
12226df5c7cSmrgAC_DEFUN([AM_CONDITIONAL],
12326df5c7cSmrg[AC_PREREQ([2.52])dnl
12426df5c7cSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12526df5c7cSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12626df5c7cSmrgAC_SUBST([$1_TRUE])dnl
12726df5c7cSmrgAC_SUBST([$1_FALSE])dnl
12826df5c7cSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12926df5c7cSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13026df5c7cSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13126df5c7cSmrgif $2; then
13226df5c7cSmrg  $1_TRUE=
13326df5c7cSmrg  $1_FALSE='#'
13426df5c7cSmrgelse
13526df5c7cSmrg  $1_TRUE='#'
13626df5c7cSmrg  $1_FALSE=
13726df5c7cSmrgfi
13826df5c7cSmrgAC_CONFIG_COMMANDS_PRE(
13926df5c7cSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14026df5c7cSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14126df5c7cSmrgUsually this means the macro was only invoked conditionally.]])
14226df5c7cSmrgfi])])
143a1d141d5Smrg
14426df5c7cSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14526df5c7cSmrg#
14626df5c7cSmrg# This file is free software; the Free Software Foundation
14726df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
14826df5c7cSmrg# with or without modifications, as long as this notice is preserved.
149a1d141d5Smrg
150a1d141d5Smrg
15126df5c7cSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15226df5c7cSmrg# written in clear, in which case automake, when reading aclocal.m4,
15326df5c7cSmrg# will think it sees a *use*, and therefore will trigger all it's
15426df5c7cSmrg# C support machinery.  Also note that it means that autoscan, seeing
15526df5c7cSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156a1d141d5Smrg
157a1d141d5Smrg
15826df5c7cSmrg# _AM_DEPENDENCIES(NAME)
15926df5c7cSmrg# ----------------------
16026df5c7cSmrg# See how the compiler implements dependency checking.
16126df5c7cSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16226df5c7cSmrg# We try a few techniques and use that to set a single cache variable.
16326df5c7cSmrg#
16426df5c7cSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16526df5c7cSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16626df5c7cSmrg# dependency, and given that the user is not expected to run this macro,
16726df5c7cSmrg# just rely on AC_PROG_CC.
16826df5c7cSmrgAC_DEFUN([_AM_DEPENDENCIES],
16926df5c7cSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17026df5c7cSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17126df5c7cSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17226df5c7cSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173a1d141d5Smrg
17426df5c7cSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17526df5c7cSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17626df5c7cSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17726df5c7cSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17826df5c7cSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17926df5c7cSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18026df5c7cSmrg                    [depcc="$$1"   am_compiler_list=])
181a1d141d5Smrg
18226df5c7cSmrgAC_CACHE_CHECK([dependency style of $depcc],
18326df5c7cSmrg               [am_cv_$1_dependencies_compiler_type],
18426df5c7cSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18526df5c7cSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
18626df5c7cSmrg  # making bogus files that we don't know about and never remove.  For
18726df5c7cSmrg  # instance it was reported that on HP-UX the gcc test will end up
18826df5c7cSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18926df5c7cSmrg  # in D".
19026df5c7cSmrg  rm -rf conftest.dir
19126df5c7cSmrg  mkdir conftest.dir
19226df5c7cSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19326df5c7cSmrg  # using a relative directory.
19426df5c7cSmrg  cp "$am_depcomp" conftest.dir
19526df5c7cSmrg  cd conftest.dir
19626df5c7cSmrg  # We will build objects and dependencies in a subdirectory because
19726df5c7cSmrg  # it helps to detect inapplicable dependency modes.  For instance
19826df5c7cSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19926df5c7cSmrg  # side effect of compilation, but ICC will put the dependencies in
20026df5c7cSmrg  # the current directory while Tru64 will put them in the object
20126df5c7cSmrg  # directory.
20226df5c7cSmrg  mkdir sub
203a1d141d5Smrg
20426df5c7cSmrg  am_cv_$1_dependencies_compiler_type=none
20526df5c7cSmrg  if test "$am_compiler_list" = ""; then
20626df5c7cSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20726df5c7cSmrg  fi
20826df5c7cSmrg  am__universal=false
20926df5c7cSmrg  m4_case([$1], [CC],
21026df5c7cSmrg    [case " $depcc " in #(
21126df5c7cSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21226df5c7cSmrg     esac],
21326df5c7cSmrg    [CXX],
21426df5c7cSmrg    [case " $depcc " in #(
21526df5c7cSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21626df5c7cSmrg     esac])
21755074dd0Smrg
21826df5c7cSmrg  for depmode in $am_compiler_list; do
21926df5c7cSmrg    # Setup a source with many dependencies, because some compilers
22026df5c7cSmrg    # like to wrap large dependency lists on column 80 (with \), and
22126df5c7cSmrg    # we should not choose a depcomp mode which is confused by this.
22226df5c7cSmrg    #
22326df5c7cSmrg    # We need to recreate these files for each test, as the compiler may
22426df5c7cSmrg    # overwrite some of them when testing with obscure command lines.
22526df5c7cSmrg    # This happens at least with the AIX C compiler.
22626df5c7cSmrg    : > sub/conftest.c
22726df5c7cSmrg    for i in 1 2 3 4 5 6; do
22826df5c7cSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22926df5c7cSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23026df5c7cSmrg      # Solaris 10 /bin/sh.
23126df5c7cSmrg      echo '/* dummy */' > sub/conftst$i.h
23226df5c7cSmrg    done
23326df5c7cSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23455074dd0Smrg
23526df5c7cSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23626df5c7cSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23726df5c7cSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23826df5c7cSmrg    # versions had trouble with output in subdirs.
23926df5c7cSmrg    am__obj=sub/conftest.${OBJEXT-o}
24026df5c7cSmrg    am__minus_obj="-o $am__obj"
24126df5c7cSmrg    case $depmode in
24226df5c7cSmrg    gcc)
24326df5c7cSmrg      # This depmode causes a compiler race in universal mode.
24426df5c7cSmrg      test "$am__universal" = false || continue
24526df5c7cSmrg      ;;
24626df5c7cSmrg    nosideeffect)
24726df5c7cSmrg      # After this tag, mechanisms are not by side-effect, so they'll
24826df5c7cSmrg      # only be used when explicitly requested.
24926df5c7cSmrg      if test "x$enable_dependency_tracking" = xyes; then
25026df5c7cSmrg	continue
25126df5c7cSmrg      else
25226df5c7cSmrg	break
25326df5c7cSmrg      fi
25426df5c7cSmrg      ;;
25526df5c7cSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25626df5c7cSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
25726df5c7cSmrg      # not run yet.  These depmodes are late enough in the game, and
25826df5c7cSmrg      # so weak that their functioning should not be impacted.
25926df5c7cSmrg      am__obj=conftest.${OBJEXT-o}
26026df5c7cSmrg      am__minus_obj=
26126df5c7cSmrg      ;;
26226df5c7cSmrg    none) break ;;
26326df5c7cSmrg    esac
26426df5c7cSmrg    if depmode=$depmode \
26526df5c7cSmrg       source=sub/conftest.c object=$am__obj \
26626df5c7cSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26726df5c7cSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26826df5c7cSmrg         >/dev/null 2>conftest.err &&
26926df5c7cSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27026df5c7cSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27126df5c7cSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27226df5c7cSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27326df5c7cSmrg      # icc doesn't choke on unknown options, it will just issue warnings
27426df5c7cSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
27526df5c7cSmrg      # that says an option was ignored or not supported.
27626df5c7cSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27726df5c7cSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27826df5c7cSmrg      # The diagnosis changed in icc 8.0:
27926df5c7cSmrg      #   icc: Command line remark: option '-MP' not supported
28026df5c7cSmrg      if (grep 'ignoring option' conftest.err ||
28126df5c7cSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28226df5c7cSmrg        am_cv_$1_dependencies_compiler_type=$depmode
28326df5c7cSmrg        break
28426df5c7cSmrg      fi
28526df5c7cSmrg    fi
28626df5c7cSmrg  done
28755074dd0Smrg
28826df5c7cSmrg  cd ..
28926df5c7cSmrg  rm -rf conftest.dir
29026df5c7cSmrgelse
29126df5c7cSmrg  am_cv_$1_dependencies_compiler_type=none
29226df5c7cSmrgfi
29326df5c7cSmrg])
29426df5c7cSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29526df5c7cSmrgAM_CONDITIONAL([am__fastdep$1], [
29626df5c7cSmrg  test "x$enable_dependency_tracking" != xno \
29726df5c7cSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29826df5c7cSmrg])
29955074dd0Smrg
300054b3d00Smrg
30126df5c7cSmrg# AM_SET_DEPDIR
30226df5c7cSmrg# -------------
30326df5c7cSmrg# Choose a directory name for dependency files.
30426df5c7cSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30526df5c7cSmrgAC_DEFUN([AM_SET_DEPDIR],
30626df5c7cSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30726df5c7cSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30826df5c7cSmrg])
309054b3d00Smrg
310054b3d00Smrg
31126df5c7cSmrg# AM_DEP_TRACK
31226df5c7cSmrg# ------------
31326df5c7cSmrgAC_DEFUN([AM_DEP_TRACK],
31426df5c7cSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31526df5c7cSmrgAS_HELP_STRING(
31626df5c7cSmrg  [--enable-dependency-tracking],
31726df5c7cSmrg  [do not reject slow dependency extractors])
31826df5c7cSmrgAS_HELP_STRING(
31926df5c7cSmrg  [--disable-dependency-tracking],
32026df5c7cSmrg  [speeds up one-time build])])
32126df5c7cSmrgif test "x$enable_dependency_tracking" != xno; then
32226df5c7cSmrg  am_depcomp="$ac_aux_dir/depcomp"
32326df5c7cSmrg  AMDEPBACKSLASH='\'
32426df5c7cSmrg  am__nodep='_no'
32526df5c7cSmrgfi
32626df5c7cSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32726df5c7cSmrgAC_SUBST([AMDEPBACKSLASH])dnl
32826df5c7cSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32926df5c7cSmrgAC_SUBST([am__nodep])dnl
33026df5c7cSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33126df5c7cSmrg])
332054b3d00Smrg
33326df5c7cSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33455074dd0Smrg
33526df5c7cSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336054b3d00Smrg#
33726df5c7cSmrg# This file is free software; the Free Software Foundation
33826df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
33926df5c7cSmrg# with or without modifications, as long as this notice is preserved.
34055074dd0Smrg
34126df5c7cSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34226df5c7cSmrg# ------------------------------
34326df5c7cSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34426df5c7cSmrg[{
34526df5c7cSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
34626df5c7cSmrg  # are listed without --file.  Let's play safe and only enable the eval
34726df5c7cSmrg  # if we detect the quoting.
34826df5c7cSmrg  # TODO: see whether this extra hack can be removed once we start
34926df5c7cSmrg  # requiring Autoconf 2.70 or later.
35026df5c7cSmrg  AS_CASE([$CONFIG_FILES],
35126df5c7cSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
35226df5c7cSmrg          [*], [set x $CONFIG_FILES])
35326df5c7cSmrg  shift
35426df5c7cSmrg  # Used to flag and report bootstrapping failures.
35526df5c7cSmrg  am_rc=0
35626df5c7cSmrg  for am_mf
35726df5c7cSmrg  do
35826df5c7cSmrg    # Strip MF so we end up with the name of the file.
35926df5c7cSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36026df5c7cSmrg    # Check whether this is an Automake generated Makefile which includes
36126df5c7cSmrg    # dependency-tracking related rules and includes.
36226df5c7cSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36326df5c7cSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
36426df5c7cSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36526df5c7cSmrg      || continue
36626df5c7cSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36726df5c7cSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36826df5c7cSmrg    AM_RUN_LOG([cd "$am_dirpart" \
36926df5c7cSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37026df5c7cSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37126df5c7cSmrg  done
37226df5c7cSmrg  if test $am_rc -ne 0; then
37326df5c7cSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37426df5c7cSmrg    for automatic dependency tracking.  If GNU make was not used, consider
37526df5c7cSmrg    re-running the configure script with MAKE="gmake" (or whatever is
37626df5c7cSmrg    necessary).  You can also try re-running configure with the
37726df5c7cSmrg    '--disable-dependency-tracking' option to at least be able to build
37826df5c7cSmrg    the package (albeit without support for automatic dependency tracking).])
37926df5c7cSmrg  fi
38026df5c7cSmrg  AS_UNSET([am_dirpart])
38126df5c7cSmrg  AS_UNSET([am_filepart])
38226df5c7cSmrg  AS_UNSET([am_mf])
38326df5c7cSmrg  AS_UNSET([am_rc])
38426df5c7cSmrg  rm -f conftest-deps.mk
38526df5c7cSmrg}
38626df5c7cSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
38755074dd0Smrg
38855074dd0Smrg
38926df5c7cSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39026df5c7cSmrg# -----------------------------
39126df5c7cSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3922ddb6cf1Smrg#
39326df5c7cSmrg# This code is only required when automatic dependency tracking is enabled.
39426df5c7cSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39526df5c7cSmrg# order to bootstrap the dependency handling code.
39626df5c7cSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39726df5c7cSmrg[AC_CONFIG_COMMANDS([depfiles],
39826df5c7cSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39926df5c7cSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
40055074dd0Smrg
40126df5c7cSmrg# Do all the work for Automake.                             -*- Autoconf -*-
40255074dd0Smrg
40326df5c7cSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40426df5c7cSmrg#
40526df5c7cSmrg# This file is free software; the Free Software Foundation
40626df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
40726df5c7cSmrg# with or without modifications, as long as this notice is preserved.
40855074dd0Smrg
40926df5c7cSmrg# This macro actually does too much.  Some checks are only needed if
41026df5c7cSmrg# your package does certain things.  But this isn't really a big deal.
41155074dd0Smrg
41226df5c7cSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41326df5c7cSmrgm4_define([AC_PROG_CC],
41426df5c7cSmrgm4_defn([AC_PROG_CC])
41526df5c7cSmrg[_AM_PROG_CC_C_O
41626df5c7cSmrg])
417a1d141d5Smrg
41826df5c7cSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41926df5c7cSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42026df5c7cSmrg# -----------------------------------------------
42126df5c7cSmrg# The call with PACKAGE and VERSION arguments is the old style
42226df5c7cSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42326df5c7cSmrg# and VERSION should now be passed to AC_INIT and removed from
42426df5c7cSmrg# the call to AM_INIT_AUTOMAKE.
42526df5c7cSmrg# We support both call styles for the transition.  After
42626df5c7cSmrg# the next Automake release, Autoconf can make the AC_INIT
42726df5c7cSmrg# arguments mandatory, and then we can depend on a new Autoconf
42826df5c7cSmrg# release and drop the old call support.
42926df5c7cSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43026df5c7cSmrg[AC_PREREQ([2.65])dnl
4313bee1c92Smrgm4_ifdef([_$0_ALREADY_INIT],
4323bee1c92Smrg  [m4_fatal([$0 expanded multiple times
4333bee1c92Smrg]m4_defn([_$0_ALREADY_INIT]))],
4343bee1c92Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43526df5c7cSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43626df5c7cSmrgdnl the ones we care about.
43726df5c7cSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43826df5c7cSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43926df5c7cSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44026df5c7cSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44126df5c7cSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44226df5c7cSmrg  # is not polluted with repeated "-I."
44326df5c7cSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44426df5c7cSmrg  # test to see if srcdir already configured
44526df5c7cSmrg  if test -f $srcdir/config.status; then
44626df5c7cSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44726df5c7cSmrg  fi
448054b3d00Smrgfi
44955074dd0Smrg
45026df5c7cSmrg# test whether we have cygpath
45126df5c7cSmrgif test -z "$CYGPATH_W"; then
45226df5c7cSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45326df5c7cSmrg    CYGPATH_W='cygpath -w'
45426df5c7cSmrg  else
45526df5c7cSmrg    CYGPATH_W=echo
45626df5c7cSmrg  fi
4572ddb6cf1Smrgfi
45826df5c7cSmrgAC_SUBST([CYGPATH_W])
459a1d141d5Smrg
46026df5c7cSmrg# Define the identity of the package.
46126df5c7cSmrgdnl Distinguish between old-style and new-style calls.
46226df5c7cSmrgm4_ifval([$2],
46326df5c7cSmrg[AC_DIAGNOSE([obsolete],
46426df5c7cSmrg             [$0: two- and three-arguments forms are deprecated.])
46526df5c7cSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46626df5c7cSmrg AC_SUBST([PACKAGE], [$1])dnl
46726df5c7cSmrg AC_SUBST([VERSION], [$2])],
46826df5c7cSmrg[_AM_SET_OPTIONS([$1])dnl
46926df5c7cSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47026df5c7cSmrgm4_if(
47126df5c7cSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47226df5c7cSmrg  [ok:ok],,
47326df5c7cSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47426df5c7cSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47526df5c7cSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476a1d141d5Smrg
47726df5c7cSmrg_AM_IF_OPTION([no-define],,
47826df5c7cSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47926df5c7cSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480a1d141d5Smrg
48126df5c7cSmrg# Some tools Automake needs.
48226df5c7cSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48326df5c7cSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48426df5c7cSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48526df5c7cSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48626df5c7cSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48726df5c7cSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48826df5c7cSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48926df5c7cSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49026df5c7cSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49126df5c7cSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49226df5c7cSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
49326df5c7cSmrg# dies out for good.  For more background, see:
49426df5c7cSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49526df5c7cSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49626df5c7cSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49726df5c7cSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
49826df5c7cSmrg# system "awk" is bad on some platforms.
49926df5c7cSmrgAC_REQUIRE([AC_PROG_AWK])dnl
50026df5c7cSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50126df5c7cSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50226df5c7cSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50326df5c7cSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50426df5c7cSmrg			     [_AM_PROG_TAR([v7])])])
50526df5c7cSmrg_AM_IF_OPTION([no-dependencies],,
50626df5c7cSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50726df5c7cSmrg		  [_AM_DEPENDENCIES([CC])],
50826df5c7cSmrg		  [m4_define([AC_PROG_CC],
50926df5c7cSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51026df5c7cSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51126df5c7cSmrg		  [_AM_DEPENDENCIES([CXX])],
51226df5c7cSmrg		  [m4_define([AC_PROG_CXX],
51326df5c7cSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51426df5c7cSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51526df5c7cSmrg		  [_AM_DEPENDENCIES([OBJC])],
51626df5c7cSmrg		  [m4_define([AC_PROG_OBJC],
51726df5c7cSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51826df5c7cSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51926df5c7cSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
52026df5c7cSmrg		  [m4_define([AC_PROG_OBJCXX],
52126df5c7cSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52226df5c7cSmrg])
52326df5c7cSmrg# Variables for tags utilities; see am/tags.am
52426df5c7cSmrgif test -z "$CTAGS"; then
52526df5c7cSmrg  CTAGS=ctags
52626df5c7cSmrgfi
52726df5c7cSmrgAC_SUBST([CTAGS])
52826df5c7cSmrgif test -z "$ETAGS"; then
52926df5c7cSmrg  ETAGS=etags
53026df5c7cSmrgfi
53126df5c7cSmrgAC_SUBST([ETAGS])
53226df5c7cSmrgif test -z "$CSCOPE"; then
53326df5c7cSmrg  CSCOPE=cscope
53426df5c7cSmrgfi
53526df5c7cSmrgAC_SUBST([CSCOPE])
536a1d141d5Smrg
53726df5c7cSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53826df5c7cSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
53926df5c7cSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54026df5c7cSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54126df5c7cSmrgAC_CONFIG_COMMANDS_PRE(dnl
54226df5c7cSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54326df5c7cSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544a1d141d5Smrg
54526df5c7cSmrg# POSIX will say in a future version that running "rm -f" with no argument
54626df5c7cSmrg# is OK; and we want to be able to make that assumption in our Makefile
54726df5c7cSmrg# recipes.  So use an aggressive probe to check that the usage we want is
54826df5c7cSmrg# actually supported "in the wild" to an acceptable degree.
54926df5c7cSmrg# See automake bug#10828.
55026df5c7cSmrg# To make any issue more visible, cause the running configure to be aborted
55126df5c7cSmrg# by default if the 'rm' program in use doesn't match our expectations; the
55226df5c7cSmrg# user can still override this though.
55326df5c7cSmrgif rm -f && rm -fr && rm -rf; then : OK; else
55426df5c7cSmrg  cat >&2 <<'END'
55526df5c7cSmrgOops!
556a1d141d5Smrg
55726df5c7cSmrgYour 'rm' program seems unable to run without file operands specified
55826df5c7cSmrgon the command line, even when the '-f' option is present.  This is contrary
55926df5c7cSmrgto the behaviour of most rm programs out there, and not conforming with
56026df5c7cSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561a1d141d5Smrg
56226df5c7cSmrgPlease tell bug-automake@gnu.org about your system, including the value
56326df5c7cSmrgof your $PATH and any error possibly output before this message.  This
56426df5c7cSmrgcan help us improve future automake versions.
565a1d141d5Smrg
56626df5c7cSmrgEND
56726df5c7cSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56826df5c7cSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56926df5c7cSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57026df5c7cSmrg    echo >&2
57126df5c7cSmrg  else
57226df5c7cSmrg    cat >&2 <<'END'
57326df5c7cSmrgAborting the configuration process, to ensure you take notice of the issue.
574a1d141d5Smrg
57526df5c7cSmrgYou can download and install GNU coreutils to get an 'rm' implementation
57626df5c7cSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577054b3d00Smrg
57826df5c7cSmrgIf you want to complete the configuration process using your problematic
57926df5c7cSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58026df5c7cSmrgto "yes", and re-run configure.
581054b3d00Smrg
58226df5c7cSmrgEND
58326df5c7cSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58426df5c7cSmrg  fi
5852ddb6cf1Smrgfi
58626df5c7cSmrgdnl The trailing newline in this macro's definition is deliberate, for
58726df5c7cSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58826df5c7cSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58926df5c7cSmrg])
590a1d141d5Smrg
59126df5c7cSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59226df5c7cSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59326df5c7cSmrgdnl mangled by Autoconf and run in a shell conditional statement.
59426df5c7cSmrgm4_define([_AC_COMPILER_EXEEXT],
59526df5c7cSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
59655074dd0Smrg
59726df5c7cSmrg# When config.status generates a header, we must update the stamp-h file.
59826df5c7cSmrg# This file resides in the same directory as the config header
59926df5c7cSmrg# that is generated.  The stamp files are numbered to have different names.
600a1d141d5Smrg
60126df5c7cSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60226df5c7cSmrg# loop where config.status creates the headers, so we can generate
60326df5c7cSmrg# our stamp files there.
60426df5c7cSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60526df5c7cSmrg[# Compute $1's index in $config_headers.
60626df5c7cSmrg_am_arg=$1
60726df5c7cSmrg_am_stamp_count=1
60826df5c7cSmrgfor _am_header in $config_headers :; do
60926df5c7cSmrg  case $_am_header in
61026df5c7cSmrg    $_am_arg | $_am_arg:* )
61126df5c7cSmrg      break ;;
61226df5c7cSmrg    * )
61326df5c7cSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61426df5c7cSmrg  esac
61526df5c7cSmrgdone
61626df5c7cSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617054b3d00Smrg
61826df5c7cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61926df5c7cSmrg#
62026df5c7cSmrg# This file is free software; the Free Software Foundation
62126df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
62226df5c7cSmrg# with or without modifications, as long as this notice is preserved.
62326df5c7cSmrg
62426df5c7cSmrg# AM_PROG_INSTALL_SH
62526df5c7cSmrg# ------------------
62626df5c7cSmrg# Define $install_sh.
62726df5c7cSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62826df5c7cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62926df5c7cSmrgif test x"${install_sh+set}" != xset; then
63026df5c7cSmrg  case $am_aux_dir in
63126df5c7cSmrg  *\ * | *\	*)
63226df5c7cSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63326df5c7cSmrg  *)
63426df5c7cSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63526df5c7cSmrg  esac
63626df5c7cSmrgfi
63726df5c7cSmrgAC_SUBST([install_sh])])
63826df5c7cSmrg
63926df5c7cSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64026df5c7cSmrg#
64126df5c7cSmrg# This file is free software; the Free Software Foundation
64226df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
64326df5c7cSmrg# with or without modifications, as long as this notice is preserved.
64426df5c7cSmrg
64526df5c7cSmrg# Check whether the underlying file-system supports filenames
64626df5c7cSmrg# with a leading dot.  For instance MS-DOS doesn't.
64726df5c7cSmrgAC_DEFUN([AM_SET_LEADING_DOT],
64826df5c7cSmrg[rm -rf .tst 2>/dev/null
64926df5c7cSmrgmkdir .tst 2>/dev/null
65026df5c7cSmrgif test -d .tst; then
65126df5c7cSmrg  am__leading_dot=.
652a1d141d5Smrgelse
65326df5c7cSmrg  am__leading_dot=_
654a1d141d5Smrgfi
65526df5c7cSmrgrmdir .tst 2>/dev/null
65626df5c7cSmrgAC_SUBST([am__leading_dot])])
657a1d141d5Smrg
65826df5c7cSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659a1d141d5Smrg
66026df5c7cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66126df5c7cSmrg#
66226df5c7cSmrg# This file is free software; the Free Software Foundation
66326df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
66426df5c7cSmrg# with or without modifications, as long as this notice is preserved.
665a1d141d5Smrg
66626df5c7cSmrg# AM_MAKE_INCLUDE()
66726df5c7cSmrg# -----------------
66826df5c7cSmrg# Check whether make has an 'include' directive that can support all
66926df5c7cSmrg# the idioms we need for our automatic dependency tracking code.
67026df5c7cSmrgAC_DEFUN([AM_MAKE_INCLUDE],
67126df5c7cSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
67226df5c7cSmrgcat > confinc.mk << 'END'
67326df5c7cSmrgam__doit:
67426df5c7cSmrg	@echo this is the am__doit target >confinc.out
67526df5c7cSmrg.PHONY: am__doit
67626df5c7cSmrgEND
67726df5c7cSmrgam__include="#"
67826df5c7cSmrgam__quote=
67926df5c7cSmrg# BSD make does it like this.
68026df5c7cSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
68126df5c7cSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
68226df5c7cSmrgecho 'include confinc.mk # ignored' > confmf.GNU
68326df5c7cSmrg_am_result=no
68426df5c7cSmrgfor s in GNU BSD; do
68526df5c7cSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
68626df5c7cSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
68726df5c7cSmrg      ['0:this is the am__doit target'],
68826df5c7cSmrg      [AS_CASE([$s],
68926df5c7cSmrg          [BSD], [am__include='.include' am__quote='"'],
69026df5c7cSmrg          [am__include='include' am__quote=''])])
69126df5c7cSmrg  if test "$am__include" != "#"; then
69226df5c7cSmrg    _am_result="yes ($s style)"
69326df5c7cSmrg    break
69426df5c7cSmrg  fi
69526df5c7cSmrgdone
69626df5c7cSmrgrm -f confinc.* confmf.*
69726df5c7cSmrgAC_MSG_RESULT([${_am_result}])
69826df5c7cSmrgAC_SUBST([am__include])])
69926df5c7cSmrgAC_SUBST([am__quote])])
700a1d141d5Smrg
70126df5c7cSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702a1d141d5Smrg
70326df5c7cSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
70455074dd0Smrg#
70526df5c7cSmrg# This file is free software; the Free Software Foundation
70626df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
70726df5c7cSmrg# with or without modifications, as long as this notice is preserved.
708a1d141d5Smrg
70926df5c7cSmrg# AM_MISSING_PROG(NAME, PROGRAM)
71026df5c7cSmrg# ------------------------------
71126df5c7cSmrgAC_DEFUN([AM_MISSING_PROG],
71226df5c7cSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71326df5c7cSmrg$1=${$1-"${am_missing_run}$2"}
71426df5c7cSmrgAC_SUBST($1)])
715a1d141d5Smrg
71626df5c7cSmrg# AM_MISSING_HAS_RUN
71726df5c7cSmrg# ------------------
71826df5c7cSmrg# Define MISSING if not defined so far and test if it is modern enough.
71926df5c7cSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72026df5c7cSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72126df5c7cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72226df5c7cSmrgAC_REQUIRE_AUX_FILE([missing])dnl
72326df5c7cSmrgif test x"${MISSING+set}" != xset; then
72426df5c7cSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725054b3d00Smrgfi
72626df5c7cSmrg# Use eval to expand $SHELL
72726df5c7cSmrgif eval "$MISSING --is-lightweight"; then
72826df5c7cSmrg  am_missing_run="$MISSING "
72926df5c7cSmrgelse
73026df5c7cSmrg  am_missing_run=
73126df5c7cSmrg  AC_MSG_WARN(['missing' script is too old or missing])
732054b3d00Smrgfi
73326df5c7cSmrg])
7342ddb6cf1Smrg
73526df5c7cSmrg# Helper functions for option handling.                     -*- Autoconf -*-
7362ddb6cf1Smrg
73726df5c7cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73826df5c7cSmrg#
73926df5c7cSmrg# This file is free software; the Free Software Foundation
74026df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
74126df5c7cSmrg# with or without modifications, as long as this notice is preserved.
7422ddb6cf1Smrg
74326df5c7cSmrg# _AM_MANGLE_OPTION(NAME)
74426df5c7cSmrg# -----------------------
74526df5c7cSmrgAC_DEFUN([_AM_MANGLE_OPTION],
74626df5c7cSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747a1d141d5Smrg
74826df5c7cSmrg# _AM_SET_OPTION(NAME)
74926df5c7cSmrg# --------------------
75026df5c7cSmrg# Set option NAME.  Presently that only means defining a flag for this option.
75126df5c7cSmrgAC_DEFUN([_AM_SET_OPTION],
75226df5c7cSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753a1d141d5Smrg
75426df5c7cSmrg# _AM_SET_OPTIONS(OPTIONS)
75526df5c7cSmrg# ------------------------
75626df5c7cSmrg# OPTIONS is a space-separated list of Automake options.
75726df5c7cSmrgAC_DEFUN([_AM_SET_OPTIONS],
75826df5c7cSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75926df5c7cSmrg
76026df5c7cSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76126df5c7cSmrg# -------------------------------------------
76226df5c7cSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76326df5c7cSmrgAC_DEFUN([_AM_IF_OPTION],
76426df5c7cSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76526df5c7cSmrg
76626df5c7cSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767054b3d00Smrg#
76826df5c7cSmrg# This file is free software; the Free Software Foundation
76926df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
77026df5c7cSmrg# with or without modifications, as long as this notice is preserved.
771a1d141d5Smrg
77226df5c7cSmrg# _AM_PROG_CC_C_O
77326df5c7cSmrg# ---------------
77426df5c7cSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77526df5c7cSmrg# to automatically call this.
77626df5c7cSmrgAC_DEFUN([_AM_PROG_CC_C_O],
77726df5c7cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77826df5c7cSmrgAC_REQUIRE_AUX_FILE([compile])dnl
77926df5c7cSmrgAC_LANG_PUSH([C])dnl
78026df5c7cSmrgAC_CACHE_CHECK(
78126df5c7cSmrg  [whether $CC understands -c and -o together],
78226df5c7cSmrg  [am_cv_prog_cc_c_o],
78326df5c7cSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78426df5c7cSmrg  # Make sure it works both with $CC and with simple cc.
78526df5c7cSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78626df5c7cSmrg  # compilers refuse to overwrite an existing .o file with -o,
78726df5c7cSmrg  # though they will create one.
78826df5c7cSmrg  am_cv_prog_cc_c_o=yes
78926df5c7cSmrg  for am_i in 1 2; do
79026df5c7cSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79126df5c7cSmrg         && test -f conftest2.$ac_objext; then
79226df5c7cSmrg      : OK
79326df5c7cSmrg    else
79426df5c7cSmrg      am_cv_prog_cc_c_o=no
79526df5c7cSmrg      break
79626df5c7cSmrg    fi
79726df5c7cSmrg  done
79826df5c7cSmrg  rm -f core conftest*
79926df5c7cSmrg  unset am_i])
80026df5c7cSmrgif test "$am_cv_prog_cc_c_o" != yes; then
80126df5c7cSmrg   # Losing compiler, so override with the script.
80226df5c7cSmrg   # FIXME: It is wrong to rewrite CC.
80326df5c7cSmrg   # But if we don't then we get into trouble of one sort or another.
80426df5c7cSmrg   # A longer-term fix would be to have automake use am__CC in this case,
80526df5c7cSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80626df5c7cSmrg   CC="$am_aux_dir/compile $CC"
807054b3d00Smrgfi
80826df5c7cSmrgAC_LANG_POP([C])])
809a1d141d5Smrg
81026df5c7cSmrg# For backward compatibility.
81126df5c7cSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812a1d141d5Smrg
81326df5c7cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
8142ddb6cf1Smrg#
81526df5c7cSmrg# This file is free software; the Free Software Foundation
81626df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
81726df5c7cSmrg# with or without modifications, as long as this notice is preserved.
818a1d141d5Smrg
81926df5c7cSmrg# AM_RUN_LOG(COMMAND)
82026df5c7cSmrg# -------------------
82126df5c7cSmrg# Run COMMAND, save the exit status in ac_status, and log it.
82226df5c7cSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82326df5c7cSmrgAC_DEFUN([AM_RUN_LOG],
82426df5c7cSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82526df5c7cSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82626df5c7cSmrg   ac_status=$?
82726df5c7cSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82826df5c7cSmrg   (exit $ac_status); }])
82926df5c7cSmrg
83026df5c7cSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83126df5c7cSmrg
83226df5c7cSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833054b3d00Smrg#
83426df5c7cSmrg# This file is free software; the Free Software Foundation
83526df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
83626df5c7cSmrg# with or without modifications, as long as this notice is preserved.
837a1d141d5Smrg
83826df5c7cSmrg# AM_SANITY_CHECK
83926df5c7cSmrg# ---------------
84026df5c7cSmrgAC_DEFUN([AM_SANITY_CHECK],
84126df5c7cSmrg[AC_MSG_CHECKING([whether build environment is sane])
84226df5c7cSmrg# Reject unsafe characters in $srcdir or the absolute working directory
84326df5c7cSmrg# name.  Accept space and tab only in the latter.
84426df5c7cSmrgam_lf='
84526df5c7cSmrg'
84626df5c7cSmrgcase `pwd` in
84726df5c7cSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84826df5c7cSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84926df5c7cSmrgesac
85026df5c7cSmrgcase $srcdir in
85126df5c7cSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85226df5c7cSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85326df5c7cSmrgesac
85426df5c7cSmrg
85526df5c7cSmrg# Do 'set' in a subshell so we don't clobber the current shell's
85626df5c7cSmrg# arguments.  Must try -L first in case configure is actually a
85726df5c7cSmrg# symlink; some systems play weird games with the mod time of symlinks
85826df5c7cSmrg# (eg FreeBSD returns the mod time of the symlink's containing
85926df5c7cSmrg# directory).
86026df5c7cSmrgif (
86126df5c7cSmrg   am_has_slept=no
86226df5c7cSmrg   for am_try in 1 2; do
86326df5c7cSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86426df5c7cSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86526df5c7cSmrg     if test "$[*]" = "X"; then
86626df5c7cSmrg	# -L didn't work.
86726df5c7cSmrg	set X `ls -t "$srcdir/configure" conftest.file`
86826df5c7cSmrg     fi
86926df5c7cSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87026df5c7cSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87126df5c7cSmrg
87226df5c7cSmrg	# If neither matched, then we have a broken ls.  This can happen
87326df5c7cSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87426df5c7cSmrg	# broken ls alias from the environment.  This has actually
87526df5c7cSmrg	# happened.  Such a system could not be considered "sane".
87626df5c7cSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87726df5c7cSmrg  alias in your environment])
87826df5c7cSmrg     fi
87926df5c7cSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88026df5c7cSmrg       break
88126df5c7cSmrg     fi
88226df5c7cSmrg     # Just in case.
88326df5c7cSmrg     sleep 1
88426df5c7cSmrg     am_has_slept=yes
88526df5c7cSmrg   done
88626df5c7cSmrg   test "$[2]" = conftest.file
88726df5c7cSmrg   )
88826df5c7cSmrgthen
88926df5c7cSmrg   # Ok.
89026df5c7cSmrg   :
891054b3d00Smrgelse
89226df5c7cSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
89326df5c7cSmrgCheck your system clock])
894054b3d00Smrgfi
89526df5c7cSmrgAC_MSG_RESULT([yes])
89626df5c7cSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89726df5c7cSmrg# generated files are strictly newer.
89826df5c7cSmrgam_sleep_pid=
89926df5c7cSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90026df5c7cSmrg  ( sleep 1 ) &
90126df5c7cSmrg  am_sleep_pid=$!
90226df5c7cSmrgfi
90326df5c7cSmrgAC_CONFIG_COMMANDS_PRE(
90426df5c7cSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90526df5c7cSmrg   if test -n "$am_sleep_pid"; then
90626df5c7cSmrg     # Hide warnings about reused PIDs.
90726df5c7cSmrg     wait $am_sleep_pid 2>/dev/null
90826df5c7cSmrg   fi
90926df5c7cSmrg   AC_MSG_RESULT([done])])
91026df5c7cSmrgrm -f conftest.file
91126df5c7cSmrg])
912a1d141d5Smrg
91326df5c7cSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914054b3d00Smrg#
91526df5c7cSmrg# This file is free software; the Free Software Foundation
91626df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
91726df5c7cSmrg# with or without modifications, as long as this notice is preserved.
918a1d141d5Smrg
91926df5c7cSmrg# AM_SILENT_RULES([DEFAULT])
92026df5c7cSmrg# --------------------------
92126df5c7cSmrg# Enable less verbose build rules; with the default set to DEFAULT
92226df5c7cSmrg# ("yes" being less verbose, "no" or empty being verbose).
92326df5c7cSmrgAC_DEFUN([AM_SILENT_RULES],
92426df5c7cSmrg[AC_ARG_ENABLE([silent-rules], [dnl
92526df5c7cSmrgAS_HELP_STRING(
92626df5c7cSmrg  [--enable-silent-rules],
92726df5c7cSmrg  [less verbose build output (undo: "make V=1")])
92826df5c7cSmrgAS_HELP_STRING(
92926df5c7cSmrg  [--disable-silent-rules],
93026df5c7cSmrg  [verbose build output (undo: "make V=0")])dnl
93126df5c7cSmrg])
93226df5c7cSmrgcase $enable_silent_rules in @%:@ (((
93326df5c7cSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
93426df5c7cSmrg   no) AM_DEFAULT_VERBOSITY=1;;
93526df5c7cSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93626df5c7cSmrgesac
93726df5c7cSmrgdnl
93826df5c7cSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93926df5c7cSmrgdnl do not support nested variable expansions.
94026df5c7cSmrgdnl See automake bug#9928 and bug#10237.
94126df5c7cSmrgam_make=${MAKE-make}
94226df5c7cSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94326df5c7cSmrg   [am_cv_make_support_nested_variables],
94426df5c7cSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94526df5c7cSmrgBAR0=false
94626df5c7cSmrgBAR1=true
94726df5c7cSmrgV=1
94826df5c7cSmrgam__doit:
94926df5c7cSmrg	@$(TRUE)
95026df5c7cSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95126df5c7cSmrg  am_cv_make_support_nested_variables=yes
952054b3d00Smrgelse
95326df5c7cSmrg  am_cv_make_support_nested_variables=no
95426df5c7cSmrgfi])
95526df5c7cSmrgif test $am_cv_make_support_nested_variables = yes; then
95626df5c7cSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95726df5c7cSmrg  AM_V='$(V)'
95826df5c7cSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95926df5c7cSmrgelse
96026df5c7cSmrg  AM_V=$AM_DEFAULT_VERBOSITY
96126df5c7cSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962054b3d00Smrgfi
96326df5c7cSmrgAC_SUBST([AM_V])dnl
96426df5c7cSmrgAM_SUBST_NOTMAKE([AM_V])dnl
96526df5c7cSmrgAC_SUBST([AM_DEFAULT_V])dnl
96626df5c7cSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96726df5c7cSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96826df5c7cSmrgAM_BACKSLASH='\'
96926df5c7cSmrgAC_SUBST([AM_BACKSLASH])dnl
97026df5c7cSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97126df5c7cSmrg])
972a1d141d5Smrg
97326df5c7cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974054b3d00Smrg#
97526df5c7cSmrg# This file is free software; the Free Software Foundation
97626df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
97726df5c7cSmrg# with or without modifications, as long as this notice is preserved.
978a1d141d5Smrg
97926df5c7cSmrg# AM_PROG_INSTALL_STRIP
98026df5c7cSmrg# ---------------------
98126df5c7cSmrg# One issue with vendor 'install' (even GNU) is that you can't
98226df5c7cSmrg# specify the program used to strip binaries.  This is especially
98326df5c7cSmrg# annoying in cross-compiling environments, where the build's strip
98426df5c7cSmrg# is unlikely to handle the host's binaries.
98526df5c7cSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98626df5c7cSmrg# always use install-sh in "make install-strip", and initialize
98726df5c7cSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
98826df5c7cSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98926df5c7cSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99026df5c7cSmrg# Installed binaries are usually stripped using 'strip' when the user
99126df5c7cSmrg# run "make install-strip".  However 'strip' might not be the right
99226df5c7cSmrg# tool to use in cross-compilation environments, therefore Automake
99326df5c7cSmrg# will honor the 'STRIP' environment variable to overrule this program.
99426df5c7cSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99526df5c7cSmrgif test "$cross_compiling" != no; then
99626df5c7cSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
9972ddb6cf1Smrgfi
99826df5c7cSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99926df5c7cSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1000a1d141d5Smrg
100126df5c7cSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002054b3d00Smrg#
100326df5c7cSmrg# This file is free software; the Free Software Foundation
100426df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
100526df5c7cSmrg# with or without modifications, as long as this notice is preserved.
100655074dd0Smrg
100726df5c7cSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
100826df5c7cSmrg# ---------------------------
100926df5c7cSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101026df5c7cSmrg# This macro is traced by Automake.
101126df5c7cSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101255074dd0Smrg
101326df5c7cSmrg# AM_SUBST_NOTMAKE(VARIABLE)
101426df5c7cSmrg# --------------------------
101526df5c7cSmrg# Public sister of _AM_SUBST_NOTMAKE.
101626df5c7cSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101755074dd0Smrg
101826df5c7cSmrg# Check how to create a tarball.                            -*- Autoconf -*-
101955074dd0Smrg
102026df5c7cSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
102155074dd0Smrg#
102226df5c7cSmrg# This file is free software; the Free Software Foundation
102326df5c7cSmrg# gives unlimited permission to copy and/or distribute it,
102426df5c7cSmrg# with or without modifications, as long as this notice is preserved.
102526df5c7cSmrg
102626df5c7cSmrg# _AM_PROG_TAR(FORMAT)
102726df5c7cSmrg# --------------------
102826df5c7cSmrg# Check how to create a tarball in format FORMAT.
102926df5c7cSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10302ddb6cf1Smrg#
103126df5c7cSmrg# Substitute a variable $(am__tar) that is a command
103226df5c7cSmrg# writing to stdout a FORMAT-tarball containing the directory
103326df5c7cSmrg# $tardir.
103426df5c7cSmrg#     tardir=directory && $(am__tar) > result.tar
10352ddb6cf1Smrg#
103626df5c7cSmrg# Substitute a variable $(am__untar) that extract such
103726df5c7cSmrg# a tarball read from stdin.
103826df5c7cSmrg#     $(am__untar) < result.tar
10392ddb6cf1Smrg#
104026df5c7cSmrgAC_DEFUN([_AM_PROG_TAR],
104126df5c7cSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104226df5c7cSmrg# in the wild :-(  We should find a proper way to deprecate it ...
104326df5c7cSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10442ddb6cf1Smrg
104526df5c7cSmrg# We'll loop over all known methods to create a tar archive until one works.
104626df5c7cSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10472ddb6cf1Smrg
104826df5c7cSmrgm4_if([$1], [v7],
104926df5c7cSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10502ddb6cf1Smrg
105126df5c7cSmrg  [m4_case([$1],
105226df5c7cSmrg    [ustar],
105326df5c7cSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105426df5c7cSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105526df5c7cSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105626df5c7cSmrg      # and bug#13588).
105726df5c7cSmrg      am_max_uid=2097151 # 2^21 - 1
105826df5c7cSmrg      am_max_gid=$am_max_uid
105926df5c7cSmrg      # The $UID and $GID variables are not portable, so we need to resort
106026df5c7cSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106126df5c7cSmrg      # below are definitely unexpected, so allow the users to see them
106226df5c7cSmrg      # (that is, avoid stderr redirection).
106326df5c7cSmrg      am_uid=`id -u || echo unknown`
106426df5c7cSmrg      am_gid=`id -g || echo unknown`
106526df5c7cSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106626df5c7cSmrg      if test $am_uid -le $am_max_uid; then
106726df5c7cSmrg         AC_MSG_RESULT([yes])
106826df5c7cSmrg      else
106926df5c7cSmrg         AC_MSG_RESULT([no])
107026df5c7cSmrg         _am_tools=none
107126df5c7cSmrg      fi
107226df5c7cSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107326df5c7cSmrg      if test $am_gid -le $am_max_gid; then
107426df5c7cSmrg         AC_MSG_RESULT([yes])
107526df5c7cSmrg      else
107626df5c7cSmrg        AC_MSG_RESULT([no])
107726df5c7cSmrg        _am_tools=none
107826df5c7cSmrg      fi],
107955074dd0Smrg
108026df5c7cSmrg  [pax],
108126df5c7cSmrg    [],
10822ddb6cf1Smrg
108326df5c7cSmrg  [m4_fatal([Unknown tar format])])
10842ddb6cf1Smrg
108526df5c7cSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108655074dd0Smrg
108726df5c7cSmrg  # Go ahead even if we have the value already cached.  We do so because we
108826df5c7cSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108926df5c7cSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090054b3d00Smrg
109126df5c7cSmrg  for _am_tool in $_am_tools; do
109226df5c7cSmrg    case $_am_tool in
109326df5c7cSmrg    gnutar)
109426df5c7cSmrg      for _am_tar in tar gnutar gtar; do
109526df5c7cSmrg        AM_RUN_LOG([$_am_tar --version]) && break
109626df5c7cSmrg      done
109726df5c7cSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109826df5c7cSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109926df5c7cSmrg      am__untar="$_am_tar -xf -"
110026df5c7cSmrg      ;;
110126df5c7cSmrg    plaintar)
110226df5c7cSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110326df5c7cSmrg      # ustar tarball either.
110426df5c7cSmrg      (tar --version) >/dev/null 2>&1 && continue
110526df5c7cSmrg      am__tar='tar chf - "$$tardir"'
110626df5c7cSmrg      am__tar_='tar chf - "$tardir"'
110726df5c7cSmrg      am__untar='tar xf -'
110826df5c7cSmrg      ;;
110926df5c7cSmrg    pax)
111026df5c7cSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
111126df5c7cSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
111226df5c7cSmrg      am__untar='pax -r'
111326df5c7cSmrg      ;;
111426df5c7cSmrg    cpio)
111526df5c7cSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111626df5c7cSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111726df5c7cSmrg      am__untar='cpio -i -H $1 -d'
111826df5c7cSmrg      ;;
111926df5c7cSmrg    none)
112026df5c7cSmrg      am__tar=false
112126df5c7cSmrg      am__tar_=false
112226df5c7cSmrg      am__untar=false
112326df5c7cSmrg      ;;
112426df5c7cSmrg    esac
1125054b3d00Smrg
112626df5c7cSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
112726df5c7cSmrg    # and am__untar set.
112826df5c7cSmrg    test -n "${am_cv_prog_tar_$1}" && break
1129054b3d00Smrg
113026df5c7cSmrg    # tar/untar a dummy directory, and stop if the command works.
113126df5c7cSmrg    rm -rf conftest.dir
113226df5c7cSmrg    mkdir conftest.dir
113326df5c7cSmrg    echo GrepMe > conftest.dir/file
113426df5c7cSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113526df5c7cSmrg    rm -rf conftest.dir
113626df5c7cSmrg    if test -s conftest.tar; then
113726df5c7cSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
113826df5c7cSmrg      AM_RUN_LOG([cat conftest.dir/file])
113926df5c7cSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114026df5c7cSmrg    fi
114126df5c7cSmrg  done
114226df5c7cSmrg  rm -rf conftest.dir
114355074dd0Smrg
114426df5c7cSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114526df5c7cSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146054b3d00Smrg
114726df5c7cSmrgAC_SUBST([am__tar])
114826df5c7cSmrgAC_SUBST([am__untar])
114926df5c7cSmrg]) # _AM_PROG_TAR
1150054b3d00Smrg
115126df5c7cSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
115226df5c7cSmrgdnl serial 11 (pkg-config-0.29)
115326df5c7cSmrgdnl
115426df5c7cSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115526df5c7cSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
115626df5c7cSmrgdnl
115726df5c7cSmrgdnl This program is free software; you can redistribute it and/or modify
115826df5c7cSmrgdnl it under the terms of the GNU General Public License as published by
115926df5c7cSmrgdnl the Free Software Foundation; either version 2 of the License, or
116026df5c7cSmrgdnl (at your option) any later version.
116126df5c7cSmrgdnl
116226df5c7cSmrgdnl This program is distributed in the hope that it will be useful, but
116326df5c7cSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
116426df5c7cSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
116526df5c7cSmrgdnl General Public License for more details.
116626df5c7cSmrgdnl
116726df5c7cSmrgdnl You should have received a copy of the GNU General Public License
116826df5c7cSmrgdnl along with this program; if not, write to the Free Software
116926df5c7cSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
117026df5c7cSmrgdnl 02111-1307, USA.
117126df5c7cSmrgdnl
117226df5c7cSmrgdnl As a special exception to the GNU General Public License, if you
117326df5c7cSmrgdnl distribute this file as part of a program that contains a
117426df5c7cSmrgdnl configuration script generated by Autoconf, you may include it under
117526df5c7cSmrgdnl the same distribution terms that you use for the rest of that
117626df5c7cSmrgdnl program.
1177054b3d00Smrg
117826df5c7cSmrgdnl PKG_PREREQ(MIN-VERSION)
117926df5c7cSmrgdnl -----------------------
118026df5c7cSmrgdnl Since: 0.29
118126df5c7cSmrgdnl
118226df5c7cSmrgdnl Verify that the version of the pkg-config macros are at least
118326df5c7cSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
118426df5c7cSmrgdnl installed version of pkg-config, this checks the developer's version
118526df5c7cSmrgdnl of pkg.m4 when generating configure.
118626df5c7cSmrgdnl
118726df5c7cSmrgdnl To ensure that this macro is defined, also add:
118826df5c7cSmrgdnl m4_ifndef([PKG_PREREQ],
118926df5c7cSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
119026df5c7cSmrgdnl
119126df5c7cSmrgdnl See the "Since" comment for each macro you use to see what version
119226df5c7cSmrgdnl of the macros you require.
119326df5c7cSmrgm4_defun([PKG_PREREQ],
119426df5c7cSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
119526df5c7cSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
119626df5c7cSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
119726df5c7cSmrg])dnl PKG_PREREQ
1198054b3d00Smrg
119926df5c7cSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
120026df5c7cSmrgdnl ----------------------------------
120126df5c7cSmrgdnl Since: 0.16
120226df5c7cSmrgdnl
120326df5c7cSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
120426df5c7cSmrgdnl first found in the path. Checks that the version of pkg-config found
120526df5c7cSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
120626df5c7cSmrgdnl used since that's the first version where most current features of
120726df5c7cSmrgdnl pkg-config existed.
120826df5c7cSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120926df5c7cSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
121026df5c7cSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
121126df5c7cSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
121226df5c7cSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
121326df5c7cSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
121426df5c7cSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215054b3d00Smrg
121626df5c7cSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121726df5c7cSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218054b3d00Smrgfi
121926df5c7cSmrgif test -n "$PKG_CONFIG"; then
122026df5c7cSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
122126df5c7cSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122226df5c7cSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122326df5c7cSmrg		AC_MSG_RESULT([yes])
122426df5c7cSmrg	else
122526df5c7cSmrg		AC_MSG_RESULT([no])
122626df5c7cSmrg		PKG_CONFIG=""
122726df5c7cSmrg	fi
122826df5c7cSmrgfi[]dnl
122926df5c7cSmrg])dnl PKG_PROG_PKG_CONFIG
1230054b3d00Smrg
123126df5c7cSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
123226df5c7cSmrgdnl -------------------------------------------------------------------
123326df5c7cSmrgdnl Since: 0.18
123426df5c7cSmrgdnl
123526df5c7cSmrgdnl Check to see whether a particular set of modules exists. Similar to
123626df5c7cSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
123726df5c7cSmrgdnl
123826df5c7cSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123926df5c7cSmrgdnl only at the first occurence in configure.ac, so if the first place
124026df5c7cSmrgdnl it's called might be skipped (such as if it is within an "if", you
124126df5c7cSmrgdnl have to call PKG_CHECK_EXISTS manually
124226df5c7cSmrgAC_DEFUN([PKG_CHECK_EXISTS],
124326df5c7cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124426df5c7cSmrgif test -n "$PKG_CONFIG" && \
124526df5c7cSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
124626df5c7cSmrg  m4_default([$2], [:])
124726df5c7cSmrgm4_ifvaln([$3], [else
124826df5c7cSmrg  $3])dnl
124926df5c7cSmrgfi])
125026df5c7cSmrg
125126df5c7cSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
125226df5c7cSmrgdnl ---------------------------------------------
125326df5c7cSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
125426df5c7cSmrgdnl pkg_failed based on the result.
125526df5c7cSmrgm4_define([_PKG_CONFIG],
125626df5c7cSmrg[if test -n "$$1"; then
125726df5c7cSmrg    pkg_cv_[]$1="$$1"
125826df5c7cSmrg elif test -n "$PKG_CONFIG"; then
125926df5c7cSmrg    PKG_CHECK_EXISTS([$3],
126026df5c7cSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
126126df5c7cSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
126226df5c7cSmrg		     [pkg_failed=yes])
126326df5c7cSmrg else
126426df5c7cSmrg    pkg_failed=untried
126526df5c7cSmrgfi[]dnl
126626df5c7cSmrg])dnl _PKG_CONFIG
126726df5c7cSmrg
126826df5c7cSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
126926df5c7cSmrgdnl ---------------------------
127026df5c7cSmrgdnl Internal check to see if pkg-config supports short errors.
127126df5c7cSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127226df5c7cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127326df5c7cSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127426df5c7cSmrg        _pkg_short_errors_supported=yes
127555074dd0Smrgelse
127626df5c7cSmrg        _pkg_short_errors_supported=no
127726df5c7cSmrgfi[]dnl
127826df5c7cSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
12792ddb6cf1Smrg
128055074dd0Smrg
128126df5c7cSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
128226df5c7cSmrgdnl   [ACTION-IF-NOT-FOUND])
128326df5c7cSmrgdnl --------------------------------------------------------------
128426df5c7cSmrgdnl Since: 0.4.0
128526df5c7cSmrgdnl
128626df5c7cSmrgdnl Note that if there is a possibility the first call to
128726df5c7cSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
128826df5c7cSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128926df5c7cSmrgAC_DEFUN([PKG_CHECK_MODULES],
129026df5c7cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129126df5c7cSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129226df5c7cSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293054b3d00Smrg
129426df5c7cSmrgpkg_failed=no
129526df5c7cSmrgAC_MSG_CHECKING([for $1])
1296054b3d00Smrg
129726df5c7cSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129826df5c7cSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299054b3d00Smrg
130026df5c7cSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130126df5c7cSmrgand $1[]_LIBS to avoid the need to call pkg-config.
130226df5c7cSmrgSee the pkg-config man page for more details.])
1303054b3d00Smrg
130426df5c7cSmrgif test $pkg_failed = yes; then
130526df5c7cSmrg   	AC_MSG_RESULT([no])
130626df5c7cSmrg        _PKG_SHORT_ERRORS_SUPPORTED
130726df5c7cSmrg        if test $_pkg_short_errors_supported = yes; then
130826df5c7cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130926df5c7cSmrg        else 
131026df5c7cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131126df5c7cSmrg        fi
131226df5c7cSmrg	# Put the nasty error message in config.log where it belongs
131326df5c7cSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314054b3d00Smrg
131526df5c7cSmrg	m4_default([$4], [AC_MSG_ERROR(
131626df5c7cSmrg[Package requirements ($2) were not met:
1317054b3d00Smrg
131826df5c7cSmrg$$1_PKG_ERRORS
131926df5c7cSmrg
132026df5c7cSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132126df5c7cSmrginstalled software in a non-standard prefix.
132226df5c7cSmrg
132326df5c7cSmrg_PKG_TEXT])[]dnl
132426df5c7cSmrg        ])
132526df5c7cSmrgelif test $pkg_failed = untried; then
132626df5c7cSmrg     	AC_MSG_RESULT([no])
132726df5c7cSmrg	m4_default([$4], [AC_MSG_FAILURE(
132826df5c7cSmrg[The pkg-config script could not be found or is too old.  Make sure it
132926df5c7cSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
133026df5c7cSmrgpath to pkg-config.
133126df5c7cSmrg
133226df5c7cSmrg_PKG_TEXT
133326df5c7cSmrg
133426df5c7cSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
133526df5c7cSmrg        ])
133655074dd0Smrgelse
133726df5c7cSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133826df5c7cSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133926df5c7cSmrg        AC_MSG_RESULT([yes])
134026df5c7cSmrg	$3
134126df5c7cSmrgfi[]dnl
134226df5c7cSmrg])dnl PKG_CHECK_MODULES
1343a1d141d5Smrg
1344054b3d00Smrg
134526df5c7cSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
134626df5c7cSmrgdnl   [ACTION-IF-NOT-FOUND])
134726df5c7cSmrgdnl ---------------------------------------------------------------------
134826df5c7cSmrgdnl Since: 0.29
134926df5c7cSmrgdnl
135026df5c7cSmrgdnl Checks for existence of MODULES and gathers its build flags with
135126df5c7cSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
135226df5c7cSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
135326df5c7cSmrgdnl
135426df5c7cSmrgdnl Note that if there is a possibility the first call to
135526df5c7cSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
135626df5c7cSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
135726df5c7cSmrgdnl configure.ac.
135826df5c7cSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
135926df5c7cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
136026df5c7cSmrg_save_PKG_CONFIG=$PKG_CONFIG
136126df5c7cSmrgPKG_CONFIG="$PKG_CONFIG --static"
136226df5c7cSmrgPKG_CHECK_MODULES($@)
136326df5c7cSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
136426df5c7cSmrg])dnl PKG_CHECK_MODULES_STATIC
136555074dd0Smrg
1366054b3d00Smrg
136726df5c7cSmrgdnl PKG_INSTALLDIR([DIRECTORY])
136826df5c7cSmrgdnl -------------------------
136926df5c7cSmrgdnl Since: 0.27
137026df5c7cSmrgdnl
137126df5c7cSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
137226df5c7cSmrgdnl should install pkg-config .pc files. By default the directory is
137326df5c7cSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
137426df5c7cSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
137526df5c7cSmrgdnl parameter.
137626df5c7cSmrgAC_DEFUN([PKG_INSTALLDIR],
137726df5c7cSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
137826df5c7cSmrgm4_pushdef([pkg_description],
137926df5c7cSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
138026df5c7cSmrgAC_ARG_WITH([pkgconfigdir],
138126df5c7cSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
138226df5c7cSmrg    [with_pkgconfigdir=]pkg_default)
138326df5c7cSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
138426df5c7cSmrgm4_popdef([pkg_default])
138526df5c7cSmrgm4_popdef([pkg_description])
138626df5c7cSmrg])dnl PKG_INSTALLDIR
138726df5c7cSmrg
138826df5c7cSmrg
138926df5c7cSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
139026df5c7cSmrgdnl --------------------------------
139126df5c7cSmrgdnl Since: 0.27
139226df5c7cSmrgdnl
139326df5c7cSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
139426df5c7cSmrgdnl module should install arch-independent pkg-config .pc files. By
139526df5c7cSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
139626df5c7cSmrgdnl changed by passing DIRECTORY. The user can override through the
139726df5c7cSmrgdnl --with-noarch-pkgconfigdir parameter.
139826df5c7cSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
139926df5c7cSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
140026df5c7cSmrgm4_pushdef([pkg_description],
140126df5c7cSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
140226df5c7cSmrgAC_ARG_WITH([noarch-pkgconfigdir],
140326df5c7cSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
140426df5c7cSmrg    [with_noarch_pkgconfigdir=]pkg_default)
140526df5c7cSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
140626df5c7cSmrgm4_popdef([pkg_default])
140726df5c7cSmrgm4_popdef([pkg_description])
140826df5c7cSmrg])dnl PKG_NOARCH_INSTALLDIR
140926df5c7cSmrg
1410054b3d00Smrg
141126df5c7cSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
141226df5c7cSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
141326df5c7cSmrgdnl -------------------------------------------
141426df5c7cSmrgdnl Since: 0.28
141526df5c7cSmrgdnl
141626df5c7cSmrgdnl Retrieves the value of the pkg-config variable for the given module.
141726df5c7cSmrgAC_DEFUN([PKG_CHECK_VAR],
141826df5c7cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
141926df5c7cSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
14202ddb6cf1Smrg
142126df5c7cSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
142226df5c7cSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
14232ddb6cf1Smrg
142426df5c7cSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
142526df5c7cSmrg])dnl PKG_CHECK_VAR
14262ddb6cf1Smrg
142726df5c7cSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142826df5c7cSmrgdnl
14293bee1c92Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
143026df5c7cSmrgdnl
143126df5c7cSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143226df5c7cSmrgdnl copy of this software and associated documentation files (the "Software"),
143326df5c7cSmrgdnl to deal in the Software without restriction, including without limitation
143426df5c7cSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143526df5c7cSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
143626df5c7cSmrgdnl Software is furnished to do so, subject to the following conditions:
143726df5c7cSmrgdnl
143826df5c7cSmrgdnl The above copyright notice and this permission notice (including the next
143926df5c7cSmrgdnl paragraph) shall be included in all copies or substantial portions of the
144026df5c7cSmrgdnl Software.
144126df5c7cSmrgdnl
144226df5c7cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144326df5c7cSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144426df5c7cSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144526df5c7cSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144626df5c7cSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144726df5c7cSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144826df5c7cSmrgdnl DEALINGS IN THE SOFTWARE.
14492ddb6cf1Smrg
145026df5c7cSmrg# XORG_MACROS_VERSION(required-version)
145126df5c7cSmrg# -------------------------------------
1452054b3d00Smrg# Minimum version: 1.1.0
145355074dd0Smrg#
145426df5c7cSmrg# If you're using a macro added in Version 1.1 or newer, include this in
145526df5c7cSmrg# your configure.ac with the minimum required version, such as:
145626df5c7cSmrg# XORG_MACROS_VERSION(1.1)
145755074dd0Smrg#
145826df5c7cSmrg# To ensure that this macro is defined, also add:
145926df5c7cSmrg# m4_ifndef([XORG_MACROS_VERSION],
146026df5c7cSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
146155074dd0Smrg#
146226df5c7cSmrg#
146326df5c7cSmrg# See the "minimum version" comment for each macro you use to see what
146426df5c7cSmrg# version you require.
146526df5c7cSmrgm4_defun([XORG_MACROS_VERSION],[
14663bee1c92Smrgm4_define([vers_have], [1.20.0])
146726df5c7cSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146826df5c7cSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
146926df5c7cSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147026df5c7cSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147126df5c7cSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147226df5c7cSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147326df5c7cSmrgm4_undefine([vers_have])
147426df5c7cSmrgm4_undefine([maj_have])
147526df5c7cSmrgm4_undefine([maj_needed])
147626df5c7cSmrg]) # XORG_MACROS_VERSION
147755074dd0Smrg
147826df5c7cSmrg# XORG_PROG_RAWCPP()
147926df5c7cSmrg# ------------------
148026df5c7cSmrg# Minimum version: 1.0.0
148126df5c7cSmrg#
148226df5c7cSmrg# Find cpp program and necessary flags for use in pre-processing text files
148326df5c7cSmrg# such as man pages and config files
148426df5c7cSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148526df5c7cSmrgAC_REQUIRE([AC_PROG_CPP])
148626df5c7cSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148726df5c7cSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1488054b3d00Smrg
148926df5c7cSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149026df5c7cSmrg# which is not the best choice for supporting other OS'es, but covers most
149126df5c7cSmrg# of the ones we need for now.
149226df5c7cSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149326df5c7cSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149426df5c7cSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149526df5c7cSmrg	AC_MSG_RESULT([no])
149626df5c7cSmrgelse
149726df5c7cSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149826df5c7cSmrg		RAWCPPFLAGS=-undef
149926df5c7cSmrg		AC_MSG_RESULT([yes])
150026df5c7cSmrg	# under Cygwin unix is still defined even with -undef
150126df5c7cSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150226df5c7cSmrg		RAWCPPFLAGS="-undef -ansi"
150326df5c7cSmrg		AC_MSG_RESULT([yes, with -ansi])
150426df5c7cSmrg	else
150526df5c7cSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150626df5c7cSmrg	fi
1507054b3d00Smrgfi
150826df5c7cSmrgrm -f conftest.$ac_ext
1509054b3d00Smrg
151026df5c7cSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151126df5c7cSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151226df5c7cSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151326df5c7cSmrg	AC_MSG_RESULT([no])
151426df5c7cSmrgelse
151526df5c7cSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151626df5c7cSmrg		TRADITIONALCPPFLAGS="-traditional"
151726df5c7cSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151826df5c7cSmrg		AC_MSG_RESULT([yes])
151926df5c7cSmrg	else
152026df5c7cSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152126df5c7cSmrg	fi
152226df5c7cSmrgfi
152326df5c7cSmrgrm -f conftest.$ac_ext
152426df5c7cSmrgAC_SUBST(RAWCPPFLAGS)
152526df5c7cSmrgAC_SUBST(TRADITIONALCPPFLAGS)
152626df5c7cSmrg]) # XORG_PROG_RAWCPP
1527054b3d00Smrg
152826df5c7cSmrg# XORG_MANPAGE_SECTIONS()
152926df5c7cSmrg# -----------------------
153026df5c7cSmrg# Minimum version: 1.0.0
1531054b3d00Smrg#
153226df5c7cSmrg# Determine which sections man pages go in for the different man page types
153326df5c7cSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153426df5c7cSmrg# Not sure if there's any better way than just hardcoding by OS name.
153526df5c7cSmrg# Override default settings by setting environment variables
153626df5c7cSmrg# Added MAN_SUBSTS in version 1.8
153726df5c7cSmrg# Added AC_PROG_SED in version 1.8
1538054b3d00Smrg
153926df5c7cSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154026df5c7cSmrgAC_REQUIRE([AC_CANONICAL_HOST])
154126df5c7cSmrgAC_REQUIRE([AC_PROG_SED])
1542054b3d00Smrg
154326df5c7cSmrgcase $host_os in
154426df5c7cSmrg    solaris*)
154526df5c7cSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
154626df5c7cSmrg        # check for a man page file found in later versions that use
154726df5c7cSmrg        # traditional section numbers instead
154826df5c7cSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
154926df5c7cSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
155026df5c7cSmrg        ;;
155126df5c7cSmrg    *) SYSV_MAN_SECTIONS=false ;;
155226df5c7cSmrgesac
1553054b3d00Smrg
155426df5c7cSmrgif test x$APP_MAN_SUFFIX = x    ; then
155526df5c7cSmrg    APP_MAN_SUFFIX=1
155626df5c7cSmrgfi
155726df5c7cSmrgif test x$APP_MAN_DIR = x    ; then
155826df5c7cSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
155926df5c7cSmrgfi
1560054b3d00Smrg
156126df5c7cSmrgif test x$LIB_MAN_SUFFIX = x    ; then
156226df5c7cSmrg    LIB_MAN_SUFFIX=3
156326df5c7cSmrgfi
156426df5c7cSmrgif test x$LIB_MAN_DIR = x    ; then
156526df5c7cSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
156626df5c7cSmrgfi
1567054b3d00Smrg
156826df5c7cSmrgif test x$FILE_MAN_SUFFIX = x    ; then
156926df5c7cSmrg    case $SYSV_MAN_SECTIONS in
157026df5c7cSmrg	true)				FILE_MAN_SUFFIX=4  ;;
157126df5c7cSmrg	*)				FILE_MAN_SUFFIX=5  ;;
157226df5c7cSmrg    esac
157326df5c7cSmrgfi
157426df5c7cSmrgif test x$FILE_MAN_DIR = x    ; then
157526df5c7cSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576054b3d00Smrgfi
1577054b3d00Smrg
157826df5c7cSmrgif test x$MISC_MAN_SUFFIX = x    ; then
157926df5c7cSmrg    case $SYSV_MAN_SECTIONS in
158026df5c7cSmrg	true)				MISC_MAN_SUFFIX=5  ;;
158126df5c7cSmrg	*)				MISC_MAN_SUFFIX=7  ;;
158226df5c7cSmrg    esac
158326df5c7cSmrgfi
158426df5c7cSmrgif test x$MISC_MAN_DIR = x    ; then
158526df5c7cSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586054b3d00Smrgfi
1587054b3d00Smrg
158826df5c7cSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
158926df5c7cSmrg    case $SYSV_MAN_SECTIONS in
159026df5c7cSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
159126df5c7cSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159226df5c7cSmrg    esac
159326df5c7cSmrgfi
159426df5c7cSmrgif test x$DRIVER_MAN_DIR = x    ; then
159526df5c7cSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159626df5c7cSmrgfi
1597054b3d00Smrg
159826df5c7cSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
159926df5c7cSmrg    case $SYSV_MAN_SECTIONS in
160026df5c7cSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
160126df5c7cSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160226df5c7cSmrg    esac
160326df5c7cSmrgfi
160426df5c7cSmrgif test x$ADMIN_MAN_DIR = x    ; then
160526df5c7cSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160626df5c7cSmrgfi
1607054b3d00Smrg
1608054b3d00Smrg
160926df5c7cSmrgAC_SUBST([APP_MAN_SUFFIX])
161026df5c7cSmrgAC_SUBST([LIB_MAN_SUFFIX])
161126df5c7cSmrgAC_SUBST([FILE_MAN_SUFFIX])
161226df5c7cSmrgAC_SUBST([MISC_MAN_SUFFIX])
161326df5c7cSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161426df5c7cSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161526df5c7cSmrgAC_SUBST([APP_MAN_DIR])
161626df5c7cSmrgAC_SUBST([LIB_MAN_DIR])
161726df5c7cSmrgAC_SUBST([FILE_MAN_DIR])
161826df5c7cSmrgAC_SUBST([MISC_MAN_DIR])
161926df5c7cSmrgAC_SUBST([DRIVER_MAN_DIR])
162026df5c7cSmrgAC_SUBST([ADMIN_MAN_DIR])
1621054b3d00Smrg
162226df5c7cSmrgXORG_MAN_PAGE="X Version 11"
162326df5c7cSmrgAC_SUBST([XORG_MAN_PAGE])
162426df5c7cSmrgMAN_SUBSTS="\
162526df5c7cSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162626df5c7cSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162726df5c7cSmrg	-e 's|__xservername__|Xorg|g' \
162826df5c7cSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
162926df5c7cSmrg	-e 's|__projectroot__|\$(prefix)|g' \
163026df5c7cSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163126df5c7cSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163226df5c7cSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163326df5c7cSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163426df5c7cSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163526df5c7cSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163626df5c7cSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163726df5c7cSmrgAC_SUBST([MAN_SUBSTS])
1638054b3d00Smrg
163926df5c7cSmrg]) # XORG_MANPAGE_SECTIONS
1640054b3d00Smrg
164126df5c7cSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164226df5c7cSmrg# ------------------------
164326df5c7cSmrg# Minimum version: 1.7.0
1644054b3d00Smrg#
164526df5c7cSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164626df5c7cSmrg# provided by xorg-sgml-doctools, if installed.
164726df5c7cSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164826df5c7cSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164926df5c7cSmrgXORG_SGML_PATH=
165026df5c7cSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165126df5c7cSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165226df5c7cSmrg    [m4_ifval([$1],[:],
165326df5c7cSmrg        [if test x"$cross_compiling" != x"yes" ; then
165426df5c7cSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165526df5c7cSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165626df5c7cSmrg         fi])
165726df5c7cSmrg    ])
165826df5c7cSmrg
165926df5c7cSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166026df5c7cSmrg# the path and the name of the doc stylesheet
166126df5c7cSmrgif test "x$XORG_SGML_PATH" != "x" ; then
166226df5c7cSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166326df5c7cSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166426df5c7cSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166526df5c7cSmrgelse
166626df5c7cSmrg   AC_MSG_RESULT([no])
166726df5c7cSmrgfi
166826df5c7cSmrg
166926df5c7cSmrgAC_SUBST(XORG_SGML_PATH)
167026df5c7cSmrgAC_SUBST(STYLESHEET_SRCDIR)
167126df5c7cSmrgAC_SUBST(XSL_STYLESHEET)
167226df5c7cSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167326df5c7cSmrg]) # XORG_CHECK_SGML_DOCTOOLS
167426df5c7cSmrg
167526df5c7cSmrg# XORG_CHECK_LINUXDOC
167626df5c7cSmrg# -------------------
167726df5c7cSmrg# Minimum version: 1.0.0
1678054b3d00Smrg#
167926df5c7cSmrg# Defines the variable MAKE_TEXT if the necessary tools and
168026df5c7cSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168126df5c7cSmrg# Whether or not the necessary tools and files are found can be checked
168226df5c7cSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168326df5c7cSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168426df5c7cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168526df5c7cSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686054b3d00Smrg
168726df5c7cSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688054b3d00Smrg
168926df5c7cSmrgAC_MSG_CHECKING([whether to build documentation])
169026df5c7cSmrg
169126df5c7cSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169226df5c7cSmrg   BUILDDOC=yes
169355074dd0Smrgelse
169426df5c7cSmrg   BUILDDOC=no
169555074dd0Smrgfi
16962ddb6cf1Smrg
169726df5c7cSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698054b3d00Smrg
169926df5c7cSmrgAC_MSG_RESULT([$BUILDDOC])
170055074dd0Smrg
170126df5c7cSmrgAC_MSG_CHECKING([whether to build pdf documentation])
170226df5c7cSmrg
170326df5c7cSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170426df5c7cSmrg   BUILDPDFDOC=yes
170526df5c7cSmrgelse
170626df5c7cSmrg   BUILDPDFDOC=no
170726df5c7cSmrgfi
170826df5c7cSmrg
170926df5c7cSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171026df5c7cSmrg
171126df5c7cSmrgAC_MSG_RESULT([$BUILDPDFDOC])
171226df5c7cSmrg
171326df5c7cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171426df5c7cSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171526df5c7cSmrgMAKE_PDF="$PS2PDF"
171626df5c7cSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171726df5c7cSmrg
171826df5c7cSmrgAC_SUBST(MAKE_TEXT)
171926df5c7cSmrgAC_SUBST(MAKE_PS)
172026df5c7cSmrgAC_SUBST(MAKE_PDF)
172126df5c7cSmrgAC_SUBST(MAKE_HTML)
172226df5c7cSmrg]) # XORG_CHECK_LINUXDOC
172326df5c7cSmrg
172426df5c7cSmrg# XORG_CHECK_DOCBOOK
172526df5c7cSmrg# -------------------
172626df5c7cSmrg# Minimum version: 1.0.0
172726df5c7cSmrg#
172826df5c7cSmrg# Checks for the ability to build output formats from SGML DocBook source.
172926df5c7cSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173026df5c7cSmrg# indicates whether the necessary tools and files are found and, if set,
173126df5c7cSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173226df5c7cSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173326df5c7cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
173426df5c7cSmrg
173526df5c7cSmrgBUILDTXTDOC=no
173626df5c7cSmrgBUILDPDFDOC=no
173726df5c7cSmrgBUILDPSDOC=no
173826df5c7cSmrgBUILDHTMLDOC=no
173926df5c7cSmrg
174026df5c7cSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174126df5c7cSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174226df5c7cSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174326df5c7cSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744054b3d00Smrg
174526df5c7cSmrgAC_MSG_CHECKING([whether to build text documentation])
174626df5c7cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174726df5c7cSmrg   test x$BUILD_TXTDOC != xno; then
174826df5c7cSmrg	BUILDTXTDOC=yes
174926df5c7cSmrgfi
175026df5c7cSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175126df5c7cSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752054b3d00Smrg
175326df5c7cSmrgAC_MSG_CHECKING([whether to build PDF documentation])
175426df5c7cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175526df5c7cSmrg   test x$BUILD_PDFDOC != xno; then
175626df5c7cSmrg	BUILDPDFDOC=yes
175726df5c7cSmrgfi
175826df5c7cSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175926df5c7cSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760054b3d00Smrg
176126df5c7cSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176226df5c7cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176326df5c7cSmrg   test x$BUILD_PSDOC != xno; then
176426df5c7cSmrg	BUILDPSDOC=yes
176555074dd0Smrgfi
176626df5c7cSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176726df5c7cSmrgAC_MSG_RESULT([$BUILDPSDOC])
17682ddb6cf1Smrg
176926df5c7cSmrgAC_MSG_CHECKING([whether to build HTML documentation])
177026df5c7cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177126df5c7cSmrg   test x$BUILD_HTMLDOC != xno; then
177226df5c7cSmrg	BUILDHTMLDOC=yes
177326df5c7cSmrgfi
177426df5c7cSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177526df5c7cSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776054b3d00Smrg
177726df5c7cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177826df5c7cSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177926df5c7cSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178026df5c7cSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178126df5c7cSmrg
178226df5c7cSmrgAC_SUBST(MAKE_TEXT)
178326df5c7cSmrgAC_SUBST(MAKE_PS)
178426df5c7cSmrgAC_SUBST(MAKE_PDF)
178526df5c7cSmrgAC_SUBST(MAKE_HTML)
178626df5c7cSmrg]) # XORG_CHECK_DOCBOOK
178726df5c7cSmrg
178826df5c7cSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178926df5c7cSmrg# ----------------
179026df5c7cSmrg# Minimum version: 1.5.0
179126df5c7cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
179255074dd0Smrg#
179326df5c7cSmrg# Documentation tools are not always available on all platforms and sometimes
179426df5c7cSmrg# not at the appropriate level. This macro enables a module to test for the
179526df5c7cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
17963bee1c92Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
179726df5c7cSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179826df5c7cSmrg# --with-xmlto assumes 'auto'.
179955074dd0Smrg#
180026df5c7cSmrg# Interface to module:
180126df5c7cSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180226df5c7cSmrg# XMLTO:	returns the path of the xmlto program found
180326df5c7cSmrg#		returns the path set by the user in the environment
180426df5c7cSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180526df5c7cSmrg#		'no' user instructs the module not to use xmlto
180655074dd0Smrg#
180726df5c7cSmrg# Added in version 1.10.0
180826df5c7cSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180926df5c7cSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
181055074dd0Smrg#
181126df5c7cSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
181255074dd0Smrg#
181326df5c7cSmrgAC_DEFUN([XORG_WITH_XMLTO],[
181426df5c7cSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181526df5c7cSmrgm4_define([_defopt], m4_default([$2], [auto]))
181626df5c7cSmrgAC_ARG_WITH(xmlto,
181726df5c7cSmrg	AS_HELP_STRING([--with-xmlto],
181826df5c7cSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181926df5c7cSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182026df5c7cSmrgm4_undefine([_defopt])
182155074dd0Smrg
182226df5c7cSmrgif test "x$use_xmlto" = x"auto"; then
182326df5c7cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
182426df5c7cSmrg   if test "x$XMLTO" = "x"; then
182526df5c7cSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182626df5c7cSmrg	have_xmlto=no
182726df5c7cSmrg   else
182826df5c7cSmrg        have_xmlto=yes
182926df5c7cSmrg   fi
183026df5c7cSmrgelif test "x$use_xmlto" = x"yes" ; then
183126df5c7cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
183226df5c7cSmrg   if test "x$XMLTO" = "x"; then
183326df5c7cSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183426df5c7cSmrg   fi
183526df5c7cSmrg   have_xmlto=yes
183626df5c7cSmrgelif test "x$use_xmlto" = x"no" ; then
183726df5c7cSmrg   if test "x$XMLTO" != "x"; then
183826df5c7cSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183926df5c7cSmrg   fi
184026df5c7cSmrg   have_xmlto=no
184126df5c7cSmrgelse
184226df5c7cSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184326df5c7cSmrgfi
1844054b3d00Smrg
184526df5c7cSmrg# Test for a minimum version of xmlto, if provided.
184626df5c7cSmrgm4_ifval([$1],
184726df5c7cSmrg[if test "$have_xmlto" = yes; then
184826df5c7cSmrg    # scrape the xmlto version
184926df5c7cSmrg    AC_MSG_CHECKING([the xmlto version])
185026df5c7cSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185126df5c7cSmrg    AC_MSG_RESULT([$xmlto_version])
185226df5c7cSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185326df5c7cSmrg        [if test "x$use_xmlto" = xauto; then
185426df5c7cSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185526df5c7cSmrg            have_xmlto=no
185626df5c7cSmrg        else
185726df5c7cSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185826df5c7cSmrg        fi])
185926df5c7cSmrgfi])
1860054b3d00Smrg
186126df5c7cSmrg# Test for the ability of xmlto to generate a text target
186226df5c7cSmrg#
186326df5c7cSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
186426df5c7cSmrg# following test for empty XML docbook files.
186526df5c7cSmrg# For compatibility reasons use the following empty XML docbook file and if
186626df5c7cSmrg# it fails try it again with a non-empty XML file.
186726df5c7cSmrghave_xmlto_text=no
186826df5c7cSmrgcat > conftest.xml << "EOF"
186926df5c7cSmrgEOF
187026df5c7cSmrgAS_IF([test "$have_xmlto" = yes],
187126df5c7cSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187226df5c7cSmrg             [have_xmlto_text=yes],
187326df5c7cSmrg             [# Try it again with a non-empty XML file.
187426df5c7cSmrg              cat > conftest.xml << "EOF"
187526df5c7cSmrg<x></x>
187626df5c7cSmrgEOF
187726df5c7cSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187826df5c7cSmrg                    [have_xmlto_text=yes],
187926df5c7cSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188026df5c7cSmrgrm -f conftest.xml
188126df5c7cSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188226df5c7cSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188326df5c7cSmrg]) # XORG_WITH_XMLTO
1884054b3d00Smrg
188526df5c7cSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188626df5c7cSmrg# --------------------------------------------
188726df5c7cSmrg# Minimum version: 1.12.0
188826df5c7cSmrg# Minimum version for optional DEFAULT argument: 1.12.0
188926df5c7cSmrg#
189026df5c7cSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189126df5c7cSmrg# XML-based language used for the transformation of XML documents.
189226df5c7cSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189326df5c7cSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189426df5c7cSmrg# The XSLT processor is often used as a standalone tool for transformations.
189526df5c7cSmrg# It should not be assumed that this tool is used only to work with documnetation.
189626df5c7cSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189726df5c7cSmrg#
189826df5c7cSmrg# Interface to module:
189926df5c7cSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190026df5c7cSmrg# XSLTPROC:	 returns the path of the xsltproc program found
190126df5c7cSmrg#		 returns the path set by the user in the environment
190226df5c7cSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190326df5c7cSmrg#		  'no' user instructs the module not to use xsltproc
190426df5c7cSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190526df5c7cSmrg#
190626df5c7cSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190726df5c7cSmrg#
190826df5c7cSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190926df5c7cSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191026df5c7cSmrg# Preserves the interface, should it be implemented later
191126df5c7cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191226df5c7cSmrgm4_define([_defopt], m4_default([$2], [auto]))
191326df5c7cSmrgAC_ARG_WITH(xsltproc,
191426df5c7cSmrg	AS_HELP_STRING([--with-xsltproc],
191526df5c7cSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191626df5c7cSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191726df5c7cSmrgm4_undefine([_defopt])
1918054b3d00Smrg
191926df5c7cSmrgif test "x$use_xsltproc" = x"auto"; then
192026df5c7cSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192126df5c7cSmrg   if test "x$XSLTPROC" = "x"; then
192226df5c7cSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192326df5c7cSmrg	have_xsltproc=no
192426df5c7cSmrg   else
192526df5c7cSmrg        have_xsltproc=yes
192626df5c7cSmrg   fi
192726df5c7cSmrgelif test "x$use_xsltproc" = x"yes" ; then
192826df5c7cSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192926df5c7cSmrg   if test "x$XSLTPROC" = "x"; then
193026df5c7cSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193126df5c7cSmrg   fi
193226df5c7cSmrg   have_xsltproc=yes
193326df5c7cSmrgelif test "x$use_xsltproc" = x"no" ; then
193426df5c7cSmrg   if test "x$XSLTPROC" != "x"; then
193526df5c7cSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193626df5c7cSmrg   fi
193726df5c7cSmrg   have_xsltproc=no
193826df5c7cSmrgelse
193926df5c7cSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940054b3d00Smrgfi
1941054b3d00Smrg
194226df5c7cSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194326df5c7cSmrg]) # XORG_WITH_XSLTPROC
194426df5c7cSmrg
194526df5c7cSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194626df5c7cSmrg# ----------------------------------------
194726df5c7cSmrg# Minimum version: 1.15.0
194855074dd0Smrg#
194926df5c7cSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
195026df5c7cSmrg# scanning arbitrary text files, extracting information from those text files,
195126df5c7cSmrg# and printing reports based on that information.
195255074dd0Smrg#
195326df5c7cSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
19542ddb6cf1Smrg#
195526df5c7cSmrg# Interface to module:
195626df5c7cSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
195726df5c7cSmrg# PERL:	     returns the path of the perl program found
195826df5c7cSmrg#	     returns the path set by the user in the environment
195926df5c7cSmrg# --with-perl: 'yes' user instructs the module to use perl
196026df5c7cSmrg#	       'no' user instructs the module not to use perl
196126df5c7cSmrg# have_perl: returns yes if perl found in PATH or no
1962054b3d00Smrg#
196326df5c7cSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196426df5c7cSmrg#
196526df5c7cSmrgAC_DEFUN([XORG_WITH_PERL],[
196626df5c7cSmrgAC_ARG_VAR([PERL], [Path to perl command])
196726df5c7cSmrg# Preserves the interface, should it be implemented later
196826df5c7cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196926df5c7cSmrgm4_define([_defopt], m4_default([$2], [auto]))
197026df5c7cSmrgAC_ARG_WITH(perl,
197126df5c7cSmrg	AS_HELP_STRING([--with-perl],
197226df5c7cSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197326df5c7cSmrg	   [use_perl=$withval], [use_perl=]_defopt)
197426df5c7cSmrgm4_undefine([_defopt])
1975054b3d00Smrg
197626df5c7cSmrgif test "x$use_perl" = x"auto"; then
197726df5c7cSmrg   AC_PATH_PROG([PERL], [perl])
197826df5c7cSmrg   if test "x$PERL" = "x"; then
197926df5c7cSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198026df5c7cSmrg	have_perl=no
198126df5c7cSmrg   else
198226df5c7cSmrg        have_perl=yes
198326df5c7cSmrg   fi
198426df5c7cSmrgelif test "x$use_perl" = x"yes" ; then
198526df5c7cSmrg   AC_PATH_PROG([PERL], [perl])
198626df5c7cSmrg   if test "x$PERL" = "x"; then
198726df5c7cSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198826df5c7cSmrg   fi
198926df5c7cSmrg   have_perl=yes
199026df5c7cSmrgelif test "x$use_perl" = x"no" ; then
199126df5c7cSmrg   if test "x$PERL" != "x"; then
199226df5c7cSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199326df5c7cSmrg   fi
199426df5c7cSmrg   have_perl=no
199526df5c7cSmrgelse
199626df5c7cSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199726df5c7cSmrgfi
1998054b3d00Smrg
199926df5c7cSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200026df5c7cSmrg]) # XORG_WITH_PERL
2001054b3d00Smrg
200226df5c7cSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003054b3d00Smrg# ----------------
200426df5c7cSmrg# Minimum version: 1.5.0
200526df5c7cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2006054b3d00Smrg#
200726df5c7cSmrg# Documentation tools are not always available on all platforms and sometimes
200826df5c7cSmrg# not at the appropriate level. This macro enables a module to test for the
200926df5c7cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20103bee1c92Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
201126df5c7cSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201226df5c7cSmrg# --with-asciidoc assumes 'auto'.
2013054b3d00Smrg#
201426df5c7cSmrg# Interface to module:
201526df5c7cSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201626df5c7cSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
201726df5c7cSmrg#		 returns the path set by the user in the environment
201826df5c7cSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201926df5c7cSmrg#		  'no' user instructs the module not to use asciidoc
2020054b3d00Smrg#
202126df5c7cSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2022054b3d00Smrg#
202326df5c7cSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202426df5c7cSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202526df5c7cSmrgm4_define([_defopt], m4_default([$2], [auto]))
202626df5c7cSmrgAC_ARG_WITH(asciidoc,
202726df5c7cSmrg	AS_HELP_STRING([--with-asciidoc],
202826df5c7cSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202926df5c7cSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203026df5c7cSmrgm4_undefine([_defopt])
2031054b3d00Smrg
203226df5c7cSmrgif test "x$use_asciidoc" = x"auto"; then
203326df5c7cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203426df5c7cSmrg   if test "x$ASCIIDOC" = "x"; then
203526df5c7cSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203626df5c7cSmrg	have_asciidoc=no
203726df5c7cSmrg   else
203826df5c7cSmrg        have_asciidoc=yes
203926df5c7cSmrg   fi
204026df5c7cSmrgelif test "x$use_asciidoc" = x"yes" ; then
204126df5c7cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204226df5c7cSmrg   if test "x$ASCIIDOC" = "x"; then
204326df5c7cSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204426df5c7cSmrg   fi
204526df5c7cSmrg   have_asciidoc=yes
204626df5c7cSmrgelif test "x$use_asciidoc" = x"no" ; then
204726df5c7cSmrg   if test "x$ASCIIDOC" != "x"; then
204826df5c7cSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204926df5c7cSmrg   fi
205026df5c7cSmrg   have_asciidoc=no
205126df5c7cSmrgelse
205226df5c7cSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205326df5c7cSmrgfi
205426df5c7cSmrgm4_ifval([$1],
205526df5c7cSmrg[if test "$have_asciidoc" = yes; then
205626df5c7cSmrg    # scrape the asciidoc version
205726df5c7cSmrg    AC_MSG_CHECKING([the asciidoc version])
205826df5c7cSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205926df5c7cSmrg    AC_MSG_RESULT([$asciidoc_version])
206026df5c7cSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206126df5c7cSmrg        [if test "x$use_asciidoc" = xauto; then
206226df5c7cSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206326df5c7cSmrg            have_asciidoc=no
206426df5c7cSmrg        else
206526df5c7cSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206626df5c7cSmrg        fi])
206726df5c7cSmrgfi])
206826df5c7cSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206926df5c7cSmrg]) # XORG_WITH_ASCIIDOC
2070054b3d00Smrg
207126df5c7cSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207226df5c7cSmrg# -------------------------------------------
207326df5c7cSmrg# Minimum version: 1.5.0
207426df5c7cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
207526df5c7cSmrg# Minimum version for optional DOT checking: 1.18.0
2076054b3d00Smrg#
207726df5c7cSmrg# Documentation tools are not always available on all platforms and sometimes
207826df5c7cSmrg# not at the appropriate level. This macro enables a module to test for the
207926df5c7cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20803bee1c92Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
208126df5c7cSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208226df5c7cSmrg# --with-doxygen assumes 'auto'.
2083054b3d00Smrg#
208426df5c7cSmrg# Interface to module:
208526df5c7cSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208626df5c7cSmrg# DOXYGEN:	 returns the path of the doxygen program found
208726df5c7cSmrg#		 returns the path set by the user in the environment
208826df5c7cSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208926df5c7cSmrg#		  'no' user instructs the module not to use doxygen
2090054b3d00Smrg#
209126df5c7cSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092054b3d00Smrg#
209326df5c7cSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209426df5c7cSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209526df5c7cSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209626df5c7cSmrgm4_define([_defopt], m4_default([$2], [auto]))
209726df5c7cSmrgAC_ARG_WITH(doxygen,
209826df5c7cSmrg	AS_HELP_STRING([--with-doxygen],
209926df5c7cSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210026df5c7cSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210126df5c7cSmrgm4_undefine([_defopt])
2102054b3d00Smrg
210326df5c7cSmrgif test "x$use_doxygen" = x"auto"; then
210426df5c7cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210526df5c7cSmrg   if test "x$DOXYGEN" = "x"; then
210626df5c7cSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210726df5c7cSmrg	have_doxygen=no
210826df5c7cSmrg   else
210926df5c7cSmrg        have_doxygen=yes
211026df5c7cSmrg   fi
211126df5c7cSmrgelif test "x$use_doxygen" = x"yes" ; then
211226df5c7cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211326df5c7cSmrg   if test "x$DOXYGEN" = "x"; then
211426df5c7cSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211526df5c7cSmrg   fi
211626df5c7cSmrg   have_doxygen=yes
211726df5c7cSmrgelif test "x$use_doxygen" = x"no" ; then
211826df5c7cSmrg   if test "x$DOXYGEN" != "x"; then
211926df5c7cSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212026df5c7cSmrg   fi
212126df5c7cSmrg   have_doxygen=no
2122054b3d00Smrgelse
212326df5c7cSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
212455074dd0Smrgfi
212526df5c7cSmrgm4_ifval([$1],
212626df5c7cSmrg[if test "$have_doxygen" = yes; then
212726df5c7cSmrg    # scrape the doxygen version
212826df5c7cSmrg    AC_MSG_CHECKING([the doxygen version])
212926df5c7cSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213026df5c7cSmrg    AC_MSG_RESULT([$doxygen_version])
213126df5c7cSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213226df5c7cSmrg        [if test "x$use_doxygen" = xauto; then
213326df5c7cSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213426df5c7cSmrg            have_doxygen=no
213526df5c7cSmrg        else
213626df5c7cSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213726df5c7cSmrg        fi])
213826df5c7cSmrgfi])
2139054b3d00Smrg
214026df5c7cSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214126df5c7cSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214226df5c7cSmrgdnl 	HAVE_DOT = @HAVE_DOT@
214326df5c7cSmrgHAVE_DOT=no
214426df5c7cSmrgif test "x$have_doxygen" = "xyes"; then
214526df5c7cSmrg  AC_PATH_PROG([DOT], [dot])
214626df5c7cSmrg    if test "x$DOT" != "x"; then
214726df5c7cSmrg      HAVE_DOT=yes
214826df5c7cSmrg    fi
214926df5c7cSmrgfi
2150054b3d00Smrg
215126df5c7cSmrgAC_SUBST([HAVE_DOT])
215226df5c7cSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215326df5c7cSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215426df5c7cSmrg]) # XORG_WITH_DOXYGEN
2155054b3d00Smrg
215626df5c7cSmrg# XORG_WITH_GROFF([DEFAULT])
215726df5c7cSmrg# ----------------
215826df5c7cSmrg# Minimum version: 1.6.0
215926df5c7cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2160054b3d00Smrg#
216126df5c7cSmrg# Documentation tools are not always available on all platforms and sometimes
216226df5c7cSmrg# not at the appropriate level. This macro enables a module to test for the
216326df5c7cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
21643bee1c92Smrg# the --with-groff option, it allows maximum flexibility in making decisions
216526df5c7cSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
216626df5c7cSmrg# --with-groff assumes 'auto'.
216726df5c7cSmrg#
216826df5c7cSmrg# Interface to module:
216926df5c7cSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217026df5c7cSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217126df5c7cSmrg# HAVE_GROFF_MS: the -ms macros package
217226df5c7cSmrg# GROFF:	 returns the path of the groff program found
217326df5c7cSmrg#		 returns the path set by the user in the environment
217426df5c7cSmrg# --with-groff:	 'yes' user instructs the module to use groff
217526df5c7cSmrg#		 'no' user instructs the module not to use groff
217626df5c7cSmrg#
217726df5c7cSmrg# Added in version 1.9.0:
217826df5c7cSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217926df5c7cSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218026df5c7cSmrg#		   psselect from the psutils package.
218126df5c7cSmrg#		   the ghostcript package. Refer to the grohtml man pages
218226df5c7cSmrg#
218326df5c7cSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218426df5c7cSmrg#
218526df5c7cSmrg# OS and distros often splits groff in a basic and full package, the former
218626df5c7cSmrg# having the groff program and the later having devices, fonts and macros
218726df5c7cSmrg# Checking for the groff executable is not enough.
218826df5c7cSmrg#
218926df5c7cSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
219026df5c7cSmrg# unset HAVE_GROFF or GROFF env variables.
219126df5c7cSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219226df5c7cSmrg#
219326df5c7cSmrgAC_DEFUN([XORG_WITH_GROFF],[
219426df5c7cSmrgAC_ARG_VAR([GROFF], [Path to groff command])
219526df5c7cSmrgm4_define([_defopt], m4_default([$1], [auto]))
219626df5c7cSmrgAC_ARG_WITH(groff,
219726df5c7cSmrg	AS_HELP_STRING([--with-groff],
219826df5c7cSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219926df5c7cSmrg	   [use_groff=$withval], [use_groff=]_defopt)
220026df5c7cSmrgm4_undefine([_defopt])
2201054b3d00Smrg
220226df5c7cSmrgif test "x$use_groff" = x"auto"; then
220326df5c7cSmrg   AC_PATH_PROG([GROFF], [groff])
220426df5c7cSmrg   if test "x$GROFF" = "x"; then
220526df5c7cSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220626df5c7cSmrg	have_groff=no
220726df5c7cSmrg   else
220826df5c7cSmrg        have_groff=yes
220926df5c7cSmrg   fi
221026df5c7cSmrgelif test "x$use_groff" = x"yes" ; then
221126df5c7cSmrg   AC_PATH_PROG([GROFF], [groff])
221226df5c7cSmrg   if test "x$GROFF" = "x"; then
221326df5c7cSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221426df5c7cSmrg   fi
221526df5c7cSmrg   have_groff=yes
221626df5c7cSmrgelif test "x$use_groff" = x"no" ; then
221726df5c7cSmrg   if test "x$GROFF" != "x"; then
221826df5c7cSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221926df5c7cSmrg   fi
222026df5c7cSmrg   have_groff=no
222126df5c7cSmrgelse
222226df5c7cSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222326df5c7cSmrgfi
2224054b3d00Smrg
222526df5c7cSmrg# We have groff, test for the presence of the macro packages
222626df5c7cSmrgif test "x$have_groff" = x"yes"; then
222726df5c7cSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222826df5c7cSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222926df5c7cSmrg        groff_ms_works=yes
223026df5c7cSmrg    else
223126df5c7cSmrg        groff_ms_works=no
2232054b3d00Smrg    fi
223326df5c7cSmrg    AC_MSG_RESULT([$groff_ms_works])
223426df5c7cSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223526df5c7cSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223626df5c7cSmrg        groff_mm_works=yes
223726df5c7cSmrg    else
223826df5c7cSmrg        groff_mm_works=no
223926df5c7cSmrg    fi
224026df5c7cSmrg    AC_MSG_RESULT([$groff_mm_works])
224126df5c7cSmrgfi
22422ddb6cf1Smrg
224326df5c7cSmrg# We have groff, test for HTML dependencies, one command per package
224426df5c7cSmrgif test "x$have_groff" = x"yes"; then
224526df5c7cSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224626df5c7cSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224726df5c7cSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224826df5c7cSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224926df5c7cSmrg      have_groff_html=yes
225026df5c7cSmrg   else
225126df5c7cSmrg      have_groff_html=no
225226df5c7cSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225326df5c7cSmrg   fi
225426df5c7cSmrgfi
225526df5c7cSmrg
225626df5c7cSmrg# Set Automake conditionals for Makefiles
225726df5c7cSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225826df5c7cSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225926df5c7cSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226026df5c7cSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226126df5c7cSmrg]) # XORG_WITH_GROFF
226226df5c7cSmrg
226326df5c7cSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226426df5c7cSmrg# ---------------------------------------
226526df5c7cSmrg# Minimum version: 1.6.0
226626df5c7cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
226726df5c7cSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226826df5c7cSmrg#
226926df5c7cSmrg# Documentation tools are not always available on all platforms and sometimes
227026df5c7cSmrg# not at the appropriate level. This macro enables a module to test for the
227126df5c7cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
22723bee1c92Smrg# the --with-fop option, it allows maximum flexibility in making decisions
227326df5c7cSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
227426df5c7cSmrg# --with-fop assumes 'auto'.
227526df5c7cSmrg#
227626df5c7cSmrg# Interface to module:
227726df5c7cSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227826df5c7cSmrg# FOP:	 	returns the path of the fop program found
227926df5c7cSmrg#		returns the path set by the user in the environment
228026df5c7cSmrg# --with-fop: 	'yes' user instructs the module to use fop
228126df5c7cSmrg#		'no' user instructs the module not to use fop
228226df5c7cSmrg#
228326df5c7cSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228426df5c7cSmrg#
228526df5c7cSmrgAC_DEFUN([XORG_WITH_FOP],[
228626df5c7cSmrgAC_ARG_VAR([FOP], [Path to fop command])
228726df5c7cSmrgm4_define([_defopt], m4_default([$2], [auto]))
228826df5c7cSmrgAC_ARG_WITH(fop,
228926df5c7cSmrg	AS_HELP_STRING([--with-fop],
229026df5c7cSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229126df5c7cSmrg	   [use_fop=$withval], [use_fop=]_defopt)
229226df5c7cSmrgm4_undefine([_defopt])
229326df5c7cSmrg
229426df5c7cSmrgif test "x$use_fop" = x"auto"; then
229526df5c7cSmrg   AC_PATH_PROG([FOP], [fop])
229626df5c7cSmrg   if test "x$FOP" = "x"; then
229726df5c7cSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229826df5c7cSmrg	have_fop=no
229926df5c7cSmrg   else
230026df5c7cSmrg        have_fop=yes
230126df5c7cSmrg   fi
230226df5c7cSmrgelif test "x$use_fop" = x"yes" ; then
230326df5c7cSmrg   AC_PATH_PROG([FOP], [fop])
230426df5c7cSmrg   if test "x$FOP" = "x"; then
230526df5c7cSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230626df5c7cSmrg   fi
230726df5c7cSmrg   have_fop=yes
230826df5c7cSmrgelif test "x$use_fop" = x"no" ; then
230926df5c7cSmrg   if test "x$FOP" != "x"; then
231026df5c7cSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231126df5c7cSmrg   fi
231226df5c7cSmrg   have_fop=no
231355074dd0Smrgelse
231426df5c7cSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315a1d141d5Smrgfi
2316a1d141d5Smrg
231726df5c7cSmrg# Test for a minimum version of fop, if provided.
231826df5c7cSmrgm4_ifval([$1],
231926df5c7cSmrg[if test "$have_fop" = yes; then
232026df5c7cSmrg    # scrape the fop version
232126df5c7cSmrg    AC_MSG_CHECKING([for fop minimum version])
232226df5c7cSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232326df5c7cSmrg    AC_MSG_RESULT([$fop_version])
232426df5c7cSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
232526df5c7cSmrg        [if test "x$use_fop" = xauto; then
232626df5c7cSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232726df5c7cSmrg            have_fop=no
232826df5c7cSmrg        else
232926df5c7cSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233026df5c7cSmrg        fi])
233126df5c7cSmrgfi])
233226df5c7cSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233326df5c7cSmrg]) # XORG_WITH_FOP
233426df5c7cSmrg
233526df5c7cSmrg# XORG_WITH_M4([MIN-VERSION])
233626df5c7cSmrg# ---------------------------
233726df5c7cSmrg# Minimum version: 1.19.0
233826df5c7cSmrg#
233926df5c7cSmrg# This macro attempts to locate an m4 macro processor which supports
234026df5c7cSmrg# -I option and is only useful for modules relying on M4 in order to
234126df5c7cSmrg# expand macros in source code files.
234226df5c7cSmrg#
234326df5c7cSmrg# Interface to module:
234426df5c7cSmrg# M4:	 	returns the path of the m4 program found
234526df5c7cSmrg#		returns the path set by the user in the environment
234626df5c7cSmrg#
234726df5c7cSmrgAC_DEFUN([XORG_WITH_M4], [
234826df5c7cSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234926df5c7cSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235026df5c7cSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235126df5c7cSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235226df5c7cSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235326df5c7cSmrg   [$PATH:/usr/gnu/bin])])
2354a1d141d5Smrg
235526df5c7cSmrgAC_SUBST([M4], [$ac_cv_path_M4])
235626df5c7cSmrg]) # XORG_WITH_M4
2357054b3d00Smrg
235826df5c7cSmrg# XORG_WITH_PS2PDF([DEFAULT])
235926df5c7cSmrg# ----------------
236026df5c7cSmrg# Minimum version: 1.6.0
236126df5c7cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
236226df5c7cSmrg#
236326df5c7cSmrg# Documentation tools are not always available on all platforms and sometimes
236426df5c7cSmrg# not at the appropriate level. This macro enables a module to test for the
236526df5c7cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
23663bee1c92Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
236726df5c7cSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236826df5c7cSmrg# --with-ps2pdf assumes 'auto'.
236926df5c7cSmrg#
237026df5c7cSmrg# Interface to module:
237126df5c7cSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237226df5c7cSmrg# PS2PDF:	returns the path of the ps2pdf program found
237326df5c7cSmrg#		returns the path set by the user in the environment
237426df5c7cSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237526df5c7cSmrg#		 'no' user instructs the module not to use ps2pdf
237626df5c7cSmrg#
237726df5c7cSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237826df5c7cSmrg#
237926df5c7cSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238026df5c7cSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238126df5c7cSmrgm4_define([_defopt], m4_default([$1], [auto]))
238226df5c7cSmrgAC_ARG_WITH(ps2pdf,
238326df5c7cSmrg	AS_HELP_STRING([--with-ps2pdf],
238426df5c7cSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238526df5c7cSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238626df5c7cSmrgm4_undefine([_defopt])
2387054b3d00Smrg
238826df5c7cSmrgif test "x$use_ps2pdf" = x"auto"; then
238926df5c7cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239026df5c7cSmrg   if test "x$PS2PDF" = "x"; then
239126df5c7cSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239226df5c7cSmrg	have_ps2pdf=no
239326df5c7cSmrg   else
239426df5c7cSmrg        have_ps2pdf=yes
239526df5c7cSmrg   fi
239626df5c7cSmrgelif test "x$use_ps2pdf" = x"yes" ; then
239726df5c7cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239826df5c7cSmrg   if test "x$PS2PDF" = "x"; then
239926df5c7cSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240026df5c7cSmrg   fi
240126df5c7cSmrg   have_ps2pdf=yes
240226df5c7cSmrgelif test "x$use_ps2pdf" = x"no" ; then
240326df5c7cSmrg   if test "x$PS2PDF" != "x"; then
240426df5c7cSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240526df5c7cSmrg   fi
240626df5c7cSmrg   have_ps2pdf=no
240726df5c7cSmrgelse
240826df5c7cSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409054b3d00Smrgfi
241026df5c7cSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241126df5c7cSmrg]) # XORG_WITH_PS2PDF
2412054b3d00Smrg
241326df5c7cSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
241426df5c7cSmrg# ----------------
241526df5c7cSmrg# Minimum version: 1.6.0
241655074dd0Smrg#
241726df5c7cSmrg# Documentation tools are not always available on all platforms and sometimes
241826df5c7cSmrg# not at the appropriate level. This macro enables a builder to skip all
241926df5c7cSmrg# documentation targets except traditional man pages.
242026df5c7cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24213bee1c92Smrg# maximum flexibility in controlling documentation building.
242226df5c7cSmrg# Refer to:
242326df5c7cSmrg# XORG_WITH_XMLTO         --with-xmlto
242426df5c7cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242526df5c7cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
242626df5c7cSmrg# XORG_WITH_FOP           --with-fop
242726df5c7cSmrg# XORG_WITH_GROFF         --with-groff
242826df5c7cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
242926df5c7cSmrg#
243026df5c7cSmrg# Interface to module:
243126df5c7cSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243226df5c7cSmrg# --enable-docs: 'yes' user instructs the module to generate docs
243326df5c7cSmrg#		 'no' user instructs the module not to generate docs
243426df5c7cSmrg# parm1:	specify the default value, yes or no.
243526df5c7cSmrg#
243626df5c7cSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243726df5c7cSmrgm4_define([docs_default], m4_default([$1], [yes]))
243826df5c7cSmrgAC_ARG_ENABLE(docs,
243926df5c7cSmrg	AS_HELP_STRING([--enable-docs],
244026df5c7cSmrg	   [Enable building the documentation (default: ]docs_default[)]),
244126df5c7cSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
244226df5c7cSmrgm4_undefine([docs_default])
244326df5c7cSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244426df5c7cSmrgAC_MSG_CHECKING([whether to build documentation])
244526df5c7cSmrgAC_MSG_RESULT([$build_docs])
244626df5c7cSmrg]) # XORG_ENABLE_DOCS
2447054b3d00Smrg
244826df5c7cSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244926df5c7cSmrg# ----------------
245026df5c7cSmrg# Minimum version: 1.6.0
245126df5c7cSmrg#
245226df5c7cSmrg# This macro enables a builder to skip all developer documentation.
245326df5c7cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24543bee1c92Smrg# maximum flexibility in controlling documentation building.
245526df5c7cSmrg# Refer to:
245626df5c7cSmrg# XORG_WITH_XMLTO         --with-xmlto
245726df5c7cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245826df5c7cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
245926df5c7cSmrg# XORG_WITH_FOP           --with-fop
246026df5c7cSmrg# XORG_WITH_GROFF         --with-groff
246126df5c7cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
246226df5c7cSmrg#
246326df5c7cSmrg# Interface to module:
246426df5c7cSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246526df5c7cSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246626df5c7cSmrg#			'no' user instructs the module not to generate developer docs
246726df5c7cSmrg# parm1:		specify the default value, yes or no.
246826df5c7cSmrg#
246926df5c7cSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247026df5c7cSmrgm4_define([devel_default], m4_default([$1], [yes]))
247126df5c7cSmrgAC_ARG_ENABLE(devel-docs,
247226df5c7cSmrg	AS_HELP_STRING([--enable-devel-docs],
247326df5c7cSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247426df5c7cSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247526df5c7cSmrgm4_undefine([devel_default])
247626df5c7cSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247726df5c7cSmrgAC_MSG_CHECKING([whether to build developer documentation])
247826df5c7cSmrgAC_MSG_RESULT([$build_devel_docs])
247926df5c7cSmrg]) # XORG_ENABLE_DEVEL_DOCS
2480054b3d00Smrg
248126df5c7cSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
248226df5c7cSmrg# ----------------
248326df5c7cSmrg# Minimum version: 1.6.0
248426df5c7cSmrg#
248526df5c7cSmrg# This macro enables a builder to skip all functional specification targets.
248626df5c7cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24873bee1c92Smrg# maximum flexibility in controlling documentation building.
248826df5c7cSmrg# Refer to:
248926df5c7cSmrg# XORG_WITH_XMLTO         --with-xmlto
249026df5c7cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249126df5c7cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
249226df5c7cSmrg# XORG_WITH_FOP           --with-fop
249326df5c7cSmrg# XORG_WITH_GROFF         --with-groff
249426df5c7cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
249526df5c7cSmrg#
249626df5c7cSmrg# Interface to module:
249726df5c7cSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249826df5c7cSmrg# --enable-specs:	'yes' user instructs the module to generate specs
249926df5c7cSmrg#			'no' user instructs the module not to generate specs
250026df5c7cSmrg# parm1:		specify the default value, yes or no.
250126df5c7cSmrg#
250226df5c7cSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250326df5c7cSmrgm4_define([spec_default], m4_default([$1], [yes]))
250426df5c7cSmrgAC_ARG_ENABLE(specs,
250526df5c7cSmrg	AS_HELP_STRING([--enable-specs],
250626df5c7cSmrg	   [Enable building the specs (default: ]spec_default[)]),
250726df5c7cSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
250826df5c7cSmrgm4_undefine([spec_default])
250926df5c7cSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251026df5c7cSmrgAC_MSG_CHECKING([whether to build functional specifications])
251126df5c7cSmrgAC_MSG_RESULT([$build_specs])
251226df5c7cSmrg]) # XORG_ENABLE_SPECS
2513054b3d00Smrg
251426df5c7cSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251526df5c7cSmrg# ----------------------------------------------
251626df5c7cSmrg# Minimum version: 1.13.0
251755074dd0Smrg#
251826df5c7cSmrg# This macro enables a builder to enable/disable unit testing
251926df5c7cSmrg# It makes no assumption about the test cases implementation
252026df5c7cSmrg# Test cases may or may not use Automake "Support for test suites"
252126df5c7cSmrg# They may or may not use the software utility library GLib
252226df5c7cSmrg#
252326df5c7cSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252426df5c7cSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252526df5c7cSmrg# The variable enable_unit_tests is used by other macros in this file.
252626df5c7cSmrg#
252726df5c7cSmrg# Interface to module:
252826df5c7cSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252926df5c7cSmrg# enable_unit_tests:    used in configure.ac for additional configuration
253026df5c7cSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253126df5c7cSmrg#			'no' user instructs the module not to build tests
253226df5c7cSmrg# parm1:		specify the default value, yes or no.
253326df5c7cSmrg#
253426df5c7cSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253526df5c7cSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253626df5c7cSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253726df5c7cSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253826df5c7cSmrgm4_define([_defopt], m4_default([$1], [auto]))
253926df5c7cSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254026df5c7cSmrg	[Enable building unit test cases (default: ]_defopt[)]),
254126df5c7cSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254226df5c7cSmrgm4_undefine([_defopt])
254326df5c7cSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254426df5c7cSmrgAC_MSG_CHECKING([whether to build unit test cases])
254526df5c7cSmrgAC_MSG_RESULT([$enable_unit_tests])
254626df5c7cSmrg]) # XORG_ENABLE_UNIT_TESTS
2547054b3d00Smrg
254826df5c7cSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254926df5c7cSmrg# ------------------------------------------------------
255026df5c7cSmrg# Minimum version: 1.17.0
255126df5c7cSmrg#
255226df5c7cSmrg# This macro enables a builder to enable/disable integration testing
255326df5c7cSmrg# It makes no assumption about the test cases' implementation
255426df5c7cSmrg# Test cases may or may not use Automake "Support for test suites"
255526df5c7cSmrg#
255626df5c7cSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255726df5c7cSmrg# usually requires less dependencies and may be built and run under less
255826df5c7cSmrg# stringent environments than integration tests.
255926df5c7cSmrg#
256026df5c7cSmrg# Interface to module:
256126df5c7cSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256226df5c7cSmrg# enable_integration_tests:   used in configure.ac for additional configuration
256326df5c7cSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256426df5c7cSmrg#                             'no' user instructs the module not to build tests
256526df5c7cSmrg# parm1:                      specify the default value, yes or no.
256626df5c7cSmrg#
256726df5c7cSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256826df5c7cSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256926df5c7cSmrgm4_define([_defopt], m4_default([$1], [auto]))
257026df5c7cSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257126df5c7cSmrg	[Enable building integration test cases (default: ]_defopt[)]),
257226df5c7cSmrg	[enable_integration_tests=$enableval],
257326df5c7cSmrg	[enable_integration_tests=]_defopt)
257426df5c7cSmrgm4_undefine([_defopt])
257526df5c7cSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257626df5c7cSmrg	[test "x$enable_integration_tests" != xno])
257726df5c7cSmrgAC_MSG_CHECKING([whether to build unit test cases])
257826df5c7cSmrgAC_MSG_RESULT([$enable_integration_tests])
257926df5c7cSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580054b3d00Smrg
258126df5c7cSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258226df5c7cSmrg# ----------------------------------------
258326df5c7cSmrg# Minimum version: 1.13.0
258426df5c7cSmrg#
258526df5c7cSmrg# GLib is a library which provides advanced data structures and functions.
258626df5c7cSmrg# This macro enables a module to test for the presence of Glib.
258726df5c7cSmrg#
258826df5c7cSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258926df5c7cSmrg# Otherwise the value of $enable_unit_tests is blank.
259026df5c7cSmrg#
259126df5c7cSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259226df5c7cSmrg# test support usually requires less dependencies and may be built and run under
259326df5c7cSmrg# less stringent environments than integration tests.
259455074dd0Smrg#
259526df5c7cSmrg# Interface to module:
259626df5c7cSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
259726df5c7cSmrg# with_glib: used in configure.ac to know if GLib has been found
259826df5c7cSmrg# --with-glib:	'yes' user instructs the module to use glib
259926df5c7cSmrg#		'no' user instructs the module not to use glib
260026df5c7cSmrg#
260126df5c7cSmrgAC_DEFUN([XORG_WITH_GLIB],[
260226df5c7cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260326df5c7cSmrgm4_define([_defopt], m4_default([$2], [auto]))
260426df5c7cSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260526df5c7cSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260626df5c7cSmrg	[with_glib=$withval], [with_glib=]_defopt)
260726df5c7cSmrgm4_undefine([_defopt])
2608a1d141d5Smrg
260926df5c7cSmrghave_glib=no
261026df5c7cSmrg# Do not probe GLib if user explicitly disabled unit testing
261126df5c7cSmrgif test "x$enable_unit_tests" != x"no"; then
261226df5c7cSmrg  # Do not probe GLib if user explicitly disabled it
261326df5c7cSmrg  if test "x$with_glib" != x"no"; then
261426df5c7cSmrg    m4_ifval(
261526df5c7cSmrg      [$1],
261626df5c7cSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261726df5c7cSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261826df5c7cSmrg    )
2619054b3d00Smrg  fi
2620a1d141d5Smrgfi
2621a1d141d5Smrg
262226df5c7cSmrg# Not having GLib when unit testing has been explicitly requested is an error
262326df5c7cSmrgif test "x$enable_unit_tests" = x"yes"; then
262426df5c7cSmrg  if test "x$have_glib" = x"no"; then
262526df5c7cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626054b3d00Smrg  fi
262755074dd0Smrgfi
2628a1d141d5Smrg
262926df5c7cSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
263026df5c7cSmrgif test "x$enable_unit_tests" = x"no"; then
263126df5c7cSmrg  if test "x$with_glib" = x"yes"; then
263226df5c7cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263326df5c7cSmrg  fi
263426df5c7cSmrgfi
2635a1d141d5Smrg
263626df5c7cSmrg# Not having GLib when it has been explicitly requested is an error
263726df5c7cSmrgif test "x$with_glib" = x"yes"; then
263826df5c7cSmrg  if test "x$have_glib" = x"no"; then
263926df5c7cSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264026df5c7cSmrg  fi
264126df5c7cSmrgfi
2642a1d141d5Smrg
264326df5c7cSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264426df5c7cSmrg]) # XORG_WITH_GLIB
2645054b3d00Smrg
264626df5c7cSmrg# XORG_LD_WRAP([required|optional])
264726df5c7cSmrg# ---------------------------------
264826df5c7cSmrg# Minimum version: 1.13.0
264926df5c7cSmrg#
265026df5c7cSmrg# Check if linker supports -wrap, passed via compiler flags
265126df5c7cSmrg#
265226df5c7cSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265326df5c7cSmrg# Otherwise the value of $enable_unit_tests is blank.
265426df5c7cSmrg#
265526df5c7cSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265626df5c7cSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265726df5c7cSmrg# available, an argument of "optional" allows use when some unit tests require
265826df5c7cSmrg# ld -wrap and others do not.
265926df5c7cSmrg#
266026df5c7cSmrgAC_DEFUN([XORG_LD_WRAP],[
266126df5c7cSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266226df5c7cSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266326df5c7cSmrg                      void __wrap_exit(int status) { return; }],
266426df5c7cSmrg                     [exit(0);])])
266526df5c7cSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
266626df5c7cSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266726df5c7cSmrg  if test "x$have_ld_wrap" = x"no"; then
266826df5c7cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266926df5c7cSmrg  fi
267026df5c7cSmrgfi
267126df5c7cSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267226df5c7cSmrg#
267326df5c7cSmrg]) # XORG_LD_WRAP
2674054b3d00Smrg
267526df5c7cSmrg# XORG_CHECK_LINKER_FLAGS
267626df5c7cSmrg# -----------------------
267726df5c7cSmrg# SYNOPSIS
267826df5c7cSmrg#
267926df5c7cSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268026df5c7cSmrg#
268126df5c7cSmrg# DESCRIPTION
268226df5c7cSmrg#
268326df5c7cSmrg#   Check whether the given linker FLAGS work with the current language's
268426df5c7cSmrg#   linker, or whether they give an error.
268526df5c7cSmrg#
268626df5c7cSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268726df5c7cSmrg#   success/failure.
268826df5c7cSmrg#
268926df5c7cSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
269026df5c7cSmrg#
269126df5c7cSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269226df5c7cSmrg#
269326df5c7cSmrg# LICENSE
269426df5c7cSmrg#
269526df5c7cSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269626df5c7cSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269726df5c7cSmrg#   Copyright (c) 2009 Matteo Frigo
269826df5c7cSmrg#
269926df5c7cSmrg#   This program is free software: you can redistribute it and/or modify it
270026df5c7cSmrg#   under the terms of the GNU General Public License as published by the
270126df5c7cSmrg#   Free Software Foundation, either version 3 of the License, or (at your
270226df5c7cSmrg#   option) any later version.
270326df5c7cSmrg#
270426df5c7cSmrg#   This program is distributed in the hope that it will be useful, but
270526df5c7cSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270626df5c7cSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270726df5c7cSmrg#   Public License for more details.
270826df5c7cSmrg#
270926df5c7cSmrg#   You should have received a copy of the GNU General Public License along
271026df5c7cSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271126df5c7cSmrg#
271226df5c7cSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
271326df5c7cSmrg#   gives unlimited permission to copy, distribute and modify the configure
271426df5c7cSmrg#   scripts that are the output of Autoconf when processing the Macro. You
271526df5c7cSmrg#   need not follow the terms of the GNU General Public License when using
271626df5c7cSmrg#   or distributing such scripts, even though portions of the text of the
271726df5c7cSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271826df5c7cSmrg#   all other use of the material that constitutes the Autoconf Macro.
271926df5c7cSmrg#
272026df5c7cSmrg#   This special exception to the GPL applies to versions of the Autoconf
272126df5c7cSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
272226df5c7cSmrg#   modified version of the Autoconf Macro, you may extend this special
272326df5c7cSmrg#   exception to the GPL to apply to your modified version as well.#
272426df5c7cSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272526df5c7cSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
272626df5c7cSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272726df5c7cSmrgAS_LITERAL_IF([$1],
272826df5c7cSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272926df5c7cSmrg      ax_save_FLAGS=$LDFLAGS
273026df5c7cSmrg      LDFLAGS="$1"
273126df5c7cSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273226df5c7cSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273326df5c7cSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273426df5c7cSmrg      LDFLAGS=$ax_save_FLAGS])],
273526df5c7cSmrg  [ax_save_FLAGS=$LDFLAGS
273626df5c7cSmrg   LDFLAGS="$1"
273726df5c7cSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273826df5c7cSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273926df5c7cSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274026df5c7cSmrg   LDFLAGS=$ax_save_FLAGS])
274126df5c7cSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274226df5c7cSmrgAC_MSG_RESULT($xorg_check_linker_flags)
274326df5c7cSmrgif test "x$xorg_check_linker_flags" = xyes; then
274426df5c7cSmrg	m4_default([$2], :)
274526df5c7cSmrgelse
274626df5c7cSmrg	m4_default([$3], :)
274726df5c7cSmrgfi
274826df5c7cSmrg]) # XORG_CHECK_LINKER_FLAGS
2749a1d141d5Smrg
275026df5c7cSmrg# XORG_MEMORY_CHECK_FLAGS
275126df5c7cSmrg# -----------------------
275226df5c7cSmrg# Minimum version: 1.16.0
275326df5c7cSmrg#
275426df5c7cSmrg# This macro attempts to find appropriate memory checking functionality
275526df5c7cSmrg# for various platforms which unit testing code may use to catch various
275626df5c7cSmrg# forms of memory allocation and access errors in testing.
275726df5c7cSmrg#
275826df5c7cSmrg# Interface to module:
275926df5c7cSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276026df5c7cSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276126df5c7cSmrg#
276226df5c7cSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276326df5c7cSmrg#
276426df5c7cSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765054b3d00Smrg
276626df5c7cSmrgAC_REQUIRE([AC_CANONICAL_HOST])
276726df5c7cSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276826df5c7cSmrg           [Environment variables to enable memory checking in tests])
2769054b3d00Smrg
277026df5c7cSmrg# Check for different types of support on different platforms
277126df5c7cSmrgcase $host_os in
277226df5c7cSmrg    solaris*)
277326df5c7cSmrg        AC_CHECK_LIB([umem], [umem_alloc],
277426df5c7cSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277526df5c7cSmrg        ;;
277626df5c7cSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277726df5c7cSmrg        # both directly and inverted, so should not be 0 or 255.
277826df5c7cSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
277926df5c7cSmrg        ;;
278026df5c7cSmrg    darwin*)
278126df5c7cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278226df5c7cSmrg        ;;
278326df5c7cSmrg    *bsd*)
278426df5c7cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278526df5c7cSmrg        ;;
278626df5c7cSmrgesac
2787054b3d00Smrg
278826df5c7cSmrg# User supplied flags override default flags
278926df5c7cSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279026df5c7cSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
279155074dd0Smrgfi
2792a1d141d5Smrg
279326df5c7cSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279426df5c7cSmrg]) # XORG_WITH_LINT
2795054b3d00Smrg
279626df5c7cSmrg# XORG_CHECK_MALLOC_ZERO
279726df5c7cSmrg# ----------------------
279826df5c7cSmrg# Minimum version: 1.0.0
279955074dd0Smrg#
280026df5c7cSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280126df5c7cSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280226df5c7cSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280326df5c7cSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280426df5c7cSmrgAC_ARG_ENABLE(malloc0returnsnull,
280526df5c7cSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280626df5c7cSmrg		       [malloc(0) returns NULL (default: auto)]),
280726df5c7cSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280826df5c7cSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809054b3d00Smrg
281026df5c7cSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281126df5c7cSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281226df5c7cSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281326df5c7cSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281426df5c7cSmrg#include <stdlib.h>
281526df5c7cSmrg],[
281626df5c7cSmrg    char *m0, *r0, *c0, *p;
281726df5c7cSmrg    m0 = malloc(0);
281826df5c7cSmrg    p = malloc(10);
281926df5c7cSmrg    r0 = realloc(p,0);
282026df5c7cSmrg    c0 = calloc(0,10);
282126df5c7cSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282226df5c7cSmrg])],
282326df5c7cSmrg		[xorg_cv_malloc0_returns_null=yes],
282426df5c7cSmrg		[xorg_cv_malloc0_returns_null=no])])
282526df5c7cSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
282655074dd0Smrgfi
282726df5c7cSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828a1d141d5Smrg
282926df5c7cSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283026df5c7cSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283126df5c7cSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283226df5c7cSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2833054b3d00Smrgelse
283426df5c7cSmrg	MALLOC_ZERO_CFLAGS=""
283526df5c7cSmrg	XMALLOC_ZERO_CFLAGS=""
283626df5c7cSmrg	XTMALLOC_ZERO_CFLAGS=""
283755074dd0Smrgfi
283855074dd0Smrg
283926df5c7cSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284026df5c7cSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284126df5c7cSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284226df5c7cSmrg]) # XORG_CHECK_MALLOC_ZERO
2843a1d141d5Smrg
284426df5c7cSmrg# XORG_WITH_LINT()
284526df5c7cSmrg# ----------------
284626df5c7cSmrg# Minimum version: 1.1.0
284755074dd0Smrg#
284826df5c7cSmrg# This macro enables the use of a tool that flags some suspicious and
284926df5c7cSmrg# non-portable constructs (likely to be bugs) in C language source code.
285026df5c7cSmrg# It will attempt to locate the tool and use appropriate options.
285126df5c7cSmrg# There are various lint type tools on different platforms.
285255074dd0Smrg#
285326df5c7cSmrg# Interface to module:
285426df5c7cSmrg# LINT:		returns the path to the tool found on the platform
285526df5c7cSmrg#		or the value set to LINT on the configure cmd line
285626df5c7cSmrg#		also an Automake conditional
285726df5c7cSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
285826df5c7cSmrg#
285926df5c7cSmrg# --with-lint:	'yes' user instructs the module to use lint
286026df5c7cSmrg#		'no' user instructs the module not to use lint (default)
286126df5c7cSmrg#
286226df5c7cSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286326df5c7cSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286426df5c7cSmrg#
286526df5c7cSmrgAC_DEFUN([XORG_WITH_LINT],[
2866054b3d00Smrg
286726df5c7cSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286826df5c7cSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286926df5c7cSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287026df5c7cSmrg		[Use a lint-style source code checker (default: disabled)])],
287126df5c7cSmrg		[use_lint=$withval], [use_lint=no])
2872054b3d00Smrg
287326df5c7cSmrg# Obtain platform specific info like program name and options
287426df5c7cSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287526df5c7cSmrgcase $host_os in
287626df5c7cSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287726df5c7cSmrg	lint_name=splint
287826df5c7cSmrg	lint_options="-badflag"
287926df5c7cSmrg	;;
288026df5c7cSmrg  *freebsd* | *netbsd*)
288126df5c7cSmrg	lint_name=lint
288226df5c7cSmrg	lint_options="-u -b"
288326df5c7cSmrg	;;
288426df5c7cSmrg  *solaris*)
288526df5c7cSmrg	lint_name=lint
288626df5c7cSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288726df5c7cSmrg	;;
288826df5c7cSmrgesac
288926df5c7cSmrg
289026df5c7cSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289126df5c7cSmrgif test "x$use_lint" = x"yes" ; then
289226df5c7cSmrg   AC_PATH_PROG([LINT], [$lint_name])
289326df5c7cSmrg   if test "x$LINT" = "x"; then
289426df5c7cSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289526df5c7cSmrg   fi
289626df5c7cSmrgelif test "x$use_lint" = x"no" ; then
289726df5c7cSmrg   if test "x$LINT" != "x"; then
289826df5c7cSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289926df5c7cSmrg   fi
2900054b3d00Smrgelse
290126df5c7cSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902054b3d00Smrgfi
2903054b3d00Smrg
290426df5c7cSmrg# User supplied flags override default flags
290526df5c7cSmrgif test "x$LINT_FLAGS" != "x"; then
290626df5c7cSmrg   lint_options=$LINT_FLAGS
290726df5c7cSmrgfi
2908054b3d00Smrg
290926df5c7cSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291026df5c7cSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911054b3d00Smrg
291226df5c7cSmrg]) # XORG_WITH_LINT
2913054b3d00Smrg
291426df5c7cSmrg# XORG_LINT_LIBRARY(LIBNAME)
291526df5c7cSmrg# --------------------------
291626df5c7cSmrg# Minimum version: 1.1.0
291755074dd0Smrg#
291826df5c7cSmrg# Sets up flags for building lint libraries for checking programs that call
291926df5c7cSmrg# functions in the library.
292026df5c7cSmrg#
292126df5c7cSmrg# Interface to module:
292226df5c7cSmrg# LINTLIB		- Automake variable with the name of lint library file to make
292326df5c7cSmrg# MAKE_LINT_LIB		- Automake conditional
292426df5c7cSmrg#
292526df5c7cSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292626df5c7cSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2927a1d141d5Smrg
292826df5c7cSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292926df5c7cSmrgAC_REQUIRE([XORG_WITH_LINT])
293026df5c7cSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293126df5c7cSmrg	[Create lint library (default: disabled)])],
293226df5c7cSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293326df5c7cSmrg
293426df5c7cSmrgif test "x$make_lint_lib" = x"yes" ; then
293526df5c7cSmrg   LINTLIB=llib-l$1.ln
293626df5c7cSmrg   if test "x$LINT" = "x"; then
293726df5c7cSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293826df5c7cSmrg   fi
293926df5c7cSmrgelif test "x$make_lint_lib" != x"no" ; then
294026df5c7cSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29412ddb6cf1Smrgfi
2942a1d141d5Smrg
294326df5c7cSmrgAC_SUBST(LINTLIB)
294426df5c7cSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945054b3d00Smrg
294626df5c7cSmrg]) # XORG_LINT_LIBRARY
29472ddb6cf1Smrg
294826df5c7cSmrg# XORG_COMPILER_BRAND
2949054b3d00Smrg# -------------------
295026df5c7cSmrg# Minimum version: 1.14.0
2951054b3d00Smrg#
295226df5c7cSmrg# Checks for various brands of compilers and sets flags as appropriate:
295326df5c7cSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295426df5c7cSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295526df5c7cSmrg#   clang compiler - sets CLANGCC to "yes"
295626df5c7cSmrg#   Intel compiler - sets INTELCC to "yes"
295726df5c7cSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295826df5c7cSmrg#
295926df5c7cSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296026df5c7cSmrgAC_LANG_CASE(
296126df5c7cSmrg	[C], [
29623bee1c92Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29633bee1c92Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
29643bee1c92Smrg		m4_version_prereq([2.70],
29653bee1c92Smrg			[AC_REQUIRE([AC_PROG_CC])],
29663bee1c92Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
296726df5c7cSmrg	],
296826df5c7cSmrg	[C++], [
296926df5c7cSmrg		AC_REQUIRE([AC_PROG_CXX])
297026df5c7cSmrg	]
297126df5c7cSmrg)
297226df5c7cSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
297326df5c7cSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297426df5c7cSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297526df5c7cSmrg]) # XORG_COMPILER_BRAND
2976a1d141d5Smrg
297726df5c7cSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2978054b3d00Smrg# ---------------
297926df5c7cSmrg# Minimum version: 1.16.0
298026df5c7cSmrg#
298126df5c7cSmrg# Test if the compiler works when passed the given flag as a command line argument.
29823bee1c92Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
298326df5c7cSmrg# next flag in the list until there are no more options.
298426df5c7cSmrg#
298526df5c7cSmrg# Note that this does not guarantee that the compiler supports the flag as some
298626df5c7cSmrg# compilers will simply ignore arguments that they do not understand, but we do
298726df5c7cSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298826df5c7cSmrg# -Werror=unused-command-line-argument
298926df5c7cSmrg#
299026df5c7cSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
299126df5c7cSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
299226df5c7cSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993a1d141d5Smrg
299426df5c7cSmrgAC_LANG_COMPILER_REQUIRE
2995054b3d00Smrg
299626df5c7cSmrgAC_LANG_CASE(
299726df5c7cSmrg	[C], [
29983bee1c92Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29993bee1c92Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
30003bee1c92Smrg		m4_version_prereq([2.70],
30013bee1c92Smrg			[AC_REQUIRE([AC_PROG_CC])],
30023bee1c92Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
300326df5c7cSmrg		define([PREFIX], [C])
300426df5c7cSmrg		define([CACHE_PREFIX], [cc])
300526df5c7cSmrg		define([COMPILER], [$CC])
300626df5c7cSmrg	],
300726df5c7cSmrg	[C++], [
300826df5c7cSmrg		define([PREFIX], [CXX])
300926df5c7cSmrg		define([CACHE_PREFIX], [cxx])
301026df5c7cSmrg		define([COMPILER], [$CXX])
301126df5c7cSmrg	]
301226df5c7cSmrg)
301326df5c7cSmrg
301426df5c7cSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
301526df5c7cSmrg
301626df5c7cSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
301726df5c7cSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301826df5c7cSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301926df5c7cSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
302026df5c7cSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302126df5c7cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
302226df5c7cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
302326df5c7cSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
302426df5c7cSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3025054b3d00Smrgfi
302626df5c7cSmrg
302726df5c7cSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302826df5c7cSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302926df5c7cSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303026df5c7cSmrg	fi
303126df5c7cSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
303226df5c7cSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
303326df5c7cSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
303426df5c7cSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
303526df5c7cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
303626df5c7cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
303726df5c7cSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303826df5c7cSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303926df5c7cSmrgfi
304026df5c7cSmrg
304126df5c7cSmrgfound="no"
304226df5c7cSmrgm4_foreach([flag], m4_cdr($@), [
304326df5c7cSmrg	if test $found = "no" ; then
304426df5c7cSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
304526df5c7cSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
304626df5c7cSmrg		fi
304726df5c7cSmrg
304826df5c7cSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304926df5c7cSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
305026df5c7cSmrg		fi
305126df5c7cSmrg
305226df5c7cSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
305326df5c7cSmrg
305426df5c7cSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
305526df5c7cSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
305626df5c7cSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
305726df5c7cSmrg		AC_CACHE_VAL($cacheid,
305826df5c7cSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305926df5c7cSmrg					     [eval $cacheid=yes],
306026df5c7cSmrg					     [eval $cacheid=no])])
306126df5c7cSmrg
306226df5c7cSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
306326df5c7cSmrg
306426df5c7cSmrg		eval supported=\$$cacheid
306526df5c7cSmrg		AC_MSG_RESULT([$supported])
306626df5c7cSmrg		if test "$supported" = "yes" ; then
306726df5c7cSmrg			$1="$$1 ]flag["
306826df5c7cSmrg			found="yes"
306926df5c7cSmrg		fi
307026df5c7cSmrg	fi
3071054b3d00Smrg])
307226df5c7cSmrg]) # XORG_TESTSET_CFLAG
3073054b3d00Smrg
307426df5c7cSmrg# XORG_COMPILER_FLAGS
307526df5c7cSmrg# ---------------
307626df5c7cSmrg# Minimum version: 1.16.0
307755074dd0Smrg#
307826df5c7cSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307926df5c7cSmrg# arguments supported by the selected compiler which do NOT alter the generated
308026df5c7cSmrg# code.  These arguments will cause the compiler to print various warnings
308126df5c7cSmrg# during compilation AND turn a conservative set of warnings into errors.
308226df5c7cSmrg#
308326df5c7cSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
308426df5c7cSmrg# future versions of util-macros as options are added to new compilers.
308526df5c7cSmrg#
308626df5c7cSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
308726df5c7cSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3088054b3d00Smrg
308926df5c7cSmrgAC_ARG_ENABLE(selective-werror,
309026df5c7cSmrg              AS_HELP_STRING([--disable-selective-werror],
309126df5c7cSmrg                             [Turn off selective compiler errors. (default: enabled)]),
309226df5c7cSmrg              [SELECTIVE_WERROR=$enableval],
309326df5c7cSmrg              [SELECTIVE_WERROR=yes])
309426df5c7cSmrg
309526df5c7cSmrgAC_LANG_CASE(
309626df5c7cSmrg        [C], [
309726df5c7cSmrg                define([PREFIX], [C])
309826df5c7cSmrg        ],
309926df5c7cSmrg        [C++], [
310026df5c7cSmrg                define([PREFIX], [CXX])
310126df5c7cSmrg        ]
310226df5c7cSmrg)
310326df5c7cSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
310426df5c7cSmrgif test "x$SUNCC" = "xyes"; then
310526df5c7cSmrg    [BASE_]PREFIX[FLAGS]="-v"
3106054b3d00Smrgelse
310726df5c7cSmrg    [BASE_]PREFIX[FLAGS]=""
3108054b3d00Smrgfi
3109054b3d00Smrg
311026df5c7cSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
311126df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
311226df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
311326df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
311426df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3115054b3d00Smrg
311626df5c7cSmrgAC_LANG_CASE(
311726df5c7cSmrg	[C], [
311826df5c7cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311926df5c7cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
312026df5c7cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
312126df5c7cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
312226df5c7cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
312326df5c7cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
312426df5c7cSmrg	]
312526df5c7cSmrg)
3126054b3d00Smrg
312726df5c7cSmrg# This chunk adds additional warnings that could catch undesired effects.
312826df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312926df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
313026df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
313126df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
313226df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
313326df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
313426df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3135a1d141d5Smrg
313626df5c7cSmrg# These are currently disabled because they are noisy.  They will be enabled
313726df5c7cSmrg# in the future once the codebase is sufficiently modernized to silence
313826df5c7cSmrg# them.  For now, I don't want them to drown out the other warnings.
313926df5c7cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
314026df5c7cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
314126df5c7cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3142a1d141d5Smrg
31433bee1c92Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
314426df5c7cSmrg# when there are problems that should be fixed.
3145a1d141d5Smrg
314626df5c7cSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
314726df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314826df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314926df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
315026df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
315126df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
315226df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
315326df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
315426df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
315526df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
315626df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
315726df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315826df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315926df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
316026df5c7cSmrgelse
316126df5c7cSmrgAC_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])
316226df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
316326df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
316426df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
316526df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
316626df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
316726df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316826df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316926df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
317026df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
317126df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
317226df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
317326df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
317426df5c7cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
317526df5c7cSmrgfi
3176a1d141d5Smrg
317726df5c7cSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317826df5c7cSmrg]) # XORG_COMPILER_FLAGS
3179a1d141d5Smrg
318026df5c7cSmrg# XORG_CWARNFLAGS
318126df5c7cSmrg# ---------------
318226df5c7cSmrg# Minimum version: 1.2.0
318326df5c7cSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3184054b3d00Smrg#
318526df5c7cSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3186054b3d00Smrg#
318726df5c7cSmrg# This function is deprecated because it defines -fno-strict-aliasing
318826df5c7cSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318926df5c7cSmrg# is needed, then it should be added explicitly in the module when
319026df5c7cSmrg# it is updated to use BASE_CFLAGS.
3191054b3d00Smrg#
319226df5c7cSmrgAC_DEFUN([XORG_CWARNFLAGS], [
319326df5c7cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
319426df5c7cSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
319526df5c7cSmrgAC_LANG_CASE(
319626df5c7cSmrg	[C], [
319726df5c7cSmrg		CWARNFLAGS="$BASE_CFLAGS"
319826df5c7cSmrg		if  test "x$GCC" = xyes ; then
319926df5c7cSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
320026df5c7cSmrg		fi
320126df5c7cSmrg		AC_SUBST(CWARNFLAGS)
320226df5c7cSmrg	]
320326df5c7cSmrg)
320426df5c7cSmrg]) # XORG_CWARNFLAGS
32052ddb6cf1Smrg
320626df5c7cSmrg# XORG_STRICT_OPTION
320726df5c7cSmrg# -----------------------
320826df5c7cSmrg# Minimum version: 1.3.0
320926df5c7cSmrg#
321026df5c7cSmrg# Add configure option to enable strict compilation flags, such as treating
321126df5c7cSmrg# warnings as fatal errors.
321226df5c7cSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
321326df5c7cSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
321426df5c7cSmrg#
321526df5c7cSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
321626df5c7cSmrg# when strict compilation is unconditionally desired.
321726df5c7cSmrgAC_DEFUN([XORG_STRICT_OPTION], [
321826df5c7cSmrgAC_REQUIRE([XORG_CWARNFLAGS])
321926df5c7cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3220054b3d00Smrg
322126df5c7cSmrgAC_ARG_ENABLE(strict-compilation,
322226df5c7cSmrg			  AS_HELP_STRING([--enable-strict-compilation],
322326df5c7cSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
322426df5c7cSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3225054b3d00Smrg
322626df5c7cSmrgAC_LANG_CASE(
322726df5c7cSmrg        [C], [
322826df5c7cSmrg                define([PREFIX], [C])
322926df5c7cSmrg        ],
323026df5c7cSmrg        [C++], [
323126df5c7cSmrg                define([PREFIX], [CXX])
323226df5c7cSmrg        ]
323326df5c7cSmrg)
3234054b3d00Smrg
323526df5c7cSmrg[STRICT_]PREFIX[FLAGS]=""
323626df5c7cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
323726df5c7cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3238054b3d00Smrg
323926df5c7cSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
324026df5c7cSmrg# activate it with -Werror, so we add it here explicitly.
324126df5c7cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3242054b3d00Smrg
324326df5c7cSmrgif test "x$STRICT_COMPILE" = "xyes"; then
324426df5c7cSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
324526df5c7cSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
324626df5c7cSmrgfi
324726df5c7cSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324826df5c7cSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324926df5c7cSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
325026df5c7cSmrg]) # XORG_STRICT_OPTION
3251054b3d00Smrg
32523bee1c92Smrg# XORG_DEFAULT_NOCODE_OPTIONS
32533bee1c92Smrg# ---------------------------
32543bee1c92Smrg# Minimum version: 1.20.0
32553bee1c92Smrg#
32563bee1c92Smrg# Defines default options for X.Org modules which don't compile code,
32573bee1c92Smrg# such as fonts, bitmaps, cursors, and docs.
32583bee1c92Smrg#
32593bee1c92SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
32603bee1c92SmrgAC_REQUIRE([AC_PROG_INSTALL])
32613bee1c92SmrgXORG_RELEASE_VERSION
32623bee1c92SmrgXORG_CHANGELOG
32633bee1c92SmrgXORG_INSTALL
32643bee1c92SmrgXORG_MANPAGE_SECTIONS
32653bee1c92Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32663bee1c92Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32673bee1c92Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
32683bee1c92Smrg
326926df5c7cSmrg# XORG_DEFAULT_OPTIONS
327026df5c7cSmrg# --------------------
327126df5c7cSmrg# Minimum version: 1.3.0
327226df5c7cSmrg#
32733bee1c92Smrg# Defines default options for X.Org modules which compile code.
327426df5c7cSmrg#
327526df5c7cSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
327626df5c7cSmrgAC_REQUIRE([AC_PROG_INSTALL])
327726df5c7cSmrgXORG_COMPILER_FLAGS
327826df5c7cSmrgXORG_CWARNFLAGS
327926df5c7cSmrgXORG_STRICT_OPTION
32803bee1c92SmrgXORG_DEFAULT_NOCODE_OPTIONS
328126df5c7cSmrg]) # XORG_DEFAULT_OPTIONS
3282a1d141d5Smrg
328326df5c7cSmrg# XORG_INSTALL()
328426df5c7cSmrg# ----------------
328526df5c7cSmrg# Minimum version: 1.4.0
328626df5c7cSmrg#
328726df5c7cSmrg# Defines the variable INSTALL_CMD as the command to copy
328826df5c7cSmrg# INSTALL from $prefix/share/util-macros.
328926df5c7cSmrg#
329026df5c7cSmrgAC_DEFUN([XORG_INSTALL], [
329126df5c7cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
329226df5c7cSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
329326df5c7cSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
329426df5c7cSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
329526df5c7cSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
329626df5c7cSmrgtouch \$(top_srcdir)/INSTALL; \
329726df5c7cSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
329826df5c7cSmrgAC_SUBST([INSTALL_CMD])
329926df5c7cSmrg]) # XORG_INSTALL
330026df5c7cSmrgdnl Copyright 2005 Red Hat, Inc
330126df5c7cSmrgdnl
330226df5c7cSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
330326df5c7cSmrgdnl documentation for any purpose is hereby granted without fee, provided that
330426df5c7cSmrgdnl the above copyright notice appear in all copies and that both that
330526df5c7cSmrgdnl copyright notice and this permission notice appear in supporting
330626df5c7cSmrgdnl documentation.
330726df5c7cSmrgdnl
330826df5c7cSmrgdnl The above copyright notice and this permission notice shall be included
330926df5c7cSmrgdnl in all copies or substantial portions of the Software.
331026df5c7cSmrgdnl
331126df5c7cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
331226df5c7cSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
331326df5c7cSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
331426df5c7cSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
331526df5c7cSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
331626df5c7cSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
331726df5c7cSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
331826df5c7cSmrgdnl
331926df5c7cSmrgdnl Except as contained in this notice, the name of the copyright holders shall
332026df5c7cSmrgdnl not be used in advertising or otherwise to promote the sale, use or
332126df5c7cSmrgdnl other dealings in this Software without prior written authorization
332226df5c7cSmrgdnl from the copyright holders.
332326df5c7cSmrgdnl
3324054b3d00Smrg
332526df5c7cSmrg# XORG_RELEASE_VERSION
332626df5c7cSmrg# --------------------
332726df5c7cSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3328a1d141d5Smrg
332926df5c7cSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
333026df5c7cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
333126df5c7cSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
333226df5c7cSmrg		[Major version of this package])
333326df5c7cSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
333426df5c7cSmrg	if test "x$PVM" = "x"; then
333526df5c7cSmrg		PVM="0"
333626df5c7cSmrg	fi
333726df5c7cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
333826df5c7cSmrg		[$PVM],
333926df5c7cSmrg		[Minor version of this package])
334026df5c7cSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
334126df5c7cSmrg	if test "x$PVP" = "x"; then
334226df5c7cSmrg		PVP="0"
334326df5c7cSmrg	fi
334426df5c7cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
334526df5c7cSmrg		[$PVP],
334626df5c7cSmrg		[Patch version of this package])
334726df5c7cSmrg])
3348a1d141d5Smrg
334926df5c7cSmrg# XORG_CHANGELOG()
335026df5c7cSmrg# ----------------
335126df5c7cSmrg# Minimum version: 1.2.0
335226df5c7cSmrg#
335326df5c7cSmrg# Defines the variable CHANGELOG_CMD as the command to generate
335426df5c7cSmrg# ChangeLog from git.
335526df5c7cSmrg#
335626df5c7cSmrg#
335726df5c7cSmrgAC_DEFUN([XORG_CHANGELOG], [
335826df5c7cSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
335926df5c7cSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
336026df5c7cSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
336126df5c7cSmrgtouch \$(top_srcdir)/ChangeLog; \
336226df5c7cSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
336326df5c7cSmrgAC_SUBST([CHANGELOG_CMD])
336426df5c7cSmrg]) # XORG_CHANGELOG
3365a1d141d5Smrg
3366