aclocal.m4 revision 92e95ad1
192e95ad1Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2b91640d3Smrg
392e95ad1Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4a6d9b409Smrg
5a6d9b409Smrg# This file is free software; the Free Software Foundation
6a6d9b409Smrg# gives unlimited permission to copy and/or distribute it,
7a6d9b409Smrg# with or without modifications, as long as this notice is preserved.
8a6d9b409Smrg
9a6d9b409Smrg# This program is distributed in the hope that it will be useful,
10a6d9b409Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a6d9b409Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a6d9b409Smrg# PARTICULAR PURPOSE.
13a6d9b409Smrg
14b91640d3Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15efda2da8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16efda2da8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1792e95ad1Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
1892e95ad1Smrg[m4_warning([this file was generated for autoconf 2.71.
19efda2da8SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20efda2da8SmrgIf you have problems, you may need to regenerate the build system entirely.
21b91640d3SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22a6d9b409Smrg
2392e95ad1Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2492e95ad1Smrg#
2592e95ad1Smrg# This file is free software; the Free Software Foundation
2692e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
2792e95ad1Smrg# with or without modifications, as long as this notice is preserved.
288b8e729cSmrg
2992e95ad1Smrg# AM_AUTOMAKE_VERSION(VERSION)
3092e95ad1Smrg# ----------------------------
3192e95ad1Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3292e95ad1Smrg# generated from the m4 files accompanying Automake X.Y.
3392e95ad1Smrg# (This private macro should not be called outside this file.)
3492e95ad1SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3592e95ad1Smrg[am__api_version='1.16'
3692e95ad1Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3792e95ad1Smrgdnl require some minimum version.  Point them to the right macro.
3892e95ad1Smrgm4_if([$1], [1.16.5], [],
3992e95ad1Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4092e95ad1Smrg])
418b8e729cSmrg
4292e95ad1Smrg# _AM_AUTOCONF_VERSION(VERSION)
4392e95ad1Smrg# -----------------------------
4492e95ad1Smrg# aclocal traces this macro to find the Autoconf version.
4592e95ad1Smrg# This is a private macro too.  Using m4_define simplifies
4692e95ad1Smrg# the logic in aclocal, which can simply ignore this definition.
4792e95ad1Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48a6d9b409Smrg
4992e95ad1Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5092e95ad1Smrg# -------------------------------
5192e95ad1Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5292e95ad1Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5392e95ad1SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5492e95ad1Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5592e95ad1Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5692e95ad1Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5792e95ad1Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58a6d9b409Smrg
5992e95ad1Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60a6d9b409Smrg
6192e95ad1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6292e95ad1Smrg#
6392e95ad1Smrg# This file is free software; the Free Software Foundation
6492e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
6592e95ad1Smrg# with or without modifications, as long as this notice is preserved.
66a6d9b409Smrg
6792e95ad1Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6892e95ad1Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6992e95ad1Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7092e95ad1Smrg#
7192e95ad1Smrg# Of course, Automake must honor this variable whenever it calls a
7292e95ad1Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7392e95ad1Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7492e95ad1Smrg# depending on how configure is run.  This is pretty annoying, since
7592e95ad1Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7692e95ad1Smrg# source directory, any form will work fine, but in subdirectories a
7792e95ad1Smrg# relative path needs to be adjusted first.
7892e95ad1Smrg#
7992e95ad1Smrg# $ac_aux_dir/missing
8092e95ad1Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8192e95ad1Smrg# $top_srcdir/$ac_aux_dir/missing
8292e95ad1Smrg#    fails if $ac_aux_dir is absolute,
8392e95ad1Smrg#    fails when called from a subdirectory in a VPATH build with
8492e95ad1Smrg#          a relative $ac_aux_dir
8592e95ad1Smrg#
8692e95ad1Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8792e95ad1Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8892e95ad1Smrg# harmless because $srcdir is '.', but things will broke when you
8992e95ad1Smrg# start a VPATH build or use an absolute $srcdir.
9092e95ad1Smrg#
9192e95ad1Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9292e95ad1Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9392e95ad1Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9492e95ad1Smrg# and then we would define $MISSING as
9592e95ad1Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9692e95ad1Smrg# This will work as long as MISSING is not called from configure, because
9792e95ad1Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9892e95ad1Smrg# However there are other variables, like CC, which are often used in
9992e95ad1Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10092e95ad1Smrg#
10192e95ad1Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10292e95ad1Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10392e95ad1Smrg# configured tree to be moved without reconfiguration.
104a6d9b409Smrg
10592e95ad1SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10692e95ad1Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10792e95ad1Smrg# Expand $ac_aux_dir to an absolute path.
10892e95ad1Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10992e95ad1Smrg])
11011a95ff3Smrg
11192e95ad1Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112a6d9b409Smrg
11392e95ad1Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11492e95ad1Smrg#
11592e95ad1Smrg# This file is free software; the Free Software Foundation
11692e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
11792e95ad1Smrg# with or without modifications, as long as this notice is preserved.
118a6d9b409Smrg
11992e95ad1Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12092e95ad1Smrg# -------------------------------------
12192e95ad1Smrg# Define a conditional.
12292e95ad1SmrgAC_DEFUN([AM_CONDITIONAL],
12392e95ad1Smrg[AC_PREREQ([2.52])dnl
12492e95ad1Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12592e95ad1Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12692e95ad1SmrgAC_SUBST([$1_TRUE])dnl
12792e95ad1SmrgAC_SUBST([$1_FALSE])dnl
12892e95ad1Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12992e95ad1Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13092e95ad1Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13192e95ad1Smrgif $2; then
13292e95ad1Smrg  $1_TRUE=
13392e95ad1Smrg  $1_FALSE='#'
13492e95ad1Smrgelse
13592e95ad1Smrg  $1_TRUE='#'
13692e95ad1Smrg  $1_FALSE=
13792e95ad1Smrgfi
13892e95ad1SmrgAC_CONFIG_COMMANDS_PRE(
13992e95ad1Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14092e95ad1Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14192e95ad1SmrgUsually this means the macro was only invoked conditionally.]])
14292e95ad1Smrgfi])])
143a6d9b409Smrg
14492e95ad1Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14592e95ad1Smrg#
14692e95ad1Smrg# This file is free software; the Free Software Foundation
14792e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
14892e95ad1Smrg# with or without modifications, as long as this notice is preserved.
149a6d9b409Smrg
150a6d9b409Smrg
15192e95ad1Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15292e95ad1Smrg# written in clear, in which case automake, when reading aclocal.m4,
15392e95ad1Smrg# will think it sees a *use*, and therefore will trigger all it's
15492e95ad1Smrg# C support machinery.  Also note that it means that autoscan, seeing
15592e95ad1Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156a6d9b409Smrg
157a6d9b409Smrg
15892e95ad1Smrg# _AM_DEPENDENCIES(NAME)
15992e95ad1Smrg# ----------------------
16092e95ad1Smrg# See how the compiler implements dependency checking.
16192e95ad1Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16292e95ad1Smrg# We try a few techniques and use that to set a single cache variable.
16392e95ad1Smrg#
16492e95ad1Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16592e95ad1Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16692e95ad1Smrg# dependency, and given that the user is not expected to run this macro,
16792e95ad1Smrg# just rely on AC_PROG_CC.
16892e95ad1SmrgAC_DEFUN([_AM_DEPENDENCIES],
16992e95ad1Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17092e95ad1SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17192e95ad1SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17292e95ad1SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173a6d9b409Smrg
17492e95ad1Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17592e95ad1Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17692e95ad1Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17792e95ad1Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17892e95ad1Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17992e95ad1Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18092e95ad1Smrg                    [depcc="$$1"   am_compiler_list=])
181a6d9b409Smrg
18292e95ad1SmrgAC_CACHE_CHECK([dependency style of $depcc],
18392e95ad1Smrg               [am_cv_$1_dependencies_compiler_type],
18492e95ad1Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18592e95ad1Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18692e95ad1Smrg  # making bogus files that we don't know about and never remove.  For
18792e95ad1Smrg  # instance it was reported that on HP-UX the gcc test will end up
18892e95ad1Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18992e95ad1Smrg  # in D".
19092e95ad1Smrg  rm -rf conftest.dir
19192e95ad1Smrg  mkdir conftest.dir
19292e95ad1Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19392e95ad1Smrg  # using a relative directory.
19492e95ad1Smrg  cp "$am_depcomp" conftest.dir
19592e95ad1Smrg  cd conftest.dir
19692e95ad1Smrg  # We will build objects and dependencies in a subdirectory because
19792e95ad1Smrg  # it helps to detect inapplicable dependency modes.  For instance
19892e95ad1Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19992e95ad1Smrg  # side effect of compilation, but ICC will put the dependencies in
20092e95ad1Smrg  # the current directory while Tru64 will put them in the object
20192e95ad1Smrg  # directory.
20292e95ad1Smrg  mkdir sub
203a6d9b409Smrg
20492e95ad1Smrg  am_cv_$1_dependencies_compiler_type=none
20592e95ad1Smrg  if test "$am_compiler_list" = ""; then
20692e95ad1Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20792e95ad1Smrg  fi
20892e95ad1Smrg  am__universal=false
20992e95ad1Smrg  m4_case([$1], [CC],
21092e95ad1Smrg    [case " $depcc " in #(
21192e95ad1Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21292e95ad1Smrg     esac],
21392e95ad1Smrg    [CXX],
21492e95ad1Smrg    [case " $depcc " in #(
21592e95ad1Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21692e95ad1Smrg     esac])
2178b8e729cSmrg
21892e95ad1Smrg  for depmode in $am_compiler_list; do
21992e95ad1Smrg    # Setup a source with many dependencies, because some compilers
22092e95ad1Smrg    # like to wrap large dependency lists on column 80 (with \), and
22192e95ad1Smrg    # we should not choose a depcomp mode which is confused by this.
22292e95ad1Smrg    #
22392e95ad1Smrg    # We need to recreate these files for each test, as the compiler may
22492e95ad1Smrg    # overwrite some of them when testing with obscure command lines.
22592e95ad1Smrg    # This happens at least with the AIX C compiler.
22692e95ad1Smrg    : > sub/conftest.c
22792e95ad1Smrg    for i in 1 2 3 4 5 6; do
22892e95ad1Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22992e95ad1Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23092e95ad1Smrg      # Solaris 10 /bin/sh.
23192e95ad1Smrg      echo '/* dummy */' > sub/conftst$i.h
23292e95ad1Smrg    done
23392e95ad1Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2348b8e729cSmrg
23592e95ad1Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23692e95ad1Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23792e95ad1Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23892e95ad1Smrg    # versions had trouble with output in subdirs.
23992e95ad1Smrg    am__obj=sub/conftest.${OBJEXT-o}
24092e95ad1Smrg    am__minus_obj="-o $am__obj"
24192e95ad1Smrg    case $depmode in
24292e95ad1Smrg    gcc)
24392e95ad1Smrg      # This depmode causes a compiler race in universal mode.
24492e95ad1Smrg      test "$am__universal" = false || continue
24592e95ad1Smrg      ;;
24692e95ad1Smrg    nosideeffect)
24792e95ad1Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24892e95ad1Smrg      # only be used when explicitly requested.
24992e95ad1Smrg      if test "x$enable_dependency_tracking" = xyes; then
25092e95ad1Smrg	continue
25192e95ad1Smrg      else
25292e95ad1Smrg	break
25392e95ad1Smrg      fi
25492e95ad1Smrg      ;;
25592e95ad1Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25692e95ad1Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25792e95ad1Smrg      # not run yet.  These depmodes are late enough in the game, and
25892e95ad1Smrg      # so weak that their functioning should not be impacted.
25992e95ad1Smrg      am__obj=conftest.${OBJEXT-o}
26092e95ad1Smrg      am__minus_obj=
26192e95ad1Smrg      ;;
26292e95ad1Smrg    none) break ;;
26392e95ad1Smrg    esac
26492e95ad1Smrg    if depmode=$depmode \
26592e95ad1Smrg       source=sub/conftest.c object=$am__obj \
26692e95ad1Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26792e95ad1Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26892e95ad1Smrg         >/dev/null 2>conftest.err &&
26992e95ad1Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27092e95ad1Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27192e95ad1Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27292e95ad1Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27392e95ad1Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27492e95ad1Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27592e95ad1Smrg      # that says an option was ignored or not supported.
27692e95ad1Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27792e95ad1Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27892e95ad1Smrg      # The diagnosis changed in icc 8.0:
27992e95ad1Smrg      #   icc: Command line remark: option '-MP' not supported
28092e95ad1Smrg      if (grep 'ignoring option' conftest.err ||
28192e95ad1Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28292e95ad1Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28392e95ad1Smrg        break
28492e95ad1Smrg      fi
28592e95ad1Smrg    fi
28692e95ad1Smrg  done
287a6d9b409Smrg
28892e95ad1Smrg  cd ..
28992e95ad1Smrg  rm -rf conftest.dir
29092e95ad1Smrgelse
29192e95ad1Smrg  am_cv_$1_dependencies_compiler_type=none
29292e95ad1Smrgfi
29392e95ad1Smrg])
29492e95ad1SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29592e95ad1SmrgAM_CONDITIONAL([am__fastdep$1], [
29692e95ad1Smrg  test "x$enable_dependency_tracking" != xno \
29792e95ad1Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29892e95ad1Smrg])
299a6d9b409Smrg
30011a95ff3Smrg
30192e95ad1Smrg# AM_SET_DEPDIR
30292e95ad1Smrg# -------------
30392e95ad1Smrg# Choose a directory name for dependency files.
30492e95ad1Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30592e95ad1SmrgAC_DEFUN([AM_SET_DEPDIR],
30692e95ad1Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30792e95ad1SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30892e95ad1Smrg])
30911a95ff3Smrg
31011a95ff3Smrg
31192e95ad1Smrg# AM_DEP_TRACK
31292e95ad1Smrg# ------------
31392e95ad1SmrgAC_DEFUN([AM_DEP_TRACK],
31492e95ad1Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31592e95ad1SmrgAS_HELP_STRING(
31692e95ad1Smrg  [--enable-dependency-tracking],
31792e95ad1Smrg  [do not reject slow dependency extractors])
31892e95ad1SmrgAS_HELP_STRING(
31992e95ad1Smrg  [--disable-dependency-tracking],
32092e95ad1Smrg  [speeds up one-time build])])
32192e95ad1Smrgif test "x$enable_dependency_tracking" != xno; then
32292e95ad1Smrg  am_depcomp="$ac_aux_dir/depcomp"
32392e95ad1Smrg  AMDEPBACKSLASH='\'
32492e95ad1Smrg  am__nodep='_no'
32592e95ad1Smrgfi
32692e95ad1SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32792e95ad1SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32892e95ad1Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32992e95ad1SmrgAC_SUBST([am__nodep])dnl
33092e95ad1Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33192e95ad1Smrg])
33211a95ff3Smrg
33392e95ad1Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334a6d9b409Smrg
33592e95ad1Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
33611a95ff3Smrg#
33792e95ad1Smrg# This file is free software; the Free Software Foundation
33892e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
33992e95ad1Smrg# with or without modifications, as long as this notice is preserved.
340a6d9b409Smrg
34192e95ad1Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34292e95ad1Smrg# ------------------------------
34392e95ad1SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34492e95ad1Smrg[{
34592e95ad1Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34692e95ad1Smrg  # are listed without --file.  Let's play safe and only enable the eval
34792e95ad1Smrg  # if we detect the quoting.
34892e95ad1Smrg  # TODO: see whether this extra hack can be removed once we start
34992e95ad1Smrg  # requiring Autoconf 2.70 or later.
35092e95ad1Smrg  AS_CASE([$CONFIG_FILES],
35192e95ad1Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
35292e95ad1Smrg          [*], [set x $CONFIG_FILES])
35392e95ad1Smrg  shift
35492e95ad1Smrg  # Used to flag and report bootstrapping failures.
35592e95ad1Smrg  am_rc=0
35692e95ad1Smrg  for am_mf
35792e95ad1Smrg  do
35892e95ad1Smrg    # Strip MF so we end up with the name of the file.
35992e95ad1Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36092e95ad1Smrg    # Check whether this is an Automake generated Makefile which includes
36192e95ad1Smrg    # dependency-tracking related rules and includes.
36292e95ad1Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36392e95ad1Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36492e95ad1Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36592e95ad1Smrg      || continue
36692e95ad1Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36792e95ad1Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36892e95ad1Smrg    AM_RUN_LOG([cd "$am_dirpart" \
36992e95ad1Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37092e95ad1Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37192e95ad1Smrg  done
37292e95ad1Smrg  if test $am_rc -ne 0; then
37392e95ad1Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37492e95ad1Smrg    for automatic dependency tracking.  If GNU make was not used, consider
37592e95ad1Smrg    re-running the configure script with MAKE="gmake" (or whatever is
37692e95ad1Smrg    necessary).  You can also try re-running configure with the
37792e95ad1Smrg    '--disable-dependency-tracking' option to at least be able to build
37892e95ad1Smrg    the package (albeit without support for automatic dependency tracking).])
37992e95ad1Smrg  fi
38092e95ad1Smrg  AS_UNSET([am_dirpart])
38192e95ad1Smrg  AS_UNSET([am_filepart])
38292e95ad1Smrg  AS_UNSET([am_mf])
38392e95ad1Smrg  AS_UNSET([am_rc])
38492e95ad1Smrg  rm -f conftest-deps.mk
38592e95ad1Smrg}
38692e95ad1Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387a6d9b409Smrg
388a6d9b409Smrg
38992e95ad1Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39092e95ad1Smrg# -----------------------------
39192e95ad1Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392a6d9b409Smrg#
39392e95ad1Smrg# This code is only required when automatic dependency tracking is enabled.
39492e95ad1Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39592e95ad1Smrg# order to bootstrap the dependency handling code.
39692e95ad1SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39792e95ad1Smrg[AC_CONFIG_COMMANDS([depfiles],
39892e95ad1Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39992e95ad1Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400a6d9b409Smrg
40192e95ad1Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402a6d9b409Smrg
40392e95ad1Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40492e95ad1Smrg#
40592e95ad1Smrg# This file is free software; the Free Software Foundation
40692e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
40792e95ad1Smrg# with or without modifications, as long as this notice is preserved.
408a6d9b409Smrg
40992e95ad1Smrg# This macro actually does too much.  Some checks are only needed if
41092e95ad1Smrg# your package does certain things.  But this isn't really a big deal.
411a6d9b409Smrg
41292e95ad1Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41392e95ad1Smrgm4_define([AC_PROG_CC],
41492e95ad1Smrgm4_defn([AC_PROG_CC])
41592e95ad1Smrg[_AM_PROG_CC_C_O
41692e95ad1Smrg])
41711a95ff3Smrg
41892e95ad1Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41992e95ad1Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42092e95ad1Smrg# -----------------------------------------------
42192e95ad1Smrg# The call with PACKAGE and VERSION arguments is the old style
42292e95ad1Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42392e95ad1Smrg# and VERSION should now be passed to AC_INIT and removed from
42492e95ad1Smrg# the call to AM_INIT_AUTOMAKE.
42592e95ad1Smrg# We support both call styles for the transition.  After
42692e95ad1Smrg# the next Automake release, Autoconf can make the AC_INIT
42792e95ad1Smrg# arguments mandatory, and then we can depend on a new Autoconf
42892e95ad1Smrg# release and drop the old call support.
42992e95ad1SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43092e95ad1Smrg[AC_PREREQ([2.65])dnl
43192e95ad1Smrgm4_ifdef([_$0_ALREADY_INIT],
43292e95ad1Smrg  [m4_fatal([$0 expanded multiple times
43392e95ad1Smrg]m4_defn([_$0_ALREADY_INIT]))],
43492e95ad1Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43592e95ad1Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43692e95ad1Smrgdnl the ones we care about.
43792e95ad1Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43892e95ad1SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43992e95ad1SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44092e95ad1Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44192e95ad1Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44292e95ad1Smrg  # is not polluted with repeated "-I."
44392e95ad1Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44492e95ad1Smrg  # test to see if srcdir already configured
44592e95ad1Smrg  if test -f $srcdir/config.status; then
44692e95ad1Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44792e95ad1Smrg  fi
44811a95ff3Smrgfi
44911a95ff3Smrg
45092e95ad1Smrg# test whether we have cygpath
45192e95ad1Smrgif test -z "$CYGPATH_W"; then
45292e95ad1Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45392e95ad1Smrg    CYGPATH_W='cygpath -w'
45492e95ad1Smrg  else
45592e95ad1Smrg    CYGPATH_W=echo
45692e95ad1Smrg  fi
45711a95ff3Smrgfi
45892e95ad1SmrgAC_SUBST([CYGPATH_W])
45911a95ff3Smrg
46092e95ad1Smrg# Define the identity of the package.
46192e95ad1Smrgdnl Distinguish between old-style and new-style calls.
46292e95ad1Smrgm4_ifval([$2],
46392e95ad1Smrg[AC_DIAGNOSE([obsolete],
46492e95ad1Smrg             [$0: two- and three-arguments forms are deprecated.])
46592e95ad1Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46692e95ad1Smrg AC_SUBST([PACKAGE], [$1])dnl
46792e95ad1Smrg AC_SUBST([VERSION], [$2])],
46892e95ad1Smrg[_AM_SET_OPTIONS([$1])dnl
46992e95ad1Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47092e95ad1Smrgm4_if(
47192e95ad1Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47292e95ad1Smrg  [ok:ok],,
47392e95ad1Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47492e95ad1Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47592e95ad1Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47611a95ff3Smrg
47792e95ad1Smrg_AM_IF_OPTION([no-define],,
47892e95ad1Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47992e95ad1Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48011a95ff3Smrg
48192e95ad1Smrg# Some tools Automake needs.
48292e95ad1SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48392e95ad1SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48492e95ad1SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48592e95ad1SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48692e95ad1SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48792e95ad1SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48892e95ad1SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48992e95ad1SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49092e95ad1SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49192e95ad1SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49292e95ad1Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49392e95ad1Smrg# dies out for good.  For more background, see:
49492e95ad1Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49592e95ad1Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49692e95ad1SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49792e95ad1Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49892e95ad1Smrg# system "awk" is bad on some platforms.
49992e95ad1SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50092e95ad1SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50192e95ad1SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50292e95ad1Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50392e95ad1Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50492e95ad1Smrg			     [_AM_PROG_TAR([v7])])])
50592e95ad1Smrg_AM_IF_OPTION([no-dependencies],,
50692e95ad1Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50792e95ad1Smrg		  [_AM_DEPENDENCIES([CC])],
50892e95ad1Smrg		  [m4_define([AC_PROG_CC],
50992e95ad1Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51092e95ad1SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51192e95ad1Smrg		  [_AM_DEPENDENCIES([CXX])],
51292e95ad1Smrg		  [m4_define([AC_PROG_CXX],
51392e95ad1Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51492e95ad1SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51592e95ad1Smrg		  [_AM_DEPENDENCIES([OBJC])],
51692e95ad1Smrg		  [m4_define([AC_PROG_OBJC],
51792e95ad1Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51892e95ad1SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51992e95ad1Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52092e95ad1Smrg		  [m4_define([AC_PROG_OBJCXX],
52192e95ad1Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52292e95ad1Smrg])
52392e95ad1Smrg# Variables for tags utilities; see am/tags.am
52492e95ad1Smrgif test -z "$CTAGS"; then
52592e95ad1Smrg  CTAGS=ctags
52692e95ad1Smrgfi
52792e95ad1SmrgAC_SUBST([CTAGS])
52892e95ad1Smrgif test -z "$ETAGS"; then
52992e95ad1Smrg  ETAGS=etags
53092e95ad1Smrgfi
53192e95ad1SmrgAC_SUBST([ETAGS])
53292e95ad1Smrgif test -z "$CSCOPE"; then
53392e95ad1Smrg  CSCOPE=cscope
53492e95ad1Smrgfi
53592e95ad1SmrgAC_SUBST([CSCOPE])
53611a95ff3Smrg
53792e95ad1SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53892e95ad1Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53992e95ad1Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54092e95ad1Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54192e95ad1SmrgAC_CONFIG_COMMANDS_PRE(dnl
54292e95ad1Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54392e95ad1Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
54411a95ff3Smrg
54592e95ad1Smrg# POSIX will say in a future version that running "rm -f" with no argument
54692e95ad1Smrg# is OK; and we want to be able to make that assumption in our Makefile
54792e95ad1Smrg# recipes.  So use an aggressive probe to check that the usage we want is
54892e95ad1Smrg# actually supported "in the wild" to an acceptable degree.
54992e95ad1Smrg# See automake bug#10828.
55092e95ad1Smrg# To make any issue more visible, cause the running configure to be aborted
55192e95ad1Smrg# by default if the 'rm' program in use doesn't match our expectations; the
55292e95ad1Smrg# user can still override this though.
55392e95ad1Smrgif rm -f && rm -fr && rm -rf; then : OK; else
55492e95ad1Smrg  cat >&2 <<'END'
55592e95ad1SmrgOops!
556a6d9b409Smrg
55792e95ad1SmrgYour 'rm' program seems unable to run without file operands specified
55892e95ad1Smrgon the command line, even when the '-f' option is present.  This is contrary
55992e95ad1Smrgto the behaviour of most rm programs out there, and not conforming with
56092e95ad1Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561a6d9b409Smrg
56292e95ad1SmrgPlease tell bug-automake@gnu.org about your system, including the value
56392e95ad1Smrgof your $PATH and any error possibly output before this message.  This
56492e95ad1Smrgcan help us improve future automake versions.
56511a95ff3Smrg
56692e95ad1SmrgEND
56792e95ad1Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56892e95ad1Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56992e95ad1Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57092e95ad1Smrg    echo >&2
57192e95ad1Smrg  else
57292e95ad1Smrg    cat >&2 <<'END'
57392e95ad1SmrgAborting the configuration process, to ensure you take notice of the issue.
574a6d9b409Smrg
57592e95ad1SmrgYou can download and install GNU coreutils to get an 'rm' implementation
57692e95ad1Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577a6d9b409Smrg
57892e95ad1SmrgIf you want to complete the configuration process using your problematic
57992e95ad1Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58092e95ad1Smrgto "yes", and re-run configure.
581b91640d3Smrg
58292e95ad1SmrgEND
58392e95ad1Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58492e95ad1Smrg  fi
585a6d9b409Smrgfi
58692e95ad1Smrgdnl The trailing newline in this macro's definition is deliberate, for
58792e95ad1Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58892e95ad1Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58992e95ad1Smrg])
590a6d9b409Smrg
59192e95ad1Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59292e95ad1Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59392e95ad1Smrgdnl mangled by Autoconf and run in a shell conditional statement.
59492e95ad1Smrgm4_define([_AC_COMPILER_EXEEXT],
59592e95ad1Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596a6d9b409Smrg
59792e95ad1Smrg# When config.status generates a header, we must update the stamp-h file.
59892e95ad1Smrg# This file resides in the same directory as the config header
59992e95ad1Smrg# that is generated.  The stamp files are numbered to have different names.
600a6d9b409Smrg
60192e95ad1Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60292e95ad1Smrg# loop where config.status creates the headers, so we can generate
60392e95ad1Smrg# our stamp files there.
60492e95ad1SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60592e95ad1Smrg[# Compute $1's index in $config_headers.
60692e95ad1Smrg_am_arg=$1
60792e95ad1Smrg_am_stamp_count=1
60892e95ad1Smrgfor _am_header in $config_headers :; do
60992e95ad1Smrg  case $_am_header in
61092e95ad1Smrg    $_am_arg | $_am_arg:* )
61192e95ad1Smrg      break ;;
61292e95ad1Smrg    * )
61392e95ad1Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61492e95ad1Smrg  esac
61592e95ad1Smrgdone
61692e95ad1Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617b91640d3Smrg
61892e95ad1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61992e95ad1Smrg#
62092e95ad1Smrg# This file is free software; the Free Software Foundation
62192e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
62292e95ad1Smrg# with or without modifications, as long as this notice is preserved.
62392e95ad1Smrg
62492e95ad1Smrg# AM_PROG_INSTALL_SH
62592e95ad1Smrg# ------------------
62692e95ad1Smrg# Define $install_sh.
62792e95ad1SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62892e95ad1Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62992e95ad1Smrgif test x"${install_sh+set}" != xset; then
63092e95ad1Smrg  case $am_aux_dir in
63192e95ad1Smrg  *\ * | *\	*)
63292e95ad1Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63392e95ad1Smrg  *)
63492e95ad1Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63592e95ad1Smrg  esac
63692e95ad1Smrgfi
63792e95ad1SmrgAC_SUBST([install_sh])])
63892e95ad1Smrg
63992e95ad1Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64092e95ad1Smrg#
64192e95ad1Smrg# This file is free software; the Free Software Foundation
64292e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
64392e95ad1Smrg# with or without modifications, as long as this notice is preserved.
64492e95ad1Smrg
64592e95ad1Smrg# Check whether the underlying file-system supports filenames
64692e95ad1Smrg# with a leading dot.  For instance MS-DOS doesn't.
64792e95ad1SmrgAC_DEFUN([AM_SET_LEADING_DOT],
64892e95ad1Smrg[rm -rf .tst 2>/dev/null
64992e95ad1Smrgmkdir .tst 2>/dev/null
65092e95ad1Smrgif test -d .tst; then
65192e95ad1Smrg  am__leading_dot=.
65211a95ff3Smrgelse
65392e95ad1Smrg  am__leading_dot=_
65411a95ff3Smrgfi
65592e95ad1Smrgrmdir .tst 2>/dev/null
65692e95ad1SmrgAC_SUBST([am__leading_dot])])
657b91640d3Smrg
65892e95ad1Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659b91640d3Smrg
66092e95ad1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66192e95ad1Smrg#
66292e95ad1Smrg# This file is free software; the Free Software Foundation
66392e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
66492e95ad1Smrg# with or without modifications, as long as this notice is preserved.
665b91640d3Smrg
66692e95ad1Smrg# AM_MAKE_INCLUDE()
66792e95ad1Smrg# -----------------
66892e95ad1Smrg# Check whether make has an 'include' directive that can support all
66992e95ad1Smrg# the idioms we need for our automatic dependency tracking code.
67092e95ad1SmrgAC_DEFUN([AM_MAKE_INCLUDE],
67192e95ad1Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
67292e95ad1Smrgcat > confinc.mk << 'END'
67392e95ad1Smrgam__doit:
67492e95ad1Smrg	@echo this is the am__doit target >confinc.out
67592e95ad1Smrg.PHONY: am__doit
67692e95ad1SmrgEND
67792e95ad1Smrgam__include="#"
67892e95ad1Smrgam__quote=
67992e95ad1Smrg# BSD make does it like this.
68092e95ad1Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
68192e95ad1Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
68292e95ad1Smrgecho 'include confinc.mk # ignored' > confmf.GNU
68392e95ad1Smrg_am_result=no
68492e95ad1Smrgfor s in GNU BSD; do
68592e95ad1Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
68692e95ad1Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
68792e95ad1Smrg      ['0:this is the am__doit target'],
68892e95ad1Smrg      [AS_CASE([$s],
68992e95ad1Smrg          [BSD], [am__include='.include' am__quote='"'],
69092e95ad1Smrg          [am__include='include' am__quote=''])])
69192e95ad1Smrg  if test "$am__include" != "#"; then
69292e95ad1Smrg    _am_result="yes ($s style)"
69392e95ad1Smrg    break
69492e95ad1Smrg  fi
69592e95ad1Smrgdone
69692e95ad1Smrgrm -f confinc.* confmf.*
69792e95ad1SmrgAC_MSG_RESULT([${_am_result}])
69892e95ad1SmrgAC_SUBST([am__include])])
69992e95ad1SmrgAC_SUBST([am__quote])])
700b91640d3Smrg
70192e95ad1Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702a6d9b409Smrg
70392e95ad1Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
70411a95ff3Smrg#
70592e95ad1Smrg# This file is free software; the Free Software Foundation
70692e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
70792e95ad1Smrg# with or without modifications, as long as this notice is preserved.
708a6d9b409Smrg
70992e95ad1Smrg# AM_MISSING_PROG(NAME, PROGRAM)
71092e95ad1Smrg# ------------------------------
71192e95ad1SmrgAC_DEFUN([AM_MISSING_PROG],
71292e95ad1Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71392e95ad1Smrg$1=${$1-"${am_missing_run}$2"}
71492e95ad1SmrgAC_SUBST($1)])
715a6d9b409Smrg
71692e95ad1Smrg# AM_MISSING_HAS_RUN
71792e95ad1Smrg# ------------------
71892e95ad1Smrg# Define MISSING if not defined so far and test if it is modern enough.
71992e95ad1Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72092e95ad1SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72192e95ad1Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72292e95ad1SmrgAC_REQUIRE_AUX_FILE([missing])dnl
72392e95ad1Smrgif test x"${MISSING+set}" != xset; then
72492e95ad1Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
72511a95ff3Smrgfi
72692e95ad1Smrg# Use eval to expand $SHELL
72792e95ad1Smrgif eval "$MISSING --is-lightweight"; then
72892e95ad1Smrg  am_missing_run="$MISSING "
72992e95ad1Smrgelse
73092e95ad1Smrg  am_missing_run=
73192e95ad1Smrg  AC_MSG_WARN(['missing' script is too old or missing])
732efda2da8Smrgfi
73392e95ad1Smrg])
734a6d9b409Smrg
73592e95ad1Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736a6d9b409Smrg
73792e95ad1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73892e95ad1Smrg#
73992e95ad1Smrg# This file is free software; the Free Software Foundation
74092e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
74192e95ad1Smrg# with or without modifications, as long as this notice is preserved.
742a6d9b409Smrg
74392e95ad1Smrg# _AM_MANGLE_OPTION(NAME)
74492e95ad1Smrg# -----------------------
74592e95ad1SmrgAC_DEFUN([_AM_MANGLE_OPTION],
74692e95ad1Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747a6d9b409Smrg
74892e95ad1Smrg# _AM_SET_OPTION(NAME)
74992e95ad1Smrg# --------------------
75092e95ad1Smrg# Set option NAME.  Presently that only means defining a flag for this option.
75192e95ad1SmrgAC_DEFUN([_AM_SET_OPTION],
75292e95ad1Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753a6d9b409Smrg
75492e95ad1Smrg# _AM_SET_OPTIONS(OPTIONS)
75592e95ad1Smrg# ------------------------
75692e95ad1Smrg# OPTIONS is a space-separated list of Automake options.
75792e95ad1SmrgAC_DEFUN([_AM_SET_OPTIONS],
75892e95ad1Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75992e95ad1Smrg
76092e95ad1Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76192e95ad1Smrg# -------------------------------------------
76292e95ad1Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76392e95ad1SmrgAC_DEFUN([_AM_IF_OPTION],
76492e95ad1Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76592e95ad1Smrg
76692e95ad1Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
76711a95ff3Smrg#
76892e95ad1Smrg# This file is free software; the Free Software Foundation
76992e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
77092e95ad1Smrg# with or without modifications, as long as this notice is preserved.
771a6d9b409Smrg
77292e95ad1Smrg# _AM_PROG_CC_C_O
77392e95ad1Smrg# ---------------
77492e95ad1Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77592e95ad1Smrg# to automatically call this.
77692e95ad1SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77792e95ad1Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77892e95ad1SmrgAC_REQUIRE_AUX_FILE([compile])dnl
77992e95ad1SmrgAC_LANG_PUSH([C])dnl
78092e95ad1SmrgAC_CACHE_CHECK(
78192e95ad1Smrg  [whether $CC understands -c and -o together],
78292e95ad1Smrg  [am_cv_prog_cc_c_o],
78392e95ad1Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78492e95ad1Smrg  # Make sure it works both with $CC and with simple cc.
78592e95ad1Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78692e95ad1Smrg  # compilers refuse to overwrite an existing .o file with -o,
78792e95ad1Smrg  # though they will create one.
78892e95ad1Smrg  am_cv_prog_cc_c_o=yes
78992e95ad1Smrg  for am_i in 1 2; do
79092e95ad1Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79192e95ad1Smrg         && test -f conftest2.$ac_objext; then
79292e95ad1Smrg      : OK
79392e95ad1Smrg    else
79492e95ad1Smrg      am_cv_prog_cc_c_o=no
79592e95ad1Smrg      break
79692e95ad1Smrg    fi
79792e95ad1Smrg  done
79892e95ad1Smrg  rm -f core conftest*
79992e95ad1Smrg  unset am_i])
80092e95ad1Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80192e95ad1Smrg   # Losing compiler, so override with the script.
80292e95ad1Smrg   # FIXME: It is wrong to rewrite CC.
80392e95ad1Smrg   # But if we don't then we get into trouble of one sort or another.
80492e95ad1Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80592e95ad1Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80692e95ad1Smrg   CC="$am_aux_dir/compile $CC"
807a6d9b409Smrgfi
80892e95ad1SmrgAC_LANG_POP([C])])
809a6d9b409Smrg
81092e95ad1Smrg# For backward compatibility.
81192e95ad1SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812a6d9b409Smrg
81392e95ad1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
8148b8e729cSmrg#
81592e95ad1Smrg# This file is free software; the Free Software Foundation
81692e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
81792e95ad1Smrg# with or without modifications, as long as this notice is preserved.
818a6d9b409Smrg
81992e95ad1Smrg# AM_RUN_LOG(COMMAND)
82092e95ad1Smrg# -------------------
82192e95ad1Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82292e95ad1Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82392e95ad1SmrgAC_DEFUN([AM_RUN_LOG],
82492e95ad1Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82592e95ad1Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82692e95ad1Smrg   ac_status=$?
82792e95ad1Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82892e95ad1Smrg   (exit $ac_status); }])
82992e95ad1Smrg
83092e95ad1Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83192e95ad1Smrg
83292e95ad1Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
83311a95ff3Smrg#
83492e95ad1Smrg# This file is free software; the Free Software Foundation
83592e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
83692e95ad1Smrg# with or without modifications, as long as this notice is preserved.
837a6d9b409Smrg
83892e95ad1Smrg# AM_SANITY_CHECK
83992e95ad1Smrg# ---------------
84092e95ad1SmrgAC_DEFUN([AM_SANITY_CHECK],
84192e95ad1Smrg[AC_MSG_CHECKING([whether build environment is sane])
84292e95ad1Smrg# Reject unsafe characters in $srcdir or the absolute working directory
84392e95ad1Smrg# name.  Accept space and tab only in the latter.
84492e95ad1Smrgam_lf='
84592e95ad1Smrg'
84692e95ad1Smrgcase `pwd` in
84792e95ad1Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84892e95ad1Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84992e95ad1Smrgesac
85092e95ad1Smrgcase $srcdir in
85192e95ad1Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85292e95ad1Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85392e95ad1Smrgesac
85492e95ad1Smrg
85592e95ad1Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85692e95ad1Smrg# arguments.  Must try -L first in case configure is actually a
85792e95ad1Smrg# symlink; some systems play weird games with the mod time of symlinks
85892e95ad1Smrg# (eg FreeBSD returns the mod time of the symlink's containing
85992e95ad1Smrg# directory).
86092e95ad1Smrgif (
86192e95ad1Smrg   am_has_slept=no
86292e95ad1Smrg   for am_try in 1 2; do
86392e95ad1Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86492e95ad1Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86592e95ad1Smrg     if test "$[*]" = "X"; then
86692e95ad1Smrg	# -L didn't work.
86792e95ad1Smrg	set X `ls -t "$srcdir/configure" conftest.file`
86892e95ad1Smrg     fi
86992e95ad1Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87092e95ad1Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87192e95ad1Smrg
87292e95ad1Smrg	# If neither matched, then we have a broken ls.  This can happen
87392e95ad1Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87492e95ad1Smrg	# broken ls alias from the environment.  This has actually
87592e95ad1Smrg	# happened.  Such a system could not be considered "sane".
87692e95ad1Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87792e95ad1Smrg  alias in your environment])
87892e95ad1Smrg     fi
87992e95ad1Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88092e95ad1Smrg       break
88192e95ad1Smrg     fi
88292e95ad1Smrg     # Just in case.
88392e95ad1Smrg     sleep 1
88492e95ad1Smrg     am_has_slept=yes
88592e95ad1Smrg   done
88692e95ad1Smrg   test "$[2]" = conftest.file
88792e95ad1Smrg   )
88892e95ad1Smrgthen
88992e95ad1Smrg   # Ok.
89092e95ad1Smrg   :
89111a95ff3Smrgelse
89292e95ad1Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
89392e95ad1SmrgCheck your system clock])
894b91640d3Smrgfi
89592e95ad1SmrgAC_MSG_RESULT([yes])
89692e95ad1Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89792e95ad1Smrg# generated files are strictly newer.
89892e95ad1Smrgam_sleep_pid=
89992e95ad1Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90092e95ad1Smrg  ( sleep 1 ) &
90192e95ad1Smrg  am_sleep_pid=$!
90292e95ad1Smrgfi
90392e95ad1SmrgAC_CONFIG_COMMANDS_PRE(
90492e95ad1Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90592e95ad1Smrg   if test -n "$am_sleep_pid"; then
90692e95ad1Smrg     # Hide warnings about reused PIDs.
90792e95ad1Smrg     wait $am_sleep_pid 2>/dev/null
90892e95ad1Smrg   fi
90992e95ad1Smrg   AC_MSG_RESULT([done])])
91092e95ad1Smrgrm -f conftest.file
91192e95ad1Smrg])
912b91640d3Smrg
91392e95ad1Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
91411a95ff3Smrg#
91592e95ad1Smrg# This file is free software; the Free Software Foundation
91692e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
91792e95ad1Smrg# with or without modifications, as long as this notice is preserved.
918a6d9b409Smrg
91992e95ad1Smrg# AM_SILENT_RULES([DEFAULT])
92092e95ad1Smrg# --------------------------
92192e95ad1Smrg# Enable less verbose build rules; with the default set to DEFAULT
92292e95ad1Smrg# ("yes" being less verbose, "no" or empty being verbose).
92392e95ad1SmrgAC_DEFUN([AM_SILENT_RULES],
92492e95ad1Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92592e95ad1SmrgAS_HELP_STRING(
92692e95ad1Smrg  [--enable-silent-rules],
92792e95ad1Smrg  [less verbose build output (undo: "make V=1")])
92892e95ad1SmrgAS_HELP_STRING(
92992e95ad1Smrg  [--disable-silent-rules],
93092e95ad1Smrg  [verbose build output (undo: "make V=0")])dnl
93192e95ad1Smrg])
93292e95ad1Smrgcase $enable_silent_rules in @%:@ (((
93392e95ad1Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93492e95ad1Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93592e95ad1Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93692e95ad1Smrgesac
93792e95ad1Smrgdnl
93892e95ad1Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93992e95ad1Smrgdnl do not support nested variable expansions.
94092e95ad1Smrgdnl See automake bug#9928 and bug#10237.
94192e95ad1Smrgam_make=${MAKE-make}
94292e95ad1SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94392e95ad1Smrg   [am_cv_make_support_nested_variables],
94492e95ad1Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94592e95ad1SmrgBAR0=false
94692e95ad1SmrgBAR1=true
94792e95ad1SmrgV=1
94892e95ad1Smrgam__doit:
94992e95ad1Smrg	@$(TRUE)
95092e95ad1Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95192e95ad1Smrg  am_cv_make_support_nested_variables=yes
95211a95ff3Smrgelse
95392e95ad1Smrg  am_cv_make_support_nested_variables=no
95492e95ad1Smrgfi])
95592e95ad1Smrgif test $am_cv_make_support_nested_variables = yes; then
95692e95ad1Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95792e95ad1Smrg  AM_V='$(V)'
95892e95ad1Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95992e95ad1Smrgelse
96092e95ad1Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96192e95ad1Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
96211a95ff3Smrgfi
96392e95ad1SmrgAC_SUBST([AM_V])dnl
96492e95ad1SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96592e95ad1SmrgAC_SUBST([AM_DEFAULT_V])dnl
96692e95ad1SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96792e95ad1SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96892e95ad1SmrgAM_BACKSLASH='\'
96992e95ad1SmrgAC_SUBST([AM_BACKSLASH])dnl
97092e95ad1Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97192e95ad1Smrg])
972b91640d3Smrg
97392e95ad1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
97411a95ff3Smrg#
97592e95ad1Smrg# This file is free software; the Free Software Foundation
97692e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
97792e95ad1Smrg# with or without modifications, as long as this notice is preserved.
978b91640d3Smrg
97992e95ad1Smrg# AM_PROG_INSTALL_STRIP
98092e95ad1Smrg# ---------------------
98192e95ad1Smrg# One issue with vendor 'install' (even GNU) is that you can't
98292e95ad1Smrg# specify the program used to strip binaries.  This is especially
98392e95ad1Smrg# annoying in cross-compiling environments, where the build's strip
98492e95ad1Smrg# is unlikely to handle the host's binaries.
98592e95ad1Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98692e95ad1Smrg# always use install-sh in "make install-strip", and initialize
98792e95ad1Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
98892e95ad1SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98992e95ad1Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99092e95ad1Smrg# Installed binaries are usually stripped using 'strip' when the user
99192e95ad1Smrg# run "make install-strip".  However 'strip' might not be the right
99292e95ad1Smrg# tool to use in cross-compilation environments, therefore Automake
99392e95ad1Smrg# will honor the 'STRIP' environment variable to overrule this program.
99492e95ad1Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99592e95ad1Smrgif test "$cross_compiling" != no; then
99692e95ad1Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
997b91640d3Smrgfi
99892e95ad1SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99992e95ad1SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1000a6d9b409Smrg
100192e95ad1Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
100211a95ff3Smrg#
100392e95ad1Smrg# This file is free software; the Free Software Foundation
100492e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
100592e95ad1Smrg# with or without modifications, as long as this notice is preserved.
1006efda2da8Smrg
100792e95ad1Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
100892e95ad1Smrg# ---------------------------
100992e95ad1Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101092e95ad1Smrg# This macro is traced by Automake.
101192e95ad1SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101211a95ff3Smrg
101392e95ad1Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101492e95ad1Smrg# --------------------------
101592e95ad1Smrg# Public sister of _AM_SUBST_NOTMAKE.
101692e95ad1SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017efda2da8Smrg
101892e95ad1Smrg# Check how to create a tarball.                            -*- Autoconf -*-
101911a95ff3Smrg
102092e95ad1Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
102111a95ff3Smrg#
102292e95ad1Smrg# This file is free software; the Free Software Foundation
102392e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
102492e95ad1Smrg# with or without modifications, as long as this notice is preserved.
102592e95ad1Smrg
102692e95ad1Smrg# _AM_PROG_TAR(FORMAT)
102792e95ad1Smrg# --------------------
102892e95ad1Smrg# Check how to create a tarball in format FORMAT.
102992e95ad1Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
103011a95ff3Smrg#
103192e95ad1Smrg# Substitute a variable $(am__tar) that is a command
103292e95ad1Smrg# writing to stdout a FORMAT-tarball containing the directory
103392e95ad1Smrg# $tardir.
103492e95ad1Smrg#     tardir=directory && $(am__tar) > result.tar
103511a95ff3Smrg#
103692e95ad1Smrg# Substitute a variable $(am__untar) that extract such
103792e95ad1Smrg# a tarball read from stdin.
103892e95ad1Smrg#     $(am__untar) < result.tar
103911a95ff3Smrg#
104092e95ad1SmrgAC_DEFUN([_AM_PROG_TAR],
104192e95ad1Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104292e95ad1Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104392e95ad1SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044a6d9b409Smrg
104592e95ad1Smrg# We'll loop over all known methods to create a tar archive until one works.
104692e95ad1Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047a6d9b409Smrg
104892e95ad1Smrgm4_if([$1], [v7],
104992e95ad1Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050a6d9b409Smrg
105192e95ad1Smrg  [m4_case([$1],
105292e95ad1Smrg    [ustar],
105392e95ad1Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105492e95ad1Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105592e95ad1Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105692e95ad1Smrg      # and bug#13588).
105792e95ad1Smrg      am_max_uid=2097151 # 2^21 - 1
105892e95ad1Smrg      am_max_gid=$am_max_uid
105992e95ad1Smrg      # The $UID and $GID variables are not portable, so we need to resort
106092e95ad1Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106192e95ad1Smrg      # below are definitely unexpected, so allow the users to see them
106292e95ad1Smrg      # (that is, avoid stderr redirection).
106392e95ad1Smrg      am_uid=`id -u || echo unknown`
106492e95ad1Smrg      am_gid=`id -g || echo unknown`
106592e95ad1Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106692e95ad1Smrg      if test $am_uid -le $am_max_uid; then
106792e95ad1Smrg         AC_MSG_RESULT([yes])
106892e95ad1Smrg      else
106992e95ad1Smrg         AC_MSG_RESULT([no])
107092e95ad1Smrg         _am_tools=none
107192e95ad1Smrg      fi
107292e95ad1Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107392e95ad1Smrg      if test $am_gid -le $am_max_gid; then
107492e95ad1Smrg         AC_MSG_RESULT([yes])
107592e95ad1Smrg      else
107692e95ad1Smrg        AC_MSG_RESULT([no])
107792e95ad1Smrg        _am_tools=none
107892e95ad1Smrg      fi],
1079a097bd00Smrg
108092e95ad1Smrg  [pax],
108192e95ad1Smrg    [],
1082a097bd00Smrg
108392e95ad1Smrg  [m4_fatal([Unknown tar format])])
1084a6d9b409Smrg
108592e95ad1Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086a6d9b409Smrg
108792e95ad1Smrg  # Go ahead even if we have the value already cached.  We do so because we
108892e95ad1Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108992e95ad1Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090a6d9b409Smrg
109192e95ad1Smrg  for _am_tool in $_am_tools; do
109292e95ad1Smrg    case $_am_tool in
109392e95ad1Smrg    gnutar)
109492e95ad1Smrg      for _am_tar in tar gnutar gtar; do
109592e95ad1Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109692e95ad1Smrg      done
109792e95ad1Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109892e95ad1Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109992e95ad1Smrg      am__untar="$_am_tar -xf -"
110092e95ad1Smrg      ;;
110192e95ad1Smrg    plaintar)
110292e95ad1Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110392e95ad1Smrg      # ustar tarball either.
110492e95ad1Smrg      (tar --version) >/dev/null 2>&1 && continue
110592e95ad1Smrg      am__tar='tar chf - "$$tardir"'
110692e95ad1Smrg      am__tar_='tar chf - "$tardir"'
110792e95ad1Smrg      am__untar='tar xf -'
110892e95ad1Smrg      ;;
110992e95ad1Smrg    pax)
111092e95ad1Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111192e95ad1Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111292e95ad1Smrg      am__untar='pax -r'
111392e95ad1Smrg      ;;
111492e95ad1Smrg    cpio)
111592e95ad1Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111692e95ad1Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111792e95ad1Smrg      am__untar='cpio -i -H $1 -d'
111892e95ad1Smrg      ;;
111992e95ad1Smrg    none)
112092e95ad1Smrg      am__tar=false
112192e95ad1Smrg      am__tar_=false
112292e95ad1Smrg      am__untar=false
112392e95ad1Smrg      ;;
112492e95ad1Smrg    esac
1125a6d9b409Smrg
112692e95ad1Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112792e95ad1Smrg    # and am__untar set.
112892e95ad1Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129a6d9b409Smrg
113092e95ad1Smrg    # tar/untar a dummy directory, and stop if the command works.
113192e95ad1Smrg    rm -rf conftest.dir
113292e95ad1Smrg    mkdir conftest.dir
113392e95ad1Smrg    echo GrepMe > conftest.dir/file
113492e95ad1Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113592e95ad1Smrg    rm -rf conftest.dir
113692e95ad1Smrg    if test -s conftest.tar; then
113792e95ad1Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
113892e95ad1Smrg      AM_RUN_LOG([cat conftest.dir/file])
113992e95ad1Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114092e95ad1Smrg    fi
114192e95ad1Smrg  done
114292e95ad1Smrg  rm -rf conftest.dir
1143a6d9b409Smrg
114492e95ad1Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114592e95ad1Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146a6d9b409Smrg
114792e95ad1SmrgAC_SUBST([am__tar])
114892e95ad1SmrgAC_SUBST([am__untar])
114992e95ad1Smrg]) # _AM_PROG_TAR
1150a6d9b409Smrg
115192e95ad1Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
115292e95ad1Smrgdnl serial 11 (pkg-config-0.29)
115392e95ad1Smrgdnl
115492e95ad1Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115592e95ad1Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
115692e95ad1Smrgdnl
115792e95ad1Smrgdnl This program is free software; you can redistribute it and/or modify
115892e95ad1Smrgdnl it under the terms of the GNU General Public License as published by
115992e95ad1Smrgdnl the Free Software Foundation; either version 2 of the License, or
116092e95ad1Smrgdnl (at your option) any later version.
116192e95ad1Smrgdnl
116292e95ad1Smrgdnl This program is distributed in the hope that it will be useful, but
116392e95ad1Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
116492e95ad1Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
116592e95ad1Smrgdnl General Public License for more details.
116692e95ad1Smrgdnl
116792e95ad1Smrgdnl You should have received a copy of the GNU General Public License
116892e95ad1Smrgdnl along with this program; if not, write to the Free Software
116992e95ad1Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
117092e95ad1Smrgdnl 02111-1307, USA.
117192e95ad1Smrgdnl
117292e95ad1Smrgdnl As a special exception to the GNU General Public License, if you
117392e95ad1Smrgdnl distribute this file as part of a program that contains a
117492e95ad1Smrgdnl configuration script generated by Autoconf, you may include it under
117592e95ad1Smrgdnl the same distribution terms that you use for the rest of that
117692e95ad1Smrgdnl program.
1177a6d9b409Smrg
117892e95ad1Smrgdnl PKG_PREREQ(MIN-VERSION)
117992e95ad1Smrgdnl -----------------------
118092e95ad1Smrgdnl Since: 0.29
118192e95ad1Smrgdnl
118292e95ad1Smrgdnl Verify that the version of the pkg-config macros are at least
118392e95ad1Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
118492e95ad1Smrgdnl installed version of pkg-config, this checks the developer's version
118592e95ad1Smrgdnl of pkg.m4 when generating configure.
118692e95ad1Smrgdnl
118792e95ad1Smrgdnl To ensure that this macro is defined, also add:
118892e95ad1Smrgdnl m4_ifndef([PKG_PREREQ],
118992e95ad1Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
119092e95ad1Smrgdnl
119192e95ad1Smrgdnl See the "Since" comment for each macro you use to see what version
119292e95ad1Smrgdnl of the macros you require.
119392e95ad1Smrgm4_defun([PKG_PREREQ],
119492e95ad1Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
119592e95ad1Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
119692e95ad1Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
119792e95ad1Smrg])dnl PKG_PREREQ
1198a6d9b409Smrg
119992e95ad1Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
120092e95ad1Smrgdnl ----------------------------------
120192e95ad1Smrgdnl Since: 0.16
120292e95ad1Smrgdnl
120392e95ad1Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
120492e95ad1Smrgdnl first found in the path. Checks that the version of pkg-config found
120592e95ad1Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
120692e95ad1Smrgdnl used since that's the first version where most current features of
120792e95ad1Smrgdnl pkg-config existed.
120892e95ad1SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120992e95ad1Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
121092e95ad1Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
121192e95ad1Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
121292e95ad1SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
121392e95ad1SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
121492e95ad1SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215a6d9b409Smrg
121692e95ad1Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121792e95ad1Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218a6d9b409Smrgfi
121992e95ad1Smrgif test -n "$PKG_CONFIG"; then
122092e95ad1Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
122192e95ad1Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122292e95ad1Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122392e95ad1Smrg		AC_MSG_RESULT([yes])
122492e95ad1Smrg	else
122592e95ad1Smrg		AC_MSG_RESULT([no])
122692e95ad1Smrg		PKG_CONFIG=""
122792e95ad1Smrg	fi
122892e95ad1Smrgfi[]dnl
122992e95ad1Smrg])dnl PKG_PROG_PKG_CONFIG
12301e5fa1c5Smrg
123192e95ad1Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
123292e95ad1Smrgdnl -------------------------------------------------------------------
123392e95ad1Smrgdnl Since: 0.18
123492e95ad1Smrgdnl
123592e95ad1Smrgdnl Check to see whether a particular set of modules exists. Similar to
123692e95ad1Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
123792e95ad1Smrgdnl
123892e95ad1Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123992e95ad1Smrgdnl only at the first occurence in configure.ac, so if the first place
124092e95ad1Smrgdnl it's called might be skipped (such as if it is within an "if", you
124192e95ad1Smrgdnl have to call PKG_CHECK_EXISTS manually
124292e95ad1SmrgAC_DEFUN([PKG_CHECK_EXISTS],
124392e95ad1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124492e95ad1Smrgif test -n "$PKG_CONFIG" && \
124592e95ad1Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
124692e95ad1Smrg  m4_default([$2], [:])
124792e95ad1Smrgm4_ifvaln([$3], [else
124892e95ad1Smrg  $3])dnl
124992e95ad1Smrgfi])
125092e95ad1Smrg
125192e95ad1Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
125292e95ad1Smrgdnl ---------------------------------------------
125392e95ad1Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
125492e95ad1Smrgdnl pkg_failed based on the result.
125592e95ad1Smrgm4_define([_PKG_CONFIG],
125692e95ad1Smrg[if test -n "$$1"; then
125792e95ad1Smrg    pkg_cv_[]$1="$$1"
125892e95ad1Smrg elif test -n "$PKG_CONFIG"; then
125992e95ad1Smrg    PKG_CHECK_EXISTS([$3],
126092e95ad1Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
126192e95ad1Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
126292e95ad1Smrg		     [pkg_failed=yes])
126392e95ad1Smrg else
126492e95ad1Smrg    pkg_failed=untried
126592e95ad1Smrgfi[]dnl
126692e95ad1Smrg])dnl _PKG_CONFIG
126792e95ad1Smrg
126892e95ad1Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
126992e95ad1Smrgdnl ---------------------------
127092e95ad1Smrgdnl Internal check to see if pkg-config supports short errors.
127192e95ad1SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127292e95ad1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127392e95ad1Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127492e95ad1Smrg        _pkg_short_errors_supported=yes
12751e5fa1c5Smrgelse
127692e95ad1Smrg        _pkg_short_errors_supported=no
127792e95ad1Smrgfi[]dnl
127892e95ad1Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
12791e5fa1c5Smrg
1280a6d9b409Smrg
128192e95ad1Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
128292e95ad1Smrgdnl   [ACTION-IF-NOT-FOUND])
128392e95ad1Smrgdnl --------------------------------------------------------------
128492e95ad1Smrgdnl Since: 0.4.0
128592e95ad1Smrgdnl
128692e95ad1Smrgdnl Note that if there is a possibility the first call to
128792e95ad1Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
128892e95ad1Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128992e95ad1SmrgAC_DEFUN([PKG_CHECK_MODULES],
129092e95ad1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129192e95ad1SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129292e95ad1SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293a6d9b409Smrg
129492e95ad1Smrgpkg_failed=no
129592e95ad1SmrgAC_MSG_CHECKING([for $1])
1296a6d9b409Smrg
129792e95ad1Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129892e95ad1Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299a6d9b409Smrg
130092e95ad1Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130192e95ad1Smrgand $1[]_LIBS to avoid the need to call pkg-config.
130292e95ad1SmrgSee the pkg-config man page for more details.])
1303a6d9b409Smrg
130492e95ad1Smrgif test $pkg_failed = yes; then
130592e95ad1Smrg   	AC_MSG_RESULT([no])
130692e95ad1Smrg        _PKG_SHORT_ERRORS_SUPPORTED
130792e95ad1Smrg        if test $_pkg_short_errors_supported = yes; then
130892e95ad1Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130992e95ad1Smrg        else 
131092e95ad1Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131192e95ad1Smrg        fi
131292e95ad1Smrg	# Put the nasty error message in config.log where it belongs
131392e95ad1Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314a6d9b409Smrg
131592e95ad1Smrg	m4_default([$4], [AC_MSG_ERROR(
131692e95ad1Smrg[Package requirements ($2) were not met:
1317a6d9b409Smrg
131892e95ad1Smrg$$1_PKG_ERRORS
131992e95ad1Smrg
132092e95ad1SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132192e95ad1Smrginstalled software in a non-standard prefix.
132292e95ad1Smrg
132392e95ad1Smrg_PKG_TEXT])[]dnl
132492e95ad1Smrg        ])
132592e95ad1Smrgelif test $pkg_failed = untried; then
132692e95ad1Smrg     	AC_MSG_RESULT([no])
132792e95ad1Smrg	m4_default([$4], [AC_MSG_FAILURE(
132892e95ad1Smrg[The pkg-config script could not be found or is too old.  Make sure it
132992e95ad1Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
133092e95ad1Smrgpath to pkg-config.
133192e95ad1Smrg
133292e95ad1Smrg_PKG_TEXT
133392e95ad1Smrg
133492e95ad1SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
133592e95ad1Smrg        ])
1336a6d9b409Smrgelse
133792e95ad1Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133892e95ad1Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133992e95ad1Smrg        AC_MSG_RESULT([yes])
134092e95ad1Smrg	$3
134192e95ad1Smrgfi[]dnl
134292e95ad1Smrg])dnl PKG_CHECK_MODULES
1343a6d9b409Smrg
1344a6d9b409Smrg
134592e95ad1Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
134692e95ad1Smrgdnl   [ACTION-IF-NOT-FOUND])
134792e95ad1Smrgdnl ---------------------------------------------------------------------
134892e95ad1Smrgdnl Since: 0.29
134992e95ad1Smrgdnl
135092e95ad1Smrgdnl Checks for existence of MODULES and gathers its build flags with
135192e95ad1Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
135292e95ad1Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
135392e95ad1Smrgdnl
135492e95ad1Smrgdnl Note that if there is a possibility the first call to
135592e95ad1Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
135692e95ad1Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
135792e95ad1Smrgdnl configure.ac.
135892e95ad1SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
135992e95ad1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
136092e95ad1Smrg_save_PKG_CONFIG=$PKG_CONFIG
136192e95ad1SmrgPKG_CONFIG="$PKG_CONFIG --static"
136292e95ad1SmrgPKG_CHECK_MODULES($@)
136392e95ad1SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
136492e95ad1Smrg])dnl PKG_CHECK_MODULES_STATIC
13651e5fa1c5Smrg
1366a6d9b409Smrg
136792e95ad1Smrgdnl PKG_INSTALLDIR([DIRECTORY])
136892e95ad1Smrgdnl -------------------------
136992e95ad1Smrgdnl Since: 0.27
137092e95ad1Smrgdnl
137192e95ad1Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
137292e95ad1Smrgdnl should install pkg-config .pc files. By default the directory is
137392e95ad1Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
137492e95ad1Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
137592e95ad1Smrgdnl parameter.
137692e95ad1SmrgAC_DEFUN([PKG_INSTALLDIR],
137792e95ad1Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
137892e95ad1Smrgm4_pushdef([pkg_description],
137992e95ad1Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
138092e95ad1SmrgAC_ARG_WITH([pkgconfigdir],
138192e95ad1Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
138292e95ad1Smrg    [with_pkgconfigdir=]pkg_default)
138392e95ad1SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
138492e95ad1Smrgm4_popdef([pkg_default])
138592e95ad1Smrgm4_popdef([pkg_description])
138692e95ad1Smrg])dnl PKG_INSTALLDIR
138792e95ad1Smrg
138892e95ad1Smrg
138992e95ad1Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
139092e95ad1Smrgdnl --------------------------------
139192e95ad1Smrgdnl Since: 0.27
139292e95ad1Smrgdnl
139392e95ad1Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
139492e95ad1Smrgdnl module should install arch-independent pkg-config .pc files. By
139592e95ad1Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
139692e95ad1Smrgdnl changed by passing DIRECTORY. The user can override through the
139792e95ad1Smrgdnl --with-noarch-pkgconfigdir parameter.
139892e95ad1SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
139992e95ad1Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
140092e95ad1Smrgm4_pushdef([pkg_description],
140192e95ad1Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
140292e95ad1SmrgAC_ARG_WITH([noarch-pkgconfigdir],
140392e95ad1Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
140492e95ad1Smrg    [with_noarch_pkgconfigdir=]pkg_default)
140592e95ad1SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
140692e95ad1Smrgm4_popdef([pkg_default])
140792e95ad1Smrgm4_popdef([pkg_description])
140892e95ad1Smrg])dnl PKG_NOARCH_INSTALLDIR
140992e95ad1Smrg
1410a6d9b409Smrg
141192e95ad1Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
141292e95ad1Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
141392e95ad1Smrgdnl -------------------------------------------
141492e95ad1Smrgdnl Since: 0.28
141592e95ad1Smrgdnl
141692e95ad1Smrgdnl Retrieves the value of the pkg-config variable for the given module.
141792e95ad1SmrgAC_DEFUN([PKG_CHECK_VAR],
141892e95ad1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
141992e95ad1SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420a6d9b409Smrg
142192e95ad1Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
142292e95ad1SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423a6d9b409Smrg
142492e95ad1SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
142592e95ad1Smrg])dnl PKG_CHECK_VAR
1426a6d9b409Smrg
142792e95ad1Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142892e95ad1Smrgdnl
142992e95ad1Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
143092e95ad1Smrgdnl
143192e95ad1Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143292e95ad1Smrgdnl copy of this software and associated documentation files (the "Software"),
143392e95ad1Smrgdnl to deal in the Software without restriction, including without limitation
143492e95ad1Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143592e95ad1Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
143692e95ad1Smrgdnl Software is furnished to do so, subject to the following conditions:
143792e95ad1Smrgdnl
143892e95ad1Smrgdnl The above copyright notice and this permission notice (including the next
143992e95ad1Smrgdnl paragraph) shall be included in all copies or substantial portions of the
144092e95ad1Smrgdnl Software.
144192e95ad1Smrgdnl
144292e95ad1Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144392e95ad1Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144492e95ad1Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144592e95ad1Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144692e95ad1Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144792e95ad1Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144892e95ad1Smrgdnl DEALINGS IN THE SOFTWARE.
1449a6d9b409Smrg
145092e95ad1Smrg# XORG_MACROS_VERSION(required-version)
145192e95ad1Smrg# -------------------------------------
145211a95ff3Smrg# Minimum version: 1.1.0
14531e5fa1c5Smrg#
145492e95ad1Smrg# If you're using a macro added in Version 1.1 or newer, include this in
145592e95ad1Smrg# your configure.ac with the minimum required version, such as:
145692e95ad1Smrg# XORG_MACROS_VERSION(1.1)
14571e5fa1c5Smrg#
145892e95ad1Smrg# To ensure that this macro is defined, also add:
145992e95ad1Smrg# m4_ifndef([XORG_MACROS_VERSION],
146092e95ad1Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14611e5fa1c5Smrg#
146292e95ad1Smrg#
146392e95ad1Smrg# See the "minimum version" comment for each macro you use to see what
146492e95ad1Smrg# version you require.
146592e95ad1Smrgm4_defun([XORG_MACROS_VERSION],[
146692e95ad1Smrgm4_define([vers_have], [1.19.3])
146792e95ad1Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146892e95ad1Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
146992e95ad1Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147092e95ad1Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147192e95ad1Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147292e95ad1Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147392e95ad1Smrgm4_undefine([vers_have])
147492e95ad1Smrgm4_undefine([maj_have])
147592e95ad1Smrgm4_undefine([maj_needed])
147692e95ad1Smrg]) # XORG_MACROS_VERSION
14771e5fa1c5Smrg
147892e95ad1Smrg# XORG_PROG_RAWCPP()
147992e95ad1Smrg# ------------------
148092e95ad1Smrg# Minimum version: 1.0.0
148192e95ad1Smrg#
148292e95ad1Smrg# Find cpp program and necessary flags for use in pre-processing text files
148392e95ad1Smrg# such as man pages and config files
148492e95ad1SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148592e95ad1SmrgAC_REQUIRE([AC_PROG_CPP])
148692e95ad1SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148792e95ad1Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
148811a95ff3Smrg
148992e95ad1Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149092e95ad1Smrg# which is not the best choice for supporting other OS'es, but covers most
149192e95ad1Smrg# of the ones we need for now.
149292e95ad1SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149392e95ad1SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149492e95ad1Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149592e95ad1Smrg	AC_MSG_RESULT([no])
149692e95ad1Smrgelse
149792e95ad1Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149892e95ad1Smrg		RAWCPPFLAGS=-undef
149992e95ad1Smrg		AC_MSG_RESULT([yes])
150092e95ad1Smrg	# under Cygwin unix is still defined even with -undef
150192e95ad1Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150292e95ad1Smrg		RAWCPPFLAGS="-undef -ansi"
150392e95ad1Smrg		AC_MSG_RESULT([yes, with -ansi])
150492e95ad1Smrg	else
150592e95ad1Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150692e95ad1Smrg	fi
15071e5fa1c5Smrgfi
150892e95ad1Smrgrm -f conftest.$ac_ext
1509a097bd00Smrg
151092e95ad1SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151192e95ad1SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151292e95ad1Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151392e95ad1Smrg	AC_MSG_RESULT([no])
151492e95ad1Smrgelse
151592e95ad1Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151692e95ad1Smrg		TRADITIONALCPPFLAGS="-traditional"
151792e95ad1Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151892e95ad1Smrg		AC_MSG_RESULT([yes])
151992e95ad1Smrg	else
152092e95ad1Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152192e95ad1Smrg	fi
152292e95ad1Smrgfi
152392e95ad1Smrgrm -f conftest.$ac_ext
152492e95ad1SmrgAC_SUBST(RAWCPPFLAGS)
152592e95ad1SmrgAC_SUBST(TRADITIONALCPPFLAGS)
152692e95ad1Smrg]) # XORG_PROG_RAWCPP
15271e5fa1c5Smrg
152892e95ad1Smrg# XORG_MANPAGE_SECTIONS()
152992e95ad1Smrg# -----------------------
153092e95ad1Smrg# Minimum version: 1.0.0
1531a097bd00Smrg#
153292e95ad1Smrg# Determine which sections man pages go in for the different man page types
153392e95ad1Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153492e95ad1Smrg# Not sure if there's any better way than just hardcoding by OS name.
153592e95ad1Smrg# Override default settings by setting environment variables
153692e95ad1Smrg# Added MAN_SUBSTS in version 1.8
153792e95ad1Smrg# Added AC_PROG_SED in version 1.8
153811a95ff3Smrg
153992e95ad1SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154092e95ad1SmrgAC_REQUIRE([AC_CANONICAL_HOST])
154192e95ad1SmrgAC_REQUIRE([AC_PROG_SED])
1542a097bd00Smrg
154392e95ad1Smrgcase $host_os in
154492e95ad1Smrg    solaris*)
154592e95ad1Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
154692e95ad1Smrg        # check for a man page file found in later versions that use
154792e95ad1Smrg        # traditional section numbers instead
154892e95ad1Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
154992e95ad1Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
155092e95ad1Smrg        ;;
155192e95ad1Smrg    *) SYSV_MAN_SECTIONS=false ;;
155292e95ad1Smrgesac
1553a097bd00Smrg
155492e95ad1Smrgif test x$APP_MAN_SUFFIX = x    ; then
155592e95ad1Smrg    APP_MAN_SUFFIX=1
155692e95ad1Smrgfi
155792e95ad1Smrgif test x$APP_MAN_DIR = x    ; then
155892e95ad1Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
155992e95ad1Smrgfi
1560a097bd00Smrg
156192e95ad1Smrgif test x$LIB_MAN_SUFFIX = x    ; then
156292e95ad1Smrg    LIB_MAN_SUFFIX=3
156392e95ad1Smrgfi
156492e95ad1Smrgif test x$LIB_MAN_DIR = x    ; then
156592e95ad1Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
156692e95ad1Smrgfi
1567a097bd00Smrg
156892e95ad1Smrgif test x$FILE_MAN_SUFFIX = x    ; then
156992e95ad1Smrg    case $SYSV_MAN_SECTIONS in
157092e95ad1Smrg	true)				FILE_MAN_SUFFIX=4  ;;
157192e95ad1Smrg	*)				FILE_MAN_SUFFIX=5  ;;
157292e95ad1Smrg    esac
157392e95ad1Smrgfi
157492e95ad1Smrgif test x$FILE_MAN_DIR = x    ; then
157592e95ad1Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576a097bd00Smrgfi
1577a097bd00Smrg
157892e95ad1Smrgif test x$MISC_MAN_SUFFIX = x    ; then
157992e95ad1Smrg    case $SYSV_MAN_SECTIONS in
158092e95ad1Smrg	true)				MISC_MAN_SUFFIX=5  ;;
158192e95ad1Smrg	*)				MISC_MAN_SUFFIX=7  ;;
158292e95ad1Smrg    esac
158392e95ad1Smrgfi
158492e95ad1Smrgif test x$MISC_MAN_DIR = x    ; then
158592e95ad1Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
158611a95ff3Smrgfi
1587a097bd00Smrg
158892e95ad1Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
158992e95ad1Smrg    case $SYSV_MAN_SECTIONS in
159092e95ad1Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
159192e95ad1Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159292e95ad1Smrg    esac
159392e95ad1Smrgfi
159492e95ad1Smrgif test x$DRIVER_MAN_DIR = x    ; then
159592e95ad1Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159692e95ad1Smrgfi
159711a95ff3Smrg
159892e95ad1Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
159992e95ad1Smrg    case $SYSV_MAN_SECTIONS in
160092e95ad1Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
160192e95ad1Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160292e95ad1Smrg    esac
160392e95ad1Smrgfi
160492e95ad1Smrgif test x$ADMIN_MAN_DIR = x    ; then
160592e95ad1Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160692e95ad1Smrgfi
160711a95ff3Smrg
160811a95ff3Smrg
160992e95ad1SmrgAC_SUBST([APP_MAN_SUFFIX])
161092e95ad1SmrgAC_SUBST([LIB_MAN_SUFFIX])
161192e95ad1SmrgAC_SUBST([FILE_MAN_SUFFIX])
161292e95ad1SmrgAC_SUBST([MISC_MAN_SUFFIX])
161392e95ad1SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161492e95ad1SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161592e95ad1SmrgAC_SUBST([APP_MAN_DIR])
161692e95ad1SmrgAC_SUBST([LIB_MAN_DIR])
161792e95ad1SmrgAC_SUBST([FILE_MAN_DIR])
161892e95ad1SmrgAC_SUBST([MISC_MAN_DIR])
161992e95ad1SmrgAC_SUBST([DRIVER_MAN_DIR])
162092e95ad1SmrgAC_SUBST([ADMIN_MAN_DIR])
162111a95ff3Smrg
162292e95ad1SmrgXORG_MAN_PAGE="X Version 11"
162392e95ad1SmrgAC_SUBST([XORG_MAN_PAGE])
162492e95ad1SmrgMAN_SUBSTS="\
162592e95ad1Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162692e95ad1Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162792e95ad1Smrg	-e 's|__xservername__|Xorg|g' \
162892e95ad1Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
162992e95ad1Smrg	-e 's|__projectroot__|\$(prefix)|g' \
163092e95ad1Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163192e95ad1Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163292e95ad1Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163392e95ad1Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163492e95ad1Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163592e95ad1Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163692e95ad1Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163792e95ad1SmrgAC_SUBST([MAN_SUBSTS])
163811a95ff3Smrg
163992e95ad1Smrg]) # XORG_MANPAGE_SECTIONS
164011a95ff3Smrg
164192e95ad1Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164292e95ad1Smrg# ------------------------
164392e95ad1Smrg# Minimum version: 1.7.0
16441e5fa1c5Smrg#
164592e95ad1Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164692e95ad1Smrg# provided by xorg-sgml-doctools, if installed.
164792e95ad1SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164892e95ad1SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164992e95ad1SmrgXORG_SGML_PATH=
165092e95ad1SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165192e95ad1Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165292e95ad1Smrg    [m4_ifval([$1],[:],
165392e95ad1Smrg        [if test x"$cross_compiling" != x"yes" ; then
165492e95ad1Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165592e95ad1Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165692e95ad1Smrg         fi])
165792e95ad1Smrg    ])
165892e95ad1Smrg
165992e95ad1Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166092e95ad1Smrg# the path and the name of the doc stylesheet
166192e95ad1Smrgif test "x$XORG_SGML_PATH" != "x" ; then
166292e95ad1Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166392e95ad1Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166492e95ad1Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166592e95ad1Smrgelse
166692e95ad1Smrg   AC_MSG_RESULT([no])
166792e95ad1Smrgfi
166892e95ad1Smrg
166992e95ad1SmrgAC_SUBST(XORG_SGML_PATH)
167092e95ad1SmrgAC_SUBST(STYLESHEET_SRCDIR)
167192e95ad1SmrgAC_SUBST(XSL_STYLESHEET)
167292e95ad1SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167392e95ad1Smrg]) # XORG_CHECK_SGML_DOCTOOLS
167492e95ad1Smrg
167592e95ad1Smrg# XORG_CHECK_LINUXDOC
167692e95ad1Smrg# -------------------
167792e95ad1Smrg# Minimum version: 1.0.0
16781e5fa1c5Smrg#
167992e95ad1Smrg# Defines the variable MAKE_TEXT if the necessary tools and
168092e95ad1Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168192e95ad1Smrg# Whether or not the necessary tools and files are found can be checked
168292e95ad1Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168392e95ad1SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168492e95ad1SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168592e95ad1SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16861e5fa1c5Smrg
168792e95ad1SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
168811a95ff3Smrg
168992e95ad1SmrgAC_MSG_CHECKING([whether to build documentation])
169092e95ad1Smrg
169192e95ad1Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169292e95ad1Smrg   BUILDDOC=yes
16931e5fa1c5Smrgelse
169492e95ad1Smrg   BUILDDOC=no
16951e5fa1c5Smrgfi
16961e5fa1c5Smrg
169792e95ad1SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16981e5fa1c5Smrg
169992e95ad1SmrgAC_MSG_RESULT([$BUILDDOC])
1700b91640d3Smrg
170192e95ad1SmrgAC_MSG_CHECKING([whether to build pdf documentation])
170292e95ad1Smrg
170392e95ad1Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170492e95ad1Smrg   BUILDPDFDOC=yes
170592e95ad1Smrgelse
170692e95ad1Smrg   BUILDPDFDOC=no
170792e95ad1Smrgfi
170892e95ad1Smrg
170992e95ad1SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171092e95ad1Smrg
171192e95ad1SmrgAC_MSG_RESULT([$BUILDPDFDOC])
171292e95ad1Smrg
171392e95ad1SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171492e95ad1SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171592e95ad1SmrgMAKE_PDF="$PS2PDF"
171692e95ad1SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171792e95ad1Smrg
171892e95ad1SmrgAC_SUBST(MAKE_TEXT)
171992e95ad1SmrgAC_SUBST(MAKE_PS)
172092e95ad1SmrgAC_SUBST(MAKE_PDF)
172192e95ad1SmrgAC_SUBST(MAKE_HTML)
172292e95ad1Smrg]) # XORG_CHECK_LINUXDOC
172392e95ad1Smrg
172492e95ad1Smrg# XORG_CHECK_DOCBOOK
172592e95ad1Smrg# -------------------
172692e95ad1Smrg# Minimum version: 1.0.0
172792e95ad1Smrg#
172892e95ad1Smrg# Checks for the ability to build output formats from SGML DocBook source.
172992e95ad1Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173092e95ad1Smrg# indicates whether the necessary tools and files are found and, if set,
173192e95ad1Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173292e95ad1SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173392e95ad1SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
173492e95ad1Smrg
173592e95ad1SmrgBUILDTXTDOC=no
173692e95ad1SmrgBUILDPDFDOC=no
173792e95ad1SmrgBUILDPSDOC=no
173892e95ad1SmrgBUILDHTMLDOC=no
173992e95ad1Smrg
174092e95ad1SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174192e95ad1SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174292e95ad1SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174392e95ad1SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
174411a95ff3Smrg
174592e95ad1SmrgAC_MSG_CHECKING([whether to build text documentation])
174692e95ad1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174792e95ad1Smrg   test x$BUILD_TXTDOC != xno; then
174892e95ad1Smrg	BUILDTXTDOC=yes
174992e95ad1Smrgfi
175092e95ad1SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175192e95ad1SmrgAC_MSG_RESULT([$BUILDTXTDOC])
175211a95ff3Smrg
175392e95ad1SmrgAC_MSG_CHECKING([whether to build PDF documentation])
175492e95ad1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175592e95ad1Smrg   test x$BUILD_PDFDOC != xno; then
175692e95ad1Smrg	BUILDPDFDOC=yes
175792e95ad1Smrgfi
175892e95ad1SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175992e95ad1SmrgAC_MSG_RESULT([$BUILDPDFDOC])
176011a95ff3Smrg
176192e95ad1SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176292e95ad1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176392e95ad1Smrg   test x$BUILD_PSDOC != xno; then
176492e95ad1Smrg	BUILDPSDOC=yes
1765b91640d3Smrgfi
176692e95ad1SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176792e95ad1SmrgAC_MSG_RESULT([$BUILDPSDOC])
1768b91640d3Smrg
176992e95ad1SmrgAC_MSG_CHECKING([whether to build HTML documentation])
177092e95ad1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177192e95ad1Smrg   test x$BUILD_HTMLDOC != xno; then
177292e95ad1Smrg	BUILDHTMLDOC=yes
177392e95ad1Smrgfi
177492e95ad1SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177592e95ad1SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17761e5fa1c5Smrg
177792e95ad1SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177892e95ad1SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177992e95ad1SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178092e95ad1SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178192e95ad1Smrg
178292e95ad1SmrgAC_SUBST(MAKE_TEXT)
178392e95ad1SmrgAC_SUBST(MAKE_PS)
178492e95ad1SmrgAC_SUBST(MAKE_PDF)
178592e95ad1SmrgAC_SUBST(MAKE_HTML)
178692e95ad1Smrg]) # XORG_CHECK_DOCBOOK
178792e95ad1Smrg
178892e95ad1Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178992e95ad1Smrg# ----------------
179092e95ad1Smrg# Minimum version: 1.5.0
179192e95ad1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17921e5fa1c5Smrg#
179392e95ad1Smrg# Documentation tools are not always available on all platforms and sometimes
179492e95ad1Smrg# not at the appropriate level. This macro enables a module to test for the
179592e95ad1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
179692e95ad1Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
179792e95ad1Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179892e95ad1Smrg# --with-xmlto assumes 'auto'.
1799a097bd00Smrg#
180092e95ad1Smrg# Interface to module:
180192e95ad1Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180292e95ad1Smrg# XMLTO:	returns the path of the xmlto program found
180392e95ad1Smrg#		returns the path set by the user in the environment
180492e95ad1Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180592e95ad1Smrg#		'no' user instructs the module not to use xmlto
18061e5fa1c5Smrg#
180792e95ad1Smrg# Added in version 1.10.0
180892e95ad1Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180992e95ad1Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
18101e5fa1c5Smrg#
181192e95ad1Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
18121e5fa1c5Smrg#
181392e95ad1SmrgAC_DEFUN([XORG_WITH_XMLTO],[
181492e95ad1SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181592e95ad1Smrgm4_define([_defopt], m4_default([$2], [auto]))
181692e95ad1SmrgAC_ARG_WITH(xmlto,
181792e95ad1Smrg	AS_HELP_STRING([--with-xmlto],
181892e95ad1Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181992e95ad1Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182092e95ad1Smrgm4_undefine([_defopt])
18211e5fa1c5Smrg
182292e95ad1Smrgif test "x$use_xmlto" = x"auto"; then
182392e95ad1Smrg   AC_PATH_PROG([XMLTO], [xmlto])
182492e95ad1Smrg   if test "x$XMLTO" = "x"; then
182592e95ad1Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182692e95ad1Smrg	have_xmlto=no
182792e95ad1Smrg   else
182892e95ad1Smrg        have_xmlto=yes
182992e95ad1Smrg   fi
183092e95ad1Smrgelif test "x$use_xmlto" = x"yes" ; then
183192e95ad1Smrg   AC_PATH_PROG([XMLTO], [xmlto])
183292e95ad1Smrg   if test "x$XMLTO" = "x"; then
183392e95ad1Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183492e95ad1Smrg   fi
183592e95ad1Smrg   have_xmlto=yes
183692e95ad1Smrgelif test "x$use_xmlto" = x"no" ; then
183792e95ad1Smrg   if test "x$XMLTO" != "x"; then
183892e95ad1Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183992e95ad1Smrg   fi
184092e95ad1Smrg   have_xmlto=no
184192e95ad1Smrgelse
184292e95ad1Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184392e95ad1Smrgfi
1844a097bd00Smrg
184592e95ad1Smrg# Test for a minimum version of xmlto, if provided.
184692e95ad1Smrgm4_ifval([$1],
184792e95ad1Smrg[if test "$have_xmlto" = yes; then
184892e95ad1Smrg    # scrape the xmlto version
184992e95ad1Smrg    AC_MSG_CHECKING([the xmlto version])
185092e95ad1Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185192e95ad1Smrg    AC_MSG_RESULT([$xmlto_version])
185292e95ad1Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185392e95ad1Smrg        [if test "x$use_xmlto" = xauto; then
185492e95ad1Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185592e95ad1Smrg            have_xmlto=no
185692e95ad1Smrg        else
185792e95ad1Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185892e95ad1Smrg        fi])
185992e95ad1Smrgfi])
1860a097bd00Smrg
186192e95ad1Smrg# Test for the ability of xmlto to generate a text target
186292e95ad1Smrg#
186392e95ad1Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
186492e95ad1Smrg# following test for empty XML docbook files.
186592e95ad1Smrg# For compatibility reasons use the following empty XML docbook file and if
186692e95ad1Smrg# it fails try it again with a non-empty XML file.
186792e95ad1Smrghave_xmlto_text=no
186892e95ad1Smrgcat > conftest.xml << "EOF"
186992e95ad1SmrgEOF
187092e95ad1SmrgAS_IF([test "$have_xmlto" = yes],
187192e95ad1Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187292e95ad1Smrg             [have_xmlto_text=yes],
187392e95ad1Smrg             [# Try it again with a non-empty XML file.
187492e95ad1Smrg              cat > conftest.xml << "EOF"
187592e95ad1Smrg<x></x>
187692e95ad1SmrgEOF
187792e95ad1Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187892e95ad1Smrg                    [have_xmlto_text=yes],
187992e95ad1Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188092e95ad1Smrgrm -f conftest.xml
188192e95ad1SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188292e95ad1SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188392e95ad1Smrg]) # XORG_WITH_XMLTO
1884a097bd00Smrg
188592e95ad1Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188692e95ad1Smrg# --------------------------------------------
188792e95ad1Smrg# Minimum version: 1.12.0
188892e95ad1Smrg# Minimum version for optional DEFAULT argument: 1.12.0
188992e95ad1Smrg#
189092e95ad1Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189192e95ad1Smrg# XML-based language used for the transformation of XML documents.
189292e95ad1Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189392e95ad1Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189492e95ad1Smrg# The XSLT processor is often used as a standalone tool for transformations.
189592e95ad1Smrg# It should not be assumed that this tool is used only to work with documnetation.
189692e95ad1Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189792e95ad1Smrg#
189892e95ad1Smrg# Interface to module:
189992e95ad1Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190092e95ad1Smrg# XSLTPROC:	 returns the path of the xsltproc program found
190192e95ad1Smrg#		 returns the path set by the user in the environment
190292e95ad1Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190392e95ad1Smrg#		  'no' user instructs the module not to use xsltproc
190492e95ad1Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190592e95ad1Smrg#
190692e95ad1Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190792e95ad1Smrg#
190892e95ad1SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190992e95ad1SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191092e95ad1Smrg# Preserves the interface, should it be implemented later
191192e95ad1Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191292e95ad1Smrgm4_define([_defopt], m4_default([$2], [auto]))
191392e95ad1SmrgAC_ARG_WITH(xsltproc,
191492e95ad1Smrg	AS_HELP_STRING([--with-xsltproc],
191592e95ad1Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191692e95ad1Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191792e95ad1Smrgm4_undefine([_defopt])
19181e5fa1c5Smrg
191992e95ad1Smrgif test "x$use_xsltproc" = x"auto"; then
192092e95ad1Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192192e95ad1Smrg   if test "x$XSLTPROC" = "x"; then
192292e95ad1Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192392e95ad1Smrg	have_xsltproc=no
192492e95ad1Smrg   else
192592e95ad1Smrg        have_xsltproc=yes
192692e95ad1Smrg   fi
192792e95ad1Smrgelif test "x$use_xsltproc" = x"yes" ; then
192892e95ad1Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192992e95ad1Smrg   if test "x$XSLTPROC" = "x"; then
193092e95ad1Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193192e95ad1Smrg   fi
193292e95ad1Smrg   have_xsltproc=yes
193392e95ad1Smrgelif test "x$use_xsltproc" = x"no" ; then
193492e95ad1Smrg   if test "x$XSLTPROC" != "x"; then
193592e95ad1Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193692e95ad1Smrg   fi
193792e95ad1Smrg   have_xsltproc=no
193892e95ad1Smrgelse
193992e95ad1Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
194011a95ff3Smrgfi
194111a95ff3Smrg
194292e95ad1SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194392e95ad1Smrg]) # XORG_WITH_XSLTPROC
194492e95ad1Smrg
194592e95ad1Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194692e95ad1Smrg# ----------------------------------------
194792e95ad1Smrg# Minimum version: 1.15.0
19481e5fa1c5Smrg#
194992e95ad1Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
195092e95ad1Smrg# scanning arbitrary text files, extracting information from those text files,
195192e95ad1Smrg# and printing reports based on that information.
19521e5fa1c5Smrg#
195392e95ad1Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
19541e5fa1c5Smrg#
195592e95ad1Smrg# Interface to module:
195692e95ad1Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
195792e95ad1Smrg# PERL:	     returns the path of the perl program found
195892e95ad1Smrg#	     returns the path set by the user in the environment
195992e95ad1Smrg# --with-perl: 'yes' user instructs the module to use perl
196092e95ad1Smrg#	       'no' user instructs the module not to use perl
196192e95ad1Smrg# have_perl: returns yes if perl found in PATH or no
19621e5fa1c5Smrg#
196392e95ad1Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196492e95ad1Smrg#
196592e95ad1SmrgAC_DEFUN([XORG_WITH_PERL],[
196692e95ad1SmrgAC_ARG_VAR([PERL], [Path to perl command])
196792e95ad1Smrg# Preserves the interface, should it be implemented later
196892e95ad1Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196992e95ad1Smrgm4_define([_defopt], m4_default([$2], [auto]))
197092e95ad1SmrgAC_ARG_WITH(perl,
197192e95ad1Smrg	AS_HELP_STRING([--with-perl],
197292e95ad1Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197392e95ad1Smrg	   [use_perl=$withval], [use_perl=]_defopt)
197492e95ad1Smrgm4_undefine([_defopt])
19751e5fa1c5Smrg
197692e95ad1Smrgif test "x$use_perl" = x"auto"; then
197792e95ad1Smrg   AC_PATH_PROG([PERL], [perl])
197892e95ad1Smrg   if test "x$PERL" = "x"; then
197992e95ad1Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198092e95ad1Smrg	have_perl=no
198192e95ad1Smrg   else
198292e95ad1Smrg        have_perl=yes
198392e95ad1Smrg   fi
198492e95ad1Smrgelif test "x$use_perl" = x"yes" ; then
198592e95ad1Smrg   AC_PATH_PROG([PERL], [perl])
198692e95ad1Smrg   if test "x$PERL" = "x"; then
198792e95ad1Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198892e95ad1Smrg   fi
198992e95ad1Smrg   have_perl=yes
199092e95ad1Smrgelif test "x$use_perl" = x"no" ; then
199192e95ad1Smrg   if test "x$PERL" != "x"; then
199292e95ad1Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199392e95ad1Smrg   fi
199492e95ad1Smrg   have_perl=no
199592e95ad1Smrgelse
199692e95ad1Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199792e95ad1Smrgfi
1998a097bd00Smrg
199992e95ad1SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200092e95ad1Smrg]) # XORG_WITH_PERL
20011e5fa1c5Smrg
200292e95ad1Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
200311a95ff3Smrg# ----------------
200492e95ad1Smrg# Minimum version: 1.5.0
200592e95ad1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2006b91640d3Smrg#
200792e95ad1Smrg# Documentation tools are not always available on all platforms and sometimes
200892e95ad1Smrg# not at the appropriate level. This macro enables a module to test for the
200992e95ad1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
201092e95ad1Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
201192e95ad1Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201292e95ad1Smrg# --with-asciidoc assumes 'auto'.
2013b91640d3Smrg#
201492e95ad1Smrg# Interface to module:
201592e95ad1Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201692e95ad1Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
201792e95ad1Smrg#		 returns the path set by the user in the environment
201892e95ad1Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201992e95ad1Smrg#		  'no' user instructs the module not to use asciidoc
2020b91640d3Smrg#
202192e95ad1Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20221e5fa1c5Smrg#
202392e95ad1SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202492e95ad1SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202592e95ad1Smrgm4_define([_defopt], m4_default([$2], [auto]))
202692e95ad1SmrgAC_ARG_WITH(asciidoc,
202792e95ad1Smrg	AS_HELP_STRING([--with-asciidoc],
202892e95ad1Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202992e95ad1Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203092e95ad1Smrgm4_undefine([_defopt])
203111a95ff3Smrg
203292e95ad1Smrgif test "x$use_asciidoc" = x"auto"; then
203392e95ad1Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203492e95ad1Smrg   if test "x$ASCIIDOC" = "x"; then
203592e95ad1Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203692e95ad1Smrg	have_asciidoc=no
203792e95ad1Smrg   else
203892e95ad1Smrg        have_asciidoc=yes
203992e95ad1Smrg   fi
204092e95ad1Smrgelif test "x$use_asciidoc" = x"yes" ; then
204192e95ad1Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204292e95ad1Smrg   if test "x$ASCIIDOC" = "x"; then
204392e95ad1Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204492e95ad1Smrg   fi
204592e95ad1Smrg   have_asciidoc=yes
204692e95ad1Smrgelif test "x$use_asciidoc" = x"no" ; then
204792e95ad1Smrg   if test "x$ASCIIDOC" != "x"; then
204892e95ad1Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204992e95ad1Smrg   fi
205092e95ad1Smrg   have_asciidoc=no
205192e95ad1Smrgelse
205292e95ad1Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205392e95ad1Smrgfi
205492e95ad1Smrgm4_ifval([$1],
205592e95ad1Smrg[if test "$have_asciidoc" = yes; then
205692e95ad1Smrg    # scrape the asciidoc version
205792e95ad1Smrg    AC_MSG_CHECKING([the asciidoc version])
205892e95ad1Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205992e95ad1Smrg    AC_MSG_RESULT([$asciidoc_version])
206092e95ad1Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206192e95ad1Smrg        [if test "x$use_asciidoc" = xauto; then
206292e95ad1Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206392e95ad1Smrg            have_asciidoc=no
206492e95ad1Smrg        else
206592e95ad1Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206692e95ad1Smrg        fi])
206792e95ad1Smrgfi])
206892e95ad1SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206992e95ad1Smrg]) # XORG_WITH_ASCIIDOC
207011a95ff3Smrg
207192e95ad1Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207292e95ad1Smrg# -------------------------------------------
207392e95ad1Smrg# Minimum version: 1.5.0
207492e95ad1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
207592e95ad1Smrg# Minimum version for optional DOT checking: 1.18.0
20761e5fa1c5Smrg#
207792e95ad1Smrg# Documentation tools are not always available on all platforms and sometimes
207892e95ad1Smrg# not at the appropriate level. This macro enables a module to test for the
207992e95ad1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
208092e95ad1Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
208192e95ad1Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208292e95ad1Smrg# --with-doxygen assumes 'auto'.
20831e5fa1c5Smrg#
208492e95ad1Smrg# Interface to module:
208592e95ad1Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208692e95ad1Smrg# DOXYGEN:	 returns the path of the doxygen program found
208792e95ad1Smrg#		 returns the path set by the user in the environment
208892e95ad1Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208992e95ad1Smrg#		  'no' user instructs the module not to use doxygen
20901e5fa1c5Smrg#
209192e95ad1Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20921e5fa1c5Smrg#
209392e95ad1SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209492e95ad1SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209592e95ad1SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209692e95ad1Smrgm4_define([_defopt], m4_default([$2], [auto]))
209792e95ad1SmrgAC_ARG_WITH(doxygen,
209892e95ad1Smrg	AS_HELP_STRING([--with-doxygen],
209992e95ad1Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210092e95ad1Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210192e95ad1Smrgm4_undefine([_defopt])
210211a95ff3Smrg
210392e95ad1Smrgif test "x$use_doxygen" = x"auto"; then
210492e95ad1Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210592e95ad1Smrg   if test "x$DOXYGEN" = "x"; then
210692e95ad1Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210792e95ad1Smrg	have_doxygen=no
210892e95ad1Smrg   else
210992e95ad1Smrg        have_doxygen=yes
211092e95ad1Smrg   fi
211192e95ad1Smrgelif test "x$use_doxygen" = x"yes" ; then
211292e95ad1Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211392e95ad1Smrg   if test "x$DOXYGEN" = "x"; then
211492e95ad1Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211592e95ad1Smrg   fi
211692e95ad1Smrg   have_doxygen=yes
211792e95ad1Smrgelif test "x$use_doxygen" = x"no" ; then
211892e95ad1Smrg   if test "x$DOXYGEN" != "x"; then
211992e95ad1Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212092e95ad1Smrg   fi
212192e95ad1Smrg   have_doxygen=no
212211a95ff3Smrgelse
212392e95ad1Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
212411a95ff3Smrgfi
212592e95ad1Smrgm4_ifval([$1],
212692e95ad1Smrg[if test "$have_doxygen" = yes; then
212792e95ad1Smrg    # scrape the doxygen version
212892e95ad1Smrg    AC_MSG_CHECKING([the doxygen version])
212992e95ad1Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213092e95ad1Smrg    AC_MSG_RESULT([$doxygen_version])
213192e95ad1Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213292e95ad1Smrg        [if test "x$use_doxygen" = xauto; then
213392e95ad1Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213492e95ad1Smrg            have_doxygen=no
213592e95ad1Smrg        else
213692e95ad1Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213792e95ad1Smrg        fi])
213892e95ad1Smrgfi])
213911a95ff3Smrg
214092e95ad1Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214192e95ad1Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214292e95ad1Smrgdnl 	HAVE_DOT = @HAVE_DOT@
214392e95ad1SmrgHAVE_DOT=no
214492e95ad1Smrgif test "x$have_doxygen" = "xyes"; then
214592e95ad1Smrg  AC_PATH_PROG([DOT], [dot])
214692e95ad1Smrg    if test "x$DOT" != "x"; then
214792e95ad1Smrg      HAVE_DOT=yes
214892e95ad1Smrg    fi
214992e95ad1Smrgfi
215011a95ff3Smrg
215192e95ad1SmrgAC_SUBST([HAVE_DOT])
215292e95ad1SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215392e95ad1SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215492e95ad1Smrg]) # XORG_WITH_DOXYGEN
215511a95ff3Smrg
215692e95ad1Smrg# XORG_WITH_GROFF([DEFAULT])
215792e95ad1Smrg# ----------------
215892e95ad1Smrg# Minimum version: 1.6.0
215992e95ad1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21601e5fa1c5Smrg#
216192e95ad1Smrg# Documentation tools are not always available on all platforms and sometimes
216292e95ad1Smrg# not at the appropriate level. This macro enables a module to test for the
216392e95ad1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
216492e95ad1Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
216592e95ad1Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
216692e95ad1Smrg# --with-groff assumes 'auto'.
216792e95ad1Smrg#
216892e95ad1Smrg# Interface to module:
216992e95ad1Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217092e95ad1Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217192e95ad1Smrg# HAVE_GROFF_MS: the -ms macros package
217292e95ad1Smrg# GROFF:	 returns the path of the groff program found
217392e95ad1Smrg#		 returns the path set by the user in the environment
217492e95ad1Smrg# --with-groff:	 'yes' user instructs the module to use groff
217592e95ad1Smrg#		 'no' user instructs the module not to use groff
217692e95ad1Smrg#
217792e95ad1Smrg# Added in version 1.9.0:
217892e95ad1Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217992e95ad1Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218092e95ad1Smrg#		   psselect from the psutils package.
218192e95ad1Smrg#		   the ghostcript package. Refer to the grohtml man pages
218292e95ad1Smrg#
218392e95ad1Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218492e95ad1Smrg#
218592e95ad1Smrg# OS and distros often splits groff in a basic and full package, the former
218692e95ad1Smrg# having the groff program and the later having devices, fonts and macros
218792e95ad1Smrg# Checking for the groff executable is not enough.
218892e95ad1Smrg#
218992e95ad1Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
219092e95ad1Smrg# unset HAVE_GROFF or GROFF env variables.
219192e95ad1Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219292e95ad1Smrg#
219392e95ad1SmrgAC_DEFUN([XORG_WITH_GROFF],[
219492e95ad1SmrgAC_ARG_VAR([GROFF], [Path to groff command])
219592e95ad1Smrgm4_define([_defopt], m4_default([$1], [auto]))
219692e95ad1SmrgAC_ARG_WITH(groff,
219792e95ad1Smrg	AS_HELP_STRING([--with-groff],
219892e95ad1Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219992e95ad1Smrg	   [use_groff=$withval], [use_groff=]_defopt)
220092e95ad1Smrgm4_undefine([_defopt])
220111a95ff3Smrg
220292e95ad1Smrgif test "x$use_groff" = x"auto"; then
220392e95ad1Smrg   AC_PATH_PROG([GROFF], [groff])
220492e95ad1Smrg   if test "x$GROFF" = "x"; then
220592e95ad1Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220692e95ad1Smrg	have_groff=no
220792e95ad1Smrg   else
220892e95ad1Smrg        have_groff=yes
220992e95ad1Smrg   fi
221092e95ad1Smrgelif test "x$use_groff" = x"yes" ; then
221192e95ad1Smrg   AC_PATH_PROG([GROFF], [groff])
221292e95ad1Smrg   if test "x$GROFF" = "x"; then
221392e95ad1Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221492e95ad1Smrg   fi
221592e95ad1Smrg   have_groff=yes
221692e95ad1Smrgelif test "x$use_groff" = x"no" ; then
221792e95ad1Smrg   if test "x$GROFF" != "x"; then
221892e95ad1Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221992e95ad1Smrg   fi
222092e95ad1Smrg   have_groff=no
222192e95ad1Smrgelse
222292e95ad1Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222392e95ad1Smrgfi
222411a95ff3Smrg
222592e95ad1Smrg# We have groff, test for the presence of the macro packages
222692e95ad1Smrgif test "x$have_groff" = x"yes"; then
222792e95ad1Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222892e95ad1Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222992e95ad1Smrg        groff_ms_works=yes
223092e95ad1Smrg    else
223192e95ad1Smrg        groff_ms_works=no
223211a95ff3Smrg    fi
223392e95ad1Smrg    AC_MSG_RESULT([$groff_ms_works])
223492e95ad1Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223592e95ad1Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223692e95ad1Smrg        groff_mm_works=yes
223792e95ad1Smrg    else
223892e95ad1Smrg        groff_mm_works=no
223992e95ad1Smrg    fi
224092e95ad1Smrg    AC_MSG_RESULT([$groff_mm_works])
224192e95ad1Smrgfi
224211a95ff3Smrg
224392e95ad1Smrg# We have groff, test for HTML dependencies, one command per package
224492e95ad1Smrgif test "x$have_groff" = x"yes"; then
224592e95ad1Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224692e95ad1Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224792e95ad1Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224892e95ad1Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224992e95ad1Smrg      have_groff_html=yes
225092e95ad1Smrg   else
225192e95ad1Smrg      have_groff_html=no
225292e95ad1Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225392e95ad1Smrg   fi
225492e95ad1Smrgfi
225592e95ad1Smrg
225692e95ad1Smrg# Set Automake conditionals for Makefiles
225792e95ad1SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225892e95ad1SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225992e95ad1SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226092e95ad1SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226192e95ad1Smrg]) # XORG_WITH_GROFF
226292e95ad1Smrg
226392e95ad1Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226492e95ad1Smrg# ---------------------------------------
226592e95ad1Smrg# Minimum version: 1.6.0
226692e95ad1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
226792e95ad1Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226892e95ad1Smrg#
226992e95ad1Smrg# Documentation tools are not always available on all platforms and sometimes
227092e95ad1Smrg# not at the appropriate level. This macro enables a module to test for the
227192e95ad1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
227292e95ad1Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
227392e95ad1Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
227492e95ad1Smrg# --with-fop assumes 'auto'.
227592e95ad1Smrg#
227692e95ad1Smrg# Interface to module:
227792e95ad1Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227892e95ad1Smrg# FOP:	 	returns the path of the fop program found
227992e95ad1Smrg#		returns the path set by the user in the environment
228092e95ad1Smrg# --with-fop: 	'yes' user instructs the module to use fop
228192e95ad1Smrg#		'no' user instructs the module not to use fop
228292e95ad1Smrg#
228392e95ad1Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228492e95ad1Smrg#
228592e95ad1SmrgAC_DEFUN([XORG_WITH_FOP],[
228692e95ad1SmrgAC_ARG_VAR([FOP], [Path to fop command])
228792e95ad1Smrgm4_define([_defopt], m4_default([$2], [auto]))
228892e95ad1SmrgAC_ARG_WITH(fop,
228992e95ad1Smrg	AS_HELP_STRING([--with-fop],
229092e95ad1Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229192e95ad1Smrg	   [use_fop=$withval], [use_fop=]_defopt)
229292e95ad1Smrgm4_undefine([_defopt])
229392e95ad1Smrg
229492e95ad1Smrgif test "x$use_fop" = x"auto"; then
229592e95ad1Smrg   AC_PATH_PROG([FOP], [fop])
229692e95ad1Smrg   if test "x$FOP" = "x"; then
229792e95ad1Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229892e95ad1Smrg	have_fop=no
229992e95ad1Smrg   else
230092e95ad1Smrg        have_fop=yes
230192e95ad1Smrg   fi
230292e95ad1Smrgelif test "x$use_fop" = x"yes" ; then
230392e95ad1Smrg   AC_PATH_PROG([FOP], [fop])
230492e95ad1Smrg   if test "x$FOP" = "x"; then
230592e95ad1Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230692e95ad1Smrg   fi
230792e95ad1Smrg   have_fop=yes
230892e95ad1Smrgelif test "x$use_fop" = x"no" ; then
230992e95ad1Smrg   if test "x$FOP" != "x"; then
231092e95ad1Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231192e95ad1Smrg   fi
231292e95ad1Smrg   have_fop=no
231311a95ff3Smrgelse
231492e95ad1Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
231511a95ff3Smrgfi
231611a95ff3Smrg
231792e95ad1Smrg# Test for a minimum version of fop, if provided.
231892e95ad1Smrgm4_ifval([$1],
231992e95ad1Smrg[if test "$have_fop" = yes; then
232092e95ad1Smrg    # scrape the fop version
232192e95ad1Smrg    AC_MSG_CHECKING([for fop minimum version])
232292e95ad1Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232392e95ad1Smrg    AC_MSG_RESULT([$fop_version])
232492e95ad1Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
232592e95ad1Smrg        [if test "x$use_fop" = xauto; then
232692e95ad1Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232792e95ad1Smrg            have_fop=no
232892e95ad1Smrg        else
232992e95ad1Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233092e95ad1Smrg        fi])
233192e95ad1Smrgfi])
233292e95ad1SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233392e95ad1Smrg]) # XORG_WITH_FOP
233492e95ad1Smrg
233592e95ad1Smrg# XORG_WITH_M4([MIN-VERSION])
233692e95ad1Smrg# ---------------------------
233792e95ad1Smrg# Minimum version: 1.19.0
233892e95ad1Smrg#
233992e95ad1Smrg# This macro attempts to locate an m4 macro processor which supports
234092e95ad1Smrg# -I option and is only useful for modules relying on M4 in order to
234192e95ad1Smrg# expand macros in source code files.
234292e95ad1Smrg#
234392e95ad1Smrg# Interface to module:
234492e95ad1Smrg# M4:	 	returns the path of the m4 program found
234592e95ad1Smrg#		returns the path set by the user in the environment
234692e95ad1Smrg#
234792e95ad1SmrgAC_DEFUN([XORG_WITH_M4], [
234892e95ad1SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234992e95ad1Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235092e95ad1Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235192e95ad1Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235292e95ad1Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235392e95ad1Smrg   [$PATH:/usr/gnu/bin])])
235411a95ff3Smrg
235592e95ad1SmrgAC_SUBST([M4], [$ac_cv_path_M4])
235692e95ad1Smrg]) # XORG_WITH_M4
235711a95ff3Smrg
235892e95ad1Smrg# XORG_WITH_PS2PDF([DEFAULT])
235992e95ad1Smrg# ----------------
236092e95ad1Smrg# Minimum version: 1.6.0
236192e95ad1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
236292e95ad1Smrg#
236392e95ad1Smrg# Documentation tools are not always available on all platforms and sometimes
236492e95ad1Smrg# not at the appropriate level. This macro enables a module to test for the
236592e95ad1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
236692e95ad1Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
236792e95ad1Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236892e95ad1Smrg# --with-ps2pdf assumes 'auto'.
236992e95ad1Smrg#
237092e95ad1Smrg# Interface to module:
237192e95ad1Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237292e95ad1Smrg# PS2PDF:	returns the path of the ps2pdf program found
237392e95ad1Smrg#		returns the path set by the user in the environment
237492e95ad1Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237592e95ad1Smrg#		 'no' user instructs the module not to use ps2pdf
237692e95ad1Smrg#
237792e95ad1Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237892e95ad1Smrg#
237992e95ad1SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238092e95ad1SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238192e95ad1Smrgm4_define([_defopt], m4_default([$1], [auto]))
238292e95ad1SmrgAC_ARG_WITH(ps2pdf,
238392e95ad1Smrg	AS_HELP_STRING([--with-ps2pdf],
238492e95ad1Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238592e95ad1Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238692e95ad1Smrgm4_undefine([_defopt])
238711a95ff3Smrg
238892e95ad1Smrgif test "x$use_ps2pdf" = x"auto"; then
238992e95ad1Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239092e95ad1Smrg   if test "x$PS2PDF" = "x"; then
239192e95ad1Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239292e95ad1Smrg	have_ps2pdf=no
239392e95ad1Smrg   else
239492e95ad1Smrg        have_ps2pdf=yes
239592e95ad1Smrg   fi
239692e95ad1Smrgelif test "x$use_ps2pdf" = x"yes" ; then
239792e95ad1Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239892e95ad1Smrg   if test "x$PS2PDF" = "x"; then
239992e95ad1Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240092e95ad1Smrg   fi
240192e95ad1Smrg   have_ps2pdf=yes
240292e95ad1Smrgelif test "x$use_ps2pdf" = x"no" ; then
240392e95ad1Smrg   if test "x$PS2PDF" != "x"; then
240492e95ad1Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240592e95ad1Smrg   fi
240692e95ad1Smrg   have_ps2pdf=no
240792e95ad1Smrgelse
240892e95ad1Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
240911a95ff3Smrgfi
241092e95ad1SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241192e95ad1Smrg]) # XORG_WITH_PS2PDF
24121e5fa1c5Smrg
241392e95ad1Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
241492e95ad1Smrg# ----------------
241592e95ad1Smrg# Minimum version: 1.6.0
2416a097bd00Smrg#
241792e95ad1Smrg# Documentation tools are not always available on all platforms and sometimes
241892e95ad1Smrg# not at the appropriate level. This macro enables a builder to skip all
241992e95ad1Smrg# documentation targets except traditional man pages.
242092e95ad1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242192e95ad1Smrg# maximum flexibilty in controlling documentation building.
242292e95ad1Smrg# Refer to:
242392e95ad1Smrg# XORG_WITH_XMLTO         --with-xmlto
242492e95ad1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242592e95ad1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
242692e95ad1Smrg# XORG_WITH_FOP           --with-fop
242792e95ad1Smrg# XORG_WITH_GROFF         --with-groff
242892e95ad1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
242992e95ad1Smrg#
243092e95ad1Smrg# Interface to module:
243192e95ad1Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243292e95ad1Smrg# --enable-docs: 'yes' user instructs the module to generate docs
243392e95ad1Smrg#		 'no' user instructs the module not to generate docs
243492e95ad1Smrg# parm1:	specify the default value, yes or no.
243592e95ad1Smrg#
243692e95ad1SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243792e95ad1Smrgm4_define([docs_default], m4_default([$1], [yes]))
243892e95ad1SmrgAC_ARG_ENABLE(docs,
243992e95ad1Smrg	AS_HELP_STRING([--enable-docs],
244092e95ad1Smrg	   [Enable building the documentation (default: ]docs_default[)]),
244192e95ad1Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
244292e95ad1Smrgm4_undefine([docs_default])
244392e95ad1SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244492e95ad1SmrgAC_MSG_CHECKING([whether to build documentation])
244592e95ad1SmrgAC_MSG_RESULT([$build_docs])
244692e95ad1Smrg]) # XORG_ENABLE_DOCS
2447a097bd00Smrg
244892e95ad1Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244992e95ad1Smrg# ----------------
245092e95ad1Smrg# Minimum version: 1.6.0
245192e95ad1Smrg#
245292e95ad1Smrg# This macro enables a builder to skip all developer documentation.
245392e95ad1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245492e95ad1Smrg# maximum flexibilty in controlling documentation building.
245592e95ad1Smrg# Refer to:
245692e95ad1Smrg# XORG_WITH_XMLTO         --with-xmlto
245792e95ad1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245892e95ad1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
245992e95ad1Smrg# XORG_WITH_FOP           --with-fop
246092e95ad1Smrg# XORG_WITH_GROFF         --with-groff
246192e95ad1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
246292e95ad1Smrg#
246392e95ad1Smrg# Interface to module:
246492e95ad1Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246592e95ad1Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246692e95ad1Smrg#			'no' user instructs the module not to generate developer docs
246792e95ad1Smrg# parm1:		specify the default value, yes or no.
246892e95ad1Smrg#
246992e95ad1SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247092e95ad1Smrgm4_define([devel_default], m4_default([$1], [yes]))
247192e95ad1SmrgAC_ARG_ENABLE(devel-docs,
247292e95ad1Smrg	AS_HELP_STRING([--enable-devel-docs],
247392e95ad1Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247492e95ad1Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247592e95ad1Smrgm4_undefine([devel_default])
247692e95ad1SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247792e95ad1SmrgAC_MSG_CHECKING([whether to build developer documentation])
247892e95ad1SmrgAC_MSG_RESULT([$build_devel_docs])
247992e95ad1Smrg]) # XORG_ENABLE_DEVEL_DOCS
248011a95ff3Smrg
248192e95ad1Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
248292e95ad1Smrg# ----------------
248392e95ad1Smrg# Minimum version: 1.6.0
248492e95ad1Smrg#
248592e95ad1Smrg# This macro enables a builder to skip all functional specification targets.
248692e95ad1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248792e95ad1Smrg# maximum flexibilty in controlling documentation building.
248892e95ad1Smrg# Refer to:
248992e95ad1Smrg# XORG_WITH_XMLTO         --with-xmlto
249092e95ad1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249192e95ad1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
249292e95ad1Smrg# XORG_WITH_FOP           --with-fop
249392e95ad1Smrg# XORG_WITH_GROFF         --with-groff
249492e95ad1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
249592e95ad1Smrg#
249692e95ad1Smrg# Interface to module:
249792e95ad1Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249892e95ad1Smrg# --enable-specs:	'yes' user instructs the module to generate specs
249992e95ad1Smrg#			'no' user instructs the module not to generate specs
250092e95ad1Smrg# parm1:		specify the default value, yes or no.
250192e95ad1Smrg#
250292e95ad1SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250392e95ad1Smrgm4_define([spec_default], m4_default([$1], [yes]))
250492e95ad1SmrgAC_ARG_ENABLE(specs,
250592e95ad1Smrg	AS_HELP_STRING([--enable-specs],
250692e95ad1Smrg	   [Enable building the specs (default: ]spec_default[)]),
250792e95ad1Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
250892e95ad1Smrgm4_undefine([spec_default])
250992e95ad1SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251092e95ad1SmrgAC_MSG_CHECKING([whether to build functional specifications])
251192e95ad1SmrgAC_MSG_RESULT([$build_specs])
251292e95ad1Smrg]) # XORG_ENABLE_SPECS
251311a95ff3Smrg
251492e95ad1Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251592e95ad1Smrg# ----------------------------------------------
251692e95ad1Smrg# Minimum version: 1.13.0
2517a097bd00Smrg#
251892e95ad1Smrg# This macro enables a builder to enable/disable unit testing
251992e95ad1Smrg# It makes no assumption about the test cases implementation
252092e95ad1Smrg# Test cases may or may not use Automake "Support for test suites"
252192e95ad1Smrg# They may or may not use the software utility library GLib
252292e95ad1Smrg#
252392e95ad1Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252492e95ad1Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252592e95ad1Smrg# The variable enable_unit_tests is used by other macros in this file.
252692e95ad1Smrg#
252792e95ad1Smrg# Interface to module:
252892e95ad1Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252992e95ad1Smrg# enable_unit_tests:    used in configure.ac for additional configuration
253092e95ad1Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253192e95ad1Smrg#			'no' user instructs the module not to build tests
253292e95ad1Smrg# parm1:		specify the default value, yes or no.
253392e95ad1Smrg#
253492e95ad1SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253592e95ad1SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253692e95ad1SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253792e95ad1SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253892e95ad1Smrgm4_define([_defopt], m4_default([$1], [auto]))
253992e95ad1SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254092e95ad1Smrg	[Enable building unit test cases (default: ]_defopt[)]),
254192e95ad1Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254292e95ad1Smrgm4_undefine([_defopt])
254392e95ad1SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254492e95ad1SmrgAC_MSG_CHECKING([whether to build unit test cases])
254592e95ad1SmrgAC_MSG_RESULT([$enable_unit_tests])
254692e95ad1Smrg]) # XORG_ENABLE_UNIT_TESTS
254711a95ff3Smrg
254892e95ad1Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254992e95ad1Smrg# ------------------------------------------------------
255092e95ad1Smrg# Minimum version: 1.17.0
255192e95ad1Smrg#
255292e95ad1Smrg# This macro enables a builder to enable/disable integration testing
255392e95ad1Smrg# It makes no assumption about the test cases' implementation
255492e95ad1Smrg# Test cases may or may not use Automake "Support for test suites"
255592e95ad1Smrg#
255692e95ad1Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255792e95ad1Smrg# usually requires less dependencies and may be built and run under less
255892e95ad1Smrg# stringent environments than integration tests.
255992e95ad1Smrg#
256092e95ad1Smrg# Interface to module:
256192e95ad1Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256292e95ad1Smrg# enable_integration_tests:   used in configure.ac for additional configuration
256392e95ad1Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256492e95ad1Smrg#                             'no' user instructs the module not to build tests
256592e95ad1Smrg# parm1:                      specify the default value, yes or no.
256692e95ad1Smrg#
256792e95ad1SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256892e95ad1SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256992e95ad1Smrgm4_define([_defopt], m4_default([$1], [auto]))
257092e95ad1SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257192e95ad1Smrg	[Enable building integration test cases (default: ]_defopt[)]),
257292e95ad1Smrg	[enable_integration_tests=$enableval],
257392e95ad1Smrg	[enable_integration_tests=]_defopt)
257492e95ad1Smrgm4_undefine([_defopt])
257592e95ad1SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257692e95ad1Smrg	[test "x$enable_integration_tests" != xno])
257792e95ad1SmrgAC_MSG_CHECKING([whether to build unit test cases])
257892e95ad1SmrgAC_MSG_RESULT([$enable_integration_tests])
257992e95ad1Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
258011a95ff3Smrg
258192e95ad1Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258292e95ad1Smrg# ----------------------------------------
258392e95ad1Smrg# Minimum version: 1.13.0
258492e95ad1Smrg#
258592e95ad1Smrg# GLib is a library which provides advanced data structures and functions.
258692e95ad1Smrg# This macro enables a module to test for the presence of Glib.
258792e95ad1Smrg#
258892e95ad1Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258992e95ad1Smrg# Otherwise the value of $enable_unit_tests is blank.
259092e95ad1Smrg#
259192e95ad1Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259292e95ad1Smrg# test support usually requires less dependencies and may be built and run under
259392e95ad1Smrg# less stringent environments than integration tests.
2594a097bd00Smrg#
259592e95ad1Smrg# Interface to module:
259692e95ad1Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
259792e95ad1Smrg# with_glib: used in configure.ac to know if GLib has been found
259892e95ad1Smrg# --with-glib:	'yes' user instructs the module to use glib
259992e95ad1Smrg#		'no' user instructs the module not to use glib
260092e95ad1Smrg#
260192e95ad1SmrgAC_DEFUN([XORG_WITH_GLIB],[
260292e95ad1SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260392e95ad1Smrgm4_define([_defopt], m4_default([$2], [auto]))
260492e95ad1SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260592e95ad1Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260692e95ad1Smrg	[with_glib=$withval], [with_glib=]_defopt)
260792e95ad1Smrgm4_undefine([_defopt])
2608a097bd00Smrg
260992e95ad1Smrghave_glib=no
261092e95ad1Smrg# Do not probe GLib if user explicitly disabled unit testing
261192e95ad1Smrgif test "x$enable_unit_tests" != x"no"; then
261292e95ad1Smrg  # Do not probe GLib if user explicitly disabled it
261392e95ad1Smrg  if test "x$with_glib" != x"no"; then
261492e95ad1Smrg    m4_ifval(
261592e95ad1Smrg      [$1],
261692e95ad1Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261792e95ad1Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261892e95ad1Smrg    )
2619a097bd00Smrg  fi
2620a097bd00Smrgfi
2621a097bd00Smrg
262292e95ad1Smrg# Not having GLib when unit testing has been explicitly requested is an error
262392e95ad1Smrgif test "x$enable_unit_tests" = x"yes"; then
262492e95ad1Smrg  if test "x$have_glib" = x"no"; then
262592e95ad1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626a097bd00Smrg  fi
2627a097bd00Smrgfi
2628a097bd00Smrg
262992e95ad1Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
263092e95ad1Smrgif test "x$enable_unit_tests" = x"no"; then
263192e95ad1Smrg  if test "x$with_glib" = x"yes"; then
263292e95ad1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263392e95ad1Smrg  fi
263492e95ad1Smrgfi
2635a097bd00Smrg
263692e95ad1Smrg# Not having GLib when it has been explicitly requested is an error
263792e95ad1Smrgif test "x$with_glib" = x"yes"; then
263892e95ad1Smrg  if test "x$have_glib" = x"no"; then
263992e95ad1Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264092e95ad1Smrg  fi
264192e95ad1Smrgfi
2642a097bd00Smrg
264392e95ad1SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264492e95ad1Smrg]) # XORG_WITH_GLIB
2645a097bd00Smrg
264692e95ad1Smrg# XORG_LD_WRAP([required|optional])
264792e95ad1Smrg# ---------------------------------
264892e95ad1Smrg# Minimum version: 1.13.0
264992e95ad1Smrg#
265092e95ad1Smrg# Check if linker supports -wrap, passed via compiler flags
265192e95ad1Smrg#
265292e95ad1Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265392e95ad1Smrg# Otherwise the value of $enable_unit_tests is blank.
265492e95ad1Smrg#
265592e95ad1Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265692e95ad1Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265792e95ad1Smrg# available, an argument of "optional" allows use when some unit tests require
265892e95ad1Smrg# ld -wrap and others do not.
265992e95ad1Smrg#
266092e95ad1SmrgAC_DEFUN([XORG_LD_WRAP],[
266192e95ad1SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266292e95ad1Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266392e95ad1Smrg                      void __wrap_exit(int status) { return; }],
266492e95ad1Smrg                     [exit(0);])])
266592e95ad1Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
266692e95ad1Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266792e95ad1Smrg  if test "x$have_ld_wrap" = x"no"; then
266892e95ad1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266992e95ad1Smrg  fi
267092e95ad1Smrgfi
267192e95ad1SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267292e95ad1Smrg#
267392e95ad1Smrg]) # XORG_LD_WRAP
2674a097bd00Smrg
267592e95ad1Smrg# XORG_CHECK_LINKER_FLAGS
267692e95ad1Smrg# -----------------------
267792e95ad1Smrg# SYNOPSIS
267892e95ad1Smrg#
267992e95ad1Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268092e95ad1Smrg#
268192e95ad1Smrg# DESCRIPTION
268292e95ad1Smrg#
268392e95ad1Smrg#   Check whether the given linker FLAGS work with the current language's
268492e95ad1Smrg#   linker, or whether they give an error.
268592e95ad1Smrg#
268692e95ad1Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268792e95ad1Smrg#   success/failure.
268892e95ad1Smrg#
268992e95ad1Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
269092e95ad1Smrg#
269192e95ad1Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269292e95ad1Smrg#
269392e95ad1Smrg# LICENSE
269492e95ad1Smrg#
269592e95ad1Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269692e95ad1Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269792e95ad1Smrg#   Copyright (c) 2009 Matteo Frigo
269892e95ad1Smrg#
269992e95ad1Smrg#   This program is free software: you can redistribute it and/or modify it
270092e95ad1Smrg#   under the terms of the GNU General Public License as published by the
270192e95ad1Smrg#   Free Software Foundation, either version 3 of the License, or (at your
270292e95ad1Smrg#   option) any later version.
270392e95ad1Smrg#
270492e95ad1Smrg#   This program is distributed in the hope that it will be useful, but
270592e95ad1Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270692e95ad1Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270792e95ad1Smrg#   Public License for more details.
270892e95ad1Smrg#
270992e95ad1Smrg#   You should have received a copy of the GNU General Public License along
271092e95ad1Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271192e95ad1Smrg#
271292e95ad1Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
271392e95ad1Smrg#   gives unlimited permission to copy, distribute and modify the configure
271492e95ad1Smrg#   scripts that are the output of Autoconf when processing the Macro. You
271592e95ad1Smrg#   need not follow the terms of the GNU General Public License when using
271692e95ad1Smrg#   or distributing such scripts, even though portions of the text of the
271792e95ad1Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271892e95ad1Smrg#   all other use of the material that constitutes the Autoconf Macro.
271992e95ad1Smrg#
272092e95ad1Smrg#   This special exception to the GPL applies to versions of the Autoconf
272192e95ad1Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
272292e95ad1Smrg#   modified version of the Autoconf Macro, you may extend this special
272392e95ad1Smrg#   exception to the GPL to apply to your modified version as well.#
272492e95ad1SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272592e95ad1Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
272692e95ad1Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272792e95ad1SmrgAS_LITERAL_IF([$1],
272892e95ad1Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272992e95ad1Smrg      ax_save_FLAGS=$LDFLAGS
273092e95ad1Smrg      LDFLAGS="$1"
273192e95ad1Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273292e95ad1Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273392e95ad1Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273492e95ad1Smrg      LDFLAGS=$ax_save_FLAGS])],
273592e95ad1Smrg  [ax_save_FLAGS=$LDFLAGS
273692e95ad1Smrg   LDFLAGS="$1"
273792e95ad1Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273892e95ad1Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273992e95ad1Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274092e95ad1Smrg   LDFLAGS=$ax_save_FLAGS])
274192e95ad1Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274292e95ad1SmrgAC_MSG_RESULT($xorg_check_linker_flags)
274392e95ad1Smrgif test "x$xorg_check_linker_flags" = xyes; then
274492e95ad1Smrg	m4_default([$2], :)
274592e95ad1Smrgelse
274692e95ad1Smrg	m4_default([$3], :)
274792e95ad1Smrgfi
274892e95ad1Smrg]) # XORG_CHECK_LINKER_FLAGS
2749a097bd00Smrg
275092e95ad1Smrg# XORG_MEMORY_CHECK_FLAGS
275192e95ad1Smrg# -----------------------
275292e95ad1Smrg# Minimum version: 1.16.0
275392e95ad1Smrg#
275492e95ad1Smrg# This macro attempts to find appropriate memory checking functionality
275592e95ad1Smrg# for various platforms which unit testing code may use to catch various
275692e95ad1Smrg# forms of memory allocation and access errors in testing.
275792e95ad1Smrg#
275892e95ad1Smrg# Interface to module:
275992e95ad1Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276092e95ad1Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276192e95ad1Smrg#
276292e95ad1Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276392e95ad1Smrg#
276492e95ad1SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765a097bd00Smrg
276692e95ad1SmrgAC_REQUIRE([AC_CANONICAL_HOST])
276792e95ad1SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276892e95ad1Smrg           [Environment variables to enable memory checking in tests])
2769a097bd00Smrg
277092e95ad1Smrg# Check for different types of support on different platforms
277192e95ad1Smrgcase $host_os in
277292e95ad1Smrg    solaris*)
277392e95ad1Smrg        AC_CHECK_LIB([umem], [umem_alloc],
277492e95ad1Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277592e95ad1Smrg        ;;
277692e95ad1Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277792e95ad1Smrg        # both directly and inverted, so should not be 0 or 255.
277892e95ad1Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
277992e95ad1Smrg        ;;
278092e95ad1Smrg    darwin*)
278192e95ad1Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278292e95ad1Smrg        ;;
278392e95ad1Smrg    *bsd*)
278492e95ad1Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278592e95ad1Smrg        ;;
278692e95ad1Smrgesac
2787a6d9b409Smrg
278892e95ad1Smrg# User supplied flags override default flags
278992e95ad1Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279092e95ad1Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791a6d9b409Smrgfi
2792a6d9b409Smrg
279392e95ad1SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279492e95ad1Smrg]) # XORG_WITH_LINT
279511a95ff3Smrg
279692e95ad1Smrg# XORG_CHECK_MALLOC_ZERO
279792e95ad1Smrg# ----------------------
279892e95ad1Smrg# Minimum version: 1.0.0
2799a6d9b409Smrg#
280092e95ad1Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280192e95ad1Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280292e95ad1Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280392e95ad1SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280492e95ad1SmrgAC_ARG_ENABLE(malloc0returnsnull,
280592e95ad1Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280692e95ad1Smrg		       [malloc(0) returns NULL (default: auto)]),
280792e95ad1Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280892e95ad1Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809a6d9b409Smrg
281092e95ad1SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281192e95ad1Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281292e95ad1SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281392e95ad1Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281492e95ad1Smrg#include <stdlib.h>
281592e95ad1Smrg],[
281692e95ad1Smrg    char *m0, *r0, *c0, *p;
281792e95ad1Smrg    m0 = malloc(0);
281892e95ad1Smrg    p = malloc(10);
281992e95ad1Smrg    r0 = realloc(p,0);
282092e95ad1Smrg    c0 = calloc(0,10);
282192e95ad1Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282292e95ad1Smrg])],
282392e95ad1Smrg		[xorg_cv_malloc0_returns_null=yes],
282492e95ad1Smrg		[xorg_cv_malloc0_returns_null=no])])
282592e95ad1SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
282611a95ff3Smrgfi
282792e95ad1SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828a097bd00Smrg
282992e95ad1Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283092e95ad1Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283192e95ad1Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283292e95ad1Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2833a6d9b409Smrgelse
283492e95ad1Smrg	MALLOC_ZERO_CFLAGS=""
283592e95ad1Smrg	XMALLOC_ZERO_CFLAGS=""
283692e95ad1Smrg	XTMALLOC_ZERO_CFLAGS=""
2837a6d9b409Smrgfi
2838a6d9b409Smrg
283992e95ad1SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284092e95ad1SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284192e95ad1SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284292e95ad1Smrg]) # XORG_CHECK_MALLOC_ZERO
2843a6d9b409Smrg
284492e95ad1Smrg# XORG_WITH_LINT()
284592e95ad1Smrg# ----------------
284692e95ad1Smrg# Minimum version: 1.1.0
2847a097bd00Smrg#
284892e95ad1Smrg# This macro enables the use of a tool that flags some suspicious and
284992e95ad1Smrg# non-portable constructs (likely to be bugs) in C language source code.
285092e95ad1Smrg# It will attempt to locate the tool and use appropriate options.
285192e95ad1Smrg# There are various lint type tools on different platforms.
2852a097bd00Smrg#
285392e95ad1Smrg# Interface to module:
285492e95ad1Smrg# LINT:		returns the path to the tool found on the platform
285592e95ad1Smrg#		or the value set to LINT on the configure cmd line
285692e95ad1Smrg#		also an Automake conditional
285792e95ad1Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
285892e95ad1Smrg#
285992e95ad1Smrg# --with-lint:	'yes' user instructs the module to use lint
286092e95ad1Smrg#		'no' user instructs the module not to use lint (default)
286192e95ad1Smrg#
286292e95ad1Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286392e95ad1Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286492e95ad1Smrg#
286592e95ad1SmrgAC_DEFUN([XORG_WITH_LINT],[
2866a097bd00Smrg
286792e95ad1SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286892e95ad1SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286992e95ad1SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287092e95ad1Smrg		[Use a lint-style source code checker (default: disabled)])],
287192e95ad1Smrg		[use_lint=$withval], [use_lint=no])
2872a097bd00Smrg
287392e95ad1Smrg# Obtain platform specific info like program name and options
287492e95ad1Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287592e95ad1Smrgcase $host_os in
287692e95ad1Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287792e95ad1Smrg	lint_name=splint
287892e95ad1Smrg	lint_options="-badflag"
287992e95ad1Smrg	;;
288092e95ad1Smrg  *freebsd* | *netbsd*)
288192e95ad1Smrg	lint_name=lint
288292e95ad1Smrg	lint_options="-u -b"
288392e95ad1Smrg	;;
288492e95ad1Smrg  *solaris*)
288592e95ad1Smrg	lint_name=lint
288692e95ad1Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288792e95ad1Smrg	;;
288892e95ad1Smrgesac
288992e95ad1Smrg
289092e95ad1Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289192e95ad1Smrgif test "x$use_lint" = x"yes" ; then
289292e95ad1Smrg   AC_PATH_PROG([LINT], [$lint_name])
289392e95ad1Smrg   if test "x$LINT" = "x"; then
289492e95ad1Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289592e95ad1Smrg   fi
289692e95ad1Smrgelif test "x$use_lint" = x"no" ; then
289792e95ad1Smrg   if test "x$LINT" != "x"; then
289892e95ad1Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289992e95ad1Smrg   fi
290011a95ff3Smrgelse
290192e95ad1Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902a097bd00Smrgfi
2903a097bd00Smrg
290492e95ad1Smrg# User supplied flags override default flags
290592e95ad1Smrgif test "x$LINT_FLAGS" != "x"; then
290692e95ad1Smrg   lint_options=$LINT_FLAGS
290792e95ad1Smrgfi
2908a097bd00Smrg
290992e95ad1SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291092e95ad1SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911a097bd00Smrg
291292e95ad1Smrg]) # XORG_WITH_LINT
2913a097bd00Smrg
291492e95ad1Smrg# XORG_LINT_LIBRARY(LIBNAME)
291592e95ad1Smrg# --------------------------
291692e95ad1Smrg# Minimum version: 1.1.0
2917a097bd00Smrg#
291892e95ad1Smrg# Sets up flags for building lint libraries for checking programs that call
291992e95ad1Smrg# functions in the library.
292092e95ad1Smrg#
292192e95ad1Smrg# Interface to module:
292292e95ad1Smrg# LINTLIB		- Automake variable with the name of lint library file to make
292392e95ad1Smrg# MAKE_LINT_LIB		- Automake conditional
292492e95ad1Smrg#
292592e95ad1Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292692e95ad1Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2927a097bd00Smrg
292892e95ad1SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292992e95ad1SmrgAC_REQUIRE([XORG_WITH_LINT])
293092e95ad1SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293192e95ad1Smrg	[Create lint library (default: disabled)])],
293292e95ad1Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293392e95ad1Smrg
293492e95ad1Smrgif test "x$make_lint_lib" = x"yes" ; then
293592e95ad1Smrg   LINTLIB=llib-l$1.ln
293692e95ad1Smrg   if test "x$LINT" = "x"; then
293792e95ad1Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293892e95ad1Smrg   fi
293992e95ad1Smrgelif test "x$make_lint_lib" != x"no" ; then
294092e95ad1Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941a097bd00Smrgfi
2942a097bd00Smrg
294392e95ad1SmrgAC_SUBST(LINTLIB)
294492e95ad1SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
294511a95ff3Smrg
294692e95ad1Smrg]) # XORG_LINT_LIBRARY
294711a95ff3Smrg
294892e95ad1Smrg# XORG_COMPILER_BRAND
294911a95ff3Smrg# -------------------
295092e95ad1Smrg# Minimum version: 1.14.0
295111a95ff3Smrg#
295292e95ad1Smrg# Checks for various brands of compilers and sets flags as appropriate:
295392e95ad1Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295492e95ad1Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295592e95ad1Smrg#   clang compiler - sets CLANGCC to "yes"
295692e95ad1Smrg#   Intel compiler - sets INTELCC to "yes"
295792e95ad1Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295892e95ad1Smrg#
295992e95ad1SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296092e95ad1SmrgAC_LANG_CASE(
296192e95ad1Smrg	[C], [
296292e95ad1Smrg		AC_REQUIRE([AC_PROG_CC_C99])
296392e95ad1Smrg	],
296492e95ad1Smrg	[C++], [
296592e95ad1Smrg		AC_REQUIRE([AC_PROG_CXX])
296692e95ad1Smrg	]
296792e95ad1Smrg)
296892e95ad1SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
296992e95ad1SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297092e95ad1SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297192e95ad1Smrg]) # XORG_COMPILER_BRAND
2972a097bd00Smrg
297392e95ad1Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
297411a95ff3Smrg# ---------------
297592e95ad1Smrg# Minimum version: 1.16.0
297692e95ad1Smrg#
297792e95ad1Smrg# Test if the compiler works when passed the given flag as a command line argument.
297892e95ad1Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
297992e95ad1Smrg# next flag in the list until there are no more options.
298092e95ad1Smrg#
298192e95ad1Smrg# Note that this does not guarantee that the compiler supports the flag as some
298292e95ad1Smrg# compilers will simply ignore arguments that they do not understand, but we do
298392e95ad1Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298492e95ad1Smrg# -Werror=unused-command-line-argument
298592e95ad1Smrg#
298692e95ad1SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
298792e95ad1Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298892e95ad1Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2989a097bd00Smrg
299092e95ad1SmrgAC_LANG_COMPILER_REQUIRE
2991a097bd00Smrg
299292e95ad1SmrgAC_LANG_CASE(
299392e95ad1Smrg	[C], [
299492e95ad1Smrg		AC_REQUIRE([AC_PROG_CC_C99])
299592e95ad1Smrg		define([PREFIX], [C])
299692e95ad1Smrg		define([CACHE_PREFIX], [cc])
299792e95ad1Smrg		define([COMPILER], [$CC])
299892e95ad1Smrg	],
299992e95ad1Smrg	[C++], [
300092e95ad1Smrg		define([PREFIX], [CXX])
300192e95ad1Smrg		define([CACHE_PREFIX], [cxx])
300292e95ad1Smrg		define([COMPILER], [$CXX])
300392e95ad1Smrg	]
300492e95ad1Smrg)
300592e95ad1Smrg
300692e95ad1Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
300792e95ad1Smrg
300892e95ad1Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
300992e95ad1Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301092e95ad1Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301192e95ad1Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
301292e95ad1Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
301392e95ad1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
301492e95ad1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
301592e95ad1Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
301692e95ad1Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
301711a95ff3Smrgfi
301892e95ad1Smrg
301992e95ad1Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302092e95ad1Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302192e95ad1Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
302292e95ad1Smrg	fi
302392e95ad1Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
302492e95ad1Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
302592e95ad1Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
302692e95ad1Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302792e95ad1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
302892e95ad1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
302992e95ad1Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303092e95ad1Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303192e95ad1Smrgfi
303292e95ad1Smrg
303392e95ad1Smrgfound="no"
303492e95ad1Smrgm4_foreach([flag], m4_cdr($@), [
303592e95ad1Smrg	if test $found = "no" ; then
303692e95ad1Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
303792e95ad1Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303892e95ad1Smrg		fi
303992e95ad1Smrg
304092e95ad1Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304192e95ad1Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
304292e95ad1Smrg		fi
304392e95ad1Smrg
304492e95ad1Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
304592e95ad1Smrg
304692e95ad1Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
304792e95ad1Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
304892e95ad1Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
304992e95ad1Smrg		AC_CACHE_VAL($cacheid,
305092e95ad1Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305192e95ad1Smrg					     [eval $cacheid=yes],
305292e95ad1Smrg					     [eval $cacheid=no])])
305392e95ad1Smrg
305492e95ad1Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
305592e95ad1Smrg
305692e95ad1Smrg		eval supported=\$$cacheid
305792e95ad1Smrg		AC_MSG_RESULT([$supported])
305892e95ad1Smrg		if test "$supported" = "yes" ; then
305992e95ad1Smrg			$1="$$1 ]flag["
306092e95ad1Smrg			found="yes"
306192e95ad1Smrg		fi
306292e95ad1Smrg	fi
306311a95ff3Smrg])
306492e95ad1Smrg]) # XORG_TESTSET_CFLAG
3065a097bd00Smrg
306692e95ad1Smrg# XORG_COMPILER_FLAGS
306792e95ad1Smrg# ---------------
306892e95ad1Smrg# Minimum version: 1.16.0
3069a097bd00Smrg#
307092e95ad1Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307192e95ad1Smrg# arguments supported by the selected compiler which do NOT alter the generated
307292e95ad1Smrg# code.  These arguments will cause the compiler to print various warnings
307392e95ad1Smrg# during compilation AND turn a conservative set of warnings into errors.
307492e95ad1Smrg#
307592e95ad1Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
307692e95ad1Smrg# future versions of util-macros as options are added to new compilers.
307792e95ad1Smrg#
307892e95ad1SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
307992e95ad1SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3080efda2da8Smrg
308192e95ad1SmrgAC_ARG_ENABLE(selective-werror,
308292e95ad1Smrg              AS_HELP_STRING([--disable-selective-werror],
308392e95ad1Smrg                             [Turn off selective compiler errors. (default: enabled)]),
308492e95ad1Smrg              [SELECTIVE_WERROR=$enableval],
308592e95ad1Smrg              [SELECTIVE_WERROR=yes])
308692e95ad1Smrg
308792e95ad1SmrgAC_LANG_CASE(
308892e95ad1Smrg        [C], [
308992e95ad1Smrg                define([PREFIX], [C])
309092e95ad1Smrg        ],
309192e95ad1Smrg        [C++], [
309292e95ad1Smrg                define([PREFIX], [CXX])
309392e95ad1Smrg        ]
309492e95ad1Smrg)
309592e95ad1Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
309692e95ad1Smrgif test "x$SUNCC" = "xyes"; then
309792e95ad1Smrg    [BASE_]PREFIX[FLAGS]="-v"
309811a95ff3Smrgelse
309992e95ad1Smrg    [BASE_]PREFIX[FLAGS]=""
310011a95ff3Smrgfi
310111a95ff3Smrg
310292e95ad1Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
310392e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
310492e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
310592e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
310692e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
310711a95ff3Smrg
310892e95ad1SmrgAC_LANG_CASE(
310992e95ad1Smrg	[C], [
311092e95ad1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311192e95ad1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
311292e95ad1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
311392e95ad1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
311492e95ad1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
311592e95ad1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
311692e95ad1Smrg	]
311792e95ad1Smrg)
3118efda2da8Smrg
311992e95ad1Smrg# This chunk adds additional warnings that could catch undesired effects.
312092e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312192e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
312292e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
312392e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
312492e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
312592e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
312692e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3127a097bd00Smrg
312892e95ad1Smrg# These are currently disabled because they are noisy.  They will be enabled
312992e95ad1Smrg# in the future once the codebase is sufficiently modernized to silence
313092e95ad1Smrg# them.  For now, I don't want them to drown out the other warnings.
313192e95ad1Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
313292e95ad1Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
313392e95ad1Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3134a097bd00Smrg
313592e95ad1Smrg# Turn some warnings into errors, so we don't accidently get successful builds
313692e95ad1Smrg# when there are problems that should be fixed.
3137a097bd00Smrg
313892e95ad1Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
313992e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314092e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314192e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
314292e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
314392e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
314492e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
314592e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
314692e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
314792e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
314892e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
314992e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315092e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315192e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
315292e95ad1Smrgelse
315392e95ad1SmrgAC_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])
315492e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
315592e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
315692e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
315792e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
315892e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
315992e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316092e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316192e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
316292e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
316392e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
316492e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
316592e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
316692e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
316792e95ad1Smrgfi
3168a097bd00Smrg
316992e95ad1SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317092e95ad1Smrg]) # XORG_COMPILER_FLAGS
3171efda2da8Smrg
317292e95ad1Smrg# XORG_CWARNFLAGS
317392e95ad1Smrg# ---------------
317492e95ad1Smrg# Minimum version: 1.2.0
317592e95ad1Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3176efda2da8Smrg#
317792e95ad1Smrg# Defines CWARNFLAGS to enable C compiler warnings.
31781e5fa1c5Smrg#
317992e95ad1Smrg# This function is deprecated because it defines -fno-strict-aliasing
318092e95ad1Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318192e95ad1Smrg# is needed, then it should be added explicitly in the module when
318292e95ad1Smrg# it is updated to use BASE_CFLAGS.
31831e5fa1c5Smrg#
318492e95ad1SmrgAC_DEFUN([XORG_CWARNFLAGS], [
318592e95ad1SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
318692e95ad1SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
318792e95ad1SmrgAC_LANG_CASE(
318892e95ad1Smrg	[C], [
318992e95ad1Smrg		CWARNFLAGS="$BASE_CFLAGS"
319092e95ad1Smrg		if  test "x$GCC" = xyes ; then
319192e95ad1Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
319292e95ad1Smrg		fi
319392e95ad1Smrg		AC_SUBST(CWARNFLAGS)
319492e95ad1Smrg	]
319592e95ad1Smrg)
319692e95ad1Smrg]) # XORG_CWARNFLAGS
3197b91640d3Smrg
319892e95ad1Smrg# XORG_STRICT_OPTION
319992e95ad1Smrg# -----------------------
320092e95ad1Smrg# Minimum version: 1.3.0
320192e95ad1Smrg#
320292e95ad1Smrg# Add configure option to enable strict compilation flags, such as treating
320392e95ad1Smrg# warnings as fatal errors.
320492e95ad1Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
320592e95ad1Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
320692e95ad1Smrg#
320792e95ad1Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
320892e95ad1Smrg# when strict compilation is unconditionally desired.
320992e95ad1SmrgAC_DEFUN([XORG_STRICT_OPTION], [
321092e95ad1SmrgAC_REQUIRE([XORG_CWARNFLAGS])
321192e95ad1SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3212a6d9b409Smrg
321392e95ad1SmrgAC_ARG_ENABLE(strict-compilation,
321492e95ad1Smrg			  AS_HELP_STRING([--enable-strict-compilation],
321592e95ad1Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
321692e95ad1Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
321711a95ff3Smrg
321892e95ad1SmrgAC_LANG_CASE(
321992e95ad1Smrg        [C], [
322092e95ad1Smrg                define([PREFIX], [C])
322192e95ad1Smrg        ],
322292e95ad1Smrg        [C++], [
322392e95ad1Smrg                define([PREFIX], [CXX])
322492e95ad1Smrg        ]
322592e95ad1Smrg)
322611a95ff3Smrg
322792e95ad1Smrg[STRICT_]PREFIX[FLAGS]=""
322892e95ad1SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
322992e95ad1SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
323011a95ff3Smrg
323192e95ad1Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
323292e95ad1Smrg# activate it with -Werror, so we add it here explicitly.
323392e95ad1SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
323411a95ff3Smrg
323592e95ad1Smrgif test "x$STRICT_COMPILE" = "xyes"; then
323692e95ad1Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
323792e95ad1Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
323892e95ad1Smrgfi
323992e95ad1SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324092e95ad1SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324192e95ad1SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
324292e95ad1Smrg]) # XORG_STRICT_OPTION
324311a95ff3Smrg
324492e95ad1Smrg# XORG_DEFAULT_OPTIONS
324592e95ad1Smrg# --------------------
324692e95ad1Smrg# Minimum version: 1.3.0
324792e95ad1Smrg#
324892e95ad1Smrg# Defines default options for X.Org modules.
324992e95ad1Smrg#
325092e95ad1SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
325192e95ad1SmrgAC_REQUIRE([AC_PROG_INSTALL])
325292e95ad1SmrgXORG_COMPILER_FLAGS
325392e95ad1SmrgXORG_CWARNFLAGS
325492e95ad1SmrgXORG_STRICT_OPTION
325592e95ad1SmrgXORG_RELEASE_VERSION
325692e95ad1SmrgXORG_CHANGELOG
325792e95ad1SmrgXORG_INSTALL
325892e95ad1SmrgXORG_MANPAGE_SECTIONS
325992e95ad1Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326092e95ad1Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
326192e95ad1Smrg]) # XORG_DEFAULT_OPTIONS
326211a95ff3Smrg
326392e95ad1Smrg# XORG_INSTALL()
326492e95ad1Smrg# ----------------
326592e95ad1Smrg# Minimum version: 1.4.0
326692e95ad1Smrg#
326792e95ad1Smrg# Defines the variable INSTALL_CMD as the command to copy
326892e95ad1Smrg# INSTALL from $prefix/share/util-macros.
326992e95ad1Smrg#
327092e95ad1SmrgAC_DEFUN([XORG_INSTALL], [
327192e95ad1SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
327292e95ad1Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
327392e95ad1SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
327492e95ad1Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
327592e95ad1Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
327692e95ad1Smrgtouch \$(top_srcdir)/INSTALL; \
327792e95ad1Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
327892e95ad1SmrgAC_SUBST([INSTALL_CMD])
327992e95ad1Smrg]) # XORG_INSTALL
328092e95ad1Smrgdnl Copyright 2005 Red Hat, Inc
328192e95ad1Smrgdnl
328292e95ad1Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
328392e95ad1Smrgdnl documentation for any purpose is hereby granted without fee, provided that
328492e95ad1Smrgdnl the above copyright notice appear in all copies and that both that
328592e95ad1Smrgdnl copyright notice and this permission notice appear in supporting
328692e95ad1Smrgdnl documentation.
328792e95ad1Smrgdnl
328892e95ad1Smrgdnl The above copyright notice and this permission notice shall be included
328992e95ad1Smrgdnl in all copies or substantial portions of the Software.
329092e95ad1Smrgdnl
329192e95ad1Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
329292e95ad1Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
329392e95ad1Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
329492e95ad1Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
329592e95ad1Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
329692e95ad1Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
329792e95ad1Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
329892e95ad1Smrgdnl
329992e95ad1Smrgdnl Except as contained in this notice, the name of the copyright holders shall
330092e95ad1Smrgdnl not be used in advertising or otherwise to promote the sale, use or
330192e95ad1Smrgdnl other dealings in this Software without prior written authorization
330292e95ad1Smrgdnl from the copyright holders.
330392e95ad1Smrgdnl
330411a95ff3Smrg
330592e95ad1Smrg# XORG_RELEASE_VERSION
330692e95ad1Smrg# --------------------
330792e95ad1Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
330811a95ff3Smrg
330992e95ad1SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
331092e95ad1Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
331192e95ad1Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
331292e95ad1Smrg		[Major version of this package])
331392e95ad1Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
331492e95ad1Smrg	if test "x$PVM" = "x"; then
331592e95ad1Smrg		PVM="0"
331692e95ad1Smrg	fi
331792e95ad1Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
331892e95ad1Smrg		[$PVM],
331992e95ad1Smrg		[Minor version of this package])
332092e95ad1Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
332192e95ad1Smrg	if test "x$PVP" = "x"; then
332292e95ad1Smrg		PVP="0"
332392e95ad1Smrg	fi
332492e95ad1Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
332592e95ad1Smrg		[$PVP],
332692e95ad1Smrg		[Patch version of this package])
332792e95ad1Smrg])
332811a95ff3Smrg
332992e95ad1Smrg# XORG_CHANGELOG()
333092e95ad1Smrg# ----------------
333192e95ad1Smrg# Minimum version: 1.2.0
333292e95ad1Smrg#
333392e95ad1Smrg# Defines the variable CHANGELOG_CMD as the command to generate
333492e95ad1Smrg# ChangeLog from git.
333592e95ad1Smrg#
333692e95ad1Smrg#
333792e95ad1SmrgAC_DEFUN([XORG_CHANGELOG], [
333892e95ad1SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
333992e95ad1Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
334092e95ad1Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
334192e95ad1Smrgtouch \$(top_srcdir)/ChangeLog; \
334292e95ad1Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
334392e95ad1SmrgAC_SUBST([CHANGELOG_CMD])
334492e95ad1Smrg]) # XORG_CHANGELOG
3345efda2da8Smrg
3346