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