1838f5b0bSmrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
2b91640d3Smrg
3838f5b0bSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4a6d9b409Smrg
5a6d9b409Smrg# This file is free software; the Free Software Foundation
6a6d9b409Smrg# gives unlimited permission to copy and/or distribute it,
7a6d9b409Smrg# with or without modifications, as long as this notice is preserved.
8a6d9b409Smrg
9a6d9b409Smrg# This program is distributed in the hope that it will be useful,
10a6d9b409Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a6d9b409Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a6d9b409Smrg# PARTICULAR PURPOSE.
13a6d9b409Smrg
14b91640d3Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15efda2da8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16efda2da8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17838f5b0bSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18838f5b0bSmrg[m4_warning([this file was generated for autoconf 2.72.
19efda2da8SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20efda2da8SmrgIf you have problems, you may need to regenerate the build system entirely.
21b91640d3SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22a6d9b409Smrg
23838f5b0bSmrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
2492e95ad1Smrg#
2592e95ad1Smrg# This file is free software; the Free Software Foundation
2692e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
2792e95ad1Smrg# with or without modifications, as long as this notice is preserved.
288b8e729cSmrg
2992e95ad1Smrg# AM_AUTOMAKE_VERSION(VERSION)
3092e95ad1Smrg# ----------------------------
3192e95ad1Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3292e95ad1Smrg# generated from the m4 files accompanying Automake X.Y.
3392e95ad1Smrg# (This private macro should not be called outside this file.)
3492e95ad1SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35838f5b0bSmrg[am__api_version='1.17'
3692e95ad1Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3792e95ad1Smrgdnl require some minimum version.  Point them to the right macro.
38838f5b0bSmrgm4_if([$1], [1.17], [],
3992e95ad1Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4092e95ad1Smrg])
418b8e729cSmrg
4292e95ad1Smrg# _AM_AUTOCONF_VERSION(VERSION)
4392e95ad1Smrg# -----------------------------
4492e95ad1Smrg# aclocal traces this macro to find the Autoconf version.
4592e95ad1Smrg# This is a private macro too.  Using m4_define simplifies
4692e95ad1Smrg# the logic in aclocal, which can simply ignore this definition.
4792e95ad1Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48a6d9b409Smrg
4992e95ad1Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5092e95ad1Smrg# -------------------------------
5192e95ad1Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5292e95ad1Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5392e95ad1SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54838f5b0bSmrg[AM_AUTOMAKE_VERSION([1.17])dnl
5592e95ad1Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5692e95ad1Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5792e95ad1Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58a6d9b409Smrg
5992e95ad1Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60a6d9b409Smrg
61838f5b0bSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
6292e95ad1Smrg#
6392e95ad1Smrg# This file is free software; the Free Software Foundation
6492e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
6592e95ad1Smrg# with or without modifications, as long as this notice is preserved.
66a6d9b409Smrg
6792e95ad1Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6892e95ad1Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6992e95ad1Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7092e95ad1Smrg#
7192e95ad1Smrg# Of course, Automake must honor this variable whenever it calls a
7292e95ad1Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7392e95ad1Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7492e95ad1Smrg# depending on how configure is run.  This is pretty annoying, since
7592e95ad1Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7692e95ad1Smrg# source directory, any form will work fine, but in subdirectories a
7792e95ad1Smrg# relative path needs to be adjusted first.
7892e95ad1Smrg#
7992e95ad1Smrg# $ac_aux_dir/missing
8092e95ad1Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8192e95ad1Smrg# $top_srcdir/$ac_aux_dir/missing
8292e95ad1Smrg#    fails if $ac_aux_dir is absolute,
8392e95ad1Smrg#    fails when called from a subdirectory in a VPATH build with
8492e95ad1Smrg#          a relative $ac_aux_dir
8592e95ad1Smrg#
8692e95ad1Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8792e95ad1Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8892e95ad1Smrg# harmless because $srcdir is '.', but things will broke when you
8992e95ad1Smrg# start a VPATH build or use an absolute $srcdir.
9092e95ad1Smrg#
9192e95ad1Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9292e95ad1Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9392e95ad1Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9492e95ad1Smrg# and then we would define $MISSING as
9592e95ad1Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9692e95ad1Smrg# This will work as long as MISSING is not called from configure, because
9792e95ad1Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9892e95ad1Smrg# However there are other variables, like CC, which are often used in
9992e95ad1Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10092e95ad1Smrg#
10192e95ad1Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10292e95ad1Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10392e95ad1Smrg# configured tree to be moved without reconfiguration.
104a6d9b409Smrg
10592e95ad1SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10692e95ad1Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10792e95ad1Smrg# Expand $ac_aux_dir to an absolute path.
10892e95ad1Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10992e95ad1Smrg])
11011a95ff3Smrg
11192e95ad1Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112a6d9b409Smrg
113838f5b0bSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
11492e95ad1Smrg#
11592e95ad1Smrg# This file is free software; the Free Software Foundation
11692e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
11792e95ad1Smrg# with or without modifications, as long as this notice is preserved.
118a6d9b409Smrg
11992e95ad1Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12092e95ad1Smrg# -------------------------------------
12192e95ad1Smrg# Define a conditional.
12292e95ad1SmrgAC_DEFUN([AM_CONDITIONAL],
12392e95ad1Smrg[AC_PREREQ([2.52])dnl
12492e95ad1Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12592e95ad1Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12692e95ad1SmrgAC_SUBST([$1_TRUE])dnl
12792e95ad1SmrgAC_SUBST([$1_FALSE])dnl
12892e95ad1Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12992e95ad1Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13092e95ad1Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13192e95ad1Smrgif $2; then
13292e95ad1Smrg  $1_TRUE=
13392e95ad1Smrg  $1_FALSE='#'
13492e95ad1Smrgelse
13592e95ad1Smrg  $1_TRUE='#'
13692e95ad1Smrg  $1_FALSE=
13792e95ad1Smrgfi
13892e95ad1SmrgAC_CONFIG_COMMANDS_PRE(
13992e95ad1Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14092e95ad1Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14192e95ad1SmrgUsually this means the macro was only invoked conditionally.]])
14292e95ad1Smrgfi])])
143a6d9b409Smrg
144838f5b0bSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
14592e95ad1Smrg#
14692e95ad1Smrg# This file is free software; the Free Software Foundation
14792e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
14892e95ad1Smrg# with or without modifications, as long as this notice is preserved.
149a6d9b409Smrg
150a6d9b409Smrg
15192e95ad1Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15292e95ad1Smrg# written in clear, in which case automake, when reading aclocal.m4,
15392e95ad1Smrg# will think it sees a *use*, and therefore will trigger all it's
15492e95ad1Smrg# C support machinery.  Also note that it means that autoscan, seeing
15592e95ad1Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156a6d9b409Smrg
157a6d9b409Smrg
15892e95ad1Smrg# _AM_DEPENDENCIES(NAME)
15992e95ad1Smrg# ----------------------
16092e95ad1Smrg# See how the compiler implements dependency checking.
16192e95ad1Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16292e95ad1Smrg# We try a few techniques and use that to set a single cache variable.
16392e95ad1Smrg#
16492e95ad1Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16592e95ad1Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16692e95ad1Smrg# dependency, and given that the user is not expected to run this macro,
16792e95ad1Smrg# just rely on AC_PROG_CC.
16892e95ad1SmrgAC_DEFUN([_AM_DEPENDENCIES],
16992e95ad1Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17092e95ad1SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17192e95ad1SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17292e95ad1SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173a6d9b409Smrg
17492e95ad1Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17592e95ad1Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17692e95ad1Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17792e95ad1Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17892e95ad1Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17992e95ad1Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18092e95ad1Smrg                    [depcc="$$1"   am_compiler_list=])
181a6d9b409Smrg
18292e95ad1SmrgAC_CACHE_CHECK([dependency style of $depcc],
18392e95ad1Smrg               [am_cv_$1_dependencies_compiler_type],
18492e95ad1Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18592e95ad1Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18692e95ad1Smrg  # making bogus files that we don't know about and never remove.  For
18792e95ad1Smrg  # instance it was reported that on HP-UX the gcc test will end up
18892e95ad1Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18992e95ad1Smrg  # in D".
19092e95ad1Smrg  rm -rf conftest.dir
19192e95ad1Smrg  mkdir conftest.dir
19292e95ad1Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19392e95ad1Smrg  # using a relative directory.
19492e95ad1Smrg  cp "$am_depcomp" conftest.dir
19592e95ad1Smrg  cd conftest.dir
19692e95ad1Smrg  # We will build objects and dependencies in a subdirectory because
19792e95ad1Smrg  # it helps to detect inapplicable dependency modes.  For instance
19892e95ad1Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19992e95ad1Smrg  # side effect of compilation, but ICC will put the dependencies in
20092e95ad1Smrg  # the current directory while Tru64 will put them in the object
20192e95ad1Smrg  # directory.
20292e95ad1Smrg  mkdir sub
203a6d9b409Smrg
20492e95ad1Smrg  am_cv_$1_dependencies_compiler_type=none
20592e95ad1Smrg  if test "$am_compiler_list" = ""; then
20692e95ad1Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20792e95ad1Smrg  fi
20892e95ad1Smrg  am__universal=false
20992e95ad1Smrg  m4_case([$1], [CC],
21092e95ad1Smrg    [case " $depcc " in #(
21192e95ad1Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21292e95ad1Smrg     esac],
21392e95ad1Smrg    [CXX],
21492e95ad1Smrg    [case " $depcc " in #(
21592e95ad1Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21692e95ad1Smrg     esac])
2178b8e729cSmrg
21892e95ad1Smrg  for depmode in $am_compiler_list; do
21992e95ad1Smrg    # Setup a source with many dependencies, because some compilers
22092e95ad1Smrg    # like to wrap large dependency lists on column 80 (with \), and
22192e95ad1Smrg    # we should not choose a depcomp mode which is confused by this.
22292e95ad1Smrg    #
22392e95ad1Smrg    # We need to recreate these files for each test, as the compiler may
22492e95ad1Smrg    # overwrite some of them when testing with obscure command lines.
22592e95ad1Smrg    # This happens at least with the AIX C compiler.
22692e95ad1Smrg    : > sub/conftest.c
22792e95ad1Smrg    for i in 1 2 3 4 5 6; do
22892e95ad1Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22992e95ad1Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23092e95ad1Smrg      # Solaris 10 /bin/sh.
23192e95ad1Smrg      echo '/* dummy */' > sub/conftst$i.h
23292e95ad1Smrg    done
23392e95ad1Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2348b8e729cSmrg
23592e95ad1Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23692e95ad1Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23792e95ad1Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23892e95ad1Smrg    # versions had trouble with output in subdirs.
23992e95ad1Smrg    am__obj=sub/conftest.${OBJEXT-o}
24092e95ad1Smrg    am__minus_obj="-o $am__obj"
24192e95ad1Smrg    case $depmode in
24292e95ad1Smrg    gcc)
24392e95ad1Smrg      # This depmode causes a compiler race in universal mode.
24492e95ad1Smrg      test "$am__universal" = false || continue
24592e95ad1Smrg      ;;
24692e95ad1Smrg    nosideeffect)
24792e95ad1Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24892e95ad1Smrg      # only be used when explicitly requested.
24992e95ad1Smrg      if test "x$enable_dependency_tracking" = xyes; then
25092e95ad1Smrg	continue
25192e95ad1Smrg      else
25292e95ad1Smrg	break
25392e95ad1Smrg      fi
25492e95ad1Smrg      ;;
25592e95ad1Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25692e95ad1Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25792e95ad1Smrg      # not run yet.  These depmodes are late enough in the game, and
25892e95ad1Smrg      # so weak that their functioning should not be impacted.
25992e95ad1Smrg      am__obj=conftest.${OBJEXT-o}
26092e95ad1Smrg      am__minus_obj=
26192e95ad1Smrg      ;;
26292e95ad1Smrg    none) break ;;
26392e95ad1Smrg    esac
26492e95ad1Smrg    if depmode=$depmode \
26592e95ad1Smrg       source=sub/conftest.c object=$am__obj \
26692e95ad1Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26792e95ad1Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26892e95ad1Smrg         >/dev/null 2>conftest.err &&
26992e95ad1Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27092e95ad1Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27192e95ad1Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27292e95ad1Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27392e95ad1Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27492e95ad1Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27592e95ad1Smrg      # that says an option was ignored or not supported.
276838f5b0bSmrg      # When given -MP, icc 7.0 and 7.1 complain thus:
27792e95ad1Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27892e95ad1Smrg      # The diagnosis changed in icc 8.0:
27992e95ad1Smrg      #   icc: Command line remark: option '-MP' not supported
28092e95ad1Smrg      if (grep 'ignoring option' conftest.err ||
28192e95ad1Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28292e95ad1Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28392e95ad1Smrg        break
28492e95ad1Smrg      fi
28592e95ad1Smrg    fi
28692e95ad1Smrg  done
287a6d9b409Smrg
28892e95ad1Smrg  cd ..
28992e95ad1Smrg  rm -rf conftest.dir
29092e95ad1Smrgelse
29192e95ad1Smrg  am_cv_$1_dependencies_compiler_type=none
29292e95ad1Smrgfi
29392e95ad1Smrg])
29492e95ad1SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29592e95ad1SmrgAM_CONDITIONAL([am__fastdep$1], [
29692e95ad1Smrg  test "x$enable_dependency_tracking" != xno \
29792e95ad1Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29892e95ad1Smrg])
299a6d9b409Smrg
30011a95ff3Smrg
30192e95ad1Smrg# AM_SET_DEPDIR
30292e95ad1Smrg# -------------
30392e95ad1Smrg# Choose a directory name for dependency files.
30492e95ad1Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30592e95ad1SmrgAC_DEFUN([AM_SET_DEPDIR],
30692e95ad1Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30792e95ad1SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30892e95ad1Smrg])
30911a95ff3Smrg
31011a95ff3Smrg
31192e95ad1Smrg# AM_DEP_TRACK
31292e95ad1Smrg# ------------
31392e95ad1SmrgAC_DEFUN([AM_DEP_TRACK],
31492e95ad1Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31592e95ad1SmrgAS_HELP_STRING(
31692e95ad1Smrg  [--enable-dependency-tracking],
31792e95ad1Smrg  [do not reject slow dependency extractors])
31892e95ad1SmrgAS_HELP_STRING(
31992e95ad1Smrg  [--disable-dependency-tracking],
32092e95ad1Smrg  [speeds up one-time build])])
32192e95ad1Smrgif test "x$enable_dependency_tracking" != xno; then
32292e95ad1Smrg  am_depcomp="$ac_aux_dir/depcomp"
32392e95ad1Smrg  AMDEPBACKSLASH='\'
32492e95ad1Smrg  am__nodep='_no'
32592e95ad1Smrgfi
32692e95ad1SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32792e95ad1SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32892e95ad1Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32992e95ad1SmrgAC_SUBST([am__nodep])dnl
33092e95ad1Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33192e95ad1Smrg])
33211a95ff3Smrg
33392e95ad1Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334a6d9b409Smrg
335838f5b0bSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
33611a95ff3Smrg#
33792e95ad1Smrg# This file is free software; the Free Software Foundation
33892e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
33992e95ad1Smrg# with or without modifications, as long as this notice is preserved.
340a6d9b409Smrg
34192e95ad1Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34292e95ad1Smrg# ------------------------------
34392e95ad1SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34492e95ad1Smrg[{
34592e95ad1Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34692e95ad1Smrg  # are listed without --file.  Let's play safe and only enable the eval
34792e95ad1Smrg  # if we detect the quoting.
34892e95ad1Smrg  # TODO: see whether this extra hack can be removed once we start
34992e95ad1Smrg  # requiring Autoconf 2.70 or later.
35092e95ad1Smrg  AS_CASE([$CONFIG_FILES],
35192e95ad1Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
35292e95ad1Smrg          [*], [set x $CONFIG_FILES])
35392e95ad1Smrg  shift
35492e95ad1Smrg  # Used to flag and report bootstrapping failures.
35592e95ad1Smrg  am_rc=0
35692e95ad1Smrg  for am_mf
35792e95ad1Smrg  do
35892e95ad1Smrg    # Strip MF so we end up with the name of the file.
35992e95ad1Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36092e95ad1Smrg    # Check whether this is an Automake generated Makefile which includes
36192e95ad1Smrg    # dependency-tracking related rules and includes.
36292e95ad1Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36392e95ad1Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36492e95ad1Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36592e95ad1Smrg      || continue
36692e95ad1Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36792e95ad1Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36892e95ad1Smrg    AM_RUN_LOG([cd "$am_dirpart" \
36992e95ad1Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37092e95ad1Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37192e95ad1Smrg  done
37292e95ad1Smrg  if test $am_rc -ne 0; then
37392e95ad1Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37492e95ad1Smrg    for automatic dependency tracking.  If GNU make was not used, consider
37592e95ad1Smrg    re-running the configure script with MAKE="gmake" (or whatever is
37692e95ad1Smrg    necessary).  You can also try re-running configure with the
37792e95ad1Smrg    '--disable-dependency-tracking' option to at least be able to build
37892e95ad1Smrg    the package (albeit without support for automatic dependency tracking).])
37992e95ad1Smrg  fi
38092e95ad1Smrg  AS_UNSET([am_dirpart])
38192e95ad1Smrg  AS_UNSET([am_filepart])
38292e95ad1Smrg  AS_UNSET([am_mf])
38392e95ad1Smrg  AS_UNSET([am_rc])
38492e95ad1Smrg  rm -f conftest-deps.mk
38592e95ad1Smrg}
38692e95ad1Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387a6d9b409Smrg
388a6d9b409Smrg
38992e95ad1Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39092e95ad1Smrg# -----------------------------
39192e95ad1Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392a6d9b409Smrg#
39392e95ad1Smrg# This code is only required when automatic dependency tracking is enabled.
39492e95ad1Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39592e95ad1Smrg# order to bootstrap the dependency handling code.
39692e95ad1SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39792e95ad1Smrg[AC_CONFIG_COMMANDS([depfiles],
39892e95ad1Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39992e95ad1Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400a6d9b409Smrg
40192e95ad1Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402a6d9b409Smrg
403838f5b0bSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
40492e95ad1Smrg#
40592e95ad1Smrg# This file is free software; the Free Software Foundation
40692e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
40792e95ad1Smrg# with or without modifications, as long as this notice is preserved.
408a6d9b409Smrg
40992e95ad1Smrg# This macro actually does too much.  Some checks are only needed if
41092e95ad1Smrg# your package does certain things.  But this isn't really a big deal.
411a6d9b409Smrg
41292e95ad1Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41392e95ad1Smrgm4_define([AC_PROG_CC],
41492e95ad1Smrgm4_defn([AC_PROG_CC])
41592e95ad1Smrg[_AM_PROG_CC_C_O
41692e95ad1Smrg])
41711a95ff3Smrg
41892e95ad1Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41992e95ad1Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42092e95ad1Smrg# -----------------------------------------------
42192e95ad1Smrg# The call with PACKAGE and VERSION arguments is the old style
42292e95ad1Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42392e95ad1Smrg# and VERSION should now be passed to AC_INIT and removed from
42492e95ad1Smrg# the call to AM_INIT_AUTOMAKE.
42592e95ad1Smrg# We support both call styles for the transition.  After
42692e95ad1Smrg# the next Automake release, Autoconf can make the AC_INIT
42792e95ad1Smrg# arguments mandatory, and then we can depend on a new Autoconf
42892e95ad1Smrg# release and drop the old call support.
42992e95ad1SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43092e95ad1Smrg[AC_PREREQ([2.65])dnl
43192e95ad1Smrgm4_ifdef([_$0_ALREADY_INIT],
43292e95ad1Smrg  [m4_fatal([$0 expanded multiple times
43392e95ad1Smrg]m4_defn([_$0_ALREADY_INIT]))],
43492e95ad1Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43592e95ad1Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43692e95ad1Smrgdnl the ones we care about.
43792e95ad1Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43892e95ad1SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43992e95ad1SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44092e95ad1Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44192e95ad1Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44292e95ad1Smrg  # is not polluted with repeated "-I."
44392e95ad1Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44492e95ad1Smrg  # test to see if srcdir already configured
44592e95ad1Smrg  if test -f $srcdir/config.status; then
44692e95ad1Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44792e95ad1Smrg  fi
44811a95ff3Smrgfi
44911a95ff3Smrg
45092e95ad1Smrg# test whether we have cygpath
45192e95ad1Smrgif test -z "$CYGPATH_W"; then
45292e95ad1Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45392e95ad1Smrg    CYGPATH_W='cygpath -w'
45492e95ad1Smrg  else
45592e95ad1Smrg    CYGPATH_W=echo
45692e95ad1Smrg  fi
45711a95ff3Smrgfi
45892e95ad1SmrgAC_SUBST([CYGPATH_W])
45911a95ff3Smrg
46092e95ad1Smrg# Define the identity of the package.
46192e95ad1Smrgdnl Distinguish between old-style and new-style calls.
46292e95ad1Smrgm4_ifval([$2],
46392e95ad1Smrg[AC_DIAGNOSE([obsolete],
46492e95ad1Smrg             [$0: two- and three-arguments forms are deprecated.])
46592e95ad1Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46692e95ad1Smrg AC_SUBST([PACKAGE], [$1])dnl
46792e95ad1Smrg AC_SUBST([VERSION], [$2])],
46892e95ad1Smrg[_AM_SET_OPTIONS([$1])dnl
46992e95ad1Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47092e95ad1Smrgm4_if(
47192e95ad1Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47292e95ad1Smrg  [ok:ok],,
47392e95ad1Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47492e95ad1Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47592e95ad1Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47611a95ff3Smrg
47792e95ad1Smrg_AM_IF_OPTION([no-define],,
47892e95ad1Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47992e95ad1Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48011a95ff3Smrg
48192e95ad1Smrg# Some tools Automake needs.
48292e95ad1SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48392e95ad1SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48492e95ad1SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48592e95ad1SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48692e95ad1SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48792e95ad1SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48892e95ad1SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48992e95ad1SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49092e95ad1SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49192e95ad1SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49292e95ad1Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49392e95ad1Smrg# dies out for good.  For more background, see:
49492e95ad1Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49592e95ad1Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49692e95ad1SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49792e95ad1Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49892e95ad1Smrg# system "awk" is bad on some platforms.
49992e95ad1SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50092e95ad1SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50192e95ad1SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50292e95ad1Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50392e95ad1Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50492e95ad1Smrg			     [_AM_PROG_TAR([v7])])])
50592e95ad1Smrg_AM_IF_OPTION([no-dependencies],,
50692e95ad1Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50792e95ad1Smrg		  [_AM_DEPENDENCIES([CC])],
50892e95ad1Smrg		  [m4_define([AC_PROG_CC],
50992e95ad1Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51092e95ad1SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51192e95ad1Smrg		  [_AM_DEPENDENCIES([CXX])],
51292e95ad1Smrg		  [m4_define([AC_PROG_CXX],
51392e95ad1Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51492e95ad1SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51592e95ad1Smrg		  [_AM_DEPENDENCIES([OBJC])],
51692e95ad1Smrg		  [m4_define([AC_PROG_OBJC],
51792e95ad1Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51892e95ad1SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51992e95ad1Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52092e95ad1Smrg		  [m4_define([AC_PROG_OBJCXX],
52192e95ad1Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52292e95ad1Smrg])
52392e95ad1Smrg# Variables for tags utilities; see am/tags.am
52492e95ad1Smrgif test -z "$CTAGS"; then
52592e95ad1Smrg  CTAGS=ctags
52692e95ad1Smrgfi
52792e95ad1SmrgAC_SUBST([CTAGS])
52892e95ad1Smrgif test -z "$ETAGS"; then
52992e95ad1Smrg  ETAGS=etags
53092e95ad1Smrgfi
53192e95ad1SmrgAC_SUBST([ETAGS])
53292e95ad1Smrgif test -z "$CSCOPE"; then
53392e95ad1Smrg  CSCOPE=cscope
53492e95ad1Smrgfi
53592e95ad1SmrgAC_SUBST([CSCOPE])
53611a95ff3Smrg
537838f5b0bSmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
53892e95ad1Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53992e95ad1Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54092e95ad1Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54192e95ad1SmrgAC_CONFIG_COMMANDS_PRE(dnl
54292e95ad1Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54392e95ad1Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
54411a95ff3Smrg
545838f5b0bSmrgAC_REQUIRE([_AM_PROG_RM_F])
546838f5b0bSmrgAC_REQUIRE([_AM_PROG_XARGS_N])
54711a95ff3Smrg
54892e95ad1Smrgdnl The trailing newline in this macro's definition is deliberate, for
54992e95ad1Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
55092e95ad1Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
55192e95ad1Smrg])
552a6d9b409Smrg
55392e95ad1Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
55492e95ad1Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
55592e95ad1Smrgdnl mangled by Autoconf and run in a shell conditional statement.
55692e95ad1Smrgm4_define([_AC_COMPILER_EXEEXT],
55792e95ad1Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
558a6d9b409Smrg
55992e95ad1Smrg# When config.status generates a header, we must update the stamp-h file.
56092e95ad1Smrg# This file resides in the same directory as the config header
56192e95ad1Smrg# that is generated.  The stamp files are numbered to have different names.
562a6d9b409Smrg
56392e95ad1Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
56492e95ad1Smrg# loop where config.status creates the headers, so we can generate
56592e95ad1Smrg# our stamp files there.
56692e95ad1SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
56792e95ad1Smrg[# Compute $1's index in $config_headers.
56892e95ad1Smrg_am_arg=$1
56992e95ad1Smrg_am_stamp_count=1
57092e95ad1Smrgfor _am_header in $config_headers :; do
57192e95ad1Smrg  case $_am_header in
57292e95ad1Smrg    $_am_arg | $_am_arg:* )
57392e95ad1Smrg      break ;;
57492e95ad1Smrg    * )
57592e95ad1Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
57692e95ad1Smrg  esac
57792e95ad1Smrgdone
57892e95ad1Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
579b91640d3Smrg
580838f5b0bSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
58192e95ad1Smrg#
58292e95ad1Smrg# This file is free software; the Free Software Foundation
58392e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
58492e95ad1Smrg# with or without modifications, as long as this notice is preserved.
58592e95ad1Smrg
58692e95ad1Smrg# AM_PROG_INSTALL_SH
58792e95ad1Smrg# ------------------
58892e95ad1Smrg# Define $install_sh.
58992e95ad1SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
59092e95ad1Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
59192e95ad1Smrgif test x"${install_sh+set}" != xset; then
59292e95ad1Smrg  case $am_aux_dir in
59392e95ad1Smrg  *\ * | *\	*)
59492e95ad1Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
59592e95ad1Smrg  *)
59692e95ad1Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
59792e95ad1Smrg  esac
59892e95ad1Smrgfi
59992e95ad1SmrgAC_SUBST([install_sh])])
60092e95ad1Smrg
601838f5b0bSmrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
60292e95ad1Smrg#
60392e95ad1Smrg# This file is free software; the Free Software Foundation
60492e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
60592e95ad1Smrg# with or without modifications, as long as this notice is preserved.
60692e95ad1Smrg
60792e95ad1Smrg# Check whether the underlying file-system supports filenames
60892e95ad1Smrg# with a leading dot.  For instance MS-DOS doesn't.
60992e95ad1SmrgAC_DEFUN([AM_SET_LEADING_DOT],
61092e95ad1Smrg[rm -rf .tst 2>/dev/null
61192e95ad1Smrgmkdir .tst 2>/dev/null
61292e95ad1Smrgif test -d .tst; then
61392e95ad1Smrg  am__leading_dot=.
61411a95ff3Smrgelse
61592e95ad1Smrg  am__leading_dot=_
61611a95ff3Smrgfi
61792e95ad1Smrgrmdir .tst 2>/dev/null
61892e95ad1SmrgAC_SUBST([am__leading_dot])])
619b91640d3Smrg
62092e95ad1Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
621b91640d3Smrg
622838f5b0bSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
62392e95ad1Smrg#
62492e95ad1Smrg# This file is free software; the Free Software Foundation
62592e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
62692e95ad1Smrg# with or without modifications, as long as this notice is preserved.
627b91640d3Smrg
62892e95ad1Smrg# AM_MAKE_INCLUDE()
62992e95ad1Smrg# -----------------
63092e95ad1Smrg# Check whether make has an 'include' directive that can support all
63192e95ad1Smrg# the idioms we need for our automatic dependency tracking code.
63292e95ad1SmrgAC_DEFUN([AM_MAKE_INCLUDE],
63392e95ad1Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
63492e95ad1Smrgcat > confinc.mk << 'END'
63592e95ad1Smrgam__doit:
63692e95ad1Smrg	@echo this is the am__doit target >confinc.out
63792e95ad1Smrg.PHONY: am__doit
63892e95ad1SmrgEND
63992e95ad1Smrgam__include="#"
64092e95ad1Smrgam__quote=
64192e95ad1Smrg# BSD make does it like this.
64292e95ad1Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
64392e95ad1Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
64492e95ad1Smrgecho 'include confinc.mk # ignored' > confmf.GNU
64592e95ad1Smrg_am_result=no
64692e95ad1Smrgfor s in GNU BSD; do
64792e95ad1Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
64892e95ad1Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
64992e95ad1Smrg      ['0:this is the am__doit target'],
65092e95ad1Smrg      [AS_CASE([$s],
65192e95ad1Smrg          [BSD], [am__include='.include' am__quote='"'],
65292e95ad1Smrg          [am__include='include' am__quote=''])])
65392e95ad1Smrg  if test "$am__include" != "#"; then
65492e95ad1Smrg    _am_result="yes ($s style)"
65592e95ad1Smrg    break
65692e95ad1Smrg  fi
65792e95ad1Smrgdone
65892e95ad1Smrgrm -f confinc.* confmf.*
65992e95ad1SmrgAC_MSG_RESULT([${_am_result}])
66092e95ad1SmrgAC_SUBST([am__include])])
66192e95ad1SmrgAC_SUBST([am__quote])])
662b91640d3Smrg
66392e95ad1Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
664a6d9b409Smrg
665838f5b0bSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
66611a95ff3Smrg#
66792e95ad1Smrg# This file is free software; the Free Software Foundation
66892e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
66992e95ad1Smrg# with or without modifications, as long as this notice is preserved.
670a6d9b409Smrg
67192e95ad1Smrg# AM_MISSING_PROG(NAME, PROGRAM)
67292e95ad1Smrg# ------------------------------
67392e95ad1SmrgAC_DEFUN([AM_MISSING_PROG],
67492e95ad1Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
67592e95ad1Smrg$1=${$1-"${am_missing_run}$2"}
67692e95ad1SmrgAC_SUBST($1)])
677a6d9b409Smrg
67892e95ad1Smrg# AM_MISSING_HAS_RUN
67992e95ad1Smrg# ------------------
68092e95ad1Smrg# Define MISSING if not defined so far and test if it is modern enough.
68192e95ad1Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
68292e95ad1SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
68392e95ad1Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
68492e95ad1SmrgAC_REQUIRE_AUX_FILE([missing])dnl
68592e95ad1Smrgif test x"${MISSING+set}" != xset; then
68692e95ad1Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
68711a95ff3Smrgfi
68892e95ad1Smrg# Use eval to expand $SHELL
68992e95ad1Smrgif eval "$MISSING --is-lightweight"; then
69092e95ad1Smrg  am_missing_run="$MISSING "
69192e95ad1Smrgelse
69292e95ad1Smrg  am_missing_run=
69392e95ad1Smrg  AC_MSG_WARN(['missing' script is too old or missing])
694efda2da8Smrgfi
69592e95ad1Smrg])
696a6d9b409Smrg
69792e95ad1Smrg# Helper functions for option handling.                     -*- Autoconf -*-
698a6d9b409Smrg
699838f5b0bSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
70092e95ad1Smrg#
70192e95ad1Smrg# This file is free software; the Free Software Foundation
70292e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
70392e95ad1Smrg# with or without modifications, as long as this notice is preserved.
704a6d9b409Smrg
70592e95ad1Smrg# _AM_MANGLE_OPTION(NAME)
70692e95ad1Smrg# -----------------------
70792e95ad1SmrgAC_DEFUN([_AM_MANGLE_OPTION],
70892e95ad1Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
709a6d9b409Smrg
71092e95ad1Smrg# _AM_SET_OPTION(NAME)
71192e95ad1Smrg# --------------------
71292e95ad1Smrg# Set option NAME.  Presently that only means defining a flag for this option.
71392e95ad1SmrgAC_DEFUN([_AM_SET_OPTION],
71492e95ad1Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
715a6d9b409Smrg
71692e95ad1Smrg# _AM_SET_OPTIONS(OPTIONS)
71792e95ad1Smrg# ------------------------
71892e95ad1Smrg# OPTIONS is a space-separated list of Automake options.
71992e95ad1SmrgAC_DEFUN([_AM_SET_OPTIONS],
72092e95ad1Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
72192e95ad1Smrg
72292e95ad1Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
72392e95ad1Smrg# -------------------------------------------
72492e95ad1Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
72592e95ad1SmrgAC_DEFUN([_AM_IF_OPTION],
72692e95ad1Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
72792e95ad1Smrg
728838f5b0bSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
72911a95ff3Smrg#
73092e95ad1Smrg# This file is free software; the Free Software Foundation
73192e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
73292e95ad1Smrg# with or without modifications, as long as this notice is preserved.
733a6d9b409Smrg
73492e95ad1Smrg# _AM_PROG_CC_C_O
73592e95ad1Smrg# ---------------
73692e95ad1Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
73792e95ad1Smrg# to automatically call this.
73892e95ad1SmrgAC_DEFUN([_AM_PROG_CC_C_O],
73992e95ad1Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
74092e95ad1SmrgAC_REQUIRE_AUX_FILE([compile])dnl
74192e95ad1SmrgAC_LANG_PUSH([C])dnl
74292e95ad1SmrgAC_CACHE_CHECK(
74392e95ad1Smrg  [whether $CC understands -c and -o together],
74492e95ad1Smrg  [am_cv_prog_cc_c_o],
74592e95ad1Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
74692e95ad1Smrg  # Make sure it works both with $CC and with simple cc.
74792e95ad1Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
74892e95ad1Smrg  # compilers refuse to overwrite an existing .o file with -o,
74992e95ad1Smrg  # though they will create one.
75092e95ad1Smrg  am_cv_prog_cc_c_o=yes
75192e95ad1Smrg  for am_i in 1 2; do
75292e95ad1Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
75392e95ad1Smrg         && test -f conftest2.$ac_objext; then
75492e95ad1Smrg      : OK
75592e95ad1Smrg    else
75692e95ad1Smrg      am_cv_prog_cc_c_o=no
75792e95ad1Smrg      break
75892e95ad1Smrg    fi
75992e95ad1Smrg  done
76092e95ad1Smrg  rm -f core conftest*
76192e95ad1Smrg  unset am_i])
76292e95ad1Smrgif test "$am_cv_prog_cc_c_o" != yes; then
76392e95ad1Smrg   # Losing compiler, so override with the script.
76492e95ad1Smrg   # FIXME: It is wrong to rewrite CC.
76592e95ad1Smrg   # But if we don't then we get into trouble of one sort or another.
76692e95ad1Smrg   # A longer-term fix would be to have automake use am__CC in this case,
76792e95ad1Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
76892e95ad1Smrg   CC="$am_aux_dir/compile $CC"
769a6d9b409Smrgfi
77092e95ad1SmrgAC_LANG_POP([C])])
771a6d9b409Smrg
77292e95ad1Smrg# For backward compatibility.
77392e95ad1SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
774a6d9b409Smrg
775838f5b0bSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
776838f5b0bSmrg#
777838f5b0bSmrg# This file is free software; the Free Software Foundation
778838f5b0bSmrg# gives unlimited permission to copy and/or distribute it,
779838f5b0bSmrg# with or without modifications, as long as this notice is preserved.
780838f5b0bSmrg
781838f5b0bSmrg# _AM_PROG_RM_F
782838f5b0bSmrg# ---------------
783838f5b0bSmrg# Check whether 'rm -f' without any arguments works.
784838f5b0bSmrg# https://bugs.gnu.org/10828
785838f5b0bSmrgAC_DEFUN([_AM_PROG_RM_F],
786838f5b0bSmrg[am__rm_f_notfound=
787838f5b0bSmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
788838f5b0bSmrgAC_SUBST(am__rm_f_notfound)
789838f5b0bSmrg])
790838f5b0bSmrg
791838f5b0bSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
7928b8e729cSmrg#
79392e95ad1Smrg# This file is free software; the Free Software Foundation
79492e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
79592e95ad1Smrg# with or without modifications, as long as this notice is preserved.
796a6d9b409Smrg
79792e95ad1Smrg# AM_RUN_LOG(COMMAND)
79892e95ad1Smrg# -------------------
79992e95ad1Smrg# Run COMMAND, save the exit status in ac_status, and log it.
80092e95ad1Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
80192e95ad1SmrgAC_DEFUN([AM_RUN_LOG],
80292e95ad1Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
80392e95ad1Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
80492e95ad1Smrg   ac_status=$?
80592e95ad1Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
80692e95ad1Smrg   (exit $ac_status); }])
80792e95ad1Smrg
80892e95ad1Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
80992e95ad1Smrg
810838f5b0bSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
81111a95ff3Smrg#
81292e95ad1Smrg# This file is free software; the Free Software Foundation
81392e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
81492e95ad1Smrg# with or without modifications, as long as this notice is preserved.
815a6d9b409Smrg
816838f5b0bSmrg# _AM_SLEEP_FRACTIONAL_SECONDS
817838f5b0bSmrg# ----------------------------
818838f5b0bSmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
819838f5b0bSmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
820838f5b0bSmrg               am_cv_sleep_fractional_seconds, [dnl
821838f5b0bSmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
822838f5b0bSmrg                                 [am_cv_sleep_fractional_seconds=no])
823838f5b0bSmrg])])
824838f5b0bSmrg
825838f5b0bSmrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
826838f5b0bSmrg# -----------------------------------
827838f5b0bSmrg# Determine the filesystem's resolution for file modification
828838f5b0bSmrg# timestamps.  The coarsest we know of is FAT, with a resolution
829838f5b0bSmrg# of only two seconds, even with the most recent "exFAT" extensions.
830838f5b0bSmrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
831838f5b0bSmrg# nanosecond, matching clock_gettime.  However, it is probably not
832838f5b0bSmrg# possible to delay execution of a shell script for less than one
833838f5b0bSmrg# millisecond, due to process creation overhead and scheduling
834838f5b0bSmrg# granularity, so we don't check for anything finer than that. (See below.)
835838f5b0bSmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
836838f5b0bSmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
837838f5b0bSmrgAC_CACHE_CHECK([filesystem timestamp resolution],
838838f5b0bSmrg               am_cv_filesystem_timestamp_resolution, [dnl
839838f5b0bSmrg# Default to the worst case.
840838f5b0bSmrgam_cv_filesystem_timestamp_resolution=2
841838f5b0bSmrg
842838f5b0bSmrg# Only try to go finer than 1 sec if sleep can do it.
843838f5b0bSmrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
844838f5b0bSmrg# - 1 sec is not much of a win compared to 2 sec, and
845838f5b0bSmrg# - it takes 2 seconds to perform the test whether 1 sec works.
846838f5b0bSmrg# 
847838f5b0bSmrg# Instead, just use the default 2s on platforms that have 1s resolution,
848838f5b0bSmrg# accept the extra 1s delay when using $sleep in the Automake tests, in
849838f5b0bSmrg# exchange for not incurring the 2s delay for running the test for all
850838f5b0bSmrg# packages.
851838f5b0bSmrg#
852838f5b0bSmrgam_try_resolutions=
853838f5b0bSmrgif test "$am_cv_sleep_fractional_seconds" = yes; then
854838f5b0bSmrg  # Even a millisecond often causes a bunch of false positives,
855838f5b0bSmrg  # so just try a hundredth of a second. The time saved between .001 and
856838f5b0bSmrg  # .01 is not terribly consequential.
857838f5b0bSmrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
858838f5b0bSmrgfi
859838f5b0bSmrg
860838f5b0bSmrg# In order to catch current-generation FAT out, we must *modify* files
861838f5b0bSmrg# that already exist; the *creation* timestamp is finer.  Use names
862838f5b0bSmrg# that make ls -t sort them differently when they have equal
863838f5b0bSmrg# timestamps than when they have distinct timestamps, keeping
864838f5b0bSmrg# in mind that ls -t prints the *newest* file first.
865838f5b0bSmrgrm -f conftest.ts?
866838f5b0bSmrg: > conftest.ts1
867838f5b0bSmrg: > conftest.ts2
868838f5b0bSmrg: > conftest.ts3
869838f5b0bSmrg
870838f5b0bSmrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
871838f5b0bSmrg# clobber the current shell's arguments. (Outer-level square brackets
872838f5b0bSmrg# are removed by m4; they're present so that m4 does not expand
873838f5b0bSmrg# <dollar><star>; be careful, easy to get confused.)
874838f5b0bSmrgif (
875838f5b0bSmrg     set X `[ls -t conftest.ts[12]]` &&
876838f5b0bSmrg     {
877838f5b0bSmrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
878838f5b0bSmrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
879838f5b0bSmrg     }
880838f5b0bSmrg); then :; else
881838f5b0bSmrg  # If neither matched, then we have a broken ls.  This can happen
882838f5b0bSmrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
883838f5b0bSmrg  # broken ls alias from the environment.  This has actually
884838f5b0bSmrg  # happened.  Such a system could not be considered "sane".
885838f5b0bSmrg  _AS_ECHO_UNQUOTED(
886838f5b0bSmrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
887838f5b0bSmrg    [AS_MESSAGE_LOG_FD])
888838f5b0bSmrg  AC_MSG_FAILURE([ls -t produces unexpected output.
889838f5b0bSmrgMake sure there is not a broken ls alias in your environment.])
890838f5b0bSmrgfi
891838f5b0bSmrg
892838f5b0bSmrgfor am_try_res in $am_try_resolutions; do
893838f5b0bSmrg  # Any one fine-grained sleep might happen to cross the boundary
894838f5b0bSmrg  # between two values of a coarser actual resolution, but if we do
895838f5b0bSmrg  # two fine-grained sleeps in a row, at least one of them will fall
896838f5b0bSmrg  # entirely within a coarse interval.
897838f5b0bSmrg  echo alpha > conftest.ts1
898838f5b0bSmrg  sleep $am_try_res
899838f5b0bSmrg  echo beta > conftest.ts2
900838f5b0bSmrg  sleep $am_try_res
901838f5b0bSmrg  echo gamma > conftest.ts3
902838f5b0bSmrg
903838f5b0bSmrg  # We assume that 'ls -t' will make use of high-resolution
904838f5b0bSmrg  # timestamps if the operating system supports them at all.
905838f5b0bSmrg  if (set X `ls -t conftest.ts?` &&
906838f5b0bSmrg      test "$[]2" = conftest.ts3 &&
907838f5b0bSmrg      test "$[]3" = conftest.ts2 &&
908838f5b0bSmrg      test "$[]4" = conftest.ts1); then
909838f5b0bSmrg    #
910838f5b0bSmrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
911838f5b0bSmrg    # because we don't need to test make.
912838f5b0bSmrg    make_ok=true
913838f5b0bSmrg    if test $am_try_res != 1; then
914838f5b0bSmrg      # But if we've succeeded so far with a subsecond resolution, we
915838f5b0bSmrg      # have one more thing to check: make. It can happen that
916838f5b0bSmrg      # everything else supports the subsecond mtimes, but make doesn't;
917838f5b0bSmrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
918838f5b0bSmrg      # released under GPLv2). https://bugs.gnu.org/68808
919838f5b0bSmrg      # 
920838f5b0bSmrg      # We test $MAKE if it is defined in the environment, else "make".
921838f5b0bSmrg      # It might get overridden later, but our hope is that in practice
922838f5b0bSmrg      # it does not matter: it is the system "make" which is (by far)
923838f5b0bSmrg      # the most likely to be broken, whereas if the user overrides it,
924838f5b0bSmrg      # probably they did so with a better, or at least not worse, make.
925838f5b0bSmrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
926838f5b0bSmrg      #
927838f5b0bSmrg      # Create a Makefile (real tab character here):
928838f5b0bSmrg      rm -f conftest.mk
929838f5b0bSmrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
930838f5b0bSmrg      echo '	touch conftest.ts2' >>conftest.mk
931838f5b0bSmrg      #
932838f5b0bSmrg      # Now, running
933838f5b0bSmrg      #   touch conftest.ts1; touch conftest.ts2; make
934838f5b0bSmrg      # should touch ts1 because ts2 is newer. This could happen by luck,
935838f5b0bSmrg      # but most often, it will fail if make's support is insufficient. So
936838f5b0bSmrg      # test for several consecutive successes.
937838f5b0bSmrg      #
938838f5b0bSmrg      # (We reuse conftest.ts[12] because we still want to modify existing
939838f5b0bSmrg      # files, not create new ones, per above.)
940838f5b0bSmrg      n=0
941838f5b0bSmrg      make=${MAKE-make}
942838f5b0bSmrg      until test $n -eq 3; do
943838f5b0bSmrg        echo one > conftest.ts1
944838f5b0bSmrg        sleep $am_try_res
945838f5b0bSmrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
946838f5b0bSmrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
947838f5b0bSmrg          make_ok=false
948838f5b0bSmrg          break # out of $n loop
949838f5b0bSmrg        fi
950838f5b0bSmrg        n=`expr $n + 1`
951838f5b0bSmrg      done
952838f5b0bSmrg    fi
953838f5b0bSmrg    #
954838f5b0bSmrg    if $make_ok; then
955838f5b0bSmrg      # Everything we know to check worked out, so call this resolution good.
956838f5b0bSmrg      am_cv_filesystem_timestamp_resolution=$am_try_res
957838f5b0bSmrg      break # out of $am_try_res loop
958838f5b0bSmrg    fi
959838f5b0bSmrg    # Otherwise, we'll go on to check the next resolution.
960838f5b0bSmrg  fi
961838f5b0bSmrgdone
962838f5b0bSmrgrm -f conftest.ts?
963838f5b0bSmrg# (end _am_filesystem_timestamp_resolution)
964838f5b0bSmrg])])
965838f5b0bSmrg
96692e95ad1Smrg# AM_SANITY_CHECK
96792e95ad1Smrg# ---------------
96892e95ad1SmrgAC_DEFUN([AM_SANITY_CHECK],
969838f5b0bSmrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
970838f5b0bSmrg# This check should not be cached, as it may vary across builds of
971838f5b0bSmrg# different projects.
972838f5b0bSmrgAC_MSG_CHECKING([whether build environment is sane])
97392e95ad1Smrg# Reject unsafe characters in $srcdir or the absolute working directory
97492e95ad1Smrg# name.  Accept space and tab only in the latter.
97592e95ad1Smrgam_lf='
97692e95ad1Smrg'
97792e95ad1Smrgcase `pwd` in
97892e95ad1Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
97992e95ad1Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
98092e95ad1Smrgesac
98192e95ad1Smrgcase $srcdir in
98292e95ad1Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
98392e95ad1Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
98492e95ad1Smrgesac
98592e95ad1Smrg
98692e95ad1Smrg# Do 'set' in a subshell so we don't clobber the current shell's
98792e95ad1Smrg# arguments.  Must try -L first in case configure is actually a
98892e95ad1Smrg# symlink; some systems play weird games with the mod time of symlinks
98992e95ad1Smrg# (eg FreeBSD returns the mod time of the symlink's containing
99092e95ad1Smrg# directory).
991838f5b0bSmrgam_build_env_is_sane=no
992838f5b0bSmrgam_has_slept=no
993838f5b0bSmrgrm -f conftest.file
994838f5b0bSmrgfor am_try in 1 2; do
995838f5b0bSmrg  echo "timestamp, slept: $am_has_slept" > conftest.file
996838f5b0bSmrg  if (
997838f5b0bSmrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
998838f5b0bSmrg    if test "$[]*" = "X"; then
999838f5b0bSmrg      # -L didn't work.
1000838f5b0bSmrg      set X `ls -t "$srcdir/configure" conftest.file`
1001838f5b0bSmrg    fi
1002838f5b0bSmrg    test "$[]2" = conftest.file
1003838f5b0bSmrg  ); then
1004838f5b0bSmrg    am_build_env_is_sane=yes
1005838f5b0bSmrg    break
1006838f5b0bSmrg  fi
1007838f5b0bSmrg  # Just in case.
1008838f5b0bSmrg  sleep "$am_cv_filesystem_timestamp_resolution"
1009838f5b0bSmrg  am_has_slept=yes
1010838f5b0bSmrgdone
1011838f5b0bSmrg
1012838f5b0bSmrgAC_MSG_RESULT([$am_build_env_is_sane])
1013838f5b0bSmrgif test "$am_build_env_is_sane" = no; then
1014838f5b0bSmrg  AC_MSG_ERROR([newly created file is older than distributed files!
101592e95ad1SmrgCheck your system clock])
1016b91640d3Smrgfi
1017838f5b0bSmrg
101892e95ad1Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
101992e95ad1Smrg# generated files are strictly newer.
102092e95ad1Smrgam_sleep_pid=
1021838f5b0bSmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
1022838f5b0bSmrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
102392e95ad1Smrg  am_sleep_pid=$!
1024838f5b0bSmrg])
102592e95ad1SmrgAC_CONFIG_COMMANDS_PRE(
102692e95ad1Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
102792e95ad1Smrg   if test -n "$am_sleep_pid"; then
102892e95ad1Smrg     # Hide warnings about reused PIDs.
102992e95ad1Smrg     wait $am_sleep_pid 2>/dev/null
103092e95ad1Smrg   fi
103192e95ad1Smrg   AC_MSG_RESULT([done])])
103292e95ad1Smrgrm -f conftest.file
103392e95ad1Smrg])
1034b91640d3Smrg
1035838f5b0bSmrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
103611a95ff3Smrg#
103792e95ad1Smrg# This file is free software; the Free Software Foundation
103892e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
103992e95ad1Smrg# with or without modifications, as long as this notice is preserved.
1040a6d9b409Smrg
1041838f5b0bSmrg# _AM_SILENT_RULES
1042838f5b0bSmrg# ----------------
1043838f5b0bSmrg# Enable less verbose build rules support.
1044838f5b0bSmrgAC_DEFUN([_AM_SILENT_RULES],
1045838f5b0bSmrg[AM_DEFAULT_VERBOSITY=1
1046838f5b0bSmrgAC_ARG_ENABLE([silent-rules], [dnl
104792e95ad1SmrgAS_HELP_STRING(
104892e95ad1Smrg  [--enable-silent-rules],
104992e95ad1Smrg  [less verbose build output (undo: "make V=1")])
105092e95ad1SmrgAS_HELP_STRING(
105192e95ad1Smrg  [--disable-silent-rules],
105292e95ad1Smrg  [verbose build output (undo: "make V=0")])dnl
105392e95ad1Smrg])
105492e95ad1Smrgdnl
105592e95ad1Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
105692e95ad1Smrgdnl do not support nested variable expansions.
105792e95ad1Smrgdnl See automake bug#9928 and bug#10237.
105892e95ad1Smrgam_make=${MAKE-make}
105992e95ad1SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
106092e95ad1Smrg   [am_cv_make_support_nested_variables],
106192e95ad1Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
106292e95ad1SmrgBAR0=false
106392e95ad1SmrgBAR1=true
106492e95ad1SmrgV=1
106592e95ad1Smrgam__doit:
106692e95ad1Smrg	@$(TRUE)
106792e95ad1Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
106892e95ad1Smrg  am_cv_make_support_nested_variables=yes
106911a95ff3Smrgelse
107092e95ad1Smrg  am_cv_make_support_nested_variables=no
107192e95ad1Smrgfi])
107292e95ad1SmrgAC_SUBST([AM_V])dnl
107392e95ad1SmrgAM_SUBST_NOTMAKE([AM_V])dnl
107492e95ad1SmrgAC_SUBST([AM_DEFAULT_V])dnl
107592e95ad1SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
107692e95ad1SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
107792e95ad1SmrgAM_BACKSLASH='\'
107892e95ad1SmrgAC_SUBST([AM_BACKSLASH])dnl
107992e95ad1Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1080838f5b0bSmrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
1081838f5b0bSmrgdnl to AM_SILENT_RULES to change the default value.
1082838f5b0bSmrgAC_CONFIG_COMMANDS_PRE([dnl
1083838f5b0bSmrgcase $enable_silent_rules in @%:@ (((
1084838f5b0bSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
1085838f5b0bSmrg   no) AM_DEFAULT_VERBOSITY=1;;
1086838f5b0bSmrgesac
1087838f5b0bSmrgif test $am_cv_make_support_nested_variables = yes; then
1088838f5b0bSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
1089838f5b0bSmrg  AM_V='$(V)'
1090838f5b0bSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
1091838f5b0bSmrgelse
1092838f5b0bSmrg  AM_V=$AM_DEFAULT_VERBOSITY
1093838f5b0bSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
1094838f5b0bSmrgfi
1095838f5b0bSmrg])dnl
109692e95ad1Smrg])
1097b91640d3Smrg
1098838f5b0bSmrg# AM_SILENT_RULES([DEFAULT])
1099838f5b0bSmrg# --------------------------
1100838f5b0bSmrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
1101838f5b0bSmrg# empty being verbose).
1102838f5b0bSmrgAC_DEFUN([AM_SILENT_RULES],
1103838f5b0bSmrg[AC_REQUIRE([_AM_SILENT_RULES])
1104838f5b0bSmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
1105838f5b0bSmrg
1106838f5b0bSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
110711a95ff3Smrg#
110892e95ad1Smrg# This file is free software; the Free Software Foundation
110992e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
111092e95ad1Smrg# with or without modifications, as long as this notice is preserved.
1111b91640d3Smrg
111292e95ad1Smrg# AM_PROG_INSTALL_STRIP
111392e95ad1Smrg# ---------------------
111492e95ad1Smrg# One issue with vendor 'install' (even GNU) is that you can't
111592e95ad1Smrg# specify the program used to strip binaries.  This is especially
111692e95ad1Smrg# annoying in cross-compiling environments, where the build's strip
111792e95ad1Smrg# is unlikely to handle the host's binaries.
111892e95ad1Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
111992e95ad1Smrg# always use install-sh in "make install-strip", and initialize
112092e95ad1Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
112192e95ad1SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
112292e95ad1Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
112392e95ad1Smrg# Installed binaries are usually stripped using 'strip' when the user
112492e95ad1Smrg# run "make install-strip".  However 'strip' might not be the right
112592e95ad1Smrg# tool to use in cross-compilation environments, therefore Automake
112692e95ad1Smrg# will honor the 'STRIP' environment variable to overrule this program.
112792e95ad1Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
112892e95ad1Smrgif test "$cross_compiling" != no; then
112992e95ad1Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
1130b91640d3Smrgfi
113192e95ad1SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
113292e95ad1SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1133a6d9b409Smrg
1134838f5b0bSmrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
113511a95ff3Smrg#
113692e95ad1Smrg# This file is free software; the Free Software Foundation
113792e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
113892e95ad1Smrg# with or without modifications, as long as this notice is preserved.
1139efda2da8Smrg
114092e95ad1Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
114192e95ad1Smrg# ---------------------------
114292e95ad1Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
114392e95ad1Smrg# This macro is traced by Automake.
114492e95ad1SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
114511a95ff3Smrg
114692e95ad1Smrg# AM_SUBST_NOTMAKE(VARIABLE)
114792e95ad1Smrg# --------------------------
114892e95ad1Smrg# Public sister of _AM_SUBST_NOTMAKE.
114992e95ad1SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1150efda2da8Smrg
115192e95ad1Smrg# Check how to create a tarball.                            -*- Autoconf -*-
115211a95ff3Smrg
1153838f5b0bSmrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
115411a95ff3Smrg#
115592e95ad1Smrg# This file is free software; the Free Software Foundation
115692e95ad1Smrg# gives unlimited permission to copy and/or distribute it,
115792e95ad1Smrg# with or without modifications, as long as this notice is preserved.
115892e95ad1Smrg
115992e95ad1Smrg# _AM_PROG_TAR(FORMAT)
116092e95ad1Smrg# --------------------
116192e95ad1Smrg# Check how to create a tarball in format FORMAT.
116292e95ad1Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
116311a95ff3Smrg#
116492e95ad1Smrg# Substitute a variable $(am__tar) that is a command
116592e95ad1Smrg# writing to stdout a FORMAT-tarball containing the directory
116692e95ad1Smrg# $tardir.
116792e95ad1Smrg#     tardir=directory && $(am__tar) > result.tar
116811a95ff3Smrg#
116992e95ad1Smrg# Substitute a variable $(am__untar) that extract such
117092e95ad1Smrg# a tarball read from stdin.
117192e95ad1Smrg#     $(am__untar) < result.tar
117211a95ff3Smrg#
117392e95ad1SmrgAC_DEFUN([_AM_PROG_TAR],
117492e95ad1Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
117592e95ad1Smrg# in the wild :-(  We should find a proper way to deprecate it ...
117692e95ad1SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1177a6d9b409Smrg
117892e95ad1Smrg# We'll loop over all known methods to create a tar archive until one works.
117992e95ad1Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1180a6d9b409Smrg
118192e95ad1Smrgm4_if([$1], [v7],
118292e95ad1Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1183a6d9b409Smrg
118492e95ad1Smrg  [m4_case([$1],
118592e95ad1Smrg    [ustar],
118692e95ad1Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
118792e95ad1Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
118892e95ad1Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
118992e95ad1Smrg      # and bug#13588).
119092e95ad1Smrg      am_max_uid=2097151 # 2^21 - 1
119192e95ad1Smrg      am_max_gid=$am_max_uid
119292e95ad1Smrg      # The $UID and $GID variables are not portable, so we need to resort
119392e95ad1Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
119492e95ad1Smrg      # below are definitely unexpected, so allow the users to see them
119592e95ad1Smrg      # (that is, avoid stderr redirection).
119692e95ad1Smrg      am_uid=`id -u || echo unknown`
119792e95ad1Smrg      am_gid=`id -g || echo unknown`
119892e95ad1Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1199838f5b0bSmrg      if test x$am_uid = xunknown; then
1200838f5b0bSmrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
1201838f5b0bSmrg      elif test $am_uid -le $am_max_uid; then
1202838f5b0bSmrg        AC_MSG_RESULT([yes])
120392e95ad1Smrg      else
1204838f5b0bSmrg        AC_MSG_RESULT([no])
1205838f5b0bSmrg        _am_tools=none
120692e95ad1Smrg      fi
120792e95ad1Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1208838f5b0bSmrg      if test x$gm_gid = xunknown; then
1209838f5b0bSmrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
1210838f5b0bSmrg      elif test $am_gid -le $am_max_gid; then
1211838f5b0bSmrg        AC_MSG_RESULT([yes])
121292e95ad1Smrg      else
121392e95ad1Smrg        AC_MSG_RESULT([no])
121492e95ad1Smrg        _am_tools=none
121592e95ad1Smrg      fi],
1216a097bd00Smrg
121792e95ad1Smrg  [pax],
121892e95ad1Smrg    [],
1219a097bd00Smrg
122092e95ad1Smrg  [m4_fatal([Unknown tar format])])
1221a6d9b409Smrg
122292e95ad1Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1223a6d9b409Smrg
122492e95ad1Smrg  # Go ahead even if we have the value already cached.  We do so because we
122592e95ad1Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
122692e95ad1Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1227a6d9b409Smrg
122892e95ad1Smrg  for _am_tool in $_am_tools; do
122992e95ad1Smrg    case $_am_tool in
123092e95ad1Smrg    gnutar)
123192e95ad1Smrg      for _am_tar in tar gnutar gtar; do
123292e95ad1Smrg        AM_RUN_LOG([$_am_tar --version]) && break
123392e95ad1Smrg      done
123492e95ad1Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
123592e95ad1Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
123692e95ad1Smrg      am__untar="$_am_tar -xf -"
123792e95ad1Smrg      ;;
123892e95ad1Smrg    plaintar)
123992e95ad1Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
124092e95ad1Smrg      # ustar tarball either.
124192e95ad1Smrg      (tar --version) >/dev/null 2>&1 && continue
124292e95ad1Smrg      am__tar='tar chf - "$$tardir"'
124392e95ad1Smrg      am__tar_='tar chf - "$tardir"'
124492e95ad1Smrg      am__untar='tar xf -'
124592e95ad1Smrg      ;;
124692e95ad1Smrg    pax)
124792e95ad1Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
124892e95ad1Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
124992e95ad1Smrg      am__untar='pax -r'
125092e95ad1Smrg      ;;
125192e95ad1Smrg    cpio)
125292e95ad1Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
125392e95ad1Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
125492e95ad1Smrg      am__untar='cpio -i -H $1 -d'
125592e95ad1Smrg      ;;
125692e95ad1Smrg    none)
125792e95ad1Smrg      am__tar=false
125892e95ad1Smrg      am__tar_=false
125992e95ad1Smrg      am__untar=false
126092e95ad1Smrg      ;;
126192e95ad1Smrg    esac
1262a6d9b409Smrg
126392e95ad1Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
126492e95ad1Smrg    # and am__untar set.
126592e95ad1Smrg    test -n "${am_cv_prog_tar_$1}" && break
1266a6d9b409Smrg
126792e95ad1Smrg    # tar/untar a dummy directory, and stop if the command works.
126892e95ad1Smrg    rm -rf conftest.dir
126992e95ad1Smrg    mkdir conftest.dir
127092e95ad1Smrg    echo GrepMe > conftest.dir/file
127192e95ad1Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
127292e95ad1Smrg    rm -rf conftest.dir
127392e95ad1Smrg    if test -s conftest.tar; then
127492e95ad1Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
127592e95ad1Smrg      AM_RUN_LOG([cat conftest.dir/file])
127692e95ad1Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
127792e95ad1Smrg    fi
127892e95ad1Smrg  done
127992e95ad1Smrg  rm -rf conftest.dir
1280a6d9b409Smrg
128192e95ad1Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
128292e95ad1Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1283a6d9b409Smrg
128492e95ad1SmrgAC_SUBST([am__tar])
128592e95ad1SmrgAC_SUBST([am__untar])
128692e95ad1Smrg]) # _AM_PROG_TAR
1287a6d9b409Smrg
1288838f5b0bSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
1289838f5b0bSmrg#
1290838f5b0bSmrg# This file is free software; the Free Software Foundation
1291838f5b0bSmrg# gives unlimited permission to copy and/or distribute it,
1292838f5b0bSmrg# with or without modifications, as long as this notice is preserved.
1293838f5b0bSmrg
1294838f5b0bSmrg# _AM_PROG_XARGS_N
1295838f5b0bSmrg# ----------------
1296838f5b0bSmrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
1297838f5b0bSmrg# is not optimized at all as we never expect to use it.
1298838f5b0bSmrgAC_DEFUN([_AM_PROG_XARGS_N],
1299838f5b0bSmrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
1300838f5b0bSmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
1301838f5b0bSmrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
1302838f5b0bSmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
1303838f5b0bSmrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
1304838f5b0bSmrg])dnl
1305838f5b0bSmrgAC_SUBST(am__xargs_n)
1306838f5b0bSmrg])
1307838f5b0bSmrg
130892e95ad1Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
130992e95ad1Smrgdnl serial 11 (pkg-config-0.29)
131092e95ad1Smrgdnl
131192e95ad1Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
131292e95ad1Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
131392e95ad1Smrgdnl
131492e95ad1Smrgdnl This program is free software; you can redistribute it and/or modify
131592e95ad1Smrgdnl it under the terms of the GNU General Public License as published by
131692e95ad1Smrgdnl the Free Software Foundation; either version 2 of the License, or
131792e95ad1Smrgdnl (at your option) any later version.
131892e95ad1Smrgdnl
131992e95ad1Smrgdnl This program is distributed in the hope that it will be useful, but
132092e95ad1Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
132192e95ad1Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
132292e95ad1Smrgdnl General Public License for more details.
132392e95ad1Smrgdnl
132492e95ad1Smrgdnl You should have received a copy of the GNU General Public License
132592e95ad1Smrgdnl along with this program; if not, write to the Free Software
132692e95ad1Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
132792e95ad1Smrgdnl 02111-1307, USA.
132892e95ad1Smrgdnl
132992e95ad1Smrgdnl As a special exception to the GNU General Public License, if you
133092e95ad1Smrgdnl distribute this file as part of a program that contains a
133192e95ad1Smrgdnl configuration script generated by Autoconf, you may include it under
133292e95ad1Smrgdnl the same distribution terms that you use for the rest of that
133392e95ad1Smrgdnl program.
1334a6d9b409Smrg
133592e95ad1Smrgdnl PKG_PREREQ(MIN-VERSION)
133692e95ad1Smrgdnl -----------------------
133792e95ad1Smrgdnl Since: 0.29
133892e95ad1Smrgdnl
133992e95ad1Smrgdnl Verify that the version of the pkg-config macros are at least
134092e95ad1Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
134192e95ad1Smrgdnl installed version of pkg-config, this checks the developer's version
134292e95ad1Smrgdnl of pkg.m4 when generating configure.
134392e95ad1Smrgdnl
134492e95ad1Smrgdnl To ensure that this macro is defined, also add:
134592e95ad1Smrgdnl m4_ifndef([PKG_PREREQ],
134692e95ad1Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
134792e95ad1Smrgdnl
134892e95ad1Smrgdnl See the "Since" comment for each macro you use to see what version
134992e95ad1Smrgdnl of the macros you require.
135092e95ad1Smrgm4_defun([PKG_PREREQ],
135192e95ad1Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
135292e95ad1Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
135392e95ad1Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
135492e95ad1Smrg])dnl PKG_PREREQ
1355a6d9b409Smrg
135692e95ad1Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
135792e95ad1Smrgdnl ----------------------------------
135892e95ad1Smrgdnl Since: 0.16
135992e95ad1Smrgdnl
136092e95ad1Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
136192e95ad1Smrgdnl first found in the path. Checks that the version of pkg-config found
136292e95ad1Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
136392e95ad1Smrgdnl used since that's the first version where most current features of
136492e95ad1Smrgdnl pkg-config existed.
136592e95ad1SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
136692e95ad1Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
136792e95ad1Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
136892e95ad1Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
136992e95ad1SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
137092e95ad1SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
137192e95ad1SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1372a6d9b409Smrg
137392e95ad1Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
137492e95ad1Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1375a6d9b409Smrgfi
137692e95ad1Smrgif test -n "$PKG_CONFIG"; then
137792e95ad1Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
137892e95ad1Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
137992e95ad1Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
138092e95ad1Smrg		AC_MSG_RESULT([yes])
138192e95ad1Smrg	else
138292e95ad1Smrg		AC_MSG_RESULT([no])
138392e95ad1Smrg		PKG_CONFIG=""
138492e95ad1Smrg	fi
138592e95ad1Smrgfi[]dnl
138692e95ad1Smrg])dnl PKG_PROG_PKG_CONFIG
13871e5fa1c5Smrg
138892e95ad1Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
138992e95ad1Smrgdnl -------------------------------------------------------------------
139092e95ad1Smrgdnl Since: 0.18
139192e95ad1Smrgdnl
139292e95ad1Smrgdnl Check to see whether a particular set of modules exists. Similar to
139392e95ad1Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
139492e95ad1Smrgdnl
139592e95ad1Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
139692e95ad1Smrgdnl only at the first occurence in configure.ac, so if the first place
139792e95ad1Smrgdnl it's called might be skipped (such as if it is within an "if", you
139892e95ad1Smrgdnl have to call PKG_CHECK_EXISTS manually
139992e95ad1SmrgAC_DEFUN([PKG_CHECK_EXISTS],
140092e95ad1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
140192e95ad1Smrgif test -n "$PKG_CONFIG" && \
140292e95ad1Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
140392e95ad1Smrg  m4_default([$2], [:])
140492e95ad1Smrgm4_ifvaln([$3], [else
140592e95ad1Smrg  $3])dnl
140692e95ad1Smrgfi])
140792e95ad1Smrg
140892e95ad1Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
140992e95ad1Smrgdnl ---------------------------------------------
141092e95ad1Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
141192e95ad1Smrgdnl pkg_failed based on the result.
141292e95ad1Smrgm4_define([_PKG_CONFIG],
141392e95ad1Smrg[if test -n "$$1"; then
141492e95ad1Smrg    pkg_cv_[]$1="$$1"
141592e95ad1Smrg elif test -n "$PKG_CONFIG"; then
141692e95ad1Smrg    PKG_CHECK_EXISTS([$3],
141792e95ad1Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
141892e95ad1Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
141992e95ad1Smrg		     [pkg_failed=yes])
142092e95ad1Smrg else
142192e95ad1Smrg    pkg_failed=untried
142292e95ad1Smrgfi[]dnl
142392e95ad1Smrg])dnl _PKG_CONFIG
142492e95ad1Smrg
142592e95ad1Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
142692e95ad1Smrgdnl ---------------------------
142792e95ad1Smrgdnl Internal check to see if pkg-config supports short errors.
142892e95ad1SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
142992e95ad1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
143092e95ad1Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
143192e95ad1Smrg        _pkg_short_errors_supported=yes
14321e5fa1c5Smrgelse
143392e95ad1Smrg        _pkg_short_errors_supported=no
143492e95ad1Smrgfi[]dnl
143592e95ad1Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
14361e5fa1c5Smrg
1437a6d9b409Smrg
143892e95ad1Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
143992e95ad1Smrgdnl   [ACTION-IF-NOT-FOUND])
144092e95ad1Smrgdnl --------------------------------------------------------------
144192e95ad1Smrgdnl Since: 0.4.0
144292e95ad1Smrgdnl
144392e95ad1Smrgdnl Note that if there is a possibility the first call to
144492e95ad1Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
144592e95ad1Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
144692e95ad1SmrgAC_DEFUN([PKG_CHECK_MODULES],
144792e95ad1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
144892e95ad1SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
144992e95ad1SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1450a6d9b409Smrg
145192e95ad1Smrgpkg_failed=no
145292e95ad1SmrgAC_MSG_CHECKING([for $1])
1453a6d9b409Smrg
145492e95ad1Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
145592e95ad1Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1456a6d9b409Smrg
145792e95ad1Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
145892e95ad1Smrgand $1[]_LIBS to avoid the need to call pkg-config.
145992e95ad1SmrgSee the pkg-config man page for more details.])
1460a6d9b409Smrg
146192e95ad1Smrgif test $pkg_failed = yes; then
146292e95ad1Smrg   	AC_MSG_RESULT([no])
146392e95ad1Smrg        _PKG_SHORT_ERRORS_SUPPORTED
146492e95ad1Smrg        if test $_pkg_short_errors_supported = yes; then
146592e95ad1Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
146692e95ad1Smrg        else 
146792e95ad1Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
146892e95ad1Smrg        fi
146992e95ad1Smrg	# Put the nasty error message in config.log where it belongs
147092e95ad1Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1471a6d9b409Smrg
147292e95ad1Smrg	m4_default([$4], [AC_MSG_ERROR(
147392e95ad1Smrg[Package requirements ($2) were not met:
1474a6d9b409Smrg
147592e95ad1Smrg$$1_PKG_ERRORS
147692e95ad1Smrg
147792e95ad1SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
147892e95ad1Smrginstalled software in a non-standard prefix.
147992e95ad1Smrg
148092e95ad1Smrg_PKG_TEXT])[]dnl
148192e95ad1Smrg        ])
148292e95ad1Smrgelif test $pkg_failed = untried; then
148392e95ad1Smrg     	AC_MSG_RESULT([no])
148492e95ad1Smrg	m4_default([$4], [AC_MSG_FAILURE(
148592e95ad1Smrg[The pkg-config script could not be found or is too old.  Make sure it
148692e95ad1Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
148792e95ad1Smrgpath to pkg-config.
148892e95ad1Smrg
148992e95ad1Smrg_PKG_TEXT
149092e95ad1Smrg
149192e95ad1SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
149292e95ad1Smrg        ])
1493a6d9b409Smrgelse
149492e95ad1Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
149592e95ad1Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
149692e95ad1Smrg        AC_MSG_RESULT([yes])
149792e95ad1Smrg	$3
149892e95ad1Smrgfi[]dnl
149992e95ad1Smrg])dnl PKG_CHECK_MODULES
1500a6d9b409Smrg
1501a6d9b409Smrg
150292e95ad1Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
150392e95ad1Smrgdnl   [ACTION-IF-NOT-FOUND])
150492e95ad1Smrgdnl ---------------------------------------------------------------------
150592e95ad1Smrgdnl Since: 0.29
150692e95ad1Smrgdnl
150792e95ad1Smrgdnl Checks for existence of MODULES and gathers its build flags with
150892e95ad1Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
150992e95ad1Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
151092e95ad1Smrgdnl
151192e95ad1Smrgdnl Note that if there is a possibility the first call to
151292e95ad1Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
151392e95ad1Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
151492e95ad1Smrgdnl configure.ac.
151592e95ad1SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
151692e95ad1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
151792e95ad1Smrg_save_PKG_CONFIG=$PKG_CONFIG
151892e95ad1SmrgPKG_CONFIG="$PKG_CONFIG --static"
151992e95ad1SmrgPKG_CHECK_MODULES($@)
152092e95ad1SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
152192e95ad1Smrg])dnl PKG_CHECK_MODULES_STATIC
15221e5fa1c5Smrg
1523a6d9b409Smrg
152492e95ad1Smrgdnl PKG_INSTALLDIR([DIRECTORY])
152592e95ad1Smrgdnl -------------------------
152692e95ad1Smrgdnl Since: 0.27
152792e95ad1Smrgdnl
152892e95ad1Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
152992e95ad1Smrgdnl should install pkg-config .pc files. By default the directory is
153092e95ad1Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
153192e95ad1Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
153292e95ad1Smrgdnl parameter.
153392e95ad1SmrgAC_DEFUN([PKG_INSTALLDIR],
153492e95ad1Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
153592e95ad1Smrgm4_pushdef([pkg_description],
153692e95ad1Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
153792e95ad1SmrgAC_ARG_WITH([pkgconfigdir],
153892e95ad1Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
153992e95ad1Smrg    [with_pkgconfigdir=]pkg_default)
154092e95ad1SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
154192e95ad1Smrgm4_popdef([pkg_default])
154292e95ad1Smrgm4_popdef([pkg_description])
154392e95ad1Smrg])dnl PKG_INSTALLDIR
154492e95ad1Smrg
154592e95ad1Smrg
154692e95ad1Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
154792e95ad1Smrgdnl --------------------------------
154892e95ad1Smrgdnl Since: 0.27
154992e95ad1Smrgdnl
155092e95ad1Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
155192e95ad1Smrgdnl module should install arch-independent pkg-config .pc files. By
155292e95ad1Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
155392e95ad1Smrgdnl changed by passing DIRECTORY. The user can override through the
155492e95ad1Smrgdnl --with-noarch-pkgconfigdir parameter.
155592e95ad1SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
155692e95ad1Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
155792e95ad1Smrgm4_pushdef([pkg_description],
155892e95ad1Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
155992e95ad1SmrgAC_ARG_WITH([noarch-pkgconfigdir],
156092e95ad1Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
156192e95ad1Smrg    [with_noarch_pkgconfigdir=]pkg_default)
156292e95ad1SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
156392e95ad1Smrgm4_popdef([pkg_default])
156492e95ad1Smrgm4_popdef([pkg_description])
156592e95ad1Smrg])dnl PKG_NOARCH_INSTALLDIR
156692e95ad1Smrg
1567a6d9b409Smrg
156892e95ad1Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
156992e95ad1Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
157092e95ad1Smrgdnl -------------------------------------------
157192e95ad1Smrgdnl Since: 0.28
157292e95ad1Smrgdnl
157392e95ad1Smrgdnl Retrieves the value of the pkg-config variable for the given module.
157492e95ad1SmrgAC_DEFUN([PKG_CHECK_VAR],
157592e95ad1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
157692e95ad1SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1577a6d9b409Smrg
157892e95ad1Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
157992e95ad1SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1580a6d9b409Smrg
158192e95ad1SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
158292e95ad1Smrg])dnl PKG_CHECK_VAR
1583a6d9b409Smrg
158492e95ad1Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
158592e95ad1Smrgdnl
1586838f5b0bSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
158792e95ad1Smrgdnl
158892e95ad1Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
158992e95ad1Smrgdnl copy of this software and associated documentation files (the "Software"),
159092e95ad1Smrgdnl to deal in the Software without restriction, including without limitation
159192e95ad1Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
159292e95ad1Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
159392e95ad1Smrgdnl Software is furnished to do so, subject to the following conditions:
159492e95ad1Smrgdnl
159592e95ad1Smrgdnl The above copyright notice and this permission notice (including the next
159692e95ad1Smrgdnl paragraph) shall be included in all copies or substantial portions of the
159792e95ad1Smrgdnl Software.
159892e95ad1Smrgdnl
159992e95ad1Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
160092e95ad1Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
160192e95ad1Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
160292e95ad1Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
160392e95ad1Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
160492e95ad1Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
160592e95ad1Smrgdnl DEALINGS IN THE SOFTWARE.
1606a6d9b409Smrg
160792e95ad1Smrg# XORG_MACROS_VERSION(required-version)
160892e95ad1Smrg# -------------------------------------
160911a95ff3Smrg# Minimum version: 1.1.0
16101e5fa1c5Smrg#
161192e95ad1Smrg# If you're using a macro added in Version 1.1 or newer, include this in
161292e95ad1Smrg# your configure.ac with the minimum required version, such as:
161392e95ad1Smrg# XORG_MACROS_VERSION(1.1)
16141e5fa1c5Smrg#
161592e95ad1Smrg# To ensure that this macro is defined, also add:
161692e95ad1Smrg# m4_ifndef([XORG_MACROS_VERSION],
161792e95ad1Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
16181e5fa1c5Smrg#
161992e95ad1Smrg#
162092e95ad1Smrg# See the "minimum version" comment for each macro you use to see what
162192e95ad1Smrg# version you require.
162292e95ad1Smrgm4_defun([XORG_MACROS_VERSION],[
1623838f5b0bSmrgm4_define([vers_have], [1.20.2])
162492e95ad1Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
162592e95ad1Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
162692e95ad1Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
162792e95ad1Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
162892e95ad1Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
162992e95ad1Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
163092e95ad1Smrgm4_undefine([vers_have])
163192e95ad1Smrgm4_undefine([maj_have])
163292e95ad1Smrgm4_undefine([maj_needed])
163392e95ad1Smrg]) # XORG_MACROS_VERSION
16341e5fa1c5Smrg
163592e95ad1Smrg# XORG_PROG_RAWCPP()
163692e95ad1Smrg# ------------------
163792e95ad1Smrg# Minimum version: 1.0.0
163892e95ad1Smrg#
163992e95ad1Smrg# Find cpp program and necessary flags for use in pre-processing text files
164092e95ad1Smrg# such as man pages and config files
164192e95ad1SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
164292e95ad1SmrgAC_REQUIRE([AC_PROG_CPP])
164392e95ad1SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
164492e95ad1Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
164511a95ff3Smrg
164692e95ad1Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
164792e95ad1Smrg# which is not the best choice for supporting other OS'es, but covers most
164892e95ad1Smrg# of the ones we need for now.
164992e95ad1SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
165092e95ad1SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
165192e95ad1Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
165292e95ad1Smrg	AC_MSG_RESULT([no])
165392e95ad1Smrgelse
165492e95ad1Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
165592e95ad1Smrg		RAWCPPFLAGS=-undef
165692e95ad1Smrg		AC_MSG_RESULT([yes])
165792e95ad1Smrg	# under Cygwin unix is still defined even with -undef
165892e95ad1Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
165992e95ad1Smrg		RAWCPPFLAGS="-undef -ansi"
166092e95ad1Smrg		AC_MSG_RESULT([yes, with -ansi])
166192e95ad1Smrg	else
166292e95ad1Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
166392e95ad1Smrg	fi
16641e5fa1c5Smrgfi
166592e95ad1Smrgrm -f conftest.$ac_ext
1666a097bd00Smrg
166792e95ad1SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
166892e95ad1SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1669838f5b0bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
167092e95ad1Smrg	AC_MSG_RESULT([no])
167192e95ad1Smrgelse
1672838f5b0bSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
167392e95ad1Smrg		TRADITIONALCPPFLAGS="-traditional"
167492e95ad1Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
167592e95ad1Smrg		AC_MSG_RESULT([yes])
167692e95ad1Smrg	else
167792e95ad1Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
167892e95ad1Smrg	fi
167992e95ad1Smrgfi
168092e95ad1Smrgrm -f conftest.$ac_ext
168192e95ad1SmrgAC_SUBST(RAWCPPFLAGS)
168292e95ad1SmrgAC_SUBST(TRADITIONALCPPFLAGS)
168392e95ad1Smrg]) # XORG_PROG_RAWCPP
16841e5fa1c5Smrg
168592e95ad1Smrg# XORG_MANPAGE_SECTIONS()
168692e95ad1Smrg# -----------------------
168792e95ad1Smrg# Minimum version: 1.0.0
1688a097bd00Smrg#
168992e95ad1Smrg# Determine which sections man pages go in for the different man page types
169092e95ad1Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
169192e95ad1Smrg# Not sure if there's any better way than just hardcoding by OS name.
169292e95ad1Smrg# Override default settings by setting environment variables
169392e95ad1Smrg# Added MAN_SUBSTS in version 1.8
169492e95ad1Smrg# Added AC_PROG_SED in version 1.8
169511a95ff3Smrg
169692e95ad1SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
169792e95ad1SmrgAC_REQUIRE([AC_CANONICAL_HOST])
169892e95ad1SmrgAC_REQUIRE([AC_PROG_SED])
1699a097bd00Smrg
170092e95ad1Smrgcase $host_os in
170192e95ad1Smrg    solaris*)
170292e95ad1Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
170392e95ad1Smrg        # check for a man page file found in later versions that use
170492e95ad1Smrg        # traditional section numbers instead
170592e95ad1Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
170692e95ad1Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
170792e95ad1Smrg        ;;
170892e95ad1Smrg    *) SYSV_MAN_SECTIONS=false ;;
170992e95ad1Smrgesac
1710a097bd00Smrg
171192e95ad1Smrgif test x$APP_MAN_SUFFIX = x    ; then
171292e95ad1Smrg    APP_MAN_SUFFIX=1
171392e95ad1Smrgfi
171492e95ad1Smrgif test x$APP_MAN_DIR = x    ; then
171592e95ad1Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
171692e95ad1Smrgfi
1717a097bd00Smrg
171892e95ad1Smrgif test x$LIB_MAN_SUFFIX = x    ; then
171992e95ad1Smrg    LIB_MAN_SUFFIX=3
172092e95ad1Smrgfi
172192e95ad1Smrgif test x$LIB_MAN_DIR = x    ; then
172292e95ad1Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
172392e95ad1Smrgfi
1724a097bd00Smrg
172592e95ad1Smrgif test x$FILE_MAN_SUFFIX = x    ; then
172692e95ad1Smrg    case $SYSV_MAN_SECTIONS in
172792e95ad1Smrg	true)				FILE_MAN_SUFFIX=4  ;;
172892e95ad1Smrg	*)				FILE_MAN_SUFFIX=5  ;;
172992e95ad1Smrg    esac
173092e95ad1Smrgfi
173192e95ad1Smrgif test x$FILE_MAN_DIR = x    ; then
173292e95ad1Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1733a097bd00Smrgfi
1734a097bd00Smrg
173592e95ad1Smrgif test x$MISC_MAN_SUFFIX = x    ; then
173692e95ad1Smrg    case $SYSV_MAN_SECTIONS in
173792e95ad1Smrg	true)				MISC_MAN_SUFFIX=5  ;;
173892e95ad1Smrg	*)				MISC_MAN_SUFFIX=7  ;;
173992e95ad1Smrg    esac
174092e95ad1Smrgfi
174192e95ad1Smrgif test x$MISC_MAN_DIR = x    ; then
174292e95ad1Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
174311a95ff3Smrgfi
1744a097bd00Smrg
174592e95ad1Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
174692e95ad1Smrg    case $SYSV_MAN_SECTIONS in
174792e95ad1Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
174892e95ad1Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
174992e95ad1Smrg    esac
175092e95ad1Smrgfi
175192e95ad1Smrgif test x$DRIVER_MAN_DIR = x    ; then
175292e95ad1Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
175392e95ad1Smrgfi
175411a95ff3Smrg
175592e95ad1Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
175692e95ad1Smrg    case $SYSV_MAN_SECTIONS in
175792e95ad1Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
175892e95ad1Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
175992e95ad1Smrg    esac
176092e95ad1Smrgfi
176192e95ad1Smrgif test x$ADMIN_MAN_DIR = x    ; then
176292e95ad1Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
176392e95ad1Smrgfi
176411a95ff3Smrg
176511a95ff3Smrg
176692e95ad1SmrgAC_SUBST([APP_MAN_SUFFIX])
176792e95ad1SmrgAC_SUBST([LIB_MAN_SUFFIX])
176892e95ad1SmrgAC_SUBST([FILE_MAN_SUFFIX])
176992e95ad1SmrgAC_SUBST([MISC_MAN_SUFFIX])
177092e95ad1SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
177192e95ad1SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
177292e95ad1SmrgAC_SUBST([APP_MAN_DIR])
177392e95ad1SmrgAC_SUBST([LIB_MAN_DIR])
177492e95ad1SmrgAC_SUBST([FILE_MAN_DIR])
177592e95ad1SmrgAC_SUBST([MISC_MAN_DIR])
177692e95ad1SmrgAC_SUBST([DRIVER_MAN_DIR])
177792e95ad1SmrgAC_SUBST([ADMIN_MAN_DIR])
177811a95ff3Smrg
177992e95ad1SmrgXORG_MAN_PAGE="X Version 11"
178092e95ad1SmrgAC_SUBST([XORG_MAN_PAGE])
178192e95ad1SmrgMAN_SUBSTS="\
178292e95ad1Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
178392e95ad1Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
178492e95ad1Smrg	-e 's|__xservername__|Xorg|g' \
178592e95ad1Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
178692e95ad1Smrg	-e 's|__projectroot__|\$(prefix)|g' \
178792e95ad1Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
178892e95ad1Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
178992e95ad1Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
179092e95ad1Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
179192e95ad1Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
179292e95ad1Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
179392e95ad1Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
179492e95ad1SmrgAC_SUBST([MAN_SUBSTS])
179511a95ff3Smrg
179692e95ad1Smrg]) # XORG_MANPAGE_SECTIONS
179711a95ff3Smrg
179892e95ad1Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
179992e95ad1Smrg# ------------------------
180092e95ad1Smrg# Minimum version: 1.7.0
18011e5fa1c5Smrg#
180292e95ad1Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
180392e95ad1Smrg# provided by xorg-sgml-doctools, if installed.
180492e95ad1SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
180592e95ad1SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
180692e95ad1SmrgXORG_SGML_PATH=
180792e95ad1SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
180892e95ad1Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
180992e95ad1Smrg    [m4_ifval([$1],[:],
181092e95ad1Smrg        [if test x"$cross_compiling" != x"yes" ; then
181192e95ad1Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
181292e95ad1Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
181392e95ad1Smrg         fi])
181492e95ad1Smrg    ])
181592e95ad1Smrg
181692e95ad1Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
181792e95ad1Smrg# the path and the name of the doc stylesheet
181892e95ad1Smrgif test "x$XORG_SGML_PATH" != "x" ; then
181992e95ad1Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
182092e95ad1Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
182192e95ad1Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
182292e95ad1Smrgelse
182392e95ad1Smrg   AC_MSG_RESULT([no])
182492e95ad1Smrgfi
182592e95ad1Smrg
182692e95ad1SmrgAC_SUBST(XORG_SGML_PATH)
182792e95ad1SmrgAC_SUBST(STYLESHEET_SRCDIR)
182892e95ad1SmrgAC_SUBST(XSL_STYLESHEET)
182992e95ad1SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
183092e95ad1Smrg]) # XORG_CHECK_SGML_DOCTOOLS
183192e95ad1Smrg
183292e95ad1Smrg# XORG_CHECK_LINUXDOC
183392e95ad1Smrg# -------------------
183492e95ad1Smrg# Minimum version: 1.0.0
18351e5fa1c5Smrg#
183692e95ad1Smrg# Defines the variable MAKE_TEXT if the necessary tools and
183792e95ad1Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
183892e95ad1Smrg# Whether or not the necessary tools and files are found can be checked
183992e95ad1Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
184092e95ad1SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
184192e95ad1SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
184292e95ad1SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
18431e5fa1c5Smrg
184492e95ad1SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
184511a95ff3Smrg
184692e95ad1SmrgAC_MSG_CHECKING([whether to build documentation])
184792e95ad1Smrg
184892e95ad1Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
184992e95ad1Smrg   BUILDDOC=yes
18501e5fa1c5Smrgelse
185192e95ad1Smrg   BUILDDOC=no
18521e5fa1c5Smrgfi
18531e5fa1c5Smrg
185492e95ad1SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
18551e5fa1c5Smrg
185692e95ad1SmrgAC_MSG_RESULT([$BUILDDOC])
1857b91640d3Smrg
185892e95ad1SmrgAC_MSG_CHECKING([whether to build pdf documentation])
185992e95ad1Smrg
186092e95ad1Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
186192e95ad1Smrg   BUILDPDFDOC=yes
186292e95ad1Smrgelse
186392e95ad1Smrg   BUILDPDFDOC=no
186492e95ad1Smrgfi
186592e95ad1Smrg
186692e95ad1SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
186792e95ad1Smrg
186892e95ad1SmrgAC_MSG_RESULT([$BUILDPDFDOC])
186992e95ad1Smrg
187092e95ad1SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
187192e95ad1SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
187292e95ad1SmrgMAKE_PDF="$PS2PDF"
187392e95ad1SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
187492e95ad1Smrg
187592e95ad1SmrgAC_SUBST(MAKE_TEXT)
187692e95ad1SmrgAC_SUBST(MAKE_PS)
187792e95ad1SmrgAC_SUBST(MAKE_PDF)
187892e95ad1SmrgAC_SUBST(MAKE_HTML)
187992e95ad1Smrg]) # XORG_CHECK_LINUXDOC
188092e95ad1Smrg
188192e95ad1Smrg# XORG_CHECK_DOCBOOK
188292e95ad1Smrg# -------------------
188392e95ad1Smrg# Minimum version: 1.0.0
188492e95ad1Smrg#
188592e95ad1Smrg# Checks for the ability to build output formats from SGML DocBook source.
188692e95ad1Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
188792e95ad1Smrg# indicates whether the necessary tools and files are found and, if set,
188892e95ad1Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
188992e95ad1SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
189092e95ad1SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
189192e95ad1Smrg
189292e95ad1SmrgBUILDTXTDOC=no
189392e95ad1SmrgBUILDPDFDOC=no
189492e95ad1SmrgBUILDPSDOC=no
189592e95ad1SmrgBUILDHTMLDOC=no
189692e95ad1Smrg
189792e95ad1SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
189892e95ad1SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
189992e95ad1SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
190092e95ad1SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
190111a95ff3Smrg
190292e95ad1SmrgAC_MSG_CHECKING([whether to build text documentation])
190392e95ad1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
190492e95ad1Smrg   test x$BUILD_TXTDOC != xno; then
190592e95ad1Smrg	BUILDTXTDOC=yes
190692e95ad1Smrgfi
190792e95ad1SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
190892e95ad1SmrgAC_MSG_RESULT([$BUILDTXTDOC])
190911a95ff3Smrg
191092e95ad1SmrgAC_MSG_CHECKING([whether to build PDF documentation])
191192e95ad1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
191292e95ad1Smrg   test x$BUILD_PDFDOC != xno; then
191392e95ad1Smrg	BUILDPDFDOC=yes
191492e95ad1Smrgfi
191592e95ad1SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
191692e95ad1SmrgAC_MSG_RESULT([$BUILDPDFDOC])
191711a95ff3Smrg
191892e95ad1SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
191992e95ad1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
192092e95ad1Smrg   test x$BUILD_PSDOC != xno; then
192192e95ad1Smrg	BUILDPSDOC=yes
1922b91640d3Smrgfi
192392e95ad1SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
192492e95ad1SmrgAC_MSG_RESULT([$BUILDPSDOC])
1925b91640d3Smrg
192692e95ad1SmrgAC_MSG_CHECKING([whether to build HTML documentation])
192792e95ad1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
192892e95ad1Smrg   test x$BUILD_HTMLDOC != xno; then
192992e95ad1Smrg	BUILDHTMLDOC=yes
193092e95ad1Smrgfi
193192e95ad1SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
193292e95ad1SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
19331e5fa1c5Smrg
193492e95ad1SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
193592e95ad1SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
193692e95ad1SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
193792e95ad1SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
193892e95ad1Smrg
193992e95ad1SmrgAC_SUBST(MAKE_TEXT)
194092e95ad1SmrgAC_SUBST(MAKE_PS)
194192e95ad1SmrgAC_SUBST(MAKE_PDF)
194292e95ad1SmrgAC_SUBST(MAKE_HTML)
194392e95ad1Smrg]) # XORG_CHECK_DOCBOOK
194492e95ad1Smrg
194592e95ad1Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
194692e95ad1Smrg# ----------------
194792e95ad1Smrg# Minimum version: 1.5.0
194892e95ad1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19491e5fa1c5Smrg#
195092e95ad1Smrg# Documentation tools are not always available on all platforms and sometimes
195192e95ad1Smrg# not at the appropriate level. This macro enables a module to test for the
195292e95ad1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1953838f5b0bSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
195492e95ad1Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
195592e95ad1Smrg# --with-xmlto assumes 'auto'.
1956a097bd00Smrg#
195792e95ad1Smrg# Interface to module:
195892e95ad1Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
195992e95ad1Smrg# XMLTO:	returns the path of the xmlto program found
196092e95ad1Smrg#		returns the path set by the user in the environment
196192e95ad1Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
196292e95ad1Smrg#		'no' user instructs the module not to use xmlto
19631e5fa1c5Smrg#
196492e95ad1Smrg# Added in version 1.10.0
196592e95ad1Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
196692e95ad1Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
19671e5fa1c5Smrg#
196892e95ad1Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
19691e5fa1c5Smrg#
197092e95ad1SmrgAC_DEFUN([XORG_WITH_XMLTO],[
197192e95ad1SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
197292e95ad1Smrgm4_define([_defopt], m4_default([$2], [auto]))
197392e95ad1SmrgAC_ARG_WITH(xmlto,
197492e95ad1Smrg	AS_HELP_STRING([--with-xmlto],
197592e95ad1Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
197692e95ad1Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
197792e95ad1Smrgm4_undefine([_defopt])
19781e5fa1c5Smrg
197992e95ad1Smrgif test "x$use_xmlto" = x"auto"; then
198092e95ad1Smrg   AC_PATH_PROG([XMLTO], [xmlto])
198192e95ad1Smrg   if test "x$XMLTO" = "x"; then
198292e95ad1Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
198392e95ad1Smrg	have_xmlto=no
198492e95ad1Smrg   else
198592e95ad1Smrg        have_xmlto=yes
198692e95ad1Smrg   fi
198792e95ad1Smrgelif test "x$use_xmlto" = x"yes" ; then
198892e95ad1Smrg   AC_PATH_PROG([XMLTO], [xmlto])
198992e95ad1Smrg   if test "x$XMLTO" = "x"; then
199092e95ad1Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
199192e95ad1Smrg   fi
199292e95ad1Smrg   have_xmlto=yes
199392e95ad1Smrgelif test "x$use_xmlto" = x"no" ; then
199492e95ad1Smrg   if test "x$XMLTO" != "x"; then
199592e95ad1Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
199692e95ad1Smrg   fi
199792e95ad1Smrg   have_xmlto=no
199892e95ad1Smrgelse
199992e95ad1Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
200092e95ad1Smrgfi
2001a097bd00Smrg
200292e95ad1Smrg# Test for a minimum version of xmlto, if provided.
200392e95ad1Smrgm4_ifval([$1],
200492e95ad1Smrg[if test "$have_xmlto" = yes; then
200592e95ad1Smrg    # scrape the xmlto version
200692e95ad1Smrg    AC_MSG_CHECKING([the xmlto version])
200792e95ad1Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
200892e95ad1Smrg    AC_MSG_RESULT([$xmlto_version])
200992e95ad1Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
201092e95ad1Smrg        [if test "x$use_xmlto" = xauto; then
201192e95ad1Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
201292e95ad1Smrg            have_xmlto=no
201392e95ad1Smrg        else
201492e95ad1Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
201592e95ad1Smrg        fi])
201692e95ad1Smrgfi])
2017a097bd00Smrg
201892e95ad1Smrg# Test for the ability of xmlto to generate a text target
201992e95ad1Smrg#
202092e95ad1Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
202192e95ad1Smrg# following test for empty XML docbook files.
202292e95ad1Smrg# For compatibility reasons use the following empty XML docbook file and if
202392e95ad1Smrg# it fails try it again with a non-empty XML file.
202492e95ad1Smrghave_xmlto_text=no
202592e95ad1Smrgcat > conftest.xml << "EOF"
202692e95ad1SmrgEOF
202792e95ad1SmrgAS_IF([test "$have_xmlto" = yes],
202892e95ad1Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
202992e95ad1Smrg             [have_xmlto_text=yes],
203092e95ad1Smrg             [# Try it again with a non-empty XML file.
203192e95ad1Smrg              cat > conftest.xml << "EOF"
203292e95ad1Smrg<x></x>
203392e95ad1SmrgEOF
203492e95ad1Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
203592e95ad1Smrg                    [have_xmlto_text=yes],
203692e95ad1Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
203792e95ad1Smrgrm -f conftest.xml
203892e95ad1SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
203992e95ad1SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
204092e95ad1Smrg]) # XORG_WITH_XMLTO
2041a097bd00Smrg
204292e95ad1Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
204392e95ad1Smrg# --------------------------------------------
204492e95ad1Smrg# Minimum version: 1.12.0
204592e95ad1Smrg# Minimum version for optional DEFAULT argument: 1.12.0
204692e95ad1Smrg#
204792e95ad1Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
204892e95ad1Smrg# XML-based language used for the transformation of XML documents.
204992e95ad1Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
205092e95ad1Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
205192e95ad1Smrg# The XSLT processor is often used as a standalone tool for transformations.
205292e95ad1Smrg# It should not be assumed that this tool is used only to work with documnetation.
205392e95ad1Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
205492e95ad1Smrg#
205592e95ad1Smrg# Interface to module:
205692e95ad1Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
205792e95ad1Smrg# XSLTPROC:	 returns the path of the xsltproc program found
205892e95ad1Smrg#		 returns the path set by the user in the environment
205992e95ad1Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
206092e95ad1Smrg#		  'no' user instructs the module not to use xsltproc
206192e95ad1Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
206292e95ad1Smrg#
206392e95ad1Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
206492e95ad1Smrg#
206592e95ad1SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
206692e95ad1SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
206792e95ad1Smrg# Preserves the interface, should it be implemented later
206892e95ad1Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
206992e95ad1Smrgm4_define([_defopt], m4_default([$2], [auto]))
207092e95ad1SmrgAC_ARG_WITH(xsltproc,
207192e95ad1Smrg	AS_HELP_STRING([--with-xsltproc],
207292e95ad1Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
207392e95ad1Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
207492e95ad1Smrgm4_undefine([_defopt])
20751e5fa1c5Smrg
207692e95ad1Smrgif test "x$use_xsltproc" = x"auto"; then
207792e95ad1Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
207892e95ad1Smrg   if test "x$XSLTPROC" = "x"; then
207992e95ad1Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
208092e95ad1Smrg	have_xsltproc=no
208192e95ad1Smrg   else
208292e95ad1Smrg        have_xsltproc=yes
208392e95ad1Smrg   fi
208492e95ad1Smrgelif test "x$use_xsltproc" = x"yes" ; then
208592e95ad1Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
208692e95ad1Smrg   if test "x$XSLTPROC" = "x"; then
208792e95ad1Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
208892e95ad1Smrg   fi
208992e95ad1Smrg   have_xsltproc=yes
209092e95ad1Smrgelif test "x$use_xsltproc" = x"no" ; then
209192e95ad1Smrg   if test "x$XSLTPROC" != "x"; then
209292e95ad1Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
209392e95ad1Smrg   fi
209492e95ad1Smrg   have_xsltproc=no
209592e95ad1Smrgelse
209692e95ad1Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
209711a95ff3Smrgfi
209811a95ff3Smrg
209992e95ad1SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
210092e95ad1Smrg]) # XORG_WITH_XSLTPROC
210192e95ad1Smrg
210292e95ad1Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
210392e95ad1Smrg# ----------------------------------------
210492e95ad1Smrg# Minimum version: 1.15.0
21051e5fa1c5Smrg#
210692e95ad1Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
210792e95ad1Smrg# scanning arbitrary text files, extracting information from those text files,
210892e95ad1Smrg# and printing reports based on that information.
21091e5fa1c5Smrg#
211092e95ad1Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
21111e5fa1c5Smrg#
211292e95ad1Smrg# Interface to module:
211392e95ad1Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
211492e95ad1Smrg# PERL:	     returns the path of the perl program found
211592e95ad1Smrg#	     returns the path set by the user in the environment
211692e95ad1Smrg# --with-perl: 'yes' user instructs the module to use perl
211792e95ad1Smrg#	       'no' user instructs the module not to use perl
211892e95ad1Smrg# have_perl: returns yes if perl found in PATH or no
21191e5fa1c5Smrg#
212092e95ad1Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
212192e95ad1Smrg#
212292e95ad1SmrgAC_DEFUN([XORG_WITH_PERL],[
212392e95ad1SmrgAC_ARG_VAR([PERL], [Path to perl command])
212492e95ad1Smrg# Preserves the interface, should it be implemented later
212592e95ad1Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
212692e95ad1Smrgm4_define([_defopt], m4_default([$2], [auto]))
212792e95ad1SmrgAC_ARG_WITH(perl,
212892e95ad1Smrg	AS_HELP_STRING([--with-perl],
212992e95ad1Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
213092e95ad1Smrg	   [use_perl=$withval], [use_perl=]_defopt)
213192e95ad1Smrgm4_undefine([_defopt])
21321e5fa1c5Smrg
213392e95ad1Smrgif test "x$use_perl" = x"auto"; then
213492e95ad1Smrg   AC_PATH_PROG([PERL], [perl])
213592e95ad1Smrg   if test "x$PERL" = "x"; then
213692e95ad1Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
213792e95ad1Smrg	have_perl=no
213892e95ad1Smrg   else
213992e95ad1Smrg        have_perl=yes
214092e95ad1Smrg   fi
214192e95ad1Smrgelif test "x$use_perl" = x"yes" ; then
214292e95ad1Smrg   AC_PATH_PROG([PERL], [perl])
214392e95ad1Smrg   if test "x$PERL" = "x"; then
214492e95ad1Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
214592e95ad1Smrg   fi
214692e95ad1Smrg   have_perl=yes
214792e95ad1Smrgelif test "x$use_perl" = x"no" ; then
214892e95ad1Smrg   if test "x$PERL" != "x"; then
214992e95ad1Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
215092e95ad1Smrg   fi
215192e95ad1Smrg   have_perl=no
215292e95ad1Smrgelse
215392e95ad1Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
215492e95ad1Smrgfi
2155a097bd00Smrg
215692e95ad1SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
215792e95ad1Smrg]) # XORG_WITH_PERL
21581e5fa1c5Smrg
215992e95ad1Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
216011a95ff3Smrg# ----------------
216192e95ad1Smrg# Minimum version: 1.5.0
216292e95ad1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2163b91640d3Smrg#
216492e95ad1Smrg# Documentation tools are not always available on all platforms and sometimes
216592e95ad1Smrg# not at the appropriate level. This macro enables a module to test for the
216692e95ad1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2167838f5b0bSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
216892e95ad1Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
216992e95ad1Smrg# --with-asciidoc assumes 'auto'.
2170b91640d3Smrg#
217192e95ad1Smrg# Interface to module:
217292e95ad1Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
217392e95ad1Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
217492e95ad1Smrg#		 returns the path set by the user in the environment
217592e95ad1Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
217692e95ad1Smrg#		  'no' user instructs the module not to use asciidoc
2177b91640d3Smrg#
217892e95ad1Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
21791e5fa1c5Smrg#
218092e95ad1SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
218192e95ad1SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
218292e95ad1Smrgm4_define([_defopt], m4_default([$2], [auto]))
218392e95ad1SmrgAC_ARG_WITH(asciidoc,
218492e95ad1Smrg	AS_HELP_STRING([--with-asciidoc],
218592e95ad1Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
218692e95ad1Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
218792e95ad1Smrgm4_undefine([_defopt])
218811a95ff3Smrg
218992e95ad1Smrgif test "x$use_asciidoc" = x"auto"; then
219092e95ad1Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
219192e95ad1Smrg   if test "x$ASCIIDOC" = "x"; then
219292e95ad1Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
219392e95ad1Smrg	have_asciidoc=no
219492e95ad1Smrg   else
219592e95ad1Smrg        have_asciidoc=yes
219692e95ad1Smrg   fi
219792e95ad1Smrgelif test "x$use_asciidoc" = x"yes" ; then
219892e95ad1Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
219992e95ad1Smrg   if test "x$ASCIIDOC" = "x"; then
220092e95ad1Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
220192e95ad1Smrg   fi
220292e95ad1Smrg   have_asciidoc=yes
220392e95ad1Smrgelif test "x$use_asciidoc" = x"no" ; then
220492e95ad1Smrg   if test "x$ASCIIDOC" != "x"; then
220592e95ad1Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
220692e95ad1Smrg   fi
220792e95ad1Smrg   have_asciidoc=no
220892e95ad1Smrgelse
220992e95ad1Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
221092e95ad1Smrgfi
221192e95ad1Smrgm4_ifval([$1],
221292e95ad1Smrg[if test "$have_asciidoc" = yes; then
221392e95ad1Smrg    # scrape the asciidoc version
221492e95ad1Smrg    AC_MSG_CHECKING([the asciidoc version])
221592e95ad1Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
221692e95ad1Smrg    AC_MSG_RESULT([$asciidoc_version])
221792e95ad1Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
221892e95ad1Smrg        [if test "x$use_asciidoc" = xauto; then
221992e95ad1Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
222092e95ad1Smrg            have_asciidoc=no
222192e95ad1Smrg        else
222292e95ad1Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
222392e95ad1Smrg        fi])
222492e95ad1Smrgfi])
222592e95ad1SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
222692e95ad1Smrg]) # XORG_WITH_ASCIIDOC
222711a95ff3Smrg
222892e95ad1Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
222992e95ad1Smrg# -------------------------------------------
223092e95ad1Smrg# Minimum version: 1.5.0
223192e95ad1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
223292e95ad1Smrg# Minimum version for optional DOT checking: 1.18.0
22331e5fa1c5Smrg#
223492e95ad1Smrg# Documentation tools are not always available on all platforms and sometimes
223592e95ad1Smrg# not at the appropriate level. This macro enables a module to test for the
223692e95ad1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2237838f5b0bSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
223892e95ad1Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
223992e95ad1Smrg# --with-doxygen assumes 'auto'.
22401e5fa1c5Smrg#
224192e95ad1Smrg# Interface to module:
224292e95ad1Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
224392e95ad1Smrg# DOXYGEN:	 returns the path of the doxygen program found
224492e95ad1Smrg#		 returns the path set by the user in the environment
224592e95ad1Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
224692e95ad1Smrg#		  'no' user instructs the module not to use doxygen
22471e5fa1c5Smrg#
224892e95ad1Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
22491e5fa1c5Smrg#
225092e95ad1SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
225192e95ad1SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
225292e95ad1SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
225392e95ad1Smrgm4_define([_defopt], m4_default([$2], [auto]))
225492e95ad1SmrgAC_ARG_WITH(doxygen,
225592e95ad1Smrg	AS_HELP_STRING([--with-doxygen],
225692e95ad1Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
225792e95ad1Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
225892e95ad1Smrgm4_undefine([_defopt])
225911a95ff3Smrg
226092e95ad1Smrgif test "x$use_doxygen" = x"auto"; then
226192e95ad1Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
226292e95ad1Smrg   if test "x$DOXYGEN" = "x"; then
226392e95ad1Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
226492e95ad1Smrg	have_doxygen=no
226592e95ad1Smrg   else
226692e95ad1Smrg        have_doxygen=yes
226792e95ad1Smrg   fi
226892e95ad1Smrgelif test "x$use_doxygen" = x"yes" ; then
226992e95ad1Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
227092e95ad1Smrg   if test "x$DOXYGEN" = "x"; then
227192e95ad1Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
227292e95ad1Smrg   fi
227392e95ad1Smrg   have_doxygen=yes
227492e95ad1Smrgelif test "x$use_doxygen" = x"no" ; then
227592e95ad1Smrg   if test "x$DOXYGEN" != "x"; then
227692e95ad1Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
227792e95ad1Smrg   fi
227892e95ad1Smrg   have_doxygen=no
227911a95ff3Smrgelse
228092e95ad1Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
228111a95ff3Smrgfi
228292e95ad1Smrgm4_ifval([$1],
228392e95ad1Smrg[if test "$have_doxygen" = yes; then
228492e95ad1Smrg    # scrape the doxygen version
228592e95ad1Smrg    AC_MSG_CHECKING([the doxygen version])
228692e95ad1Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
228792e95ad1Smrg    AC_MSG_RESULT([$doxygen_version])
228892e95ad1Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
228992e95ad1Smrg        [if test "x$use_doxygen" = xauto; then
229092e95ad1Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
229192e95ad1Smrg            have_doxygen=no
229292e95ad1Smrg        else
229392e95ad1Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
229492e95ad1Smrg        fi])
229592e95ad1Smrgfi])
229611a95ff3Smrg
229792e95ad1Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
229892e95ad1Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
229992e95ad1Smrgdnl 	HAVE_DOT = @HAVE_DOT@
230092e95ad1SmrgHAVE_DOT=no
230192e95ad1Smrgif test "x$have_doxygen" = "xyes"; then
230292e95ad1Smrg  AC_PATH_PROG([DOT], [dot])
230392e95ad1Smrg    if test "x$DOT" != "x"; then
230492e95ad1Smrg      HAVE_DOT=yes
230592e95ad1Smrg    fi
230692e95ad1Smrgfi
230711a95ff3Smrg
230892e95ad1SmrgAC_SUBST([HAVE_DOT])
230992e95ad1SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
231092e95ad1SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
231192e95ad1Smrg]) # XORG_WITH_DOXYGEN
231211a95ff3Smrg
231392e95ad1Smrg# XORG_WITH_GROFF([DEFAULT])
231492e95ad1Smrg# ----------------
231592e95ad1Smrg# Minimum version: 1.6.0
231692e95ad1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23171e5fa1c5Smrg#
231892e95ad1Smrg# Documentation tools are not always available on all platforms and sometimes
231992e95ad1Smrg# not at the appropriate level. This macro enables a module to test for the
232092e95ad1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2321838f5b0bSmrg# the --with-groff option, it allows maximum flexibility in making decisions
232292e95ad1Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
232392e95ad1Smrg# --with-groff assumes 'auto'.
232492e95ad1Smrg#
232592e95ad1Smrg# Interface to module:
232692e95ad1Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
232792e95ad1Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
232892e95ad1Smrg# HAVE_GROFF_MS: the -ms macros package
232992e95ad1Smrg# GROFF:	 returns the path of the groff program found
233092e95ad1Smrg#		 returns the path set by the user in the environment
233192e95ad1Smrg# --with-groff:	 'yes' user instructs the module to use groff
233292e95ad1Smrg#		 'no' user instructs the module not to use groff
233392e95ad1Smrg#
233492e95ad1Smrg# Added in version 1.9.0:
233592e95ad1Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
233692e95ad1Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
233792e95ad1Smrg#		   psselect from the psutils package.
233892e95ad1Smrg#		   the ghostcript package. Refer to the grohtml man pages
233992e95ad1Smrg#
234092e95ad1Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
234192e95ad1Smrg#
234292e95ad1Smrg# OS and distros often splits groff in a basic and full package, the former
234392e95ad1Smrg# having the groff program and the later having devices, fonts and macros
234492e95ad1Smrg# Checking for the groff executable is not enough.
234592e95ad1Smrg#
234692e95ad1Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
234792e95ad1Smrg# unset HAVE_GROFF or GROFF env variables.
234892e95ad1Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
234992e95ad1Smrg#
235092e95ad1SmrgAC_DEFUN([XORG_WITH_GROFF],[
235192e95ad1SmrgAC_ARG_VAR([GROFF], [Path to groff command])
235292e95ad1Smrgm4_define([_defopt], m4_default([$1], [auto]))
235392e95ad1SmrgAC_ARG_WITH(groff,
235492e95ad1Smrg	AS_HELP_STRING([--with-groff],
235592e95ad1Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
235692e95ad1Smrg	   [use_groff=$withval], [use_groff=]_defopt)
235792e95ad1Smrgm4_undefine([_defopt])
235811a95ff3Smrg
235992e95ad1Smrgif test "x$use_groff" = x"auto"; then
236092e95ad1Smrg   AC_PATH_PROG([GROFF], [groff])
236192e95ad1Smrg   if test "x$GROFF" = "x"; then
236292e95ad1Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
236392e95ad1Smrg	have_groff=no
236492e95ad1Smrg   else
236592e95ad1Smrg        have_groff=yes
236692e95ad1Smrg   fi
236792e95ad1Smrgelif test "x$use_groff" = x"yes" ; then
236892e95ad1Smrg   AC_PATH_PROG([GROFF], [groff])
236992e95ad1Smrg   if test "x$GROFF" = "x"; then
237092e95ad1Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
237192e95ad1Smrg   fi
237292e95ad1Smrg   have_groff=yes
237392e95ad1Smrgelif test "x$use_groff" = x"no" ; then
237492e95ad1Smrg   if test "x$GROFF" != "x"; then
237592e95ad1Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
237692e95ad1Smrg   fi
237792e95ad1Smrg   have_groff=no
237892e95ad1Smrgelse
237992e95ad1Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
238092e95ad1Smrgfi
238111a95ff3Smrg
238292e95ad1Smrg# We have groff, test for the presence of the macro packages
238392e95ad1Smrgif test "x$have_groff" = x"yes"; then
238492e95ad1Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
238592e95ad1Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
238692e95ad1Smrg        groff_ms_works=yes
238792e95ad1Smrg    else
238892e95ad1Smrg        groff_ms_works=no
238911a95ff3Smrg    fi
239092e95ad1Smrg    AC_MSG_RESULT([$groff_ms_works])
239192e95ad1Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
239292e95ad1Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
239392e95ad1Smrg        groff_mm_works=yes
239492e95ad1Smrg    else
239592e95ad1Smrg        groff_mm_works=no
239692e95ad1Smrg    fi
239792e95ad1Smrg    AC_MSG_RESULT([$groff_mm_works])
239892e95ad1Smrgfi
239911a95ff3Smrg
240092e95ad1Smrg# We have groff, test for HTML dependencies, one command per package
240192e95ad1Smrgif test "x$have_groff" = x"yes"; then
240292e95ad1Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
240392e95ad1Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
240492e95ad1Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
240592e95ad1Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
240692e95ad1Smrg      have_groff_html=yes
240792e95ad1Smrg   else
240892e95ad1Smrg      have_groff_html=no
240992e95ad1Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
241092e95ad1Smrg   fi
241192e95ad1Smrgfi
241292e95ad1Smrg
241392e95ad1Smrg# Set Automake conditionals for Makefiles
241492e95ad1SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
241592e95ad1SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
241692e95ad1SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
241792e95ad1SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
241892e95ad1Smrg]) # XORG_WITH_GROFF
241992e95ad1Smrg
242092e95ad1Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
242192e95ad1Smrg# ---------------------------------------
242292e95ad1Smrg# Minimum version: 1.6.0
242392e95ad1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
242492e95ad1Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
242592e95ad1Smrg#
242692e95ad1Smrg# Documentation tools are not always available on all platforms and sometimes
242792e95ad1Smrg# not at the appropriate level. This macro enables a module to test for the
242892e95ad1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2429838f5b0bSmrg# the --with-fop option, it allows maximum flexibility in making decisions
243092e95ad1Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
243192e95ad1Smrg# --with-fop assumes 'auto'.
243292e95ad1Smrg#
243392e95ad1Smrg# Interface to module:
243492e95ad1Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
243592e95ad1Smrg# FOP:	 	returns the path of the fop program found
243692e95ad1Smrg#		returns the path set by the user in the environment
243792e95ad1Smrg# --with-fop: 	'yes' user instructs the module to use fop
243892e95ad1Smrg#		'no' user instructs the module not to use fop
243992e95ad1Smrg#
244092e95ad1Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
244192e95ad1Smrg#
244292e95ad1SmrgAC_DEFUN([XORG_WITH_FOP],[
244392e95ad1SmrgAC_ARG_VAR([FOP], [Path to fop command])
244492e95ad1Smrgm4_define([_defopt], m4_default([$2], [auto]))
244592e95ad1SmrgAC_ARG_WITH(fop,
244692e95ad1Smrg	AS_HELP_STRING([--with-fop],
244792e95ad1Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
244892e95ad1Smrg	   [use_fop=$withval], [use_fop=]_defopt)
244992e95ad1Smrgm4_undefine([_defopt])
245092e95ad1Smrg
245192e95ad1Smrgif test "x$use_fop" = x"auto"; then
245292e95ad1Smrg   AC_PATH_PROG([FOP], [fop])
245392e95ad1Smrg   if test "x$FOP" = "x"; then
245492e95ad1Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
245592e95ad1Smrg	have_fop=no
245692e95ad1Smrg   else
245792e95ad1Smrg        have_fop=yes
245892e95ad1Smrg   fi
245992e95ad1Smrgelif test "x$use_fop" = x"yes" ; then
246092e95ad1Smrg   AC_PATH_PROG([FOP], [fop])
246192e95ad1Smrg   if test "x$FOP" = "x"; then
246292e95ad1Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
246392e95ad1Smrg   fi
246492e95ad1Smrg   have_fop=yes
246592e95ad1Smrgelif test "x$use_fop" = x"no" ; then
246692e95ad1Smrg   if test "x$FOP" != "x"; then
246792e95ad1Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
246892e95ad1Smrg   fi
246992e95ad1Smrg   have_fop=no
247011a95ff3Smrgelse
247192e95ad1Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
247211a95ff3Smrgfi
247311a95ff3Smrg
247492e95ad1Smrg# Test for a minimum version of fop, if provided.
247592e95ad1Smrgm4_ifval([$1],
247692e95ad1Smrg[if test "$have_fop" = yes; then
247792e95ad1Smrg    # scrape the fop version
247892e95ad1Smrg    AC_MSG_CHECKING([for fop minimum version])
247992e95ad1Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
248092e95ad1Smrg    AC_MSG_RESULT([$fop_version])
248192e95ad1Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
248292e95ad1Smrg        [if test "x$use_fop" = xauto; then
248392e95ad1Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
248492e95ad1Smrg            have_fop=no
248592e95ad1Smrg        else
248692e95ad1Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
248792e95ad1Smrg        fi])
248892e95ad1Smrgfi])
248992e95ad1SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
249092e95ad1Smrg]) # XORG_WITH_FOP
249192e95ad1Smrg
249292e95ad1Smrg# XORG_WITH_M4([MIN-VERSION])
249392e95ad1Smrg# ---------------------------
249492e95ad1Smrg# Minimum version: 1.19.0
249592e95ad1Smrg#
249692e95ad1Smrg# This macro attempts to locate an m4 macro processor which supports
249792e95ad1Smrg# -I option and is only useful for modules relying on M4 in order to
249892e95ad1Smrg# expand macros in source code files.
249992e95ad1Smrg#
250092e95ad1Smrg# Interface to module:
250192e95ad1Smrg# M4:	 	returns the path of the m4 program found
250292e95ad1Smrg#		returns the path set by the user in the environment
250392e95ad1Smrg#
250492e95ad1SmrgAC_DEFUN([XORG_WITH_M4], [
250592e95ad1SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
250692e95ad1Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
250792e95ad1Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
250892e95ad1Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
250992e95ad1Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
251092e95ad1Smrg   [$PATH:/usr/gnu/bin])])
251111a95ff3Smrg
251292e95ad1SmrgAC_SUBST([M4], [$ac_cv_path_M4])
251392e95ad1Smrg]) # XORG_WITH_M4
251411a95ff3Smrg
251592e95ad1Smrg# XORG_WITH_PS2PDF([DEFAULT])
251692e95ad1Smrg# ----------------
251792e95ad1Smrg# Minimum version: 1.6.0
251892e95ad1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
251992e95ad1Smrg#
252092e95ad1Smrg# Documentation tools are not always available on all platforms and sometimes
252192e95ad1Smrg# not at the appropriate level. This macro enables a module to test for the
252292e95ad1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2523838f5b0bSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
252492e95ad1Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
252592e95ad1Smrg# --with-ps2pdf assumes 'auto'.
252692e95ad1Smrg#
252792e95ad1Smrg# Interface to module:
252892e95ad1Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
252992e95ad1Smrg# PS2PDF:	returns the path of the ps2pdf program found
253092e95ad1Smrg#		returns the path set by the user in the environment
253192e95ad1Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
253292e95ad1Smrg#		 'no' user instructs the module not to use ps2pdf
253392e95ad1Smrg#
253492e95ad1Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
253592e95ad1Smrg#
253692e95ad1SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
253792e95ad1SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
253892e95ad1Smrgm4_define([_defopt], m4_default([$1], [auto]))
253992e95ad1SmrgAC_ARG_WITH(ps2pdf,
254092e95ad1Smrg	AS_HELP_STRING([--with-ps2pdf],
254192e95ad1Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
254292e95ad1Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
254392e95ad1Smrgm4_undefine([_defopt])
254411a95ff3Smrg
254592e95ad1Smrgif test "x$use_ps2pdf" = x"auto"; then
254692e95ad1Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
254792e95ad1Smrg   if test "x$PS2PDF" = "x"; then
254892e95ad1Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
254992e95ad1Smrg	have_ps2pdf=no
255092e95ad1Smrg   else
255192e95ad1Smrg        have_ps2pdf=yes
255292e95ad1Smrg   fi
255392e95ad1Smrgelif test "x$use_ps2pdf" = x"yes" ; then
255492e95ad1Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
255592e95ad1Smrg   if test "x$PS2PDF" = "x"; then
255692e95ad1Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
255792e95ad1Smrg   fi
255892e95ad1Smrg   have_ps2pdf=yes
255992e95ad1Smrgelif test "x$use_ps2pdf" = x"no" ; then
256092e95ad1Smrg   if test "x$PS2PDF" != "x"; then
256192e95ad1Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
256292e95ad1Smrg   fi
256392e95ad1Smrg   have_ps2pdf=no
256492e95ad1Smrgelse
256592e95ad1Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
256611a95ff3Smrgfi
256792e95ad1SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
256892e95ad1Smrg]) # XORG_WITH_PS2PDF
25691e5fa1c5Smrg
257092e95ad1Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
257192e95ad1Smrg# ----------------
257292e95ad1Smrg# Minimum version: 1.6.0
2573a097bd00Smrg#
257492e95ad1Smrg# Documentation tools are not always available on all platforms and sometimes
257592e95ad1Smrg# not at the appropriate level. This macro enables a builder to skip all
257692e95ad1Smrg# documentation targets except traditional man pages.
257792e95ad1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2578838f5b0bSmrg# maximum flexibility in controlling documentation building.
257992e95ad1Smrg# Refer to:
258092e95ad1Smrg# XORG_WITH_XMLTO         --with-xmlto
258192e95ad1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
258292e95ad1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
258392e95ad1Smrg# XORG_WITH_FOP           --with-fop
258492e95ad1Smrg# XORG_WITH_GROFF         --with-groff
258592e95ad1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
258692e95ad1Smrg#
258792e95ad1Smrg# Interface to module:
258892e95ad1Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
258992e95ad1Smrg# --enable-docs: 'yes' user instructs the module to generate docs
259092e95ad1Smrg#		 'no' user instructs the module not to generate docs
259192e95ad1Smrg# parm1:	specify the default value, yes or no.
259292e95ad1Smrg#
259392e95ad1SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
259492e95ad1Smrgm4_define([docs_default], m4_default([$1], [yes]))
259592e95ad1SmrgAC_ARG_ENABLE(docs,
259692e95ad1Smrg	AS_HELP_STRING([--enable-docs],
259792e95ad1Smrg	   [Enable building the documentation (default: ]docs_default[)]),
259892e95ad1Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
259992e95ad1Smrgm4_undefine([docs_default])
260092e95ad1SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
260192e95ad1SmrgAC_MSG_CHECKING([whether to build documentation])
260292e95ad1SmrgAC_MSG_RESULT([$build_docs])
260392e95ad1Smrg]) # XORG_ENABLE_DOCS
2604a097bd00Smrg
260592e95ad1Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
260692e95ad1Smrg# ----------------
260792e95ad1Smrg# Minimum version: 1.6.0
260892e95ad1Smrg#
260992e95ad1Smrg# This macro enables a builder to skip all developer documentation.
261092e95ad1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2611838f5b0bSmrg# maximum flexibility in controlling documentation building.
261292e95ad1Smrg# Refer to:
261392e95ad1Smrg# XORG_WITH_XMLTO         --with-xmlto
261492e95ad1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
261592e95ad1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
261692e95ad1Smrg# XORG_WITH_FOP           --with-fop
261792e95ad1Smrg# XORG_WITH_GROFF         --with-groff
261892e95ad1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
261992e95ad1Smrg#
262092e95ad1Smrg# Interface to module:
262192e95ad1Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
262292e95ad1Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
262392e95ad1Smrg#			'no' user instructs the module not to generate developer docs
262492e95ad1Smrg# parm1:		specify the default value, yes or no.
262592e95ad1Smrg#
262692e95ad1SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
262792e95ad1Smrgm4_define([devel_default], m4_default([$1], [yes]))
262892e95ad1SmrgAC_ARG_ENABLE(devel-docs,
262992e95ad1Smrg	AS_HELP_STRING([--enable-devel-docs],
263092e95ad1Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
263192e95ad1Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
263292e95ad1Smrgm4_undefine([devel_default])
263392e95ad1SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
263492e95ad1SmrgAC_MSG_CHECKING([whether to build developer documentation])
263592e95ad1SmrgAC_MSG_RESULT([$build_devel_docs])
263692e95ad1Smrg]) # XORG_ENABLE_DEVEL_DOCS
263711a95ff3Smrg
263892e95ad1Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
263992e95ad1Smrg# ----------------
264092e95ad1Smrg# Minimum version: 1.6.0
264192e95ad1Smrg#
264292e95ad1Smrg# This macro enables a builder to skip all functional specification targets.
264392e95ad1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2644838f5b0bSmrg# maximum flexibility in controlling documentation building.
264592e95ad1Smrg# Refer to:
264692e95ad1Smrg# XORG_WITH_XMLTO         --with-xmlto
264792e95ad1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
264892e95ad1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
264992e95ad1Smrg# XORG_WITH_FOP           --with-fop
265092e95ad1Smrg# XORG_WITH_GROFF         --with-groff
265192e95ad1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
265292e95ad1Smrg#
265392e95ad1Smrg# Interface to module:
265492e95ad1Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
265592e95ad1Smrg# --enable-specs:	'yes' user instructs the module to generate specs
265692e95ad1Smrg#			'no' user instructs the module not to generate specs
265792e95ad1Smrg# parm1:		specify the default value, yes or no.
265892e95ad1Smrg#
265992e95ad1SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
266092e95ad1Smrgm4_define([spec_default], m4_default([$1], [yes]))
266192e95ad1SmrgAC_ARG_ENABLE(specs,
266292e95ad1Smrg	AS_HELP_STRING([--enable-specs],
266392e95ad1Smrg	   [Enable building the specs (default: ]spec_default[)]),
266492e95ad1Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
266592e95ad1Smrgm4_undefine([spec_default])
266692e95ad1SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
266792e95ad1SmrgAC_MSG_CHECKING([whether to build functional specifications])
266892e95ad1SmrgAC_MSG_RESULT([$build_specs])
266992e95ad1Smrg]) # XORG_ENABLE_SPECS
267011a95ff3Smrg
267192e95ad1Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
267292e95ad1Smrg# ----------------------------------------------
267392e95ad1Smrg# Minimum version: 1.13.0
2674a097bd00Smrg#
267592e95ad1Smrg# This macro enables a builder to enable/disable unit testing
267692e95ad1Smrg# It makes no assumption about the test cases implementation
267792e95ad1Smrg# Test cases may or may not use Automake "Support for test suites"
267892e95ad1Smrg# They may or may not use the software utility library GLib
267992e95ad1Smrg#
268092e95ad1Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
268192e95ad1Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
268292e95ad1Smrg# The variable enable_unit_tests is used by other macros in this file.
268392e95ad1Smrg#
268492e95ad1Smrg# Interface to module:
268592e95ad1Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
268692e95ad1Smrg# enable_unit_tests:    used in configure.ac for additional configuration
268792e95ad1Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
268892e95ad1Smrg#			'no' user instructs the module not to build tests
268992e95ad1Smrg# parm1:		specify the default value, yes or no.
269092e95ad1Smrg#
269192e95ad1SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
269292e95ad1SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
269392e95ad1SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
269492e95ad1SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
269592e95ad1Smrgm4_define([_defopt], m4_default([$1], [auto]))
269692e95ad1SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
269792e95ad1Smrg	[Enable building unit test cases (default: ]_defopt[)]),
269892e95ad1Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
269992e95ad1Smrgm4_undefine([_defopt])
270092e95ad1SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
270192e95ad1SmrgAC_MSG_CHECKING([whether to build unit test cases])
270292e95ad1SmrgAC_MSG_RESULT([$enable_unit_tests])
270392e95ad1Smrg]) # XORG_ENABLE_UNIT_TESTS
270411a95ff3Smrg
270592e95ad1Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
270692e95ad1Smrg# ------------------------------------------------------
270792e95ad1Smrg# Minimum version: 1.17.0
270892e95ad1Smrg#
270992e95ad1Smrg# This macro enables a builder to enable/disable integration testing
271092e95ad1Smrg# It makes no assumption about the test cases' implementation
271192e95ad1Smrg# Test cases may or may not use Automake "Support for test suites"
271292e95ad1Smrg#
271392e95ad1Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
271492e95ad1Smrg# usually requires less dependencies and may be built and run under less
271592e95ad1Smrg# stringent environments than integration tests.
271692e95ad1Smrg#
271792e95ad1Smrg# Interface to module:
271892e95ad1Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
271992e95ad1Smrg# enable_integration_tests:   used in configure.ac for additional configuration
272092e95ad1Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
272192e95ad1Smrg#                             'no' user instructs the module not to build tests
272292e95ad1Smrg# parm1:                      specify the default value, yes or no.
272392e95ad1Smrg#
272492e95ad1SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
272592e95ad1SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
272692e95ad1Smrgm4_define([_defopt], m4_default([$1], [auto]))
272792e95ad1SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
272892e95ad1Smrg	[Enable building integration test cases (default: ]_defopt[)]),
272992e95ad1Smrg	[enable_integration_tests=$enableval],
273092e95ad1Smrg	[enable_integration_tests=]_defopt)
273192e95ad1Smrgm4_undefine([_defopt])
273292e95ad1SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
273392e95ad1Smrg	[test "x$enable_integration_tests" != xno])
273492e95ad1SmrgAC_MSG_CHECKING([whether to build unit test cases])
273592e95ad1SmrgAC_MSG_RESULT([$enable_integration_tests])
273692e95ad1Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
273711a95ff3Smrg
273892e95ad1Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
273992e95ad1Smrg# ----------------------------------------
274092e95ad1Smrg# Minimum version: 1.13.0
274192e95ad1Smrg#
274292e95ad1Smrg# GLib is a library which provides advanced data structures and functions.
274392e95ad1Smrg# This macro enables a module to test for the presence of Glib.
274492e95ad1Smrg#
274592e95ad1Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
274692e95ad1Smrg# Otherwise the value of $enable_unit_tests is blank.
274792e95ad1Smrg#
274892e95ad1Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
274992e95ad1Smrg# test support usually requires less dependencies and may be built and run under
275092e95ad1Smrg# less stringent environments than integration tests.
2751a097bd00Smrg#
275292e95ad1Smrg# Interface to module:
275392e95ad1Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
275492e95ad1Smrg# with_glib: used in configure.ac to know if GLib has been found
275592e95ad1Smrg# --with-glib:	'yes' user instructs the module to use glib
275692e95ad1Smrg#		'no' user instructs the module not to use glib
275792e95ad1Smrg#
275892e95ad1SmrgAC_DEFUN([XORG_WITH_GLIB],[
275992e95ad1SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
276092e95ad1Smrgm4_define([_defopt], m4_default([$2], [auto]))
276192e95ad1SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
276292e95ad1Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
276392e95ad1Smrg	[with_glib=$withval], [with_glib=]_defopt)
276492e95ad1Smrgm4_undefine([_defopt])
2765a097bd00Smrg
276692e95ad1Smrghave_glib=no
276792e95ad1Smrg# Do not probe GLib if user explicitly disabled unit testing
276892e95ad1Smrgif test "x$enable_unit_tests" != x"no"; then
276992e95ad1Smrg  # Do not probe GLib if user explicitly disabled it
277092e95ad1Smrg  if test "x$with_glib" != x"no"; then
277192e95ad1Smrg    m4_ifval(
277292e95ad1Smrg      [$1],
277392e95ad1Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
277492e95ad1Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
277592e95ad1Smrg    )
2776a097bd00Smrg  fi
2777a097bd00Smrgfi
2778a097bd00Smrg
277992e95ad1Smrg# Not having GLib when unit testing has been explicitly requested is an error
278092e95ad1Smrgif test "x$enable_unit_tests" = x"yes"; then
278192e95ad1Smrg  if test "x$have_glib" = x"no"; then
278292e95ad1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2783a097bd00Smrg  fi
2784a097bd00Smrgfi
2785a097bd00Smrg
278692e95ad1Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
278792e95ad1Smrgif test "x$enable_unit_tests" = x"no"; then
278892e95ad1Smrg  if test "x$with_glib" = x"yes"; then
278992e95ad1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
279092e95ad1Smrg  fi
279192e95ad1Smrgfi
2792a097bd00Smrg
279392e95ad1Smrg# Not having GLib when it has been explicitly requested is an error
279492e95ad1Smrgif test "x$with_glib" = x"yes"; then
279592e95ad1Smrg  if test "x$have_glib" = x"no"; then
279692e95ad1Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
279792e95ad1Smrg  fi
279892e95ad1Smrgfi
2799a097bd00Smrg
280092e95ad1SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
280192e95ad1Smrg]) # XORG_WITH_GLIB
2802a097bd00Smrg
280392e95ad1Smrg# XORG_LD_WRAP([required|optional])
280492e95ad1Smrg# ---------------------------------
280592e95ad1Smrg# Minimum version: 1.13.0
280692e95ad1Smrg#
280792e95ad1Smrg# Check if linker supports -wrap, passed via compiler flags
280892e95ad1Smrg#
280992e95ad1Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
281092e95ad1Smrg# Otherwise the value of $enable_unit_tests is blank.
281192e95ad1Smrg#
281292e95ad1Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
281392e95ad1Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
281492e95ad1Smrg# available, an argument of "optional" allows use when some unit tests require
281592e95ad1Smrg# ld -wrap and others do not.
281692e95ad1Smrg#
281792e95ad1SmrgAC_DEFUN([XORG_LD_WRAP],[
281892e95ad1SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
281992e95ad1Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
282092e95ad1Smrg                      void __wrap_exit(int status) { return; }],
282192e95ad1Smrg                     [exit(0);])])
282292e95ad1Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
282392e95ad1Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
282492e95ad1Smrg  if test "x$have_ld_wrap" = x"no"; then
282592e95ad1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
282692e95ad1Smrg  fi
282792e95ad1Smrgfi
282892e95ad1SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
282992e95ad1Smrg#
283092e95ad1Smrg]) # XORG_LD_WRAP
2831a097bd00Smrg
283292e95ad1Smrg# XORG_CHECK_LINKER_FLAGS
283392e95ad1Smrg# -----------------------
283492e95ad1Smrg# SYNOPSIS
283592e95ad1Smrg#
283692e95ad1Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
283792e95ad1Smrg#
283892e95ad1Smrg# DESCRIPTION
283992e95ad1Smrg#
284092e95ad1Smrg#   Check whether the given linker FLAGS work with the current language's
284192e95ad1Smrg#   linker, or whether they give an error.
284292e95ad1Smrg#
284392e95ad1Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
284492e95ad1Smrg#   success/failure.
284592e95ad1Smrg#
284692e95ad1Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
284792e95ad1Smrg#
284892e95ad1Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
284992e95ad1Smrg#
285092e95ad1Smrg# LICENSE
285192e95ad1Smrg#
285292e95ad1Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
285392e95ad1Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
285492e95ad1Smrg#   Copyright (c) 2009 Matteo Frigo
285592e95ad1Smrg#
285692e95ad1Smrg#   This program is free software: you can redistribute it and/or modify it
285792e95ad1Smrg#   under the terms of the GNU General Public License as published by the
285892e95ad1Smrg#   Free Software Foundation, either version 3 of the License, or (at your
285992e95ad1Smrg#   option) any later version.
286092e95ad1Smrg#
286192e95ad1Smrg#   This program is distributed in the hope that it will be useful, but
286292e95ad1Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
286392e95ad1Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
286492e95ad1Smrg#   Public License for more details.
286592e95ad1Smrg#
286692e95ad1Smrg#   You should have received a copy of the GNU General Public License along
286792e95ad1Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
286892e95ad1Smrg#
286992e95ad1Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
287092e95ad1Smrg#   gives unlimited permission to copy, distribute and modify the configure
287192e95ad1Smrg#   scripts that are the output of Autoconf when processing the Macro. You
287292e95ad1Smrg#   need not follow the terms of the GNU General Public License when using
287392e95ad1Smrg#   or distributing such scripts, even though portions of the text of the
287492e95ad1Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
287592e95ad1Smrg#   all other use of the material that constitutes the Autoconf Macro.
287692e95ad1Smrg#
287792e95ad1Smrg#   This special exception to the GPL applies to versions of the Autoconf
287892e95ad1Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
287992e95ad1Smrg#   modified version of the Autoconf Macro, you may extend this special
288092e95ad1Smrg#   exception to the GPL to apply to your modified version as well.#
288192e95ad1SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
288292e95ad1Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
288392e95ad1Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
288492e95ad1SmrgAS_LITERAL_IF([$1],
288592e95ad1Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
288692e95ad1Smrg      ax_save_FLAGS=$LDFLAGS
288792e95ad1Smrg      LDFLAGS="$1"
288892e95ad1Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
288992e95ad1Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
289092e95ad1Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
289192e95ad1Smrg      LDFLAGS=$ax_save_FLAGS])],
289292e95ad1Smrg  [ax_save_FLAGS=$LDFLAGS
289392e95ad1Smrg   LDFLAGS="$1"
289492e95ad1Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
289592e95ad1Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
289692e95ad1Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
289792e95ad1Smrg   LDFLAGS=$ax_save_FLAGS])
289892e95ad1Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
289992e95ad1SmrgAC_MSG_RESULT($xorg_check_linker_flags)
290092e95ad1Smrgif test "x$xorg_check_linker_flags" = xyes; then
290192e95ad1Smrg	m4_default([$2], :)
290292e95ad1Smrgelse
290392e95ad1Smrg	m4_default([$3], :)
290492e95ad1Smrgfi
290592e95ad1Smrg]) # XORG_CHECK_LINKER_FLAGS
2906a097bd00Smrg
290792e95ad1Smrg# XORG_MEMORY_CHECK_FLAGS
290892e95ad1Smrg# -----------------------
290992e95ad1Smrg# Minimum version: 1.16.0
291092e95ad1Smrg#
291192e95ad1Smrg# This macro attempts to find appropriate memory checking functionality
291292e95ad1Smrg# for various platforms which unit testing code may use to catch various
291392e95ad1Smrg# forms of memory allocation and access errors in testing.
291492e95ad1Smrg#
291592e95ad1Smrg# Interface to module:
291692e95ad1Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
291792e95ad1Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
291892e95ad1Smrg#
291992e95ad1Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
292092e95ad1Smrg#
292192e95ad1SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2922a097bd00Smrg
292392e95ad1SmrgAC_REQUIRE([AC_CANONICAL_HOST])
292492e95ad1SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
292592e95ad1Smrg           [Environment variables to enable memory checking in tests])
2926a097bd00Smrg
292792e95ad1Smrg# Check for different types of support on different platforms
292892e95ad1Smrgcase $host_os in
292992e95ad1Smrg    solaris*)
293092e95ad1Smrg        AC_CHECK_LIB([umem], [umem_alloc],
293192e95ad1Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
293292e95ad1Smrg        ;;
293392e95ad1Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
293492e95ad1Smrg        # both directly and inverted, so should not be 0 or 255.
293592e95ad1Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
293692e95ad1Smrg        ;;
293792e95ad1Smrg    darwin*)
293892e95ad1Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
293992e95ad1Smrg        ;;
294092e95ad1Smrg    *bsd*)
294192e95ad1Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
294292e95ad1Smrg        ;;
294392e95ad1Smrgesac
2944a6d9b409Smrg
294592e95ad1Smrg# User supplied flags override default flags
294692e95ad1Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
294792e95ad1Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2948a6d9b409Smrgfi
2949a6d9b409Smrg
295092e95ad1SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
295192e95ad1Smrg]) # XORG_WITH_LINT
295211a95ff3Smrg
295392e95ad1Smrg# XORG_CHECK_MALLOC_ZERO
295492e95ad1Smrg# ----------------------
295592e95ad1Smrg# Minimum version: 1.0.0
2956a6d9b409Smrg#
295792e95ad1Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
295892e95ad1Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
295992e95ad1Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2960838f5b0bSmrg#
2961838f5b0bSmrg# No longer actually tests since there is no guarantee applications will
2962838f5b0bSmrg# run with the same malloc implementation we tested against, and the cost
2963838f5b0bSmrg# of always ensuring the size passed to malloc is non-zero is minimal now.
2964838f5b0bSmrg# Still allows builders to override when they have complete control over
2965838f5b0bSmrg# which malloc implementation will be used.
296692e95ad1SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
296792e95ad1SmrgAC_ARG_ENABLE(malloc0returnsnull,
296892e95ad1Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2969838f5b0bSmrg		       [assume malloc(0) can return NULL (default: yes)]),
297092e95ad1Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2971838f5b0bSmrg	[MALLOC_ZERO_RETURNS_NULL=yes])
2972838f5b0bSmrg
2973838f5b0bSmrgAC_MSG_CHECKING([whether to act as if malloc(0) can return NULL])
297492e95ad1SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2975a097bd00Smrg
297692e95ad1Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
297792e95ad1Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
297892e95ad1Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
297992e95ad1Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2980a6d9b409Smrgelse
298192e95ad1Smrg	MALLOC_ZERO_CFLAGS=""
298292e95ad1Smrg	XMALLOC_ZERO_CFLAGS=""
298392e95ad1Smrg	XTMALLOC_ZERO_CFLAGS=""
2984a6d9b409Smrgfi
2985a6d9b409Smrg
298692e95ad1SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
298792e95ad1SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
298892e95ad1SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
298992e95ad1Smrg]) # XORG_CHECK_MALLOC_ZERO
2990a6d9b409Smrg
299192e95ad1Smrg# XORG_WITH_LINT()
299292e95ad1Smrg# ----------------
299392e95ad1Smrg# Minimum version: 1.1.0
2994a097bd00Smrg#
299592e95ad1Smrg# This macro enables the use of a tool that flags some suspicious and
299692e95ad1Smrg# non-portable constructs (likely to be bugs) in C language source code.
299792e95ad1Smrg# It will attempt to locate the tool and use appropriate options.
299892e95ad1Smrg# There are various lint type tools on different platforms.
2999a097bd00Smrg#
300092e95ad1Smrg# Interface to module:
300192e95ad1Smrg# LINT:		returns the path to the tool found on the platform
300292e95ad1Smrg#		or the value set to LINT on the configure cmd line
300392e95ad1Smrg#		also an Automake conditional
300492e95ad1Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
300592e95ad1Smrg#
300692e95ad1Smrg# --with-lint:	'yes' user instructs the module to use lint
300792e95ad1Smrg#		'no' user instructs the module not to use lint (default)
300892e95ad1Smrg#
300992e95ad1Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
301092e95ad1Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
301192e95ad1Smrg#
301292e95ad1SmrgAC_DEFUN([XORG_WITH_LINT],[
3013a097bd00Smrg
301492e95ad1SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
301592e95ad1SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
301692e95ad1SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
301792e95ad1Smrg		[Use a lint-style source code checker (default: disabled)])],
301892e95ad1Smrg		[use_lint=$withval], [use_lint=no])
3019a097bd00Smrg
302092e95ad1Smrg# Obtain platform specific info like program name and options
302192e95ad1Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
302292e95ad1Smrgcase $host_os in
302392e95ad1Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
302492e95ad1Smrg	lint_name=splint
302592e95ad1Smrg	lint_options="-badflag"
302692e95ad1Smrg	;;
302792e95ad1Smrg  *freebsd* | *netbsd*)
302892e95ad1Smrg	lint_name=lint
302992e95ad1Smrg	lint_options="-u -b"
303092e95ad1Smrg	;;
303192e95ad1Smrg  *solaris*)
303292e95ad1Smrg	lint_name=lint
303392e95ad1Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
303492e95ad1Smrg	;;
303592e95ad1Smrgesac
303692e95ad1Smrg
303792e95ad1Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
303892e95ad1Smrgif test "x$use_lint" = x"yes" ; then
303992e95ad1Smrg   AC_PATH_PROG([LINT], [$lint_name])
304092e95ad1Smrg   if test "x$LINT" = "x"; then
304192e95ad1Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
304292e95ad1Smrg   fi
304392e95ad1Smrgelif test "x$use_lint" = x"no" ; then
304492e95ad1Smrg   if test "x$LINT" != "x"; then
304592e95ad1Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
304692e95ad1Smrg   fi
304711a95ff3Smrgelse
304892e95ad1Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
3049a097bd00Smrgfi
3050a097bd00Smrg
305192e95ad1Smrg# User supplied flags override default flags
305292e95ad1Smrgif test "x$LINT_FLAGS" != "x"; then
305392e95ad1Smrg   lint_options=$LINT_FLAGS
305492e95ad1Smrgfi
3055a097bd00Smrg
305692e95ad1SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
305792e95ad1SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
3058a097bd00Smrg
305992e95ad1Smrg]) # XORG_WITH_LINT
3060a097bd00Smrg
306192e95ad1Smrg# XORG_LINT_LIBRARY(LIBNAME)
306292e95ad1Smrg# --------------------------
306392e95ad1Smrg# Minimum version: 1.1.0
3064a097bd00Smrg#
306592e95ad1Smrg# Sets up flags for building lint libraries for checking programs that call
306692e95ad1Smrg# functions in the library.
306792e95ad1Smrg#
306892e95ad1Smrg# Interface to module:
306992e95ad1Smrg# LINTLIB		- Automake variable with the name of lint library file to make
307092e95ad1Smrg# MAKE_LINT_LIB		- Automake conditional
307192e95ad1Smrg#
307292e95ad1Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
307392e95ad1Smrg#			  - 'no' user instructs the module not to create a lint library (default)
3074a097bd00Smrg
307592e95ad1SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
307692e95ad1SmrgAC_REQUIRE([XORG_WITH_LINT])
307792e95ad1SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
307892e95ad1Smrg	[Create lint library (default: disabled)])],
307992e95ad1Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
308092e95ad1Smrg
308192e95ad1Smrgif test "x$make_lint_lib" = x"yes" ; then
308292e95ad1Smrg   LINTLIB=llib-l$1.ln
308392e95ad1Smrg   if test "x$LINT" = "x"; then
308492e95ad1Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
308592e95ad1Smrg   fi
308692e95ad1Smrgelif test "x$make_lint_lib" != x"no" ; then
308792e95ad1Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
3088a097bd00Smrgfi
3089a097bd00Smrg
309092e95ad1SmrgAC_SUBST(LINTLIB)
309192e95ad1SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
309211a95ff3Smrg
309392e95ad1Smrg]) # XORG_LINT_LIBRARY
309411a95ff3Smrg
309592e95ad1Smrg# XORG_COMPILER_BRAND
309611a95ff3Smrg# -------------------
309792e95ad1Smrg# Minimum version: 1.14.0
309811a95ff3Smrg#
309992e95ad1Smrg# Checks for various brands of compilers and sets flags as appropriate:
310092e95ad1Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
310192e95ad1Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
310292e95ad1Smrg#   clang compiler - sets CLANGCC to "yes"
310392e95ad1Smrg#   Intel compiler - sets INTELCC to "yes"
310492e95ad1Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
310592e95ad1Smrg#
310692e95ad1SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
310792e95ad1SmrgAC_LANG_CASE(
310892e95ad1Smrg	[C], [
3109838f5b0bSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3110838f5b0bSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3111838f5b0bSmrg		m4_version_prereq([2.70],
3112838f5b0bSmrg			[AC_REQUIRE([AC_PROG_CC])],
3113838f5b0bSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
311492e95ad1Smrg	],
311592e95ad1Smrg	[C++], [
311692e95ad1Smrg		AC_REQUIRE([AC_PROG_CXX])
311792e95ad1Smrg	]
311892e95ad1Smrg)
311992e95ad1SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
312092e95ad1SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
312192e95ad1SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
312292e95ad1Smrg]) # XORG_COMPILER_BRAND
3123a097bd00Smrg
312492e95ad1Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
312511a95ff3Smrg# ---------------
312692e95ad1Smrg# Minimum version: 1.16.0
312792e95ad1Smrg#
312892e95ad1Smrg# Test if the compiler works when passed the given flag as a command line argument.
3129838f5b0bSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
313092e95ad1Smrg# next flag in the list until there are no more options.
313192e95ad1Smrg#
313292e95ad1Smrg# Note that this does not guarantee that the compiler supports the flag as some
313392e95ad1Smrg# compilers will simply ignore arguments that they do not understand, but we do
313492e95ad1Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
313592e95ad1Smrg# -Werror=unused-command-line-argument
313692e95ad1Smrg#
313792e95ad1SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
313892e95ad1Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
313992e95ad1Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3140a097bd00Smrg
314192e95ad1SmrgAC_LANG_COMPILER_REQUIRE
3142a097bd00Smrg
314392e95ad1SmrgAC_LANG_CASE(
314492e95ad1Smrg	[C], [
3145838f5b0bSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3146838f5b0bSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3147838f5b0bSmrg		m4_version_prereq([2.70],
3148838f5b0bSmrg			[AC_REQUIRE([AC_PROG_CC])],
3149838f5b0bSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
315092e95ad1Smrg		define([PREFIX], [C])
315192e95ad1Smrg		define([CACHE_PREFIX], [cc])
315292e95ad1Smrg		define([COMPILER], [$CC])
315392e95ad1Smrg	],
315492e95ad1Smrg	[C++], [
315592e95ad1Smrg		define([PREFIX], [CXX])
315692e95ad1Smrg		define([CACHE_PREFIX], [cxx])
315792e95ad1Smrg		define([COMPILER], [$CXX])
315892e95ad1Smrg	]
315992e95ad1Smrg)
316092e95ad1Smrg
316192e95ad1Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
316292e95ad1Smrg
316392e95ad1Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
316492e95ad1Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
316592e95ad1Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
316692e95ad1Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
316792e95ad1Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
316892e95ad1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
316992e95ad1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
317092e95ad1Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
317192e95ad1Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
317211a95ff3Smrgfi
317392e95ad1Smrg
317492e95ad1Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
317592e95ad1Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
317692e95ad1Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
317792e95ad1Smrg	fi
317892e95ad1Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
317992e95ad1Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
318092e95ad1Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
318192e95ad1Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
318292e95ad1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
318392e95ad1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
318492e95ad1Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
318592e95ad1Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
318692e95ad1Smrgfi
318792e95ad1Smrg
318892e95ad1Smrgfound="no"
318992e95ad1Smrgm4_foreach([flag], m4_cdr($@), [
319092e95ad1Smrg	if test $found = "no" ; then
319192e95ad1Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
319292e95ad1Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
319392e95ad1Smrg		fi
319492e95ad1Smrg
319592e95ad1Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
319692e95ad1Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
319792e95ad1Smrg		fi
319892e95ad1Smrg
319992e95ad1Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
320092e95ad1Smrg
320192e95ad1Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
320292e95ad1Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
320392e95ad1Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
320492e95ad1Smrg		AC_CACHE_VAL($cacheid,
320592e95ad1Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
320692e95ad1Smrg					     [eval $cacheid=yes],
320792e95ad1Smrg					     [eval $cacheid=no])])
320892e95ad1Smrg
320992e95ad1Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
321092e95ad1Smrg
321192e95ad1Smrg		eval supported=\$$cacheid
321292e95ad1Smrg		AC_MSG_RESULT([$supported])
321392e95ad1Smrg		if test "$supported" = "yes" ; then
321492e95ad1Smrg			$1="$$1 ]flag["
321592e95ad1Smrg			found="yes"
321692e95ad1Smrg		fi
321792e95ad1Smrg	fi
321811a95ff3Smrg])
321992e95ad1Smrg]) # XORG_TESTSET_CFLAG
3220a097bd00Smrg
322192e95ad1Smrg# XORG_COMPILER_FLAGS
322292e95ad1Smrg# ---------------
322392e95ad1Smrg# Minimum version: 1.16.0
3224a097bd00Smrg#
322592e95ad1Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
322692e95ad1Smrg# arguments supported by the selected compiler which do NOT alter the generated
322792e95ad1Smrg# code.  These arguments will cause the compiler to print various warnings
322892e95ad1Smrg# during compilation AND turn a conservative set of warnings into errors.
322992e95ad1Smrg#
323092e95ad1Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
323192e95ad1Smrg# future versions of util-macros as options are added to new compilers.
323292e95ad1Smrg#
323392e95ad1SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
323492e95ad1SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3235efda2da8Smrg
323692e95ad1SmrgAC_ARG_ENABLE(selective-werror,
323792e95ad1Smrg              AS_HELP_STRING([--disable-selective-werror],
323892e95ad1Smrg                             [Turn off selective compiler errors. (default: enabled)]),
323992e95ad1Smrg              [SELECTIVE_WERROR=$enableval],
324092e95ad1Smrg              [SELECTIVE_WERROR=yes])
324192e95ad1Smrg
324292e95ad1SmrgAC_LANG_CASE(
324392e95ad1Smrg        [C], [
324492e95ad1Smrg                define([PREFIX], [C])
324592e95ad1Smrg        ],
324692e95ad1Smrg        [C++], [
324792e95ad1Smrg                define([PREFIX], [CXX])
324892e95ad1Smrg        ]
324992e95ad1Smrg)
325092e95ad1Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
325192e95ad1Smrgif test "x$SUNCC" = "xyes"; then
325292e95ad1Smrg    [BASE_]PREFIX[FLAGS]="-v"
325311a95ff3Smrgelse
325492e95ad1Smrg    [BASE_]PREFIX[FLAGS]=""
325511a95ff3Smrgfi
325611a95ff3Smrg
325792e95ad1Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
325892e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
325992e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
326092e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
326192e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
326211a95ff3Smrg
326392e95ad1SmrgAC_LANG_CASE(
326492e95ad1Smrg	[C], [
326592e95ad1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
326692e95ad1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
326792e95ad1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
326892e95ad1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
326992e95ad1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
327092e95ad1Smrg	]
327192e95ad1Smrg)
3272efda2da8Smrg
327392e95ad1Smrg# This chunk adds additional warnings that could catch undesired effects.
327492e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
327592e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
327692e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
327792e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
327892e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
327992e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
328092e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3281a097bd00Smrg
328292e95ad1Smrg# These are currently disabled because they are noisy.  They will be enabled
328392e95ad1Smrg# in the future once the codebase is sufficiently modernized to silence
328492e95ad1Smrg# them.  For now, I don't want them to drown out the other warnings.
328592e95ad1Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
328692e95ad1Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
328792e95ad1Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3288a097bd00Smrg
3289838f5b0bSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
329092e95ad1Smrg# when there are problems that should be fixed.
3291a097bd00Smrg
329292e95ad1Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
329392e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
329492e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
329592e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
329692e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
329792e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
329892e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
329992e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
330092e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
330192e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
330292e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
330392e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
330492e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
330592e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
330692e95ad1Smrgelse
330792e95ad1SmrgAC_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])
330892e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
330992e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
331092e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
331192e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
331292e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
331392e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
331492e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
331592e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
331692e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
331792e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
331892e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
331992e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
332092e95ad1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
332192e95ad1Smrgfi
3322a097bd00Smrg
332392e95ad1SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
332492e95ad1Smrg]) # XORG_COMPILER_FLAGS
3325efda2da8Smrg
332692e95ad1Smrg# XORG_CWARNFLAGS
332792e95ad1Smrg# ---------------
332892e95ad1Smrg# Minimum version: 1.2.0
332992e95ad1Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3330efda2da8Smrg#
333192e95ad1Smrg# Defines CWARNFLAGS to enable C compiler warnings.
33321e5fa1c5Smrg#
333392e95ad1Smrg# This function is deprecated because it defines -fno-strict-aliasing
333492e95ad1Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
333592e95ad1Smrg# is needed, then it should be added explicitly in the module when
333692e95ad1Smrg# it is updated to use BASE_CFLAGS.
33371e5fa1c5Smrg#
333892e95ad1SmrgAC_DEFUN([XORG_CWARNFLAGS], [
333992e95ad1SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
334092e95ad1SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
334192e95ad1SmrgAC_LANG_CASE(
334292e95ad1Smrg	[C], [
334392e95ad1Smrg		CWARNFLAGS="$BASE_CFLAGS"
334492e95ad1Smrg		if  test "x$GCC" = xyes ; then
334592e95ad1Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
334692e95ad1Smrg		fi
334792e95ad1Smrg		AC_SUBST(CWARNFLAGS)
334892e95ad1Smrg	]
334992e95ad1Smrg)
335092e95ad1Smrg]) # XORG_CWARNFLAGS
3351b91640d3Smrg
335292e95ad1Smrg# XORG_STRICT_OPTION
335392e95ad1Smrg# -----------------------
335492e95ad1Smrg# Minimum version: 1.3.0
335592e95ad1Smrg#
335692e95ad1Smrg# Add configure option to enable strict compilation flags, such as treating
335792e95ad1Smrg# warnings as fatal errors.
335892e95ad1Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
335992e95ad1Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
336092e95ad1Smrg#
336192e95ad1Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
336292e95ad1Smrg# when strict compilation is unconditionally desired.
336392e95ad1SmrgAC_DEFUN([XORG_STRICT_OPTION], [
336492e95ad1SmrgAC_REQUIRE([XORG_CWARNFLAGS])
336592e95ad1SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3366a6d9b409Smrg
336792e95ad1SmrgAC_ARG_ENABLE(strict-compilation,
336892e95ad1Smrg			  AS_HELP_STRING([--enable-strict-compilation],
336992e95ad1Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
337092e95ad1Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
337111a95ff3Smrg
337292e95ad1SmrgAC_LANG_CASE(
337392e95ad1Smrg        [C], [
337492e95ad1Smrg                define([PREFIX], [C])
337592e95ad1Smrg        ],
337692e95ad1Smrg        [C++], [
337792e95ad1Smrg                define([PREFIX], [CXX])
337892e95ad1Smrg        ]
337992e95ad1Smrg)
338011a95ff3Smrg
338192e95ad1Smrg[STRICT_]PREFIX[FLAGS]=""
338292e95ad1SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
338392e95ad1SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
338411a95ff3Smrg
338592e95ad1Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
338692e95ad1Smrg# activate it with -Werror, so we add it here explicitly.
338792e95ad1SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
338811a95ff3Smrg
338992e95ad1Smrgif test "x$STRICT_COMPILE" = "xyes"; then
339092e95ad1Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
339192e95ad1Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
339292e95ad1Smrgfi
339392e95ad1SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
339492e95ad1SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
339592e95ad1SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
339692e95ad1Smrg]) # XORG_STRICT_OPTION
339711a95ff3Smrg
3398838f5b0bSmrg# XORG_DEFAULT_NOCODE_OPTIONS
3399838f5b0bSmrg# ---------------------------
3400838f5b0bSmrg# Minimum version: 1.20.0
3401838f5b0bSmrg#
3402838f5b0bSmrg# Defines default options for X.Org modules which don't compile code,
3403838f5b0bSmrg# such as fonts, bitmaps, cursors, and docs.
3404838f5b0bSmrg#
3405838f5b0bSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3406838f5b0bSmrgAC_REQUIRE([AC_PROG_INSTALL])
3407838f5b0bSmrgXORG_RELEASE_VERSION
3408838f5b0bSmrgXORG_CHANGELOG
3409838f5b0bSmrgXORG_INSTALL
3410838f5b0bSmrgXORG_MANPAGE_SECTIONS
3411838f5b0bSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3412838f5b0bSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3413838f5b0bSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3414838f5b0bSmrg
341592e95ad1Smrg# XORG_DEFAULT_OPTIONS
341692e95ad1Smrg# --------------------
341792e95ad1Smrg# Minimum version: 1.3.0
341892e95ad1Smrg#
3419838f5b0bSmrg# Defines default options for X.Org modules which compile code.
342092e95ad1Smrg#
342192e95ad1SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
342292e95ad1SmrgAC_REQUIRE([AC_PROG_INSTALL])
342392e95ad1SmrgXORG_COMPILER_FLAGS
342492e95ad1SmrgXORG_CWARNFLAGS
342592e95ad1SmrgXORG_STRICT_OPTION
3426838f5b0bSmrgXORG_DEFAULT_NOCODE_OPTIONS
342792e95ad1Smrg]) # XORG_DEFAULT_OPTIONS
342811a95ff3Smrg
342992e95ad1Smrg# XORG_INSTALL()
343092e95ad1Smrg# ----------------
343192e95ad1Smrg# Minimum version: 1.4.0
343292e95ad1Smrg#
343392e95ad1Smrg# Defines the variable INSTALL_CMD as the command to copy
343492e95ad1Smrg# INSTALL from $prefix/share/util-macros.
343592e95ad1Smrg#
343692e95ad1SmrgAC_DEFUN([XORG_INSTALL], [
343792e95ad1SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
343892e95ad1Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
343992e95ad1SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
344092e95ad1Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
344192e95ad1Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
344292e95ad1Smrgtouch \$(top_srcdir)/INSTALL; \
344392e95ad1Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
344492e95ad1SmrgAC_SUBST([INSTALL_CMD])
344592e95ad1Smrg]) # XORG_INSTALL
344692e95ad1Smrgdnl Copyright 2005 Red Hat, Inc
344792e95ad1Smrgdnl
344892e95ad1Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
344992e95ad1Smrgdnl documentation for any purpose is hereby granted without fee, provided that
345092e95ad1Smrgdnl the above copyright notice appear in all copies and that both that
345192e95ad1Smrgdnl copyright notice and this permission notice appear in supporting
345292e95ad1Smrgdnl documentation.
345392e95ad1Smrgdnl
345492e95ad1Smrgdnl The above copyright notice and this permission notice shall be included
345592e95ad1Smrgdnl in all copies or substantial portions of the Software.
345692e95ad1Smrgdnl
345792e95ad1Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
345892e95ad1Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
345992e95ad1Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
346092e95ad1Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
346192e95ad1Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
346292e95ad1Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
346392e95ad1Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
346492e95ad1Smrgdnl
346592e95ad1Smrgdnl Except as contained in this notice, the name of the copyright holders shall
346692e95ad1Smrgdnl not be used in advertising or otherwise to promote the sale, use or
346792e95ad1Smrgdnl other dealings in this Software without prior written authorization
346892e95ad1Smrgdnl from the copyright holders.
346992e95ad1Smrgdnl
347011a95ff3Smrg
347192e95ad1Smrg# XORG_RELEASE_VERSION
347292e95ad1Smrg# --------------------
347392e95ad1Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
347411a95ff3Smrg
347592e95ad1SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
347692e95ad1Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
347792e95ad1Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
347892e95ad1Smrg		[Major version of this package])
347992e95ad1Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
348092e95ad1Smrg	if test "x$PVM" = "x"; then
348192e95ad1Smrg		PVM="0"
348292e95ad1Smrg	fi
348392e95ad1Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
348492e95ad1Smrg		[$PVM],
348592e95ad1Smrg		[Minor version of this package])
348692e95ad1Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
348792e95ad1Smrg	if test "x$PVP" = "x"; then
348892e95ad1Smrg		PVP="0"
348992e95ad1Smrg	fi
349092e95ad1Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
349192e95ad1Smrg		[$PVP],
349292e95ad1Smrg		[Patch version of this package])
349392e95ad1Smrg])
349411a95ff3Smrg
349592e95ad1Smrg# XORG_CHANGELOG()
349692e95ad1Smrg# ----------------
349792e95ad1Smrg# Minimum version: 1.2.0
349892e95ad1Smrg#
349992e95ad1Smrg# Defines the variable CHANGELOG_CMD as the command to generate
350092e95ad1Smrg# ChangeLog from git.
350192e95ad1Smrg#
350292e95ad1Smrg#
350392e95ad1SmrgAC_DEFUN([XORG_CHANGELOG], [
350492e95ad1SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
350592e95ad1Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
350692e95ad1Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
350792e95ad1Smrgtouch \$(top_srcdir)/ChangeLog; \
350892e95ad1Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
350992e95ad1SmrgAC_SUBST([CHANGELOG_CMD])
351092e95ad1Smrg]) # XORG_CHANGELOG
3511efda2da8Smrg
3512