199c4c48aSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
28a355152Smrg
399c4c48aSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
48108eb18Smrg
58108eb18Smrg# This file is free software; the Free Software Foundation
68108eb18Smrg# gives unlimited permission to copy and/or distribute it,
78108eb18Smrg# with or without modifications, as long as this notice is preserved.
88108eb18Smrg
98108eb18Smrg# This program is distributed in the hope that it will be useful,
108108eb18Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
118108eb18Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
128108eb18Smrg# PARTICULAR PURPOSE.
138108eb18Smrg
148a355152Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
151a650d1eSmrgm4_ifndef([AC_AUTOCONF_VERSION],
161a650d1eSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
178d1e6323Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
188d1e6323Smrg[m4_warning([this file was generated for autoconf 2.72.
191a650d1eSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
201a650d1eSmrgIf you have problems, you may need to regenerate the build system entirely.
218a355152SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
228108eb18Smrg
2399c4c48aSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2499c4c48aSmrg#
2599c4c48aSmrg# This file is free software; the Free Software Foundation
2699c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
2799c4c48aSmrg# with or without modifications, as long as this notice is preserved.
288a355152Smrg
2999c4c48aSmrg# AM_AUTOMAKE_VERSION(VERSION)
3099c4c48aSmrg# ----------------------------
3199c4c48aSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3299c4c48aSmrg# generated from the m4 files accompanying Automake X.Y.
3399c4c48aSmrg# (This private macro should not be called outside this file.)
3499c4c48aSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3599c4c48aSmrg[am__api_version='1.16'
3699c4c48aSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3799c4c48aSmrgdnl require some minimum version.  Point them to the right macro.
3899c4c48aSmrgm4_if([$1], [1.16.5], [],
3999c4c48aSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4099c4c48aSmrg])
418a355152Smrg
4299c4c48aSmrg# _AM_AUTOCONF_VERSION(VERSION)
4399c4c48aSmrg# -----------------------------
4499c4c48aSmrg# aclocal traces this macro to find the Autoconf version.
4599c4c48aSmrg# This is a private macro too.  Using m4_define simplifies
4699c4c48aSmrg# the logic in aclocal, which can simply ignore this definition.
4799c4c48aSmrgm4_define([_AM_AUTOCONF_VERSION], [])
488108eb18Smrg
4999c4c48aSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5099c4c48aSmrg# -------------------------------
5199c4c48aSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5299c4c48aSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5399c4c48aSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5499c4c48aSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5599c4c48aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
5699c4c48aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5799c4c48aSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
585977a007Smrg
5999c4c48aSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
601a650d1eSmrg
6199c4c48aSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6299c4c48aSmrg#
6399c4c48aSmrg# This file is free software; the Free Software Foundation
6499c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
6599c4c48aSmrg# with or without modifications, as long as this notice is preserved.
668108eb18Smrg
6799c4c48aSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6899c4c48aSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6999c4c48aSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7099c4c48aSmrg#
7199c4c48aSmrg# Of course, Automake must honor this variable whenever it calls a
7299c4c48aSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7399c4c48aSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7499c4c48aSmrg# depending on how configure is run.  This is pretty annoying, since
7599c4c48aSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7699c4c48aSmrg# source directory, any form will work fine, but in subdirectories a
7799c4c48aSmrg# relative path needs to be adjusted first.
7899c4c48aSmrg#
7999c4c48aSmrg# $ac_aux_dir/missing
8099c4c48aSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8199c4c48aSmrg# $top_srcdir/$ac_aux_dir/missing
8299c4c48aSmrg#    fails if $ac_aux_dir is absolute,
8399c4c48aSmrg#    fails when called from a subdirectory in a VPATH build with
8499c4c48aSmrg#          a relative $ac_aux_dir
8599c4c48aSmrg#
8699c4c48aSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8799c4c48aSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
8899c4c48aSmrg# harmless because $srcdir is '.', but things will broke when you
8999c4c48aSmrg# start a VPATH build or use an absolute $srcdir.
9099c4c48aSmrg#
9199c4c48aSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9299c4c48aSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9399c4c48aSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9499c4c48aSmrg# and then we would define $MISSING as
9599c4c48aSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9699c4c48aSmrg# This will work as long as MISSING is not called from configure, because
9799c4c48aSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9899c4c48aSmrg# However there are other variables, like CC, which are often used in
9999c4c48aSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10099c4c48aSmrg#
10199c4c48aSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10299c4c48aSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10399c4c48aSmrg# configured tree to be moved without reconfiguration.
1048108eb18Smrg
10599c4c48aSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10699c4c48aSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10799c4c48aSmrg# Expand $ac_aux_dir to an absolute path.
10899c4c48aSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10999c4c48aSmrg])
1108108eb18Smrg
11199c4c48aSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1128108eb18Smrg
11399c4c48aSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11499c4c48aSmrg#
11599c4c48aSmrg# This file is free software; the Free Software Foundation
11699c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
11799c4c48aSmrg# with or without modifications, as long as this notice is preserved.
1185977a007Smrg
11999c4c48aSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12099c4c48aSmrg# -------------------------------------
12199c4c48aSmrg# Define a conditional.
12299c4c48aSmrgAC_DEFUN([AM_CONDITIONAL],
12399c4c48aSmrg[AC_PREREQ([2.52])dnl
12499c4c48aSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12599c4c48aSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12699c4c48aSmrgAC_SUBST([$1_TRUE])dnl
12799c4c48aSmrgAC_SUBST([$1_FALSE])dnl
12899c4c48aSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12999c4c48aSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13099c4c48aSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13199c4c48aSmrgif $2; then
13299c4c48aSmrg  $1_TRUE=
13399c4c48aSmrg  $1_FALSE='#'
13499c4c48aSmrgelse
13599c4c48aSmrg  $1_TRUE='#'
13699c4c48aSmrg  $1_FALSE=
13799c4c48aSmrgfi
13899c4c48aSmrgAC_CONFIG_COMMANDS_PRE(
13999c4c48aSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14099c4c48aSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14199c4c48aSmrgUsually this means the macro was only invoked conditionally.]])
14299c4c48aSmrgfi])])
1438108eb18Smrg
14499c4c48aSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14599c4c48aSmrg#
14699c4c48aSmrg# This file is free software; the Free Software Foundation
14799c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
14899c4c48aSmrg# with or without modifications, as long as this notice is preserved.
1498108eb18Smrg
1508108eb18Smrg
15199c4c48aSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15299c4c48aSmrg# written in clear, in which case automake, when reading aclocal.m4,
15399c4c48aSmrg# will think it sees a *use*, and therefore will trigger all it's
15499c4c48aSmrg# C support machinery.  Also note that it means that autoscan, seeing
15599c4c48aSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1568108eb18Smrg
1578108eb18Smrg
15899c4c48aSmrg# _AM_DEPENDENCIES(NAME)
15999c4c48aSmrg# ----------------------
16099c4c48aSmrg# See how the compiler implements dependency checking.
16199c4c48aSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16299c4c48aSmrg# We try a few techniques and use that to set a single cache variable.
16399c4c48aSmrg#
16499c4c48aSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16599c4c48aSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16699c4c48aSmrg# dependency, and given that the user is not expected to run this macro,
16799c4c48aSmrg# just rely on AC_PROG_CC.
16899c4c48aSmrgAC_DEFUN([_AM_DEPENDENCIES],
16999c4c48aSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17099c4c48aSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17199c4c48aSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17299c4c48aSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1738108eb18Smrg
17499c4c48aSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17599c4c48aSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17699c4c48aSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17799c4c48aSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17899c4c48aSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17999c4c48aSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18099c4c48aSmrg                    [depcc="$$1"   am_compiler_list=])
1818108eb18Smrg
18299c4c48aSmrgAC_CACHE_CHECK([dependency style of $depcc],
18399c4c48aSmrg               [am_cv_$1_dependencies_compiler_type],
18499c4c48aSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18599c4c48aSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
18699c4c48aSmrg  # making bogus files that we don't know about and never remove.  For
18799c4c48aSmrg  # instance it was reported that on HP-UX the gcc test will end up
18899c4c48aSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18999c4c48aSmrg  # in D".
19099c4c48aSmrg  rm -rf conftest.dir
19199c4c48aSmrg  mkdir conftest.dir
19299c4c48aSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19399c4c48aSmrg  # using a relative directory.
19499c4c48aSmrg  cp "$am_depcomp" conftest.dir
19599c4c48aSmrg  cd conftest.dir
19699c4c48aSmrg  # We will build objects and dependencies in a subdirectory because
19799c4c48aSmrg  # it helps to detect inapplicable dependency modes.  For instance
19899c4c48aSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19999c4c48aSmrg  # side effect of compilation, but ICC will put the dependencies in
20099c4c48aSmrg  # the current directory while Tru64 will put them in the object
20199c4c48aSmrg  # directory.
20299c4c48aSmrg  mkdir sub
2038108eb18Smrg
20499c4c48aSmrg  am_cv_$1_dependencies_compiler_type=none
20599c4c48aSmrg  if test "$am_compiler_list" = ""; then
20699c4c48aSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20799c4c48aSmrg  fi
20899c4c48aSmrg  am__universal=false
20999c4c48aSmrg  m4_case([$1], [CC],
21099c4c48aSmrg    [case " $depcc " in #(
21199c4c48aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21299c4c48aSmrg     esac],
21399c4c48aSmrg    [CXX],
21499c4c48aSmrg    [case " $depcc " in #(
21599c4c48aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21699c4c48aSmrg     esac])
2178108eb18Smrg
21899c4c48aSmrg  for depmode in $am_compiler_list; do
21999c4c48aSmrg    # Setup a source with many dependencies, because some compilers
22099c4c48aSmrg    # like to wrap large dependency lists on column 80 (with \), and
22199c4c48aSmrg    # we should not choose a depcomp mode which is confused by this.
22299c4c48aSmrg    #
22399c4c48aSmrg    # We need to recreate these files for each test, as the compiler may
22499c4c48aSmrg    # overwrite some of them when testing with obscure command lines.
22599c4c48aSmrg    # This happens at least with the AIX C compiler.
22699c4c48aSmrg    : > sub/conftest.c
22799c4c48aSmrg    for i in 1 2 3 4 5 6; do
22899c4c48aSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22999c4c48aSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23099c4c48aSmrg      # Solaris 10 /bin/sh.
23199c4c48aSmrg      echo '/* dummy */' > sub/conftst$i.h
23299c4c48aSmrg    done
23399c4c48aSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2348108eb18Smrg
23599c4c48aSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23699c4c48aSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23799c4c48aSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23899c4c48aSmrg    # versions had trouble with output in subdirs.
23999c4c48aSmrg    am__obj=sub/conftest.${OBJEXT-o}
24099c4c48aSmrg    am__minus_obj="-o $am__obj"
24199c4c48aSmrg    case $depmode in
24299c4c48aSmrg    gcc)
24399c4c48aSmrg      # This depmode causes a compiler race in universal mode.
24499c4c48aSmrg      test "$am__universal" = false || continue
24599c4c48aSmrg      ;;
24699c4c48aSmrg    nosideeffect)
24799c4c48aSmrg      # After this tag, mechanisms are not by side-effect, so they'll
24899c4c48aSmrg      # only be used when explicitly requested.
24999c4c48aSmrg      if test "x$enable_dependency_tracking" = xyes; then
25099c4c48aSmrg	continue
25199c4c48aSmrg      else
25299c4c48aSmrg	break
25399c4c48aSmrg      fi
25499c4c48aSmrg      ;;
25599c4c48aSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25699c4c48aSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
25799c4c48aSmrg      # not run yet.  These depmodes are late enough in the game, and
25899c4c48aSmrg      # so weak that their functioning should not be impacted.
25999c4c48aSmrg      am__obj=conftest.${OBJEXT-o}
26099c4c48aSmrg      am__minus_obj=
26199c4c48aSmrg      ;;
26299c4c48aSmrg    none) break ;;
26399c4c48aSmrg    esac
26499c4c48aSmrg    if depmode=$depmode \
26599c4c48aSmrg       source=sub/conftest.c object=$am__obj \
26699c4c48aSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26799c4c48aSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26899c4c48aSmrg         >/dev/null 2>conftest.err &&
26999c4c48aSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27099c4c48aSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27199c4c48aSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27299c4c48aSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27399c4c48aSmrg      # icc doesn't choke on unknown options, it will just issue warnings
27499c4c48aSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
27599c4c48aSmrg      # that says an option was ignored or not supported.
27699c4c48aSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27799c4c48aSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27899c4c48aSmrg      # The diagnosis changed in icc 8.0:
27999c4c48aSmrg      #   icc: Command line remark: option '-MP' not supported
28099c4c48aSmrg      if (grep 'ignoring option' conftest.err ||
28199c4c48aSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28299c4c48aSmrg        am_cv_$1_dependencies_compiler_type=$depmode
28399c4c48aSmrg        break
28499c4c48aSmrg      fi
28599c4c48aSmrg    fi
28699c4c48aSmrg  done
2878108eb18Smrg
28899c4c48aSmrg  cd ..
28999c4c48aSmrg  rm -rf conftest.dir
29099c4c48aSmrgelse
29199c4c48aSmrg  am_cv_$1_dependencies_compiler_type=none
29299c4c48aSmrgfi
29399c4c48aSmrg])
29499c4c48aSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29599c4c48aSmrgAM_CONDITIONAL([am__fastdep$1], [
29699c4c48aSmrg  test "x$enable_dependency_tracking" != xno \
29799c4c48aSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29899c4c48aSmrg])
2998108eb18Smrg
3008a355152Smrg
30199c4c48aSmrg# AM_SET_DEPDIR
30299c4c48aSmrg# -------------
30399c4c48aSmrg# Choose a directory name for dependency files.
30499c4c48aSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30599c4c48aSmrgAC_DEFUN([AM_SET_DEPDIR],
30699c4c48aSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30799c4c48aSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30899c4c48aSmrg])
3098a355152Smrg
3108a355152Smrg
31199c4c48aSmrg# AM_DEP_TRACK
31299c4c48aSmrg# ------------
31399c4c48aSmrgAC_DEFUN([AM_DEP_TRACK],
31499c4c48aSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31599c4c48aSmrgAS_HELP_STRING(
31699c4c48aSmrg  [--enable-dependency-tracking],
31799c4c48aSmrg  [do not reject slow dependency extractors])
31899c4c48aSmrgAS_HELP_STRING(
31999c4c48aSmrg  [--disable-dependency-tracking],
32099c4c48aSmrg  [speeds up one-time build])])
32199c4c48aSmrgif test "x$enable_dependency_tracking" != xno; then
32299c4c48aSmrg  am_depcomp="$ac_aux_dir/depcomp"
32399c4c48aSmrg  AMDEPBACKSLASH='\'
32499c4c48aSmrg  am__nodep='_no'
32599c4c48aSmrgfi
32699c4c48aSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32799c4c48aSmrgAC_SUBST([AMDEPBACKSLASH])dnl
32899c4c48aSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32999c4c48aSmrgAC_SUBST([am__nodep])dnl
33099c4c48aSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33199c4c48aSmrg])
3328a355152Smrg
33399c4c48aSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3348a355152Smrg
33599c4c48aSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3368a355152Smrg#
33799c4c48aSmrg# This file is free software; the Free Software Foundation
33899c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
33999c4c48aSmrg# with or without modifications, as long as this notice is preserved.
3408a355152Smrg
34199c4c48aSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34299c4c48aSmrg# ------------------------------
34399c4c48aSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34499c4c48aSmrg[{
34599c4c48aSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
34699c4c48aSmrg  # are listed without --file.  Let's play safe and only enable the eval
34799c4c48aSmrg  # if we detect the quoting.
34899c4c48aSmrg  # TODO: see whether this extra hack can be removed once we start
34999c4c48aSmrg  # requiring Autoconf 2.70 or later.
35099c4c48aSmrg  AS_CASE([$CONFIG_FILES],
35199c4c48aSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
35299c4c48aSmrg          [*], [set x $CONFIG_FILES])
35399c4c48aSmrg  shift
35499c4c48aSmrg  # Used to flag and report bootstrapping failures.
35599c4c48aSmrg  am_rc=0
35699c4c48aSmrg  for am_mf
35799c4c48aSmrg  do
35899c4c48aSmrg    # Strip MF so we end up with the name of the file.
35999c4c48aSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36099c4c48aSmrg    # Check whether this is an Automake generated Makefile which includes
36199c4c48aSmrg    # dependency-tracking related rules and includes.
36299c4c48aSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36399c4c48aSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
36499c4c48aSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36599c4c48aSmrg      || continue
36699c4c48aSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36799c4c48aSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36899c4c48aSmrg    AM_RUN_LOG([cd "$am_dirpart" \
36999c4c48aSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37099c4c48aSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37199c4c48aSmrg  done
37299c4c48aSmrg  if test $am_rc -ne 0; then
37399c4c48aSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37499c4c48aSmrg    for automatic dependency tracking.  If GNU make was not used, consider
37599c4c48aSmrg    re-running the configure script with MAKE="gmake" (or whatever is
37699c4c48aSmrg    necessary).  You can also try re-running configure with the
37799c4c48aSmrg    '--disable-dependency-tracking' option to at least be able to build
37899c4c48aSmrg    the package (albeit without support for automatic dependency tracking).])
37999c4c48aSmrg  fi
38099c4c48aSmrg  AS_UNSET([am_dirpart])
38199c4c48aSmrg  AS_UNSET([am_filepart])
38299c4c48aSmrg  AS_UNSET([am_mf])
38399c4c48aSmrg  AS_UNSET([am_rc])
38499c4c48aSmrg  rm -f conftest-deps.mk
38599c4c48aSmrg}
38699c4c48aSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3878108eb18Smrg
3888108eb18Smrg
38999c4c48aSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39099c4c48aSmrg# -----------------------------
39199c4c48aSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3928a355152Smrg#
39399c4c48aSmrg# This code is only required when automatic dependency tracking is enabled.
39499c4c48aSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39599c4c48aSmrg# order to bootstrap the dependency handling code.
39699c4c48aSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39799c4c48aSmrg[AC_CONFIG_COMMANDS([depfiles],
39899c4c48aSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39999c4c48aSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4008108eb18Smrg
40199c4c48aSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4028108eb18Smrg
40399c4c48aSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40499c4c48aSmrg#
40599c4c48aSmrg# This file is free software; the Free Software Foundation
40699c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
40799c4c48aSmrg# with or without modifications, as long as this notice is preserved.
4088108eb18Smrg
40999c4c48aSmrg# This macro actually does too much.  Some checks are only needed if
41099c4c48aSmrg# your package does certain things.  But this isn't really a big deal.
4118108eb18Smrg
41299c4c48aSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41399c4c48aSmrgm4_define([AC_PROG_CC],
41499c4c48aSmrgm4_defn([AC_PROG_CC])
41599c4c48aSmrg[_AM_PROG_CC_C_O
41699c4c48aSmrg])
4178108eb18Smrg
41899c4c48aSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41999c4c48aSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42099c4c48aSmrg# -----------------------------------------------
42199c4c48aSmrg# The call with PACKAGE and VERSION arguments is the old style
42299c4c48aSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42399c4c48aSmrg# and VERSION should now be passed to AC_INIT and removed from
42499c4c48aSmrg# the call to AM_INIT_AUTOMAKE.
42599c4c48aSmrg# We support both call styles for the transition.  After
42699c4c48aSmrg# the next Automake release, Autoconf can make the AC_INIT
42799c4c48aSmrg# arguments mandatory, and then we can depend on a new Autoconf
42899c4c48aSmrg# release and drop the old call support.
42999c4c48aSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43099c4c48aSmrg[AC_PREREQ([2.65])dnl
43199c4c48aSmrgm4_ifdef([_$0_ALREADY_INIT],
43299c4c48aSmrg  [m4_fatal([$0 expanded multiple times
43399c4c48aSmrg]m4_defn([_$0_ALREADY_INIT]))],
43499c4c48aSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43599c4c48aSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43699c4c48aSmrgdnl the ones we care about.
43799c4c48aSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43899c4c48aSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43999c4c48aSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44099c4c48aSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44199c4c48aSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44299c4c48aSmrg  # is not polluted with repeated "-I."
44399c4c48aSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44499c4c48aSmrg  # test to see if srcdir already configured
44599c4c48aSmrg  if test -f $srcdir/config.status; then
44699c4c48aSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44799c4c48aSmrg  fi
4488a355152Smrgfi
4498108eb18Smrg
45099c4c48aSmrg# test whether we have cygpath
45199c4c48aSmrgif test -z "$CYGPATH_W"; then
45299c4c48aSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45399c4c48aSmrg    CYGPATH_W='cygpath -w'
45499c4c48aSmrg  else
45599c4c48aSmrg    CYGPATH_W=echo
45699c4c48aSmrg  fi
4571a650d1eSmrgfi
45899c4c48aSmrgAC_SUBST([CYGPATH_W])
4591a650d1eSmrg
46099c4c48aSmrg# Define the identity of the package.
46199c4c48aSmrgdnl Distinguish between old-style and new-style calls.
46299c4c48aSmrgm4_ifval([$2],
46399c4c48aSmrg[AC_DIAGNOSE([obsolete],
46499c4c48aSmrg             [$0: two- and three-arguments forms are deprecated.])
46599c4c48aSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46699c4c48aSmrg AC_SUBST([PACKAGE], [$1])dnl
46799c4c48aSmrg AC_SUBST([VERSION], [$2])],
46899c4c48aSmrg[_AM_SET_OPTIONS([$1])dnl
46999c4c48aSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47099c4c48aSmrgm4_if(
47199c4c48aSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47299c4c48aSmrg  [ok:ok],,
47399c4c48aSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47499c4c48aSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47599c4c48aSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4761a650d1eSmrg
47799c4c48aSmrg_AM_IF_OPTION([no-define],,
47899c4c48aSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47999c4c48aSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4801a650d1eSmrg
48199c4c48aSmrg# Some tools Automake needs.
48299c4c48aSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48399c4c48aSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48499c4c48aSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48599c4c48aSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48699c4c48aSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48799c4c48aSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48899c4c48aSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48999c4c48aSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49099c4c48aSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49199c4c48aSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49299c4c48aSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
49399c4c48aSmrg# dies out for good.  For more background, see:
49499c4c48aSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49599c4c48aSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49699c4c48aSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49799c4c48aSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
49899c4c48aSmrg# system "awk" is bad on some platforms.
49999c4c48aSmrgAC_REQUIRE([AC_PROG_AWK])dnl
50099c4c48aSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50199c4c48aSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50299c4c48aSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50399c4c48aSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50499c4c48aSmrg			     [_AM_PROG_TAR([v7])])])
50599c4c48aSmrg_AM_IF_OPTION([no-dependencies],,
50699c4c48aSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50799c4c48aSmrg		  [_AM_DEPENDENCIES([CC])],
50899c4c48aSmrg		  [m4_define([AC_PROG_CC],
50999c4c48aSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51099c4c48aSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51199c4c48aSmrg		  [_AM_DEPENDENCIES([CXX])],
51299c4c48aSmrg		  [m4_define([AC_PROG_CXX],
51399c4c48aSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51499c4c48aSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51599c4c48aSmrg		  [_AM_DEPENDENCIES([OBJC])],
51699c4c48aSmrg		  [m4_define([AC_PROG_OBJC],
51799c4c48aSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51899c4c48aSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51999c4c48aSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
52099c4c48aSmrg		  [m4_define([AC_PROG_OBJCXX],
52199c4c48aSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52299c4c48aSmrg])
52399c4c48aSmrg# Variables for tags utilities; see am/tags.am
52499c4c48aSmrgif test -z "$CTAGS"; then
52599c4c48aSmrg  CTAGS=ctags
52699c4c48aSmrgfi
52799c4c48aSmrgAC_SUBST([CTAGS])
52899c4c48aSmrgif test -z "$ETAGS"; then
52999c4c48aSmrg  ETAGS=etags
53099c4c48aSmrgfi
53199c4c48aSmrgAC_SUBST([ETAGS])
53299c4c48aSmrgif test -z "$CSCOPE"; then
53399c4c48aSmrg  CSCOPE=cscope
53499c4c48aSmrgfi
53599c4c48aSmrgAC_SUBST([CSCOPE])
5361a650d1eSmrg
53799c4c48aSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53899c4c48aSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
53999c4c48aSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54099c4c48aSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54199c4c48aSmrgAC_CONFIG_COMMANDS_PRE(dnl
54299c4c48aSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54399c4c48aSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5441a650d1eSmrg
54599c4c48aSmrg# POSIX will say in a future version that running "rm -f" with no argument
54699c4c48aSmrg# is OK; and we want to be able to make that assumption in our Makefile
54799c4c48aSmrg# recipes.  So use an aggressive probe to check that the usage we want is
54899c4c48aSmrg# actually supported "in the wild" to an acceptable degree.
54999c4c48aSmrg# See automake bug#10828.
55099c4c48aSmrg# To make any issue more visible, cause the running configure to be aborted
55199c4c48aSmrg# by default if the 'rm' program in use doesn't match our expectations; the
55299c4c48aSmrg# user can still override this though.
55399c4c48aSmrgif rm -f && rm -fr && rm -rf; then : OK; else
55499c4c48aSmrg  cat >&2 <<'END'
55599c4c48aSmrgOops!
5561a650d1eSmrg
55799c4c48aSmrgYour 'rm' program seems unable to run without file operands specified
55899c4c48aSmrgon the command line, even when the '-f' option is present.  This is contrary
55999c4c48aSmrgto the behaviour of most rm programs out there, and not conforming with
56099c4c48aSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5611a650d1eSmrg
56299c4c48aSmrgPlease tell bug-automake@gnu.org about your system, including the value
56399c4c48aSmrgof your $PATH and any error possibly output before this message.  This
56499c4c48aSmrgcan help us improve future automake versions.
5651a650d1eSmrg
56699c4c48aSmrgEND
56799c4c48aSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56899c4c48aSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56999c4c48aSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57099c4c48aSmrg    echo >&2
57199c4c48aSmrg  else
57299c4c48aSmrg    cat >&2 <<'END'
57399c4c48aSmrgAborting the configuration process, to ensure you take notice of the issue.
5741a650d1eSmrg
57599c4c48aSmrgYou can download and install GNU coreutils to get an 'rm' implementation
57699c4c48aSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
5775977a007Smrg
57899c4c48aSmrgIf you want to complete the configuration process using your problematic
57999c4c48aSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58099c4c48aSmrgto "yes", and re-run configure.
5818a355152Smrg
58299c4c48aSmrgEND
58399c4c48aSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58499c4c48aSmrg  fi
5851a650d1eSmrgfi
58699c4c48aSmrgdnl The trailing newline in this macro's definition is deliberate, for
58799c4c48aSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58899c4c48aSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58999c4c48aSmrg])
5901a650d1eSmrg
59199c4c48aSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59299c4c48aSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59399c4c48aSmrgdnl mangled by Autoconf and run in a shell conditional statement.
59499c4c48aSmrgm4_define([_AC_COMPILER_EXEEXT],
59599c4c48aSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5968108eb18Smrg
59799c4c48aSmrg# When config.status generates a header, we must update the stamp-h file.
59899c4c48aSmrg# This file resides in the same directory as the config header
59999c4c48aSmrg# that is generated.  The stamp files are numbered to have different names.
6008108eb18Smrg
60199c4c48aSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60299c4c48aSmrg# loop where config.status creates the headers, so we can generate
60399c4c48aSmrg# our stamp files there.
60499c4c48aSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60599c4c48aSmrg[# Compute $1's index in $config_headers.
60699c4c48aSmrg_am_arg=$1
60799c4c48aSmrg_am_stamp_count=1
60899c4c48aSmrgfor _am_header in $config_headers :; do
60999c4c48aSmrg  case $_am_header in
61099c4c48aSmrg    $_am_arg | $_am_arg:* )
61199c4c48aSmrg      break ;;
61299c4c48aSmrg    * )
61399c4c48aSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61499c4c48aSmrg  esac
61599c4c48aSmrgdone
61699c4c48aSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6178a355152Smrg
61899c4c48aSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61999c4c48aSmrg#
62099c4c48aSmrg# This file is free software; the Free Software Foundation
62199c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
62299c4c48aSmrg# with or without modifications, as long as this notice is preserved.
62399c4c48aSmrg
62499c4c48aSmrg# AM_PROG_INSTALL_SH
62599c4c48aSmrg# ------------------
62699c4c48aSmrg# Define $install_sh.
62799c4c48aSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62899c4c48aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62999c4c48aSmrgif test x"${install_sh+set}" != xset; then
63099c4c48aSmrg  case $am_aux_dir in
63199c4c48aSmrg  *\ * | *\	*)
63299c4c48aSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63399c4c48aSmrg  *)
63499c4c48aSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63599c4c48aSmrg  esac
63699c4c48aSmrgfi
63799c4c48aSmrgAC_SUBST([install_sh])])
63899c4c48aSmrg
63999c4c48aSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64099c4c48aSmrg#
64199c4c48aSmrg# This file is free software; the Free Software Foundation
64299c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
64399c4c48aSmrg# with or without modifications, as long as this notice is preserved.
64499c4c48aSmrg
64599c4c48aSmrg# Check whether the underlying file-system supports filenames
64699c4c48aSmrg# with a leading dot.  For instance MS-DOS doesn't.
64799c4c48aSmrgAC_DEFUN([AM_SET_LEADING_DOT],
64899c4c48aSmrg[rm -rf .tst 2>/dev/null
64999c4c48aSmrgmkdir .tst 2>/dev/null
65099c4c48aSmrgif test -d .tst; then
65199c4c48aSmrg  am__leading_dot=.
6521a650d1eSmrgelse
65399c4c48aSmrg  am__leading_dot=_
6541a650d1eSmrgfi
65599c4c48aSmrgrmdir .tst 2>/dev/null
65699c4c48aSmrgAC_SUBST([am__leading_dot])])
6571a650d1eSmrg
65899c4c48aSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6591a650d1eSmrg
66099c4c48aSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66199c4c48aSmrg#
66299c4c48aSmrg# This file is free software; the Free Software Foundation
66399c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
66499c4c48aSmrg# with or without modifications, as long as this notice is preserved.
6651a650d1eSmrg
66699c4c48aSmrg# AM_MAKE_INCLUDE()
66799c4c48aSmrg# -----------------
66899c4c48aSmrg# Check whether make has an 'include' directive that can support all
66999c4c48aSmrg# the idioms we need for our automatic dependency tracking code.
67099c4c48aSmrgAC_DEFUN([AM_MAKE_INCLUDE],
67199c4c48aSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
67299c4c48aSmrgcat > confinc.mk << 'END'
67399c4c48aSmrgam__doit:
67499c4c48aSmrg	@echo this is the am__doit target >confinc.out
67599c4c48aSmrg.PHONY: am__doit
67699c4c48aSmrgEND
67799c4c48aSmrgam__include="#"
67899c4c48aSmrgam__quote=
67999c4c48aSmrg# BSD make does it like this.
68099c4c48aSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
68199c4c48aSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
68299c4c48aSmrgecho 'include confinc.mk # ignored' > confmf.GNU
68399c4c48aSmrg_am_result=no
68499c4c48aSmrgfor s in GNU BSD; do
68599c4c48aSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
68699c4c48aSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
68799c4c48aSmrg      ['0:this is the am__doit target'],
68899c4c48aSmrg      [AS_CASE([$s],
68999c4c48aSmrg          [BSD], [am__include='.include' am__quote='"'],
69099c4c48aSmrg          [am__include='include' am__quote=''])])
69199c4c48aSmrg  if test "$am__include" != "#"; then
69299c4c48aSmrg    _am_result="yes ($s style)"
69399c4c48aSmrg    break
69499c4c48aSmrg  fi
69599c4c48aSmrgdone
69699c4c48aSmrgrm -f confinc.* confmf.*
69799c4c48aSmrgAC_MSG_RESULT([${_am_result}])
69899c4c48aSmrgAC_SUBST([am__include])])
69999c4c48aSmrgAC_SUBST([am__quote])])
7001a650d1eSmrg
70199c4c48aSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7021a650d1eSmrg
70399c4c48aSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
7041a650d1eSmrg#
70599c4c48aSmrg# This file is free software; the Free Software Foundation
70699c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
70799c4c48aSmrg# with or without modifications, as long as this notice is preserved.
7088108eb18Smrg
70999c4c48aSmrg# AM_MISSING_PROG(NAME, PROGRAM)
71099c4c48aSmrg# ------------------------------
71199c4c48aSmrgAC_DEFUN([AM_MISSING_PROG],
71299c4c48aSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71399c4c48aSmrg$1=${$1-"${am_missing_run}$2"}
71499c4c48aSmrgAC_SUBST($1)])
7158108eb18Smrg
71699c4c48aSmrg# AM_MISSING_HAS_RUN
71799c4c48aSmrg# ------------------
71899c4c48aSmrg# Define MISSING if not defined so far and test if it is modern enough.
71999c4c48aSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72099c4c48aSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72199c4c48aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72299c4c48aSmrgAC_REQUIRE_AUX_FILE([missing])dnl
72399c4c48aSmrgif test x"${MISSING+set}" != xset; then
72499c4c48aSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
7251a650d1eSmrgfi
72699c4c48aSmrg# Use eval to expand $SHELL
72799c4c48aSmrgif eval "$MISSING --is-lightweight"; then
72899c4c48aSmrg  am_missing_run="$MISSING "
72999c4c48aSmrgelse
73099c4c48aSmrg  am_missing_run=
73199c4c48aSmrg  AC_MSG_WARN(['missing' script is too old or missing])
7328108eb18Smrgfi
73399c4c48aSmrg])
7348108eb18Smrg
73599c4c48aSmrg# Helper functions for option handling.                     -*- Autoconf -*-
7368108eb18Smrg
73799c4c48aSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73899c4c48aSmrg#
73999c4c48aSmrg# This file is free software; the Free Software Foundation
74099c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
74199c4c48aSmrg# with or without modifications, as long as this notice is preserved.
7425977a007Smrg
74399c4c48aSmrg# _AM_MANGLE_OPTION(NAME)
74499c4c48aSmrg# -----------------------
74599c4c48aSmrgAC_DEFUN([_AM_MANGLE_OPTION],
74699c4c48aSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7478108eb18Smrg
74899c4c48aSmrg# _AM_SET_OPTION(NAME)
74999c4c48aSmrg# --------------------
75099c4c48aSmrg# Set option NAME.  Presently that only means defining a flag for this option.
75199c4c48aSmrgAC_DEFUN([_AM_SET_OPTION],
75299c4c48aSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7538108eb18Smrg
75499c4c48aSmrg# _AM_SET_OPTIONS(OPTIONS)
75599c4c48aSmrg# ------------------------
75699c4c48aSmrg# OPTIONS is a space-separated list of Automake options.
75799c4c48aSmrgAC_DEFUN([_AM_SET_OPTIONS],
75899c4c48aSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75999c4c48aSmrg
76099c4c48aSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76199c4c48aSmrg# -------------------------------------------
76299c4c48aSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76399c4c48aSmrgAC_DEFUN([_AM_IF_OPTION],
76499c4c48aSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76599c4c48aSmrg
76699c4c48aSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
7678a355152Smrg#
76899c4c48aSmrg# This file is free software; the Free Software Foundation
76999c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
77099c4c48aSmrg# with or without modifications, as long as this notice is preserved.
7718108eb18Smrg
77299c4c48aSmrg# _AM_PROG_CC_C_O
77399c4c48aSmrg# ---------------
77499c4c48aSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77599c4c48aSmrg# to automatically call this.
77699c4c48aSmrgAC_DEFUN([_AM_PROG_CC_C_O],
77799c4c48aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77899c4c48aSmrgAC_REQUIRE_AUX_FILE([compile])dnl
77999c4c48aSmrgAC_LANG_PUSH([C])dnl
78099c4c48aSmrgAC_CACHE_CHECK(
78199c4c48aSmrg  [whether $CC understands -c and -o together],
78299c4c48aSmrg  [am_cv_prog_cc_c_o],
78399c4c48aSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78499c4c48aSmrg  # Make sure it works both with $CC and with simple cc.
78599c4c48aSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78699c4c48aSmrg  # compilers refuse to overwrite an existing .o file with -o,
78799c4c48aSmrg  # though they will create one.
78899c4c48aSmrg  am_cv_prog_cc_c_o=yes
78999c4c48aSmrg  for am_i in 1 2; do
79099c4c48aSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79199c4c48aSmrg         && test -f conftest2.$ac_objext; then
79299c4c48aSmrg      : OK
79399c4c48aSmrg    else
79499c4c48aSmrg      am_cv_prog_cc_c_o=no
79599c4c48aSmrg      break
79699c4c48aSmrg    fi
79799c4c48aSmrg  done
79899c4c48aSmrg  rm -f core conftest*
79999c4c48aSmrg  unset am_i])
80099c4c48aSmrgif test "$am_cv_prog_cc_c_o" != yes; then
80199c4c48aSmrg   # Losing compiler, so override with the script.
80299c4c48aSmrg   # FIXME: It is wrong to rewrite CC.
80399c4c48aSmrg   # But if we don't then we get into trouble of one sort or another.
80499c4c48aSmrg   # A longer-term fix would be to have automake use am__CC in this case,
80599c4c48aSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80699c4c48aSmrg   CC="$am_aux_dir/compile $CC"
8071a650d1eSmrgfi
80899c4c48aSmrgAC_LANG_POP([C])])
8098108eb18Smrg
81099c4c48aSmrg# For backward compatibility.
81199c4c48aSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8121a650d1eSmrg
81399c4c48aSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
8148108eb18Smrg#
81599c4c48aSmrg# This file is free software; the Free Software Foundation
81699c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
81799c4c48aSmrg# with or without modifications, as long as this notice is preserved.
8181a650d1eSmrg
81999c4c48aSmrg# AM_RUN_LOG(COMMAND)
82099c4c48aSmrg# -------------------
82199c4c48aSmrg# Run COMMAND, save the exit status in ac_status, and log it.
82299c4c48aSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82399c4c48aSmrgAC_DEFUN([AM_RUN_LOG],
82499c4c48aSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82599c4c48aSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82699c4c48aSmrg   ac_status=$?
82799c4c48aSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82899c4c48aSmrg   (exit $ac_status); }])
82999c4c48aSmrg
83099c4c48aSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83199c4c48aSmrg
83299c4c48aSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8331a650d1eSmrg#
83499c4c48aSmrg# This file is free software; the Free Software Foundation
83599c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
83699c4c48aSmrg# with or without modifications, as long as this notice is preserved.
8378108eb18Smrg
83899c4c48aSmrg# AM_SANITY_CHECK
83999c4c48aSmrg# ---------------
84099c4c48aSmrgAC_DEFUN([AM_SANITY_CHECK],
84199c4c48aSmrg[AC_MSG_CHECKING([whether build environment is sane])
84299c4c48aSmrg# Reject unsafe characters in $srcdir or the absolute working directory
84399c4c48aSmrg# name.  Accept space and tab only in the latter.
84499c4c48aSmrgam_lf='
84599c4c48aSmrg'
84699c4c48aSmrgcase `pwd` in
84799c4c48aSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84899c4c48aSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84999c4c48aSmrgesac
85099c4c48aSmrgcase $srcdir in
85199c4c48aSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85299c4c48aSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85399c4c48aSmrgesac
85499c4c48aSmrg
85599c4c48aSmrg# Do 'set' in a subshell so we don't clobber the current shell's
85699c4c48aSmrg# arguments.  Must try -L first in case configure is actually a
85799c4c48aSmrg# symlink; some systems play weird games with the mod time of symlinks
85899c4c48aSmrg# (eg FreeBSD returns the mod time of the symlink's containing
85999c4c48aSmrg# directory).
86099c4c48aSmrgif (
86199c4c48aSmrg   am_has_slept=no
86299c4c48aSmrg   for am_try in 1 2; do
86399c4c48aSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86499c4c48aSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86599c4c48aSmrg     if test "$[*]" = "X"; then
86699c4c48aSmrg	# -L didn't work.
86799c4c48aSmrg	set X `ls -t "$srcdir/configure" conftest.file`
86899c4c48aSmrg     fi
86999c4c48aSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87099c4c48aSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87199c4c48aSmrg
87299c4c48aSmrg	# If neither matched, then we have a broken ls.  This can happen
87399c4c48aSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87499c4c48aSmrg	# broken ls alias from the environment.  This has actually
87599c4c48aSmrg	# happened.  Such a system could not be considered "sane".
87699c4c48aSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87799c4c48aSmrg  alias in your environment])
87899c4c48aSmrg     fi
87999c4c48aSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88099c4c48aSmrg       break
88199c4c48aSmrg     fi
88299c4c48aSmrg     # Just in case.
88399c4c48aSmrg     sleep 1
88499c4c48aSmrg     am_has_slept=yes
88599c4c48aSmrg   done
88699c4c48aSmrg   test "$[2]" = conftest.file
88799c4c48aSmrg   )
88899c4c48aSmrgthen
88999c4c48aSmrg   # Ok.
89099c4c48aSmrg   :
8918a355152Smrgelse
89299c4c48aSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
89399c4c48aSmrgCheck your system clock])
8948a355152Smrgfi
89599c4c48aSmrgAC_MSG_RESULT([yes])
89699c4c48aSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89799c4c48aSmrg# generated files are strictly newer.
89899c4c48aSmrgam_sleep_pid=
89999c4c48aSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90099c4c48aSmrg  ( sleep 1 ) &
90199c4c48aSmrg  am_sleep_pid=$!
90299c4c48aSmrgfi
90399c4c48aSmrgAC_CONFIG_COMMANDS_PRE(
90499c4c48aSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90599c4c48aSmrg   if test -n "$am_sleep_pid"; then
90699c4c48aSmrg     # Hide warnings about reused PIDs.
90799c4c48aSmrg     wait $am_sleep_pid 2>/dev/null
90899c4c48aSmrg   fi
90999c4c48aSmrg   AC_MSG_RESULT([done])])
91099c4c48aSmrgrm -f conftest.file
91199c4c48aSmrg])
9128108eb18Smrg
91399c4c48aSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9145977a007Smrg#
91599c4c48aSmrg# This file is free software; the Free Software Foundation
91699c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
91799c4c48aSmrg# with or without modifications, as long as this notice is preserved.
9185977a007Smrg
91999c4c48aSmrg# AM_SILENT_RULES([DEFAULT])
92099c4c48aSmrg# --------------------------
92199c4c48aSmrg# Enable less verbose build rules; with the default set to DEFAULT
92299c4c48aSmrg# ("yes" being less verbose, "no" or empty being verbose).
92399c4c48aSmrgAC_DEFUN([AM_SILENT_RULES],
92499c4c48aSmrg[AC_ARG_ENABLE([silent-rules], [dnl
92599c4c48aSmrgAS_HELP_STRING(
92699c4c48aSmrg  [--enable-silent-rules],
92799c4c48aSmrg  [less verbose build output (undo: "make V=1")])
92899c4c48aSmrgAS_HELP_STRING(
92999c4c48aSmrg  [--disable-silent-rules],
93099c4c48aSmrg  [verbose build output (undo: "make V=0")])dnl
93199c4c48aSmrg])
93299c4c48aSmrgcase $enable_silent_rules in @%:@ (((
93399c4c48aSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
93499c4c48aSmrg   no) AM_DEFAULT_VERBOSITY=1;;
93599c4c48aSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93699c4c48aSmrgesac
93799c4c48aSmrgdnl
93899c4c48aSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93999c4c48aSmrgdnl do not support nested variable expansions.
94099c4c48aSmrgdnl See automake bug#9928 and bug#10237.
94199c4c48aSmrgam_make=${MAKE-make}
94299c4c48aSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94399c4c48aSmrg   [am_cv_make_support_nested_variables],
94499c4c48aSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94599c4c48aSmrgBAR0=false
94699c4c48aSmrgBAR1=true
94799c4c48aSmrgV=1
94899c4c48aSmrgam__doit:
94999c4c48aSmrg	@$(TRUE)
95099c4c48aSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95199c4c48aSmrg  am_cv_make_support_nested_variables=yes
9525977a007Smrgelse
95399c4c48aSmrg  am_cv_make_support_nested_variables=no
95499c4c48aSmrgfi])
95599c4c48aSmrgif test $am_cv_make_support_nested_variables = yes; then
95699c4c48aSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95799c4c48aSmrg  AM_V='$(V)'
95899c4c48aSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95999c4c48aSmrgelse
96099c4c48aSmrg  AM_V=$AM_DEFAULT_VERBOSITY
96199c4c48aSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9628a355152Smrgfi
96399c4c48aSmrgAC_SUBST([AM_V])dnl
96499c4c48aSmrgAM_SUBST_NOTMAKE([AM_V])dnl
96599c4c48aSmrgAC_SUBST([AM_DEFAULT_V])dnl
96699c4c48aSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96799c4c48aSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96899c4c48aSmrgAM_BACKSLASH='\'
96999c4c48aSmrgAC_SUBST([AM_BACKSLASH])dnl
97099c4c48aSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97199c4c48aSmrg])
9725977a007Smrg
97399c4c48aSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
9745977a007Smrg#
97599c4c48aSmrg# This file is free software; the Free Software Foundation
97699c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
97799c4c48aSmrg# with or without modifications, as long as this notice is preserved.
9785977a007Smrg
97999c4c48aSmrg# AM_PROG_INSTALL_STRIP
98099c4c48aSmrg# ---------------------
98199c4c48aSmrg# One issue with vendor 'install' (even GNU) is that you can't
98299c4c48aSmrg# specify the program used to strip binaries.  This is especially
98399c4c48aSmrg# annoying in cross-compiling environments, where the build's strip
98499c4c48aSmrg# is unlikely to handle the host's binaries.
98599c4c48aSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98699c4c48aSmrg# always use install-sh in "make install-strip", and initialize
98799c4c48aSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
98899c4c48aSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98999c4c48aSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99099c4c48aSmrg# Installed binaries are usually stripped using 'strip' when the user
99199c4c48aSmrg# run "make install-strip".  However 'strip' might not be the right
99299c4c48aSmrg# tool to use in cross-compilation environments, therefore Automake
99399c4c48aSmrg# will honor the 'STRIP' environment variable to overrule this program.
99499c4c48aSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99599c4c48aSmrgif test "$cross_compiling" != no; then
99699c4c48aSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
9978a355152Smrgfi
99899c4c48aSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99999c4c48aSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10001a650d1eSmrg
100199c4c48aSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
10021a650d1eSmrg#
100399c4c48aSmrg# This file is free software; the Free Software Foundation
100499c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
100599c4c48aSmrg# with or without modifications, as long as this notice is preserved.
10068108eb18Smrg
100799c4c48aSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
100899c4c48aSmrg# ---------------------------
100999c4c48aSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101099c4c48aSmrg# This macro is traced by Automake.
101199c4c48aSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10128108eb18Smrg
101399c4c48aSmrg# AM_SUBST_NOTMAKE(VARIABLE)
101499c4c48aSmrg# --------------------------
101599c4c48aSmrg# Public sister of _AM_SUBST_NOTMAKE.
101699c4c48aSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10178108eb18Smrg
101899c4c48aSmrg# Check how to create a tarball.                            -*- Autoconf -*-
10198108eb18Smrg
102099c4c48aSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
10218a355152Smrg#
102299c4c48aSmrg# This file is free software; the Free Software Foundation
102399c4c48aSmrg# gives unlimited permission to copy and/or distribute it,
102499c4c48aSmrg# with or without modifications, as long as this notice is preserved.
102599c4c48aSmrg
102699c4c48aSmrg# _AM_PROG_TAR(FORMAT)
102799c4c48aSmrg# --------------------
102899c4c48aSmrg# Check how to create a tarball in format FORMAT.
102999c4c48aSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10308a355152Smrg#
103199c4c48aSmrg# Substitute a variable $(am__tar) that is a command
103299c4c48aSmrg# writing to stdout a FORMAT-tarball containing the directory
103399c4c48aSmrg# $tardir.
103499c4c48aSmrg#     tardir=directory && $(am__tar) > result.tar
10358a355152Smrg#
103699c4c48aSmrg# Substitute a variable $(am__untar) that extract such
103799c4c48aSmrg# a tarball read from stdin.
103899c4c48aSmrg#     $(am__untar) < result.tar
10398a355152Smrg#
104099c4c48aSmrgAC_DEFUN([_AM_PROG_TAR],
104199c4c48aSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104299c4c48aSmrg# in the wild :-(  We should find a proper way to deprecate it ...
104399c4c48aSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10448108eb18Smrg
104599c4c48aSmrg# We'll loop over all known methods to create a tar archive until one works.
104699c4c48aSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10478108eb18Smrg
104899c4c48aSmrgm4_if([$1], [v7],
104999c4c48aSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10508108eb18Smrg
105199c4c48aSmrg  [m4_case([$1],
105299c4c48aSmrg    [ustar],
105399c4c48aSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105499c4c48aSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105599c4c48aSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105699c4c48aSmrg      # and bug#13588).
105799c4c48aSmrg      am_max_uid=2097151 # 2^21 - 1
105899c4c48aSmrg      am_max_gid=$am_max_uid
105999c4c48aSmrg      # The $UID and $GID variables are not portable, so we need to resort
106099c4c48aSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106199c4c48aSmrg      # below are definitely unexpected, so allow the users to see them
106299c4c48aSmrg      # (that is, avoid stderr redirection).
106399c4c48aSmrg      am_uid=`id -u || echo unknown`
106499c4c48aSmrg      am_gid=`id -g || echo unknown`
106599c4c48aSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106699c4c48aSmrg      if test $am_uid -le $am_max_uid; then
106799c4c48aSmrg         AC_MSG_RESULT([yes])
106899c4c48aSmrg      else
106999c4c48aSmrg         AC_MSG_RESULT([no])
107099c4c48aSmrg         _am_tools=none
107199c4c48aSmrg      fi
107299c4c48aSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107399c4c48aSmrg      if test $am_gid -le $am_max_gid; then
107499c4c48aSmrg         AC_MSG_RESULT([yes])
107599c4c48aSmrg      else
107699c4c48aSmrg        AC_MSG_RESULT([no])
107799c4c48aSmrg        _am_tools=none
107899c4c48aSmrg      fi],
10791a650d1eSmrg
108099c4c48aSmrg  [pax],
108199c4c48aSmrg    [],
10821a650d1eSmrg
108399c4c48aSmrg  [m4_fatal([Unknown tar format])])
10845977a007Smrg
108599c4c48aSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
10865977a007Smrg
108799c4c48aSmrg  # Go ahead even if we have the value already cached.  We do so because we
108899c4c48aSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108999c4c48aSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10905977a007Smrg
109199c4c48aSmrg  for _am_tool in $_am_tools; do
109299c4c48aSmrg    case $_am_tool in
109399c4c48aSmrg    gnutar)
109499c4c48aSmrg      for _am_tar in tar gnutar gtar; do
109599c4c48aSmrg        AM_RUN_LOG([$_am_tar --version]) && break
109699c4c48aSmrg      done
109799c4c48aSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109899c4c48aSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109999c4c48aSmrg      am__untar="$_am_tar -xf -"
110099c4c48aSmrg      ;;
110199c4c48aSmrg    plaintar)
110299c4c48aSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110399c4c48aSmrg      # ustar tarball either.
110499c4c48aSmrg      (tar --version) >/dev/null 2>&1 && continue
110599c4c48aSmrg      am__tar='tar chf - "$$tardir"'
110699c4c48aSmrg      am__tar_='tar chf - "$tardir"'
110799c4c48aSmrg      am__untar='tar xf -'
110899c4c48aSmrg      ;;
110999c4c48aSmrg    pax)
111099c4c48aSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
111199c4c48aSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
111299c4c48aSmrg      am__untar='pax -r'
111399c4c48aSmrg      ;;
111499c4c48aSmrg    cpio)
111599c4c48aSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111699c4c48aSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111799c4c48aSmrg      am__untar='cpio -i -H $1 -d'
111899c4c48aSmrg      ;;
111999c4c48aSmrg    none)
112099c4c48aSmrg      am__tar=false
112199c4c48aSmrg      am__tar_=false
112299c4c48aSmrg      am__untar=false
112399c4c48aSmrg      ;;
112499c4c48aSmrg    esac
11255977a007Smrg
112699c4c48aSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
112799c4c48aSmrg    # and am__untar set.
112899c4c48aSmrg    test -n "${am_cv_prog_tar_$1}" && break
11298a355152Smrg
113099c4c48aSmrg    # tar/untar a dummy directory, and stop if the command works.
113199c4c48aSmrg    rm -rf conftest.dir
113299c4c48aSmrg    mkdir conftest.dir
113399c4c48aSmrg    echo GrepMe > conftest.dir/file
113499c4c48aSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113599c4c48aSmrg    rm -rf conftest.dir
113699c4c48aSmrg    if test -s conftest.tar; then
113799c4c48aSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
113899c4c48aSmrg      AM_RUN_LOG([cat conftest.dir/file])
113999c4c48aSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114099c4c48aSmrg    fi
114199c4c48aSmrg  done
114299c4c48aSmrg  rm -rf conftest.dir
11431a650d1eSmrg
114499c4c48aSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114599c4c48aSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11461a650d1eSmrg
114799c4c48aSmrgAC_SUBST([am__tar])
114899c4c48aSmrgAC_SUBST([am__untar])
114999c4c48aSmrg]) # _AM_PROG_TAR
11508a355152Smrg
115199c4c48aSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
115299c4c48aSmrgdnl serial 11 (pkg-config-0.29)
115399c4c48aSmrgdnl
115499c4c48aSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115599c4c48aSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
115699c4c48aSmrgdnl
115799c4c48aSmrgdnl This program is free software; you can redistribute it and/or modify
115899c4c48aSmrgdnl it under the terms of the GNU General Public License as published by
115999c4c48aSmrgdnl the Free Software Foundation; either version 2 of the License, or
116099c4c48aSmrgdnl (at your option) any later version.
116199c4c48aSmrgdnl
116299c4c48aSmrgdnl This program is distributed in the hope that it will be useful, but
116399c4c48aSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
116499c4c48aSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
116599c4c48aSmrgdnl General Public License for more details.
116699c4c48aSmrgdnl
116799c4c48aSmrgdnl You should have received a copy of the GNU General Public License
116899c4c48aSmrgdnl along with this program; if not, write to the Free Software
116999c4c48aSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
117099c4c48aSmrgdnl 02111-1307, USA.
117199c4c48aSmrgdnl
117299c4c48aSmrgdnl As a special exception to the GNU General Public License, if you
117399c4c48aSmrgdnl distribute this file as part of a program that contains a
117499c4c48aSmrgdnl configuration script generated by Autoconf, you may include it under
117599c4c48aSmrgdnl the same distribution terms that you use for the rest of that
117699c4c48aSmrgdnl program.
11778a355152Smrg
117899c4c48aSmrgdnl PKG_PREREQ(MIN-VERSION)
117999c4c48aSmrgdnl -----------------------
118099c4c48aSmrgdnl Since: 0.29
118199c4c48aSmrgdnl
118299c4c48aSmrgdnl Verify that the version of the pkg-config macros are at least
118399c4c48aSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
118499c4c48aSmrgdnl installed version of pkg-config, this checks the developer's version
118599c4c48aSmrgdnl of pkg.m4 when generating configure.
118699c4c48aSmrgdnl
118799c4c48aSmrgdnl To ensure that this macro is defined, also add:
118899c4c48aSmrgdnl m4_ifndef([PKG_PREREQ],
118999c4c48aSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
119099c4c48aSmrgdnl
119199c4c48aSmrgdnl See the "Since" comment for each macro you use to see what version
119299c4c48aSmrgdnl of the macros you require.
119399c4c48aSmrgm4_defun([PKG_PREREQ],
119499c4c48aSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
119599c4c48aSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
119699c4c48aSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
119799c4c48aSmrg])dnl PKG_PREREQ
11988a355152Smrg
119999c4c48aSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
120099c4c48aSmrgdnl ----------------------------------
120199c4c48aSmrgdnl Since: 0.16
120299c4c48aSmrgdnl
120399c4c48aSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
120499c4c48aSmrgdnl first found in the path. Checks that the version of pkg-config found
120599c4c48aSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
120699c4c48aSmrgdnl used since that's the first version where most current features of
120799c4c48aSmrgdnl pkg-config existed.
120899c4c48aSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120999c4c48aSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
121099c4c48aSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
121199c4c48aSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
121299c4c48aSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
121399c4c48aSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
121499c4c48aSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
12158a355152Smrg
121699c4c48aSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121799c4c48aSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12181a650d1eSmrgfi
121999c4c48aSmrgif test -n "$PKG_CONFIG"; then
122099c4c48aSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
122199c4c48aSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122299c4c48aSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122399c4c48aSmrg		AC_MSG_RESULT([yes])
122499c4c48aSmrg	else
122599c4c48aSmrg		AC_MSG_RESULT([no])
122699c4c48aSmrg		PKG_CONFIG=""
122799c4c48aSmrg	fi
122899c4c48aSmrgfi[]dnl
122999c4c48aSmrg])dnl PKG_PROG_PKG_CONFIG
12308108eb18Smrg
123199c4c48aSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
123299c4c48aSmrgdnl -------------------------------------------------------------------
123399c4c48aSmrgdnl Since: 0.18
123499c4c48aSmrgdnl
123599c4c48aSmrgdnl Check to see whether a particular set of modules exists. Similar to
123699c4c48aSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
123799c4c48aSmrgdnl
123899c4c48aSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123999c4c48aSmrgdnl only at the first occurence in configure.ac, so if the first place
124099c4c48aSmrgdnl it's called might be skipped (such as if it is within an "if", you
124199c4c48aSmrgdnl have to call PKG_CHECK_EXISTS manually
124299c4c48aSmrgAC_DEFUN([PKG_CHECK_EXISTS],
124399c4c48aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124499c4c48aSmrgif test -n "$PKG_CONFIG" && \
124599c4c48aSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
124699c4c48aSmrg  m4_default([$2], [:])
124799c4c48aSmrgm4_ifvaln([$3], [else
124899c4c48aSmrg  $3])dnl
124999c4c48aSmrgfi])
125099c4c48aSmrg
125199c4c48aSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
125299c4c48aSmrgdnl ---------------------------------------------
125399c4c48aSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
125499c4c48aSmrgdnl pkg_failed based on the result.
125599c4c48aSmrgm4_define([_PKG_CONFIG],
125699c4c48aSmrg[if test -n "$$1"; then
125799c4c48aSmrg    pkg_cv_[]$1="$$1"
125899c4c48aSmrg elif test -n "$PKG_CONFIG"; then
125999c4c48aSmrg    PKG_CHECK_EXISTS([$3],
126099c4c48aSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
126199c4c48aSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
126299c4c48aSmrg		     [pkg_failed=yes])
126399c4c48aSmrg else
126499c4c48aSmrg    pkg_failed=untried
126599c4c48aSmrgfi[]dnl
126699c4c48aSmrg])dnl _PKG_CONFIG
126799c4c48aSmrg
126899c4c48aSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
126999c4c48aSmrgdnl ---------------------------
127099c4c48aSmrgdnl Internal check to see if pkg-config supports short errors.
127199c4c48aSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127299c4c48aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127399c4c48aSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127499c4c48aSmrg        _pkg_short_errors_supported=yes
12758a355152Smrgelse
127699c4c48aSmrg        _pkg_short_errors_supported=no
127799c4c48aSmrgfi[]dnl
127899c4c48aSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
12798108eb18Smrg
12801a650d1eSmrg
128199c4c48aSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
128299c4c48aSmrgdnl   [ACTION-IF-NOT-FOUND])
128399c4c48aSmrgdnl --------------------------------------------------------------
128499c4c48aSmrgdnl Since: 0.4.0
128599c4c48aSmrgdnl
128699c4c48aSmrgdnl Note that if there is a possibility the first call to
128799c4c48aSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
128899c4c48aSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128999c4c48aSmrgAC_DEFUN([PKG_CHECK_MODULES],
129099c4c48aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129199c4c48aSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129299c4c48aSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12938a355152Smrg
129499c4c48aSmrgpkg_failed=no
129599c4c48aSmrgAC_MSG_CHECKING([for $1])
12968a355152Smrg
129799c4c48aSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129899c4c48aSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12998a355152Smrg
130099c4c48aSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130199c4c48aSmrgand $1[]_LIBS to avoid the need to call pkg-config.
130299c4c48aSmrgSee the pkg-config man page for more details.])
13038a355152Smrg
130499c4c48aSmrgif test $pkg_failed = yes; then
130599c4c48aSmrg   	AC_MSG_RESULT([no])
130699c4c48aSmrg        _PKG_SHORT_ERRORS_SUPPORTED
130799c4c48aSmrg        if test $_pkg_short_errors_supported = yes; then
130899c4c48aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130999c4c48aSmrg        else 
131099c4c48aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131199c4c48aSmrg        fi
131299c4c48aSmrg	# Put the nasty error message in config.log where it belongs
131399c4c48aSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13148a355152Smrg
131599c4c48aSmrg	m4_default([$4], [AC_MSG_ERROR(
131699c4c48aSmrg[Package requirements ($2) were not met:
13178a355152Smrg
131899c4c48aSmrg$$1_PKG_ERRORS
131999c4c48aSmrg
132099c4c48aSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132199c4c48aSmrginstalled software in a non-standard prefix.
132299c4c48aSmrg
132399c4c48aSmrg_PKG_TEXT])[]dnl
132499c4c48aSmrg        ])
132599c4c48aSmrgelif test $pkg_failed = untried; then
132699c4c48aSmrg     	AC_MSG_RESULT([no])
132799c4c48aSmrg	m4_default([$4], [AC_MSG_FAILURE(
132899c4c48aSmrg[The pkg-config script could not be found or is too old.  Make sure it
132999c4c48aSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
133099c4c48aSmrgpath to pkg-config.
133199c4c48aSmrg
133299c4c48aSmrg_PKG_TEXT
133399c4c48aSmrg
133499c4c48aSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
133599c4c48aSmrg        ])
13368108eb18Smrgelse
133799c4c48aSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133899c4c48aSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133999c4c48aSmrg        AC_MSG_RESULT([yes])
134099c4c48aSmrg	$3
134199c4c48aSmrgfi[]dnl
134299c4c48aSmrg])dnl PKG_CHECK_MODULES
13435977a007Smrg
13448108eb18Smrg
134599c4c48aSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
134699c4c48aSmrgdnl   [ACTION-IF-NOT-FOUND])
134799c4c48aSmrgdnl ---------------------------------------------------------------------
134899c4c48aSmrgdnl Since: 0.29
134999c4c48aSmrgdnl
135099c4c48aSmrgdnl Checks for existence of MODULES and gathers its build flags with
135199c4c48aSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
135299c4c48aSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
135399c4c48aSmrgdnl
135499c4c48aSmrgdnl Note that if there is a possibility the first call to
135599c4c48aSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
135699c4c48aSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
135799c4c48aSmrgdnl configure.ac.
135899c4c48aSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
135999c4c48aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
136099c4c48aSmrg_save_PKG_CONFIG=$PKG_CONFIG
136199c4c48aSmrgPKG_CONFIG="$PKG_CONFIG --static"
136299c4c48aSmrgPKG_CHECK_MODULES($@)
136399c4c48aSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
136499c4c48aSmrg])dnl PKG_CHECK_MODULES_STATIC
13651a650d1eSmrg
13668a355152Smrg
136799c4c48aSmrgdnl PKG_INSTALLDIR([DIRECTORY])
136899c4c48aSmrgdnl -------------------------
136999c4c48aSmrgdnl Since: 0.27
137099c4c48aSmrgdnl
137199c4c48aSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
137299c4c48aSmrgdnl should install pkg-config .pc files. By default the directory is
137399c4c48aSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
137499c4c48aSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
137599c4c48aSmrgdnl parameter.
137699c4c48aSmrgAC_DEFUN([PKG_INSTALLDIR],
137799c4c48aSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
137899c4c48aSmrgm4_pushdef([pkg_description],
137999c4c48aSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
138099c4c48aSmrgAC_ARG_WITH([pkgconfigdir],
138199c4c48aSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
138299c4c48aSmrg    [with_pkgconfigdir=]pkg_default)
138399c4c48aSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
138499c4c48aSmrgm4_popdef([pkg_default])
138599c4c48aSmrgm4_popdef([pkg_description])
138699c4c48aSmrg])dnl PKG_INSTALLDIR
138799c4c48aSmrg
138899c4c48aSmrg
138999c4c48aSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
139099c4c48aSmrgdnl --------------------------------
139199c4c48aSmrgdnl Since: 0.27
139299c4c48aSmrgdnl
139399c4c48aSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
139499c4c48aSmrgdnl module should install arch-independent pkg-config .pc files. By
139599c4c48aSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
139699c4c48aSmrgdnl changed by passing DIRECTORY. The user can override through the
139799c4c48aSmrgdnl --with-noarch-pkgconfigdir parameter.
139899c4c48aSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
139999c4c48aSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
140099c4c48aSmrgm4_pushdef([pkg_description],
140199c4c48aSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
140299c4c48aSmrgAC_ARG_WITH([noarch-pkgconfigdir],
140399c4c48aSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
140499c4c48aSmrg    [with_noarch_pkgconfigdir=]pkg_default)
140599c4c48aSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
140699c4c48aSmrgm4_popdef([pkg_default])
140799c4c48aSmrgm4_popdef([pkg_description])
140899c4c48aSmrg])dnl PKG_NOARCH_INSTALLDIR
140999c4c48aSmrg
14108a355152Smrg
141199c4c48aSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
141299c4c48aSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
141399c4c48aSmrgdnl -------------------------------------------
141499c4c48aSmrgdnl Since: 0.28
141599c4c48aSmrgdnl
141699c4c48aSmrgdnl Retrieves the value of the pkg-config variable for the given module.
141799c4c48aSmrgAC_DEFUN([PKG_CHECK_VAR],
141899c4c48aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
141999c4c48aSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
14208108eb18Smrg
142199c4c48aSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
142299c4c48aSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
14238a355152Smrg
142499c4c48aSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
142599c4c48aSmrg])dnl PKG_CHECK_VAR
14268a355152Smrg
142799c4c48aSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142899c4c48aSmrgdnl
14298d1e6323Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
143099c4c48aSmrgdnl
143199c4c48aSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143299c4c48aSmrgdnl copy of this software and associated documentation files (the "Software"),
143399c4c48aSmrgdnl to deal in the Software without restriction, including without limitation
143499c4c48aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143599c4c48aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
143699c4c48aSmrgdnl Software is furnished to do so, subject to the following conditions:
143799c4c48aSmrgdnl
143899c4c48aSmrgdnl The above copyright notice and this permission notice (including the next
143999c4c48aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
144099c4c48aSmrgdnl Software.
144199c4c48aSmrgdnl
144299c4c48aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144399c4c48aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144499c4c48aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144599c4c48aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144699c4c48aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144799c4c48aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144899c4c48aSmrgdnl DEALINGS IN THE SOFTWARE.
14498a355152Smrg
145099c4c48aSmrg# XORG_MACROS_VERSION(required-version)
145199c4c48aSmrg# -------------------------------------
14528a355152Smrg# Minimum version: 1.1.0
14531a650d1eSmrg#
145499c4c48aSmrg# If you're using a macro added in Version 1.1 or newer, include this in
145599c4c48aSmrg# your configure.ac with the minimum required version, such as:
145699c4c48aSmrg# XORG_MACROS_VERSION(1.1)
14571a650d1eSmrg#
145899c4c48aSmrg# To ensure that this macro is defined, also add:
145999c4c48aSmrg# m4_ifndef([XORG_MACROS_VERSION],
146099c4c48aSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14611a650d1eSmrg#
146299c4c48aSmrg#
146399c4c48aSmrg# See the "minimum version" comment for each macro you use to see what
146499c4c48aSmrg# version you require.
146599c4c48aSmrgm4_defun([XORG_MACROS_VERSION],[
14668d1e6323Smrgm4_define([vers_have], [1.20.0])
146799c4c48aSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146899c4c48aSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
146999c4c48aSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147099c4c48aSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147199c4c48aSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147299c4c48aSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147399c4c48aSmrgm4_undefine([vers_have])
147499c4c48aSmrgm4_undefine([maj_have])
147599c4c48aSmrgm4_undefine([maj_needed])
147699c4c48aSmrg]) # XORG_MACROS_VERSION
14771a650d1eSmrg
147899c4c48aSmrg# XORG_PROG_RAWCPP()
147999c4c48aSmrg# ------------------
148099c4c48aSmrg# Minimum version: 1.0.0
148199c4c48aSmrg#
148299c4c48aSmrg# Find cpp program and necessary flags for use in pre-processing text files
148399c4c48aSmrg# such as man pages and config files
148499c4c48aSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148599c4c48aSmrgAC_REQUIRE([AC_PROG_CPP])
148699c4c48aSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148799c4c48aSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14888a355152Smrg
148999c4c48aSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149099c4c48aSmrg# which is not the best choice for supporting other OS'es, but covers most
149199c4c48aSmrg# of the ones we need for now.
149299c4c48aSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149399c4c48aSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149499c4c48aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149599c4c48aSmrg	AC_MSG_RESULT([no])
149699c4c48aSmrgelse
149799c4c48aSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149899c4c48aSmrg		RAWCPPFLAGS=-undef
149999c4c48aSmrg		AC_MSG_RESULT([yes])
150099c4c48aSmrg	# under Cygwin unix is still defined even with -undef
150199c4c48aSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150299c4c48aSmrg		RAWCPPFLAGS="-undef -ansi"
150399c4c48aSmrg		AC_MSG_RESULT([yes, with -ansi])
150499c4c48aSmrg	else
150599c4c48aSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150699c4c48aSmrg	fi
15078a355152Smrgfi
150899c4c48aSmrgrm -f conftest.$ac_ext
15098a355152Smrg
151099c4c48aSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151199c4c48aSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15128d1e6323Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
151399c4c48aSmrg	AC_MSG_RESULT([no])
151499c4c48aSmrgelse
15158d1e6323Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
151699c4c48aSmrg		TRADITIONALCPPFLAGS="-traditional"
151799c4c48aSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151899c4c48aSmrg		AC_MSG_RESULT([yes])
151999c4c48aSmrg	else
152099c4c48aSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152199c4c48aSmrg	fi
152299c4c48aSmrgfi
152399c4c48aSmrgrm -f conftest.$ac_ext
152499c4c48aSmrgAC_SUBST(RAWCPPFLAGS)
152599c4c48aSmrgAC_SUBST(TRADITIONALCPPFLAGS)
152699c4c48aSmrg]) # XORG_PROG_RAWCPP
15278a355152Smrg
152899c4c48aSmrg# XORG_MANPAGE_SECTIONS()
152999c4c48aSmrg# -----------------------
153099c4c48aSmrg# Minimum version: 1.0.0
15311a650d1eSmrg#
153299c4c48aSmrg# Determine which sections man pages go in for the different man page types
153399c4c48aSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153499c4c48aSmrg# Not sure if there's any better way than just hardcoding by OS name.
153599c4c48aSmrg# Override default settings by setting environment variables
153699c4c48aSmrg# Added MAN_SUBSTS in version 1.8
153799c4c48aSmrg# Added AC_PROG_SED in version 1.8
15381a650d1eSmrg
153999c4c48aSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154099c4c48aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
154199c4c48aSmrgAC_REQUIRE([AC_PROG_SED])
15428108eb18Smrg
154399c4c48aSmrgcase $host_os in
154499c4c48aSmrg    solaris*)
154599c4c48aSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
154699c4c48aSmrg        # check for a man page file found in later versions that use
154799c4c48aSmrg        # traditional section numbers instead
154899c4c48aSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
154999c4c48aSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
155099c4c48aSmrg        ;;
155199c4c48aSmrg    *) SYSV_MAN_SECTIONS=false ;;
155299c4c48aSmrgesac
15538a355152Smrg
155499c4c48aSmrgif test x$APP_MAN_SUFFIX = x    ; then
155599c4c48aSmrg    APP_MAN_SUFFIX=1
155699c4c48aSmrgfi
155799c4c48aSmrgif test x$APP_MAN_DIR = x    ; then
155899c4c48aSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
155999c4c48aSmrgfi
15608a355152Smrg
156199c4c48aSmrgif test x$LIB_MAN_SUFFIX = x    ; then
156299c4c48aSmrg    LIB_MAN_SUFFIX=3
156399c4c48aSmrgfi
156499c4c48aSmrgif test x$LIB_MAN_DIR = x    ; then
156599c4c48aSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
156699c4c48aSmrgfi
15678a355152Smrg
156899c4c48aSmrgif test x$FILE_MAN_SUFFIX = x    ; then
156999c4c48aSmrg    case $SYSV_MAN_SECTIONS in
157099c4c48aSmrg	true)				FILE_MAN_SUFFIX=4  ;;
157199c4c48aSmrg	*)				FILE_MAN_SUFFIX=5  ;;
157299c4c48aSmrg    esac
157399c4c48aSmrgfi
157499c4c48aSmrgif test x$FILE_MAN_DIR = x    ; then
157599c4c48aSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15768a355152Smrgfi
15778a355152Smrg
157899c4c48aSmrgif test x$MISC_MAN_SUFFIX = x    ; then
157999c4c48aSmrg    case $SYSV_MAN_SECTIONS in
158099c4c48aSmrg	true)				MISC_MAN_SUFFIX=5  ;;
158199c4c48aSmrg	*)				MISC_MAN_SUFFIX=7  ;;
158299c4c48aSmrg    esac
158399c4c48aSmrgfi
158499c4c48aSmrgif test x$MISC_MAN_DIR = x    ; then
158599c4c48aSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15868a355152Smrgfi
15878a355152Smrg
158899c4c48aSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
158999c4c48aSmrg    case $SYSV_MAN_SECTIONS in
159099c4c48aSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
159199c4c48aSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159299c4c48aSmrg    esac
159399c4c48aSmrgfi
159499c4c48aSmrgif test x$DRIVER_MAN_DIR = x    ; then
159599c4c48aSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159699c4c48aSmrgfi
15978a355152Smrg
159899c4c48aSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
159999c4c48aSmrg    case $SYSV_MAN_SECTIONS in
160099c4c48aSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
160199c4c48aSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160299c4c48aSmrg    esac
160399c4c48aSmrgfi
160499c4c48aSmrgif test x$ADMIN_MAN_DIR = x    ; then
160599c4c48aSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160699c4c48aSmrgfi
16078a355152Smrg
16088a355152Smrg
160999c4c48aSmrgAC_SUBST([APP_MAN_SUFFIX])
161099c4c48aSmrgAC_SUBST([LIB_MAN_SUFFIX])
161199c4c48aSmrgAC_SUBST([FILE_MAN_SUFFIX])
161299c4c48aSmrgAC_SUBST([MISC_MAN_SUFFIX])
161399c4c48aSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161499c4c48aSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161599c4c48aSmrgAC_SUBST([APP_MAN_DIR])
161699c4c48aSmrgAC_SUBST([LIB_MAN_DIR])
161799c4c48aSmrgAC_SUBST([FILE_MAN_DIR])
161899c4c48aSmrgAC_SUBST([MISC_MAN_DIR])
161999c4c48aSmrgAC_SUBST([DRIVER_MAN_DIR])
162099c4c48aSmrgAC_SUBST([ADMIN_MAN_DIR])
16218a355152Smrg
162299c4c48aSmrgXORG_MAN_PAGE="X Version 11"
162399c4c48aSmrgAC_SUBST([XORG_MAN_PAGE])
162499c4c48aSmrgMAN_SUBSTS="\
162599c4c48aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162699c4c48aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162799c4c48aSmrg	-e 's|__xservername__|Xorg|g' \
162899c4c48aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
162999c4c48aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
163099c4c48aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163199c4c48aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163299c4c48aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163399c4c48aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163499c4c48aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163599c4c48aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163699c4c48aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163799c4c48aSmrgAC_SUBST([MAN_SUBSTS])
16388a355152Smrg
163999c4c48aSmrg]) # XORG_MANPAGE_SECTIONS
16408a355152Smrg
164199c4c48aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164299c4c48aSmrg# ------------------------
164399c4c48aSmrg# Minimum version: 1.7.0
16445977a007Smrg#
164599c4c48aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164699c4c48aSmrg# provided by xorg-sgml-doctools, if installed.
164799c4c48aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164899c4c48aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164999c4c48aSmrgXORG_SGML_PATH=
165099c4c48aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165199c4c48aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165299c4c48aSmrg    [m4_ifval([$1],[:],
165399c4c48aSmrg        [if test x"$cross_compiling" != x"yes" ; then
165499c4c48aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165599c4c48aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165699c4c48aSmrg         fi])
165799c4c48aSmrg    ])
165899c4c48aSmrg
165999c4c48aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166099c4c48aSmrg# the path and the name of the doc stylesheet
166199c4c48aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
166299c4c48aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166399c4c48aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166499c4c48aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166599c4c48aSmrgelse
166699c4c48aSmrg   AC_MSG_RESULT([no])
166799c4c48aSmrgfi
166899c4c48aSmrg
166999c4c48aSmrgAC_SUBST(XORG_SGML_PATH)
167099c4c48aSmrgAC_SUBST(STYLESHEET_SRCDIR)
167199c4c48aSmrgAC_SUBST(XSL_STYLESHEET)
167299c4c48aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167399c4c48aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
167499c4c48aSmrg
167599c4c48aSmrg# XORG_CHECK_LINUXDOC
167699c4c48aSmrg# -------------------
167799c4c48aSmrg# Minimum version: 1.0.0
16785977a007Smrg#
167999c4c48aSmrg# Defines the variable MAKE_TEXT if the necessary tools and
168099c4c48aSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168199c4c48aSmrg# Whether or not the necessary tools and files are found can be checked
168299c4c48aSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168399c4c48aSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168499c4c48aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168599c4c48aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16868a355152Smrg
168799c4c48aSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16888a355152Smrg
168999c4c48aSmrgAC_MSG_CHECKING([whether to build documentation])
169099c4c48aSmrg
169199c4c48aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169299c4c48aSmrg   BUILDDOC=yes
16938a355152Smrgelse
169499c4c48aSmrg   BUILDDOC=no
16958a355152Smrgfi
16968a355152Smrg
169799c4c48aSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16988a355152Smrg
169999c4c48aSmrgAC_MSG_RESULT([$BUILDDOC])
17008a355152Smrg
170199c4c48aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
170299c4c48aSmrg
170399c4c48aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170499c4c48aSmrg   BUILDPDFDOC=yes
170599c4c48aSmrgelse
170699c4c48aSmrg   BUILDPDFDOC=no
170799c4c48aSmrgfi
170899c4c48aSmrg
170999c4c48aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171099c4c48aSmrg
171199c4c48aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
171299c4c48aSmrg
171399c4c48aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171499c4c48aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171599c4c48aSmrgMAKE_PDF="$PS2PDF"
171699c4c48aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171799c4c48aSmrg
171899c4c48aSmrgAC_SUBST(MAKE_TEXT)
171999c4c48aSmrgAC_SUBST(MAKE_PS)
172099c4c48aSmrgAC_SUBST(MAKE_PDF)
172199c4c48aSmrgAC_SUBST(MAKE_HTML)
172299c4c48aSmrg]) # XORG_CHECK_LINUXDOC
172399c4c48aSmrg
172499c4c48aSmrg# XORG_CHECK_DOCBOOK
172599c4c48aSmrg# -------------------
172699c4c48aSmrg# Minimum version: 1.0.0
172799c4c48aSmrg#
172899c4c48aSmrg# Checks for the ability to build output formats from SGML DocBook source.
172999c4c48aSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173099c4c48aSmrg# indicates whether the necessary tools and files are found and, if set,
173199c4c48aSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173299c4c48aSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173399c4c48aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
173499c4c48aSmrg
173599c4c48aSmrgBUILDTXTDOC=no
173699c4c48aSmrgBUILDPDFDOC=no
173799c4c48aSmrgBUILDPSDOC=no
173899c4c48aSmrgBUILDHTMLDOC=no
173999c4c48aSmrg
174099c4c48aSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174199c4c48aSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174299c4c48aSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174399c4c48aSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17448a355152Smrg
174599c4c48aSmrgAC_MSG_CHECKING([whether to build text documentation])
174699c4c48aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174799c4c48aSmrg   test x$BUILD_TXTDOC != xno; then
174899c4c48aSmrg	BUILDTXTDOC=yes
174999c4c48aSmrgfi
175099c4c48aSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175199c4c48aSmrgAC_MSG_RESULT([$BUILDTXTDOC])
17528a355152Smrg
175399c4c48aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
175499c4c48aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175599c4c48aSmrg   test x$BUILD_PDFDOC != xno; then
175699c4c48aSmrg	BUILDPDFDOC=yes
175799c4c48aSmrgfi
175899c4c48aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175999c4c48aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17608a355152Smrg
176199c4c48aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176299c4c48aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176399c4c48aSmrg   test x$BUILD_PSDOC != xno; then
176499c4c48aSmrg	BUILDPSDOC=yes
17658a355152Smrgfi
176699c4c48aSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176799c4c48aSmrgAC_MSG_RESULT([$BUILDPSDOC])
17685977a007Smrg
176999c4c48aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
177099c4c48aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177199c4c48aSmrg   test x$BUILD_HTMLDOC != xno; then
177299c4c48aSmrg	BUILDHTMLDOC=yes
177399c4c48aSmrgfi
177499c4c48aSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177599c4c48aSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17765977a007Smrg
177799c4c48aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177899c4c48aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177999c4c48aSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178099c4c48aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178199c4c48aSmrg
178299c4c48aSmrgAC_SUBST(MAKE_TEXT)
178399c4c48aSmrgAC_SUBST(MAKE_PS)
178499c4c48aSmrgAC_SUBST(MAKE_PDF)
178599c4c48aSmrgAC_SUBST(MAKE_HTML)
178699c4c48aSmrg]) # XORG_CHECK_DOCBOOK
178799c4c48aSmrg
178899c4c48aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178999c4c48aSmrg# ----------------
179099c4c48aSmrg# Minimum version: 1.5.0
179199c4c48aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
17925977a007Smrg#
179399c4c48aSmrg# Documentation tools are not always available on all platforms and sometimes
179499c4c48aSmrg# not at the appropriate level. This macro enables a module to test for the
179599c4c48aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
17968d1e6323Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
179799c4c48aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179899c4c48aSmrg# --with-xmlto assumes 'auto'.
17995977a007Smrg#
180099c4c48aSmrg# Interface to module:
180199c4c48aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180299c4c48aSmrg# XMLTO:	returns the path of the xmlto program found
180399c4c48aSmrg#		returns the path set by the user in the environment
180499c4c48aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180599c4c48aSmrg#		'no' user instructs the module not to use xmlto
18065977a007Smrg#
180799c4c48aSmrg# Added in version 1.10.0
180899c4c48aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180999c4c48aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
18105977a007Smrg#
181199c4c48aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
18125977a007Smrg#
181399c4c48aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
181499c4c48aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181599c4c48aSmrgm4_define([_defopt], m4_default([$2], [auto]))
181699c4c48aSmrgAC_ARG_WITH(xmlto,
181799c4c48aSmrg	AS_HELP_STRING([--with-xmlto],
181899c4c48aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181999c4c48aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182099c4c48aSmrgm4_undefine([_defopt])
18215977a007Smrg
182299c4c48aSmrgif test "x$use_xmlto" = x"auto"; then
182399c4c48aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
182499c4c48aSmrg   if test "x$XMLTO" = "x"; then
182599c4c48aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182699c4c48aSmrg	have_xmlto=no
182799c4c48aSmrg   else
182899c4c48aSmrg        have_xmlto=yes
182999c4c48aSmrg   fi
183099c4c48aSmrgelif test "x$use_xmlto" = x"yes" ; then
183199c4c48aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
183299c4c48aSmrg   if test "x$XMLTO" = "x"; then
183399c4c48aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183499c4c48aSmrg   fi
183599c4c48aSmrg   have_xmlto=yes
183699c4c48aSmrgelif test "x$use_xmlto" = x"no" ; then
183799c4c48aSmrg   if test "x$XMLTO" != "x"; then
183899c4c48aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183999c4c48aSmrg   fi
184099c4c48aSmrg   have_xmlto=no
184199c4c48aSmrgelse
184299c4c48aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184399c4c48aSmrgfi
18445977a007Smrg
184599c4c48aSmrg# Test for a minimum version of xmlto, if provided.
184699c4c48aSmrgm4_ifval([$1],
184799c4c48aSmrg[if test "$have_xmlto" = yes; then
184899c4c48aSmrg    # scrape the xmlto version
184999c4c48aSmrg    AC_MSG_CHECKING([the xmlto version])
185099c4c48aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185199c4c48aSmrg    AC_MSG_RESULT([$xmlto_version])
185299c4c48aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185399c4c48aSmrg        [if test "x$use_xmlto" = xauto; then
185499c4c48aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185599c4c48aSmrg            have_xmlto=no
185699c4c48aSmrg        else
185799c4c48aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185899c4c48aSmrg        fi])
185999c4c48aSmrgfi])
18605977a007Smrg
186199c4c48aSmrg# Test for the ability of xmlto to generate a text target
186299c4c48aSmrg#
186399c4c48aSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
186499c4c48aSmrg# following test for empty XML docbook files.
186599c4c48aSmrg# For compatibility reasons use the following empty XML docbook file and if
186699c4c48aSmrg# it fails try it again with a non-empty XML file.
186799c4c48aSmrghave_xmlto_text=no
186899c4c48aSmrgcat > conftest.xml << "EOF"
186999c4c48aSmrgEOF
187099c4c48aSmrgAS_IF([test "$have_xmlto" = yes],
187199c4c48aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187299c4c48aSmrg             [have_xmlto_text=yes],
187399c4c48aSmrg             [# Try it again with a non-empty XML file.
187499c4c48aSmrg              cat > conftest.xml << "EOF"
187599c4c48aSmrg<x></x>
187699c4c48aSmrgEOF
187799c4c48aSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187899c4c48aSmrg                    [have_xmlto_text=yes],
187999c4c48aSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188099c4c48aSmrgrm -f conftest.xml
188199c4c48aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188299c4c48aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188399c4c48aSmrg]) # XORG_WITH_XMLTO
18845977a007Smrg
188599c4c48aSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188699c4c48aSmrg# --------------------------------------------
188799c4c48aSmrg# Minimum version: 1.12.0
188899c4c48aSmrg# Minimum version for optional DEFAULT argument: 1.12.0
188999c4c48aSmrg#
189099c4c48aSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189199c4c48aSmrg# XML-based language used for the transformation of XML documents.
189299c4c48aSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189399c4c48aSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189499c4c48aSmrg# The XSLT processor is often used as a standalone tool for transformations.
189599c4c48aSmrg# It should not be assumed that this tool is used only to work with documnetation.
189699c4c48aSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189799c4c48aSmrg#
189899c4c48aSmrg# Interface to module:
189999c4c48aSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190099c4c48aSmrg# XSLTPROC:	 returns the path of the xsltproc program found
190199c4c48aSmrg#		 returns the path set by the user in the environment
190299c4c48aSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190399c4c48aSmrg#		  'no' user instructs the module not to use xsltproc
190499c4c48aSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190599c4c48aSmrg#
190699c4c48aSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190799c4c48aSmrg#
190899c4c48aSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190999c4c48aSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191099c4c48aSmrg# Preserves the interface, should it be implemented later
191199c4c48aSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191299c4c48aSmrgm4_define([_defopt], m4_default([$2], [auto]))
191399c4c48aSmrgAC_ARG_WITH(xsltproc,
191499c4c48aSmrg	AS_HELP_STRING([--with-xsltproc],
191599c4c48aSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191699c4c48aSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191799c4c48aSmrgm4_undefine([_defopt])
19185977a007Smrg
191999c4c48aSmrgif test "x$use_xsltproc" = x"auto"; then
192099c4c48aSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192199c4c48aSmrg   if test "x$XSLTPROC" = "x"; then
192299c4c48aSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192399c4c48aSmrg	have_xsltproc=no
192499c4c48aSmrg   else
192599c4c48aSmrg        have_xsltproc=yes
192699c4c48aSmrg   fi
192799c4c48aSmrgelif test "x$use_xsltproc" = x"yes" ; then
192899c4c48aSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192999c4c48aSmrg   if test "x$XSLTPROC" = "x"; then
193099c4c48aSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193199c4c48aSmrg   fi
193299c4c48aSmrg   have_xsltproc=yes
193399c4c48aSmrgelif test "x$use_xsltproc" = x"no" ; then
193499c4c48aSmrg   if test "x$XSLTPROC" != "x"; then
193599c4c48aSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193699c4c48aSmrg   fi
193799c4c48aSmrg   have_xsltproc=no
193899c4c48aSmrgelse
193999c4c48aSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19408a355152Smrgfi
19415977a007Smrg
194299c4c48aSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194399c4c48aSmrg]) # XORG_WITH_XSLTPROC
194499c4c48aSmrg
194599c4c48aSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194699c4c48aSmrg# ----------------------------------------
194799c4c48aSmrg# Minimum version: 1.15.0
19485977a007Smrg#
194999c4c48aSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
195099c4c48aSmrg# scanning arbitrary text files, extracting information from those text files,
195199c4c48aSmrg# and printing reports based on that information.
19525977a007Smrg#
195399c4c48aSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
19545977a007Smrg#
195599c4c48aSmrg# Interface to module:
195699c4c48aSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
195799c4c48aSmrg# PERL:	     returns the path of the perl program found
195899c4c48aSmrg#	     returns the path set by the user in the environment
195999c4c48aSmrg# --with-perl: 'yes' user instructs the module to use perl
196099c4c48aSmrg#	       'no' user instructs the module not to use perl
196199c4c48aSmrg# have_perl: returns yes if perl found in PATH or no
19625977a007Smrg#
196399c4c48aSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196499c4c48aSmrg#
196599c4c48aSmrgAC_DEFUN([XORG_WITH_PERL],[
196699c4c48aSmrgAC_ARG_VAR([PERL], [Path to perl command])
196799c4c48aSmrg# Preserves the interface, should it be implemented later
196899c4c48aSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196999c4c48aSmrgm4_define([_defopt], m4_default([$2], [auto]))
197099c4c48aSmrgAC_ARG_WITH(perl,
197199c4c48aSmrg	AS_HELP_STRING([--with-perl],
197299c4c48aSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197399c4c48aSmrg	   [use_perl=$withval], [use_perl=]_defopt)
197499c4c48aSmrgm4_undefine([_defopt])
19758a355152Smrg
197699c4c48aSmrgif test "x$use_perl" = x"auto"; then
197799c4c48aSmrg   AC_PATH_PROG([PERL], [perl])
197899c4c48aSmrg   if test "x$PERL" = "x"; then
197999c4c48aSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198099c4c48aSmrg	have_perl=no
198199c4c48aSmrg   else
198299c4c48aSmrg        have_perl=yes
198399c4c48aSmrg   fi
198499c4c48aSmrgelif test "x$use_perl" = x"yes" ; then
198599c4c48aSmrg   AC_PATH_PROG([PERL], [perl])
198699c4c48aSmrg   if test "x$PERL" = "x"; then
198799c4c48aSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198899c4c48aSmrg   fi
198999c4c48aSmrg   have_perl=yes
199099c4c48aSmrgelif test "x$use_perl" = x"no" ; then
199199c4c48aSmrg   if test "x$PERL" != "x"; then
199299c4c48aSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199399c4c48aSmrg   fi
199499c4c48aSmrg   have_perl=no
199599c4c48aSmrgelse
199699c4c48aSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199799c4c48aSmrgfi
19988a355152Smrg
199999c4c48aSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200099c4c48aSmrg]) # XORG_WITH_PERL
20015977a007Smrg
200299c4c48aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
20038a355152Smrg# ----------------
200499c4c48aSmrg# Minimum version: 1.5.0
200599c4c48aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20065977a007Smrg#
200799c4c48aSmrg# Documentation tools are not always available on all platforms and sometimes
200899c4c48aSmrg# not at the appropriate level. This macro enables a module to test for the
200999c4c48aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20108d1e6323Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
201199c4c48aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201299c4c48aSmrg# --with-asciidoc assumes 'auto'.
20135977a007Smrg#
201499c4c48aSmrg# Interface to module:
201599c4c48aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201699c4c48aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
201799c4c48aSmrg#		 returns the path set by the user in the environment
201899c4c48aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201999c4c48aSmrg#		  'no' user instructs the module not to use asciidoc
20205977a007Smrg#
202199c4c48aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20225977a007Smrg#
202399c4c48aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202499c4c48aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202599c4c48aSmrgm4_define([_defopt], m4_default([$2], [auto]))
202699c4c48aSmrgAC_ARG_WITH(asciidoc,
202799c4c48aSmrg	AS_HELP_STRING([--with-asciidoc],
202899c4c48aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202999c4c48aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203099c4c48aSmrgm4_undefine([_defopt])
20318a355152Smrg
203299c4c48aSmrgif test "x$use_asciidoc" = x"auto"; then
203399c4c48aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203499c4c48aSmrg   if test "x$ASCIIDOC" = "x"; then
203599c4c48aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203699c4c48aSmrg	have_asciidoc=no
203799c4c48aSmrg   else
203899c4c48aSmrg        have_asciidoc=yes
203999c4c48aSmrg   fi
204099c4c48aSmrgelif test "x$use_asciidoc" = x"yes" ; then
204199c4c48aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204299c4c48aSmrg   if test "x$ASCIIDOC" = "x"; then
204399c4c48aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204499c4c48aSmrg   fi
204599c4c48aSmrg   have_asciidoc=yes
204699c4c48aSmrgelif test "x$use_asciidoc" = x"no" ; then
204799c4c48aSmrg   if test "x$ASCIIDOC" != "x"; then
204899c4c48aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204999c4c48aSmrg   fi
205099c4c48aSmrg   have_asciidoc=no
205199c4c48aSmrgelse
205299c4c48aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205399c4c48aSmrgfi
205499c4c48aSmrgm4_ifval([$1],
205599c4c48aSmrg[if test "$have_asciidoc" = yes; then
205699c4c48aSmrg    # scrape the asciidoc version
205799c4c48aSmrg    AC_MSG_CHECKING([the asciidoc version])
205899c4c48aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205999c4c48aSmrg    AC_MSG_RESULT([$asciidoc_version])
206099c4c48aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206199c4c48aSmrg        [if test "x$use_asciidoc" = xauto; then
206299c4c48aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206399c4c48aSmrg            have_asciidoc=no
206499c4c48aSmrg        else
206599c4c48aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206699c4c48aSmrg        fi])
206799c4c48aSmrgfi])
206899c4c48aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206999c4c48aSmrg]) # XORG_WITH_ASCIIDOC
20708a355152Smrg
207199c4c48aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207299c4c48aSmrg# -------------------------------------------
207399c4c48aSmrg# Minimum version: 1.5.0
207499c4c48aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
207599c4c48aSmrg# Minimum version for optional DOT checking: 1.18.0
20765977a007Smrg#
207799c4c48aSmrg# Documentation tools are not always available on all platforms and sometimes
207899c4c48aSmrg# not at the appropriate level. This macro enables a module to test for the
207999c4c48aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20808d1e6323Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
208199c4c48aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208299c4c48aSmrg# --with-doxygen assumes 'auto'.
20835977a007Smrg#
208499c4c48aSmrg# Interface to module:
208599c4c48aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208699c4c48aSmrg# DOXYGEN:	 returns the path of the doxygen program found
208799c4c48aSmrg#		 returns the path set by the user in the environment
208899c4c48aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208999c4c48aSmrg#		  'no' user instructs the module not to use doxygen
20905977a007Smrg#
209199c4c48aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20925977a007Smrg#
209399c4c48aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209499c4c48aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209599c4c48aSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209699c4c48aSmrgm4_define([_defopt], m4_default([$2], [auto]))
209799c4c48aSmrgAC_ARG_WITH(doxygen,
209899c4c48aSmrg	AS_HELP_STRING([--with-doxygen],
209999c4c48aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210099c4c48aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210199c4c48aSmrgm4_undefine([_defopt])
21028a355152Smrg
210399c4c48aSmrgif test "x$use_doxygen" = x"auto"; then
210499c4c48aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210599c4c48aSmrg   if test "x$DOXYGEN" = "x"; then
210699c4c48aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210799c4c48aSmrg	have_doxygen=no
210899c4c48aSmrg   else
210999c4c48aSmrg        have_doxygen=yes
211099c4c48aSmrg   fi
211199c4c48aSmrgelif test "x$use_doxygen" = x"yes" ; then
211299c4c48aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211399c4c48aSmrg   if test "x$DOXYGEN" = "x"; then
211499c4c48aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211599c4c48aSmrg   fi
211699c4c48aSmrg   have_doxygen=yes
211799c4c48aSmrgelif test "x$use_doxygen" = x"no" ; then
211899c4c48aSmrg   if test "x$DOXYGEN" != "x"; then
211999c4c48aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212099c4c48aSmrg   fi
212199c4c48aSmrg   have_doxygen=no
21225977a007Smrgelse
212399c4c48aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
21245977a007Smrgfi
212599c4c48aSmrgm4_ifval([$1],
212699c4c48aSmrg[if test "$have_doxygen" = yes; then
212799c4c48aSmrg    # scrape the doxygen version
212899c4c48aSmrg    AC_MSG_CHECKING([the doxygen version])
212999c4c48aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213099c4c48aSmrg    AC_MSG_RESULT([$doxygen_version])
213199c4c48aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213299c4c48aSmrg        [if test "x$use_doxygen" = xauto; then
213399c4c48aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213499c4c48aSmrg            have_doxygen=no
213599c4c48aSmrg        else
213699c4c48aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213799c4c48aSmrg        fi])
213899c4c48aSmrgfi])
21398a355152Smrg
214099c4c48aSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214199c4c48aSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214299c4c48aSmrgdnl 	HAVE_DOT = @HAVE_DOT@
214399c4c48aSmrgHAVE_DOT=no
214499c4c48aSmrgif test "x$have_doxygen" = "xyes"; then
214599c4c48aSmrg  AC_PATH_PROG([DOT], [dot])
214699c4c48aSmrg    if test "x$DOT" != "x"; then
214799c4c48aSmrg      HAVE_DOT=yes
214899c4c48aSmrg    fi
214999c4c48aSmrgfi
21508a355152Smrg
215199c4c48aSmrgAC_SUBST([HAVE_DOT])
215299c4c48aSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215399c4c48aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215499c4c48aSmrg]) # XORG_WITH_DOXYGEN
21558a355152Smrg
215699c4c48aSmrg# XORG_WITH_GROFF([DEFAULT])
215799c4c48aSmrg# ----------------
215899c4c48aSmrg# Minimum version: 1.6.0
215999c4c48aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
21605977a007Smrg#
216199c4c48aSmrg# Documentation tools are not always available on all platforms and sometimes
216299c4c48aSmrg# not at the appropriate level. This macro enables a module to test for the
216399c4c48aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
21648d1e6323Smrg# the --with-groff option, it allows maximum flexibility in making decisions
216599c4c48aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
216699c4c48aSmrg# --with-groff assumes 'auto'.
216799c4c48aSmrg#
216899c4c48aSmrg# Interface to module:
216999c4c48aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217099c4c48aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217199c4c48aSmrg# HAVE_GROFF_MS: the -ms macros package
217299c4c48aSmrg# GROFF:	 returns the path of the groff program found
217399c4c48aSmrg#		 returns the path set by the user in the environment
217499c4c48aSmrg# --with-groff:	 'yes' user instructs the module to use groff
217599c4c48aSmrg#		 'no' user instructs the module not to use groff
217699c4c48aSmrg#
217799c4c48aSmrg# Added in version 1.9.0:
217899c4c48aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217999c4c48aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218099c4c48aSmrg#		   psselect from the psutils package.
218199c4c48aSmrg#		   the ghostcript package. Refer to the grohtml man pages
218299c4c48aSmrg#
218399c4c48aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218499c4c48aSmrg#
218599c4c48aSmrg# OS and distros often splits groff in a basic and full package, the former
218699c4c48aSmrg# having the groff program and the later having devices, fonts and macros
218799c4c48aSmrg# Checking for the groff executable is not enough.
218899c4c48aSmrg#
218999c4c48aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
219099c4c48aSmrg# unset HAVE_GROFF or GROFF env variables.
219199c4c48aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219299c4c48aSmrg#
219399c4c48aSmrgAC_DEFUN([XORG_WITH_GROFF],[
219499c4c48aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
219599c4c48aSmrgm4_define([_defopt], m4_default([$1], [auto]))
219699c4c48aSmrgAC_ARG_WITH(groff,
219799c4c48aSmrg	AS_HELP_STRING([--with-groff],
219899c4c48aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219999c4c48aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
220099c4c48aSmrgm4_undefine([_defopt])
22015977a007Smrg
220299c4c48aSmrgif test "x$use_groff" = x"auto"; then
220399c4c48aSmrg   AC_PATH_PROG([GROFF], [groff])
220499c4c48aSmrg   if test "x$GROFF" = "x"; then
220599c4c48aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220699c4c48aSmrg	have_groff=no
220799c4c48aSmrg   else
220899c4c48aSmrg        have_groff=yes
220999c4c48aSmrg   fi
221099c4c48aSmrgelif test "x$use_groff" = x"yes" ; then
221199c4c48aSmrg   AC_PATH_PROG([GROFF], [groff])
221299c4c48aSmrg   if test "x$GROFF" = "x"; then
221399c4c48aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221499c4c48aSmrg   fi
221599c4c48aSmrg   have_groff=yes
221699c4c48aSmrgelif test "x$use_groff" = x"no" ; then
221799c4c48aSmrg   if test "x$GROFF" != "x"; then
221899c4c48aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221999c4c48aSmrg   fi
222099c4c48aSmrg   have_groff=no
222199c4c48aSmrgelse
222299c4c48aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222399c4c48aSmrgfi
22245977a007Smrg
222599c4c48aSmrg# We have groff, test for the presence of the macro packages
222699c4c48aSmrgif test "x$have_groff" = x"yes"; then
222799c4c48aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222899c4c48aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222999c4c48aSmrg        groff_ms_works=yes
223099c4c48aSmrg    else
223199c4c48aSmrg        groff_ms_works=no
22328a355152Smrg    fi
223399c4c48aSmrg    AC_MSG_RESULT([$groff_ms_works])
223499c4c48aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223599c4c48aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223699c4c48aSmrg        groff_mm_works=yes
223799c4c48aSmrg    else
223899c4c48aSmrg        groff_mm_works=no
223999c4c48aSmrg    fi
224099c4c48aSmrg    AC_MSG_RESULT([$groff_mm_works])
224199c4c48aSmrgfi
22425977a007Smrg
224399c4c48aSmrg# We have groff, test for HTML dependencies, one command per package
224499c4c48aSmrgif test "x$have_groff" = x"yes"; then
224599c4c48aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224699c4c48aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224799c4c48aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224899c4c48aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224999c4c48aSmrg      have_groff_html=yes
225099c4c48aSmrg   else
225199c4c48aSmrg      have_groff_html=no
225299c4c48aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225399c4c48aSmrg   fi
225499c4c48aSmrgfi
225599c4c48aSmrg
225699c4c48aSmrg# Set Automake conditionals for Makefiles
225799c4c48aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225899c4c48aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225999c4c48aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226099c4c48aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226199c4c48aSmrg]) # XORG_WITH_GROFF
226299c4c48aSmrg
226399c4c48aSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226499c4c48aSmrg# ---------------------------------------
226599c4c48aSmrg# Minimum version: 1.6.0
226699c4c48aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
226799c4c48aSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226899c4c48aSmrg#
226999c4c48aSmrg# Documentation tools are not always available on all platforms and sometimes
227099c4c48aSmrg# not at the appropriate level. This macro enables a module to test for the
227199c4c48aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
22728d1e6323Smrg# the --with-fop option, it allows maximum flexibility in making decisions
227399c4c48aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
227499c4c48aSmrg# --with-fop assumes 'auto'.
227599c4c48aSmrg#
227699c4c48aSmrg# Interface to module:
227799c4c48aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227899c4c48aSmrg# FOP:	 	returns the path of the fop program found
227999c4c48aSmrg#		returns the path set by the user in the environment
228099c4c48aSmrg# --with-fop: 	'yes' user instructs the module to use fop
228199c4c48aSmrg#		'no' user instructs the module not to use fop
228299c4c48aSmrg#
228399c4c48aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228499c4c48aSmrg#
228599c4c48aSmrgAC_DEFUN([XORG_WITH_FOP],[
228699c4c48aSmrgAC_ARG_VAR([FOP], [Path to fop command])
228799c4c48aSmrgm4_define([_defopt], m4_default([$2], [auto]))
228899c4c48aSmrgAC_ARG_WITH(fop,
228999c4c48aSmrg	AS_HELP_STRING([--with-fop],
229099c4c48aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229199c4c48aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
229299c4c48aSmrgm4_undefine([_defopt])
229399c4c48aSmrg
229499c4c48aSmrgif test "x$use_fop" = x"auto"; then
229599c4c48aSmrg   AC_PATH_PROG([FOP], [fop])
229699c4c48aSmrg   if test "x$FOP" = "x"; then
229799c4c48aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229899c4c48aSmrg	have_fop=no
229999c4c48aSmrg   else
230099c4c48aSmrg        have_fop=yes
230199c4c48aSmrg   fi
230299c4c48aSmrgelif test "x$use_fop" = x"yes" ; then
230399c4c48aSmrg   AC_PATH_PROG([FOP], [fop])
230499c4c48aSmrg   if test "x$FOP" = "x"; then
230599c4c48aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230699c4c48aSmrg   fi
230799c4c48aSmrg   have_fop=yes
230899c4c48aSmrgelif test "x$use_fop" = x"no" ; then
230999c4c48aSmrg   if test "x$FOP" != "x"; then
231099c4c48aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231199c4c48aSmrg   fi
231299c4c48aSmrg   have_fop=no
23138a355152Smrgelse
231499c4c48aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
23155977a007Smrgfi
23165977a007Smrg
231799c4c48aSmrg# Test for a minimum version of fop, if provided.
231899c4c48aSmrgm4_ifval([$1],
231999c4c48aSmrg[if test "$have_fop" = yes; then
232099c4c48aSmrg    # scrape the fop version
232199c4c48aSmrg    AC_MSG_CHECKING([for fop minimum version])
232299c4c48aSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232399c4c48aSmrg    AC_MSG_RESULT([$fop_version])
232499c4c48aSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
232599c4c48aSmrg        [if test "x$use_fop" = xauto; then
232699c4c48aSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232799c4c48aSmrg            have_fop=no
232899c4c48aSmrg        else
232999c4c48aSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233099c4c48aSmrg        fi])
233199c4c48aSmrgfi])
233299c4c48aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233399c4c48aSmrg]) # XORG_WITH_FOP
233499c4c48aSmrg
233599c4c48aSmrg# XORG_WITH_M4([MIN-VERSION])
233699c4c48aSmrg# ---------------------------
233799c4c48aSmrg# Minimum version: 1.19.0
233899c4c48aSmrg#
233999c4c48aSmrg# This macro attempts to locate an m4 macro processor which supports
234099c4c48aSmrg# -I option and is only useful for modules relying on M4 in order to
234199c4c48aSmrg# expand macros in source code files.
234299c4c48aSmrg#
234399c4c48aSmrg# Interface to module:
234499c4c48aSmrg# M4:	 	returns the path of the m4 program found
234599c4c48aSmrg#		returns the path set by the user in the environment
234699c4c48aSmrg#
234799c4c48aSmrgAC_DEFUN([XORG_WITH_M4], [
234899c4c48aSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234999c4c48aSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235099c4c48aSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235199c4c48aSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235299c4c48aSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235399c4c48aSmrg   [$PATH:/usr/gnu/bin])])
23545977a007Smrg
235599c4c48aSmrgAC_SUBST([M4], [$ac_cv_path_M4])
235699c4c48aSmrg]) # XORG_WITH_M4
23578108eb18Smrg
235899c4c48aSmrg# XORG_WITH_PS2PDF([DEFAULT])
235999c4c48aSmrg# ----------------
236099c4c48aSmrg# Minimum version: 1.6.0
236199c4c48aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
236299c4c48aSmrg#
236399c4c48aSmrg# Documentation tools are not always available on all platforms and sometimes
236499c4c48aSmrg# not at the appropriate level. This macro enables a module to test for the
236599c4c48aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
23668d1e6323Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
236799c4c48aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236899c4c48aSmrg# --with-ps2pdf assumes 'auto'.
236999c4c48aSmrg#
237099c4c48aSmrg# Interface to module:
237199c4c48aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237299c4c48aSmrg# PS2PDF:	returns the path of the ps2pdf program found
237399c4c48aSmrg#		returns the path set by the user in the environment
237499c4c48aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237599c4c48aSmrg#		 'no' user instructs the module not to use ps2pdf
237699c4c48aSmrg#
237799c4c48aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237899c4c48aSmrg#
237999c4c48aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238099c4c48aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238199c4c48aSmrgm4_define([_defopt], m4_default([$1], [auto]))
238299c4c48aSmrgAC_ARG_WITH(ps2pdf,
238399c4c48aSmrg	AS_HELP_STRING([--with-ps2pdf],
238499c4c48aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238599c4c48aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238699c4c48aSmrgm4_undefine([_defopt])
23878108eb18Smrg
238899c4c48aSmrgif test "x$use_ps2pdf" = x"auto"; then
238999c4c48aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239099c4c48aSmrg   if test "x$PS2PDF" = "x"; then
239199c4c48aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239299c4c48aSmrg	have_ps2pdf=no
239399c4c48aSmrg   else
239499c4c48aSmrg        have_ps2pdf=yes
239599c4c48aSmrg   fi
239699c4c48aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
239799c4c48aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239899c4c48aSmrg   if test "x$PS2PDF" = "x"; then
239999c4c48aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240099c4c48aSmrg   fi
240199c4c48aSmrg   have_ps2pdf=yes
240299c4c48aSmrgelif test "x$use_ps2pdf" = x"no" ; then
240399c4c48aSmrg   if test "x$PS2PDF" != "x"; then
240499c4c48aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240599c4c48aSmrg   fi
240699c4c48aSmrg   have_ps2pdf=no
240799c4c48aSmrgelse
240899c4c48aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
24098108eb18Smrgfi
241099c4c48aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241199c4c48aSmrg]) # XORG_WITH_PS2PDF
24128108eb18Smrg
241399c4c48aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
241499c4c48aSmrg# ----------------
241599c4c48aSmrg# Minimum version: 1.6.0
24161a650d1eSmrg#
241799c4c48aSmrg# Documentation tools are not always available on all platforms and sometimes
241899c4c48aSmrg# not at the appropriate level. This macro enables a builder to skip all
241999c4c48aSmrg# documentation targets except traditional man pages.
242099c4c48aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24218d1e6323Smrg# maximum flexibility in controlling documentation building.
242299c4c48aSmrg# Refer to:
242399c4c48aSmrg# XORG_WITH_XMLTO         --with-xmlto
242499c4c48aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242599c4c48aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
242699c4c48aSmrg# XORG_WITH_FOP           --with-fop
242799c4c48aSmrg# XORG_WITH_GROFF         --with-groff
242899c4c48aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
242999c4c48aSmrg#
243099c4c48aSmrg# Interface to module:
243199c4c48aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243299c4c48aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
243399c4c48aSmrg#		 'no' user instructs the module not to generate docs
243499c4c48aSmrg# parm1:	specify the default value, yes or no.
243599c4c48aSmrg#
243699c4c48aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243799c4c48aSmrgm4_define([docs_default], m4_default([$1], [yes]))
243899c4c48aSmrgAC_ARG_ENABLE(docs,
243999c4c48aSmrg	AS_HELP_STRING([--enable-docs],
244099c4c48aSmrg	   [Enable building the documentation (default: ]docs_default[)]),
244199c4c48aSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
244299c4c48aSmrgm4_undefine([docs_default])
244399c4c48aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244499c4c48aSmrgAC_MSG_CHECKING([whether to build documentation])
244599c4c48aSmrgAC_MSG_RESULT([$build_docs])
244699c4c48aSmrg]) # XORG_ENABLE_DOCS
24471a650d1eSmrg
244899c4c48aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244999c4c48aSmrg# ----------------
245099c4c48aSmrg# Minimum version: 1.6.0
245199c4c48aSmrg#
245299c4c48aSmrg# This macro enables a builder to skip all developer documentation.
245399c4c48aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24548d1e6323Smrg# maximum flexibility in controlling documentation building.
245599c4c48aSmrg# Refer to:
245699c4c48aSmrg# XORG_WITH_XMLTO         --with-xmlto
245799c4c48aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245899c4c48aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
245999c4c48aSmrg# XORG_WITH_FOP           --with-fop
246099c4c48aSmrg# XORG_WITH_GROFF         --with-groff
246199c4c48aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
246299c4c48aSmrg#
246399c4c48aSmrg# Interface to module:
246499c4c48aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246599c4c48aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246699c4c48aSmrg#			'no' user instructs the module not to generate developer docs
246799c4c48aSmrg# parm1:		specify the default value, yes or no.
246899c4c48aSmrg#
246999c4c48aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247099c4c48aSmrgm4_define([devel_default], m4_default([$1], [yes]))
247199c4c48aSmrgAC_ARG_ENABLE(devel-docs,
247299c4c48aSmrg	AS_HELP_STRING([--enable-devel-docs],
247399c4c48aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247499c4c48aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247599c4c48aSmrgm4_undefine([devel_default])
247699c4c48aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247799c4c48aSmrgAC_MSG_CHECKING([whether to build developer documentation])
247899c4c48aSmrgAC_MSG_RESULT([$build_devel_docs])
247999c4c48aSmrg]) # XORG_ENABLE_DEVEL_DOCS
24801a650d1eSmrg
248199c4c48aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
248299c4c48aSmrg# ----------------
248399c4c48aSmrg# Minimum version: 1.6.0
248499c4c48aSmrg#
248599c4c48aSmrg# This macro enables a builder to skip all functional specification targets.
248699c4c48aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24878d1e6323Smrg# maximum flexibility in controlling documentation building.
248899c4c48aSmrg# Refer to:
248999c4c48aSmrg# XORG_WITH_XMLTO         --with-xmlto
249099c4c48aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249199c4c48aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
249299c4c48aSmrg# XORG_WITH_FOP           --with-fop
249399c4c48aSmrg# XORG_WITH_GROFF         --with-groff
249499c4c48aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
249599c4c48aSmrg#
249699c4c48aSmrg# Interface to module:
249799c4c48aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249899c4c48aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
249999c4c48aSmrg#			'no' user instructs the module not to generate specs
250099c4c48aSmrg# parm1:		specify the default value, yes or no.
250199c4c48aSmrg#
250299c4c48aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250399c4c48aSmrgm4_define([spec_default], m4_default([$1], [yes]))
250499c4c48aSmrgAC_ARG_ENABLE(specs,
250599c4c48aSmrg	AS_HELP_STRING([--enable-specs],
250699c4c48aSmrg	   [Enable building the specs (default: ]spec_default[)]),
250799c4c48aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
250899c4c48aSmrgm4_undefine([spec_default])
250999c4c48aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251099c4c48aSmrgAC_MSG_CHECKING([whether to build functional specifications])
251199c4c48aSmrgAC_MSG_RESULT([$build_specs])
251299c4c48aSmrg]) # XORG_ENABLE_SPECS
25131a650d1eSmrg
251499c4c48aSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251599c4c48aSmrg# ----------------------------------------------
251699c4c48aSmrg# Minimum version: 1.13.0
25178a355152Smrg#
251899c4c48aSmrg# This macro enables a builder to enable/disable unit testing
251999c4c48aSmrg# It makes no assumption about the test cases implementation
252099c4c48aSmrg# Test cases may or may not use Automake "Support for test suites"
252199c4c48aSmrg# They may or may not use the software utility library GLib
252299c4c48aSmrg#
252399c4c48aSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252499c4c48aSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252599c4c48aSmrg# The variable enable_unit_tests is used by other macros in this file.
252699c4c48aSmrg#
252799c4c48aSmrg# Interface to module:
252899c4c48aSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252999c4c48aSmrg# enable_unit_tests:    used in configure.ac for additional configuration
253099c4c48aSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253199c4c48aSmrg#			'no' user instructs the module not to build tests
253299c4c48aSmrg# parm1:		specify the default value, yes or no.
253399c4c48aSmrg#
253499c4c48aSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253599c4c48aSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253699c4c48aSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253799c4c48aSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253899c4c48aSmrgm4_define([_defopt], m4_default([$1], [auto]))
253999c4c48aSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254099c4c48aSmrg	[Enable building unit test cases (default: ]_defopt[)]),
254199c4c48aSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254299c4c48aSmrgm4_undefine([_defopt])
254399c4c48aSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254499c4c48aSmrgAC_MSG_CHECKING([whether to build unit test cases])
254599c4c48aSmrgAC_MSG_RESULT([$enable_unit_tests])
254699c4c48aSmrg]) # XORG_ENABLE_UNIT_TESTS
25471a650d1eSmrg
254899c4c48aSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254999c4c48aSmrg# ------------------------------------------------------
255099c4c48aSmrg# Minimum version: 1.17.0
255199c4c48aSmrg#
255299c4c48aSmrg# This macro enables a builder to enable/disable integration testing
255399c4c48aSmrg# It makes no assumption about the test cases' implementation
255499c4c48aSmrg# Test cases may or may not use Automake "Support for test suites"
255599c4c48aSmrg#
255699c4c48aSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255799c4c48aSmrg# usually requires less dependencies and may be built and run under less
255899c4c48aSmrg# stringent environments than integration tests.
255999c4c48aSmrg#
256099c4c48aSmrg# Interface to module:
256199c4c48aSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256299c4c48aSmrg# enable_integration_tests:   used in configure.ac for additional configuration
256399c4c48aSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256499c4c48aSmrg#                             'no' user instructs the module not to build tests
256599c4c48aSmrg# parm1:                      specify the default value, yes or no.
256699c4c48aSmrg#
256799c4c48aSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256899c4c48aSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256999c4c48aSmrgm4_define([_defopt], m4_default([$1], [auto]))
257099c4c48aSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257199c4c48aSmrg	[Enable building integration test cases (default: ]_defopt[)]),
257299c4c48aSmrg	[enable_integration_tests=$enableval],
257399c4c48aSmrg	[enable_integration_tests=]_defopt)
257499c4c48aSmrgm4_undefine([_defopt])
257599c4c48aSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257699c4c48aSmrg	[test "x$enable_integration_tests" != xno])
257799c4c48aSmrgAC_MSG_CHECKING([whether to build unit test cases])
257899c4c48aSmrgAC_MSG_RESULT([$enable_integration_tests])
257999c4c48aSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
25801a650d1eSmrg
258199c4c48aSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258299c4c48aSmrg# ----------------------------------------
258399c4c48aSmrg# Minimum version: 1.13.0
258499c4c48aSmrg#
258599c4c48aSmrg# GLib is a library which provides advanced data structures and functions.
258699c4c48aSmrg# This macro enables a module to test for the presence of Glib.
258799c4c48aSmrg#
258899c4c48aSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258999c4c48aSmrg# Otherwise the value of $enable_unit_tests is blank.
259099c4c48aSmrg#
259199c4c48aSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259299c4c48aSmrg# test support usually requires less dependencies and may be built and run under
259399c4c48aSmrg# less stringent environments than integration tests.
25941a650d1eSmrg#
259599c4c48aSmrg# Interface to module:
259699c4c48aSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
259799c4c48aSmrg# with_glib: used in configure.ac to know if GLib has been found
259899c4c48aSmrg# --with-glib:	'yes' user instructs the module to use glib
259999c4c48aSmrg#		'no' user instructs the module not to use glib
260099c4c48aSmrg#
260199c4c48aSmrgAC_DEFUN([XORG_WITH_GLIB],[
260299c4c48aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260399c4c48aSmrgm4_define([_defopt], m4_default([$2], [auto]))
260499c4c48aSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260599c4c48aSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260699c4c48aSmrg	[with_glib=$withval], [with_glib=]_defopt)
260799c4c48aSmrgm4_undefine([_defopt])
26088a355152Smrg
260999c4c48aSmrghave_glib=no
261099c4c48aSmrg# Do not probe GLib if user explicitly disabled unit testing
261199c4c48aSmrgif test "x$enable_unit_tests" != x"no"; then
261299c4c48aSmrg  # Do not probe GLib if user explicitly disabled it
261399c4c48aSmrg  if test "x$with_glib" != x"no"; then
261499c4c48aSmrg    m4_ifval(
261599c4c48aSmrg      [$1],
261699c4c48aSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261799c4c48aSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261899c4c48aSmrg    )
26198a355152Smrg  fi
26201a650d1eSmrgfi
26211a650d1eSmrg
262299c4c48aSmrg# Not having GLib when unit testing has been explicitly requested is an error
262399c4c48aSmrgif test "x$enable_unit_tests" = x"yes"; then
262499c4c48aSmrg  if test "x$have_glib" = x"no"; then
262599c4c48aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26268a355152Smrg  fi
26278a355152Smrgfi
26281a650d1eSmrg
262999c4c48aSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
263099c4c48aSmrgif test "x$enable_unit_tests" = x"no"; then
263199c4c48aSmrg  if test "x$with_glib" = x"yes"; then
263299c4c48aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263399c4c48aSmrg  fi
263499c4c48aSmrgfi
26355977a007Smrg
263699c4c48aSmrg# Not having GLib when it has been explicitly requested is an error
263799c4c48aSmrgif test "x$with_glib" = x"yes"; then
263899c4c48aSmrg  if test "x$have_glib" = x"no"; then
263999c4c48aSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264099c4c48aSmrg  fi
264199c4c48aSmrgfi
26425977a007Smrg
264399c4c48aSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264499c4c48aSmrg]) # XORG_WITH_GLIB
26458a355152Smrg
264699c4c48aSmrg# XORG_LD_WRAP([required|optional])
264799c4c48aSmrg# ---------------------------------
264899c4c48aSmrg# Minimum version: 1.13.0
264999c4c48aSmrg#
265099c4c48aSmrg# Check if linker supports -wrap, passed via compiler flags
265199c4c48aSmrg#
265299c4c48aSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265399c4c48aSmrg# Otherwise the value of $enable_unit_tests is blank.
265499c4c48aSmrg#
265599c4c48aSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265699c4c48aSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265799c4c48aSmrg# available, an argument of "optional" allows use when some unit tests require
265899c4c48aSmrg# ld -wrap and others do not.
265999c4c48aSmrg#
266099c4c48aSmrgAC_DEFUN([XORG_LD_WRAP],[
266199c4c48aSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266299c4c48aSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266399c4c48aSmrg                      void __wrap_exit(int status) { return; }],
266499c4c48aSmrg                     [exit(0);])])
266599c4c48aSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
266699c4c48aSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266799c4c48aSmrg  if test "x$have_ld_wrap" = x"no"; then
266899c4c48aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266999c4c48aSmrg  fi
267099c4c48aSmrgfi
267199c4c48aSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267299c4c48aSmrg#
267399c4c48aSmrg]) # XORG_LD_WRAP
26748a355152Smrg
267599c4c48aSmrg# XORG_CHECK_LINKER_FLAGS
267699c4c48aSmrg# -----------------------
267799c4c48aSmrg# SYNOPSIS
267899c4c48aSmrg#
267999c4c48aSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268099c4c48aSmrg#
268199c4c48aSmrg# DESCRIPTION
268299c4c48aSmrg#
268399c4c48aSmrg#   Check whether the given linker FLAGS work with the current language's
268499c4c48aSmrg#   linker, or whether they give an error.
268599c4c48aSmrg#
268699c4c48aSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268799c4c48aSmrg#   success/failure.
268899c4c48aSmrg#
268999c4c48aSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
269099c4c48aSmrg#
269199c4c48aSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269299c4c48aSmrg#
269399c4c48aSmrg# LICENSE
269499c4c48aSmrg#
269599c4c48aSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269699c4c48aSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269799c4c48aSmrg#   Copyright (c) 2009 Matteo Frigo
269899c4c48aSmrg#
269999c4c48aSmrg#   This program is free software: you can redistribute it and/or modify it
270099c4c48aSmrg#   under the terms of the GNU General Public License as published by the
270199c4c48aSmrg#   Free Software Foundation, either version 3 of the License, or (at your
270299c4c48aSmrg#   option) any later version.
270399c4c48aSmrg#
270499c4c48aSmrg#   This program is distributed in the hope that it will be useful, but
270599c4c48aSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270699c4c48aSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270799c4c48aSmrg#   Public License for more details.
270899c4c48aSmrg#
270999c4c48aSmrg#   You should have received a copy of the GNU General Public License along
271099c4c48aSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271199c4c48aSmrg#
271299c4c48aSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
271399c4c48aSmrg#   gives unlimited permission to copy, distribute and modify the configure
271499c4c48aSmrg#   scripts that are the output of Autoconf when processing the Macro. You
271599c4c48aSmrg#   need not follow the terms of the GNU General Public License when using
271699c4c48aSmrg#   or distributing such scripts, even though portions of the text of the
271799c4c48aSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271899c4c48aSmrg#   all other use of the material that constitutes the Autoconf Macro.
271999c4c48aSmrg#
272099c4c48aSmrg#   This special exception to the GPL applies to versions of the Autoconf
272199c4c48aSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
272299c4c48aSmrg#   modified version of the Autoconf Macro, you may extend this special
272399c4c48aSmrg#   exception to the GPL to apply to your modified version as well.#
272499c4c48aSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272599c4c48aSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
272699c4c48aSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272799c4c48aSmrgAS_LITERAL_IF([$1],
272899c4c48aSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272999c4c48aSmrg      ax_save_FLAGS=$LDFLAGS
273099c4c48aSmrg      LDFLAGS="$1"
273199c4c48aSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273299c4c48aSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273399c4c48aSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273499c4c48aSmrg      LDFLAGS=$ax_save_FLAGS])],
273599c4c48aSmrg  [ax_save_FLAGS=$LDFLAGS
273699c4c48aSmrg   LDFLAGS="$1"
273799c4c48aSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273899c4c48aSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273999c4c48aSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274099c4c48aSmrg   LDFLAGS=$ax_save_FLAGS])
274199c4c48aSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274299c4c48aSmrgAC_MSG_RESULT($xorg_check_linker_flags)
274399c4c48aSmrgif test "x$xorg_check_linker_flags" = xyes; then
274499c4c48aSmrg	m4_default([$2], :)
274599c4c48aSmrgelse
274699c4c48aSmrg	m4_default([$3], :)
274799c4c48aSmrgfi
274899c4c48aSmrg]) # XORG_CHECK_LINKER_FLAGS
27495977a007Smrg
275099c4c48aSmrg# XORG_MEMORY_CHECK_FLAGS
275199c4c48aSmrg# -----------------------
275299c4c48aSmrg# Minimum version: 1.16.0
275399c4c48aSmrg#
275499c4c48aSmrg# This macro attempts to find appropriate memory checking functionality
275599c4c48aSmrg# for various platforms which unit testing code may use to catch various
275699c4c48aSmrg# forms of memory allocation and access errors in testing.
275799c4c48aSmrg#
275899c4c48aSmrg# Interface to module:
275999c4c48aSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276099c4c48aSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276199c4c48aSmrg#
276299c4c48aSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276399c4c48aSmrg#
276499c4c48aSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
27655977a007Smrg
276699c4c48aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
276799c4c48aSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276899c4c48aSmrg           [Environment variables to enable memory checking in tests])
27695977a007Smrg
277099c4c48aSmrg# Check for different types of support on different platforms
277199c4c48aSmrgcase $host_os in
277299c4c48aSmrg    solaris*)
277399c4c48aSmrg        AC_CHECK_LIB([umem], [umem_alloc],
277499c4c48aSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277599c4c48aSmrg        ;;
277699c4c48aSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277799c4c48aSmrg        # both directly and inverted, so should not be 0 or 255.
277899c4c48aSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
277999c4c48aSmrg        ;;
278099c4c48aSmrg    darwin*)
278199c4c48aSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278299c4c48aSmrg        ;;
278399c4c48aSmrg    *bsd*)
278499c4c48aSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278599c4c48aSmrg        ;;
278699c4c48aSmrgesac
27875977a007Smrg
278899c4c48aSmrg# User supplied flags override default flags
278999c4c48aSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279099c4c48aSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27915977a007Smrgfi
27925977a007Smrg
279399c4c48aSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279499c4c48aSmrg]) # XORG_WITH_LINT
27955977a007Smrg
279699c4c48aSmrg# XORG_CHECK_MALLOC_ZERO
279799c4c48aSmrg# ----------------------
279899c4c48aSmrg# Minimum version: 1.0.0
27995977a007Smrg#
280099c4c48aSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280199c4c48aSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280299c4c48aSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280399c4c48aSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280499c4c48aSmrgAC_ARG_ENABLE(malloc0returnsnull,
280599c4c48aSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280699c4c48aSmrg		       [malloc(0) returns NULL (default: auto)]),
280799c4c48aSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280899c4c48aSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
28095977a007Smrg
281099c4c48aSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281199c4c48aSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281299c4c48aSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281399c4c48aSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281499c4c48aSmrg#include <stdlib.h>
281599c4c48aSmrg],[
281699c4c48aSmrg    char *m0, *r0, *c0, *p;
281799c4c48aSmrg    m0 = malloc(0);
281899c4c48aSmrg    p = malloc(10);
281999c4c48aSmrg    r0 = realloc(p,0);
282099c4c48aSmrg    c0 = calloc(0,10);
282199c4c48aSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282299c4c48aSmrg])],
282399c4c48aSmrg		[xorg_cv_malloc0_returns_null=yes],
282499c4c48aSmrg		[xorg_cv_malloc0_returns_null=no])])
282599c4c48aSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28268a355152Smrgfi
282799c4c48aSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
28288a355152Smrg
282999c4c48aSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283099c4c48aSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283199c4c48aSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283299c4c48aSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28335977a007Smrgelse
283499c4c48aSmrg	MALLOC_ZERO_CFLAGS=""
283599c4c48aSmrg	XMALLOC_ZERO_CFLAGS=""
283699c4c48aSmrg	XTMALLOC_ZERO_CFLAGS=""
28375977a007Smrgfi
28385977a007Smrg
283999c4c48aSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284099c4c48aSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284199c4c48aSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284299c4c48aSmrg]) # XORG_CHECK_MALLOC_ZERO
28435977a007Smrg
284499c4c48aSmrg# XORG_WITH_LINT()
284599c4c48aSmrg# ----------------
284699c4c48aSmrg# Minimum version: 1.1.0
28478a355152Smrg#
284899c4c48aSmrg# This macro enables the use of a tool that flags some suspicious and
284999c4c48aSmrg# non-portable constructs (likely to be bugs) in C language source code.
285099c4c48aSmrg# It will attempt to locate the tool and use appropriate options.
285199c4c48aSmrg# There are various lint type tools on different platforms.
28528a355152Smrg#
285399c4c48aSmrg# Interface to module:
285499c4c48aSmrg# LINT:		returns the path to the tool found on the platform
285599c4c48aSmrg#		or the value set to LINT on the configure cmd line
285699c4c48aSmrg#		also an Automake conditional
285799c4c48aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
285899c4c48aSmrg#
285999c4c48aSmrg# --with-lint:	'yes' user instructs the module to use lint
286099c4c48aSmrg#		'no' user instructs the module not to use lint (default)
286199c4c48aSmrg#
286299c4c48aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286399c4c48aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286499c4c48aSmrg#
286599c4c48aSmrgAC_DEFUN([XORG_WITH_LINT],[
28665977a007Smrg
286799c4c48aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286899c4c48aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286999c4c48aSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287099c4c48aSmrg		[Use a lint-style source code checker (default: disabled)])],
287199c4c48aSmrg		[use_lint=$withval], [use_lint=no])
28728a355152Smrg
287399c4c48aSmrg# Obtain platform specific info like program name and options
287499c4c48aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287599c4c48aSmrgcase $host_os in
287699c4c48aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287799c4c48aSmrg	lint_name=splint
287899c4c48aSmrg	lint_options="-badflag"
287999c4c48aSmrg	;;
288099c4c48aSmrg  *freebsd* | *netbsd*)
288199c4c48aSmrg	lint_name=lint
288299c4c48aSmrg	lint_options="-u -b"
288399c4c48aSmrg	;;
288499c4c48aSmrg  *solaris*)
288599c4c48aSmrg	lint_name=lint
288699c4c48aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288799c4c48aSmrg	;;
288899c4c48aSmrgesac
288999c4c48aSmrg
289099c4c48aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289199c4c48aSmrgif test "x$use_lint" = x"yes" ; then
289299c4c48aSmrg   AC_PATH_PROG([LINT], [$lint_name])
289399c4c48aSmrg   if test "x$LINT" = "x"; then
289499c4c48aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289599c4c48aSmrg   fi
289699c4c48aSmrgelif test "x$use_lint" = x"no" ; then
289799c4c48aSmrg   if test "x$LINT" != "x"; then
289899c4c48aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289999c4c48aSmrg   fi
29005977a007Smrgelse
290199c4c48aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
29025977a007Smrgfi
29038a355152Smrg
290499c4c48aSmrg# User supplied flags override default flags
290599c4c48aSmrgif test "x$LINT_FLAGS" != "x"; then
290699c4c48aSmrg   lint_options=$LINT_FLAGS
290799c4c48aSmrgfi
29088a355152Smrg
290999c4c48aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291099c4c48aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
29118a355152Smrg
291299c4c48aSmrg]) # XORG_WITH_LINT
29138a355152Smrg
291499c4c48aSmrg# XORG_LINT_LIBRARY(LIBNAME)
291599c4c48aSmrg# --------------------------
291699c4c48aSmrg# Minimum version: 1.1.0
29171a650d1eSmrg#
291899c4c48aSmrg# Sets up flags for building lint libraries for checking programs that call
291999c4c48aSmrg# functions in the library.
292099c4c48aSmrg#
292199c4c48aSmrg# Interface to module:
292299c4c48aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
292399c4c48aSmrg# MAKE_LINT_LIB		- Automake conditional
292499c4c48aSmrg#
292599c4c48aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292699c4c48aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
29278a355152Smrg
292899c4c48aSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292999c4c48aSmrgAC_REQUIRE([XORG_WITH_LINT])
293099c4c48aSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293199c4c48aSmrg	[Create lint library (default: disabled)])],
293299c4c48aSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293399c4c48aSmrg
293499c4c48aSmrgif test "x$make_lint_lib" = x"yes" ; then
293599c4c48aSmrg   LINTLIB=llib-l$1.ln
293699c4c48aSmrg   if test "x$LINT" = "x"; then
293799c4c48aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293899c4c48aSmrg   fi
293999c4c48aSmrgelif test "x$make_lint_lib" != x"no" ; then
294099c4c48aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29418a355152Smrgfi
29428a355152Smrg
294399c4c48aSmrgAC_SUBST(LINTLIB)
294499c4c48aSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29458a355152Smrg
294699c4c48aSmrg]) # XORG_LINT_LIBRARY
29471a650d1eSmrg
294899c4c48aSmrg# XORG_COMPILER_BRAND
29498a355152Smrg# -------------------
295099c4c48aSmrg# Minimum version: 1.14.0
29518a355152Smrg#
295299c4c48aSmrg# Checks for various brands of compilers and sets flags as appropriate:
295399c4c48aSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295499c4c48aSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295599c4c48aSmrg#   clang compiler - sets CLANGCC to "yes"
295699c4c48aSmrg#   Intel compiler - sets INTELCC to "yes"
295799c4c48aSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295899c4c48aSmrg#
295999c4c48aSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296099c4c48aSmrgAC_LANG_CASE(
296199c4c48aSmrg	[C], [
29628d1e6323Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29638d1e6323Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
29648d1e6323Smrg		m4_version_prereq([2.70],
29658d1e6323Smrg			[AC_REQUIRE([AC_PROG_CC])],
29668d1e6323Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
296799c4c48aSmrg	],
296899c4c48aSmrg	[C++], [
296999c4c48aSmrg		AC_REQUIRE([AC_PROG_CXX])
297099c4c48aSmrg	]
297199c4c48aSmrg)
297299c4c48aSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
297399c4c48aSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297499c4c48aSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297599c4c48aSmrg]) # XORG_COMPILER_BRAND
29765977a007Smrg
297799c4c48aSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
29788a355152Smrg# ---------------
297999c4c48aSmrg# Minimum version: 1.16.0
298099c4c48aSmrg#
298199c4c48aSmrg# Test if the compiler works when passed the given flag as a command line argument.
29828d1e6323Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
298399c4c48aSmrg# next flag in the list until there are no more options.
298499c4c48aSmrg#
298599c4c48aSmrg# Note that this does not guarantee that the compiler supports the flag as some
298699c4c48aSmrg# compilers will simply ignore arguments that they do not understand, but we do
298799c4c48aSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298899c4c48aSmrg# -Werror=unused-command-line-argument
298999c4c48aSmrg#
299099c4c48aSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
299199c4c48aSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
299299c4c48aSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29935977a007Smrg
299499c4c48aSmrgAC_LANG_COMPILER_REQUIRE
29958a355152Smrg
299699c4c48aSmrgAC_LANG_CASE(
299799c4c48aSmrg	[C], [
29988d1e6323Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29998d1e6323Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
30008d1e6323Smrg		m4_version_prereq([2.70],
30018d1e6323Smrg			[AC_REQUIRE([AC_PROG_CC])],
30028d1e6323Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
300399c4c48aSmrg		define([PREFIX], [C])
300499c4c48aSmrg		define([CACHE_PREFIX], [cc])
300599c4c48aSmrg		define([COMPILER], [$CC])
300699c4c48aSmrg	],
300799c4c48aSmrg	[C++], [
300899c4c48aSmrg		define([PREFIX], [CXX])
300999c4c48aSmrg		define([CACHE_PREFIX], [cxx])
301099c4c48aSmrg		define([COMPILER], [$CXX])
301199c4c48aSmrg	]
301299c4c48aSmrg)
301399c4c48aSmrg
301499c4c48aSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
301599c4c48aSmrg
301699c4c48aSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
301799c4c48aSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301899c4c48aSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301999c4c48aSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
302099c4c48aSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302199c4c48aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
302299c4c48aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
302399c4c48aSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
302499c4c48aSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30258a355152Smrgfi
302699c4c48aSmrg
302799c4c48aSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302899c4c48aSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302999c4c48aSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303099c4c48aSmrg	fi
303199c4c48aSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
303299c4c48aSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
303399c4c48aSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
303499c4c48aSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
303599c4c48aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
303699c4c48aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
303799c4c48aSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303899c4c48aSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303999c4c48aSmrgfi
304099c4c48aSmrg
304199c4c48aSmrgfound="no"
304299c4c48aSmrgm4_foreach([flag], m4_cdr($@), [
304399c4c48aSmrg	if test $found = "no" ; then
304499c4c48aSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
304599c4c48aSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
304699c4c48aSmrg		fi
304799c4c48aSmrg
304899c4c48aSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304999c4c48aSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
305099c4c48aSmrg		fi
305199c4c48aSmrg
305299c4c48aSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
305399c4c48aSmrg
305499c4c48aSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
305599c4c48aSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
305699c4c48aSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
305799c4c48aSmrg		AC_CACHE_VAL($cacheid,
305899c4c48aSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305999c4c48aSmrg					     [eval $cacheid=yes],
306099c4c48aSmrg					     [eval $cacheid=no])])
306199c4c48aSmrg
306299c4c48aSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
306399c4c48aSmrg
306499c4c48aSmrg		eval supported=\$$cacheid
306599c4c48aSmrg		AC_MSG_RESULT([$supported])
306699c4c48aSmrg		if test "$supported" = "yes" ; then
306799c4c48aSmrg			$1="$$1 ]flag["
306899c4c48aSmrg			found="yes"
306999c4c48aSmrg		fi
307099c4c48aSmrg	fi
30718a355152Smrg])
307299c4c48aSmrg]) # XORG_TESTSET_CFLAG
30731a650d1eSmrg
307499c4c48aSmrg# XORG_COMPILER_FLAGS
307599c4c48aSmrg# ---------------
307699c4c48aSmrg# Minimum version: 1.16.0
30771a650d1eSmrg#
307899c4c48aSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307999c4c48aSmrg# arguments supported by the selected compiler which do NOT alter the generated
308099c4c48aSmrg# code.  These arguments will cause the compiler to print various warnings
308199c4c48aSmrg# during compilation AND turn a conservative set of warnings into errors.
308299c4c48aSmrg#
308399c4c48aSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
308499c4c48aSmrg# future versions of util-macros as options are added to new compilers.
308599c4c48aSmrg#
308699c4c48aSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
308799c4c48aSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30888a355152Smrg
308999c4c48aSmrgAC_ARG_ENABLE(selective-werror,
309099c4c48aSmrg              AS_HELP_STRING([--disable-selective-werror],
309199c4c48aSmrg                             [Turn off selective compiler errors. (default: enabled)]),
309299c4c48aSmrg              [SELECTIVE_WERROR=$enableval],
309399c4c48aSmrg              [SELECTIVE_WERROR=yes])
309499c4c48aSmrg
309599c4c48aSmrgAC_LANG_CASE(
309699c4c48aSmrg        [C], [
309799c4c48aSmrg                define([PREFIX], [C])
309899c4c48aSmrg        ],
309999c4c48aSmrg        [C++], [
310099c4c48aSmrg                define([PREFIX], [CXX])
310199c4c48aSmrg        ]
310299c4c48aSmrg)
310399c4c48aSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
310499c4c48aSmrgif test "x$SUNCC" = "xyes"; then
310599c4c48aSmrg    [BASE_]PREFIX[FLAGS]="-v"
31068a355152Smrgelse
310799c4c48aSmrg    [BASE_]PREFIX[FLAGS]=""
31088a355152Smrgfi
31098a355152Smrg
311099c4c48aSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
311199c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
311299c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
311399c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
311499c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31151a650d1eSmrg
311699c4c48aSmrgAC_LANG_CASE(
311799c4c48aSmrg	[C], [
311899c4c48aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311999c4c48aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
312099c4c48aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
312199c4c48aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
312299c4c48aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
312399c4c48aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
312499c4c48aSmrg	]
312599c4c48aSmrg)
31268a355152Smrg
312799c4c48aSmrg# This chunk adds additional warnings that could catch undesired effects.
312899c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312999c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
313099c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
313199c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
313299c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
313399c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
313499c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
31358a355152Smrg
313699c4c48aSmrg# These are currently disabled because they are noisy.  They will be enabled
313799c4c48aSmrg# in the future once the codebase is sufficiently modernized to silence
313899c4c48aSmrg# them.  For now, I don't want them to drown out the other warnings.
313999c4c48aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
314099c4c48aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
314199c4c48aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
31428a355152Smrg
31438d1e6323Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
314499c4c48aSmrg# when there are problems that should be fixed.
31458a355152Smrg
314699c4c48aSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
314799c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314899c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314999c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
315099c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
315199c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
315299c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
315399c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
315499c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
315599c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
315699c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
315799c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315899c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315999c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
316099c4c48aSmrgelse
316199c4c48aSmrgAC_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])
316299c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
316399c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
316499c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
316599c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
316699c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
316799c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316899c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316999c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
317099c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
317199c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
317299c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
317399c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
317499c4c48aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
317599c4c48aSmrgfi
31768a355152Smrg
317799c4c48aSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317899c4c48aSmrg]) # XORG_COMPILER_FLAGS
31798108eb18Smrg
318099c4c48aSmrg# XORG_CWARNFLAGS
318199c4c48aSmrg# ---------------
318299c4c48aSmrg# Minimum version: 1.2.0
318399c4c48aSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
31841a650d1eSmrg#
318599c4c48aSmrg# Defines CWARNFLAGS to enable C compiler warnings.
31861a650d1eSmrg#
318799c4c48aSmrg# This function is deprecated because it defines -fno-strict-aliasing
318899c4c48aSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318999c4c48aSmrg# is needed, then it should be added explicitly in the module when
319099c4c48aSmrg# it is updated to use BASE_CFLAGS.
31911a650d1eSmrg#
319299c4c48aSmrgAC_DEFUN([XORG_CWARNFLAGS], [
319399c4c48aSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
319499c4c48aSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
319599c4c48aSmrgAC_LANG_CASE(
319699c4c48aSmrg	[C], [
319799c4c48aSmrg		CWARNFLAGS="$BASE_CFLAGS"
319899c4c48aSmrg		if  test "x$GCC" = xyes ; then
319999c4c48aSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
320099c4c48aSmrg		fi
320199c4c48aSmrg		AC_SUBST(CWARNFLAGS)
320299c4c48aSmrg	]
320399c4c48aSmrg)
320499c4c48aSmrg]) # XORG_CWARNFLAGS
32058a355152Smrg
320699c4c48aSmrg# XORG_STRICT_OPTION
320799c4c48aSmrg# -----------------------
320899c4c48aSmrg# Minimum version: 1.3.0
320999c4c48aSmrg#
321099c4c48aSmrg# Add configure option to enable strict compilation flags, such as treating
321199c4c48aSmrg# warnings as fatal errors.
321299c4c48aSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
321399c4c48aSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
321499c4c48aSmrg#
321599c4c48aSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
321699c4c48aSmrg# when strict compilation is unconditionally desired.
321799c4c48aSmrgAC_DEFUN([XORG_STRICT_OPTION], [
321899c4c48aSmrgAC_REQUIRE([XORG_CWARNFLAGS])
321999c4c48aSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32208a355152Smrg
322199c4c48aSmrgAC_ARG_ENABLE(strict-compilation,
322299c4c48aSmrg			  AS_HELP_STRING([--enable-strict-compilation],
322399c4c48aSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
322499c4c48aSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
32258a355152Smrg
322699c4c48aSmrgAC_LANG_CASE(
322799c4c48aSmrg        [C], [
322899c4c48aSmrg                define([PREFIX], [C])
322999c4c48aSmrg        ],
323099c4c48aSmrg        [C++], [
323199c4c48aSmrg                define([PREFIX], [CXX])
323299c4c48aSmrg        ]
323399c4c48aSmrg)
32348a355152Smrg
323599c4c48aSmrg[STRICT_]PREFIX[FLAGS]=""
323699c4c48aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
323799c4c48aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
32388a355152Smrg
323999c4c48aSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
324099c4c48aSmrg# activate it with -Werror, so we add it here explicitly.
324199c4c48aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
32428a355152Smrg
324399c4c48aSmrgif test "x$STRICT_COMPILE" = "xyes"; then
324499c4c48aSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
324599c4c48aSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
324699c4c48aSmrgfi
324799c4c48aSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324899c4c48aSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324999c4c48aSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
325099c4c48aSmrg]) # XORG_STRICT_OPTION
32518a355152Smrg
32528d1e6323Smrg# XORG_DEFAULT_NOCODE_OPTIONS
32538d1e6323Smrg# ---------------------------
32548d1e6323Smrg# Minimum version: 1.20.0
32558d1e6323Smrg#
32568d1e6323Smrg# Defines default options for X.Org modules which don't compile code,
32578d1e6323Smrg# such as fonts, bitmaps, cursors, and docs.
32588d1e6323Smrg#
32598d1e6323SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
32608d1e6323SmrgAC_REQUIRE([AC_PROG_INSTALL])
32618d1e6323SmrgXORG_RELEASE_VERSION
32628d1e6323SmrgXORG_CHANGELOG
32638d1e6323SmrgXORG_INSTALL
32648d1e6323SmrgXORG_MANPAGE_SECTIONS
32658d1e6323Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32668d1e6323Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32678d1e6323Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
32688d1e6323Smrg
326999c4c48aSmrg# XORG_DEFAULT_OPTIONS
327099c4c48aSmrg# --------------------
327199c4c48aSmrg# Minimum version: 1.3.0
327299c4c48aSmrg#
32738d1e6323Smrg# Defines default options for X.Org modules which compile code.
327499c4c48aSmrg#
327599c4c48aSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
327699c4c48aSmrgAC_REQUIRE([AC_PROG_INSTALL])
327799c4c48aSmrgXORG_COMPILER_FLAGS
327899c4c48aSmrgXORG_CWARNFLAGS
327999c4c48aSmrgXORG_STRICT_OPTION
32808d1e6323SmrgXORG_DEFAULT_NOCODE_OPTIONS
328199c4c48aSmrg]) # XORG_DEFAULT_OPTIONS
32828a355152Smrg
328399c4c48aSmrg# XORG_INSTALL()
328499c4c48aSmrg# ----------------
328599c4c48aSmrg# Minimum version: 1.4.0
328699c4c48aSmrg#
328799c4c48aSmrg# Defines the variable INSTALL_CMD as the command to copy
328899c4c48aSmrg# INSTALL from $prefix/share/util-macros.
328999c4c48aSmrg#
329099c4c48aSmrgAC_DEFUN([XORG_INSTALL], [
329199c4c48aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
329299c4c48aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
329399c4c48aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
329499c4c48aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
329599c4c48aSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
329699c4c48aSmrgtouch \$(top_srcdir)/INSTALL; \
329799c4c48aSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
329899c4c48aSmrgAC_SUBST([INSTALL_CMD])
329999c4c48aSmrg]) # XORG_INSTALL
330099c4c48aSmrgdnl Copyright 2005 Red Hat, Inc
330199c4c48aSmrgdnl
330299c4c48aSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
330399c4c48aSmrgdnl documentation for any purpose is hereby granted without fee, provided that
330499c4c48aSmrgdnl the above copyright notice appear in all copies and that both that
330599c4c48aSmrgdnl copyright notice and this permission notice appear in supporting
330699c4c48aSmrgdnl documentation.
330799c4c48aSmrgdnl
330899c4c48aSmrgdnl The above copyright notice and this permission notice shall be included
330999c4c48aSmrgdnl in all copies or substantial portions of the Software.
331099c4c48aSmrgdnl
331199c4c48aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
331299c4c48aSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
331399c4c48aSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
331499c4c48aSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
331599c4c48aSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
331699c4c48aSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
331799c4c48aSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
331899c4c48aSmrgdnl
331999c4c48aSmrgdnl Except as contained in this notice, the name of the copyright holders shall
332099c4c48aSmrgdnl not be used in advertising or otherwise to promote the sale, use or
332199c4c48aSmrgdnl other dealings in this Software without prior written authorization
332299c4c48aSmrgdnl from the copyright holders.
332399c4c48aSmrgdnl
33248a355152Smrg
332599c4c48aSmrg# XORG_RELEASE_VERSION
332699c4c48aSmrg# --------------------
332799c4c48aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33288a355152Smrg
332999c4c48aSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
333099c4c48aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
333199c4c48aSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
333299c4c48aSmrg		[Major version of this package])
333399c4c48aSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
333499c4c48aSmrg	if test "x$PVM" = "x"; then
333599c4c48aSmrg		PVM="0"
333699c4c48aSmrg	fi
333799c4c48aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
333899c4c48aSmrg		[$PVM],
333999c4c48aSmrg		[Minor version of this package])
334099c4c48aSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
334199c4c48aSmrg	if test "x$PVP" = "x"; then
334299c4c48aSmrg		PVP="0"
334399c4c48aSmrg	fi
334499c4c48aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
334599c4c48aSmrg		[$PVP],
334699c4c48aSmrg		[Patch version of this package])
334799c4c48aSmrg])
33488a355152Smrg
334999c4c48aSmrg# XORG_CHANGELOG()
335099c4c48aSmrg# ----------------
335199c4c48aSmrg# Minimum version: 1.2.0
335299c4c48aSmrg#
335399c4c48aSmrg# Defines the variable CHANGELOG_CMD as the command to generate
335499c4c48aSmrg# ChangeLog from git.
335599c4c48aSmrg#
335699c4c48aSmrg#
335799c4c48aSmrgAC_DEFUN([XORG_CHANGELOG], [
335899c4c48aSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
335999c4c48aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
336099c4c48aSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
336199c4c48aSmrgtouch \$(top_srcdir)/ChangeLog; \
336299c4c48aSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
336399c4c48aSmrgAC_SUBST([CHANGELOG_CMD])
336499c4c48aSmrg]) # XORG_CHANGELOG
33651a650d1eSmrg
3366