143ecf206Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2953c684bSmrg
343ecf206Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4fd0c672fSmrg
5fd0c672fSmrg# This file is free software; the Free Software Foundation
6fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
7fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
8fd0c672fSmrg
9fd0c672fSmrg# This program is distributed in the hope that it will be useful,
10fd0c672fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11fd0c672fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12fd0c672fSmrg# PARTICULAR PURPOSE.
13fd0c672fSmrg
14953c684bSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1548e69166Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1648e69166Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1783f4f7f0Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
1883f4f7f0Smrg[m4_warning([this file was generated for autoconf 2.72.
1948e69166SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2048e69166SmrgIf you have problems, you may need to regenerate the build system entirely.
21953c684bSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2248e69166Smrg
2343ecf206Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2443ecf206Smrg#
2543ecf206Smrg# This file is free software; the Free Software Foundation
2643ecf206Smrg# gives unlimited permission to copy and/or distribute it,
2743ecf206Smrg# with or without modifications, as long as this notice is preserved.
288846b520Smrg
2943ecf206Smrg# AM_AUTOMAKE_VERSION(VERSION)
3043ecf206Smrg# ----------------------------
3143ecf206Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3243ecf206Smrg# generated from the m4 files accompanying Automake X.Y.
3343ecf206Smrg# (This private macro should not be called outside this file.)
3443ecf206SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3543ecf206Smrg[am__api_version='1.16'
3643ecf206Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3743ecf206Smrgdnl require some minimum version.  Point them to the right macro.
3843ecf206Smrgm4_if([$1], [1.16.5], [],
3943ecf206Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4043ecf206Smrg])
418846b520Smrg
4243ecf206Smrg# _AM_AUTOCONF_VERSION(VERSION)
4343ecf206Smrg# -----------------------------
4443ecf206Smrg# aclocal traces this macro to find the Autoconf version.
4543ecf206Smrg# This is a private macro too.  Using m4_define simplifies
4643ecf206Smrg# the logic in aclocal, which can simply ignore this definition.
4743ecf206Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48fd0c672fSmrg
4943ecf206Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5043ecf206Smrg# -------------------------------
5143ecf206Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5243ecf206Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5343ecf206SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5443ecf206Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5543ecf206Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5643ecf206Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5743ecf206Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5848e69166Smrg
5943ecf206Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60fd0c672fSmrg
6143ecf206Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6243ecf206Smrg#
6343ecf206Smrg# This file is free software; the Free Software Foundation
6443ecf206Smrg# gives unlimited permission to copy and/or distribute it,
6543ecf206Smrg# with or without modifications, as long as this notice is preserved.
66fd0c672fSmrg
6743ecf206Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6843ecf206Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6943ecf206Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7043ecf206Smrg#
7143ecf206Smrg# Of course, Automake must honor this variable whenever it calls a
7243ecf206Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7343ecf206Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7443ecf206Smrg# depending on how configure is run.  This is pretty annoying, since
7543ecf206Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7643ecf206Smrg# source directory, any form will work fine, but in subdirectories a
7743ecf206Smrg# relative path needs to be adjusted first.
7843ecf206Smrg#
7943ecf206Smrg# $ac_aux_dir/missing
8043ecf206Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8143ecf206Smrg# $top_srcdir/$ac_aux_dir/missing
8243ecf206Smrg#    fails if $ac_aux_dir is absolute,
8343ecf206Smrg#    fails when called from a subdirectory in a VPATH build with
8443ecf206Smrg#          a relative $ac_aux_dir
8543ecf206Smrg#
8643ecf206Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8743ecf206Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8843ecf206Smrg# harmless because $srcdir is '.', but things will broke when you
8943ecf206Smrg# start a VPATH build or use an absolute $srcdir.
9043ecf206Smrg#
9143ecf206Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9243ecf206Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9343ecf206Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9443ecf206Smrg# and then we would define $MISSING as
9543ecf206Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9643ecf206Smrg# This will work as long as MISSING is not called from configure, because
9743ecf206Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9843ecf206Smrg# However there are other variables, like CC, which are often used in
9943ecf206Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10043ecf206Smrg#
10143ecf206Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10243ecf206Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10343ecf206Smrg# configured tree to be moved without reconfiguration.
104fd0c672fSmrg
10543ecf206SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10643ecf206Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10743ecf206Smrg# Expand $ac_aux_dir to an absolute path.
10843ecf206Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10943ecf206Smrg])
110fd0c672fSmrg
11143ecf206Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112fd0c672fSmrg
11343ecf206Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11443ecf206Smrg#
11543ecf206Smrg# This file is free software; the Free Software Foundation
11643ecf206Smrg# gives unlimited permission to copy and/or distribute it,
11743ecf206Smrg# with or without modifications, as long as this notice is preserved.
118fd0c672fSmrg
11943ecf206Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12043ecf206Smrg# -------------------------------------
12143ecf206Smrg# Define a conditional.
12243ecf206SmrgAC_DEFUN([AM_CONDITIONAL],
12343ecf206Smrg[AC_PREREQ([2.52])dnl
12443ecf206Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12543ecf206Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12643ecf206SmrgAC_SUBST([$1_TRUE])dnl
12743ecf206SmrgAC_SUBST([$1_FALSE])dnl
12843ecf206Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12943ecf206Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13043ecf206Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13143ecf206Smrgif $2; then
13243ecf206Smrg  $1_TRUE=
13343ecf206Smrg  $1_FALSE='#'
13443ecf206Smrgelse
13543ecf206Smrg  $1_TRUE='#'
13643ecf206Smrg  $1_FALSE=
13743ecf206Smrgfi
13843ecf206SmrgAC_CONFIG_COMMANDS_PRE(
13943ecf206Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14043ecf206Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14143ecf206SmrgUsually this means the macro was only invoked conditionally.]])
14243ecf206Smrgfi])])
143fd0c672fSmrg
14443ecf206Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14543ecf206Smrg#
14643ecf206Smrg# This file is free software; the Free Software Foundation
14743ecf206Smrg# gives unlimited permission to copy and/or distribute it,
14843ecf206Smrg# with or without modifications, as long as this notice is preserved.
149fd0c672fSmrg
150fd0c672fSmrg
15143ecf206Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15243ecf206Smrg# written in clear, in which case automake, when reading aclocal.m4,
15343ecf206Smrg# will think it sees a *use*, and therefore will trigger all it's
15443ecf206Smrg# C support machinery.  Also note that it means that autoscan, seeing
15543ecf206Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156fd0c672fSmrg
157fd0c672fSmrg
15843ecf206Smrg# _AM_DEPENDENCIES(NAME)
15943ecf206Smrg# ----------------------
16043ecf206Smrg# See how the compiler implements dependency checking.
16143ecf206Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16243ecf206Smrg# We try a few techniques and use that to set a single cache variable.
16343ecf206Smrg#
16443ecf206Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16543ecf206Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16643ecf206Smrg# dependency, and given that the user is not expected to run this macro,
16743ecf206Smrg# just rely on AC_PROG_CC.
16843ecf206SmrgAC_DEFUN([_AM_DEPENDENCIES],
16943ecf206Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17043ecf206SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17143ecf206SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17243ecf206SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173fd0c672fSmrg
17443ecf206Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17543ecf206Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17643ecf206Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17743ecf206Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17843ecf206Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17943ecf206Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18043ecf206Smrg                    [depcc="$$1"   am_compiler_list=])
181fd0c672fSmrg
18243ecf206SmrgAC_CACHE_CHECK([dependency style of $depcc],
18343ecf206Smrg               [am_cv_$1_dependencies_compiler_type],
18443ecf206Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18543ecf206Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18643ecf206Smrg  # making bogus files that we don't know about and never remove.  For
18743ecf206Smrg  # instance it was reported that on HP-UX the gcc test will end up
18843ecf206Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18943ecf206Smrg  # in D".
19043ecf206Smrg  rm -rf conftest.dir
19143ecf206Smrg  mkdir conftest.dir
19243ecf206Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19343ecf206Smrg  # using a relative directory.
19443ecf206Smrg  cp "$am_depcomp" conftest.dir
19543ecf206Smrg  cd conftest.dir
19643ecf206Smrg  # We will build objects and dependencies in a subdirectory because
19743ecf206Smrg  # it helps to detect inapplicable dependency modes.  For instance
19843ecf206Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19943ecf206Smrg  # side effect of compilation, but ICC will put the dependencies in
20043ecf206Smrg  # the current directory while Tru64 will put them in the object
20143ecf206Smrg  # directory.
20243ecf206Smrg  mkdir sub
203fd0c672fSmrg
20443ecf206Smrg  am_cv_$1_dependencies_compiler_type=none
20543ecf206Smrg  if test "$am_compiler_list" = ""; then
20643ecf206Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20743ecf206Smrg  fi
20843ecf206Smrg  am__universal=false
20943ecf206Smrg  m4_case([$1], [CC],
21043ecf206Smrg    [case " $depcc " in #(
21143ecf206Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21243ecf206Smrg     esac],
21343ecf206Smrg    [CXX],
21443ecf206Smrg    [case " $depcc " in #(
21543ecf206Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21643ecf206Smrg     esac])
217fd0c672fSmrg
21843ecf206Smrg  for depmode in $am_compiler_list; do
21943ecf206Smrg    # Setup a source with many dependencies, because some compilers
22043ecf206Smrg    # like to wrap large dependency lists on column 80 (with \), and
22143ecf206Smrg    # we should not choose a depcomp mode which is confused by this.
22243ecf206Smrg    #
22343ecf206Smrg    # We need to recreate these files for each test, as the compiler may
22443ecf206Smrg    # overwrite some of them when testing with obscure command lines.
22543ecf206Smrg    # This happens at least with the AIX C compiler.
22643ecf206Smrg    : > sub/conftest.c
22743ecf206Smrg    for i in 1 2 3 4 5 6; do
22843ecf206Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22943ecf206Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23043ecf206Smrg      # Solaris 10 /bin/sh.
23143ecf206Smrg      echo '/* dummy */' > sub/conftst$i.h
23243ecf206Smrg    done
23343ecf206Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234fd0c672fSmrg
23543ecf206Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23643ecf206Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23743ecf206Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23843ecf206Smrg    # versions had trouble with output in subdirs.
23943ecf206Smrg    am__obj=sub/conftest.${OBJEXT-o}
24043ecf206Smrg    am__minus_obj="-o $am__obj"
24143ecf206Smrg    case $depmode in
24243ecf206Smrg    gcc)
24343ecf206Smrg      # This depmode causes a compiler race in universal mode.
24443ecf206Smrg      test "$am__universal" = false || continue
24543ecf206Smrg      ;;
24643ecf206Smrg    nosideeffect)
24743ecf206Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24843ecf206Smrg      # only be used when explicitly requested.
24943ecf206Smrg      if test "x$enable_dependency_tracking" = xyes; then
25043ecf206Smrg	continue
25143ecf206Smrg      else
25243ecf206Smrg	break
25343ecf206Smrg      fi
25443ecf206Smrg      ;;
25543ecf206Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25643ecf206Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25743ecf206Smrg      # not run yet.  These depmodes are late enough in the game, and
25843ecf206Smrg      # so weak that their functioning should not be impacted.
25943ecf206Smrg      am__obj=conftest.${OBJEXT-o}
26043ecf206Smrg      am__minus_obj=
26143ecf206Smrg      ;;
26243ecf206Smrg    none) break ;;
26343ecf206Smrg    esac
26443ecf206Smrg    if depmode=$depmode \
26543ecf206Smrg       source=sub/conftest.c object=$am__obj \
26643ecf206Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26743ecf206Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26843ecf206Smrg         >/dev/null 2>conftest.err &&
26943ecf206Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27043ecf206Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27143ecf206Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27243ecf206Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27343ecf206Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27443ecf206Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27543ecf206Smrg      # that says an option was ignored or not supported.
27643ecf206Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27743ecf206Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27843ecf206Smrg      # The diagnosis changed in icc 8.0:
27943ecf206Smrg      #   icc: Command line remark: option '-MP' not supported
28043ecf206Smrg      if (grep 'ignoring option' conftest.err ||
28143ecf206Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28243ecf206Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28343ecf206Smrg        break
28443ecf206Smrg      fi
28543ecf206Smrg    fi
28643ecf206Smrg  done
28748e69166Smrg
28843ecf206Smrg  cd ..
28943ecf206Smrg  rm -rf conftest.dir
29043ecf206Smrgelse
29143ecf206Smrg  am_cv_$1_dependencies_compiler_type=none
29243ecf206Smrgfi
29343ecf206Smrg])
29443ecf206SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29543ecf206SmrgAM_CONDITIONAL([am__fastdep$1], [
29643ecf206Smrg  test "x$enable_dependency_tracking" != xno \
29743ecf206Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29843ecf206Smrg])
299fd0c672fSmrg
3008846b520Smrg
30143ecf206Smrg# AM_SET_DEPDIR
30243ecf206Smrg# -------------
30343ecf206Smrg# Choose a directory name for dependency files.
30443ecf206Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30543ecf206SmrgAC_DEFUN([AM_SET_DEPDIR],
30643ecf206Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30743ecf206SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30843ecf206Smrg])
3098846b520Smrg
3108846b520Smrg
31143ecf206Smrg# AM_DEP_TRACK
31243ecf206Smrg# ------------
31343ecf206SmrgAC_DEFUN([AM_DEP_TRACK],
31443ecf206Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31543ecf206SmrgAS_HELP_STRING(
31643ecf206Smrg  [--enable-dependency-tracking],
31743ecf206Smrg  [do not reject slow dependency extractors])
31843ecf206SmrgAS_HELP_STRING(
31943ecf206Smrg  [--disable-dependency-tracking],
32043ecf206Smrg  [speeds up one-time build])])
32143ecf206Smrgif test "x$enable_dependency_tracking" != xno; then
32243ecf206Smrg  am_depcomp="$ac_aux_dir/depcomp"
32343ecf206Smrg  AMDEPBACKSLASH='\'
32443ecf206Smrg  am__nodep='_no'
32543ecf206Smrgfi
32643ecf206SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32743ecf206SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32843ecf206Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32943ecf206SmrgAC_SUBST([am__nodep])dnl
33043ecf206Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33143ecf206Smrg])
3328846b520Smrg
33343ecf206Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3348846b520Smrg
33543ecf206Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3368846b520Smrg#
33743ecf206Smrg# This file is free software; the Free Software Foundation
33843ecf206Smrg# gives unlimited permission to copy and/or distribute it,
33943ecf206Smrg# with or without modifications, as long as this notice is preserved.
3408846b520Smrg
34143ecf206Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34243ecf206Smrg# ------------------------------
34343ecf206SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34443ecf206Smrg[{
34543ecf206Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34643ecf206Smrg  # are listed without --file.  Let's play safe and only enable the eval
34743ecf206Smrg  # if we detect the quoting.
34843ecf206Smrg  # TODO: see whether this extra hack can be removed once we start
34943ecf206Smrg  # requiring Autoconf 2.70 or later.
35043ecf206Smrg  AS_CASE([$CONFIG_FILES],
35143ecf206Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
35243ecf206Smrg          [*], [set x $CONFIG_FILES])
35343ecf206Smrg  shift
35443ecf206Smrg  # Used to flag and report bootstrapping failures.
35543ecf206Smrg  am_rc=0
35643ecf206Smrg  for am_mf
35743ecf206Smrg  do
35843ecf206Smrg    # Strip MF so we end up with the name of the file.
35943ecf206Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36043ecf206Smrg    # Check whether this is an Automake generated Makefile which includes
36143ecf206Smrg    # dependency-tracking related rules and includes.
36243ecf206Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36343ecf206Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36443ecf206Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36543ecf206Smrg      || continue
36643ecf206Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36743ecf206Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36843ecf206Smrg    AM_RUN_LOG([cd "$am_dirpart" \
36943ecf206Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37043ecf206Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37143ecf206Smrg  done
37243ecf206Smrg  if test $am_rc -ne 0; then
37343ecf206Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37443ecf206Smrg    for automatic dependency tracking.  If GNU make was not used, consider
37543ecf206Smrg    re-running the configure script with MAKE="gmake" (or whatever is
37643ecf206Smrg    necessary).  You can also try re-running configure with the
37743ecf206Smrg    '--disable-dependency-tracking' option to at least be able to build
37843ecf206Smrg    the package (albeit without support for automatic dependency tracking).])
37943ecf206Smrg  fi
38043ecf206Smrg  AS_UNSET([am_dirpart])
38143ecf206Smrg  AS_UNSET([am_filepart])
38243ecf206Smrg  AS_UNSET([am_mf])
38343ecf206Smrg  AS_UNSET([am_rc])
38443ecf206Smrg  rm -f conftest-deps.mk
38543ecf206Smrg}
38643ecf206Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387fd0c672fSmrg
388fd0c672fSmrg
38943ecf206Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39043ecf206Smrg# -----------------------------
39143ecf206Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3928846b520Smrg#
39343ecf206Smrg# This code is only required when automatic dependency tracking is enabled.
39443ecf206Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39543ecf206Smrg# order to bootstrap the dependency handling code.
39643ecf206SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39743ecf206Smrg[AC_CONFIG_COMMANDS([depfiles],
39843ecf206Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39943ecf206Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400fd0c672fSmrg
40143ecf206Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402fd0c672fSmrg
40343ecf206Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40443ecf206Smrg#
40543ecf206Smrg# This file is free software; the Free Software Foundation
40643ecf206Smrg# gives unlimited permission to copy and/or distribute it,
40743ecf206Smrg# with or without modifications, as long as this notice is preserved.
408fd0c672fSmrg
40943ecf206Smrg# This macro actually does too much.  Some checks are only needed if
41043ecf206Smrg# your package does certain things.  But this isn't really a big deal.
411fd0c672fSmrg
41243ecf206Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41343ecf206Smrgm4_define([AC_PROG_CC],
41443ecf206Smrgm4_defn([AC_PROG_CC])
41543ecf206Smrg[_AM_PROG_CC_C_O
41643ecf206Smrg])
417fd0c672fSmrg
41843ecf206Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41943ecf206Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42043ecf206Smrg# -----------------------------------------------
42143ecf206Smrg# The call with PACKAGE and VERSION arguments is the old style
42243ecf206Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42343ecf206Smrg# and VERSION should now be passed to AC_INIT and removed from
42443ecf206Smrg# the call to AM_INIT_AUTOMAKE.
42543ecf206Smrg# We support both call styles for the transition.  After
42643ecf206Smrg# the next Automake release, Autoconf can make the AC_INIT
42743ecf206Smrg# arguments mandatory, and then we can depend on a new Autoconf
42843ecf206Smrg# release and drop the old call support.
42943ecf206SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43043ecf206Smrg[AC_PREREQ([2.65])dnl
43143ecf206Smrgm4_ifdef([_$0_ALREADY_INIT],
43243ecf206Smrg  [m4_fatal([$0 expanded multiple times
43343ecf206Smrg]m4_defn([_$0_ALREADY_INIT]))],
43443ecf206Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43543ecf206Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43643ecf206Smrgdnl the ones we care about.
43743ecf206Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43843ecf206SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43943ecf206SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44043ecf206Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44143ecf206Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44243ecf206Smrg  # is not polluted with repeated "-I."
44343ecf206Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44443ecf206Smrg  # test to see if srcdir already configured
44543ecf206Smrg  if test -f $srcdir/config.status; then
44643ecf206Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44743ecf206Smrg  fi
4488846b520Smrgfi
449fd0c672fSmrg
45043ecf206Smrg# test whether we have cygpath
45143ecf206Smrgif test -z "$CYGPATH_W"; then
45243ecf206Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45343ecf206Smrg    CYGPATH_W='cygpath -w'
45443ecf206Smrg  else
45543ecf206Smrg    CYGPATH_W=echo
45643ecf206Smrg  fi
4578846b520Smrgfi
45843ecf206SmrgAC_SUBST([CYGPATH_W])
4598846b520Smrg
46043ecf206Smrg# Define the identity of the package.
46143ecf206Smrgdnl Distinguish between old-style and new-style calls.
46243ecf206Smrgm4_ifval([$2],
46343ecf206Smrg[AC_DIAGNOSE([obsolete],
46443ecf206Smrg             [$0: two- and three-arguments forms are deprecated.])
46543ecf206Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46643ecf206Smrg AC_SUBST([PACKAGE], [$1])dnl
46743ecf206Smrg AC_SUBST([VERSION], [$2])],
46843ecf206Smrg[_AM_SET_OPTIONS([$1])dnl
46943ecf206Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47043ecf206Smrgm4_if(
47143ecf206Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47243ecf206Smrg  [ok:ok],,
47343ecf206Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47443ecf206Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47543ecf206Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476fd0c672fSmrg
47743ecf206Smrg_AM_IF_OPTION([no-define],,
47843ecf206Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47943ecf206Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480fd0c672fSmrg
48143ecf206Smrg# Some tools Automake needs.
48243ecf206SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48343ecf206SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48443ecf206SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48543ecf206SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48643ecf206SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48743ecf206SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48843ecf206SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48943ecf206SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49043ecf206SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49143ecf206SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49243ecf206Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49343ecf206Smrg# dies out for good.  For more background, see:
49443ecf206Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49543ecf206Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49643ecf206SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49743ecf206Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49843ecf206Smrg# system "awk" is bad on some platforms.
49943ecf206SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50043ecf206SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50143ecf206SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50243ecf206Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50343ecf206Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50443ecf206Smrg			     [_AM_PROG_TAR([v7])])])
50543ecf206Smrg_AM_IF_OPTION([no-dependencies],,
50643ecf206Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50743ecf206Smrg		  [_AM_DEPENDENCIES([CC])],
50843ecf206Smrg		  [m4_define([AC_PROG_CC],
50943ecf206Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51043ecf206SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51143ecf206Smrg		  [_AM_DEPENDENCIES([CXX])],
51243ecf206Smrg		  [m4_define([AC_PROG_CXX],
51343ecf206Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51443ecf206SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51543ecf206Smrg		  [_AM_DEPENDENCIES([OBJC])],
51643ecf206Smrg		  [m4_define([AC_PROG_OBJC],
51743ecf206Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51843ecf206SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51943ecf206Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52043ecf206Smrg		  [m4_define([AC_PROG_OBJCXX],
52143ecf206Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52243ecf206Smrg])
52343ecf206Smrg# Variables for tags utilities; see am/tags.am
52443ecf206Smrgif test -z "$CTAGS"; then
52543ecf206Smrg  CTAGS=ctags
52643ecf206Smrgfi
52743ecf206SmrgAC_SUBST([CTAGS])
52843ecf206Smrgif test -z "$ETAGS"; then
52943ecf206Smrg  ETAGS=etags
53043ecf206Smrgfi
53143ecf206SmrgAC_SUBST([ETAGS])
53243ecf206Smrgif test -z "$CSCOPE"; then
53343ecf206Smrg  CSCOPE=cscope
53443ecf206Smrgfi
53543ecf206SmrgAC_SUBST([CSCOPE])
5368846b520Smrg
53743ecf206SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53843ecf206Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53943ecf206Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54043ecf206Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54143ecf206SmrgAC_CONFIG_COMMANDS_PRE(dnl
54243ecf206Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54343ecf206Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5448846b520Smrg
54543ecf206Smrg# POSIX will say in a future version that running "rm -f" with no argument
54643ecf206Smrg# is OK; and we want to be able to make that assumption in our Makefile
54743ecf206Smrg# recipes.  So use an aggressive probe to check that the usage we want is
54843ecf206Smrg# actually supported "in the wild" to an acceptable degree.
54943ecf206Smrg# See automake bug#10828.
55043ecf206Smrg# To make any issue more visible, cause the running configure to be aborted
55143ecf206Smrg# by default if the 'rm' program in use doesn't match our expectations; the
55243ecf206Smrg# user can still override this though.
55343ecf206Smrgif rm -f && rm -fr && rm -rf; then : OK; else
55443ecf206Smrg  cat >&2 <<'END'
55543ecf206SmrgOops!
556fd0c672fSmrg
55743ecf206SmrgYour 'rm' program seems unable to run without file operands specified
55843ecf206Smrgon the command line, even when the '-f' option is present.  This is contrary
55943ecf206Smrgto the behaviour of most rm programs out there, and not conforming with
56043ecf206Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561fd0c672fSmrg
56243ecf206SmrgPlease tell bug-automake@gnu.org about your system, including the value
56343ecf206Smrgof your $PATH and any error possibly output before this message.  This
56443ecf206Smrgcan help us improve future automake versions.
5658846b520Smrg
56643ecf206SmrgEND
56743ecf206Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56843ecf206Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56943ecf206Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57043ecf206Smrg    echo >&2
57143ecf206Smrg  else
57243ecf206Smrg    cat >&2 <<'END'
57343ecf206SmrgAborting the configuration process, to ensure you take notice of the issue.
574fd0c672fSmrg
57543ecf206SmrgYou can download and install GNU coreutils to get an 'rm' implementation
57643ecf206Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577fd0c672fSmrg
57843ecf206SmrgIf you want to complete the configuration process using your problematic
57943ecf206Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58043ecf206Smrgto "yes", and re-run configure.
581953c684bSmrg
58243ecf206SmrgEND
58343ecf206Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58443ecf206Smrg  fi
585fd0c672fSmrgfi
58643ecf206Smrgdnl The trailing newline in this macro's definition is deliberate, for
58743ecf206Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58843ecf206Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58943ecf206Smrg])
590fd0c672fSmrg
59143ecf206Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59243ecf206Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59343ecf206Smrgdnl mangled by Autoconf and run in a shell conditional statement.
59443ecf206Smrgm4_define([_AC_COMPILER_EXEEXT],
59543ecf206Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5968846b520Smrg
59743ecf206Smrg# When config.status generates a header, we must update the stamp-h file.
59843ecf206Smrg# This file resides in the same directory as the config header
59943ecf206Smrg# that is generated.  The stamp files are numbered to have different names.
6008846b520Smrg
60143ecf206Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60243ecf206Smrg# loop where config.status creates the headers, so we can generate
60343ecf206Smrg# our stamp files there.
60443ecf206SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60543ecf206Smrg[# Compute $1's index in $config_headers.
60643ecf206Smrg_am_arg=$1
60743ecf206Smrg_am_stamp_count=1
60843ecf206Smrgfor _am_header in $config_headers :; do
60943ecf206Smrg  case $_am_header in
61043ecf206Smrg    $_am_arg | $_am_arg:* )
61143ecf206Smrg      break ;;
61243ecf206Smrg    * )
61343ecf206Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61443ecf206Smrg  esac
61543ecf206Smrgdone
61643ecf206Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6178846b520Smrg
61843ecf206Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61943ecf206Smrg#
62043ecf206Smrg# This file is free software; the Free Software Foundation
62143ecf206Smrg# gives unlimited permission to copy and/or distribute it,
62243ecf206Smrg# with or without modifications, as long as this notice is preserved.
62343ecf206Smrg
62443ecf206Smrg# AM_PROG_INSTALL_SH
62543ecf206Smrg# ------------------
62643ecf206Smrg# Define $install_sh.
62743ecf206SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62843ecf206Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62943ecf206Smrgif test x"${install_sh+set}" != xset; then
63043ecf206Smrg  case $am_aux_dir in
63143ecf206Smrg  *\ * | *\	*)
63243ecf206Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63343ecf206Smrg  *)
63443ecf206Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63543ecf206Smrg  esac
63643ecf206Smrgfi
63743ecf206SmrgAC_SUBST([install_sh])])
63843ecf206Smrg
63943ecf206Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64043ecf206Smrg#
64143ecf206Smrg# This file is free software; the Free Software Foundation
64243ecf206Smrg# gives unlimited permission to copy and/or distribute it,
64343ecf206Smrg# with or without modifications, as long as this notice is preserved.
64443ecf206Smrg
64543ecf206Smrg# Check whether the underlying file-system supports filenames
64643ecf206Smrg# with a leading dot.  For instance MS-DOS doesn't.
64743ecf206SmrgAC_DEFUN([AM_SET_LEADING_DOT],
64843ecf206Smrg[rm -rf .tst 2>/dev/null
64943ecf206Smrgmkdir .tst 2>/dev/null
65043ecf206Smrgif test -d .tst; then
65143ecf206Smrg  am__leading_dot=.
6528846b520Smrgelse
65343ecf206Smrg  am__leading_dot=_
654fd0c672fSmrgfi
65543ecf206Smrgrmdir .tst 2>/dev/null
65643ecf206SmrgAC_SUBST([am__leading_dot])])
657fd0c672fSmrg
65843ecf206Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659fd0c672fSmrg
66043ecf206Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66143ecf206Smrg#
66243ecf206Smrg# This file is free software; the Free Software Foundation
66343ecf206Smrg# gives unlimited permission to copy and/or distribute it,
66443ecf206Smrg# with or without modifications, as long as this notice is preserved.
665fd0c672fSmrg
66643ecf206Smrg# AM_MAKE_INCLUDE()
66743ecf206Smrg# -----------------
66843ecf206Smrg# Check whether make has an 'include' directive that can support all
66943ecf206Smrg# the idioms we need for our automatic dependency tracking code.
67043ecf206SmrgAC_DEFUN([AM_MAKE_INCLUDE],
67143ecf206Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
67243ecf206Smrgcat > confinc.mk << 'END'
67343ecf206Smrgam__doit:
67443ecf206Smrg	@echo this is the am__doit target >confinc.out
67543ecf206Smrg.PHONY: am__doit
67643ecf206SmrgEND
67743ecf206Smrgam__include="#"
67843ecf206Smrgam__quote=
67943ecf206Smrg# BSD make does it like this.
68043ecf206Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
68143ecf206Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
68243ecf206Smrgecho 'include confinc.mk # ignored' > confmf.GNU
68343ecf206Smrg_am_result=no
68443ecf206Smrgfor s in GNU BSD; do
68543ecf206Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
68643ecf206Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
68743ecf206Smrg      ['0:this is the am__doit target'],
68843ecf206Smrg      [AS_CASE([$s],
68943ecf206Smrg          [BSD], [am__include='.include' am__quote='"'],
69043ecf206Smrg          [am__include='include' am__quote=''])])
69143ecf206Smrg  if test "$am__include" != "#"; then
69243ecf206Smrg    _am_result="yes ($s style)"
69343ecf206Smrg    break
69443ecf206Smrg  fi
69543ecf206Smrgdone
69643ecf206Smrgrm -f confinc.* confmf.*
69743ecf206SmrgAC_MSG_RESULT([${_am_result}])
69843ecf206SmrgAC_SUBST([am__include])])
69943ecf206SmrgAC_SUBST([am__quote])])
700fd0c672fSmrg
70143ecf206Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702953c684bSmrg
70343ecf206Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
7048846b520Smrg#
70543ecf206Smrg# This file is free software; the Free Software Foundation
70643ecf206Smrg# gives unlimited permission to copy and/or distribute it,
70743ecf206Smrg# with or without modifications, as long as this notice is preserved.
708953c684bSmrg
70943ecf206Smrg# AM_MISSING_PROG(NAME, PROGRAM)
71043ecf206Smrg# ------------------------------
71143ecf206SmrgAC_DEFUN([AM_MISSING_PROG],
71243ecf206Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71343ecf206Smrg$1=${$1-"${am_missing_run}$2"}
71443ecf206SmrgAC_SUBST($1)])
715953c684bSmrg
71643ecf206Smrg# AM_MISSING_HAS_RUN
71743ecf206Smrg# ------------------
71843ecf206Smrg# Define MISSING if not defined so far and test if it is modern enough.
71943ecf206Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72043ecf206SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72143ecf206Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72243ecf206SmrgAC_REQUIRE_AUX_FILE([missing])dnl
72343ecf206Smrgif test x"${MISSING+set}" != xset; then
72443ecf206Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
7258846b520Smrgfi
72643ecf206Smrg# Use eval to expand $SHELL
72743ecf206Smrgif eval "$MISSING --is-lightweight"; then
72843ecf206Smrg  am_missing_run="$MISSING "
72943ecf206Smrgelse
73043ecf206Smrg  am_missing_run=
73143ecf206Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7328846b520Smrgfi
73343ecf206Smrg])
734953c684bSmrg
73543ecf206Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736953c684bSmrg
73743ecf206Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73843ecf206Smrg#
73943ecf206Smrg# This file is free software; the Free Software Foundation
74043ecf206Smrg# gives unlimited permission to copy and/or distribute it,
74143ecf206Smrg# with or without modifications, as long as this notice is preserved.
74248e69166Smrg
74343ecf206Smrg# _AM_MANGLE_OPTION(NAME)
74443ecf206Smrg# -----------------------
74543ecf206SmrgAC_DEFUN([_AM_MANGLE_OPTION],
74643ecf206Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747fd0c672fSmrg
74843ecf206Smrg# _AM_SET_OPTION(NAME)
74943ecf206Smrg# --------------------
75043ecf206Smrg# Set option NAME.  Presently that only means defining a flag for this option.
75143ecf206SmrgAC_DEFUN([_AM_SET_OPTION],
75243ecf206Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753fd0c672fSmrg
75443ecf206Smrg# _AM_SET_OPTIONS(OPTIONS)
75543ecf206Smrg# ------------------------
75643ecf206Smrg# OPTIONS is a space-separated list of Automake options.
75743ecf206SmrgAC_DEFUN([_AM_SET_OPTIONS],
75843ecf206Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75943ecf206Smrg
76043ecf206Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76143ecf206Smrg# -------------------------------------------
76243ecf206Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76343ecf206SmrgAC_DEFUN([_AM_IF_OPTION],
76443ecf206Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76543ecf206Smrg
76643ecf206Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
7678846b520Smrg#
76843ecf206Smrg# This file is free software; the Free Software Foundation
76943ecf206Smrg# gives unlimited permission to copy and/or distribute it,
77043ecf206Smrg# with or without modifications, as long as this notice is preserved.
771fd0c672fSmrg
77243ecf206Smrg# _AM_PROG_CC_C_O
77343ecf206Smrg# ---------------
77443ecf206Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77543ecf206Smrg# to automatically call this.
77643ecf206SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77743ecf206Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77843ecf206SmrgAC_REQUIRE_AUX_FILE([compile])dnl
77943ecf206SmrgAC_LANG_PUSH([C])dnl
78043ecf206SmrgAC_CACHE_CHECK(
78143ecf206Smrg  [whether $CC understands -c and -o together],
78243ecf206Smrg  [am_cv_prog_cc_c_o],
78343ecf206Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78443ecf206Smrg  # Make sure it works both with $CC and with simple cc.
78543ecf206Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78643ecf206Smrg  # compilers refuse to overwrite an existing .o file with -o,
78743ecf206Smrg  # though they will create one.
78843ecf206Smrg  am_cv_prog_cc_c_o=yes
78943ecf206Smrg  for am_i in 1 2; do
79043ecf206Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79143ecf206Smrg         && test -f conftest2.$ac_objext; then
79243ecf206Smrg      : OK
79343ecf206Smrg    else
79443ecf206Smrg      am_cv_prog_cc_c_o=no
79543ecf206Smrg      break
79643ecf206Smrg    fi
79743ecf206Smrg  done
79843ecf206Smrg  rm -f core conftest*
79943ecf206Smrg  unset am_i])
80043ecf206Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80143ecf206Smrg   # Losing compiler, so override with the script.
80243ecf206Smrg   # FIXME: It is wrong to rewrite CC.
80343ecf206Smrg   # But if we don't then we get into trouble of one sort or another.
80443ecf206Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80543ecf206Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80643ecf206Smrg   CC="$am_aux_dir/compile $CC"
807fd0c672fSmrgfi
80843ecf206SmrgAC_LANG_POP([C])])
809fd0c672fSmrg
81043ecf206Smrg# For backward compatibility.
81143ecf206SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812fd0c672fSmrg
81343ecf206Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814fd0c672fSmrg#
81543ecf206Smrg# This file is free software; the Free Software Foundation
81643ecf206Smrg# gives unlimited permission to copy and/or distribute it,
81743ecf206Smrg# with or without modifications, as long as this notice is preserved.
818fd0c672fSmrg
81943ecf206Smrg# AM_RUN_LOG(COMMAND)
82043ecf206Smrg# -------------------
82143ecf206Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82243ecf206Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82343ecf206SmrgAC_DEFUN([AM_RUN_LOG],
82443ecf206Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82543ecf206Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82643ecf206Smrg   ac_status=$?
82743ecf206Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82843ecf206Smrg   (exit $ac_status); }])
82943ecf206Smrg
83043ecf206Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83143ecf206Smrg
83243ecf206Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833fd0c672fSmrg#
83443ecf206Smrg# This file is free software; the Free Software Foundation
83543ecf206Smrg# gives unlimited permission to copy and/or distribute it,
83643ecf206Smrg# with or without modifications, as long as this notice is preserved.
837fd0c672fSmrg
83843ecf206Smrg# AM_SANITY_CHECK
83943ecf206Smrg# ---------------
84043ecf206SmrgAC_DEFUN([AM_SANITY_CHECK],
84143ecf206Smrg[AC_MSG_CHECKING([whether build environment is sane])
84243ecf206Smrg# Reject unsafe characters in $srcdir or the absolute working directory
84343ecf206Smrg# name.  Accept space and tab only in the latter.
84443ecf206Smrgam_lf='
84543ecf206Smrg'
84643ecf206Smrgcase `pwd` in
84743ecf206Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84843ecf206Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84943ecf206Smrgesac
85043ecf206Smrgcase $srcdir in
85143ecf206Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85243ecf206Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85343ecf206Smrgesac
85443ecf206Smrg
85543ecf206Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85643ecf206Smrg# arguments.  Must try -L first in case configure is actually a
85743ecf206Smrg# symlink; some systems play weird games with the mod time of symlinks
85843ecf206Smrg# (eg FreeBSD returns the mod time of the symlink's containing
85943ecf206Smrg# directory).
86043ecf206Smrgif (
86143ecf206Smrg   am_has_slept=no
86243ecf206Smrg   for am_try in 1 2; do
86343ecf206Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86443ecf206Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86543ecf206Smrg     if test "$[*]" = "X"; then
86643ecf206Smrg	# -L didn't work.
86743ecf206Smrg	set X `ls -t "$srcdir/configure" conftest.file`
86843ecf206Smrg     fi
86943ecf206Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87043ecf206Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87143ecf206Smrg
87243ecf206Smrg	# If neither matched, then we have a broken ls.  This can happen
87343ecf206Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87443ecf206Smrg	# broken ls alias from the environment.  This has actually
87543ecf206Smrg	# happened.  Such a system could not be considered "sane".
87643ecf206Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87743ecf206Smrg  alias in your environment])
87843ecf206Smrg     fi
87943ecf206Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88043ecf206Smrg       break
88143ecf206Smrg     fi
88243ecf206Smrg     # Just in case.
88343ecf206Smrg     sleep 1
88443ecf206Smrg     am_has_slept=yes
88543ecf206Smrg   done
88643ecf206Smrg   test "$[2]" = conftest.file
88743ecf206Smrg   )
88843ecf206Smrgthen
88943ecf206Smrg   # Ok.
89043ecf206Smrg   :
891fd0c672fSmrgelse
89243ecf206Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
89343ecf206SmrgCheck your system clock])
894fd0c672fSmrgfi
89543ecf206SmrgAC_MSG_RESULT([yes])
89643ecf206Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89743ecf206Smrg# generated files are strictly newer.
89843ecf206Smrgam_sleep_pid=
89943ecf206Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90043ecf206Smrg  ( sleep 1 ) &
90143ecf206Smrg  am_sleep_pid=$!
90243ecf206Smrgfi
90343ecf206SmrgAC_CONFIG_COMMANDS_PRE(
90443ecf206Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90543ecf206Smrg   if test -n "$am_sleep_pid"; then
90643ecf206Smrg     # Hide warnings about reused PIDs.
90743ecf206Smrg     wait $am_sleep_pid 2>/dev/null
90843ecf206Smrg   fi
90943ecf206Smrg   AC_MSG_RESULT([done])])
91043ecf206Smrgrm -f conftest.file
91143ecf206Smrg])
912fd0c672fSmrg
91343ecf206Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9148846b520Smrg#
91543ecf206Smrg# This file is free software; the Free Software Foundation
91643ecf206Smrg# gives unlimited permission to copy and/or distribute it,
91743ecf206Smrg# with or without modifications, as long as this notice is preserved.
918953c684bSmrg
91943ecf206Smrg# AM_SILENT_RULES([DEFAULT])
92043ecf206Smrg# --------------------------
92143ecf206Smrg# Enable less verbose build rules; with the default set to DEFAULT
92243ecf206Smrg# ("yes" being less verbose, "no" or empty being verbose).
92343ecf206SmrgAC_DEFUN([AM_SILENT_RULES],
92443ecf206Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92543ecf206SmrgAS_HELP_STRING(
92643ecf206Smrg  [--enable-silent-rules],
92743ecf206Smrg  [less verbose build output (undo: "make V=1")])
92843ecf206SmrgAS_HELP_STRING(
92943ecf206Smrg  [--disable-silent-rules],
93043ecf206Smrg  [verbose build output (undo: "make V=0")])dnl
93143ecf206Smrg])
93243ecf206Smrgcase $enable_silent_rules in @%:@ (((
93343ecf206Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93443ecf206Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93543ecf206Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93643ecf206Smrgesac
93743ecf206Smrgdnl
93843ecf206Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93943ecf206Smrgdnl do not support nested variable expansions.
94043ecf206Smrgdnl See automake bug#9928 and bug#10237.
94143ecf206Smrgam_make=${MAKE-make}
94243ecf206SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94343ecf206Smrg   [am_cv_make_support_nested_variables],
94443ecf206Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94543ecf206SmrgBAR0=false
94643ecf206SmrgBAR1=true
94743ecf206SmrgV=1
94843ecf206Smrgam__doit:
94943ecf206Smrg	@$(TRUE)
95043ecf206Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95143ecf206Smrg  am_cv_make_support_nested_variables=yes
9528846b520Smrgelse
95343ecf206Smrg  am_cv_make_support_nested_variables=no
95443ecf206Smrgfi])
95543ecf206Smrgif test $am_cv_make_support_nested_variables = yes; then
95643ecf206Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95743ecf206Smrg  AM_V='$(V)'
95843ecf206Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95943ecf206Smrgelse
96043ecf206Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96143ecf206Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962953c684bSmrgfi
96343ecf206SmrgAC_SUBST([AM_V])dnl
96443ecf206SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96543ecf206SmrgAC_SUBST([AM_DEFAULT_V])dnl
96643ecf206SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96743ecf206SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96843ecf206SmrgAM_BACKSLASH='\'
96943ecf206SmrgAC_SUBST([AM_BACKSLASH])dnl
97043ecf206Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97143ecf206Smrg])
972953c684bSmrg
97343ecf206Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
9748846b520Smrg#
97543ecf206Smrg# This file is free software; the Free Software Foundation
97643ecf206Smrg# gives unlimited permission to copy and/or distribute it,
97743ecf206Smrg# with or without modifications, as long as this notice is preserved.
978953c684bSmrg
97943ecf206Smrg# AM_PROG_INSTALL_STRIP
98043ecf206Smrg# ---------------------
98143ecf206Smrg# One issue with vendor 'install' (even GNU) is that you can't
98243ecf206Smrg# specify the program used to strip binaries.  This is especially
98343ecf206Smrg# annoying in cross-compiling environments, where the build's strip
98443ecf206Smrg# is unlikely to handle the host's binaries.
98543ecf206Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98643ecf206Smrg# always use install-sh in "make install-strip", and initialize
98743ecf206Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
98843ecf206SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98943ecf206Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99043ecf206Smrg# Installed binaries are usually stripped using 'strip' when the user
99143ecf206Smrg# run "make install-strip".  However 'strip' might not be the right
99243ecf206Smrg# tool to use in cross-compilation environments, therefore Automake
99343ecf206Smrg# will honor the 'STRIP' environment variable to overrule this program.
99443ecf206Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99543ecf206Smrgif test "$cross_compiling" != no; then
99643ecf206Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
997953c684bSmrgfi
99843ecf206SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99943ecf206SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1000fd0c672fSmrg
100143ecf206Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
10028846b520Smrg#
100343ecf206Smrg# This file is free software; the Free Software Foundation
100443ecf206Smrg# gives unlimited permission to copy and/or distribute it,
100543ecf206Smrg# with or without modifications, as long as this notice is preserved.
100648e69166Smrg
100743ecf206Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
100843ecf206Smrg# ---------------------------
100943ecf206Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101043ecf206Smrg# This macro is traced by Automake.
101143ecf206SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10128846b520Smrg
101343ecf206Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101443ecf206Smrg# --------------------------
101543ecf206Smrg# Public sister of _AM_SUBST_NOTMAKE.
101643ecf206SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101748e69166Smrg
101843ecf206Smrg# Check how to create a tarball.                            -*- Autoconf -*-
10198846b520Smrg
102043ecf206Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
10218846b520Smrg#
102243ecf206Smrg# This file is free software; the Free Software Foundation
102343ecf206Smrg# gives unlimited permission to copy and/or distribute it,
102443ecf206Smrg# with or without modifications, as long as this notice is preserved.
102543ecf206Smrg
102643ecf206Smrg# _AM_PROG_TAR(FORMAT)
102743ecf206Smrg# --------------------
102843ecf206Smrg# Check how to create a tarball in format FORMAT.
102943ecf206Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10308846b520Smrg#
103143ecf206Smrg# Substitute a variable $(am__tar) that is a command
103243ecf206Smrg# writing to stdout a FORMAT-tarball containing the directory
103343ecf206Smrg# $tardir.
103443ecf206Smrg#     tardir=directory && $(am__tar) > result.tar
10358846b520Smrg#
103643ecf206Smrg# Substitute a variable $(am__untar) that extract such
103743ecf206Smrg# a tarball read from stdin.
103843ecf206Smrg#     $(am__untar) < result.tar
10398846b520Smrg#
104043ecf206SmrgAC_DEFUN([_AM_PROG_TAR],
104143ecf206Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104243ecf206Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104343ecf206SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044fd0c672fSmrg
104543ecf206Smrg# We'll loop over all known methods to create a tar archive until one works.
104643ecf206Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
104748e69166Smrg
104843ecf206Smrgm4_if([$1], [v7],
104943ecf206Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
105048e69166Smrg
105143ecf206Smrg  [m4_case([$1],
105243ecf206Smrg    [ustar],
105343ecf206Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105443ecf206Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105543ecf206Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105643ecf206Smrg      # and bug#13588).
105743ecf206Smrg      am_max_uid=2097151 # 2^21 - 1
105843ecf206Smrg      am_max_gid=$am_max_uid
105943ecf206Smrg      # The $UID and $GID variables are not portable, so we need to resort
106043ecf206Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106143ecf206Smrg      # below are definitely unexpected, so allow the users to see them
106243ecf206Smrg      # (that is, avoid stderr redirection).
106343ecf206Smrg      am_uid=`id -u || echo unknown`
106443ecf206Smrg      am_gid=`id -g || echo unknown`
106543ecf206Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106643ecf206Smrg      if test $am_uid -le $am_max_uid; then
106743ecf206Smrg         AC_MSG_RESULT([yes])
106843ecf206Smrg      else
106943ecf206Smrg         AC_MSG_RESULT([no])
107043ecf206Smrg         _am_tools=none
107143ecf206Smrg      fi
107243ecf206Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107343ecf206Smrg      if test $am_gid -le $am_max_gid; then
107443ecf206Smrg         AC_MSG_RESULT([yes])
107543ecf206Smrg      else
107643ecf206Smrg        AC_MSG_RESULT([no])
107743ecf206Smrg        _am_tools=none
107843ecf206Smrg      fi],
1079a8bb11d0Smrg
108043ecf206Smrg  [pax],
108143ecf206Smrg    [],
1082fd0c672fSmrg
108343ecf206Smrg  [m4_fatal([Unknown tar format])])
1084fd0c672fSmrg
108543ecf206Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086fd0c672fSmrg
108743ecf206Smrg  # Go ahead even if we have the value already cached.  We do so because we
108843ecf206Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108943ecf206Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090fd0c672fSmrg
109143ecf206Smrg  for _am_tool in $_am_tools; do
109243ecf206Smrg    case $_am_tool in
109343ecf206Smrg    gnutar)
109443ecf206Smrg      for _am_tar in tar gnutar gtar; do
109543ecf206Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109643ecf206Smrg      done
109743ecf206Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109843ecf206Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109943ecf206Smrg      am__untar="$_am_tar -xf -"
110043ecf206Smrg      ;;
110143ecf206Smrg    plaintar)
110243ecf206Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110343ecf206Smrg      # ustar tarball either.
110443ecf206Smrg      (tar --version) >/dev/null 2>&1 && continue
110543ecf206Smrg      am__tar='tar chf - "$$tardir"'
110643ecf206Smrg      am__tar_='tar chf - "$tardir"'
110743ecf206Smrg      am__untar='tar xf -'
110843ecf206Smrg      ;;
110943ecf206Smrg    pax)
111043ecf206Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111143ecf206Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111243ecf206Smrg      am__untar='pax -r'
111343ecf206Smrg      ;;
111443ecf206Smrg    cpio)
111543ecf206Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111643ecf206Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111743ecf206Smrg      am__untar='cpio -i -H $1 -d'
111843ecf206Smrg      ;;
111943ecf206Smrg    none)
112043ecf206Smrg      am__tar=false
112143ecf206Smrg      am__tar_=false
112243ecf206Smrg      am__untar=false
112343ecf206Smrg      ;;
112443ecf206Smrg    esac
1125fd0c672fSmrg
112643ecf206Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112743ecf206Smrg    # and am__untar set.
112843ecf206Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129fd0c672fSmrg
113043ecf206Smrg    # tar/untar a dummy directory, and stop if the command works.
113143ecf206Smrg    rm -rf conftest.dir
113243ecf206Smrg    mkdir conftest.dir
113343ecf206Smrg    echo GrepMe > conftest.dir/file
113443ecf206Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113543ecf206Smrg    rm -rf conftest.dir
113643ecf206Smrg    if test -s conftest.tar; then
113743ecf206Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
113843ecf206Smrg      AM_RUN_LOG([cat conftest.dir/file])
113943ecf206Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114043ecf206Smrg    fi
114143ecf206Smrg  done
114243ecf206Smrg  rm -rf conftest.dir
1143fd0c672fSmrg
114443ecf206Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114543ecf206Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146fd0c672fSmrg
114743ecf206SmrgAC_SUBST([am__tar])
114843ecf206SmrgAC_SUBST([am__untar])
114943ecf206Smrg]) # _AM_PROG_TAR
1150fd0c672fSmrg
115143ecf206Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
115243ecf206Smrgdnl serial 11 (pkg-config-0.29)
115343ecf206Smrgdnl
115443ecf206Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115543ecf206Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
115643ecf206Smrgdnl
115743ecf206Smrgdnl This program is free software; you can redistribute it and/or modify
115843ecf206Smrgdnl it under the terms of the GNU General Public License as published by
115943ecf206Smrgdnl the Free Software Foundation; either version 2 of the License, or
116043ecf206Smrgdnl (at your option) any later version.
116143ecf206Smrgdnl
116243ecf206Smrgdnl This program is distributed in the hope that it will be useful, but
116343ecf206Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
116443ecf206Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
116543ecf206Smrgdnl General Public License for more details.
116643ecf206Smrgdnl
116743ecf206Smrgdnl You should have received a copy of the GNU General Public License
116843ecf206Smrgdnl along with this program; if not, write to the Free Software
116943ecf206Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
117043ecf206Smrgdnl 02111-1307, USA.
117143ecf206Smrgdnl
117243ecf206Smrgdnl As a special exception to the GNU General Public License, if you
117343ecf206Smrgdnl distribute this file as part of a program that contains a
117443ecf206Smrgdnl configuration script generated by Autoconf, you may include it under
117543ecf206Smrgdnl the same distribution terms that you use for the rest of that
117643ecf206Smrgdnl program.
1177fd0c672fSmrg
117843ecf206Smrgdnl PKG_PREREQ(MIN-VERSION)
117943ecf206Smrgdnl -----------------------
118043ecf206Smrgdnl Since: 0.29
118143ecf206Smrgdnl
118243ecf206Smrgdnl Verify that the version of the pkg-config macros are at least
118343ecf206Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
118443ecf206Smrgdnl installed version of pkg-config, this checks the developer's version
118543ecf206Smrgdnl of pkg.m4 when generating configure.
118643ecf206Smrgdnl
118743ecf206Smrgdnl To ensure that this macro is defined, also add:
118843ecf206Smrgdnl m4_ifndef([PKG_PREREQ],
118943ecf206Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
119043ecf206Smrgdnl
119143ecf206Smrgdnl See the "Since" comment for each macro you use to see what version
119243ecf206Smrgdnl of the macros you require.
119343ecf206Smrgm4_defun([PKG_PREREQ],
119443ecf206Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
119543ecf206Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
119643ecf206Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
119743ecf206Smrg])dnl PKG_PREREQ
1198fd0c672fSmrg
119943ecf206Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
120043ecf206Smrgdnl ----------------------------------
120143ecf206Smrgdnl Since: 0.16
120243ecf206Smrgdnl
120343ecf206Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
120443ecf206Smrgdnl first found in the path. Checks that the version of pkg-config found
120543ecf206Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
120643ecf206Smrgdnl used since that's the first version where most current features of
120743ecf206Smrgdnl pkg-config existed.
120843ecf206SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120943ecf206Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
121043ecf206Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
121143ecf206Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
121243ecf206SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
121343ecf206SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
121443ecf206SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215fd0c672fSmrg
121643ecf206Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121743ecf206Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218fd0c672fSmrgfi
121943ecf206Smrgif test -n "$PKG_CONFIG"; then
122043ecf206Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
122143ecf206Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122243ecf206Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122343ecf206Smrg		AC_MSG_RESULT([yes])
122443ecf206Smrg	else
122543ecf206Smrg		AC_MSG_RESULT([no])
122643ecf206Smrg		PKG_CONFIG=""
122743ecf206Smrg	fi
122843ecf206Smrgfi[]dnl
122943ecf206Smrg])dnl PKG_PROG_PKG_CONFIG
1230fd0c672fSmrg
123143ecf206Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
123243ecf206Smrgdnl -------------------------------------------------------------------
123343ecf206Smrgdnl Since: 0.18
123443ecf206Smrgdnl
123543ecf206Smrgdnl Check to see whether a particular set of modules exists. Similar to
123643ecf206Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
123743ecf206Smrgdnl
123843ecf206Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123943ecf206Smrgdnl only at the first occurence in configure.ac, so if the first place
124043ecf206Smrgdnl it's called might be skipped (such as if it is within an "if", you
124143ecf206Smrgdnl have to call PKG_CHECK_EXISTS manually
124243ecf206SmrgAC_DEFUN([PKG_CHECK_EXISTS],
124343ecf206Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124443ecf206Smrgif test -n "$PKG_CONFIG" && \
124543ecf206Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
124643ecf206Smrg  m4_default([$2], [:])
124743ecf206Smrgm4_ifvaln([$3], [else
124843ecf206Smrg  $3])dnl
124943ecf206Smrgfi])
125043ecf206Smrg
125143ecf206Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
125243ecf206Smrgdnl ---------------------------------------------
125343ecf206Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
125443ecf206Smrgdnl pkg_failed based on the result.
125543ecf206Smrgm4_define([_PKG_CONFIG],
125643ecf206Smrg[if test -n "$$1"; then
125743ecf206Smrg    pkg_cv_[]$1="$$1"
125843ecf206Smrg elif test -n "$PKG_CONFIG"; then
125943ecf206Smrg    PKG_CHECK_EXISTS([$3],
126043ecf206Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
126143ecf206Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
126243ecf206Smrg		     [pkg_failed=yes])
126343ecf206Smrg else
126443ecf206Smrg    pkg_failed=untried
126543ecf206Smrgfi[]dnl
126643ecf206Smrg])dnl _PKG_CONFIG
126743ecf206Smrg
126843ecf206Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
126943ecf206Smrgdnl ---------------------------
127043ecf206Smrgdnl Internal check to see if pkg-config supports short errors.
127143ecf206SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127243ecf206Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127343ecf206Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127443ecf206Smrg        _pkg_short_errors_supported=yes
12758846b520Smrgelse
127643ecf206Smrg        _pkg_short_errors_supported=no
127743ecf206Smrgfi[]dnl
127843ecf206Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279fd0c672fSmrg
128048e69166Smrg
128143ecf206Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
128243ecf206Smrgdnl   [ACTION-IF-NOT-FOUND])
128343ecf206Smrgdnl --------------------------------------------------------------
128443ecf206Smrgdnl Since: 0.4.0
128543ecf206Smrgdnl
128643ecf206Smrgdnl Note that if there is a possibility the first call to
128743ecf206Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
128843ecf206Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128943ecf206SmrgAC_DEFUN([PKG_CHECK_MODULES],
129043ecf206Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129143ecf206SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129243ecf206SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293fd0c672fSmrg
129443ecf206Smrgpkg_failed=no
129543ecf206SmrgAC_MSG_CHECKING([for $1])
129648e69166Smrg
129743ecf206Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129843ecf206Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
129948e69166Smrg
130043ecf206Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130143ecf206Smrgand $1[]_LIBS to avoid the need to call pkg-config.
130243ecf206SmrgSee the pkg-config man page for more details.])
130348e69166Smrg
130443ecf206Smrgif test $pkg_failed = yes; then
130543ecf206Smrg   	AC_MSG_RESULT([no])
130643ecf206Smrg        _PKG_SHORT_ERRORS_SUPPORTED
130743ecf206Smrg        if test $_pkg_short_errors_supported = yes; then
130843ecf206Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130943ecf206Smrg        else 
131043ecf206Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131143ecf206Smrg        fi
131243ecf206Smrg	# Put the nasty error message in config.log where it belongs
131343ecf206Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314fd0c672fSmrg
131543ecf206Smrg	m4_default([$4], [AC_MSG_ERROR(
131643ecf206Smrg[Package requirements ($2) were not met:
1317fd0c672fSmrg
131843ecf206Smrg$$1_PKG_ERRORS
131943ecf206Smrg
132043ecf206SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132143ecf206Smrginstalled software in a non-standard prefix.
132243ecf206Smrg
132343ecf206Smrg_PKG_TEXT])[]dnl
132443ecf206Smrg        ])
132543ecf206Smrgelif test $pkg_failed = untried; then
132643ecf206Smrg     	AC_MSG_RESULT([no])
132743ecf206Smrg	m4_default([$4], [AC_MSG_FAILURE(
132843ecf206Smrg[The pkg-config script could not be found or is too old.  Make sure it
132943ecf206Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
133043ecf206Smrgpath to pkg-config.
133143ecf206Smrg
133243ecf206Smrg_PKG_TEXT
133343ecf206Smrg
133443ecf206SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
133543ecf206Smrg        ])
1336fd0c672fSmrgelse
133743ecf206Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133843ecf206Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133943ecf206Smrg        AC_MSG_RESULT([yes])
134043ecf206Smrg	$3
134143ecf206Smrgfi[]dnl
134243ecf206Smrg])dnl PKG_CHECK_MODULES
1343fd0c672fSmrg
1344fd0c672fSmrg
134543ecf206Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
134643ecf206Smrgdnl   [ACTION-IF-NOT-FOUND])
134743ecf206Smrgdnl ---------------------------------------------------------------------
134843ecf206Smrgdnl Since: 0.29
134943ecf206Smrgdnl
135043ecf206Smrgdnl Checks for existence of MODULES and gathers its build flags with
135143ecf206Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
135243ecf206Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
135343ecf206Smrgdnl
135443ecf206Smrgdnl Note that if there is a possibility the first call to
135543ecf206Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
135643ecf206Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
135743ecf206Smrgdnl configure.ac.
135843ecf206SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
135943ecf206Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
136043ecf206Smrg_save_PKG_CONFIG=$PKG_CONFIG
136143ecf206SmrgPKG_CONFIG="$PKG_CONFIG --static"
136243ecf206SmrgPKG_CHECK_MODULES($@)
136343ecf206SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
136443ecf206Smrg])dnl PKG_CHECK_MODULES_STATIC
1365fd0c672fSmrg
1366fd0c672fSmrg
136743ecf206Smrgdnl PKG_INSTALLDIR([DIRECTORY])
136843ecf206Smrgdnl -------------------------
136943ecf206Smrgdnl Since: 0.27
137043ecf206Smrgdnl
137143ecf206Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
137243ecf206Smrgdnl should install pkg-config .pc files. By default the directory is
137343ecf206Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
137443ecf206Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
137543ecf206Smrgdnl parameter.
137643ecf206SmrgAC_DEFUN([PKG_INSTALLDIR],
137743ecf206Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
137843ecf206Smrgm4_pushdef([pkg_description],
137943ecf206Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
138043ecf206SmrgAC_ARG_WITH([pkgconfigdir],
138143ecf206Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
138243ecf206Smrg    [with_pkgconfigdir=]pkg_default)
138343ecf206SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
138443ecf206Smrgm4_popdef([pkg_default])
138543ecf206Smrgm4_popdef([pkg_description])
138643ecf206Smrg])dnl PKG_INSTALLDIR
138743ecf206Smrg
138843ecf206Smrg
138943ecf206Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
139043ecf206Smrgdnl --------------------------------
139143ecf206Smrgdnl Since: 0.27
139243ecf206Smrgdnl
139343ecf206Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
139443ecf206Smrgdnl module should install arch-independent pkg-config .pc files. By
139543ecf206Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
139643ecf206Smrgdnl changed by passing DIRECTORY. The user can override through the
139743ecf206Smrgdnl --with-noarch-pkgconfigdir parameter.
139843ecf206SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
139943ecf206Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
140043ecf206Smrgm4_pushdef([pkg_description],
140143ecf206Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
140243ecf206SmrgAC_ARG_WITH([noarch-pkgconfigdir],
140343ecf206Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
140443ecf206Smrg    [with_noarch_pkgconfigdir=]pkg_default)
140543ecf206SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
140643ecf206Smrgm4_popdef([pkg_default])
140743ecf206Smrgm4_popdef([pkg_description])
140843ecf206Smrg])dnl PKG_NOARCH_INSTALLDIR
140943ecf206Smrg
1410fd0c672fSmrg
141143ecf206Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
141243ecf206Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
141343ecf206Smrgdnl -------------------------------------------
141443ecf206Smrgdnl Since: 0.28
141543ecf206Smrgdnl
141643ecf206Smrgdnl Retrieves the value of the pkg-config variable for the given module.
141743ecf206SmrgAC_DEFUN([PKG_CHECK_VAR],
141843ecf206Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
141943ecf206SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420fd0c672fSmrg
142143ecf206Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
142243ecf206SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423fd0c672fSmrg
142443ecf206SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
142543ecf206Smrg])dnl PKG_CHECK_VAR
1426fd0c672fSmrg
142743ecf206Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142843ecf206Smrgdnl
142983f4f7f0Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
143043ecf206Smrgdnl
143143ecf206Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143243ecf206Smrgdnl copy of this software and associated documentation files (the "Software"),
143343ecf206Smrgdnl to deal in the Software without restriction, including without limitation
143443ecf206Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143543ecf206Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
143643ecf206Smrgdnl Software is furnished to do so, subject to the following conditions:
143743ecf206Smrgdnl
143843ecf206Smrgdnl The above copyright notice and this permission notice (including the next
143943ecf206Smrgdnl paragraph) shall be included in all copies or substantial portions of the
144043ecf206Smrgdnl Software.
144143ecf206Smrgdnl
144243ecf206Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144343ecf206Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144443ecf206Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144543ecf206Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144643ecf206Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144743ecf206Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144843ecf206Smrgdnl DEALINGS IN THE SOFTWARE.
1449fd0c672fSmrg
145043ecf206Smrg# XORG_MACROS_VERSION(required-version)
145143ecf206Smrg# -------------------------------------
14528846b520Smrg# Minimum version: 1.1.0
145348e69166Smrg#
145443ecf206Smrg# If you're using a macro added in Version 1.1 or newer, include this in
145543ecf206Smrg# your configure.ac with the minimum required version, such as:
145643ecf206Smrg# XORG_MACROS_VERSION(1.1)
145748e69166Smrg#
145843ecf206Smrg# To ensure that this macro is defined, also add:
145943ecf206Smrg# m4_ifndef([XORG_MACROS_VERSION],
146043ecf206Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
146148e69166Smrg#
146243ecf206Smrg#
146343ecf206Smrg# See the "minimum version" comment for each macro you use to see what
146443ecf206Smrg# version you require.
146543ecf206Smrgm4_defun([XORG_MACROS_VERSION],[
146683f4f7f0Smrgm4_define([vers_have], [1.20.0])
146743ecf206Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146843ecf206Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
146943ecf206Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147043ecf206Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147143ecf206Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147243ecf206Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147343ecf206Smrgm4_undefine([vers_have])
147443ecf206Smrgm4_undefine([maj_have])
147543ecf206Smrgm4_undefine([maj_needed])
147643ecf206Smrg]) # XORG_MACROS_VERSION
147748e69166Smrg
147843ecf206Smrg# XORG_PROG_RAWCPP()
147943ecf206Smrg# ------------------
148043ecf206Smrg# Minimum version: 1.0.0
148143ecf206Smrg#
148243ecf206Smrg# Find cpp program and necessary flags for use in pre-processing text files
148343ecf206Smrg# such as man pages and config files
148443ecf206SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148543ecf206SmrgAC_REQUIRE([AC_PROG_CPP])
148643ecf206SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148743ecf206Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14888846b520Smrg
148943ecf206Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149043ecf206Smrg# which is not the best choice for supporting other OS'es, but covers most
149143ecf206Smrg# of the ones we need for now.
149243ecf206SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149343ecf206SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149443ecf206Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149543ecf206Smrg	AC_MSG_RESULT([no])
149643ecf206Smrgelse
149743ecf206Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149843ecf206Smrg		RAWCPPFLAGS=-undef
149943ecf206Smrg		AC_MSG_RESULT([yes])
150043ecf206Smrg	# under Cygwin unix is still defined even with -undef
150143ecf206Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150243ecf206Smrg		RAWCPPFLAGS="-undef -ansi"
150343ecf206Smrg		AC_MSG_RESULT([yes, with -ansi])
150443ecf206Smrg	else
150543ecf206Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150643ecf206Smrg	fi
150748e69166Smrgfi
150843ecf206Smrgrm -f conftest.$ac_ext
150948e69166Smrg
151043ecf206SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151143ecf206SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151283f4f7f0Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
151343ecf206Smrg	AC_MSG_RESULT([no])
151443ecf206Smrgelse
151583f4f7f0Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
151643ecf206Smrg		TRADITIONALCPPFLAGS="-traditional"
151743ecf206Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151843ecf206Smrg		AC_MSG_RESULT([yes])
151943ecf206Smrg	else
152043ecf206Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152143ecf206Smrg	fi
152243ecf206Smrgfi
152343ecf206Smrgrm -f conftest.$ac_ext
152443ecf206SmrgAC_SUBST(RAWCPPFLAGS)
152543ecf206SmrgAC_SUBST(TRADITIONALCPPFLAGS)
152643ecf206Smrg]) # XORG_PROG_RAWCPP
152748e69166Smrg
152843ecf206Smrg# XORG_MANPAGE_SECTIONS()
152943ecf206Smrg# -----------------------
153043ecf206Smrg# Minimum version: 1.0.0
1531a8bb11d0Smrg#
153243ecf206Smrg# Determine which sections man pages go in for the different man page types
153343ecf206Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153443ecf206Smrg# Not sure if there's any better way than just hardcoding by OS name.
153543ecf206Smrg# Override default settings by setting environment variables
153643ecf206Smrg# Added MAN_SUBSTS in version 1.8
153743ecf206Smrg# Added AC_PROG_SED in version 1.8
15388846b520Smrg
153943ecf206SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154043ecf206SmrgAC_REQUIRE([AC_CANONICAL_HOST])
154143ecf206SmrgAC_REQUIRE([AC_PROG_SED])
1542a8bb11d0Smrg
154343ecf206Smrgcase $host_os in
154443ecf206Smrg    solaris*)
154543ecf206Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
154643ecf206Smrg        # check for a man page file found in later versions that use
154743ecf206Smrg        # traditional section numbers instead
154843ecf206Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
154943ecf206Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
155043ecf206Smrg        ;;
155143ecf206Smrg    *) SYSV_MAN_SECTIONS=false ;;
155243ecf206Smrgesac
1553a8bb11d0Smrg
155443ecf206Smrgif test x$APP_MAN_SUFFIX = x    ; then
155543ecf206Smrg    APP_MAN_SUFFIX=1
155643ecf206Smrgfi
155743ecf206Smrgif test x$APP_MAN_DIR = x    ; then
155843ecf206Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
155943ecf206Smrgfi
1560a8bb11d0Smrg
156143ecf206Smrgif test x$LIB_MAN_SUFFIX = x    ; then
156243ecf206Smrg    LIB_MAN_SUFFIX=3
156343ecf206Smrgfi
156443ecf206Smrgif test x$LIB_MAN_DIR = x    ; then
156543ecf206Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
156643ecf206Smrgfi
1567a8bb11d0Smrg
156843ecf206Smrgif test x$FILE_MAN_SUFFIX = x    ; then
156943ecf206Smrg    case $SYSV_MAN_SECTIONS in
157043ecf206Smrg	true)				FILE_MAN_SUFFIX=4  ;;
157143ecf206Smrg	*)				FILE_MAN_SUFFIX=5  ;;
157243ecf206Smrg    esac
157343ecf206Smrgfi
157443ecf206Smrgif test x$FILE_MAN_DIR = x    ; then
157543ecf206Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576a8bb11d0Smrgfi
1577a8bb11d0Smrg
157843ecf206Smrgif test x$MISC_MAN_SUFFIX = x    ; then
157943ecf206Smrg    case $SYSV_MAN_SECTIONS in
158043ecf206Smrg	true)				MISC_MAN_SUFFIX=5  ;;
158143ecf206Smrg	*)				MISC_MAN_SUFFIX=7  ;;
158243ecf206Smrg    esac
158343ecf206Smrgfi
158443ecf206Smrgif test x$MISC_MAN_DIR = x    ; then
158543ecf206Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15868846b520Smrgfi
1587a8bb11d0Smrg
158843ecf206Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
158943ecf206Smrg    case $SYSV_MAN_SECTIONS in
159043ecf206Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
159143ecf206Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159243ecf206Smrg    esac
159343ecf206Smrgfi
159443ecf206Smrgif test x$DRIVER_MAN_DIR = x    ; then
159543ecf206Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159643ecf206Smrgfi
15978846b520Smrg
159843ecf206Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
159943ecf206Smrg    case $SYSV_MAN_SECTIONS in
160043ecf206Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
160143ecf206Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160243ecf206Smrg    esac
160343ecf206Smrgfi
160443ecf206Smrgif test x$ADMIN_MAN_DIR = x    ; then
160543ecf206Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160643ecf206Smrgfi
16078846b520Smrg
16088846b520Smrg
160943ecf206SmrgAC_SUBST([APP_MAN_SUFFIX])
161043ecf206SmrgAC_SUBST([LIB_MAN_SUFFIX])
161143ecf206SmrgAC_SUBST([FILE_MAN_SUFFIX])
161243ecf206SmrgAC_SUBST([MISC_MAN_SUFFIX])
161343ecf206SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161443ecf206SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161543ecf206SmrgAC_SUBST([APP_MAN_DIR])
161643ecf206SmrgAC_SUBST([LIB_MAN_DIR])
161743ecf206SmrgAC_SUBST([FILE_MAN_DIR])
161843ecf206SmrgAC_SUBST([MISC_MAN_DIR])
161943ecf206SmrgAC_SUBST([DRIVER_MAN_DIR])
162043ecf206SmrgAC_SUBST([ADMIN_MAN_DIR])
16218846b520Smrg
162243ecf206SmrgXORG_MAN_PAGE="X Version 11"
162343ecf206SmrgAC_SUBST([XORG_MAN_PAGE])
162443ecf206SmrgMAN_SUBSTS="\
162543ecf206Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162643ecf206Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162743ecf206Smrg	-e 's|__xservername__|Xorg|g' \
162843ecf206Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
162943ecf206Smrg	-e 's|__projectroot__|\$(prefix)|g' \
163043ecf206Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163143ecf206Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163243ecf206Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163343ecf206Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163443ecf206Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163543ecf206Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163643ecf206Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163743ecf206SmrgAC_SUBST([MAN_SUBSTS])
16388846b520Smrg
163943ecf206Smrg]) # XORG_MANPAGE_SECTIONS
16408846b520Smrg
164143ecf206Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164243ecf206Smrg# ------------------------
164343ecf206Smrg# Minimum version: 1.7.0
164448e69166Smrg#
164543ecf206Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164643ecf206Smrg# provided by xorg-sgml-doctools, if installed.
164743ecf206SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164843ecf206SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164943ecf206SmrgXORG_SGML_PATH=
165043ecf206SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165143ecf206Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165243ecf206Smrg    [m4_ifval([$1],[:],
165343ecf206Smrg        [if test x"$cross_compiling" != x"yes" ; then
165443ecf206Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165543ecf206Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165643ecf206Smrg         fi])
165743ecf206Smrg    ])
165843ecf206Smrg
165943ecf206Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166043ecf206Smrg# the path and the name of the doc stylesheet
166143ecf206Smrgif test "x$XORG_SGML_PATH" != "x" ; then
166243ecf206Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166343ecf206Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166443ecf206Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166543ecf206Smrgelse
166643ecf206Smrg   AC_MSG_RESULT([no])
166743ecf206Smrgfi
166843ecf206Smrg
166943ecf206SmrgAC_SUBST(XORG_SGML_PATH)
167043ecf206SmrgAC_SUBST(STYLESHEET_SRCDIR)
167143ecf206SmrgAC_SUBST(XSL_STYLESHEET)
167243ecf206SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167343ecf206Smrg]) # XORG_CHECK_SGML_DOCTOOLS
167443ecf206Smrg
167543ecf206Smrg# XORG_CHECK_LINUXDOC
167643ecf206Smrg# -------------------
167743ecf206Smrg# Minimum version: 1.0.0
167848e69166Smrg#
167943ecf206Smrg# Defines the variable MAKE_TEXT if the necessary tools and
168043ecf206Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168143ecf206Smrg# Whether or not the necessary tools and files are found can be checked
168243ecf206Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168343ecf206SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168443ecf206SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168543ecf206SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
168648e69166Smrg
168743ecf206SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16888846b520Smrg
168943ecf206SmrgAC_MSG_CHECKING([whether to build documentation])
169043ecf206Smrg
169143ecf206Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169243ecf206Smrg   BUILDDOC=yes
169348e69166Smrgelse
169443ecf206Smrg   BUILDDOC=no
169548e69166Smrgfi
169648e69166Smrg
169743ecf206SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
169848e69166Smrg
169943ecf206SmrgAC_MSG_RESULT([$BUILDDOC])
17008846b520Smrg
170143ecf206SmrgAC_MSG_CHECKING([whether to build pdf documentation])
170243ecf206Smrg
170343ecf206Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170443ecf206Smrg   BUILDPDFDOC=yes
170543ecf206Smrgelse
170643ecf206Smrg   BUILDPDFDOC=no
170743ecf206Smrgfi
170843ecf206Smrg
170943ecf206SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171043ecf206Smrg
171143ecf206SmrgAC_MSG_RESULT([$BUILDPDFDOC])
171243ecf206Smrg
171343ecf206SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171443ecf206SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171543ecf206SmrgMAKE_PDF="$PS2PDF"
171643ecf206SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171743ecf206Smrg
171843ecf206SmrgAC_SUBST(MAKE_TEXT)
171943ecf206SmrgAC_SUBST(MAKE_PS)
172043ecf206SmrgAC_SUBST(MAKE_PDF)
172143ecf206SmrgAC_SUBST(MAKE_HTML)
172243ecf206Smrg]) # XORG_CHECK_LINUXDOC
172343ecf206Smrg
172443ecf206Smrg# XORG_CHECK_DOCBOOK
172543ecf206Smrg# -------------------
172643ecf206Smrg# Minimum version: 1.0.0
172743ecf206Smrg#
172843ecf206Smrg# Checks for the ability to build output formats from SGML DocBook source.
172943ecf206Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173043ecf206Smrg# indicates whether the necessary tools and files are found and, if set,
173143ecf206Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173243ecf206SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173343ecf206SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
173443ecf206Smrg
173543ecf206SmrgBUILDTXTDOC=no
173643ecf206SmrgBUILDPDFDOC=no
173743ecf206SmrgBUILDPSDOC=no
173843ecf206SmrgBUILDHTMLDOC=no
173943ecf206Smrg
174043ecf206SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174143ecf206SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174243ecf206SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174343ecf206SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17448846b520Smrg
174543ecf206SmrgAC_MSG_CHECKING([whether to build text documentation])
174643ecf206Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174743ecf206Smrg   test x$BUILD_TXTDOC != xno; then
174843ecf206Smrg	BUILDTXTDOC=yes
174943ecf206Smrgfi
175043ecf206SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175143ecf206SmrgAC_MSG_RESULT([$BUILDTXTDOC])
17528846b520Smrg
175343ecf206SmrgAC_MSG_CHECKING([whether to build PDF documentation])
175443ecf206Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175543ecf206Smrg   test x$BUILD_PDFDOC != xno; then
175643ecf206Smrg	BUILDPDFDOC=yes
175743ecf206Smrgfi
175843ecf206SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175943ecf206SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17608846b520Smrg
176143ecf206SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176243ecf206Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176343ecf206Smrg   test x$BUILD_PSDOC != xno; then
176443ecf206Smrg	BUILDPSDOC=yes
176548e69166Smrgfi
176643ecf206SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176743ecf206SmrgAC_MSG_RESULT([$BUILDPSDOC])
176848e69166Smrg
176943ecf206SmrgAC_MSG_CHECKING([whether to build HTML documentation])
177043ecf206Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177143ecf206Smrg   test x$BUILD_HTMLDOC != xno; then
177243ecf206Smrg	BUILDHTMLDOC=yes
177343ecf206Smrgfi
177443ecf206SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177543ecf206SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17768846b520Smrg
177743ecf206SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177843ecf206SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177943ecf206SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178043ecf206SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178143ecf206Smrg
178243ecf206SmrgAC_SUBST(MAKE_TEXT)
178343ecf206SmrgAC_SUBST(MAKE_PS)
178443ecf206SmrgAC_SUBST(MAKE_PDF)
178543ecf206SmrgAC_SUBST(MAKE_HTML)
178643ecf206Smrg]) # XORG_CHECK_DOCBOOK
178743ecf206Smrg
178843ecf206Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178943ecf206Smrg# ----------------
179043ecf206Smrg# Minimum version: 1.5.0
179143ecf206Smrg# Minimum version for optional DEFAULT argument: 1.11.0
179248e69166Smrg#
179343ecf206Smrg# Documentation tools are not always available on all platforms and sometimes
179443ecf206Smrg# not at the appropriate level. This macro enables a module to test for the
179543ecf206Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
179683f4f7f0Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
179743ecf206Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179843ecf206Smrg# --with-xmlto assumes 'auto'.
179948e69166Smrg#
180043ecf206Smrg# Interface to module:
180143ecf206Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180243ecf206Smrg# XMLTO:	returns the path of the xmlto program found
180343ecf206Smrg#		returns the path set by the user in the environment
180443ecf206Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180543ecf206Smrg#		'no' user instructs the module not to use xmlto
180648e69166Smrg#
180743ecf206Smrg# Added in version 1.10.0
180843ecf206Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180943ecf206Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
181048e69166Smrg#
181143ecf206Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
181248e69166Smrg#
181343ecf206SmrgAC_DEFUN([XORG_WITH_XMLTO],[
181443ecf206SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181543ecf206Smrgm4_define([_defopt], m4_default([$2], [auto]))
181643ecf206SmrgAC_ARG_WITH(xmlto,
181743ecf206Smrg	AS_HELP_STRING([--with-xmlto],
181843ecf206Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181943ecf206Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182043ecf206Smrgm4_undefine([_defopt])
182148e69166Smrg
182243ecf206Smrgif test "x$use_xmlto" = x"auto"; then
182343ecf206Smrg   AC_PATH_PROG([XMLTO], [xmlto])
182443ecf206Smrg   if test "x$XMLTO" = "x"; then
182543ecf206Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182643ecf206Smrg	have_xmlto=no
182743ecf206Smrg   else
182843ecf206Smrg        have_xmlto=yes
182943ecf206Smrg   fi
183043ecf206Smrgelif test "x$use_xmlto" = x"yes" ; then
183143ecf206Smrg   AC_PATH_PROG([XMLTO], [xmlto])
183243ecf206Smrg   if test "x$XMLTO" = "x"; then
183343ecf206Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183443ecf206Smrg   fi
183543ecf206Smrg   have_xmlto=yes
183643ecf206Smrgelif test "x$use_xmlto" = x"no" ; then
183743ecf206Smrg   if test "x$XMLTO" != "x"; then
183843ecf206Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183943ecf206Smrg   fi
184043ecf206Smrg   have_xmlto=no
184143ecf206Smrgelse
184243ecf206Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184343ecf206Smrgfi
184448e69166Smrg
184543ecf206Smrg# Test for a minimum version of xmlto, if provided.
184643ecf206Smrgm4_ifval([$1],
184743ecf206Smrg[if test "$have_xmlto" = yes; then
184843ecf206Smrg    # scrape the xmlto version
184943ecf206Smrg    AC_MSG_CHECKING([the xmlto version])
185043ecf206Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185143ecf206Smrg    AC_MSG_RESULT([$xmlto_version])
185243ecf206Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185343ecf206Smrg        [if test "x$use_xmlto" = xauto; then
185443ecf206Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185543ecf206Smrg            have_xmlto=no
185643ecf206Smrg        else
185743ecf206Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185843ecf206Smrg        fi])
185943ecf206Smrgfi])
186048e69166Smrg
186143ecf206Smrg# Test for the ability of xmlto to generate a text target
186243ecf206Smrg#
186343ecf206Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
186443ecf206Smrg# following test for empty XML docbook files.
186543ecf206Smrg# For compatibility reasons use the following empty XML docbook file and if
186643ecf206Smrg# it fails try it again with a non-empty XML file.
186743ecf206Smrghave_xmlto_text=no
186843ecf206Smrgcat > conftest.xml << "EOF"
186943ecf206SmrgEOF
187043ecf206SmrgAS_IF([test "$have_xmlto" = yes],
187143ecf206Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187243ecf206Smrg             [have_xmlto_text=yes],
187343ecf206Smrg             [# Try it again with a non-empty XML file.
187443ecf206Smrg              cat > conftest.xml << "EOF"
187543ecf206Smrg<x></x>
187643ecf206SmrgEOF
187743ecf206Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187843ecf206Smrg                    [have_xmlto_text=yes],
187943ecf206Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188043ecf206Smrgrm -f conftest.xml
188143ecf206SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188243ecf206SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188343ecf206Smrg]) # XORG_WITH_XMLTO
188448e69166Smrg
188543ecf206Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188643ecf206Smrg# --------------------------------------------
188743ecf206Smrg# Minimum version: 1.12.0
188843ecf206Smrg# Minimum version for optional DEFAULT argument: 1.12.0
188943ecf206Smrg#
189043ecf206Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189143ecf206Smrg# XML-based language used for the transformation of XML documents.
189243ecf206Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189343ecf206Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189443ecf206Smrg# The XSLT processor is often used as a standalone tool for transformations.
189543ecf206Smrg# It should not be assumed that this tool is used only to work with documnetation.
189643ecf206Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189743ecf206Smrg#
189843ecf206Smrg# Interface to module:
189943ecf206Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190043ecf206Smrg# XSLTPROC:	 returns the path of the xsltproc program found
190143ecf206Smrg#		 returns the path set by the user in the environment
190243ecf206Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190343ecf206Smrg#		  'no' user instructs the module not to use xsltproc
190443ecf206Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190543ecf206Smrg#
190643ecf206Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190743ecf206Smrg#
190843ecf206SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190943ecf206SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191043ecf206Smrg# Preserves the interface, should it be implemented later
191143ecf206Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191243ecf206Smrgm4_define([_defopt], m4_default([$2], [auto]))
191343ecf206SmrgAC_ARG_WITH(xsltproc,
191443ecf206Smrg	AS_HELP_STRING([--with-xsltproc],
191543ecf206Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191643ecf206Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191743ecf206Smrgm4_undefine([_defopt])
191848e69166Smrg
191943ecf206Smrgif test "x$use_xsltproc" = x"auto"; then
192043ecf206Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192143ecf206Smrg   if test "x$XSLTPROC" = "x"; then
192243ecf206Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192343ecf206Smrg	have_xsltproc=no
192443ecf206Smrg   else
192543ecf206Smrg        have_xsltproc=yes
192643ecf206Smrg   fi
192743ecf206Smrgelif test "x$use_xsltproc" = x"yes" ; then
192843ecf206Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192943ecf206Smrg   if test "x$XSLTPROC" = "x"; then
193043ecf206Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193143ecf206Smrg   fi
193243ecf206Smrg   have_xsltproc=yes
193343ecf206Smrgelif test "x$use_xsltproc" = x"no" ; then
193443ecf206Smrg   if test "x$XSLTPROC" != "x"; then
193543ecf206Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193643ecf206Smrg   fi
193743ecf206Smrg   have_xsltproc=no
193843ecf206Smrgelse
193943ecf206Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19408846b520Smrgfi
19418846b520Smrg
194243ecf206SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194343ecf206Smrg]) # XORG_WITH_XSLTPROC
194443ecf206Smrg
194543ecf206Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194643ecf206Smrg# ----------------------------------------
194743ecf206Smrg# Minimum version: 1.15.0
194848e69166Smrg#
194943ecf206Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
195043ecf206Smrg# scanning arbitrary text files, extracting information from those text files,
195143ecf206Smrg# and printing reports based on that information.
195248e69166Smrg#
195343ecf206Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
195448e69166Smrg#
195543ecf206Smrg# Interface to module:
195643ecf206Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
195743ecf206Smrg# PERL:	     returns the path of the perl program found
195843ecf206Smrg#	     returns the path set by the user in the environment
195943ecf206Smrg# --with-perl: 'yes' user instructs the module to use perl
196043ecf206Smrg#	       'no' user instructs the module not to use perl
196143ecf206Smrg# have_perl: returns yes if perl found in PATH or no
196248e69166Smrg#
196343ecf206Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196443ecf206Smrg#
196543ecf206SmrgAC_DEFUN([XORG_WITH_PERL],[
196643ecf206SmrgAC_ARG_VAR([PERL], [Path to perl command])
196743ecf206Smrg# Preserves the interface, should it be implemented later
196843ecf206Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196943ecf206Smrgm4_define([_defopt], m4_default([$2], [auto]))
197043ecf206SmrgAC_ARG_WITH(perl,
197143ecf206Smrg	AS_HELP_STRING([--with-perl],
197243ecf206Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197343ecf206Smrg	   [use_perl=$withval], [use_perl=]_defopt)
197443ecf206Smrgm4_undefine([_defopt])
197548e69166Smrg
197643ecf206Smrgif test "x$use_perl" = x"auto"; then
197743ecf206Smrg   AC_PATH_PROG([PERL], [perl])
197843ecf206Smrg   if test "x$PERL" = "x"; then
197943ecf206Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198043ecf206Smrg	have_perl=no
198143ecf206Smrg   else
198243ecf206Smrg        have_perl=yes
198343ecf206Smrg   fi
198443ecf206Smrgelif test "x$use_perl" = x"yes" ; then
198543ecf206Smrg   AC_PATH_PROG([PERL], [perl])
198643ecf206Smrg   if test "x$PERL" = "x"; then
198743ecf206Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198843ecf206Smrg   fi
198943ecf206Smrg   have_perl=yes
199043ecf206Smrgelif test "x$use_perl" = x"no" ; then
199143ecf206Smrg   if test "x$PERL" != "x"; then
199243ecf206Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199343ecf206Smrg   fi
199443ecf206Smrg   have_perl=no
199543ecf206Smrgelse
199643ecf206Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199743ecf206Smrgfi
1998a8bb11d0Smrg
199943ecf206SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200043ecf206Smrg]) # XORG_WITH_PERL
200148e69166Smrg
200243ecf206Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
200348e69166Smrg# ----------------
200443ecf206Smrg# Minimum version: 1.5.0
200543ecf206Smrg# Minimum version for optional DEFAULT argument: 1.11.0
200648e69166Smrg#
200743ecf206Smrg# Documentation tools are not always available on all platforms and sometimes
200843ecf206Smrg# not at the appropriate level. This macro enables a module to test for the
200943ecf206Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
201083f4f7f0Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
201143ecf206Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201243ecf206Smrg# --with-asciidoc assumes 'auto'.
201348e69166Smrg#
201443ecf206Smrg# Interface to module:
201543ecf206Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201643ecf206Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
201743ecf206Smrg#		 returns the path set by the user in the environment
201843ecf206Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201943ecf206Smrg#		  'no' user instructs the module not to use asciidoc
202048e69166Smrg#
202143ecf206Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
202248e69166Smrg#
202343ecf206SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202443ecf206SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202543ecf206Smrgm4_define([_defopt], m4_default([$2], [auto]))
202643ecf206SmrgAC_ARG_WITH(asciidoc,
202743ecf206Smrg	AS_HELP_STRING([--with-asciidoc],
202843ecf206Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202943ecf206Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203043ecf206Smrgm4_undefine([_defopt])
20318846b520Smrg
203243ecf206Smrgif test "x$use_asciidoc" = x"auto"; then
203343ecf206Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203443ecf206Smrg   if test "x$ASCIIDOC" = "x"; then
203543ecf206Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203643ecf206Smrg	have_asciidoc=no
203743ecf206Smrg   else
203843ecf206Smrg        have_asciidoc=yes
203943ecf206Smrg   fi
204043ecf206Smrgelif test "x$use_asciidoc" = x"yes" ; then
204143ecf206Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204243ecf206Smrg   if test "x$ASCIIDOC" = "x"; then
204343ecf206Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204443ecf206Smrg   fi
204543ecf206Smrg   have_asciidoc=yes
204643ecf206Smrgelif test "x$use_asciidoc" = x"no" ; then
204743ecf206Smrg   if test "x$ASCIIDOC" != "x"; then
204843ecf206Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204943ecf206Smrg   fi
205043ecf206Smrg   have_asciidoc=no
205143ecf206Smrgelse
205243ecf206Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205343ecf206Smrgfi
205443ecf206Smrgm4_ifval([$1],
205543ecf206Smrg[if test "$have_asciidoc" = yes; then
205643ecf206Smrg    # scrape the asciidoc version
205743ecf206Smrg    AC_MSG_CHECKING([the asciidoc version])
205843ecf206Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205943ecf206Smrg    AC_MSG_RESULT([$asciidoc_version])
206043ecf206Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206143ecf206Smrg        [if test "x$use_asciidoc" = xauto; then
206243ecf206Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206343ecf206Smrg            have_asciidoc=no
206443ecf206Smrg        else
206543ecf206Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206643ecf206Smrg        fi])
206743ecf206Smrgfi])
206843ecf206SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206943ecf206Smrg]) # XORG_WITH_ASCIIDOC
20708846b520Smrg
207143ecf206Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207243ecf206Smrg# -------------------------------------------
207343ecf206Smrg# Minimum version: 1.5.0
207443ecf206Smrg# Minimum version for optional DEFAULT argument: 1.11.0
207543ecf206Smrg# Minimum version for optional DOT checking: 1.18.0
207648e69166Smrg#
207743ecf206Smrg# Documentation tools are not always available on all platforms and sometimes
207843ecf206Smrg# not at the appropriate level. This macro enables a module to test for the
207943ecf206Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
208083f4f7f0Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
208143ecf206Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208243ecf206Smrg# --with-doxygen assumes 'auto'.
208348e69166Smrg#
208443ecf206Smrg# Interface to module:
208543ecf206Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208643ecf206Smrg# DOXYGEN:	 returns the path of the doxygen program found
208743ecf206Smrg#		 returns the path set by the user in the environment
208843ecf206Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208943ecf206Smrg#		  'no' user instructs the module not to use doxygen
209048e69166Smrg#
209143ecf206Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
209248e69166Smrg#
209343ecf206SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209443ecf206SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209543ecf206SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209643ecf206Smrgm4_define([_defopt], m4_default([$2], [auto]))
209743ecf206SmrgAC_ARG_WITH(doxygen,
209843ecf206Smrg	AS_HELP_STRING([--with-doxygen],
209943ecf206Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210043ecf206Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210143ecf206Smrgm4_undefine([_defopt])
21028846b520Smrg
210343ecf206Smrgif test "x$use_doxygen" = x"auto"; then
210443ecf206Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210543ecf206Smrg   if test "x$DOXYGEN" = "x"; then
210643ecf206Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210743ecf206Smrg	have_doxygen=no
210843ecf206Smrg   else
210943ecf206Smrg        have_doxygen=yes
211043ecf206Smrg   fi
211143ecf206Smrgelif test "x$use_doxygen" = x"yes" ; then
211243ecf206Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211343ecf206Smrg   if test "x$DOXYGEN" = "x"; then
211443ecf206Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211543ecf206Smrg   fi
211643ecf206Smrg   have_doxygen=yes
211743ecf206Smrgelif test "x$use_doxygen" = x"no" ; then
211843ecf206Smrg   if test "x$DOXYGEN" != "x"; then
211943ecf206Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212043ecf206Smrg   fi
212143ecf206Smrg   have_doxygen=no
21228846b520Smrgelse
212343ecf206Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
21248846b520Smrgfi
212543ecf206Smrgm4_ifval([$1],
212643ecf206Smrg[if test "$have_doxygen" = yes; then
212743ecf206Smrg    # scrape the doxygen version
212843ecf206Smrg    AC_MSG_CHECKING([the doxygen version])
212943ecf206Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213043ecf206Smrg    AC_MSG_RESULT([$doxygen_version])
213143ecf206Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213243ecf206Smrg        [if test "x$use_doxygen" = xauto; then
213343ecf206Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213443ecf206Smrg            have_doxygen=no
213543ecf206Smrg        else
213643ecf206Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213743ecf206Smrg        fi])
213843ecf206Smrgfi])
21398846b520Smrg
214043ecf206Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214143ecf206Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214243ecf206Smrgdnl 	HAVE_DOT = @HAVE_DOT@
214343ecf206SmrgHAVE_DOT=no
214443ecf206Smrgif test "x$have_doxygen" = "xyes"; then
214543ecf206Smrg  AC_PATH_PROG([DOT], [dot])
214643ecf206Smrg    if test "x$DOT" != "x"; then
214743ecf206Smrg      HAVE_DOT=yes
214843ecf206Smrg    fi
214943ecf206Smrgfi
21508846b520Smrg
215143ecf206SmrgAC_SUBST([HAVE_DOT])
215243ecf206SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215343ecf206SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215443ecf206Smrg]) # XORG_WITH_DOXYGEN
21558846b520Smrg
215643ecf206Smrg# XORG_WITH_GROFF([DEFAULT])
215743ecf206Smrg# ----------------
215843ecf206Smrg# Minimum version: 1.6.0
215943ecf206Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2160a8bb11d0Smrg#
216143ecf206Smrg# Documentation tools are not always available on all platforms and sometimes
216243ecf206Smrg# not at the appropriate level. This macro enables a module to test for the
216343ecf206Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
216483f4f7f0Smrg# the --with-groff option, it allows maximum flexibility in making decisions
216543ecf206Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
216643ecf206Smrg# --with-groff assumes 'auto'.
216743ecf206Smrg#
216843ecf206Smrg# Interface to module:
216943ecf206Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217043ecf206Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217143ecf206Smrg# HAVE_GROFF_MS: the -ms macros package
217243ecf206Smrg# GROFF:	 returns the path of the groff program found
217343ecf206Smrg#		 returns the path set by the user in the environment
217443ecf206Smrg# --with-groff:	 'yes' user instructs the module to use groff
217543ecf206Smrg#		 'no' user instructs the module not to use groff
217643ecf206Smrg#
217743ecf206Smrg# Added in version 1.9.0:
217843ecf206Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217943ecf206Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218043ecf206Smrg#		   psselect from the psutils package.
218143ecf206Smrg#		   the ghostcript package. Refer to the grohtml man pages
218243ecf206Smrg#
218343ecf206Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218443ecf206Smrg#
218543ecf206Smrg# OS and distros often splits groff in a basic and full package, the former
218643ecf206Smrg# having the groff program and the later having devices, fonts and macros
218743ecf206Smrg# Checking for the groff executable is not enough.
218843ecf206Smrg#
218943ecf206Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
219043ecf206Smrg# unset HAVE_GROFF or GROFF env variables.
219143ecf206Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219243ecf206Smrg#
219343ecf206SmrgAC_DEFUN([XORG_WITH_GROFF],[
219443ecf206SmrgAC_ARG_VAR([GROFF], [Path to groff command])
219543ecf206Smrgm4_define([_defopt], m4_default([$1], [auto]))
219643ecf206SmrgAC_ARG_WITH(groff,
219743ecf206Smrg	AS_HELP_STRING([--with-groff],
219843ecf206Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219943ecf206Smrg	   [use_groff=$withval], [use_groff=]_defopt)
220043ecf206Smrgm4_undefine([_defopt])
22018846b520Smrg
220243ecf206Smrgif test "x$use_groff" = x"auto"; then
220343ecf206Smrg   AC_PATH_PROG([GROFF], [groff])
220443ecf206Smrg   if test "x$GROFF" = "x"; then
220543ecf206Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220643ecf206Smrg	have_groff=no
220743ecf206Smrg   else
220843ecf206Smrg        have_groff=yes
220943ecf206Smrg   fi
221043ecf206Smrgelif test "x$use_groff" = x"yes" ; then
221143ecf206Smrg   AC_PATH_PROG([GROFF], [groff])
221243ecf206Smrg   if test "x$GROFF" = "x"; then
221343ecf206Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221443ecf206Smrg   fi
221543ecf206Smrg   have_groff=yes
221643ecf206Smrgelif test "x$use_groff" = x"no" ; then
221743ecf206Smrg   if test "x$GROFF" != "x"; then
221843ecf206Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221943ecf206Smrg   fi
222043ecf206Smrg   have_groff=no
222143ecf206Smrgelse
222243ecf206Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222343ecf206Smrgfi
22248846b520Smrg
222543ecf206Smrg# We have groff, test for the presence of the macro packages
222643ecf206Smrgif test "x$have_groff" = x"yes"; then
222743ecf206Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222843ecf206Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222943ecf206Smrg        groff_ms_works=yes
223043ecf206Smrg    else
223143ecf206Smrg        groff_ms_works=no
22328846b520Smrg    fi
223343ecf206Smrg    AC_MSG_RESULT([$groff_ms_works])
223443ecf206Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223543ecf206Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223643ecf206Smrg        groff_mm_works=yes
223743ecf206Smrg    else
223843ecf206Smrg        groff_mm_works=no
223943ecf206Smrg    fi
224043ecf206Smrg    AC_MSG_RESULT([$groff_mm_works])
224143ecf206Smrgfi
22428846b520Smrg
224343ecf206Smrg# We have groff, test for HTML dependencies, one command per package
224443ecf206Smrgif test "x$have_groff" = x"yes"; then
224543ecf206Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224643ecf206Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224743ecf206Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224843ecf206Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224943ecf206Smrg      have_groff_html=yes
225043ecf206Smrg   else
225143ecf206Smrg      have_groff_html=no
225243ecf206Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225343ecf206Smrg   fi
225443ecf206Smrgfi
225543ecf206Smrg
225643ecf206Smrg# Set Automake conditionals for Makefiles
225743ecf206SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225843ecf206SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225943ecf206SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226043ecf206SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226143ecf206Smrg]) # XORG_WITH_GROFF
226243ecf206Smrg
226343ecf206Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226443ecf206Smrg# ---------------------------------------
226543ecf206Smrg# Minimum version: 1.6.0
226643ecf206Smrg# Minimum version for optional DEFAULT argument: 1.11.0
226743ecf206Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226843ecf206Smrg#
226943ecf206Smrg# Documentation tools are not always available on all platforms and sometimes
227043ecf206Smrg# not at the appropriate level. This macro enables a module to test for the
227143ecf206Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
227283f4f7f0Smrg# the --with-fop option, it allows maximum flexibility in making decisions
227343ecf206Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
227443ecf206Smrg# --with-fop assumes 'auto'.
227543ecf206Smrg#
227643ecf206Smrg# Interface to module:
227743ecf206Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227843ecf206Smrg# FOP:	 	returns the path of the fop program found
227943ecf206Smrg#		returns the path set by the user in the environment
228043ecf206Smrg# --with-fop: 	'yes' user instructs the module to use fop
228143ecf206Smrg#		'no' user instructs the module not to use fop
228243ecf206Smrg#
228343ecf206Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228443ecf206Smrg#
228543ecf206SmrgAC_DEFUN([XORG_WITH_FOP],[
228643ecf206SmrgAC_ARG_VAR([FOP], [Path to fop command])
228743ecf206Smrgm4_define([_defopt], m4_default([$2], [auto]))
228843ecf206SmrgAC_ARG_WITH(fop,
228943ecf206Smrg	AS_HELP_STRING([--with-fop],
229043ecf206Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229143ecf206Smrg	   [use_fop=$withval], [use_fop=]_defopt)
229243ecf206Smrgm4_undefine([_defopt])
229343ecf206Smrg
229443ecf206Smrgif test "x$use_fop" = x"auto"; then
229543ecf206Smrg   AC_PATH_PROG([FOP], [fop])
229643ecf206Smrg   if test "x$FOP" = "x"; then
229743ecf206Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229843ecf206Smrg	have_fop=no
229943ecf206Smrg   else
230043ecf206Smrg        have_fop=yes
230143ecf206Smrg   fi
230243ecf206Smrgelif test "x$use_fop" = x"yes" ; then
230343ecf206Smrg   AC_PATH_PROG([FOP], [fop])
230443ecf206Smrg   if test "x$FOP" = "x"; then
230543ecf206Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230643ecf206Smrg   fi
230743ecf206Smrg   have_fop=yes
230843ecf206Smrgelif test "x$use_fop" = x"no" ; then
230943ecf206Smrg   if test "x$FOP" != "x"; then
231043ecf206Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231143ecf206Smrg   fi
231243ecf206Smrg   have_fop=no
23138846b520Smrgelse
231443ecf206Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315a8bb11d0Smrgfi
2316a8bb11d0Smrg
231743ecf206Smrg# Test for a minimum version of fop, if provided.
231843ecf206Smrgm4_ifval([$1],
231943ecf206Smrg[if test "$have_fop" = yes; then
232043ecf206Smrg    # scrape the fop version
232143ecf206Smrg    AC_MSG_CHECKING([for fop minimum version])
232243ecf206Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232343ecf206Smrg    AC_MSG_RESULT([$fop_version])
232443ecf206Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
232543ecf206Smrg        [if test "x$use_fop" = xauto; then
232643ecf206Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232743ecf206Smrg            have_fop=no
232843ecf206Smrg        else
232943ecf206Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233043ecf206Smrg        fi])
233143ecf206Smrgfi])
233243ecf206SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233343ecf206Smrg]) # XORG_WITH_FOP
233443ecf206Smrg
233543ecf206Smrg# XORG_WITH_M4([MIN-VERSION])
233643ecf206Smrg# ---------------------------
233743ecf206Smrg# Minimum version: 1.19.0
233843ecf206Smrg#
233943ecf206Smrg# This macro attempts to locate an m4 macro processor which supports
234043ecf206Smrg# -I option and is only useful for modules relying on M4 in order to
234143ecf206Smrg# expand macros in source code files.
234243ecf206Smrg#
234343ecf206Smrg# Interface to module:
234443ecf206Smrg# M4:	 	returns the path of the m4 program found
234543ecf206Smrg#		returns the path set by the user in the environment
234643ecf206Smrg#
234743ecf206SmrgAC_DEFUN([XORG_WITH_M4], [
234843ecf206SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234943ecf206Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235043ecf206Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235143ecf206Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235243ecf206Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235343ecf206Smrg   [$PATH:/usr/gnu/bin])])
23548846b520Smrg
235543ecf206SmrgAC_SUBST([M4], [$ac_cv_path_M4])
235643ecf206Smrg]) # XORG_WITH_M4
23578846b520Smrg
235843ecf206Smrg# XORG_WITH_PS2PDF([DEFAULT])
235943ecf206Smrg# ----------------
236043ecf206Smrg# Minimum version: 1.6.0
236143ecf206Smrg# Minimum version for optional DEFAULT argument: 1.11.0
236243ecf206Smrg#
236343ecf206Smrg# Documentation tools are not always available on all platforms and sometimes
236443ecf206Smrg# not at the appropriate level. This macro enables a module to test for the
236543ecf206Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
236683f4f7f0Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
236743ecf206Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236843ecf206Smrg# --with-ps2pdf assumes 'auto'.
236943ecf206Smrg#
237043ecf206Smrg# Interface to module:
237143ecf206Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237243ecf206Smrg# PS2PDF:	returns the path of the ps2pdf program found
237343ecf206Smrg#		returns the path set by the user in the environment
237443ecf206Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237543ecf206Smrg#		 'no' user instructs the module not to use ps2pdf
237643ecf206Smrg#
237743ecf206Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237843ecf206Smrg#
237943ecf206SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238043ecf206SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238143ecf206Smrgm4_define([_defopt], m4_default([$1], [auto]))
238243ecf206SmrgAC_ARG_WITH(ps2pdf,
238343ecf206Smrg	AS_HELP_STRING([--with-ps2pdf],
238443ecf206Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238543ecf206Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238643ecf206Smrgm4_undefine([_defopt])
23878846b520Smrg
238843ecf206Smrgif test "x$use_ps2pdf" = x"auto"; then
238943ecf206Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239043ecf206Smrg   if test "x$PS2PDF" = "x"; then
239143ecf206Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239243ecf206Smrg	have_ps2pdf=no
239343ecf206Smrg   else
239443ecf206Smrg        have_ps2pdf=yes
239543ecf206Smrg   fi
239643ecf206Smrgelif test "x$use_ps2pdf" = x"yes" ; then
239743ecf206Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239843ecf206Smrg   if test "x$PS2PDF" = "x"; then
239943ecf206Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240043ecf206Smrg   fi
240143ecf206Smrg   have_ps2pdf=yes
240243ecf206Smrgelif test "x$use_ps2pdf" = x"no" ; then
240343ecf206Smrg   if test "x$PS2PDF" != "x"; then
240443ecf206Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240543ecf206Smrg   fi
240643ecf206Smrg   have_ps2pdf=no
240743ecf206Smrgelse
240843ecf206Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409a8bb11d0Smrgfi
241043ecf206SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241143ecf206Smrg]) # XORG_WITH_PS2PDF
24128846b520Smrg
241343ecf206Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
241443ecf206Smrg# ----------------
241543ecf206Smrg# Minimum version: 1.6.0
24168846b520Smrg#
241743ecf206Smrg# Documentation tools are not always available on all platforms and sometimes
241843ecf206Smrg# not at the appropriate level. This macro enables a builder to skip all
241943ecf206Smrg# documentation targets except traditional man pages.
242043ecf206Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242183f4f7f0Smrg# maximum flexibility in controlling documentation building.
242243ecf206Smrg# Refer to:
242343ecf206Smrg# XORG_WITH_XMLTO         --with-xmlto
242443ecf206Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242543ecf206Smrg# XORG_WITH_DOXYGEN       --with-doxygen
242643ecf206Smrg# XORG_WITH_FOP           --with-fop
242743ecf206Smrg# XORG_WITH_GROFF         --with-groff
242843ecf206Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
242943ecf206Smrg#
243043ecf206Smrg# Interface to module:
243143ecf206Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243243ecf206Smrg# --enable-docs: 'yes' user instructs the module to generate docs
243343ecf206Smrg#		 'no' user instructs the module not to generate docs
243443ecf206Smrg# parm1:	specify the default value, yes or no.
243543ecf206Smrg#
243643ecf206SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243743ecf206Smrgm4_define([docs_default], m4_default([$1], [yes]))
243843ecf206SmrgAC_ARG_ENABLE(docs,
243943ecf206Smrg	AS_HELP_STRING([--enable-docs],
244043ecf206Smrg	   [Enable building the documentation (default: ]docs_default[)]),
244143ecf206Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
244243ecf206Smrgm4_undefine([docs_default])
244343ecf206SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244443ecf206SmrgAC_MSG_CHECKING([whether to build documentation])
244543ecf206SmrgAC_MSG_RESULT([$build_docs])
244643ecf206Smrg]) # XORG_ENABLE_DOCS
24478846b520Smrg
244843ecf206Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244943ecf206Smrg# ----------------
245043ecf206Smrg# Minimum version: 1.6.0
245143ecf206Smrg#
245243ecf206Smrg# This macro enables a builder to skip all developer documentation.
245343ecf206Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245483f4f7f0Smrg# maximum flexibility in controlling documentation building.
245543ecf206Smrg# Refer to:
245643ecf206Smrg# XORG_WITH_XMLTO         --with-xmlto
245743ecf206Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245843ecf206Smrg# XORG_WITH_DOXYGEN       --with-doxygen
245943ecf206Smrg# XORG_WITH_FOP           --with-fop
246043ecf206Smrg# XORG_WITH_GROFF         --with-groff
246143ecf206Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
246243ecf206Smrg#
246343ecf206Smrg# Interface to module:
246443ecf206Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246543ecf206Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246643ecf206Smrg#			'no' user instructs the module not to generate developer docs
246743ecf206Smrg# parm1:		specify the default value, yes or no.
246843ecf206Smrg#
246943ecf206SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247043ecf206Smrgm4_define([devel_default], m4_default([$1], [yes]))
247143ecf206SmrgAC_ARG_ENABLE(devel-docs,
247243ecf206Smrg	AS_HELP_STRING([--enable-devel-docs],
247343ecf206Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247443ecf206Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247543ecf206Smrgm4_undefine([devel_default])
247643ecf206SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247743ecf206SmrgAC_MSG_CHECKING([whether to build developer documentation])
247843ecf206SmrgAC_MSG_RESULT([$build_devel_docs])
247943ecf206Smrg]) # XORG_ENABLE_DEVEL_DOCS
24808846b520Smrg
248143ecf206Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
248243ecf206Smrg# ----------------
248343ecf206Smrg# Minimum version: 1.6.0
248443ecf206Smrg#
248543ecf206Smrg# This macro enables a builder to skip all functional specification targets.
248643ecf206Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248783f4f7f0Smrg# maximum flexibility in controlling documentation building.
248843ecf206Smrg# Refer to:
248943ecf206Smrg# XORG_WITH_XMLTO         --with-xmlto
249043ecf206Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249143ecf206Smrg# XORG_WITH_DOXYGEN       --with-doxygen
249243ecf206Smrg# XORG_WITH_FOP           --with-fop
249343ecf206Smrg# XORG_WITH_GROFF         --with-groff
249443ecf206Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
249543ecf206Smrg#
249643ecf206Smrg# Interface to module:
249743ecf206Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249843ecf206Smrg# --enable-specs:	'yes' user instructs the module to generate specs
249943ecf206Smrg#			'no' user instructs the module not to generate specs
250043ecf206Smrg# parm1:		specify the default value, yes or no.
250143ecf206Smrg#
250243ecf206SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250343ecf206Smrgm4_define([spec_default], m4_default([$1], [yes]))
250443ecf206SmrgAC_ARG_ENABLE(specs,
250543ecf206Smrg	AS_HELP_STRING([--enable-specs],
250643ecf206Smrg	   [Enable building the specs (default: ]spec_default[)]),
250743ecf206Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
250843ecf206Smrgm4_undefine([spec_default])
250943ecf206SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251043ecf206SmrgAC_MSG_CHECKING([whether to build functional specifications])
251143ecf206SmrgAC_MSG_RESULT([$build_specs])
251243ecf206Smrg]) # XORG_ENABLE_SPECS
25138846b520Smrg
251443ecf206Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251543ecf206Smrg# ----------------------------------------------
251643ecf206Smrg# Minimum version: 1.13.0
25178846b520Smrg#
251843ecf206Smrg# This macro enables a builder to enable/disable unit testing
251943ecf206Smrg# It makes no assumption about the test cases implementation
252043ecf206Smrg# Test cases may or may not use Automake "Support for test suites"
252143ecf206Smrg# They may or may not use the software utility library GLib
252243ecf206Smrg#
252343ecf206Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252443ecf206Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252543ecf206Smrg# The variable enable_unit_tests is used by other macros in this file.
252643ecf206Smrg#
252743ecf206Smrg# Interface to module:
252843ecf206Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252943ecf206Smrg# enable_unit_tests:    used in configure.ac for additional configuration
253043ecf206Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253143ecf206Smrg#			'no' user instructs the module not to build tests
253243ecf206Smrg# parm1:		specify the default value, yes or no.
253343ecf206Smrg#
253443ecf206SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253543ecf206SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253643ecf206SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253743ecf206SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253843ecf206Smrgm4_define([_defopt], m4_default([$1], [auto]))
253943ecf206SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254043ecf206Smrg	[Enable building unit test cases (default: ]_defopt[)]),
254143ecf206Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254243ecf206Smrgm4_undefine([_defopt])
254343ecf206SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254443ecf206SmrgAC_MSG_CHECKING([whether to build unit test cases])
254543ecf206SmrgAC_MSG_RESULT([$enable_unit_tests])
254643ecf206Smrg]) # XORG_ENABLE_UNIT_TESTS
25478846b520Smrg
254843ecf206Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254943ecf206Smrg# ------------------------------------------------------
255043ecf206Smrg# Minimum version: 1.17.0
255143ecf206Smrg#
255243ecf206Smrg# This macro enables a builder to enable/disable integration testing
255343ecf206Smrg# It makes no assumption about the test cases' implementation
255443ecf206Smrg# Test cases may or may not use Automake "Support for test suites"
255543ecf206Smrg#
255643ecf206Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255743ecf206Smrg# usually requires less dependencies and may be built and run under less
255843ecf206Smrg# stringent environments than integration tests.
255943ecf206Smrg#
256043ecf206Smrg# Interface to module:
256143ecf206Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256243ecf206Smrg# enable_integration_tests:   used in configure.ac for additional configuration
256343ecf206Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256443ecf206Smrg#                             'no' user instructs the module not to build tests
256543ecf206Smrg# parm1:                      specify the default value, yes or no.
256643ecf206Smrg#
256743ecf206SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256843ecf206SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256943ecf206Smrgm4_define([_defopt], m4_default([$1], [auto]))
257043ecf206SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257143ecf206Smrg	[Enable building integration test cases (default: ]_defopt[)]),
257243ecf206Smrg	[enable_integration_tests=$enableval],
257343ecf206Smrg	[enable_integration_tests=]_defopt)
257443ecf206Smrgm4_undefine([_defopt])
257543ecf206SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257643ecf206Smrg	[test "x$enable_integration_tests" != xno])
257743ecf206SmrgAC_MSG_CHECKING([whether to build unit test cases])
257843ecf206SmrgAC_MSG_RESULT([$enable_integration_tests])
257943ecf206Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
25808846b520Smrg
258143ecf206Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258243ecf206Smrg# ----------------------------------------
258343ecf206Smrg# Minimum version: 1.13.0
258443ecf206Smrg#
258543ecf206Smrg# GLib is a library which provides advanced data structures and functions.
258643ecf206Smrg# This macro enables a module to test for the presence of Glib.
258743ecf206Smrg#
258843ecf206Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258943ecf206Smrg# Otherwise the value of $enable_unit_tests is blank.
259043ecf206Smrg#
259143ecf206Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259243ecf206Smrg# test support usually requires less dependencies and may be built and run under
259343ecf206Smrg# less stringent environments than integration tests.
25948846b520Smrg#
259543ecf206Smrg# Interface to module:
259643ecf206Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
259743ecf206Smrg# with_glib: used in configure.ac to know if GLib has been found
259843ecf206Smrg# --with-glib:	'yes' user instructs the module to use glib
259943ecf206Smrg#		'no' user instructs the module not to use glib
260043ecf206Smrg#
260143ecf206SmrgAC_DEFUN([XORG_WITH_GLIB],[
260243ecf206SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260343ecf206Smrgm4_define([_defopt], m4_default([$2], [auto]))
260443ecf206SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260543ecf206Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260643ecf206Smrg	[with_glib=$withval], [with_glib=]_defopt)
260743ecf206Smrgm4_undefine([_defopt])
2608a8bb11d0Smrg
260943ecf206Smrghave_glib=no
261043ecf206Smrg# Do not probe GLib if user explicitly disabled unit testing
261143ecf206Smrgif test "x$enable_unit_tests" != x"no"; then
261243ecf206Smrg  # Do not probe GLib if user explicitly disabled it
261343ecf206Smrg  if test "x$with_glib" != x"no"; then
261443ecf206Smrg    m4_ifval(
261543ecf206Smrg      [$1],
261643ecf206Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261743ecf206Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261843ecf206Smrg    )
2619a8bb11d0Smrg  fi
2620a8bb11d0Smrgfi
2621a8bb11d0Smrg
262243ecf206Smrg# Not having GLib when unit testing has been explicitly requested is an error
262343ecf206Smrgif test "x$enable_unit_tests" = x"yes"; then
262443ecf206Smrg  if test "x$have_glib" = x"no"; then
262543ecf206Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626a8bb11d0Smrg  fi
2627a8bb11d0Smrgfi
2628a8bb11d0Smrg
262943ecf206Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
263043ecf206Smrgif test "x$enable_unit_tests" = x"no"; then
263143ecf206Smrg  if test "x$with_glib" = x"yes"; then
263243ecf206Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263343ecf206Smrg  fi
263443ecf206Smrgfi
2635a8bb11d0Smrg
263643ecf206Smrg# Not having GLib when it has been explicitly requested is an error
263743ecf206Smrgif test "x$with_glib" = x"yes"; then
263843ecf206Smrg  if test "x$have_glib" = x"no"; then
263943ecf206Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264043ecf206Smrg  fi
264143ecf206Smrgfi
2642a8bb11d0Smrg
264343ecf206SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264443ecf206Smrg]) # XORG_WITH_GLIB
2645a8bb11d0Smrg
264643ecf206Smrg# XORG_LD_WRAP([required|optional])
264743ecf206Smrg# ---------------------------------
264843ecf206Smrg# Minimum version: 1.13.0
264943ecf206Smrg#
265043ecf206Smrg# Check if linker supports -wrap, passed via compiler flags
265143ecf206Smrg#
265243ecf206Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265343ecf206Smrg# Otherwise the value of $enable_unit_tests is blank.
265443ecf206Smrg#
265543ecf206Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265643ecf206Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265743ecf206Smrg# available, an argument of "optional" allows use when some unit tests require
265843ecf206Smrg# ld -wrap and others do not.
265943ecf206Smrg#
266043ecf206SmrgAC_DEFUN([XORG_LD_WRAP],[
266143ecf206SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266243ecf206Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266343ecf206Smrg                      void __wrap_exit(int status) { return; }],
266443ecf206Smrg                     [exit(0);])])
266543ecf206Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
266643ecf206Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266743ecf206Smrg  if test "x$have_ld_wrap" = x"no"; then
266843ecf206Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266943ecf206Smrg  fi
267043ecf206Smrgfi
267143ecf206SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267243ecf206Smrg#
267343ecf206Smrg]) # XORG_LD_WRAP
2674a8bb11d0Smrg
267543ecf206Smrg# XORG_CHECK_LINKER_FLAGS
267643ecf206Smrg# -----------------------
267743ecf206Smrg# SYNOPSIS
267843ecf206Smrg#
267943ecf206Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268043ecf206Smrg#
268143ecf206Smrg# DESCRIPTION
268243ecf206Smrg#
268343ecf206Smrg#   Check whether the given linker FLAGS work with the current language's
268443ecf206Smrg#   linker, or whether they give an error.
268543ecf206Smrg#
268643ecf206Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268743ecf206Smrg#   success/failure.
268843ecf206Smrg#
268943ecf206Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
269043ecf206Smrg#
269143ecf206Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269243ecf206Smrg#
269343ecf206Smrg# LICENSE
269443ecf206Smrg#
269543ecf206Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269643ecf206Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269743ecf206Smrg#   Copyright (c) 2009 Matteo Frigo
269843ecf206Smrg#
269943ecf206Smrg#   This program is free software: you can redistribute it and/or modify it
270043ecf206Smrg#   under the terms of the GNU General Public License as published by the
270143ecf206Smrg#   Free Software Foundation, either version 3 of the License, or (at your
270243ecf206Smrg#   option) any later version.
270343ecf206Smrg#
270443ecf206Smrg#   This program is distributed in the hope that it will be useful, but
270543ecf206Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270643ecf206Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270743ecf206Smrg#   Public License for more details.
270843ecf206Smrg#
270943ecf206Smrg#   You should have received a copy of the GNU General Public License along
271043ecf206Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271143ecf206Smrg#
271243ecf206Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
271343ecf206Smrg#   gives unlimited permission to copy, distribute and modify the configure
271443ecf206Smrg#   scripts that are the output of Autoconf when processing the Macro. You
271543ecf206Smrg#   need not follow the terms of the GNU General Public License when using
271643ecf206Smrg#   or distributing such scripts, even though portions of the text of the
271743ecf206Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271843ecf206Smrg#   all other use of the material that constitutes the Autoconf Macro.
271943ecf206Smrg#
272043ecf206Smrg#   This special exception to the GPL applies to versions of the Autoconf
272143ecf206Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
272243ecf206Smrg#   modified version of the Autoconf Macro, you may extend this special
272343ecf206Smrg#   exception to the GPL to apply to your modified version as well.#
272443ecf206SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272543ecf206Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
272643ecf206Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272743ecf206SmrgAS_LITERAL_IF([$1],
272843ecf206Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272943ecf206Smrg      ax_save_FLAGS=$LDFLAGS
273043ecf206Smrg      LDFLAGS="$1"
273143ecf206Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273243ecf206Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273343ecf206Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273443ecf206Smrg      LDFLAGS=$ax_save_FLAGS])],
273543ecf206Smrg  [ax_save_FLAGS=$LDFLAGS
273643ecf206Smrg   LDFLAGS="$1"
273743ecf206Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273843ecf206Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273943ecf206Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274043ecf206Smrg   LDFLAGS=$ax_save_FLAGS])
274143ecf206Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274243ecf206SmrgAC_MSG_RESULT($xorg_check_linker_flags)
274343ecf206Smrgif test "x$xorg_check_linker_flags" = xyes; then
274443ecf206Smrg	m4_default([$2], :)
274543ecf206Smrgelse
274643ecf206Smrg	m4_default([$3], :)
274743ecf206Smrgfi
274843ecf206Smrg]) # XORG_CHECK_LINKER_FLAGS
2749a8bb11d0Smrg
275043ecf206Smrg# XORG_MEMORY_CHECK_FLAGS
275143ecf206Smrg# -----------------------
275243ecf206Smrg# Minimum version: 1.16.0
275343ecf206Smrg#
275443ecf206Smrg# This macro attempts to find appropriate memory checking functionality
275543ecf206Smrg# for various platforms which unit testing code may use to catch various
275643ecf206Smrg# forms of memory allocation and access errors in testing.
275743ecf206Smrg#
275843ecf206Smrg# Interface to module:
275943ecf206Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276043ecf206Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276143ecf206Smrg#
276243ecf206Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276343ecf206Smrg#
276443ecf206SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765fd0c672fSmrg
276643ecf206SmrgAC_REQUIRE([AC_CANONICAL_HOST])
276743ecf206SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276843ecf206Smrg           [Environment variables to enable memory checking in tests])
2769fd0c672fSmrg
277043ecf206Smrg# Check for different types of support on different platforms
277143ecf206Smrgcase $host_os in
277243ecf206Smrg    solaris*)
277343ecf206Smrg        AC_CHECK_LIB([umem], [umem_alloc],
277443ecf206Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277543ecf206Smrg        ;;
277643ecf206Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277743ecf206Smrg        # both directly and inverted, so should not be 0 or 255.
277843ecf206Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
277943ecf206Smrg        ;;
278043ecf206Smrg    darwin*)
278143ecf206Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278243ecf206Smrg        ;;
278343ecf206Smrg    *bsd*)
278443ecf206Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278543ecf206Smrg        ;;
278643ecf206Smrgesac
27878846b520Smrg
278843ecf206Smrg# User supplied flags override default flags
278943ecf206Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279043ecf206Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791fd0c672fSmrgfi
2792fd0c672fSmrg
279343ecf206SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279443ecf206Smrg]) # XORG_WITH_LINT
279548e69166Smrg
279643ecf206Smrg# XORG_CHECK_MALLOC_ZERO
279743ecf206Smrg# ----------------------
279843ecf206Smrg# Minimum version: 1.0.0
27998846b520Smrg#
280043ecf206Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280143ecf206Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280243ecf206Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280343ecf206SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280443ecf206SmrgAC_ARG_ENABLE(malloc0returnsnull,
280543ecf206Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280643ecf206Smrg		       [malloc(0) returns NULL (default: auto)]),
280743ecf206Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280843ecf206Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
280948e69166Smrg
281043ecf206SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281143ecf206Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281243ecf206SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281343ecf206Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281443ecf206Smrg#include <stdlib.h>
281543ecf206Smrg],[
281643ecf206Smrg    char *m0, *r0, *c0, *p;
281743ecf206Smrg    m0 = malloc(0);
281843ecf206Smrg    p = malloc(10);
281943ecf206Smrg    r0 = realloc(p,0);
282043ecf206Smrg    c0 = calloc(0,10);
282143ecf206Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282243ecf206Smrg])],
282343ecf206Smrg		[xorg_cv_malloc0_returns_null=yes],
282443ecf206Smrg		[xorg_cv_malloc0_returns_null=no])])
282543ecf206SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826fd0c672fSmrgfi
282743ecf206SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828fd0c672fSmrg
282943ecf206Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283043ecf206Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283143ecf206Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283243ecf206Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28338846b520Smrgelse
283443ecf206Smrg	MALLOC_ZERO_CFLAGS=""
283543ecf206Smrg	XMALLOC_ZERO_CFLAGS=""
283643ecf206Smrg	XTMALLOC_ZERO_CFLAGS=""
28378846b520Smrgfi
2838fd0c672fSmrg
283943ecf206SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284043ecf206SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284143ecf206SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284243ecf206Smrg]) # XORG_CHECK_MALLOC_ZERO
2843fd0c672fSmrg
284443ecf206Smrg# XORG_WITH_LINT()
284543ecf206Smrg# ----------------
284643ecf206Smrg# Minimum version: 1.1.0
284748e69166Smrg#
284843ecf206Smrg# This macro enables the use of a tool that flags some suspicious and
284943ecf206Smrg# non-portable constructs (likely to be bugs) in C language source code.
285043ecf206Smrg# It will attempt to locate the tool and use appropriate options.
285143ecf206Smrg# There are various lint type tools on different platforms.
2852a8bb11d0Smrg#
285343ecf206Smrg# Interface to module:
285443ecf206Smrg# LINT:		returns the path to the tool found on the platform
285543ecf206Smrg#		or the value set to LINT on the configure cmd line
285643ecf206Smrg#		also an Automake conditional
285743ecf206Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
285843ecf206Smrg#
285943ecf206Smrg# --with-lint:	'yes' user instructs the module to use lint
286043ecf206Smrg#		'no' user instructs the module not to use lint (default)
286143ecf206Smrg#
286243ecf206Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286343ecf206Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286443ecf206Smrg#
286543ecf206SmrgAC_DEFUN([XORG_WITH_LINT],[
2866a8bb11d0Smrg
286743ecf206SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286843ecf206SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286943ecf206SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287043ecf206Smrg		[Use a lint-style source code checker (default: disabled)])],
287143ecf206Smrg		[use_lint=$withval], [use_lint=no])
2872a8bb11d0Smrg
287343ecf206Smrg# Obtain platform specific info like program name and options
287443ecf206Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287543ecf206Smrgcase $host_os in
287643ecf206Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287743ecf206Smrg	lint_name=splint
287843ecf206Smrg	lint_options="-badflag"
287943ecf206Smrg	;;
288043ecf206Smrg  *freebsd* | *netbsd*)
288143ecf206Smrg	lint_name=lint
288243ecf206Smrg	lint_options="-u -b"
288343ecf206Smrg	;;
288443ecf206Smrg  *solaris*)
288543ecf206Smrg	lint_name=lint
288643ecf206Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288743ecf206Smrg	;;
288843ecf206Smrgesac
288943ecf206Smrg
289043ecf206Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289143ecf206Smrgif test "x$use_lint" = x"yes" ; then
289243ecf206Smrg   AC_PATH_PROG([LINT], [$lint_name])
289343ecf206Smrg   if test "x$LINT" = "x"; then
289443ecf206Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289543ecf206Smrg   fi
289643ecf206Smrgelif test "x$use_lint" = x"no" ; then
289743ecf206Smrg   if test "x$LINT" != "x"; then
289843ecf206Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289943ecf206Smrg   fi
29008846b520Smrgelse
290143ecf206Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902a8bb11d0Smrgfi
2903a8bb11d0Smrg
290443ecf206Smrg# User supplied flags override default flags
290543ecf206Smrgif test "x$LINT_FLAGS" != "x"; then
290643ecf206Smrg   lint_options=$LINT_FLAGS
290743ecf206Smrgfi
2908a8bb11d0Smrg
290943ecf206SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291043ecf206SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911a8bb11d0Smrg
291243ecf206Smrg]) # XORG_WITH_LINT
2913a8bb11d0Smrg
291443ecf206Smrg# XORG_LINT_LIBRARY(LIBNAME)
291543ecf206Smrg# --------------------------
291643ecf206Smrg# Minimum version: 1.1.0
2917a8bb11d0Smrg#
291843ecf206Smrg# Sets up flags for building lint libraries for checking programs that call
291943ecf206Smrg# functions in the library.
292043ecf206Smrg#
292143ecf206Smrg# Interface to module:
292243ecf206Smrg# LINTLIB		- Automake variable with the name of lint library file to make
292343ecf206Smrg# MAKE_LINT_LIB		- Automake conditional
292443ecf206Smrg#
292543ecf206Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292643ecf206Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2927a8bb11d0Smrg
292843ecf206SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292943ecf206SmrgAC_REQUIRE([XORG_WITH_LINT])
293043ecf206SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293143ecf206Smrg	[Create lint library (default: disabled)])],
293243ecf206Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293343ecf206Smrg
293443ecf206Smrgif test "x$make_lint_lib" = x"yes" ; then
293543ecf206Smrg   LINTLIB=llib-l$1.ln
293643ecf206Smrg   if test "x$LINT" = "x"; then
293743ecf206Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293843ecf206Smrg   fi
293943ecf206Smrgelif test "x$make_lint_lib" != x"no" ; then
294043ecf206Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941a8bb11d0Smrgfi
2942a8bb11d0Smrg
294343ecf206SmrgAC_SUBST(LINTLIB)
294443ecf206SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29458846b520Smrg
294643ecf206Smrg]) # XORG_LINT_LIBRARY
29478846b520Smrg
294843ecf206Smrg# XORG_COMPILER_BRAND
29498846b520Smrg# -------------------
295043ecf206Smrg# Minimum version: 1.14.0
29518846b520Smrg#
295243ecf206Smrg# Checks for various brands of compilers and sets flags as appropriate:
295343ecf206Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295443ecf206Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295543ecf206Smrg#   clang compiler - sets CLANGCC to "yes"
295643ecf206Smrg#   Intel compiler - sets INTELCC to "yes"
295743ecf206Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295843ecf206Smrg#
295943ecf206SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296043ecf206SmrgAC_LANG_CASE(
296143ecf206Smrg	[C], [
296283f4f7f0Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
296383f4f7f0Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
296483f4f7f0Smrg		m4_version_prereq([2.70],
296583f4f7f0Smrg			[AC_REQUIRE([AC_PROG_CC])],
296683f4f7f0Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
296743ecf206Smrg	],
296843ecf206Smrg	[C++], [
296943ecf206Smrg		AC_REQUIRE([AC_PROG_CXX])
297043ecf206Smrg	]
297143ecf206Smrg)
297243ecf206SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
297343ecf206SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297443ecf206SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297543ecf206Smrg]) # XORG_COMPILER_BRAND
2976a8bb11d0Smrg
297743ecf206Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
29788846b520Smrg# ---------------
297943ecf206Smrg# Minimum version: 1.16.0
298043ecf206Smrg#
298143ecf206Smrg# Test if the compiler works when passed the given flag as a command line argument.
298283f4f7f0Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
298343ecf206Smrg# next flag in the list until there are no more options.
298443ecf206Smrg#
298543ecf206Smrg# Note that this does not guarantee that the compiler supports the flag as some
298643ecf206Smrg# compilers will simply ignore arguments that they do not understand, but we do
298743ecf206Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298843ecf206Smrg# -Werror=unused-command-line-argument
298943ecf206Smrg#
299043ecf206SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
299143ecf206Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
299243ecf206Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993a8bb11d0Smrg
299443ecf206SmrgAC_LANG_COMPILER_REQUIRE
2995a8bb11d0Smrg
299643ecf206SmrgAC_LANG_CASE(
299743ecf206Smrg	[C], [
299883f4f7f0Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
299983f4f7f0Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
300083f4f7f0Smrg		m4_version_prereq([2.70],
300183f4f7f0Smrg			[AC_REQUIRE([AC_PROG_CC])],
300283f4f7f0Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
300343ecf206Smrg		define([PREFIX], [C])
300443ecf206Smrg		define([CACHE_PREFIX], [cc])
300543ecf206Smrg		define([COMPILER], [$CC])
300643ecf206Smrg	],
300743ecf206Smrg	[C++], [
300843ecf206Smrg		define([PREFIX], [CXX])
300943ecf206Smrg		define([CACHE_PREFIX], [cxx])
301043ecf206Smrg		define([COMPILER], [$CXX])
301143ecf206Smrg	]
301243ecf206Smrg)
301343ecf206Smrg
301443ecf206Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
301543ecf206Smrg
301643ecf206Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
301743ecf206Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301843ecf206Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301943ecf206Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
302043ecf206Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302143ecf206Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
302243ecf206Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
302343ecf206Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
302443ecf206Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30258846b520Smrgfi
302643ecf206Smrg
302743ecf206Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302843ecf206Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302943ecf206Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303043ecf206Smrg	fi
303143ecf206Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
303243ecf206Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
303343ecf206Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
303443ecf206Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
303543ecf206Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
303643ecf206Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
303743ecf206Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303843ecf206Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303943ecf206Smrgfi
304043ecf206Smrg
304143ecf206Smrgfound="no"
304243ecf206Smrgm4_foreach([flag], m4_cdr($@), [
304343ecf206Smrg	if test $found = "no" ; then
304443ecf206Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
304543ecf206Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
304643ecf206Smrg		fi
304743ecf206Smrg
304843ecf206Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304943ecf206Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
305043ecf206Smrg		fi
305143ecf206Smrg
305243ecf206Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
305343ecf206Smrg
305443ecf206Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
305543ecf206Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
305643ecf206Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
305743ecf206Smrg		AC_CACHE_VAL($cacheid,
305843ecf206Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305943ecf206Smrg					     [eval $cacheid=yes],
306043ecf206Smrg					     [eval $cacheid=no])])
306143ecf206Smrg
306243ecf206Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
306343ecf206Smrg
306443ecf206Smrg		eval supported=\$$cacheid
306543ecf206Smrg		AC_MSG_RESULT([$supported])
306643ecf206Smrg		if test "$supported" = "yes" ; then
306743ecf206Smrg			$1="$$1 ]flag["
306843ecf206Smrg			found="yes"
306943ecf206Smrg		fi
307043ecf206Smrg	fi
30718846b520Smrg])
307243ecf206Smrg]) # XORG_TESTSET_CFLAG
3073a8bb11d0Smrg
307443ecf206Smrg# XORG_COMPILER_FLAGS
307543ecf206Smrg# ---------------
307643ecf206Smrg# Minimum version: 1.16.0
307748e69166Smrg#
307843ecf206Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307943ecf206Smrg# arguments supported by the selected compiler which do NOT alter the generated
308043ecf206Smrg# code.  These arguments will cause the compiler to print various warnings
308143ecf206Smrg# during compilation AND turn a conservative set of warnings into errors.
308243ecf206Smrg#
308343ecf206Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
308443ecf206Smrg# future versions of util-macros as options are added to new compilers.
308543ecf206Smrg#
308643ecf206SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
308743ecf206SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
308848e69166Smrg
308943ecf206SmrgAC_ARG_ENABLE(selective-werror,
309043ecf206Smrg              AS_HELP_STRING([--disable-selective-werror],
309143ecf206Smrg                             [Turn off selective compiler errors. (default: enabled)]),
309243ecf206Smrg              [SELECTIVE_WERROR=$enableval],
309343ecf206Smrg              [SELECTIVE_WERROR=yes])
309443ecf206Smrg
309543ecf206SmrgAC_LANG_CASE(
309643ecf206Smrg        [C], [
309743ecf206Smrg                define([PREFIX], [C])
309843ecf206Smrg        ],
309943ecf206Smrg        [C++], [
310043ecf206Smrg                define([PREFIX], [CXX])
310143ecf206Smrg        ]
310243ecf206Smrg)
310343ecf206Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
310443ecf206Smrgif test "x$SUNCC" = "xyes"; then
310543ecf206Smrg    [BASE_]PREFIX[FLAGS]="-v"
31068846b520Smrgelse
310743ecf206Smrg    [BASE_]PREFIX[FLAGS]=""
31088846b520Smrgfi
31098846b520Smrg
311043ecf206Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
311143ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
311243ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
311343ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
311443ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31158846b520Smrg
311643ecf206SmrgAC_LANG_CASE(
311743ecf206Smrg	[C], [
311843ecf206Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311943ecf206Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
312043ecf206Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
312143ecf206Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
312243ecf206Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
312343ecf206Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
312443ecf206Smrg	]
312543ecf206Smrg)
312648e69166Smrg
312743ecf206Smrg# This chunk adds additional warnings that could catch undesired effects.
312843ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312943ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
313043ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
313143ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
313243ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
313343ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
313443ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3135a8bb11d0Smrg
313643ecf206Smrg# These are currently disabled because they are noisy.  They will be enabled
313743ecf206Smrg# in the future once the codebase is sufficiently modernized to silence
313843ecf206Smrg# them.  For now, I don't want them to drown out the other warnings.
313943ecf206Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
314043ecf206Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
314143ecf206Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3142a8bb11d0Smrg
314383f4f7f0Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
314443ecf206Smrg# when there are problems that should be fixed.
3145a8bb11d0Smrg
314643ecf206Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
314743ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314843ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314943ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
315043ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
315143ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
315243ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
315343ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
315443ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
315543ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
315643ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
315743ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315843ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315943ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
316043ecf206Smrgelse
316143ecf206SmrgAC_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])
316243ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
316343ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
316443ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
316543ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
316643ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
316743ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316843ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316943ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
317043ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
317143ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
317243ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
317343ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
317443ecf206SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
317543ecf206Smrgfi
3176a8bb11d0Smrg
317743ecf206SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317843ecf206Smrg]) # XORG_COMPILER_FLAGS
317948e69166Smrg
318043ecf206Smrg# XORG_CWARNFLAGS
318143ecf206Smrg# ---------------
318243ecf206Smrg# Minimum version: 1.2.0
318343ecf206Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
318448e69166Smrg#
318543ecf206Smrg# Defines CWARNFLAGS to enable C compiler warnings.
318648e69166Smrg#
318743ecf206Smrg# This function is deprecated because it defines -fno-strict-aliasing
318843ecf206Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318943ecf206Smrg# is needed, then it should be added explicitly in the module when
319043ecf206Smrg# it is updated to use BASE_CFLAGS.
319148e69166Smrg#
319243ecf206SmrgAC_DEFUN([XORG_CWARNFLAGS], [
319343ecf206SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
319443ecf206SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
319543ecf206SmrgAC_LANG_CASE(
319643ecf206Smrg	[C], [
319743ecf206Smrg		CWARNFLAGS="$BASE_CFLAGS"
319843ecf206Smrg		if  test "x$GCC" = xyes ; then
319943ecf206Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
320043ecf206Smrg		fi
320143ecf206Smrg		AC_SUBST(CWARNFLAGS)
320243ecf206Smrg	]
320343ecf206Smrg)
320443ecf206Smrg]) # XORG_CWARNFLAGS
3205fd0c672fSmrg
320643ecf206Smrg# XORG_STRICT_OPTION
320743ecf206Smrg# -----------------------
320843ecf206Smrg# Minimum version: 1.3.0
320943ecf206Smrg#
321043ecf206Smrg# Add configure option to enable strict compilation flags, such as treating
321143ecf206Smrg# warnings as fatal errors.
321243ecf206Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
321343ecf206Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
321443ecf206Smrg#
321543ecf206Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
321643ecf206Smrg# when strict compilation is unconditionally desired.
321743ecf206SmrgAC_DEFUN([XORG_STRICT_OPTION], [
321843ecf206SmrgAC_REQUIRE([XORG_CWARNFLAGS])
321943ecf206SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32208846b520Smrg
322143ecf206SmrgAC_ARG_ENABLE(strict-compilation,
322243ecf206Smrg			  AS_HELP_STRING([--enable-strict-compilation],
322343ecf206Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
322443ecf206Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
32258846b520Smrg
322643ecf206SmrgAC_LANG_CASE(
322743ecf206Smrg        [C], [
322843ecf206Smrg                define([PREFIX], [C])
322943ecf206Smrg        ],
323043ecf206Smrg        [C++], [
323143ecf206Smrg                define([PREFIX], [CXX])
323243ecf206Smrg        ]
323343ecf206Smrg)
32348846b520Smrg
323543ecf206Smrg[STRICT_]PREFIX[FLAGS]=""
323643ecf206SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
323743ecf206SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
32388846b520Smrg
323943ecf206Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
324043ecf206Smrg# activate it with -Werror, so we add it here explicitly.
324143ecf206SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
32428846b520Smrg
324343ecf206Smrgif test "x$STRICT_COMPILE" = "xyes"; then
324443ecf206Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
324543ecf206Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
324643ecf206Smrgfi
324743ecf206SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324843ecf206SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324943ecf206SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
325043ecf206Smrg]) # XORG_STRICT_OPTION
32518846b520Smrg
325283f4f7f0Smrg# XORG_DEFAULT_NOCODE_OPTIONS
325383f4f7f0Smrg# ---------------------------
325483f4f7f0Smrg# Minimum version: 1.20.0
325583f4f7f0Smrg#
325683f4f7f0Smrg# Defines default options for X.Org modules which don't compile code,
325783f4f7f0Smrg# such as fonts, bitmaps, cursors, and docs.
325883f4f7f0Smrg#
325983f4f7f0SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
326083f4f7f0SmrgAC_REQUIRE([AC_PROG_INSTALL])
326183f4f7f0SmrgXORG_RELEASE_VERSION
326283f4f7f0SmrgXORG_CHANGELOG
326383f4f7f0SmrgXORG_INSTALL
326483f4f7f0SmrgXORG_MANPAGE_SECTIONS
326583f4f7f0Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326683f4f7f0Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
326783f4f7f0Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
326883f4f7f0Smrg
326943ecf206Smrg# XORG_DEFAULT_OPTIONS
327043ecf206Smrg# --------------------
327143ecf206Smrg# Minimum version: 1.3.0
327243ecf206Smrg#
327383f4f7f0Smrg# Defines default options for X.Org modules which compile code.
327443ecf206Smrg#
327543ecf206SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
327643ecf206SmrgAC_REQUIRE([AC_PROG_INSTALL])
327743ecf206SmrgXORG_COMPILER_FLAGS
327843ecf206SmrgXORG_CWARNFLAGS
327943ecf206SmrgXORG_STRICT_OPTION
328083f4f7f0SmrgXORG_DEFAULT_NOCODE_OPTIONS
328143ecf206Smrg]) # XORG_DEFAULT_OPTIONS
32828846b520Smrg
328343ecf206Smrg# XORG_INSTALL()
328443ecf206Smrg# ----------------
328543ecf206Smrg# Minimum version: 1.4.0
328643ecf206Smrg#
328743ecf206Smrg# Defines the variable INSTALL_CMD as the command to copy
328843ecf206Smrg# INSTALL from $prefix/share/util-macros.
328943ecf206Smrg#
329043ecf206SmrgAC_DEFUN([XORG_INSTALL], [
329143ecf206SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
329243ecf206Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
329343ecf206SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
329443ecf206Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
329543ecf206Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
329643ecf206Smrgtouch \$(top_srcdir)/INSTALL; \
329743ecf206Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
329843ecf206SmrgAC_SUBST([INSTALL_CMD])
329943ecf206Smrg]) # XORG_INSTALL
330043ecf206Smrgdnl Copyright 2005 Red Hat, Inc
330143ecf206Smrgdnl
330243ecf206Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
330343ecf206Smrgdnl documentation for any purpose is hereby granted without fee, provided that
330443ecf206Smrgdnl the above copyright notice appear in all copies and that both that
330543ecf206Smrgdnl copyright notice and this permission notice appear in supporting
330643ecf206Smrgdnl documentation.
330743ecf206Smrgdnl
330843ecf206Smrgdnl The above copyright notice and this permission notice shall be included
330943ecf206Smrgdnl in all copies or substantial portions of the Software.
331043ecf206Smrgdnl
331143ecf206Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
331243ecf206Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
331343ecf206Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
331443ecf206Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
331543ecf206Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
331643ecf206Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
331743ecf206Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
331843ecf206Smrgdnl
331943ecf206Smrgdnl Except as contained in this notice, the name of the copyright holders shall
332043ecf206Smrgdnl not be used in advertising or otherwise to promote the sale, use or
332143ecf206Smrgdnl other dealings in this Software without prior written authorization
332243ecf206Smrgdnl from the copyright holders.
332343ecf206Smrgdnl
33248846b520Smrg
332543ecf206Smrg# XORG_RELEASE_VERSION
332643ecf206Smrg# --------------------
332743ecf206Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
332848e69166Smrg
332943ecf206SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
333043ecf206Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
333143ecf206Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
333243ecf206Smrg		[Major version of this package])
333343ecf206Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
333443ecf206Smrg	if test "x$PVM" = "x"; then
333543ecf206Smrg		PVM="0"
333643ecf206Smrg	fi
333743ecf206Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
333843ecf206Smrg		[$PVM],
333943ecf206Smrg		[Minor version of this package])
334043ecf206Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
334143ecf206Smrg	if test "x$PVP" = "x"; then
334243ecf206Smrg		PVP="0"
334343ecf206Smrg	fi
334443ecf206Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
334543ecf206Smrg		[$PVP],
334643ecf206Smrg		[Patch version of this package])
334743ecf206Smrg])
33488846b520Smrg
334943ecf206Smrg# XORG_CHANGELOG()
335043ecf206Smrg# ----------------
335143ecf206Smrg# Minimum version: 1.2.0
335243ecf206Smrg#
335343ecf206Smrg# Defines the variable CHANGELOG_CMD as the command to generate
335443ecf206Smrg# ChangeLog from git.
335543ecf206Smrg#
335643ecf206Smrg#
335743ecf206SmrgAC_DEFUN([XORG_CHANGELOG], [
335843ecf206SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
335943ecf206Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
336043ecf206Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
336143ecf206Smrgtouch \$(top_srcdir)/ChangeLog; \
336243ecf206Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
336343ecf206SmrgAC_SUBST([CHANGELOG_CMD])
336443ecf206Smrg]) # XORG_CHANGELOG
33658846b520Smrg
33668846b520Smrgm4_include([m4/ax_define_dir.m4])
3367