aclocal.m4 revision 09113985
109113985Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
24a908991Smrg
309113985Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4a0d3b6eaSmrg
5a0d3b6eaSmrg# This file is free software; the Free Software Foundation
6a0d3b6eaSmrg# gives unlimited permission to copy and/or distribute it,
7a0d3b6eaSmrg# with or without modifications, as long as this notice is preserved.
8a0d3b6eaSmrg
9a0d3b6eaSmrg# This program is distributed in the hope that it will be useful,
10a0d3b6eaSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a0d3b6eaSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a0d3b6eaSmrg# PARTICULAR PURPOSE.
13a0d3b6eaSmrg
144a908991Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15a0d3b6eaSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16a0d3b6eaSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1709113985Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
1809113985Smrg[m4_warning([this file was generated for autoconf 2.71.
19a0d3b6eaSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20a0d3b6eaSmrgIf you have problems, you may need to regenerate the build system entirely.
214a908991SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
224a908991Smrg
2309113985Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2409113985Smrg#
2509113985Smrg# This file is free software; the Free Software Foundation
2609113985Smrg# gives unlimited permission to copy and/or distribute it,
2709113985Smrg# with or without modifications, as long as this notice is preserved.
284a908991Smrg
2909113985Smrg# AM_AUTOMAKE_VERSION(VERSION)
3009113985Smrg# ----------------------------
3109113985Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3209113985Smrg# generated from the m4 files accompanying Automake X.Y.
3309113985Smrg# (This private macro should not be called outside this file.)
3409113985SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3509113985Smrg[am__api_version='1.16'
3609113985Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3709113985Smrgdnl require some minimum version.  Point them to the right macro.
3809113985Smrgm4_if([$1], [1.16.5], [],
3909113985Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4009113985Smrg])
414a908991Smrg
4209113985Smrg# _AM_AUTOCONF_VERSION(VERSION)
4309113985Smrg# -----------------------------
4409113985Smrg# aclocal traces this macro to find the Autoconf version.
4509113985Smrg# This is a private macro too.  Using m4_define simplifies
4609113985Smrg# the logic in aclocal, which can simply ignore this definition.
4709113985Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48a0d3b6eaSmrg
4909113985Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5009113985Smrg# -------------------------------
5109113985Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5209113985Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5309113985SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5409113985Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5509113985Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5609113985Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5709113985Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58a0d3b6eaSmrg
5909113985Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60a0d3b6eaSmrg
6109113985Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6209113985Smrg#
6309113985Smrg# This file is free software; the Free Software Foundation
6409113985Smrg# gives unlimited permission to copy and/or distribute it,
6509113985Smrg# with or without modifications, as long as this notice is preserved.
66a0d3b6eaSmrg
6709113985Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6809113985Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6909113985Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7009113985Smrg#
7109113985Smrg# Of course, Automake must honor this variable whenever it calls a
7209113985Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7309113985Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7409113985Smrg# depending on how configure is run.  This is pretty annoying, since
7509113985Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7609113985Smrg# source directory, any form will work fine, but in subdirectories a
7709113985Smrg# relative path needs to be adjusted first.
7809113985Smrg#
7909113985Smrg# $ac_aux_dir/missing
8009113985Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8109113985Smrg# $top_srcdir/$ac_aux_dir/missing
8209113985Smrg#    fails if $ac_aux_dir is absolute,
8309113985Smrg#    fails when called from a subdirectory in a VPATH build with
8409113985Smrg#          a relative $ac_aux_dir
8509113985Smrg#
8609113985Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8709113985Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8809113985Smrg# harmless because $srcdir is '.', but things will broke when you
8909113985Smrg# start a VPATH build or use an absolute $srcdir.
9009113985Smrg#
9109113985Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9209113985Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9309113985Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9409113985Smrg# and then we would define $MISSING as
9509113985Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9609113985Smrg# This will work as long as MISSING is not called from configure, because
9709113985Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9809113985Smrg# However there are other variables, like CC, which are often used in
9909113985Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10009113985Smrg#
10109113985Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10209113985Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10309113985Smrg# configured tree to be moved without reconfiguration.
104966b534aSmrg
10509113985SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10609113985Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10709113985Smrg# Expand $ac_aux_dir to an absolute path.
10809113985Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10909113985Smrg])
110fa120d7cSmrg
11109113985Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112a0d3b6eaSmrg
11309113985Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11409113985Smrg#
11509113985Smrg# This file is free software; the Free Software Foundation
11609113985Smrg# gives unlimited permission to copy and/or distribute it,
11709113985Smrg# with or without modifications, as long as this notice is preserved.
118a0d3b6eaSmrg
11909113985Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12009113985Smrg# -------------------------------------
12109113985Smrg# Define a conditional.
12209113985SmrgAC_DEFUN([AM_CONDITIONAL],
12309113985Smrg[AC_PREREQ([2.52])dnl
12409113985Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12509113985Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12609113985SmrgAC_SUBST([$1_TRUE])dnl
12709113985SmrgAC_SUBST([$1_FALSE])dnl
12809113985Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12909113985Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13009113985Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13109113985Smrgif $2; then
13209113985Smrg  $1_TRUE=
13309113985Smrg  $1_FALSE='#'
13409113985Smrgelse
13509113985Smrg  $1_TRUE='#'
13609113985Smrg  $1_FALSE=
13709113985Smrgfi
13809113985SmrgAC_CONFIG_COMMANDS_PRE(
13909113985Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14009113985Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14109113985SmrgUsually this means the macro was only invoked conditionally.]])
14209113985Smrgfi])])
143a0d3b6eaSmrg
14409113985Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14509113985Smrg#
14609113985Smrg# This file is free software; the Free Software Foundation
14709113985Smrg# gives unlimited permission to copy and/or distribute it,
14809113985Smrg# with or without modifications, as long as this notice is preserved.
149a0d3b6eaSmrg
150a0d3b6eaSmrg
15109113985Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15209113985Smrg# written in clear, in which case automake, when reading aclocal.m4,
15309113985Smrg# will think it sees a *use*, and therefore will trigger all it's
15409113985Smrg# C support machinery.  Also note that it means that autoscan, seeing
15509113985Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156a0d3b6eaSmrg
157a0d3b6eaSmrg
15809113985Smrg# _AM_DEPENDENCIES(NAME)
15909113985Smrg# ----------------------
16009113985Smrg# See how the compiler implements dependency checking.
16109113985Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16209113985Smrg# We try a few techniques and use that to set a single cache variable.
16309113985Smrg#
16409113985Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16509113985Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16609113985Smrg# dependency, and given that the user is not expected to run this macro,
16709113985Smrg# just rely on AC_PROG_CC.
16809113985SmrgAC_DEFUN([_AM_DEPENDENCIES],
16909113985Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17009113985SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17109113985SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17209113985SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173a0d3b6eaSmrg
17409113985Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17509113985Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17609113985Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17709113985Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17809113985Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17909113985Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18009113985Smrg                    [depcc="$$1"   am_compiler_list=])
181a0d3b6eaSmrg
18209113985SmrgAC_CACHE_CHECK([dependency style of $depcc],
18309113985Smrg               [am_cv_$1_dependencies_compiler_type],
18409113985Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18509113985Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18609113985Smrg  # making bogus files that we don't know about and never remove.  For
18709113985Smrg  # instance it was reported that on HP-UX the gcc test will end up
18809113985Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18909113985Smrg  # in D".
19009113985Smrg  rm -rf conftest.dir
19109113985Smrg  mkdir conftest.dir
19209113985Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19309113985Smrg  # using a relative directory.
19409113985Smrg  cp "$am_depcomp" conftest.dir
19509113985Smrg  cd conftest.dir
19609113985Smrg  # We will build objects and dependencies in a subdirectory because
19709113985Smrg  # it helps to detect inapplicable dependency modes.  For instance
19809113985Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19909113985Smrg  # side effect of compilation, but ICC will put the dependencies in
20009113985Smrg  # the current directory while Tru64 will put them in the object
20109113985Smrg  # directory.
20209113985Smrg  mkdir sub
203a0d3b6eaSmrg
20409113985Smrg  am_cv_$1_dependencies_compiler_type=none
20509113985Smrg  if test "$am_compiler_list" = ""; then
20609113985Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20709113985Smrg  fi
20809113985Smrg  am__universal=false
20909113985Smrg  m4_case([$1], [CC],
21009113985Smrg    [case " $depcc " in #(
21109113985Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21209113985Smrg     esac],
21309113985Smrg    [CXX],
21409113985Smrg    [case " $depcc " in #(
21509113985Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21609113985Smrg     esac])
2174a908991Smrg
21809113985Smrg  for depmode in $am_compiler_list; do
21909113985Smrg    # Setup a source with many dependencies, because some compilers
22009113985Smrg    # like to wrap large dependency lists on column 80 (with \), and
22109113985Smrg    # we should not choose a depcomp mode which is confused by this.
22209113985Smrg    #
22309113985Smrg    # We need to recreate these files for each test, as the compiler may
22409113985Smrg    # overwrite some of them when testing with obscure command lines.
22509113985Smrg    # This happens at least with the AIX C compiler.
22609113985Smrg    : > sub/conftest.c
22709113985Smrg    for i in 1 2 3 4 5 6; do
22809113985Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22909113985Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23009113985Smrg      # Solaris 10 /bin/sh.
23109113985Smrg      echo '/* dummy */' > sub/conftst$i.h
23209113985Smrg    done
23309113985Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2344a908991Smrg
23509113985Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23609113985Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23709113985Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23809113985Smrg    # versions had trouble with output in subdirs.
23909113985Smrg    am__obj=sub/conftest.${OBJEXT-o}
24009113985Smrg    am__minus_obj="-o $am__obj"
24109113985Smrg    case $depmode in
24209113985Smrg    gcc)
24309113985Smrg      # This depmode causes a compiler race in universal mode.
24409113985Smrg      test "$am__universal" = false || continue
24509113985Smrg      ;;
24609113985Smrg    nosideeffect)
24709113985Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24809113985Smrg      # only be used when explicitly requested.
24909113985Smrg      if test "x$enable_dependency_tracking" = xyes; then
25009113985Smrg	continue
25109113985Smrg      else
25209113985Smrg	break
25309113985Smrg      fi
25409113985Smrg      ;;
25509113985Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25609113985Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25709113985Smrg      # not run yet.  These depmodes are late enough in the game, and
25809113985Smrg      # so weak that their functioning should not be impacted.
25909113985Smrg      am__obj=conftest.${OBJEXT-o}
26009113985Smrg      am__minus_obj=
26109113985Smrg      ;;
26209113985Smrg    none) break ;;
26309113985Smrg    esac
26409113985Smrg    if depmode=$depmode \
26509113985Smrg       source=sub/conftest.c object=$am__obj \
26609113985Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26709113985Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26809113985Smrg         >/dev/null 2>conftest.err &&
26909113985Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27009113985Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27109113985Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27209113985Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27309113985Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27409113985Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27509113985Smrg      # that says an option was ignored or not supported.
27609113985Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27709113985Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27809113985Smrg      # The diagnosis changed in icc 8.0:
27909113985Smrg      #   icc: Command line remark: option '-MP' not supported
28009113985Smrg      if (grep 'ignoring option' conftest.err ||
28109113985Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28209113985Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28309113985Smrg        break
28409113985Smrg      fi
28509113985Smrg    fi
28609113985Smrg  done
2874a908991Smrg
28809113985Smrg  cd ..
28909113985Smrg  rm -rf conftest.dir
29009113985Smrgelse
29109113985Smrg  am_cv_$1_dependencies_compiler_type=none
29209113985Smrgfi
29309113985Smrg])
29409113985SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29509113985SmrgAM_CONDITIONAL([am__fastdep$1], [
29609113985Smrg  test "x$enable_dependency_tracking" != xno \
29709113985Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29809113985Smrg])
2994a908991Smrg
3004a908991Smrg
30109113985Smrg# AM_SET_DEPDIR
30209113985Smrg# -------------
30309113985Smrg# Choose a directory name for dependency files.
30409113985Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30509113985SmrgAC_DEFUN([AM_SET_DEPDIR],
30609113985Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30709113985SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30809113985Smrg])
3094a908991Smrg
3104a908991Smrg
31109113985Smrg# AM_DEP_TRACK
31209113985Smrg# ------------
31309113985SmrgAC_DEFUN([AM_DEP_TRACK],
31409113985Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31509113985SmrgAS_HELP_STRING(
31609113985Smrg  [--enable-dependency-tracking],
31709113985Smrg  [do not reject slow dependency extractors])
31809113985SmrgAS_HELP_STRING(
31909113985Smrg  [--disable-dependency-tracking],
32009113985Smrg  [speeds up one-time build])])
32109113985Smrgif test "x$enable_dependency_tracking" != xno; then
32209113985Smrg  am_depcomp="$ac_aux_dir/depcomp"
32309113985Smrg  AMDEPBACKSLASH='\'
32409113985Smrg  am__nodep='_no'
32509113985Smrgfi
32609113985SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32709113985SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32809113985Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32909113985SmrgAC_SUBST([am__nodep])dnl
33009113985Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33109113985Smrg])
3324a908991Smrg
33309113985Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3344a908991Smrg
33509113985Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
33609113985Smrg#
33709113985Smrg# This file is free software; the Free Software Foundation
33809113985Smrg# gives unlimited permission to copy and/or distribute it,
33909113985Smrg# with or without modifications, as long as this notice is preserved.
3404a908991Smrg
34109113985Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34209113985Smrg# ------------------------------
34309113985SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34409113985Smrg[{
34509113985Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34609113985Smrg  # are listed without --file.  Let's play safe and only enable the eval
34709113985Smrg  # if we detect the quoting.
34809113985Smrg  # TODO: see whether this extra hack can be removed once we start
34909113985Smrg  # requiring Autoconf 2.70 or later.
35009113985Smrg  AS_CASE([$CONFIG_FILES],
35109113985Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
35209113985Smrg          [*], [set x $CONFIG_FILES])
35309113985Smrg  shift
35409113985Smrg  # Used to flag and report bootstrapping failures.
35509113985Smrg  am_rc=0
35609113985Smrg  for am_mf
35709113985Smrg  do
35809113985Smrg    # Strip MF so we end up with the name of the file.
35909113985Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36009113985Smrg    # Check whether this is an Automake generated Makefile which includes
36109113985Smrg    # dependency-tracking related rules and includes.
36209113985Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36309113985Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36409113985Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36509113985Smrg      || continue
36609113985Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36709113985Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36809113985Smrg    AM_RUN_LOG([cd "$am_dirpart" \
36909113985Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37009113985Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37109113985Smrg  done
37209113985Smrg  if test $am_rc -ne 0; then
37309113985Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37409113985Smrg    for automatic dependency tracking.  If GNU make was not used, consider
37509113985Smrg    re-running the configure script with MAKE="gmake" (or whatever is
37609113985Smrg    necessary).  You can also try re-running configure with the
37709113985Smrg    '--disable-dependency-tracking' option to at least be able to build
37809113985Smrg    the package (albeit without support for automatic dependency tracking).])
37909113985Smrg  fi
38009113985Smrg  AS_UNSET([am_dirpart])
38109113985Smrg  AS_UNSET([am_filepart])
38209113985Smrg  AS_UNSET([am_mf])
38309113985Smrg  AS_UNSET([am_rc])
38409113985Smrg  rm -f conftest-deps.mk
38509113985Smrg}
38609113985Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387a0d3b6eaSmrg
388a0d3b6eaSmrg
38909113985Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39009113985Smrg# -----------------------------
39109113985Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392fa120d7cSmrg#
39309113985Smrg# This code is only required when automatic dependency tracking is enabled.
39409113985Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39509113985Smrg# order to bootstrap the dependency handling code.
39609113985SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39709113985Smrg[AC_CONFIG_COMMANDS([depfiles],
39809113985Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39909113985Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400a0d3b6eaSmrg
40109113985Smrg# Do all the work for Automake.                             -*- Autoconf -*-
40209113985Smrg
40309113985Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
404fa120d7cSmrg#
40509113985Smrg# This file is free software; the Free Software Foundation
40609113985Smrg# gives unlimited permission to copy and/or distribute it,
40709113985Smrg# with or without modifications, as long as this notice is preserved.
408a0d3b6eaSmrg
40909113985Smrg# This macro actually does too much.  Some checks are only needed if
41009113985Smrg# your package does certain things.  But this isn't really a big deal.
41109113985Smrg
41209113985Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41309113985Smrgm4_define([AC_PROG_CC],
41409113985Smrgm4_defn([AC_PROG_CC])
41509113985Smrg[_AM_PROG_CC_C_O
41609113985Smrg])
41709113985Smrg
41809113985Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41909113985Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42009113985Smrg# -----------------------------------------------
42109113985Smrg# The call with PACKAGE and VERSION arguments is the old style
42209113985Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42309113985Smrg# and VERSION should now be passed to AC_INIT and removed from
42409113985Smrg# the call to AM_INIT_AUTOMAKE.
42509113985Smrg# We support both call styles for the transition.  After
42609113985Smrg# the next Automake release, Autoconf can make the AC_INIT
42709113985Smrg# arguments mandatory, and then we can depend on a new Autoconf
42809113985Smrg# release and drop the old call support.
42909113985SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43009113985Smrg[AC_PREREQ([2.65])dnl
43109113985Smrgm4_ifdef([_$0_ALREADY_INIT],
43209113985Smrg  [m4_fatal([$0 expanded multiple times
43309113985Smrg]m4_defn([_$0_ALREADY_INIT]))],
43409113985Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43509113985Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43609113985Smrgdnl the ones we care about.
43709113985Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43809113985SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43909113985SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44009113985Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44109113985Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44209113985Smrg  # is not polluted with repeated "-I."
44309113985Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44409113985Smrg  # test to see if srcdir already configured
44509113985Smrg  if test -f $srcdir/config.status; then
44609113985Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44709113985Smrg  fi
448966b534aSmrgfi
449f8a31ee4Smrg
45009113985Smrg# test whether we have cygpath
45109113985Smrgif test -z "$CYGPATH_W"; then
45209113985Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45309113985Smrg    CYGPATH_W='cygpath -w'
45409113985Smrg  else
45509113985Smrg    CYGPATH_W=echo
45609113985Smrg  fi
457fa120d7cSmrgfi
45809113985SmrgAC_SUBST([CYGPATH_W])
459966b534aSmrg
46009113985Smrg# Define the identity of the package.
46109113985Smrgdnl Distinguish between old-style and new-style calls.
46209113985Smrgm4_ifval([$2],
46309113985Smrg[AC_DIAGNOSE([obsolete],
46409113985Smrg             [$0: two- and three-arguments forms are deprecated.])
46509113985Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46609113985Smrg AC_SUBST([PACKAGE], [$1])dnl
46709113985Smrg AC_SUBST([VERSION], [$2])],
46809113985Smrg[_AM_SET_OPTIONS([$1])dnl
46909113985Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47009113985Smrgm4_if(
47109113985Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47209113985Smrg  [ok:ok],,
47309113985Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47409113985Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47509113985Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476f8a31ee4Smrg
47709113985Smrg_AM_IF_OPTION([no-define],,
47809113985Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47909113985Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480a0d3b6eaSmrg
48109113985Smrg# Some tools Automake needs.
48209113985SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48309113985SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48409113985SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48509113985SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48609113985SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48709113985SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48809113985SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48909113985SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49009113985SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49109113985SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49209113985Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49309113985Smrg# dies out for good.  For more background, see:
49409113985Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49509113985Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49609113985SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49709113985Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49809113985Smrg# system "awk" is bad on some platforms.
49909113985SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50009113985SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50109113985SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50209113985Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50309113985Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50409113985Smrg			     [_AM_PROG_TAR([v7])])])
50509113985Smrg_AM_IF_OPTION([no-dependencies],,
50609113985Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50709113985Smrg		  [_AM_DEPENDENCIES([CC])],
50809113985Smrg		  [m4_define([AC_PROG_CC],
50909113985Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51009113985SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51109113985Smrg		  [_AM_DEPENDENCIES([CXX])],
51209113985Smrg		  [m4_define([AC_PROG_CXX],
51309113985Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51409113985SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51509113985Smrg		  [_AM_DEPENDENCIES([OBJC])],
51609113985Smrg		  [m4_define([AC_PROG_OBJC],
51709113985Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51809113985SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51909113985Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52009113985Smrg		  [m4_define([AC_PROG_OBJCXX],
52109113985Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52209113985Smrg])
52309113985Smrg# Variables for tags utilities; see am/tags.am
52409113985Smrgif test -z "$CTAGS"; then
52509113985Smrg  CTAGS=ctags
526fa120d7cSmrgfi
52709113985SmrgAC_SUBST([CTAGS])
52809113985Smrgif test -z "$ETAGS"; then
52909113985Smrg  ETAGS=etags
530fa120d7cSmrgfi
53109113985SmrgAC_SUBST([ETAGS])
53209113985Smrgif test -z "$CSCOPE"; then
53309113985Smrg  CSCOPE=cscope
534fa120d7cSmrgfi
53509113985SmrgAC_SUBST([CSCOPE])
536966b534aSmrg
53709113985SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53809113985Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53909113985Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54009113985Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54109113985SmrgAC_CONFIG_COMMANDS_PRE(dnl
54209113985Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54309113985Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544fa120d7cSmrg
54509113985Smrg# POSIX will say in a future version that running "rm -f" with no argument
54609113985Smrg# is OK; and we want to be able to make that assumption in our Makefile
54709113985Smrg# recipes.  So use an aggressive probe to check that the usage we want is
54809113985Smrg# actually supported "in the wild" to an acceptable degree.
54909113985Smrg# See automake bug#10828.
55009113985Smrg# To make any issue more visible, cause the running configure to be aborted
55109113985Smrg# by default if the 'rm' program in use doesn't match our expectations; the
55209113985Smrg# user can still override this though.
55309113985Smrgif rm -f && rm -fr && rm -rf; then : OK; else
55409113985Smrg  cat >&2 <<'END'
55509113985SmrgOops!
556fa120d7cSmrg
55709113985SmrgYour 'rm' program seems unable to run without file operands specified
55809113985Smrgon the command line, even when the '-f' option is present.  This is contrary
55909113985Smrgto the behaviour of most rm programs out there, and not conforming with
56009113985Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561fa120d7cSmrg
56209113985SmrgPlease tell bug-automake@gnu.org about your system, including the value
56309113985Smrgof your $PATH and any error possibly output before this message.  This
56409113985Smrgcan help us improve future automake versions.
565fa120d7cSmrg
56609113985SmrgEND
56709113985Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56809113985Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56909113985Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57009113985Smrg    echo >&2
57109113985Smrg  else
57209113985Smrg    cat >&2 <<'END'
57309113985SmrgAborting the configuration process, to ensure you take notice of the issue.
574fa120d7cSmrg
57509113985SmrgYou can download and install GNU coreutils to get an 'rm' implementation
57609113985Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577fa120d7cSmrg
57809113985SmrgIf you want to complete the configuration process using your problematic
57909113985Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58009113985Smrgto "yes", and re-run configure.
581fa120d7cSmrg
58209113985SmrgEND
58309113985Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58409113985Smrg  fi
58509113985Smrgfi
58609113985Smrgdnl The trailing newline in this macro's definition is deliberate, for
58709113985Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58809113985Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58909113985Smrg])
590fa120d7cSmrg
59109113985Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59209113985Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59309113985Smrgdnl mangled by Autoconf and run in a shell conditional statement.
59409113985Smrgm4_define([_AC_COMPILER_EXEEXT],
59509113985Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596a0d3b6eaSmrg
59709113985Smrg# When config.status generates a header, we must update the stamp-h file.
59809113985Smrg# This file resides in the same directory as the config header
59909113985Smrg# that is generated.  The stamp files are numbered to have different names.
600966b534aSmrg
60109113985Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60209113985Smrg# loop where config.status creates the headers, so we can generate
60309113985Smrg# our stamp files there.
60409113985SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60509113985Smrg[# Compute $1's index in $config_headers.
60609113985Smrg_am_arg=$1
60709113985Smrg_am_stamp_count=1
60809113985Smrgfor _am_header in $config_headers :; do
60909113985Smrg  case $_am_header in
61009113985Smrg    $_am_arg | $_am_arg:* )
61109113985Smrg      break ;;
61209113985Smrg    * )
61309113985Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61409113985Smrg  esac
61509113985Smrgdone
61609113985Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617fa120d7cSmrg
61809113985Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6194def10e6Smrg#
62009113985Smrg# This file is free software; the Free Software Foundation
62109113985Smrg# gives unlimited permission to copy and/or distribute it,
62209113985Smrg# with or without modifications, as long as this notice is preserved.
623a0d3b6eaSmrg
62409113985Smrg# AM_PROG_INSTALL_SH
62509113985Smrg# ------------------
62609113985Smrg# Define $install_sh.
62709113985SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62809113985Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62909113985Smrgif test x"${install_sh+set}" != xset; then
63009113985Smrg  case $am_aux_dir in
63109113985Smrg  *\ * | *\	*)
63209113985Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63309113985Smrg  *)
63409113985Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63509113985Smrg  esac
63609113985Smrgfi
63709113985SmrgAC_SUBST([install_sh])])
638a0d3b6eaSmrg
63909113985Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64009113985Smrg#
64109113985Smrg# This file is free software; the Free Software Foundation
64209113985Smrg# gives unlimited permission to copy and/or distribute it,
64309113985Smrg# with or without modifications, as long as this notice is preserved.
644a0d3b6eaSmrg
64509113985Smrg# Check whether the underlying file-system supports filenames
64609113985Smrg# with a leading dot.  For instance MS-DOS doesn't.
64709113985SmrgAC_DEFUN([AM_SET_LEADING_DOT],
64809113985Smrg[rm -rf .tst 2>/dev/null
64909113985Smrgmkdir .tst 2>/dev/null
65009113985Smrgif test -d .tst; then
65109113985Smrg  am__leading_dot=.
652fa120d7cSmrgelse
65309113985Smrg  am__leading_dot=_
654a0d3b6eaSmrgfi
65509113985Smrgrmdir .tst 2>/dev/null
65609113985SmrgAC_SUBST([am__leading_dot])])
657a0d3b6eaSmrg
65809113985Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659966b534aSmrg
66009113985Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66109113985Smrg#
66209113985Smrg# This file is free software; the Free Software Foundation
66309113985Smrg# gives unlimited permission to copy and/or distribute it,
66409113985Smrg# with or without modifications, as long as this notice is preserved.
665966b534aSmrg
66609113985Smrg# AM_MAKE_INCLUDE()
66709113985Smrg# -----------------
66809113985Smrg# Check whether make has an 'include' directive that can support all
66909113985Smrg# the idioms we need for our automatic dependency tracking code.
67009113985SmrgAC_DEFUN([AM_MAKE_INCLUDE],
67109113985Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
67209113985Smrgcat > confinc.mk << 'END'
67309113985Smrgam__doit:
67409113985Smrg	@echo this is the am__doit target >confinc.out
67509113985Smrg.PHONY: am__doit
67609113985SmrgEND
67709113985Smrgam__include="#"
67809113985Smrgam__quote=
67909113985Smrg# BSD make does it like this.
68009113985Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
68109113985Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
68209113985Smrgecho 'include confinc.mk # ignored' > confmf.GNU
68309113985Smrg_am_result=no
68409113985Smrgfor s in GNU BSD; do
68509113985Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
68609113985Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
68709113985Smrg      ['0:this is the am__doit target'],
68809113985Smrg      [AS_CASE([$s],
68909113985Smrg          [BSD], [am__include='.include' am__quote='"'],
69009113985Smrg          [am__include='include' am__quote=''])])
69109113985Smrg  if test "$am__include" != "#"; then
69209113985Smrg    _am_result="yes ($s style)"
69309113985Smrg    break
69409113985Smrg  fi
69509113985Smrgdone
69609113985Smrgrm -f confinc.* confmf.*
69709113985SmrgAC_MSG_RESULT([${_am_result}])
69809113985SmrgAC_SUBST([am__include])])
69909113985SmrgAC_SUBST([am__quote])])
700a0d3b6eaSmrg
70109113985Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
70209113985Smrg
70309113985Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
70409113985Smrg#
70509113985Smrg# This file is free software; the Free Software Foundation
70609113985Smrg# gives unlimited permission to copy and/or distribute it,
70709113985Smrg# with or without modifications, as long as this notice is preserved.
70809113985Smrg
70909113985Smrg# AM_MISSING_PROG(NAME, PROGRAM)
71009113985Smrg# ------------------------------
71109113985SmrgAC_DEFUN([AM_MISSING_PROG],
71209113985Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71309113985Smrg$1=${$1-"${am_missing_run}$2"}
71409113985SmrgAC_SUBST($1)])
71509113985Smrg
71609113985Smrg# AM_MISSING_HAS_RUN
71709113985Smrg# ------------------
71809113985Smrg# Define MISSING if not defined so far and test if it is modern enough.
71909113985Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72009113985SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72109113985Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72209113985SmrgAC_REQUIRE_AUX_FILE([missing])dnl
72309113985Smrgif test x"${MISSING+set}" != xset; then
72409113985Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
72509113985Smrgfi
72609113985Smrg# Use eval to expand $SHELL
72709113985Smrgif eval "$MISSING --is-lightweight"; then
72809113985Smrg  am_missing_run="$MISSING "
729fa120d7cSmrgelse
73009113985Smrg  am_missing_run=
73109113985Smrg  AC_MSG_WARN(['missing' script is too old or missing])
732fa120d7cSmrgfi
73309113985Smrg])
734a0d3b6eaSmrg
73509113985Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736a0d3b6eaSmrg
73709113985Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73809113985Smrg#
73909113985Smrg# This file is free software; the Free Software Foundation
74009113985Smrg# gives unlimited permission to copy and/or distribute it,
74109113985Smrg# with or without modifications, as long as this notice is preserved.
742a0d3b6eaSmrg
74309113985Smrg# _AM_MANGLE_OPTION(NAME)
74409113985Smrg# -----------------------
74509113985SmrgAC_DEFUN([_AM_MANGLE_OPTION],
74609113985Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747a0d3b6eaSmrg
74809113985Smrg# _AM_SET_OPTION(NAME)
74909113985Smrg# --------------------
75009113985Smrg# Set option NAME.  Presently that only means defining a flag for this option.
75109113985SmrgAC_DEFUN([_AM_SET_OPTION],
75209113985Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753a0d3b6eaSmrg
75409113985Smrg# _AM_SET_OPTIONS(OPTIONS)
75509113985Smrg# ------------------------
75609113985Smrg# OPTIONS is a space-separated list of Automake options.
75709113985SmrgAC_DEFUN([_AM_SET_OPTIONS],
75809113985Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
759a0d3b6eaSmrg
76009113985Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76109113985Smrg# -------------------------------------------
76209113985Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76309113985SmrgAC_DEFUN([_AM_IF_OPTION],
76409113985Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
765f8a31ee4Smrg
76609113985Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
76709113985Smrg#
76809113985Smrg# This file is free software; the Free Software Foundation
76909113985Smrg# gives unlimited permission to copy and/or distribute it,
77009113985Smrg# with or without modifications, as long as this notice is preserved.
7714def10e6Smrg
77209113985Smrg# _AM_PROG_CC_C_O
77309113985Smrg# ---------------
77409113985Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77509113985Smrg# to automatically call this.
77609113985SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77709113985Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77809113985SmrgAC_REQUIRE_AUX_FILE([compile])dnl
77909113985SmrgAC_LANG_PUSH([C])dnl
78009113985SmrgAC_CACHE_CHECK(
78109113985Smrg  [whether $CC understands -c and -o together],
78209113985Smrg  [am_cv_prog_cc_c_o],
78309113985Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78409113985Smrg  # Make sure it works both with $CC and with simple cc.
78509113985Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78609113985Smrg  # compilers refuse to overwrite an existing .o file with -o,
78709113985Smrg  # though they will create one.
78809113985Smrg  am_cv_prog_cc_c_o=yes
78909113985Smrg  for am_i in 1 2; do
79009113985Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79109113985Smrg         && test -f conftest2.$ac_objext; then
79209113985Smrg      : OK
79309113985Smrg    else
79409113985Smrg      am_cv_prog_cc_c_o=no
79509113985Smrg      break
79609113985Smrg    fi
79709113985Smrg  done
79809113985Smrg  rm -f core conftest*
79909113985Smrg  unset am_i])
80009113985Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80109113985Smrg   # Losing compiler, so override with the script.
80209113985Smrg   # FIXME: It is wrong to rewrite CC.
80309113985Smrg   # But if we don't then we get into trouble of one sort or another.
80409113985Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80509113985Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80609113985Smrg   CC="$am_aux_dir/compile $CC"
807f8a31ee4Smrgfi
80809113985SmrgAC_LANG_POP([C])])
809966b534aSmrg
81009113985Smrg# For backward compatibility.
81109113985SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812f8a31ee4Smrg
81309113985Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
81409113985Smrg#
81509113985Smrg# This file is free software; the Free Software Foundation
81609113985Smrg# gives unlimited permission to copy and/or distribute it,
81709113985Smrg# with or without modifications, as long as this notice is preserved.
818f8a31ee4Smrg
81909113985Smrg# AM_RUN_LOG(COMMAND)
82009113985Smrg# -------------------
82109113985Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82209113985Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82309113985SmrgAC_DEFUN([AM_RUN_LOG],
82409113985Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82509113985Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82609113985Smrg   ac_status=$?
82709113985Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82809113985Smrg   (exit $ac_status); }])
829da4266ffSmrg
83009113985Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
831fa120d7cSmrg
83209113985Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833fa120d7cSmrg#
83409113985Smrg# This file is free software; the Free Software Foundation
83509113985Smrg# gives unlimited permission to copy and/or distribute it,
83609113985Smrg# with or without modifications, as long as this notice is preserved.
837da4266ffSmrg
83809113985Smrg# AM_SANITY_CHECK
83909113985Smrg# ---------------
84009113985SmrgAC_DEFUN([AM_SANITY_CHECK],
84109113985Smrg[AC_MSG_CHECKING([whether build environment is sane])
84209113985Smrg# Reject unsafe characters in $srcdir or the absolute working directory
84309113985Smrg# name.  Accept space and tab only in the latter.
84409113985Smrgam_lf='
84509113985Smrg'
84609113985Smrgcase `pwd` in
84709113985Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84809113985Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84909113985Smrgesac
85009113985Smrgcase $srcdir in
85109113985Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85209113985Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85309113985Smrgesac
854da4266ffSmrg
85509113985Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85609113985Smrg# arguments.  Must try -L first in case configure is actually a
85709113985Smrg# symlink; some systems play weird games with the mod time of symlinks
85809113985Smrg# (eg FreeBSD returns the mod time of the symlink's containing
85909113985Smrg# directory).
86009113985Smrgif (
86109113985Smrg   am_has_slept=no
86209113985Smrg   for am_try in 1 2; do
86309113985Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86409113985Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86509113985Smrg     if test "$[*]" = "X"; then
86609113985Smrg	# -L didn't work.
86709113985Smrg	set X `ls -t "$srcdir/configure" conftest.file`
86809113985Smrg     fi
86909113985Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87009113985Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8714def10e6Smrg
87209113985Smrg	# If neither matched, then we have a broken ls.  This can happen
87309113985Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87409113985Smrg	# broken ls alias from the environment.  This has actually
87509113985Smrg	# happened.  Such a system could not be considered "sane".
87609113985Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87709113985Smrg  alias in your environment])
87809113985Smrg     fi
87909113985Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88009113985Smrg       break
88109113985Smrg     fi
88209113985Smrg     # Just in case.
88309113985Smrg     sleep 1
88409113985Smrg     am_has_slept=yes
88509113985Smrg   done
88609113985Smrg   test "$[2]" = conftest.file
88709113985Smrg   )
88809113985Smrgthen
88909113985Smrg   # Ok.
89009113985Smrg   :
89109113985Smrgelse
89209113985Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
89309113985SmrgCheck your system clock])
89409113985Smrgfi
89509113985SmrgAC_MSG_RESULT([yes])
89609113985Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89709113985Smrg# generated files are strictly newer.
89809113985Smrgam_sleep_pid=
89909113985Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90009113985Smrg  ( sleep 1 ) &
90109113985Smrg  am_sleep_pid=$!
90209113985Smrgfi
90309113985SmrgAC_CONFIG_COMMANDS_PRE(
90409113985Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90509113985Smrg   if test -n "$am_sleep_pid"; then
90609113985Smrg     # Hide warnings about reused PIDs.
90709113985Smrg     wait $am_sleep_pid 2>/dev/null
90809113985Smrg   fi
90909113985Smrg   AC_MSG_RESULT([done])])
91009113985Smrgrm -f conftest.file
91109113985Smrg])
91209113985Smrg
91309113985Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914fa120d7cSmrg#
91509113985Smrg# This file is free software; the Free Software Foundation
91609113985Smrg# gives unlimited permission to copy and/or distribute it,
91709113985Smrg# with or without modifications, as long as this notice is preserved.
918da4266ffSmrg
91909113985Smrg# AM_SILENT_RULES([DEFAULT])
92009113985Smrg# --------------------------
92109113985Smrg# Enable less verbose build rules; with the default set to DEFAULT
92209113985Smrg# ("yes" being less verbose, "no" or empty being verbose).
92309113985SmrgAC_DEFUN([AM_SILENT_RULES],
92409113985Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92509113985SmrgAS_HELP_STRING(
92609113985Smrg  [--enable-silent-rules],
92709113985Smrg  [less verbose build output (undo: "make V=1")])
92809113985SmrgAS_HELP_STRING(
92909113985Smrg  [--disable-silent-rules],
93009113985Smrg  [verbose build output (undo: "make V=0")])dnl
93109113985Smrg])
93209113985Smrgcase $enable_silent_rules in @%:@ (((
93309113985Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93409113985Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93509113985Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93609113985Smrgesac
93709113985Smrgdnl
93809113985Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93909113985Smrgdnl do not support nested variable expansions.
94009113985Smrgdnl See automake bug#9928 and bug#10237.
94109113985Smrgam_make=${MAKE-make}
94209113985SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94309113985Smrg   [am_cv_make_support_nested_variables],
94409113985Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94509113985SmrgBAR0=false
94609113985SmrgBAR1=true
94709113985SmrgV=1
94809113985Smrgam__doit:
94909113985Smrg	@$(TRUE)
95009113985Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95109113985Smrg  am_cv_make_support_nested_variables=yes
952966b534aSmrgelse
95309113985Smrg  am_cv_make_support_nested_variables=no
95409113985Smrgfi])
95509113985Smrgif test $am_cv_make_support_nested_variables = yes; then
95609113985Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95709113985Smrg  AM_V='$(V)'
95809113985Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95909113985Smrgelse
96009113985Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96109113985Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962966b534aSmrgfi
96309113985SmrgAC_SUBST([AM_V])dnl
96409113985SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96509113985SmrgAC_SUBST([AM_DEFAULT_V])dnl
96609113985SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96709113985SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96809113985SmrgAM_BACKSLASH='\'
96909113985SmrgAC_SUBST([AM_BACKSLASH])dnl
97009113985Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97109113985Smrg])
9724def10e6Smrg
97309113985Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
97409113985Smrg#
97509113985Smrg# This file is free software; the Free Software Foundation
97609113985Smrg# gives unlimited permission to copy and/or distribute it,
97709113985Smrg# with or without modifications, as long as this notice is preserved.
9784def10e6Smrg
97909113985Smrg# AM_PROG_INSTALL_STRIP
98009113985Smrg# ---------------------
98109113985Smrg# One issue with vendor 'install' (even GNU) is that you can't
98209113985Smrg# specify the program used to strip binaries.  This is especially
98309113985Smrg# annoying in cross-compiling environments, where the build's strip
98409113985Smrg# is unlikely to handle the host's binaries.
98509113985Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98609113985Smrg# always use install-sh in "make install-strip", and initialize
98709113985Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
98809113985SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98909113985Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99009113985Smrg# Installed binaries are usually stripped using 'strip' when the user
99109113985Smrg# run "make install-strip".  However 'strip' might not be the right
99209113985Smrg# tool to use in cross-compilation environments, therefore Automake
99309113985Smrg# will honor the 'STRIP' environment variable to overrule this program.
99409113985Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99509113985Smrgif test "$cross_compiling" != no; then
99609113985Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
99709113985Smrgfi
99809113985SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99909113985SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100009113985Smrg
100109113985Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002966b534aSmrg#
100309113985Smrg# This file is free software; the Free Software Foundation
100409113985Smrg# gives unlimited permission to copy and/or distribute it,
100509113985Smrg# with or without modifications, as long as this notice is preserved.
100609113985Smrg
100709113985Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
100809113985Smrg# ---------------------------
100909113985Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101009113985Smrg# This macro is traced by Automake.
101109113985SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101209113985Smrg
101309113985Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101409113985Smrg# --------------------------
101509113985Smrg# Public sister of _AM_SUBST_NOTMAKE.
101609113985SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101709113985Smrg
101809113985Smrg# Check how to create a tarball.                            -*- Autoconf -*-
101909113985Smrg
102009113985Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021fa120d7cSmrg#
102209113985Smrg# This file is free software; the Free Software Foundation
102309113985Smrg# gives unlimited permission to copy and/or distribute it,
102409113985Smrg# with or without modifications, as long as this notice is preserved.
102509113985Smrg
102609113985Smrg# _AM_PROG_TAR(FORMAT)
102709113985Smrg# --------------------
102809113985Smrg# Check how to create a tarball in format FORMAT.
102909113985Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030fa120d7cSmrg#
103109113985Smrg# Substitute a variable $(am__tar) that is a command
103209113985Smrg# writing to stdout a FORMAT-tarball containing the directory
103309113985Smrg# $tardir.
103409113985Smrg#     tardir=directory && $(am__tar) > result.tar
1035fa120d7cSmrg#
103609113985Smrg# Substitute a variable $(am__untar) that extract such
103709113985Smrg# a tarball read from stdin.
103809113985Smrg#     $(am__untar) < result.tar
1039fa120d7cSmrg#
104009113985SmrgAC_DEFUN([_AM_PROG_TAR],
104109113985Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104209113985Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104309113985SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10444def10e6Smrg
104509113985Smrg# We'll loop over all known methods to create a tar archive until one works.
104609113985Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047da4266ffSmrg
104809113985Smrgm4_if([$1], [v7],
104909113985Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050da4266ffSmrg
105109113985Smrg  [m4_case([$1],
105209113985Smrg    [ustar],
105309113985Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105409113985Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105509113985Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105609113985Smrg      # and bug#13588).
105709113985Smrg      am_max_uid=2097151 # 2^21 - 1
105809113985Smrg      am_max_gid=$am_max_uid
105909113985Smrg      # The $UID and $GID variables are not portable, so we need to resort
106009113985Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106109113985Smrg      # below are definitely unexpected, so allow the users to see them
106209113985Smrg      # (that is, avoid stderr redirection).
106309113985Smrg      am_uid=`id -u || echo unknown`
106409113985Smrg      am_gid=`id -g || echo unknown`
106509113985Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106609113985Smrg      if test $am_uid -le $am_max_uid; then
106709113985Smrg         AC_MSG_RESULT([yes])
106809113985Smrg      else
106909113985Smrg         AC_MSG_RESULT([no])
107009113985Smrg         _am_tools=none
107109113985Smrg      fi
107209113985Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107309113985Smrg      if test $am_gid -le $am_max_gid; then
107409113985Smrg         AC_MSG_RESULT([yes])
107509113985Smrg      else
107609113985Smrg        AC_MSG_RESULT([no])
107709113985Smrg        _am_tools=none
107809113985Smrg      fi],
1079f8a31ee4Smrg
108009113985Smrg  [pax],
108109113985Smrg    [],
10824def10e6Smrg
108309113985Smrg  [m4_fatal([Unknown tar format])])
1084da4266ffSmrg
108509113985Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086fa120d7cSmrg
108709113985Smrg  # Go ahead even if we have the value already cached.  We do so because we
108809113985Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108909113985Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
109009113985Smrg
109109113985Smrg  for _am_tool in $_am_tools; do
109209113985Smrg    case $_am_tool in
109309113985Smrg    gnutar)
109409113985Smrg      for _am_tar in tar gnutar gtar; do
109509113985Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109609113985Smrg      done
109709113985Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109809113985Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109909113985Smrg      am__untar="$_am_tar -xf -"
110009113985Smrg      ;;
110109113985Smrg    plaintar)
110209113985Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110309113985Smrg      # ustar tarball either.
110409113985Smrg      (tar --version) >/dev/null 2>&1 && continue
110509113985Smrg      am__tar='tar chf - "$$tardir"'
110609113985Smrg      am__tar_='tar chf - "$tardir"'
110709113985Smrg      am__untar='tar xf -'
110809113985Smrg      ;;
110909113985Smrg    pax)
111009113985Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111109113985Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111209113985Smrg      am__untar='pax -r'
111309113985Smrg      ;;
111409113985Smrg    cpio)
111509113985Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111609113985Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111709113985Smrg      am__untar='cpio -i -H $1 -d'
111809113985Smrg      ;;
111909113985Smrg    none)
112009113985Smrg      am__tar=false
112109113985Smrg      am__tar_=false
112209113985Smrg      am__untar=false
112309113985Smrg      ;;
112409113985Smrg    esac
112509113985Smrg
112609113985Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112709113985Smrg    # and am__untar set.
112809113985Smrg    test -n "${am_cv_prog_tar_$1}" && break
112909113985Smrg
113009113985Smrg    # tar/untar a dummy directory, and stop if the command works.
113109113985Smrg    rm -rf conftest.dir
113209113985Smrg    mkdir conftest.dir
113309113985Smrg    echo GrepMe > conftest.dir/file
113409113985Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113509113985Smrg    rm -rf conftest.dir
113609113985Smrg    if test -s conftest.tar; then
113709113985Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
113809113985Smrg      AM_RUN_LOG([cat conftest.dir/file])
113909113985Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1140fa120d7cSmrg    fi
114109113985Smrg  done
114209113985Smrg  rm -rf conftest.dir
1143f8a31ee4Smrg
114409113985Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114509113985Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146fa120d7cSmrg
114709113985SmrgAC_SUBST([am__tar])
114809113985SmrgAC_SUBST([am__untar])
114909113985Smrg]) # _AM_PROG_TAR
1150da4266ffSmrg
115109113985Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
115209113985Smrgdnl serial 11 (pkg-config-0.29)
115309113985Smrgdnl
115409113985Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115509113985Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
115609113985Smrgdnl
115709113985Smrgdnl This program is free software; you can redistribute it and/or modify
115809113985Smrgdnl it under the terms of the GNU General Public License as published by
115909113985Smrgdnl the Free Software Foundation; either version 2 of the License, or
116009113985Smrgdnl (at your option) any later version.
116109113985Smrgdnl
116209113985Smrgdnl This program is distributed in the hope that it will be useful, but
116309113985Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
116409113985Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
116509113985Smrgdnl General Public License for more details.
116609113985Smrgdnl
116709113985Smrgdnl You should have received a copy of the GNU General Public License
116809113985Smrgdnl along with this program; if not, write to the Free Software
116909113985Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
117009113985Smrgdnl 02111-1307, USA.
117109113985Smrgdnl
117209113985Smrgdnl As a special exception to the GNU General Public License, if you
117309113985Smrgdnl distribute this file as part of a program that contains a
117409113985Smrgdnl configuration script generated by Autoconf, you may include it under
117509113985Smrgdnl the same distribution terms that you use for the rest of that
117609113985Smrgdnl program.
1177da4266ffSmrg
117809113985Smrgdnl PKG_PREREQ(MIN-VERSION)
117909113985Smrgdnl -----------------------
118009113985Smrgdnl Since: 0.29
118109113985Smrgdnl
118209113985Smrgdnl Verify that the version of the pkg-config macros are at least
118309113985Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
118409113985Smrgdnl installed version of pkg-config, this checks the developer's version
118509113985Smrgdnl of pkg.m4 when generating configure.
118609113985Smrgdnl
118709113985Smrgdnl To ensure that this macro is defined, also add:
118809113985Smrgdnl m4_ifndef([PKG_PREREQ],
118909113985Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
119009113985Smrgdnl
119109113985Smrgdnl See the "Since" comment for each macro you use to see what version
119209113985Smrgdnl of the macros you require.
119309113985Smrgm4_defun([PKG_PREREQ],
119409113985Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
119509113985Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
119609113985Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
119709113985Smrg])dnl PKG_PREREQ
1198da4266ffSmrg
119909113985Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
120009113985Smrgdnl ----------------------------------
120109113985Smrgdnl Since: 0.16
120209113985Smrgdnl
120309113985Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
120409113985Smrgdnl first found in the path. Checks that the version of pkg-config found
120509113985Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
120609113985Smrgdnl used since that's the first version where most current features of
120709113985Smrgdnl pkg-config existed.
120809113985SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120909113985Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
121009113985Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
121109113985Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
121209113985SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
121309113985SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
121409113985SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215da4266ffSmrg
121609113985Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121709113985Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218fa120d7cSmrgfi
121909113985Smrgif test -n "$PKG_CONFIG"; then
122009113985Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
122109113985Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122209113985Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122309113985Smrg		AC_MSG_RESULT([yes])
122409113985Smrg	else
122509113985Smrg		AC_MSG_RESULT([no])
122609113985Smrg		PKG_CONFIG=""
122709113985Smrg	fi
122809113985Smrgfi[]dnl
122909113985Smrg])dnl PKG_PROG_PKG_CONFIG
1230da4266ffSmrg
123109113985Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
123209113985Smrgdnl -------------------------------------------------------------------
123309113985Smrgdnl Since: 0.18
123409113985Smrgdnl
123509113985Smrgdnl Check to see whether a particular set of modules exists. Similar to
123609113985Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
123709113985Smrgdnl
123809113985Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123909113985Smrgdnl only at the first occurence in configure.ac, so if the first place
124009113985Smrgdnl it's called might be skipped (such as if it is within an "if", you
124109113985Smrgdnl have to call PKG_CHECK_EXISTS manually
124209113985SmrgAC_DEFUN([PKG_CHECK_EXISTS],
124309113985Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124409113985Smrgif test -n "$PKG_CONFIG" && \
124509113985Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
124609113985Smrg  m4_default([$2], [:])
124709113985Smrgm4_ifvaln([$3], [else
124809113985Smrg  $3])dnl
1249fa120d7cSmrgfi])
1250f8a31ee4Smrg
125109113985Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
125209113985Smrgdnl ---------------------------------------------
125309113985Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
125409113985Smrgdnl pkg_failed based on the result.
125509113985Smrgm4_define([_PKG_CONFIG],
125609113985Smrg[if test -n "$$1"; then
125709113985Smrg    pkg_cv_[]$1="$$1"
125809113985Smrg elif test -n "$PKG_CONFIG"; then
125909113985Smrg    PKG_CHECK_EXISTS([$3],
126009113985Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
126109113985Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
126209113985Smrg		     [pkg_failed=yes])
126309113985Smrg else
126409113985Smrg    pkg_failed=untried
126509113985Smrgfi[]dnl
126609113985Smrg])dnl _PKG_CONFIG
1267a0d3b6eaSmrg
126809113985Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
126909113985Smrgdnl ---------------------------
127009113985Smrgdnl Internal check to see if pkg-config supports short errors.
127109113985SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127209113985Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127309113985Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127409113985Smrg        _pkg_short_errors_supported=yes
127509113985Smrgelse
127609113985Smrg        _pkg_short_errors_supported=no
127709113985Smrgfi[]dnl
127809113985Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279a0d3b6eaSmrg
1280f8a31ee4Smrg
128109113985Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
128209113985Smrgdnl   [ACTION-IF-NOT-FOUND])
128309113985Smrgdnl --------------------------------------------------------------
128409113985Smrgdnl Since: 0.4.0
128509113985Smrgdnl
128609113985Smrgdnl Note that if there is a possibility the first call to
128709113985Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
128809113985Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128909113985SmrgAC_DEFUN([PKG_CHECK_MODULES],
129009113985Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129109113985SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129209113985SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293f8a31ee4Smrg
129409113985Smrgpkg_failed=no
129509113985SmrgAC_MSG_CHECKING([for $1])
1296da4266ffSmrg
129709113985Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129809113985Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299a0d3b6eaSmrg
130009113985Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130109113985Smrgand $1[]_LIBS to avoid the need to call pkg-config.
130209113985SmrgSee the pkg-config man page for more details.])
1303a0d3b6eaSmrg
130409113985Smrgif test $pkg_failed = yes; then
130509113985Smrg   	AC_MSG_RESULT([no])
130609113985Smrg        _PKG_SHORT_ERRORS_SUPPORTED
130709113985Smrg        if test $_pkg_short_errors_supported = yes; then
130809113985Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130909113985Smrg        else 
131009113985Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131109113985Smrg        fi
131209113985Smrg	# Put the nasty error message in config.log where it belongs
131309113985Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314a0d3b6eaSmrg
131509113985Smrg	m4_default([$4], [AC_MSG_ERROR(
131609113985Smrg[Package requirements ($2) were not met:
131709113985Smrg
131809113985Smrg$$1_PKG_ERRORS
131909113985Smrg
132009113985SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132109113985Smrginstalled software in a non-standard prefix.
132209113985Smrg
132309113985Smrg_PKG_TEXT])[]dnl
132409113985Smrg        ])
132509113985Smrgelif test $pkg_failed = untried; then
132609113985Smrg     	AC_MSG_RESULT([no])
132709113985Smrg	m4_default([$4], [AC_MSG_FAILURE(
132809113985Smrg[The pkg-config script could not be found or is too old.  Make sure it
132909113985Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
133009113985Smrgpath to pkg-config.
133109113985Smrg
133209113985Smrg_PKG_TEXT
133309113985Smrg
133409113985SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
133509113985Smrg        ])
133609113985Smrgelse
133709113985Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133809113985Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133909113985Smrg        AC_MSG_RESULT([yes])
134009113985Smrg	$3
134109113985Smrgfi[]dnl
134209113985Smrg])dnl PKG_CHECK_MODULES
134309113985Smrg
134409113985Smrg
134509113985Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
134609113985Smrgdnl   [ACTION-IF-NOT-FOUND])
134709113985Smrgdnl ---------------------------------------------------------------------
134809113985Smrgdnl Since: 0.29
134909113985Smrgdnl
135009113985Smrgdnl Checks for existence of MODULES and gathers its build flags with
135109113985Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
135209113985Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
135309113985Smrgdnl
135409113985Smrgdnl Note that if there is a possibility the first call to
135509113985Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
135609113985Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
135709113985Smrgdnl configure.ac.
135809113985SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
135909113985Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
136009113985Smrg_save_PKG_CONFIG=$PKG_CONFIG
136109113985SmrgPKG_CONFIG="$PKG_CONFIG --static"
136209113985SmrgPKG_CHECK_MODULES($@)
136309113985SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
136409113985Smrg])dnl PKG_CHECK_MODULES_STATIC
136509113985Smrg
136609113985Smrg
136709113985Smrgdnl PKG_INSTALLDIR([DIRECTORY])
136809113985Smrgdnl -------------------------
136909113985Smrgdnl Since: 0.27
137009113985Smrgdnl
137109113985Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
137209113985Smrgdnl should install pkg-config .pc files. By default the directory is
137309113985Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
137409113985Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
137509113985Smrgdnl parameter.
137609113985SmrgAC_DEFUN([PKG_INSTALLDIR],
137709113985Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
137809113985Smrgm4_pushdef([pkg_description],
137909113985Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
138009113985SmrgAC_ARG_WITH([pkgconfigdir],
138109113985Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
138209113985Smrg    [with_pkgconfigdir=]pkg_default)
138309113985SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
138409113985Smrgm4_popdef([pkg_default])
138509113985Smrgm4_popdef([pkg_description])
138609113985Smrg])dnl PKG_INSTALLDIR
1387a0d3b6eaSmrg
1388a0d3b6eaSmrg
138909113985Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
139009113985Smrgdnl --------------------------------
139109113985Smrgdnl Since: 0.27
139209113985Smrgdnl
139309113985Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
139409113985Smrgdnl module should install arch-independent pkg-config .pc files. By
139509113985Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
139609113985Smrgdnl changed by passing DIRECTORY. The user can override through the
139709113985Smrgdnl --with-noarch-pkgconfigdir parameter.
139809113985SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
139909113985Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
140009113985Smrgm4_pushdef([pkg_description],
140109113985Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
140209113985SmrgAC_ARG_WITH([noarch-pkgconfigdir],
140309113985Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
140409113985Smrg    [with_noarch_pkgconfigdir=]pkg_default)
140509113985SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
140609113985Smrgm4_popdef([pkg_default])
140709113985Smrgm4_popdef([pkg_description])
140809113985Smrg])dnl PKG_NOARCH_INSTALLDIR
1409a0d3b6eaSmrg
1410a0d3b6eaSmrg
141109113985Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
141209113985Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
141309113985Smrgdnl -------------------------------------------
141409113985Smrgdnl Since: 0.28
141509113985Smrgdnl
141609113985Smrgdnl Retrieves the value of the pkg-config variable for the given module.
141709113985SmrgAC_DEFUN([PKG_CHECK_VAR],
141809113985Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
141909113985SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420a0d3b6eaSmrg
142109113985Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
142209113985SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
14234def10e6Smrg
142409113985SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
142509113985Smrg])dnl PKG_CHECK_VAR
1426da4266ffSmrg
142709113985Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142809113985Smrgdnl
142909113985Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
143009113985Smrgdnl
143109113985Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143209113985Smrgdnl copy of this software and associated documentation files (the "Software"),
143309113985Smrgdnl to deal in the Software without restriction, including without limitation
143409113985Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143509113985Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
143609113985Smrgdnl Software is furnished to do so, subject to the following conditions:
143709113985Smrgdnl
143809113985Smrgdnl The above copyright notice and this permission notice (including the next
143909113985Smrgdnl paragraph) shall be included in all copies or substantial portions of the
144009113985Smrgdnl Software.
144109113985Smrgdnl
144209113985Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144309113985Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144409113985Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144509113985Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144609113985Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144709113985Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144809113985Smrgdnl DEALINGS IN THE SOFTWARE.
1449781f9a67Smrg
145009113985Smrg# XORG_MACROS_VERSION(required-version)
145109113985Smrg# -------------------------------------
145209113985Smrg# Minimum version: 1.1.0
1453fa120d7cSmrg#
145409113985Smrg# If you're using a macro added in Version 1.1 or newer, include this in
145509113985Smrg# your configure.ac with the minimum required version, such as:
145609113985Smrg# XORG_MACROS_VERSION(1.1)
1457fa120d7cSmrg#
145809113985Smrg# To ensure that this macro is defined, also add:
145909113985Smrg# m4_ifndef([XORG_MACROS_VERSION],
146009113985Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461fa120d7cSmrg#
1462fa120d7cSmrg#
146309113985Smrg# See the "minimum version" comment for each macro you use to see what
146409113985Smrg# version you require.
146509113985Smrgm4_defun([XORG_MACROS_VERSION],[
146609113985Smrgm4_define([vers_have], [1.19.3])
146709113985Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146809113985Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
146909113985Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147009113985Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147109113985Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147209113985Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147309113985Smrgm4_undefine([vers_have])
147409113985Smrgm4_undefine([maj_have])
147509113985Smrgm4_undefine([maj_needed])
147609113985Smrg]) # XORG_MACROS_VERSION
147709113985Smrg
147809113985Smrg# XORG_PROG_RAWCPP()
147909113985Smrg# ------------------
148009113985Smrg# Minimum version: 1.0.0
1481fa120d7cSmrg#
148209113985Smrg# Find cpp program and necessary flags for use in pre-processing text files
148309113985Smrg# such as man pages and config files
148409113985SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148509113985SmrgAC_REQUIRE([AC_PROG_CPP])
148609113985SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148709113985Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
148809113985Smrg
148909113985Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149009113985Smrg# which is not the best choice for supporting other OS'es, but covers most
149109113985Smrg# of the ones we need for now.
149209113985SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149309113985SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149409113985Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149509113985Smrg	AC_MSG_RESULT([no])
1496da4266ffSmrgelse
149709113985Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149809113985Smrg		RAWCPPFLAGS=-undef
149909113985Smrg		AC_MSG_RESULT([yes])
150009113985Smrg	# under Cygwin unix is still defined even with -undef
150109113985Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150209113985Smrg		RAWCPPFLAGS="-undef -ansi"
150309113985Smrg		AC_MSG_RESULT([yes, with -ansi])
150409113985Smrg	else
150509113985Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150609113985Smrg	fi
1507da4266ffSmrgfi
150809113985Smrgrm -f conftest.$ac_ext
1509da4266ffSmrg
151009113985SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151109113985SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151209113985Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151309113985Smrg	AC_MSG_RESULT([no])
151409113985Smrgelse
151509113985Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151609113985Smrg		TRADITIONALCPPFLAGS="-traditional"
151709113985Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151809113985Smrg		AC_MSG_RESULT([yes])
151909113985Smrg	else
152009113985Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152109113985Smrg	fi
152209113985Smrgfi
152309113985Smrgrm -f conftest.$ac_ext
152409113985SmrgAC_SUBST(RAWCPPFLAGS)
152509113985SmrgAC_SUBST(TRADITIONALCPPFLAGS)
152609113985Smrg]) # XORG_PROG_RAWCPP
152709113985Smrg
152809113985Smrg# XORG_MANPAGE_SECTIONS()
1529966b534aSmrg# -----------------------
153009113985Smrg# Minimum version: 1.0.0
1531fa120d7cSmrg#
153209113985Smrg# Determine which sections man pages go in for the different man page types
153309113985Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153409113985Smrg# Not sure if there's any better way than just hardcoding by OS name.
153509113985Smrg# Override default settings by setting environment variables
153609113985Smrg# Added MAN_SUBSTS in version 1.8
153709113985Smrg# Added AC_PROG_SED in version 1.8
1538781f9a67Smrg
153909113985SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1540966b534aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
154109113985SmrgAC_REQUIRE([AC_PROG_SED])
1542781f9a67Smrg
1543fa120d7cSmrgcase $host_os in
1544fa120d7cSmrg    solaris*)
154509113985Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
154609113985Smrg        # check for a man page file found in later versions that use
154709113985Smrg        # traditional section numbers instead
154809113985Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
154909113985Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550fa120d7cSmrg        ;;
155109113985Smrg    *) SYSV_MAN_SECTIONS=false ;;
1552fa120d7cSmrgesac
1553781f9a67Smrg
155409113985Smrgif test x$APP_MAN_SUFFIX = x    ; then
155509113985Smrg    APP_MAN_SUFFIX=1
1556966b534aSmrgfi
155709113985Smrgif test x$APP_MAN_DIR = x    ; then
155809113985Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1559a0d3b6eaSmrgfi
1560a0d3b6eaSmrg
156109113985Smrgif test x$LIB_MAN_SUFFIX = x    ; then
156209113985Smrg    LIB_MAN_SUFFIX=3
1563da4266ffSmrgfi
156409113985Smrgif test x$LIB_MAN_DIR = x    ; then
156509113985Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15664def10e6Smrgfi
1567a0d3b6eaSmrg
156809113985Smrgif test x$FILE_MAN_SUFFIX = x    ; then
156909113985Smrg    case $SYSV_MAN_SECTIONS in
157009113985Smrg	true)				FILE_MAN_SUFFIX=4  ;;
157109113985Smrg	*)				FILE_MAN_SUFFIX=5  ;;
157209113985Smrg    esac
157309113985Smrgfi
157409113985Smrgif test x$FILE_MAN_DIR = x    ; then
157509113985Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576fa120d7cSmrgfi
1577966b534aSmrg
157809113985Smrgif test x$MISC_MAN_SUFFIX = x    ; then
157909113985Smrg    case $SYSV_MAN_SECTIONS in
158009113985Smrg	true)				MISC_MAN_SUFFIX=5  ;;
158109113985Smrg	*)				MISC_MAN_SUFFIX=7  ;;
158209113985Smrg    esac
158309113985Smrgfi
158409113985Smrgif test x$MISC_MAN_DIR = x    ; then
158509113985Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
158609113985Smrgfi
1587966b534aSmrg
158809113985Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
158909113985Smrg    case $SYSV_MAN_SECTIONS in
159009113985Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
159109113985Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159209113985Smrg    esac
159309113985Smrgfi
159409113985Smrgif test x$DRIVER_MAN_DIR = x    ; then
159509113985Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159609113985Smrgfi
1597966b534aSmrg
159809113985Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
159909113985Smrg    case $SYSV_MAN_SECTIONS in
160009113985Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
160109113985Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160209113985Smrg    esac
160309113985Smrgfi
160409113985Smrgif test x$ADMIN_MAN_DIR = x    ; then
160509113985Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160609113985Smrgfi
1607966b534aSmrg
1608966b534aSmrg
160909113985SmrgAC_SUBST([APP_MAN_SUFFIX])
161009113985SmrgAC_SUBST([LIB_MAN_SUFFIX])
161109113985SmrgAC_SUBST([FILE_MAN_SUFFIX])
161209113985SmrgAC_SUBST([MISC_MAN_SUFFIX])
161309113985SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161409113985SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161509113985SmrgAC_SUBST([APP_MAN_DIR])
161609113985SmrgAC_SUBST([LIB_MAN_DIR])
161709113985SmrgAC_SUBST([FILE_MAN_DIR])
161809113985SmrgAC_SUBST([MISC_MAN_DIR])
161909113985SmrgAC_SUBST([DRIVER_MAN_DIR])
162009113985SmrgAC_SUBST([ADMIN_MAN_DIR])
1621966b534aSmrg
162209113985SmrgXORG_MAN_PAGE="X Version 11"
162309113985SmrgAC_SUBST([XORG_MAN_PAGE])
162409113985SmrgMAN_SUBSTS="\
162509113985Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162609113985Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162709113985Smrg	-e 's|__xservername__|Xorg|g' \
162809113985Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
162909113985Smrg	-e 's|__projectroot__|\$(prefix)|g' \
163009113985Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163109113985Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163209113985Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163309113985Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163409113985Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163509113985Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163609113985Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163709113985SmrgAC_SUBST([MAN_SUBSTS])
1638966b534aSmrg
163909113985Smrg]) # XORG_MANPAGE_SECTIONS
1640966b534aSmrg
164109113985Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164209113985Smrg# ------------------------
164309113985Smrg# Minimum version: 1.7.0
1644fa120d7cSmrg#
164509113985Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164609113985Smrg# provided by xorg-sgml-doctools, if installed.
164709113985SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164809113985SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164909113985SmrgXORG_SGML_PATH=
165009113985SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165109113985Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165209113985Smrg    [m4_ifval([$1],[:],
165309113985Smrg        [if test x"$cross_compiling" != x"yes" ; then
165409113985Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165509113985Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165609113985Smrg         fi])
165709113985Smrg    ])
1658966b534aSmrg
165909113985Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166009113985Smrg# the path and the name of the doc stylesheet
166109113985Smrgif test "x$XORG_SGML_PATH" != "x" ; then
166209113985Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166309113985Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166409113985Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166509113985Smrgelse
166609113985Smrg   AC_MSG_RESULT([no])
166709113985Smrgfi
1668966b534aSmrg
166909113985SmrgAC_SUBST(XORG_SGML_PATH)
167009113985SmrgAC_SUBST(STYLESHEET_SRCDIR)
167109113985SmrgAC_SUBST(XSL_STYLESHEET)
167209113985SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167309113985Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1674966b534aSmrg
167509113985Smrg# XORG_CHECK_LINUXDOC
167609113985Smrg# -------------------
167709113985Smrg# Minimum version: 1.0.0
167809113985Smrg#
167909113985Smrg# Defines the variable MAKE_TEXT if the necessary tools and
168009113985Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168109113985Smrg# Whether or not the necessary tools and files are found can be checked
168209113985Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168309113985SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168409113985SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168509113985SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686966b534aSmrg
168709113985SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688fa120d7cSmrg
168909113985SmrgAC_MSG_CHECKING([whether to build documentation])
1690966b534aSmrg
169109113985Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169209113985Smrg   BUILDDOC=yes
169309113985Smrgelse
169409113985Smrg   BUILDDOC=no
1695966b534aSmrgfi
1696966b534aSmrg
169709113985SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698966b534aSmrg
169909113985SmrgAC_MSG_RESULT([$BUILDDOC])
1700966b534aSmrg
170109113985SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1702fa120d7cSmrg
170309113985Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170409113985Smrg   BUILDPDFDOC=yes
170509113985Smrgelse
170609113985Smrg   BUILDPDFDOC=no
170709113985Smrgfi
1708fa120d7cSmrg
170909113985SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1710fa120d7cSmrg
171109113985SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1712fa120d7cSmrg
171309113985SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171409113985SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171509113985SmrgMAKE_PDF="$PS2PDF"
171609113985SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1717966b534aSmrg
171809113985SmrgAC_SUBST(MAKE_TEXT)
171909113985SmrgAC_SUBST(MAKE_PS)
172009113985SmrgAC_SUBST(MAKE_PDF)
172109113985SmrgAC_SUBST(MAKE_HTML)
172209113985Smrg]) # XORG_CHECK_LINUXDOC
1723fa120d7cSmrg
172409113985Smrg# XORG_CHECK_DOCBOOK
172509113985Smrg# -------------------
172609113985Smrg# Minimum version: 1.0.0
172709113985Smrg#
172809113985Smrg# Checks for the ability to build output formats from SGML DocBook source.
172909113985Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173009113985Smrg# indicates whether the necessary tools and files are found and, if set,
173109113985Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173209113985SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173309113985SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1734966b534aSmrg
173509113985SmrgBUILDTXTDOC=no
173609113985SmrgBUILDPDFDOC=no
173709113985SmrgBUILDPSDOC=no
173809113985SmrgBUILDHTMLDOC=no
1739966b534aSmrg
174009113985SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174109113985SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174209113985SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174309113985SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744966b534aSmrg
174509113985SmrgAC_MSG_CHECKING([whether to build text documentation])
174609113985Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174709113985Smrg   test x$BUILD_TXTDOC != xno; then
174809113985Smrg	BUILDTXTDOC=yes
174909113985Smrgfi
175009113985SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175109113985SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752fa120d7cSmrg
175309113985SmrgAC_MSG_CHECKING([whether to build PDF documentation])
175409113985Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175509113985Smrg   test x$BUILD_PDFDOC != xno; then
175609113985Smrg	BUILDPDFDOC=yes
175709113985Smrgfi
175809113985SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175909113985SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760fa120d7cSmrg
176109113985SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176209113985Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176309113985Smrg   test x$BUILD_PSDOC != xno; then
176409113985Smrg	BUILDPSDOC=yes
176509113985Smrgfi
176609113985SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176709113985SmrgAC_MSG_RESULT([$BUILDPSDOC])
1768fa120d7cSmrg
176909113985SmrgAC_MSG_CHECKING([whether to build HTML documentation])
177009113985Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177109113985Smrg   test x$BUILD_HTMLDOC != xno; then
177209113985Smrg	BUILDHTMLDOC=yes
17734def10e6Smrgfi
177409113985SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177509113985SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776f8a31ee4Smrg
177709113985SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177809113985SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177909113985SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178009113985SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1781966b534aSmrg
178209113985SmrgAC_SUBST(MAKE_TEXT)
178309113985SmrgAC_SUBST(MAKE_PS)
178409113985SmrgAC_SUBST(MAKE_PDF)
178509113985SmrgAC_SUBST(MAKE_HTML)
178609113985Smrg]) # XORG_CHECK_DOCBOOK
178709113985Smrg
178809113985Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178909113985Smrg# ----------------
179009113985Smrg# Minimum version: 1.5.0
179109113985Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1792da4266ffSmrg#
179309113985Smrg# Documentation tools are not always available on all platforms and sometimes
179409113985Smrg# not at the appropriate level. This macro enables a module to test for the
179509113985Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
179609113985Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
179709113985Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179809113985Smrg# --with-xmlto assumes 'auto'.
1799da4266ffSmrg#
180009113985Smrg# Interface to module:
180109113985Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180209113985Smrg# XMLTO:	returns the path of the xmlto program found
180309113985Smrg#		returns the path set by the user in the environment
180409113985Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180509113985Smrg#		'no' user instructs the module not to use xmlto
1806da4266ffSmrg#
180709113985Smrg# Added in version 1.10.0
180809113985Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180909113985Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810da4266ffSmrg#
181109113985Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812da4266ffSmrg#
181309113985SmrgAC_DEFUN([XORG_WITH_XMLTO],[
181409113985SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181509113985Smrgm4_define([_defopt], m4_default([$2], [auto]))
181609113985SmrgAC_ARG_WITH(xmlto,
181709113985Smrg	AS_HELP_STRING([--with-xmlto],
181809113985Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181909113985Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182009113985Smrgm4_undefine([_defopt])
1821966b534aSmrg
182209113985Smrgif test "x$use_xmlto" = x"auto"; then
182309113985Smrg   AC_PATH_PROG([XMLTO], [xmlto])
182409113985Smrg   if test "x$XMLTO" = "x"; then
182509113985Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182609113985Smrg	have_xmlto=no
182709113985Smrg   else
182809113985Smrg        have_xmlto=yes
182909113985Smrg   fi
183009113985Smrgelif test "x$use_xmlto" = x"yes" ; then
183109113985Smrg   AC_PATH_PROG([XMLTO], [xmlto])
183209113985Smrg   if test "x$XMLTO" = "x"; then
183309113985Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183409113985Smrg   fi
183509113985Smrg   have_xmlto=yes
183609113985Smrgelif test "x$use_xmlto" = x"no" ; then
183709113985Smrg   if test "x$XMLTO" != "x"; then
183809113985Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183909113985Smrg   fi
184009113985Smrg   have_xmlto=no
184109113985Smrgelse
184209113985Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184309113985Smrgfi
1844fa120d7cSmrg
184509113985Smrg# Test for a minimum version of xmlto, if provided.
184609113985Smrgm4_ifval([$1],
184709113985Smrg[if test "$have_xmlto" = yes; then
184809113985Smrg    # scrape the xmlto version
184909113985Smrg    AC_MSG_CHECKING([the xmlto version])
185009113985Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185109113985Smrg    AC_MSG_RESULT([$xmlto_version])
185209113985Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185309113985Smrg        [if test "x$use_xmlto" = xauto; then
185409113985Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185509113985Smrg            have_xmlto=no
185609113985Smrg        else
185709113985Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185809113985Smrg        fi])
185909113985Smrgfi])
1860fa120d7cSmrg
186109113985Smrg# Test for the ability of xmlto to generate a text target
186209113985Smrg#
186309113985Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
186409113985Smrg# following test for empty XML docbook files.
186509113985Smrg# For compatibility reasons use the following empty XML docbook file and if
186609113985Smrg# it fails try it again with a non-empty XML file.
186709113985Smrghave_xmlto_text=no
186809113985Smrgcat > conftest.xml << "EOF"
186909113985SmrgEOF
187009113985SmrgAS_IF([test "$have_xmlto" = yes],
187109113985Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187209113985Smrg             [have_xmlto_text=yes],
187309113985Smrg             [# Try it again with a non-empty XML file.
187409113985Smrg              cat > conftest.xml << "EOF"
187509113985Smrg<x></x>
187609113985SmrgEOF
187709113985Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187809113985Smrg                    [have_xmlto_text=yes],
187909113985Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188009113985Smrgrm -f conftest.xml
188109113985SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188209113985SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188309113985Smrg]) # XORG_WITH_XMLTO
1884fa120d7cSmrg
188509113985Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188609113985Smrg# --------------------------------------------
188709113985Smrg# Minimum version: 1.12.0
188809113985Smrg# Minimum version for optional DEFAULT argument: 1.12.0
188909113985Smrg#
189009113985Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189109113985Smrg# XML-based language used for the transformation of XML documents.
189209113985Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189309113985Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189409113985Smrg# The XSLT processor is often used as a standalone tool for transformations.
189509113985Smrg# It should not be assumed that this tool is used only to work with documnetation.
189609113985Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189709113985Smrg#
189809113985Smrg# Interface to module:
189909113985Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190009113985Smrg# XSLTPROC:	 returns the path of the xsltproc program found
190109113985Smrg#		 returns the path set by the user in the environment
190209113985Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190309113985Smrg#		  'no' user instructs the module not to use xsltproc
190409113985Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190509113985Smrg#
190609113985Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190709113985Smrg#
190809113985SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190909113985SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191009113985Smrg# Preserves the interface, should it be implemented later
191109113985Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191209113985Smrgm4_define([_defopt], m4_default([$2], [auto]))
191309113985SmrgAC_ARG_WITH(xsltproc,
191409113985Smrg	AS_HELP_STRING([--with-xsltproc],
191509113985Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191609113985Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191709113985Smrgm4_undefine([_defopt])
1918fa120d7cSmrg
191909113985Smrgif test "x$use_xsltproc" = x"auto"; then
192009113985Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192109113985Smrg   if test "x$XSLTPROC" = "x"; then
192209113985Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192309113985Smrg	have_xsltproc=no
192409113985Smrg   else
192509113985Smrg        have_xsltproc=yes
192609113985Smrg   fi
192709113985Smrgelif test "x$use_xsltproc" = x"yes" ; then
192809113985Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192909113985Smrg   if test "x$XSLTPROC" = "x"; then
193009113985Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193109113985Smrg   fi
193209113985Smrg   have_xsltproc=yes
193309113985Smrgelif test "x$use_xsltproc" = x"no" ; then
193409113985Smrg   if test "x$XSLTPROC" != "x"; then
193509113985Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193609113985Smrg   fi
193709113985Smrg   have_xsltproc=no
193809113985Smrgelse
193909113985Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19404def10e6Smrgfi
1941a0d3b6eaSmrg
194209113985SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194309113985Smrg]) # XORG_WITH_XSLTPROC
194409113985Smrg
194509113985Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194609113985Smrg# ----------------------------------------
194709113985Smrg# Minimum version: 1.15.0
1948fa120d7cSmrg#
194909113985Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
195009113985Smrg# scanning arbitrary text files, extracting information from those text files,
195109113985Smrg# and printing reports based on that information.
1952fa120d7cSmrg#
195309113985Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
19544def10e6Smrg#
195509113985Smrg# Interface to module:
195609113985Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
195709113985Smrg# PERL:	     returns the path of the perl program found
195809113985Smrg#	     returns the path set by the user in the environment
195909113985Smrg# --with-perl: 'yes' user instructs the module to use perl
196009113985Smrg#	       'no' user instructs the module not to use perl
196109113985Smrg# have_perl: returns yes if perl found in PATH or no
19624def10e6Smrg#
196309113985Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196409113985Smrg#
196509113985SmrgAC_DEFUN([XORG_WITH_PERL],[
196609113985SmrgAC_ARG_VAR([PERL], [Path to perl command])
196709113985Smrg# Preserves the interface, should it be implemented later
196809113985Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196909113985Smrgm4_define([_defopt], m4_default([$2], [auto]))
197009113985SmrgAC_ARG_WITH(perl,
197109113985Smrg	AS_HELP_STRING([--with-perl],
197209113985Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197309113985Smrg	   [use_perl=$withval], [use_perl=]_defopt)
197409113985Smrgm4_undefine([_defopt])
1975966b534aSmrg
197609113985Smrgif test "x$use_perl" = x"auto"; then
197709113985Smrg   AC_PATH_PROG([PERL], [perl])
197809113985Smrg   if test "x$PERL" = "x"; then
197909113985Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198009113985Smrg	have_perl=no
198109113985Smrg   else
198209113985Smrg        have_perl=yes
198309113985Smrg   fi
198409113985Smrgelif test "x$use_perl" = x"yes" ; then
198509113985Smrg   AC_PATH_PROG([PERL], [perl])
198609113985Smrg   if test "x$PERL" = "x"; then
198709113985Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198809113985Smrg   fi
198909113985Smrg   have_perl=yes
199009113985Smrgelif test "x$use_perl" = x"no" ; then
199109113985Smrg   if test "x$PERL" != "x"; then
199209113985Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199309113985Smrg   fi
199409113985Smrg   have_perl=no
199509113985Smrgelse
199609113985Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199709113985Smrgfi
1998781f9a67Smrg
199909113985SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200009113985Smrg]) # XORG_WITH_PERL
2001fa120d7cSmrg
200209113985Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003fa120d7cSmrg# ----------------
200409113985Smrg# Minimum version: 1.5.0
200509113985Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2006966b534aSmrg#
200709113985Smrg# Documentation tools are not always available on all platforms and sometimes
200809113985Smrg# not at the appropriate level. This macro enables a module to test for the
200909113985Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
201009113985Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
201109113985Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201209113985Smrg# --with-asciidoc assumes 'auto'.
2013966b534aSmrg#
201409113985Smrg# Interface to module:
201509113985Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201609113985Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
201709113985Smrg#		 returns the path set by the user in the environment
201809113985Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201909113985Smrg#		  'no' user instructs the module not to use asciidoc
2020a0d3b6eaSmrg#
202109113985Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20224def10e6Smrg#
202309113985SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202409113985SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202509113985Smrgm4_define([_defopt], m4_default([$2], [auto]))
202609113985SmrgAC_ARG_WITH(asciidoc,
202709113985Smrg	AS_HELP_STRING([--with-asciidoc],
202809113985Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202909113985Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203009113985Smrgm4_undefine([_defopt])
2031fa120d7cSmrg
203209113985Smrgif test "x$use_asciidoc" = x"auto"; then
203309113985Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203409113985Smrg   if test "x$ASCIIDOC" = "x"; then
203509113985Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203609113985Smrg	have_asciidoc=no
203709113985Smrg   else
203809113985Smrg        have_asciidoc=yes
203909113985Smrg   fi
204009113985Smrgelif test "x$use_asciidoc" = x"yes" ; then
204109113985Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204209113985Smrg   if test "x$ASCIIDOC" = "x"; then
204309113985Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204409113985Smrg   fi
204509113985Smrg   have_asciidoc=yes
204609113985Smrgelif test "x$use_asciidoc" = x"no" ; then
204709113985Smrg   if test "x$ASCIIDOC" != "x"; then
204809113985Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204909113985Smrg   fi
205009113985Smrg   have_asciidoc=no
205109113985Smrgelse
205209113985Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205309113985Smrgfi
205409113985Smrgm4_ifval([$1],
205509113985Smrg[if test "$have_asciidoc" = yes; then
205609113985Smrg    # scrape the asciidoc version
205709113985Smrg    AC_MSG_CHECKING([the asciidoc version])
205809113985Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205909113985Smrg    AC_MSG_RESULT([$asciidoc_version])
206009113985Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206109113985Smrg        [if test "x$use_asciidoc" = xauto; then
206209113985Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206309113985Smrg            have_asciidoc=no
206409113985Smrg        else
206509113985Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206609113985Smrg        fi])
206709113985Smrgfi])
206809113985SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206909113985Smrg]) # XORG_WITH_ASCIIDOC
2070fa120d7cSmrg
207109113985Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207209113985Smrg# -------------------------------------------
207309113985Smrg# Minimum version: 1.5.0
207409113985Smrg# Minimum version for optional DEFAULT argument: 1.11.0
207509113985Smrg# Minimum version for optional DOT checking: 1.18.0
2076da4266ffSmrg#
207709113985Smrg# Documentation tools are not always available on all platforms and sometimes
207809113985Smrg# not at the appropriate level. This macro enables a module to test for the
207909113985Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
208009113985Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
208109113985Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208209113985Smrg# --with-doxygen assumes 'auto'.
2083da4266ffSmrg#
208409113985Smrg# Interface to module:
208509113985Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208609113985Smrg# DOXYGEN:	 returns the path of the doxygen program found
208709113985Smrg#		 returns the path set by the user in the environment
208809113985Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208909113985Smrg#		  'no' user instructs the module not to use doxygen
2090fa120d7cSmrg#
209109113985Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092fa120d7cSmrg#
209309113985SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209409113985SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209509113985SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209609113985Smrgm4_define([_defopt], m4_default([$2], [auto]))
209709113985SmrgAC_ARG_WITH(doxygen,
209809113985Smrg	AS_HELP_STRING([--with-doxygen],
209909113985Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210009113985Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210109113985Smrgm4_undefine([_defopt])
2102fa120d7cSmrg
210309113985Smrgif test "x$use_doxygen" = x"auto"; then
210409113985Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210509113985Smrg   if test "x$DOXYGEN" = "x"; then
210609113985Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210709113985Smrg	have_doxygen=no
210809113985Smrg   else
210909113985Smrg        have_doxygen=yes
211009113985Smrg   fi
211109113985Smrgelif test "x$use_doxygen" = x"yes" ; then
211209113985Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211309113985Smrg   if test "x$DOXYGEN" = "x"; then
211409113985Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211509113985Smrg   fi
211609113985Smrg   have_doxygen=yes
211709113985Smrgelif test "x$use_doxygen" = x"no" ; then
211809113985Smrg   if test "x$DOXYGEN" != "x"; then
211909113985Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212009113985Smrg   fi
212109113985Smrg   have_doxygen=no
2122da4266ffSmrgelse
212309113985Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124da4266ffSmrgfi
212509113985Smrgm4_ifval([$1],
212609113985Smrg[if test "$have_doxygen" = yes; then
212709113985Smrg    # scrape the doxygen version
212809113985Smrg    AC_MSG_CHECKING([the doxygen version])
212909113985Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213009113985Smrg    AC_MSG_RESULT([$doxygen_version])
213109113985Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213209113985Smrg        [if test "x$use_doxygen" = xauto; then
213309113985Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213409113985Smrg            have_doxygen=no
213509113985Smrg        else
213609113985Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213709113985Smrg        fi])
213809113985Smrgfi])
2139a0d3b6eaSmrg
214009113985Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214109113985Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214209113985Smrgdnl 	HAVE_DOT = @HAVE_DOT@
214309113985SmrgHAVE_DOT=no
214409113985Smrgif test "x$have_doxygen" = "xyes"; then
214509113985Smrg  AC_PATH_PROG([DOT], [dot])
214609113985Smrg    if test "x$DOT" != "x"; then
214709113985Smrg      HAVE_DOT=yes
214809113985Smrg    fi
214909113985Smrgfi
2150966b534aSmrg
215109113985SmrgAC_SUBST([HAVE_DOT])
215209113985SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215309113985SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215409113985Smrg]) # XORG_WITH_DOXYGEN
2155fa120d7cSmrg
215609113985Smrg# XORG_WITH_GROFF([DEFAULT])
215709113985Smrg# ----------------
215809113985Smrg# Minimum version: 1.6.0
215909113985Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2160966b534aSmrg#
216109113985Smrg# Documentation tools are not always available on all platforms and sometimes
216209113985Smrg# not at the appropriate level. This macro enables a module to test for the
216309113985Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
216409113985Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
216509113985Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
216609113985Smrg# --with-groff assumes 'auto'.
216709113985Smrg#
216809113985Smrg# Interface to module:
216909113985Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217009113985Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217109113985Smrg# HAVE_GROFF_MS: the -ms macros package
217209113985Smrg# GROFF:	 returns the path of the groff program found
217309113985Smrg#		 returns the path set by the user in the environment
217409113985Smrg# --with-groff:	 'yes' user instructs the module to use groff
217509113985Smrg#		 'no' user instructs the module not to use groff
217609113985Smrg#
217709113985Smrg# Added in version 1.9.0:
217809113985Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217909113985Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218009113985Smrg#		   psselect from the psutils package.
218109113985Smrg#		   the ghostcript package. Refer to the grohtml man pages
218209113985Smrg#
218309113985Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218409113985Smrg#
218509113985Smrg# OS and distros often splits groff in a basic and full package, the former
218609113985Smrg# having the groff program and the later having devices, fonts and macros
218709113985Smrg# Checking for the groff executable is not enough.
218809113985Smrg#
218909113985Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
219009113985Smrg# unset HAVE_GROFF or GROFF env variables.
219109113985Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219209113985Smrg#
219309113985SmrgAC_DEFUN([XORG_WITH_GROFF],[
219409113985SmrgAC_ARG_VAR([GROFF], [Path to groff command])
219509113985Smrgm4_define([_defopt], m4_default([$1], [auto]))
219609113985SmrgAC_ARG_WITH(groff,
219709113985Smrg	AS_HELP_STRING([--with-groff],
219809113985Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219909113985Smrg	   [use_groff=$withval], [use_groff=]_defopt)
220009113985Smrgm4_undefine([_defopt])
2201966b534aSmrg
220209113985Smrgif test "x$use_groff" = x"auto"; then
220309113985Smrg   AC_PATH_PROG([GROFF], [groff])
220409113985Smrg   if test "x$GROFF" = "x"; then
220509113985Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220609113985Smrg	have_groff=no
220709113985Smrg   else
220809113985Smrg        have_groff=yes
220909113985Smrg   fi
221009113985Smrgelif test "x$use_groff" = x"yes" ; then
221109113985Smrg   AC_PATH_PROG([GROFF], [groff])
221209113985Smrg   if test "x$GROFF" = "x"; then
221309113985Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221409113985Smrg   fi
221509113985Smrg   have_groff=yes
221609113985Smrgelif test "x$use_groff" = x"no" ; then
221709113985Smrg   if test "x$GROFF" != "x"; then
221809113985Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221909113985Smrg   fi
222009113985Smrg   have_groff=no
222109113985Smrgelse
222209113985Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222309113985Smrgfi
2224fa120d7cSmrg
222509113985Smrg# We have groff, test for the presence of the macro packages
222609113985Smrgif test "x$have_groff" = x"yes"; then
222709113985Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222809113985Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222909113985Smrg        groff_ms_works=yes
223009113985Smrg    else
223109113985Smrg        groff_ms_works=no
2232fa120d7cSmrg    fi
223309113985Smrg    AC_MSG_RESULT([$groff_ms_works])
223409113985Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223509113985Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223609113985Smrg        groff_mm_works=yes
223709113985Smrg    else
223809113985Smrg        groff_mm_works=no
223909113985Smrg    fi
224009113985Smrg    AC_MSG_RESULT([$groff_mm_works])
224109113985Smrgfi
2242fa120d7cSmrg
224309113985Smrg# We have groff, test for HTML dependencies, one command per package
224409113985Smrgif test "x$have_groff" = x"yes"; then
224509113985Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224609113985Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224709113985Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224809113985Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224909113985Smrg      have_groff_html=yes
225009113985Smrg   else
225109113985Smrg      have_groff_html=no
225209113985Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225309113985Smrg   fi
225409113985Smrgfi
225509113985Smrg
225609113985Smrg# Set Automake conditionals for Makefiles
225709113985SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225809113985SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225909113985SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226009113985SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226109113985Smrg]) # XORG_WITH_GROFF
226209113985Smrg
226309113985Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226409113985Smrg# ---------------------------------------
226509113985Smrg# Minimum version: 1.6.0
226609113985Smrg# Minimum version for optional DEFAULT argument: 1.11.0
226709113985Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226809113985Smrg#
226909113985Smrg# Documentation tools are not always available on all platforms and sometimes
227009113985Smrg# not at the appropriate level. This macro enables a module to test for the
227109113985Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
227209113985Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
227309113985Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
227409113985Smrg# --with-fop assumes 'auto'.
227509113985Smrg#
227609113985Smrg# Interface to module:
227709113985Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227809113985Smrg# FOP:	 	returns the path of the fop program found
227909113985Smrg#		returns the path set by the user in the environment
228009113985Smrg# --with-fop: 	'yes' user instructs the module to use fop
228109113985Smrg#		'no' user instructs the module not to use fop
228209113985Smrg#
228309113985Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228409113985Smrg#
228509113985SmrgAC_DEFUN([XORG_WITH_FOP],[
228609113985SmrgAC_ARG_VAR([FOP], [Path to fop command])
228709113985Smrgm4_define([_defopt], m4_default([$2], [auto]))
228809113985SmrgAC_ARG_WITH(fop,
228909113985Smrg	AS_HELP_STRING([--with-fop],
229009113985Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229109113985Smrg	   [use_fop=$withval], [use_fop=]_defopt)
229209113985Smrgm4_undefine([_defopt])
229309113985Smrg
229409113985Smrgif test "x$use_fop" = x"auto"; then
229509113985Smrg   AC_PATH_PROG([FOP], [fop])
229609113985Smrg   if test "x$FOP" = "x"; then
229709113985Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229809113985Smrg	have_fop=no
229909113985Smrg   else
230009113985Smrg        have_fop=yes
230109113985Smrg   fi
230209113985Smrgelif test "x$use_fop" = x"yes" ; then
230309113985Smrg   AC_PATH_PROG([FOP], [fop])
230409113985Smrg   if test "x$FOP" = "x"; then
230509113985Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230609113985Smrg   fi
230709113985Smrg   have_fop=yes
230809113985Smrgelif test "x$use_fop" = x"no" ; then
230909113985Smrg   if test "x$FOP" != "x"; then
231009113985Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231109113985Smrg   fi
231209113985Smrg   have_fop=no
2313966b534aSmrgelse
231409113985Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315966b534aSmrgfi
2316966b534aSmrg
231709113985Smrg# Test for a minimum version of fop, if provided.
231809113985Smrgm4_ifval([$1],
231909113985Smrg[if test "$have_fop" = yes; then
232009113985Smrg    # scrape the fop version
232109113985Smrg    AC_MSG_CHECKING([for fop minimum version])
232209113985Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232309113985Smrg    AC_MSG_RESULT([$fop_version])
232409113985Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
232509113985Smrg        [if test "x$use_fop" = xauto; then
232609113985Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232709113985Smrg            have_fop=no
232809113985Smrg        else
232909113985Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233009113985Smrg        fi])
233109113985Smrgfi])
233209113985SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233309113985Smrg]) # XORG_WITH_FOP
233409113985Smrg
233509113985Smrg# XORG_WITH_M4([MIN-VERSION])
233609113985Smrg# ---------------------------
233709113985Smrg# Minimum version: 1.19.0
233809113985Smrg#
233909113985Smrg# This macro attempts to locate an m4 macro processor which supports
234009113985Smrg# -I option and is only useful for modules relying on M4 in order to
234109113985Smrg# expand macros in source code files.
234209113985Smrg#
234309113985Smrg# Interface to module:
234409113985Smrg# M4:	 	returns the path of the m4 program found
234509113985Smrg#		returns the path set by the user in the environment
234609113985Smrg#
234709113985SmrgAC_DEFUN([XORG_WITH_M4], [
234809113985SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234909113985Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235009113985Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235109113985Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235209113985Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235309113985Smrg   [$PATH:/usr/gnu/bin])])
2354966b534aSmrg
235509113985SmrgAC_SUBST([M4], [$ac_cv_path_M4])
235609113985Smrg]) # XORG_WITH_M4
2357966b534aSmrg
235809113985Smrg# XORG_WITH_PS2PDF([DEFAULT])
235909113985Smrg# ----------------
236009113985Smrg# Minimum version: 1.6.0
236109113985Smrg# Minimum version for optional DEFAULT argument: 1.11.0
236209113985Smrg#
236309113985Smrg# Documentation tools are not always available on all platforms and sometimes
236409113985Smrg# not at the appropriate level. This macro enables a module to test for the
236509113985Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
236609113985Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
236709113985Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236809113985Smrg# --with-ps2pdf assumes 'auto'.
236909113985Smrg#
237009113985Smrg# Interface to module:
237109113985Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237209113985Smrg# PS2PDF:	returns the path of the ps2pdf program found
237309113985Smrg#		returns the path set by the user in the environment
237409113985Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237509113985Smrg#		 'no' user instructs the module not to use ps2pdf
237609113985Smrg#
237709113985Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237809113985Smrg#
237909113985SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238009113985SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238109113985Smrgm4_define([_defopt], m4_default([$1], [auto]))
238209113985SmrgAC_ARG_WITH(ps2pdf,
238309113985Smrg	AS_HELP_STRING([--with-ps2pdf],
238409113985Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238509113985Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238609113985Smrgm4_undefine([_defopt])
2387966b534aSmrg
238809113985Smrgif test "x$use_ps2pdf" = x"auto"; then
238909113985Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239009113985Smrg   if test "x$PS2PDF" = "x"; then
239109113985Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239209113985Smrg	have_ps2pdf=no
239309113985Smrg   else
239409113985Smrg        have_ps2pdf=yes
239509113985Smrg   fi
239609113985Smrgelif test "x$use_ps2pdf" = x"yes" ; then
239709113985Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239809113985Smrg   if test "x$PS2PDF" = "x"; then
239909113985Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240009113985Smrg   fi
240109113985Smrg   have_ps2pdf=yes
240209113985Smrgelif test "x$use_ps2pdf" = x"no" ; then
240309113985Smrg   if test "x$PS2PDF" != "x"; then
240409113985Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240509113985Smrg   fi
240609113985Smrg   have_ps2pdf=no
240709113985Smrgelse
240809113985Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409fa120d7cSmrgfi
241009113985SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241109113985Smrg]) # XORG_WITH_PS2PDF
2412966b534aSmrg
241309113985Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
241409113985Smrg# ----------------
241509113985Smrg# Minimum version: 1.6.0
2416da4266ffSmrg#
241709113985Smrg# Documentation tools are not always available on all platforms and sometimes
241809113985Smrg# not at the appropriate level. This macro enables a builder to skip all
241909113985Smrg# documentation targets except traditional man pages.
242009113985Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242109113985Smrg# maximum flexibilty in controlling documentation building.
242209113985Smrg# Refer to:
242309113985Smrg# XORG_WITH_XMLTO         --with-xmlto
242409113985Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242509113985Smrg# XORG_WITH_DOXYGEN       --with-doxygen
242609113985Smrg# XORG_WITH_FOP           --with-fop
242709113985Smrg# XORG_WITH_GROFF         --with-groff
242809113985Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
242909113985Smrg#
243009113985Smrg# Interface to module:
243109113985Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243209113985Smrg# --enable-docs: 'yes' user instructs the module to generate docs
243309113985Smrg#		 'no' user instructs the module not to generate docs
243409113985Smrg# parm1:	specify the default value, yes or no.
243509113985Smrg#
243609113985SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243709113985Smrgm4_define([docs_default], m4_default([$1], [yes]))
243809113985SmrgAC_ARG_ENABLE(docs,
243909113985Smrg	AS_HELP_STRING([--enable-docs],
244009113985Smrg	   [Enable building the documentation (default: ]docs_default[)]),
244109113985Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
244209113985Smrgm4_undefine([docs_default])
244309113985SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244409113985SmrgAC_MSG_CHECKING([whether to build documentation])
244509113985SmrgAC_MSG_RESULT([$build_docs])
244609113985Smrg]) # XORG_ENABLE_DOCS
2447fa120d7cSmrg
244809113985Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244909113985Smrg# ----------------
245009113985Smrg# Minimum version: 1.6.0
245109113985Smrg#
245209113985Smrg# This macro enables a builder to skip all developer documentation.
245309113985Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245409113985Smrg# maximum flexibilty in controlling documentation building.
245509113985Smrg# Refer to:
245609113985Smrg# XORG_WITH_XMLTO         --with-xmlto
245709113985Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245809113985Smrg# XORG_WITH_DOXYGEN       --with-doxygen
245909113985Smrg# XORG_WITH_FOP           --with-fop
246009113985Smrg# XORG_WITH_GROFF         --with-groff
246109113985Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
246209113985Smrg#
246309113985Smrg# Interface to module:
246409113985Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246509113985Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246609113985Smrg#			'no' user instructs the module not to generate developer docs
246709113985Smrg# parm1:		specify the default value, yes or no.
246809113985Smrg#
246909113985SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247009113985Smrgm4_define([devel_default], m4_default([$1], [yes]))
247109113985SmrgAC_ARG_ENABLE(devel-docs,
247209113985Smrg	AS_HELP_STRING([--enable-devel-docs],
247309113985Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247409113985Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247509113985Smrgm4_undefine([devel_default])
247609113985SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247709113985SmrgAC_MSG_CHECKING([whether to build developer documentation])
247809113985SmrgAC_MSG_RESULT([$build_devel_docs])
247909113985Smrg]) # XORG_ENABLE_DEVEL_DOCS
2480fa120d7cSmrg
248109113985Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
248209113985Smrg# ----------------
248309113985Smrg# Minimum version: 1.6.0
248409113985Smrg#
248509113985Smrg# This macro enables a builder to skip all functional specification targets.
248609113985Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248709113985Smrg# maximum flexibilty in controlling documentation building.
248809113985Smrg# Refer to:
248909113985Smrg# XORG_WITH_XMLTO         --with-xmlto
249009113985Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249109113985Smrg# XORG_WITH_DOXYGEN       --with-doxygen
249209113985Smrg# XORG_WITH_FOP           --with-fop
249309113985Smrg# XORG_WITH_GROFF         --with-groff
249409113985Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
249509113985Smrg#
249609113985Smrg# Interface to module:
249709113985Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249809113985Smrg# --enable-specs:	'yes' user instructs the module to generate specs
249909113985Smrg#			'no' user instructs the module not to generate specs
250009113985Smrg# parm1:		specify the default value, yes or no.
250109113985Smrg#
250209113985SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250309113985Smrgm4_define([spec_default], m4_default([$1], [yes]))
250409113985SmrgAC_ARG_ENABLE(specs,
250509113985Smrg	AS_HELP_STRING([--enable-specs],
250609113985Smrg	   [Enable building the specs (default: ]spec_default[)]),
250709113985Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
250809113985Smrgm4_undefine([spec_default])
250909113985SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251009113985SmrgAC_MSG_CHECKING([whether to build functional specifications])
251109113985SmrgAC_MSG_RESULT([$build_specs])
251209113985Smrg]) # XORG_ENABLE_SPECS
2513fa120d7cSmrg
251409113985Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251509113985Smrg# ----------------------------------------------
251609113985Smrg# Minimum version: 1.13.0
2517da4266ffSmrg#
251809113985Smrg# This macro enables a builder to enable/disable unit testing
251909113985Smrg# It makes no assumption about the test cases implementation
252009113985Smrg# Test cases may or may not use Automake "Support for test suites"
252109113985Smrg# They may or may not use the software utility library GLib
252209113985Smrg#
252309113985Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252409113985Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252509113985Smrg# The variable enable_unit_tests is used by other macros in this file.
252609113985Smrg#
252709113985Smrg# Interface to module:
252809113985Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252909113985Smrg# enable_unit_tests:    used in configure.ac for additional configuration
253009113985Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253109113985Smrg#			'no' user instructs the module not to build tests
253209113985Smrg# parm1:		specify the default value, yes or no.
253309113985Smrg#
253409113985SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253509113985SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253609113985SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253709113985SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253809113985Smrgm4_define([_defopt], m4_default([$1], [auto]))
253909113985SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254009113985Smrg	[Enable building unit test cases (default: ]_defopt[)]),
254109113985Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254209113985Smrgm4_undefine([_defopt])
254309113985SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254409113985SmrgAC_MSG_CHECKING([whether to build unit test cases])
254509113985SmrgAC_MSG_RESULT([$enable_unit_tests])
254609113985Smrg]) # XORG_ENABLE_UNIT_TESTS
2547fa120d7cSmrg
254809113985Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254909113985Smrg# ------------------------------------------------------
255009113985Smrg# Minimum version: 1.17.0
255109113985Smrg#
255209113985Smrg# This macro enables a builder to enable/disable integration testing
255309113985Smrg# It makes no assumption about the test cases' implementation
255409113985Smrg# Test cases may or may not use Automake "Support for test suites"
255509113985Smrg#
255609113985Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255709113985Smrg# usually requires less dependencies and may be built and run under less
255809113985Smrg# stringent environments than integration tests.
255909113985Smrg#
256009113985Smrg# Interface to module:
256109113985Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256209113985Smrg# enable_integration_tests:   used in configure.ac for additional configuration
256309113985Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256409113985Smrg#                             'no' user instructs the module not to build tests
256509113985Smrg# parm1:                      specify the default value, yes or no.
256609113985Smrg#
256709113985SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256809113985SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256909113985Smrgm4_define([_defopt], m4_default([$1], [auto]))
257009113985SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257109113985Smrg	[Enable building integration test cases (default: ]_defopt[)]),
257209113985Smrg	[enable_integration_tests=$enableval],
257309113985Smrg	[enable_integration_tests=]_defopt)
257409113985Smrgm4_undefine([_defopt])
257509113985SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257609113985Smrg	[test "x$enable_integration_tests" != xno])
257709113985SmrgAC_MSG_CHECKING([whether to build unit test cases])
257809113985SmrgAC_MSG_RESULT([$enable_integration_tests])
257909113985Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580fa120d7cSmrg
258109113985Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258209113985Smrg# ----------------------------------------
258309113985Smrg# Minimum version: 1.13.0
258409113985Smrg#
258509113985Smrg# GLib is a library which provides advanced data structures and functions.
258609113985Smrg# This macro enables a module to test for the presence of Glib.
258709113985Smrg#
258809113985Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258909113985Smrg# Otherwise the value of $enable_unit_tests is blank.
259009113985Smrg#
259109113985Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259209113985Smrg# test support usually requires less dependencies and may be built and run under
259309113985Smrg# less stringent environments than integration tests.
2594781f9a67Smrg#
259509113985Smrg# Interface to module:
259609113985Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
259709113985Smrg# with_glib: used in configure.ac to know if GLib has been found
259809113985Smrg# --with-glib:	'yes' user instructs the module to use glib
259909113985Smrg#		'no' user instructs the module not to use glib
260009113985Smrg#
260109113985SmrgAC_DEFUN([XORG_WITH_GLIB],[
260209113985SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260309113985Smrgm4_define([_defopt], m4_default([$2], [auto]))
260409113985SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260509113985Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260609113985Smrg	[with_glib=$withval], [with_glib=]_defopt)
260709113985Smrgm4_undefine([_defopt])
26084a908991Smrg
260909113985Smrghave_glib=no
261009113985Smrg# Do not probe GLib if user explicitly disabled unit testing
261109113985Smrgif test "x$enable_unit_tests" != x"no"; then
261209113985Smrg  # Do not probe GLib if user explicitly disabled it
261309113985Smrg  if test "x$with_glib" != x"no"; then
261409113985Smrg    m4_ifval(
261509113985Smrg      [$1],
261609113985Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261709113985Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261809113985Smrg    )
2619da4266ffSmrg  fi
2620da4266ffSmrgfi
2621966b534aSmrg
262209113985Smrg# Not having GLib when unit testing has been explicitly requested is an error
262309113985Smrgif test "x$enable_unit_tests" = x"yes"; then
262409113985Smrg  if test "x$have_glib" = x"no"; then
262509113985Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626da4266ffSmrg  fi
2627da4266ffSmrgfi
2628966b534aSmrg
262909113985Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
263009113985Smrgif test "x$enable_unit_tests" = x"no"; then
263109113985Smrg  if test "x$with_glib" = x"yes"; then
263209113985Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263309113985Smrg  fi
263409113985Smrgfi
2635781f9a67Smrg
263609113985Smrg# Not having GLib when it has been explicitly requested is an error
263709113985Smrgif test "x$with_glib" = x"yes"; then
263809113985Smrg  if test "x$have_glib" = x"no"; then
263909113985Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264009113985Smrg  fi
264109113985Smrgfi
26424a908991Smrg
264309113985SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264409113985Smrg]) # XORG_WITH_GLIB
26454a908991Smrg
264609113985Smrg# XORG_LD_WRAP([required|optional])
264709113985Smrg# ---------------------------------
264809113985Smrg# Minimum version: 1.13.0
264909113985Smrg#
265009113985Smrg# Check if linker supports -wrap, passed via compiler flags
265109113985Smrg#
265209113985Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265309113985Smrg# Otherwise the value of $enable_unit_tests is blank.
265409113985Smrg#
265509113985Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265609113985Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265709113985Smrg# available, an argument of "optional" allows use when some unit tests require
265809113985Smrg# ld -wrap and others do not.
265909113985Smrg#
266009113985SmrgAC_DEFUN([XORG_LD_WRAP],[
266109113985SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266209113985Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266309113985Smrg                      void __wrap_exit(int status) { return; }],
266409113985Smrg                     [exit(0);])])
266509113985Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
266609113985Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266709113985Smrg  if test "x$have_ld_wrap" = x"no"; then
266809113985Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266909113985Smrg  fi
267009113985Smrgfi
267109113985SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267209113985Smrg#
267309113985Smrg]) # XORG_LD_WRAP
26744a908991Smrg
267509113985Smrg# XORG_CHECK_LINKER_FLAGS
267609113985Smrg# -----------------------
267709113985Smrg# SYNOPSIS
267809113985Smrg#
267909113985Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268009113985Smrg#
268109113985Smrg# DESCRIPTION
268209113985Smrg#
268309113985Smrg#   Check whether the given linker FLAGS work with the current language's
268409113985Smrg#   linker, or whether they give an error.
268509113985Smrg#
268609113985Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268709113985Smrg#   success/failure.
268809113985Smrg#
268909113985Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
269009113985Smrg#
269109113985Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269209113985Smrg#
269309113985Smrg# LICENSE
269409113985Smrg#
269509113985Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269609113985Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269709113985Smrg#   Copyright (c) 2009 Matteo Frigo
269809113985Smrg#
269909113985Smrg#   This program is free software: you can redistribute it and/or modify it
270009113985Smrg#   under the terms of the GNU General Public License as published by the
270109113985Smrg#   Free Software Foundation, either version 3 of the License, or (at your
270209113985Smrg#   option) any later version.
270309113985Smrg#
270409113985Smrg#   This program is distributed in the hope that it will be useful, but
270509113985Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270609113985Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270709113985Smrg#   Public License for more details.
270809113985Smrg#
270909113985Smrg#   You should have received a copy of the GNU General Public License along
271009113985Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271109113985Smrg#
271209113985Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
271309113985Smrg#   gives unlimited permission to copy, distribute and modify the configure
271409113985Smrg#   scripts that are the output of Autoconf when processing the Macro. You
271509113985Smrg#   need not follow the terms of the GNU General Public License when using
271609113985Smrg#   or distributing such scripts, even though portions of the text of the
271709113985Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271809113985Smrg#   all other use of the material that constitutes the Autoconf Macro.
271909113985Smrg#
272009113985Smrg#   This special exception to the GPL applies to versions of the Autoconf
272109113985Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
272209113985Smrg#   modified version of the Autoconf Macro, you may extend this special
272309113985Smrg#   exception to the GPL to apply to your modified version as well.#
272409113985SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272509113985Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
272609113985Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272709113985SmrgAS_LITERAL_IF([$1],
272809113985Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272909113985Smrg      ax_save_FLAGS=$LDFLAGS
273009113985Smrg      LDFLAGS="$1"
273109113985Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273209113985Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273309113985Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273409113985Smrg      LDFLAGS=$ax_save_FLAGS])],
273509113985Smrg  [ax_save_FLAGS=$LDFLAGS
273609113985Smrg   LDFLAGS="$1"
273709113985Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273809113985Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273909113985Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274009113985Smrg   LDFLAGS=$ax_save_FLAGS])
274109113985Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274209113985SmrgAC_MSG_RESULT($xorg_check_linker_flags)
274309113985Smrgif test "x$xorg_check_linker_flags" = xyes; then
274409113985Smrg	m4_default([$2], :)
274509113985Smrgelse
274609113985Smrg	m4_default([$3], :)
274709113985Smrgfi
274809113985Smrg]) # XORG_CHECK_LINKER_FLAGS
27494a908991Smrg
275009113985Smrg# XORG_MEMORY_CHECK_FLAGS
275109113985Smrg# -----------------------
275209113985Smrg# Minimum version: 1.16.0
275309113985Smrg#
275409113985Smrg# This macro attempts to find appropriate memory checking functionality
275509113985Smrg# for various platforms which unit testing code may use to catch various
275609113985Smrg# forms of memory allocation and access errors in testing.
275709113985Smrg#
275809113985Smrg# Interface to module:
275909113985Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276009113985Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276109113985Smrg#
276209113985Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276309113985Smrg#
276409113985SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
27654a908991Smrg
276609113985SmrgAC_REQUIRE([AC_CANONICAL_HOST])
276709113985SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276809113985Smrg           [Environment variables to enable memory checking in tests])
27694a908991Smrg
277009113985Smrg# Check for different types of support on different platforms
277109113985Smrgcase $host_os in
277209113985Smrg    solaris*)
277309113985Smrg        AC_CHECK_LIB([umem], [umem_alloc],
277409113985Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277509113985Smrg        ;;
277609113985Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277709113985Smrg        # both directly and inverted, so should not be 0 or 255.
277809113985Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
277909113985Smrg        ;;
278009113985Smrg    darwin*)
278109113985Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278209113985Smrg        ;;
278309113985Smrg    *bsd*)
278409113985Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278509113985Smrg        ;;
278609113985Smrgesac
27874a908991Smrg
278809113985Smrg# User supplied flags override default flags
278909113985Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279009113985Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27914a908991Smrgfi
2792a0d3b6eaSmrg
279309113985SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279409113985Smrg]) # XORG_WITH_LINT
2795a0d3b6eaSmrg
279609113985Smrg# XORG_CHECK_MALLOC_ZERO
279709113985Smrg# ----------------------
279809113985Smrg# Minimum version: 1.0.0
2799fa120d7cSmrg#
280009113985Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280109113985Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280209113985Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280309113985SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280409113985SmrgAC_ARG_ENABLE(malloc0returnsnull,
280509113985Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280609113985Smrg		       [malloc(0) returns NULL (default: auto)]),
280709113985Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280809113985Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809da4266ffSmrg
281009113985SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281109113985Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281209113985SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281309113985Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281409113985Smrg#include <stdlib.h>
281509113985Smrg],[
281609113985Smrg    char *m0, *r0, *c0, *p;
281709113985Smrg    m0 = malloc(0);
281809113985Smrg    p = malloc(10);
281909113985Smrg    r0 = realloc(p,0);
282009113985Smrg    c0 = calloc(0,10);
282109113985Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282209113985Smrg])],
282309113985Smrg		[xorg_cv_malloc0_returns_null=yes],
282409113985Smrg		[xorg_cv_malloc0_returns_null=no])])
282509113985SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28264def10e6Smrgfi
282709113985SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828a0d3b6eaSmrg
282909113985Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283009113985Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283109113985Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283209113985Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2833fa120d7cSmrgelse
283409113985Smrg	MALLOC_ZERO_CFLAGS=""
283509113985Smrg	XMALLOC_ZERO_CFLAGS=""
283609113985Smrg	XTMALLOC_ZERO_CFLAGS=""
2837fa120d7cSmrgfi
2838781f9a67Smrg
283909113985SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284009113985SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284109113985SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284209113985Smrg]) # XORG_CHECK_MALLOC_ZERO
2843966b534aSmrg
284409113985Smrg# XORG_WITH_LINT()
284509113985Smrg# ----------------
284609113985Smrg# Minimum version: 1.1.0
2847da4266ffSmrg#
284809113985Smrg# This macro enables the use of a tool that flags some suspicious and
284909113985Smrg# non-portable constructs (likely to be bugs) in C language source code.
285009113985Smrg# It will attempt to locate the tool and use appropriate options.
285109113985Smrg# There are various lint type tools on different platforms.
2852da4266ffSmrg#
285309113985Smrg# Interface to module:
285409113985Smrg# LINT:		returns the path to the tool found on the platform
285509113985Smrg#		or the value set to LINT on the configure cmd line
285609113985Smrg#		also an Automake conditional
285709113985Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
285809113985Smrg#
285909113985Smrg# --with-lint:	'yes' user instructs the module to use lint
286009113985Smrg#		'no' user instructs the module not to use lint (default)
286109113985Smrg#
286209113985Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286309113985Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286409113985Smrg#
286509113985SmrgAC_DEFUN([XORG_WITH_LINT],[
2866966b534aSmrg
286709113985SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286809113985SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286909113985SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287009113985Smrg		[Use a lint-style source code checker (default: disabled)])],
287109113985Smrg		[use_lint=$withval], [use_lint=no])
2872a0d3b6eaSmrg
287309113985Smrg# Obtain platform specific info like program name and options
287409113985Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287509113985Smrgcase $host_os in
287609113985Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287709113985Smrg	lint_name=splint
287809113985Smrg	lint_options="-badflag"
287909113985Smrg	;;
288009113985Smrg  *freebsd* | *netbsd*)
288109113985Smrg	lint_name=lint
288209113985Smrg	lint_options="-u -b"
288309113985Smrg	;;
288409113985Smrg  *solaris*)
288509113985Smrg	lint_name=lint
288609113985Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288709113985Smrg	;;
288809113985Smrgesac
288909113985Smrg
289009113985Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289109113985Smrgif test "x$use_lint" = x"yes" ; then
289209113985Smrg   AC_PATH_PROG([LINT], [$lint_name])
289309113985Smrg   if test "x$LINT" = "x"; then
289409113985Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289509113985Smrg   fi
289609113985Smrgelif test "x$use_lint" = x"no" ; then
289709113985Smrg   if test "x$LINT" != "x"; then
289809113985Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289909113985Smrg   fi
2900fa120d7cSmrgelse
290109113985Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902da4266ffSmrgfi
2903966b534aSmrg
290409113985Smrg# User supplied flags override default flags
290509113985Smrgif test "x$LINT_FLAGS" != "x"; then
290609113985Smrg   lint_options=$LINT_FLAGS
290709113985Smrgfi
2908966b534aSmrg
290909113985SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291009113985SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911966b534aSmrg
291209113985Smrg]) # XORG_WITH_LINT
2913a0d3b6eaSmrg
291409113985Smrg# XORG_LINT_LIBRARY(LIBNAME)
291509113985Smrg# --------------------------
291609113985Smrg# Minimum version: 1.1.0
29174a908991Smrg#
291809113985Smrg# Sets up flags for building lint libraries for checking programs that call
291909113985Smrg# functions in the library.
292009113985Smrg#
292109113985Smrg# Interface to module:
292209113985Smrg# LINTLIB		- Automake variable with the name of lint library file to make
292309113985Smrg# MAKE_LINT_LIB		- Automake conditional
292409113985Smrg#
292509113985Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292609113985Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2927da4266ffSmrg
292809113985SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292909113985SmrgAC_REQUIRE([XORG_WITH_LINT])
293009113985SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293109113985Smrg	[Create lint library (default: disabled)])],
293209113985Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293309113985Smrg
293409113985Smrgif test "x$make_lint_lib" = x"yes" ; then
293509113985Smrg   LINTLIB=llib-l$1.ln
293609113985Smrg   if test "x$LINT" = "x"; then
293709113985Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293809113985Smrg   fi
293909113985Smrgelif test "x$make_lint_lib" != x"no" ; then
294009113985Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29414a908991Smrgfi
29424a908991Smrg
294309113985SmrgAC_SUBST(LINTLIB)
294409113985SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29454a908991Smrg
294609113985Smrg]) # XORG_LINT_LIBRARY
2947966b534aSmrg
294809113985Smrg# XORG_COMPILER_BRAND
29494a908991Smrg# -------------------
295009113985Smrg# Minimum version: 1.14.0
29514a908991Smrg#
295209113985Smrg# Checks for various brands of compilers and sets flags as appropriate:
295309113985Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295409113985Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295509113985Smrg#   clang compiler - sets CLANGCC to "yes"
295609113985Smrg#   Intel compiler - sets INTELCC to "yes"
295709113985Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295809113985Smrg#
295909113985SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296009113985SmrgAC_LANG_CASE(
296109113985Smrg	[C], [
296209113985Smrg		AC_REQUIRE([AC_PROG_CC_C99])
296309113985Smrg	],
296409113985Smrg	[C++], [
296509113985Smrg		AC_REQUIRE([AC_PROG_CXX])
296609113985Smrg	]
296709113985Smrg)
296809113985SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
296909113985SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297009113985SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297109113985Smrg]) # XORG_COMPILER_BRAND
2972f3dfa9d3Smrg
297309113985Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2974fa120d7cSmrg# ---------------
297509113985Smrg# Minimum version: 1.16.0
297609113985Smrg#
297709113985Smrg# Test if the compiler works when passed the given flag as a command line argument.
297809113985Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
297909113985Smrg# next flag in the list until there are no more options.
298009113985Smrg#
298109113985Smrg# Note that this does not guarantee that the compiler supports the flag as some
298209113985Smrg# compilers will simply ignore arguments that they do not understand, but we do
298309113985Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298409113985Smrg# -Werror=unused-command-line-argument
298509113985Smrg#
298609113985SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
298709113985Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298809113985Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2989966b534aSmrg
299009113985SmrgAC_LANG_COMPILER_REQUIRE
29914a908991Smrg
299209113985SmrgAC_LANG_CASE(
299309113985Smrg	[C], [
299409113985Smrg		AC_REQUIRE([AC_PROG_CC_C99])
299509113985Smrg		define([PREFIX], [C])
299609113985Smrg		define([CACHE_PREFIX], [cc])
299709113985Smrg		define([COMPILER], [$CC])
299809113985Smrg	],
299909113985Smrg	[C++], [
300009113985Smrg		define([PREFIX], [CXX])
300109113985Smrg		define([CACHE_PREFIX], [cxx])
300209113985Smrg		define([COMPILER], [$CXX])
300309113985Smrg	]
300409113985Smrg)
300509113985Smrg
300609113985Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
300709113985Smrg
300809113985Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
300909113985Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301009113985Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301109113985Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
301209113985Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
301309113985Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
301409113985Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
301509113985Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
301609113985Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30174a908991Smrgfi
301809113985Smrg
301909113985Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302009113985Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302109113985Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
302209113985Smrg	fi
302309113985Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
302409113985Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
302509113985Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
302609113985Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302709113985Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
302809113985Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
302909113985Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303009113985Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303109113985Smrgfi
303209113985Smrg
303309113985Smrgfound="no"
303409113985Smrgm4_foreach([flag], m4_cdr($@), [
303509113985Smrg	if test $found = "no" ; then
303609113985Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
303709113985Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303809113985Smrg		fi
303909113985Smrg
304009113985Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304109113985Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
304209113985Smrg		fi
304309113985Smrg
304409113985Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
304509113985Smrg
304609113985Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
304709113985Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
304809113985Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
304909113985Smrg		AC_CACHE_VAL($cacheid,
305009113985Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305109113985Smrg					     [eval $cacheid=yes],
305209113985Smrg					     [eval $cacheid=no])])
305309113985Smrg
305409113985Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
305509113985Smrg
305609113985Smrg		eval supported=\$$cacheid
305709113985Smrg		AC_MSG_RESULT([$supported])
305809113985Smrg		if test "$supported" = "yes" ; then
305909113985Smrg			$1="$$1 ]flag["
306009113985Smrg			found="yes"
306109113985Smrg		fi
306209113985Smrg	fi
30634a908991Smrg])
306409113985Smrg]) # XORG_TESTSET_CFLAG
3065966b534aSmrg
306609113985Smrg# XORG_COMPILER_FLAGS
306709113985Smrg# ---------------
306809113985Smrg# Minimum version: 1.16.0
3069da4266ffSmrg#
307009113985Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307109113985Smrg# arguments supported by the selected compiler which do NOT alter the generated
307209113985Smrg# code.  These arguments will cause the compiler to print various warnings
307309113985Smrg# during compilation AND turn a conservative set of warnings into errors.
307409113985Smrg#
307509113985Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
307609113985Smrg# future versions of util-macros as options are added to new compilers.
307709113985Smrg#
307809113985SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
307909113985SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3080a0d3b6eaSmrg
308109113985SmrgAC_ARG_ENABLE(selective-werror,
308209113985Smrg              AS_HELP_STRING([--disable-selective-werror],
308309113985Smrg                             [Turn off selective compiler errors. (default: enabled)]),
308409113985Smrg              [SELECTIVE_WERROR=$enableval],
308509113985Smrg              [SELECTIVE_WERROR=yes])
308609113985Smrg
308709113985SmrgAC_LANG_CASE(
308809113985Smrg        [C], [
308909113985Smrg                define([PREFIX], [C])
309009113985Smrg        ],
309109113985Smrg        [C++], [
309209113985Smrg                define([PREFIX], [CXX])
309309113985Smrg        ]
309409113985Smrg)
309509113985Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
309609113985Smrgif test "x$SUNCC" = "xyes"; then
309709113985Smrg    [BASE_]PREFIX[FLAGS]="-v"
3098fa120d7cSmrgelse
309909113985Smrg    [BASE_]PREFIX[FLAGS]=""
3100fa120d7cSmrgfi
3101fa120d7cSmrg
310209113985Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
310309113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
310409113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
310509113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
310609113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3107fa120d7cSmrg
310809113985SmrgAC_LANG_CASE(
310909113985Smrg	[C], [
311009113985Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311109113985Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
311209113985Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
311309113985Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
311409113985Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
311509113985Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
311609113985Smrg	]
311709113985Smrg)
3118f8a31ee4Smrg
311909113985Smrg# This chunk adds additional warnings that could catch undesired effects.
312009113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312109113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
312209113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
312309113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
312409113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
312509113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
312609113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3127a0d3b6eaSmrg
312809113985Smrg# These are currently disabled because they are noisy.  They will be enabled
312909113985Smrg# in the future once the codebase is sufficiently modernized to silence
313009113985Smrg# them.  For now, I don't want them to drown out the other warnings.
313109113985Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
313209113985Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
313309113985Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3134f8a31ee4Smrg
313509113985Smrg# Turn some warnings into errors, so we don't accidently get successful builds
313609113985Smrg# when there are problems that should be fixed.
3137a0d3b6eaSmrg
313809113985Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
313909113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314009113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314109113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
314209113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
314309113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
314409113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
314509113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
314609113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
314709113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
314809113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
314909113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315009113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315109113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
315209113985Smrgelse
315309113985SmrgAC_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])
315409113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
315509113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
315609113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
315709113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
315809113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
315909113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316009113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316109113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
316209113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
316309113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
316409113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
316509113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
316609113985SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
316709113985Smrgfi
3168a0d3b6eaSmrg
316909113985SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317009113985Smrg]) # XORG_COMPILER_FLAGS
3171a0d3b6eaSmrg
317209113985Smrg# XORG_CWARNFLAGS
317309113985Smrg# ---------------
317409113985Smrg# Minimum version: 1.2.0
317509113985Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3176966b534aSmrg#
317709113985Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3178da4266ffSmrg#
317909113985Smrg# This function is deprecated because it defines -fno-strict-aliasing
318009113985Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318109113985Smrg# is needed, then it should be added explicitly in the module when
318209113985Smrg# it is updated to use BASE_CFLAGS.
31834a908991Smrg#
318409113985SmrgAC_DEFUN([XORG_CWARNFLAGS], [
318509113985SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
318609113985SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
318709113985SmrgAC_LANG_CASE(
318809113985Smrg	[C], [
318909113985Smrg		CWARNFLAGS="$BASE_CFLAGS"
319009113985Smrg		if  test "x$GCC" = xyes ; then
319109113985Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
319209113985Smrg		fi
319309113985Smrg		AC_SUBST(CWARNFLAGS)
319409113985Smrg	]
319509113985Smrg)
319609113985Smrg]) # XORG_CWARNFLAGS
3197a0d3b6eaSmrg
319809113985Smrg# XORG_STRICT_OPTION
319909113985Smrg# -----------------------
320009113985Smrg# Minimum version: 1.3.0
320109113985Smrg#
320209113985Smrg# Add configure option to enable strict compilation flags, such as treating
320309113985Smrg# warnings as fatal errors.
320409113985Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
320509113985Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
320609113985Smrg#
320709113985Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
320809113985Smrg# when strict compilation is unconditionally desired.
320909113985SmrgAC_DEFUN([XORG_STRICT_OPTION], [
321009113985SmrgAC_REQUIRE([XORG_CWARNFLAGS])
321109113985SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32124a908991Smrg
321309113985SmrgAC_ARG_ENABLE(strict-compilation,
321409113985Smrg			  AS_HELP_STRING([--enable-strict-compilation],
321509113985Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
321609113985Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
32174a908991Smrg
321809113985SmrgAC_LANG_CASE(
321909113985Smrg        [C], [
322009113985Smrg                define([PREFIX], [C])
322109113985Smrg        ],
322209113985Smrg        [C++], [
322309113985Smrg                define([PREFIX], [CXX])
322409113985Smrg        ]
322509113985Smrg)
32264a908991Smrg
322709113985Smrg[STRICT_]PREFIX[FLAGS]=""
322809113985SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
322909113985SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
32304a908991Smrg
323109113985Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
323209113985Smrg# activate it with -Werror, so we add it here explicitly.
323309113985SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
32344a908991Smrg
323509113985Smrgif test "x$STRICT_COMPILE" = "xyes"; then
323609113985Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
323709113985Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
323809113985Smrgfi
323909113985SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324009113985SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324109113985SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
324209113985Smrg]) # XORG_STRICT_OPTION
32434a908991Smrg
324409113985Smrg# XORG_DEFAULT_OPTIONS
324509113985Smrg# --------------------
324609113985Smrg# Minimum version: 1.3.0
324709113985Smrg#
324809113985Smrg# Defines default options for X.Org modules.
324909113985Smrg#
325009113985SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
325109113985SmrgAC_REQUIRE([AC_PROG_INSTALL])
325209113985SmrgXORG_COMPILER_FLAGS
325309113985SmrgXORG_CWARNFLAGS
325409113985SmrgXORG_STRICT_OPTION
325509113985SmrgXORG_RELEASE_VERSION
325609113985SmrgXORG_CHANGELOG
325709113985SmrgXORG_INSTALL
325809113985SmrgXORG_MANPAGE_SECTIONS
325909113985Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326009113985Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
326109113985Smrg]) # XORG_DEFAULT_OPTIONS
3262fa120d7cSmrg
326309113985Smrg# XORG_INSTALL()
326409113985Smrg# ----------------
326509113985Smrg# Minimum version: 1.4.0
326609113985Smrg#
326709113985Smrg# Defines the variable INSTALL_CMD as the command to copy
326809113985Smrg# INSTALL from $prefix/share/util-macros.
326909113985Smrg#
327009113985SmrgAC_DEFUN([XORG_INSTALL], [
327109113985SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
327209113985Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
327309113985SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
327409113985Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
327509113985Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
327609113985Smrgtouch \$(top_srcdir)/INSTALL; \
327709113985Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
327809113985SmrgAC_SUBST([INSTALL_CMD])
327909113985Smrg]) # XORG_INSTALL
328009113985Smrgdnl Copyright 2005 Red Hat, Inc
328109113985Smrgdnl
328209113985Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
328309113985Smrgdnl documentation for any purpose is hereby granted without fee, provided that
328409113985Smrgdnl the above copyright notice appear in all copies and that both that
328509113985Smrgdnl copyright notice and this permission notice appear in supporting
328609113985Smrgdnl documentation.
328709113985Smrgdnl
328809113985Smrgdnl The above copyright notice and this permission notice shall be included
328909113985Smrgdnl in all copies or substantial portions of the Software.
329009113985Smrgdnl
329109113985Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
329209113985Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
329309113985Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
329409113985Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
329509113985Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
329609113985Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
329709113985Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
329809113985Smrgdnl
329909113985Smrgdnl Except as contained in this notice, the name of the copyright holders shall
330009113985Smrgdnl not be used in advertising or otherwise to promote the sale, use or
330109113985Smrgdnl other dealings in this Software without prior written authorization
330209113985Smrgdnl from the copyright holders.
330309113985Smrgdnl
33044a908991Smrg
330509113985Smrg# XORG_RELEASE_VERSION
330609113985Smrg# --------------------
330709113985Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3308fa120d7cSmrg
330909113985SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
331009113985Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
331109113985Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
331209113985Smrg		[Major version of this package])
331309113985Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
331409113985Smrg	if test "x$PVM" = "x"; then
331509113985Smrg		PVM="0"
331609113985Smrg	fi
331709113985Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
331809113985Smrg		[$PVM],
331909113985Smrg		[Minor version of this package])
332009113985Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
332109113985Smrg	if test "x$PVP" = "x"; then
332209113985Smrg		PVP="0"
332309113985Smrg	fi
332409113985Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
332509113985Smrg		[$PVP],
332609113985Smrg		[Patch version of this package])
332709113985Smrg])
33284a908991Smrg
332909113985Smrg# XORG_CHANGELOG()
333009113985Smrg# ----------------
333109113985Smrg# Minimum version: 1.2.0
333209113985Smrg#
333309113985Smrg# Defines the variable CHANGELOG_CMD as the command to generate
333409113985Smrg# ChangeLog from git.
333509113985Smrg#
333609113985Smrg#
333709113985SmrgAC_DEFUN([XORG_CHANGELOG], [
333809113985SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
333909113985Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
334009113985Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
334109113985Smrgtouch \$(top_srcdir)/ChangeLog; \
334209113985Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
334309113985SmrgAC_SUBST([CHANGELOG_CMD])
334409113985Smrg]) # XORG_CHANGELOG
3345a0d3b6eaSmrg
3346