158105723Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2e7fdea5fSmrg
358105723Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4067610f1Smrg
5067610f1Smrg# This file is free software; the Free Software Foundation
6067610f1Smrg# gives unlimited permission to copy and/or distribute it,
7067610f1Smrg# with or without modifications, as long as this notice is preserved.
8067610f1Smrg
9067610f1Smrg# This program is distributed in the hope that it will be useful,
10067610f1Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11067610f1Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12067610f1Smrg# PARTICULAR PURPOSE.
13067610f1Smrg
14e7fdea5fSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
157e6533d5Smrgm4_ifndef([AC_AUTOCONF_VERSION],
167e6533d5Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1758105723Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
1858105723Smrg[m4_warning([this file was generated for autoconf 2.71.
197e6533d5SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
207e6533d5SmrgIf you have problems, you may need to regenerate the build system entirely.
21e7fdea5fSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22067610f1Smrg
2358105723Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2458105723Smrg#
2558105723Smrg# This file is free software; the Free Software Foundation
2658105723Smrg# gives unlimited permission to copy and/or distribute it,
2758105723Smrg# with or without modifications, as long as this notice is preserved.
284d9306dbSmrg
2958105723Smrg# AM_AUTOMAKE_VERSION(VERSION)
3058105723Smrg# ----------------------------
3158105723Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3258105723Smrg# generated from the m4 files accompanying Automake X.Y.
3358105723Smrg# (This private macro should not be called outside this file.)
3458105723SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3558105723Smrg[am__api_version='1.16'
3658105723Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3758105723Smrgdnl require some minimum version.  Point them to the right macro.
3858105723Smrgm4_if([$1], [1.16.5], [],
3958105723Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4058105723Smrg])
414d9306dbSmrg
4258105723Smrg# _AM_AUTOCONF_VERSION(VERSION)
4358105723Smrg# -----------------------------
4458105723Smrg# aclocal traces this macro to find the Autoconf version.
4558105723Smrg# This is a private macro too.  Using m4_define simplifies
4658105723Smrg# the logic in aclocal, which can simply ignore this definition.
4758105723Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48067610f1Smrg
4958105723Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5058105723Smrg# -------------------------------
5158105723Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5258105723Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5358105723SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5458105723Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5558105723Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5658105723Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5758105723Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58067610f1Smrg
5958105723Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60067610f1Smrg
6158105723Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6258105723Smrg#
6358105723Smrg# This file is free software; the Free Software Foundation
6458105723Smrg# gives unlimited permission to copy and/or distribute it,
6558105723Smrg# with or without modifications, as long as this notice is preserved.
66067610f1Smrg
6758105723Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6858105723Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6958105723Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7058105723Smrg#
7158105723Smrg# Of course, Automake must honor this variable whenever it calls a
7258105723Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7358105723Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7458105723Smrg# depending on how configure is run.  This is pretty annoying, since
7558105723Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7658105723Smrg# source directory, any form will work fine, but in subdirectories a
7758105723Smrg# relative path needs to be adjusted first.
7858105723Smrg#
7958105723Smrg# $ac_aux_dir/missing
8058105723Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8158105723Smrg# $top_srcdir/$ac_aux_dir/missing
8258105723Smrg#    fails if $ac_aux_dir is absolute,
8358105723Smrg#    fails when called from a subdirectory in a VPATH build with
8458105723Smrg#          a relative $ac_aux_dir
8558105723Smrg#
8658105723Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8758105723Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8858105723Smrg# harmless because $srcdir is '.', but things will broke when you
8958105723Smrg# start a VPATH build or use an absolute $srcdir.
9058105723Smrg#
9158105723Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9258105723Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9358105723Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9458105723Smrg# and then we would define $MISSING as
9558105723Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9658105723Smrg# This will work as long as MISSING is not called from configure, because
9758105723Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9858105723Smrg# However there are other variables, like CC, which are often used in
9958105723Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10058105723Smrg#
10158105723Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10258105723Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10358105723Smrg# configured tree to be moved without reconfiguration.
104067610f1Smrg
10558105723SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10658105723Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10758105723Smrg# Expand $ac_aux_dir to an absolute path.
10858105723Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10958105723Smrg])
110067610f1Smrg
11158105723Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112067610f1Smrg
11358105723Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11458105723Smrg#
11558105723Smrg# This file is free software; the Free Software Foundation
11658105723Smrg# gives unlimited permission to copy and/or distribute it,
11758105723Smrg# with or without modifications, as long as this notice is preserved.
118067610f1Smrg
11958105723Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12058105723Smrg# -------------------------------------
12158105723Smrg# Define a conditional.
12258105723SmrgAC_DEFUN([AM_CONDITIONAL],
12358105723Smrg[AC_PREREQ([2.52])dnl
12458105723Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12558105723Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12658105723SmrgAC_SUBST([$1_TRUE])dnl
12758105723SmrgAC_SUBST([$1_FALSE])dnl
12858105723Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12958105723Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13058105723Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13158105723Smrgif $2; then
13258105723Smrg  $1_TRUE=
13358105723Smrg  $1_FALSE='#'
13458105723Smrgelse
13558105723Smrg  $1_TRUE='#'
13658105723Smrg  $1_FALSE=
13758105723Smrgfi
13858105723SmrgAC_CONFIG_COMMANDS_PRE(
13958105723Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14058105723Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14158105723SmrgUsually this means the macro was only invoked conditionally.]])
14258105723Smrgfi])])
143067610f1Smrg
14458105723Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14558105723Smrg#
14658105723Smrg# This file is free software; the Free Software Foundation
14758105723Smrg# gives unlimited permission to copy and/or distribute it,
14858105723Smrg# with or without modifications, as long as this notice is preserved.
149067610f1Smrg
150067610f1Smrg
15158105723Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15258105723Smrg# written in clear, in which case automake, when reading aclocal.m4,
15358105723Smrg# will think it sees a *use*, and therefore will trigger all it's
15458105723Smrg# C support machinery.  Also note that it means that autoscan, seeing
15558105723Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156067610f1Smrg
157067610f1Smrg
15858105723Smrg# _AM_DEPENDENCIES(NAME)
15958105723Smrg# ----------------------
16058105723Smrg# See how the compiler implements dependency checking.
16158105723Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16258105723Smrg# We try a few techniques and use that to set a single cache variable.
16358105723Smrg#
16458105723Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16558105723Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16658105723Smrg# dependency, and given that the user is not expected to run this macro,
16758105723Smrg# just rely on AC_PROG_CC.
16858105723SmrgAC_DEFUN([_AM_DEPENDENCIES],
16958105723Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17058105723SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17158105723SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17258105723SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173067610f1Smrg
17458105723Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17558105723Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17658105723Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17758105723Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17858105723Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17958105723Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18058105723Smrg                    [depcc="$$1"   am_compiler_list=])
181067610f1Smrg
18258105723SmrgAC_CACHE_CHECK([dependency style of $depcc],
18358105723Smrg               [am_cv_$1_dependencies_compiler_type],
18458105723Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18558105723Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18658105723Smrg  # making bogus files that we don't know about and never remove.  For
18758105723Smrg  # instance it was reported that on HP-UX the gcc test will end up
18858105723Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18958105723Smrg  # in D".
19058105723Smrg  rm -rf conftest.dir
19158105723Smrg  mkdir conftest.dir
19258105723Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19358105723Smrg  # using a relative directory.
19458105723Smrg  cp "$am_depcomp" conftest.dir
19558105723Smrg  cd conftest.dir
19658105723Smrg  # We will build objects and dependencies in a subdirectory because
19758105723Smrg  # it helps to detect inapplicable dependency modes.  For instance
19858105723Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19958105723Smrg  # side effect of compilation, but ICC will put the dependencies in
20058105723Smrg  # the current directory while Tru64 will put them in the object
20158105723Smrg  # directory.
20258105723Smrg  mkdir sub
203067610f1Smrg
20458105723Smrg  am_cv_$1_dependencies_compiler_type=none
20558105723Smrg  if test "$am_compiler_list" = ""; then
20658105723Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20758105723Smrg  fi
20858105723Smrg  am__universal=false
20958105723Smrg  m4_case([$1], [CC],
21058105723Smrg    [case " $depcc " in #(
21158105723Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21258105723Smrg     esac],
21358105723Smrg    [CXX],
21458105723Smrg    [case " $depcc " in #(
21558105723Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21658105723Smrg     esac])
217067610f1Smrg
21858105723Smrg  for depmode in $am_compiler_list; do
21958105723Smrg    # Setup a source with many dependencies, because some compilers
22058105723Smrg    # like to wrap large dependency lists on column 80 (with \), and
22158105723Smrg    # we should not choose a depcomp mode which is confused by this.
22258105723Smrg    #
22358105723Smrg    # We need to recreate these files for each test, as the compiler may
22458105723Smrg    # overwrite some of them when testing with obscure command lines.
22558105723Smrg    # This happens at least with the AIX C compiler.
22658105723Smrg    : > sub/conftest.c
22758105723Smrg    for i in 1 2 3 4 5 6; do
22858105723Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22958105723Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23058105723Smrg      # Solaris 10 /bin/sh.
23158105723Smrg      echo '/* dummy */' > sub/conftst$i.h
23258105723Smrg    done
23358105723Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234067610f1Smrg
23558105723Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23658105723Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23758105723Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23858105723Smrg    # versions had trouble with output in subdirs.
23958105723Smrg    am__obj=sub/conftest.${OBJEXT-o}
24058105723Smrg    am__minus_obj="-o $am__obj"
24158105723Smrg    case $depmode in
24258105723Smrg    gcc)
24358105723Smrg      # This depmode causes a compiler race in universal mode.
24458105723Smrg      test "$am__universal" = false || continue
24558105723Smrg      ;;
24658105723Smrg    nosideeffect)
24758105723Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24858105723Smrg      # only be used when explicitly requested.
24958105723Smrg      if test "x$enable_dependency_tracking" = xyes; then
25058105723Smrg	continue
25158105723Smrg      else
25258105723Smrg	break
25358105723Smrg      fi
25458105723Smrg      ;;
25558105723Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25658105723Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25758105723Smrg      # not run yet.  These depmodes are late enough in the game, and
25858105723Smrg      # so weak that their functioning should not be impacted.
25958105723Smrg      am__obj=conftest.${OBJEXT-o}
26058105723Smrg      am__minus_obj=
26158105723Smrg      ;;
26258105723Smrg    none) break ;;
26358105723Smrg    esac
26458105723Smrg    if depmode=$depmode \
26558105723Smrg       source=sub/conftest.c object=$am__obj \
26658105723Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26758105723Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26858105723Smrg         >/dev/null 2>conftest.err &&
26958105723Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27058105723Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27158105723Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27258105723Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27358105723Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27458105723Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27558105723Smrg      # that says an option was ignored or not supported.
27658105723Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27758105723Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27858105723Smrg      # The diagnosis changed in icc 8.0:
27958105723Smrg      #   icc: Command line remark: option '-MP' not supported
28058105723Smrg      if (grep 'ignoring option' conftest.err ||
28158105723Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28258105723Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28358105723Smrg        break
28458105723Smrg      fi
28558105723Smrg    fi
28658105723Smrg  done
2877e6533d5Smrg
28858105723Smrg  cd ..
28958105723Smrg  rm -rf conftest.dir
29058105723Smrgelse
29158105723Smrg  am_cv_$1_dependencies_compiler_type=none
29258105723Smrgfi
29358105723Smrg])
29458105723SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29558105723SmrgAM_CONDITIONAL([am__fastdep$1], [
29658105723Smrg  test "x$enable_dependency_tracking" != xno \
29758105723Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29858105723Smrg])
299067610f1Smrg
3004d9306dbSmrg
30158105723Smrg# AM_SET_DEPDIR
30258105723Smrg# -------------
30358105723Smrg# Choose a directory name for dependency files.
30458105723Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30558105723SmrgAC_DEFUN([AM_SET_DEPDIR],
30658105723Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30758105723SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30858105723Smrg])
3094d9306dbSmrg
3104d9306dbSmrg
31158105723Smrg# AM_DEP_TRACK
31258105723Smrg# ------------
31358105723SmrgAC_DEFUN([AM_DEP_TRACK],
31458105723Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31558105723SmrgAS_HELP_STRING(
31658105723Smrg  [--enable-dependency-tracking],
31758105723Smrg  [do not reject slow dependency extractors])
31858105723SmrgAS_HELP_STRING(
31958105723Smrg  [--disable-dependency-tracking],
32058105723Smrg  [speeds up one-time build])])
32158105723Smrgif test "x$enable_dependency_tracking" != xno; then
32258105723Smrg  am_depcomp="$ac_aux_dir/depcomp"
32358105723Smrg  AMDEPBACKSLASH='\'
32458105723Smrg  am__nodep='_no'
32558105723Smrgfi
32658105723SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32758105723SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32858105723Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32958105723SmrgAC_SUBST([am__nodep])dnl
33058105723Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33158105723Smrg])
3324d9306dbSmrg
33358105723Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3344d9306dbSmrg
33558105723Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3364d9306dbSmrg#
33758105723Smrg# This file is free software; the Free Software Foundation
33858105723Smrg# gives unlimited permission to copy and/or distribute it,
33958105723Smrg# with or without modifications, as long as this notice is preserved.
3404d9306dbSmrg
34158105723Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34258105723Smrg# ------------------------------
34358105723SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34458105723Smrg[{
34558105723Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34658105723Smrg  # are listed without --file.  Let's play safe and only enable the eval
34758105723Smrg  # if we detect the quoting.
34858105723Smrg  # TODO: see whether this extra hack can be removed once we start
34958105723Smrg  # requiring Autoconf 2.70 or later.
35058105723Smrg  AS_CASE([$CONFIG_FILES],
35158105723Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
35258105723Smrg          [*], [set x $CONFIG_FILES])
35358105723Smrg  shift
35458105723Smrg  # Used to flag and report bootstrapping failures.
35558105723Smrg  am_rc=0
35658105723Smrg  for am_mf
35758105723Smrg  do
35858105723Smrg    # Strip MF so we end up with the name of the file.
35958105723Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36058105723Smrg    # Check whether this is an Automake generated Makefile which includes
36158105723Smrg    # dependency-tracking related rules and includes.
36258105723Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36358105723Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36458105723Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36558105723Smrg      || continue
36658105723Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36758105723Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36858105723Smrg    AM_RUN_LOG([cd "$am_dirpart" \
36958105723Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37058105723Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37158105723Smrg  done
37258105723Smrg  if test $am_rc -ne 0; then
37358105723Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37458105723Smrg    for automatic dependency tracking.  If GNU make was not used, consider
37558105723Smrg    re-running the configure script with MAKE="gmake" (or whatever is
37658105723Smrg    necessary).  You can also try re-running configure with the
37758105723Smrg    '--disable-dependency-tracking' option to at least be able to build
37858105723Smrg    the package (albeit without support for automatic dependency tracking).])
37958105723Smrg  fi
38058105723Smrg  AS_UNSET([am_dirpart])
38158105723Smrg  AS_UNSET([am_filepart])
38258105723Smrg  AS_UNSET([am_mf])
38358105723Smrg  AS_UNSET([am_rc])
38458105723Smrg  rm -f conftest-deps.mk
38558105723Smrg}
38658105723Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387067610f1Smrg
388067610f1Smrg
38958105723Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39058105723Smrg# -----------------------------
39158105723Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3924d9306dbSmrg#
39358105723Smrg# This code is only required when automatic dependency tracking is enabled.
39458105723Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39558105723Smrg# order to bootstrap the dependency handling code.
39658105723SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39758105723Smrg[AC_CONFIG_COMMANDS([depfiles],
39858105723Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39958105723Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400067610f1Smrg
40158105723Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402067610f1Smrg
40358105723Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40458105723Smrg#
40558105723Smrg# This file is free software; the Free Software Foundation
40658105723Smrg# gives unlimited permission to copy and/or distribute it,
40758105723Smrg# with or without modifications, as long as this notice is preserved.
408067610f1Smrg
40958105723Smrg# This macro actually does too much.  Some checks are only needed if
41058105723Smrg# your package does certain things.  But this isn't really a big deal.
411067610f1Smrg
41258105723Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41358105723Smrgm4_define([AC_PROG_CC],
41458105723Smrgm4_defn([AC_PROG_CC])
41558105723Smrg[_AM_PROG_CC_C_O
41658105723Smrg])
417067610f1Smrg
41858105723Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41958105723Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42058105723Smrg# -----------------------------------------------
42158105723Smrg# The call with PACKAGE and VERSION arguments is the old style
42258105723Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42358105723Smrg# and VERSION should now be passed to AC_INIT and removed from
42458105723Smrg# the call to AM_INIT_AUTOMAKE.
42558105723Smrg# We support both call styles for the transition.  After
42658105723Smrg# the next Automake release, Autoconf can make the AC_INIT
42758105723Smrg# arguments mandatory, and then we can depend on a new Autoconf
42858105723Smrg# release and drop the old call support.
42958105723SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43058105723Smrg[AC_PREREQ([2.65])dnl
43158105723Smrgm4_ifdef([_$0_ALREADY_INIT],
43258105723Smrg  [m4_fatal([$0 expanded multiple times
43358105723Smrg]m4_defn([_$0_ALREADY_INIT]))],
43458105723Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43558105723Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43658105723Smrgdnl the ones we care about.
43758105723Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43858105723SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43958105723SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44058105723Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44158105723Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44258105723Smrg  # is not polluted with repeated "-I."
44358105723Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44458105723Smrg  # test to see if srcdir already configured
44558105723Smrg  if test -f $srcdir/config.status; then
44658105723Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44758105723Smrg  fi
4484d9306dbSmrgfi
449067610f1Smrg
45058105723Smrg# test whether we have cygpath
45158105723Smrgif test -z "$CYGPATH_W"; then
45258105723Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45358105723Smrg    CYGPATH_W='cygpath -w'
45458105723Smrg  else
45558105723Smrg    CYGPATH_W=echo
45658105723Smrg  fi
4574d9306dbSmrgfi
45858105723SmrgAC_SUBST([CYGPATH_W])
459067610f1Smrg
46058105723Smrg# Define the identity of the package.
46158105723Smrgdnl Distinguish between old-style and new-style calls.
46258105723Smrgm4_ifval([$2],
46358105723Smrg[AC_DIAGNOSE([obsolete],
46458105723Smrg             [$0: two- and three-arguments forms are deprecated.])
46558105723Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46658105723Smrg AC_SUBST([PACKAGE], [$1])dnl
46758105723Smrg AC_SUBST([VERSION], [$2])],
46858105723Smrg[_AM_SET_OPTIONS([$1])dnl
46958105723Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47058105723Smrgm4_if(
47158105723Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47258105723Smrg  [ok:ok],,
47358105723Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47458105723Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47558105723Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476067610f1Smrg
47758105723Smrg_AM_IF_OPTION([no-define],,
47858105723Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47958105723Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4804d9306dbSmrg
48158105723Smrg# Some tools Automake needs.
48258105723SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48358105723SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48458105723SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48558105723SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48658105723SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48758105723SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48858105723SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48958105723SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49058105723SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49158105723SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49258105723Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49358105723Smrg# dies out for good.  For more background, see:
49458105723Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49558105723Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49658105723SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49758105723Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49858105723Smrg# system "awk" is bad on some platforms.
49958105723SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50058105723SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50158105723SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50258105723Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50358105723Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50458105723Smrg			     [_AM_PROG_TAR([v7])])])
50558105723Smrg_AM_IF_OPTION([no-dependencies],,
50658105723Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50758105723Smrg		  [_AM_DEPENDENCIES([CC])],
50858105723Smrg		  [m4_define([AC_PROG_CC],
50958105723Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51058105723SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51158105723Smrg		  [_AM_DEPENDENCIES([CXX])],
51258105723Smrg		  [m4_define([AC_PROG_CXX],
51358105723Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51458105723SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51558105723Smrg		  [_AM_DEPENDENCIES([OBJC])],
51658105723Smrg		  [m4_define([AC_PROG_OBJC],
51758105723Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51858105723SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51958105723Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52058105723Smrg		  [m4_define([AC_PROG_OBJCXX],
52158105723Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52258105723Smrg])
52358105723Smrg# Variables for tags utilities; see am/tags.am
52458105723Smrgif test -z "$CTAGS"; then
52558105723Smrg  CTAGS=ctags
52658105723Smrgfi
52758105723SmrgAC_SUBST([CTAGS])
52858105723Smrgif test -z "$ETAGS"; then
52958105723Smrg  ETAGS=etags
53058105723Smrgfi
53158105723SmrgAC_SUBST([ETAGS])
53258105723Smrgif test -z "$CSCOPE"; then
53358105723Smrg  CSCOPE=cscope
53458105723Smrgfi
53558105723SmrgAC_SUBST([CSCOPE])
5364d9306dbSmrg
53758105723SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53858105723Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53958105723Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54058105723Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54158105723SmrgAC_CONFIG_COMMANDS_PRE(dnl
54258105723Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54358105723Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5444d9306dbSmrg
54558105723Smrg# POSIX will say in a future version that running "rm -f" with no argument
54658105723Smrg# is OK; and we want to be able to make that assumption in our Makefile
54758105723Smrg# recipes.  So use an aggressive probe to check that the usage we want is
54858105723Smrg# actually supported "in the wild" to an acceptable degree.
54958105723Smrg# See automake bug#10828.
55058105723Smrg# To make any issue more visible, cause the running configure to be aborted
55158105723Smrg# by default if the 'rm' program in use doesn't match our expectations; the
55258105723Smrg# user can still override this though.
55358105723Smrgif rm -f && rm -fr && rm -rf; then : OK; else
55458105723Smrg  cat >&2 <<'END'
55558105723SmrgOops!
556067610f1Smrg
55758105723SmrgYour 'rm' program seems unable to run without file operands specified
55858105723Smrgon the command line, even when the '-f' option is present.  This is contrary
55958105723Smrgto the behaviour of most rm programs out there, and not conforming with
56058105723Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5614d9306dbSmrg
56258105723SmrgPlease tell bug-automake@gnu.org about your system, including the value
56358105723Smrgof your $PATH and any error possibly output before this message.  This
56458105723Smrgcan help us improve future automake versions.
565067610f1Smrg
56658105723SmrgEND
56758105723Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56858105723Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56958105723Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57058105723Smrg    echo >&2
57158105723Smrg  else
57258105723Smrg    cat >&2 <<'END'
57358105723SmrgAborting the configuration process, to ensure you take notice of the issue.
574067610f1Smrg
57558105723SmrgYou can download and install GNU coreutils to get an 'rm' implementation
57658105723Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577067610f1Smrg
57858105723SmrgIf you want to complete the configuration process using your problematic
57958105723Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58058105723Smrgto "yes", and re-run configure.
581e7fdea5fSmrg
58258105723SmrgEND
58358105723Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58458105723Smrg  fi
585067610f1Smrgfi
58658105723Smrgdnl The trailing newline in this macro's definition is deliberate, for
58758105723Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58858105723Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58958105723Smrg])
590067610f1Smrg
59158105723Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59258105723Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59358105723Smrgdnl mangled by Autoconf and run in a shell conditional statement.
59458105723Smrgm4_define([_AC_COMPILER_EXEEXT],
59558105723Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5964d9306dbSmrg
59758105723Smrg# When config.status generates a header, we must update the stamp-h file.
59858105723Smrg# This file resides in the same directory as the config header
59958105723Smrg# that is generated.  The stamp files are numbered to have different names.
6004d9306dbSmrg
60158105723Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60258105723Smrg# loop where config.status creates the headers, so we can generate
60358105723Smrg# our stamp files there.
60458105723SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60558105723Smrg[# Compute $1's index in $config_headers.
60658105723Smrg_am_arg=$1
60758105723Smrg_am_stamp_count=1
60858105723Smrgfor _am_header in $config_headers :; do
60958105723Smrg  case $_am_header in
61058105723Smrg    $_am_arg | $_am_arg:* )
61158105723Smrg      break ;;
61258105723Smrg    * )
61358105723Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61458105723Smrg  esac
61558105723Smrgdone
61658105723Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6174d9306dbSmrg
61858105723Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61958105723Smrg#
62058105723Smrg# This file is free software; the Free Software Foundation
62158105723Smrg# gives unlimited permission to copy and/or distribute it,
62258105723Smrg# with or without modifications, as long as this notice is preserved.
62358105723Smrg
62458105723Smrg# AM_PROG_INSTALL_SH
62558105723Smrg# ------------------
62658105723Smrg# Define $install_sh.
62758105723SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62858105723Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62958105723Smrgif test x"${install_sh+set}" != xset; then
63058105723Smrg  case $am_aux_dir in
63158105723Smrg  *\ * | *\	*)
63258105723Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63358105723Smrg  *)
63458105723Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63558105723Smrg  esac
63658105723Smrgfi
63758105723SmrgAC_SUBST([install_sh])])
63858105723Smrg
63958105723Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64058105723Smrg#
64158105723Smrg# This file is free software; the Free Software Foundation
64258105723Smrg# gives unlimited permission to copy and/or distribute it,
64358105723Smrg# with or without modifications, as long as this notice is preserved.
64458105723Smrg
64558105723Smrg# Check whether the underlying file-system supports filenames
64658105723Smrg# with a leading dot.  For instance MS-DOS doesn't.
64758105723SmrgAC_DEFUN([AM_SET_LEADING_DOT],
64858105723Smrg[rm -rf .tst 2>/dev/null
64958105723Smrgmkdir .tst 2>/dev/null
65058105723Smrgif test -d .tst; then
65158105723Smrg  am__leading_dot=.
6524d9306dbSmrgelse
65358105723Smrg  am__leading_dot=_
654067610f1Smrgfi
65558105723Smrgrmdir .tst 2>/dev/null
65658105723SmrgAC_SUBST([am__leading_dot])])
657067610f1Smrg
65858105723Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659067610f1Smrg
66058105723Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66158105723Smrg#
66258105723Smrg# This file is free software; the Free Software Foundation
66358105723Smrg# gives unlimited permission to copy and/or distribute it,
66458105723Smrg# with or without modifications, as long as this notice is preserved.
665067610f1Smrg
66658105723Smrg# AM_MAKE_INCLUDE()
66758105723Smrg# -----------------
66858105723Smrg# Check whether make has an 'include' directive that can support all
66958105723Smrg# the idioms we need for our automatic dependency tracking code.
67058105723SmrgAC_DEFUN([AM_MAKE_INCLUDE],
67158105723Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
67258105723Smrgcat > confinc.mk << 'END'
67358105723Smrgam__doit:
67458105723Smrg	@echo this is the am__doit target >confinc.out
67558105723Smrg.PHONY: am__doit
67658105723SmrgEND
67758105723Smrgam__include="#"
67858105723Smrgam__quote=
67958105723Smrg# BSD make does it like this.
68058105723Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
68158105723Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
68258105723Smrgecho 'include confinc.mk # ignored' > confmf.GNU
68358105723Smrg_am_result=no
68458105723Smrgfor s in GNU BSD; do
68558105723Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
68658105723Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
68758105723Smrg      ['0:this is the am__doit target'],
68858105723Smrg      [AS_CASE([$s],
68958105723Smrg          [BSD], [am__include='.include' am__quote='"'],
69058105723Smrg          [am__include='include' am__quote=''])])
69158105723Smrg  if test "$am__include" != "#"; then
69258105723Smrg    _am_result="yes ($s style)"
69358105723Smrg    break
69458105723Smrg  fi
69558105723Smrgdone
69658105723Smrgrm -f confinc.* confmf.*
69758105723SmrgAC_MSG_RESULT([${_am_result}])
69858105723SmrgAC_SUBST([am__include])])
69958105723SmrgAC_SUBST([am__quote])])
700067610f1Smrg
70158105723Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702e7fdea5fSmrg
70358105723Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
7044d9306dbSmrg#
70558105723Smrg# This file is free software; the Free Software Foundation
70658105723Smrg# gives unlimited permission to copy and/or distribute it,
70758105723Smrg# with or without modifications, as long as this notice is preserved.
708e7fdea5fSmrg
70958105723Smrg# AM_MISSING_PROG(NAME, PROGRAM)
71058105723Smrg# ------------------------------
71158105723SmrgAC_DEFUN([AM_MISSING_PROG],
71258105723Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71358105723Smrg$1=${$1-"${am_missing_run}$2"}
71458105723SmrgAC_SUBST($1)])
715e7fdea5fSmrg
71658105723Smrg# AM_MISSING_HAS_RUN
71758105723Smrg# ------------------
71858105723Smrg# Define MISSING if not defined so far and test if it is modern enough.
71958105723Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72058105723SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72158105723Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72258105723SmrgAC_REQUIRE_AUX_FILE([missing])dnl
72358105723Smrgif test x"${MISSING+set}" != xset; then
72458105723Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
7254d9306dbSmrgfi
72658105723Smrg# Use eval to expand $SHELL
72758105723Smrgif eval "$MISSING --is-lightweight"; then
72858105723Smrg  am_missing_run="$MISSING "
72958105723Smrgelse
73058105723Smrg  am_missing_run=
73158105723Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7324d9306dbSmrgfi
73358105723Smrg])
734e7fdea5fSmrg
73558105723Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736e7fdea5fSmrg
73758105723Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73858105723Smrg#
73958105723Smrg# This file is free software; the Free Software Foundation
74058105723Smrg# gives unlimited permission to copy and/or distribute it,
74158105723Smrg# with or without modifications, as long as this notice is preserved.
7427e6533d5Smrg
74358105723Smrg# _AM_MANGLE_OPTION(NAME)
74458105723Smrg# -----------------------
74558105723SmrgAC_DEFUN([_AM_MANGLE_OPTION],
74658105723Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747067610f1Smrg
74858105723Smrg# _AM_SET_OPTION(NAME)
74958105723Smrg# --------------------
75058105723Smrg# Set option NAME.  Presently that only means defining a flag for this option.
75158105723SmrgAC_DEFUN([_AM_SET_OPTION],
75258105723Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753067610f1Smrg
75458105723Smrg# _AM_SET_OPTIONS(OPTIONS)
75558105723Smrg# ------------------------
75658105723Smrg# OPTIONS is a space-separated list of Automake options.
75758105723SmrgAC_DEFUN([_AM_SET_OPTIONS],
75858105723Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75958105723Smrg
76058105723Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76158105723Smrg# -------------------------------------------
76258105723Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76358105723SmrgAC_DEFUN([_AM_IF_OPTION],
76458105723Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76558105723Smrg
76658105723Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
7674d9306dbSmrg#
76858105723Smrg# This file is free software; the Free Software Foundation
76958105723Smrg# gives unlimited permission to copy and/or distribute it,
77058105723Smrg# with or without modifications, as long as this notice is preserved.
771067610f1Smrg
77258105723Smrg# _AM_PROG_CC_C_O
77358105723Smrg# ---------------
77458105723Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77558105723Smrg# to automatically call this.
77658105723SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77758105723Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77858105723SmrgAC_REQUIRE_AUX_FILE([compile])dnl
77958105723SmrgAC_LANG_PUSH([C])dnl
78058105723SmrgAC_CACHE_CHECK(
78158105723Smrg  [whether $CC understands -c and -o together],
78258105723Smrg  [am_cv_prog_cc_c_o],
78358105723Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78458105723Smrg  # Make sure it works both with $CC and with simple cc.
78558105723Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78658105723Smrg  # compilers refuse to overwrite an existing .o file with -o,
78758105723Smrg  # though they will create one.
78858105723Smrg  am_cv_prog_cc_c_o=yes
78958105723Smrg  for am_i in 1 2; do
79058105723Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79158105723Smrg         && test -f conftest2.$ac_objext; then
79258105723Smrg      : OK
79358105723Smrg    else
79458105723Smrg      am_cv_prog_cc_c_o=no
79558105723Smrg      break
79658105723Smrg    fi
79758105723Smrg  done
79858105723Smrg  rm -f core conftest*
79958105723Smrg  unset am_i])
80058105723Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80158105723Smrg   # Losing compiler, so override with the script.
80258105723Smrg   # FIXME: It is wrong to rewrite CC.
80358105723Smrg   # But if we don't then we get into trouble of one sort or another.
80458105723Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80558105723Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80658105723Smrg   CC="$am_aux_dir/compile $CC"
807067610f1Smrgfi
80858105723SmrgAC_LANG_POP([C])])
809067610f1Smrg
81058105723Smrg# For backward compatibility.
81158105723SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812067610f1Smrg
81358105723Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814067610f1Smrg#
81558105723Smrg# This file is free software; the Free Software Foundation
81658105723Smrg# gives unlimited permission to copy and/or distribute it,
81758105723Smrg# with or without modifications, as long as this notice is preserved.
818067610f1Smrg
81958105723Smrg# AM_RUN_LOG(COMMAND)
82058105723Smrg# -------------------
82158105723Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82258105723Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82358105723SmrgAC_DEFUN([AM_RUN_LOG],
82458105723Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82558105723Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82658105723Smrg   ac_status=$?
82758105723Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82858105723Smrg   (exit $ac_status); }])
82958105723Smrg
83058105723Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83158105723Smrg
83258105723Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8334d9306dbSmrg#
83458105723Smrg# This file is free software; the Free Software Foundation
83558105723Smrg# gives unlimited permission to copy and/or distribute it,
83658105723Smrg# with or without modifications, as long as this notice is preserved.
837067610f1Smrg
83858105723Smrg# AM_SANITY_CHECK
83958105723Smrg# ---------------
84058105723SmrgAC_DEFUN([AM_SANITY_CHECK],
84158105723Smrg[AC_MSG_CHECKING([whether build environment is sane])
84258105723Smrg# Reject unsafe characters in $srcdir or the absolute working directory
84358105723Smrg# name.  Accept space and tab only in the latter.
84458105723Smrgam_lf='
84558105723Smrg'
84658105723Smrgcase `pwd` in
84758105723Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84858105723Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84958105723Smrgesac
85058105723Smrgcase $srcdir in
85158105723Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85258105723Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85358105723Smrgesac
85458105723Smrg
85558105723Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85658105723Smrg# arguments.  Must try -L first in case configure is actually a
85758105723Smrg# symlink; some systems play weird games with the mod time of symlinks
85858105723Smrg# (eg FreeBSD returns the mod time of the symlink's containing
85958105723Smrg# directory).
86058105723Smrgif (
86158105723Smrg   am_has_slept=no
86258105723Smrg   for am_try in 1 2; do
86358105723Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86458105723Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86558105723Smrg     if test "$[*]" = "X"; then
86658105723Smrg	# -L didn't work.
86758105723Smrg	set X `ls -t "$srcdir/configure" conftest.file`
86858105723Smrg     fi
86958105723Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87058105723Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87158105723Smrg
87258105723Smrg	# If neither matched, then we have a broken ls.  This can happen
87358105723Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87458105723Smrg	# broken ls alias from the environment.  This has actually
87558105723Smrg	# happened.  Such a system could not be considered "sane".
87658105723Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87758105723Smrg  alias in your environment])
87858105723Smrg     fi
87958105723Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88058105723Smrg       break
88158105723Smrg     fi
88258105723Smrg     # Just in case.
88358105723Smrg     sleep 1
88458105723Smrg     am_has_slept=yes
88558105723Smrg   done
88658105723Smrg   test "$[2]" = conftest.file
88758105723Smrg   )
88858105723Smrgthen
88958105723Smrg   # Ok.
89058105723Smrg   :
891067610f1Smrgelse
89258105723Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
89358105723SmrgCheck your system clock])
894067610f1Smrgfi
89558105723SmrgAC_MSG_RESULT([yes])
89658105723Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89758105723Smrg# generated files are strictly newer.
89858105723Smrgam_sleep_pid=
89958105723Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90058105723Smrg  ( sleep 1 ) &
90158105723Smrg  am_sleep_pid=$!
90258105723Smrgfi
90358105723SmrgAC_CONFIG_COMMANDS_PRE(
90458105723Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90558105723Smrg   if test -n "$am_sleep_pid"; then
90658105723Smrg     # Hide warnings about reused PIDs.
90758105723Smrg     wait $am_sleep_pid 2>/dev/null
90858105723Smrg   fi
90958105723Smrg   AC_MSG_RESULT([done])])
91058105723Smrgrm -f conftest.file
91158105723Smrg])
912067610f1Smrg
91358105723Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9144d9306dbSmrg#
91558105723Smrg# This file is free software; the Free Software Foundation
91658105723Smrg# gives unlimited permission to copy and/or distribute it,
91758105723Smrg# with or without modifications, as long as this notice is preserved.
918067610f1Smrg
91958105723Smrg# AM_SILENT_RULES([DEFAULT])
92058105723Smrg# --------------------------
92158105723Smrg# Enable less verbose build rules; with the default set to DEFAULT
92258105723Smrg# ("yes" being less verbose, "no" or empty being verbose).
92358105723SmrgAC_DEFUN([AM_SILENT_RULES],
92458105723Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92558105723SmrgAS_HELP_STRING(
92658105723Smrg  [--enable-silent-rules],
92758105723Smrg  [less verbose build output (undo: "make V=1")])
92858105723SmrgAS_HELP_STRING(
92958105723Smrg  [--disable-silent-rules],
93058105723Smrg  [verbose build output (undo: "make V=0")])dnl
93158105723Smrg])
93258105723Smrgcase $enable_silent_rules in @%:@ (((
93358105723Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93458105723Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93558105723Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93658105723Smrgesac
93758105723Smrgdnl
93858105723Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93958105723Smrgdnl do not support nested variable expansions.
94058105723Smrgdnl See automake bug#9928 and bug#10237.
94158105723Smrgam_make=${MAKE-make}
94258105723SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94358105723Smrg   [am_cv_make_support_nested_variables],
94458105723Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94558105723SmrgBAR0=false
94658105723SmrgBAR1=true
94758105723SmrgV=1
94858105723Smrgam__doit:
94958105723Smrg	@$(TRUE)
95058105723Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95158105723Smrg  am_cv_make_support_nested_variables=yes
9524d9306dbSmrgelse
95358105723Smrg  am_cv_make_support_nested_variables=no
95458105723Smrgfi])
95558105723Smrgif test $am_cv_make_support_nested_variables = yes; then
95658105723Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95758105723Smrg  AM_V='$(V)'
95858105723Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95958105723Smrgelse
96058105723Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96158105723Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962e7fdea5fSmrgfi
96358105723SmrgAC_SUBST([AM_V])dnl
96458105723SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96558105723SmrgAC_SUBST([AM_DEFAULT_V])dnl
96658105723SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96758105723SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96858105723SmrgAM_BACKSLASH='\'
96958105723SmrgAC_SUBST([AM_BACKSLASH])dnl
97058105723Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97158105723Smrg])
972e7fdea5fSmrg
97358105723Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
9744d9306dbSmrg#
97558105723Smrg# This file is free software; the Free Software Foundation
97658105723Smrg# gives unlimited permission to copy and/or distribute it,
97758105723Smrg# with or without modifications, as long as this notice is preserved.
978067610f1Smrg
97958105723Smrg# AM_PROG_INSTALL_STRIP
98058105723Smrg# ---------------------
98158105723Smrg# One issue with vendor 'install' (even GNU) is that you can't
98258105723Smrg# specify the program used to strip binaries.  This is especially
98358105723Smrg# annoying in cross-compiling environments, where the build's strip
98458105723Smrg# is unlikely to handle the host's binaries.
98558105723Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98658105723Smrg# always use install-sh in "make install-strip", and initialize
98758105723Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
98858105723SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98958105723Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99058105723Smrg# Installed binaries are usually stripped using 'strip' when the user
99158105723Smrg# run "make install-strip".  However 'strip' might not be the right
99258105723Smrg# tool to use in cross-compilation environments, therefore Automake
99358105723Smrg# will honor the 'STRIP' environment variable to overrule this program.
99458105723Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99558105723Smrgif test "$cross_compiling" != no; then
99658105723Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9974d9306dbSmrgfi
99858105723SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99958105723SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10007e6533d5Smrg
100158105723Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
10024d9306dbSmrg#
100358105723Smrg# This file is free software; the Free Software Foundation
100458105723Smrg# gives unlimited permission to copy and/or distribute it,
100558105723Smrg# with or without modifications, as long as this notice is preserved.
1006e7fdea5fSmrg
100758105723Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
100858105723Smrg# ---------------------------
100958105723Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101058105723Smrg# This macro is traced by Automake.
101158105723SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10124d9306dbSmrg
101358105723Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101458105723Smrg# --------------------------
101558105723Smrg# Public sister of _AM_SUBST_NOTMAKE.
101658105723SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017067610f1Smrg
101858105723Smrg# Check how to create a tarball.                            -*- Autoconf -*-
10194d9306dbSmrg
102058105723Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
10214d9306dbSmrg#
102258105723Smrg# This file is free software; the Free Software Foundation
102358105723Smrg# gives unlimited permission to copy and/or distribute it,
102458105723Smrg# with or without modifications, as long as this notice is preserved.
102558105723Smrg
102658105723Smrg# _AM_PROG_TAR(FORMAT)
102758105723Smrg# --------------------
102858105723Smrg# Check how to create a tarball in format FORMAT.
102958105723Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10304d9306dbSmrg#
103158105723Smrg# Substitute a variable $(am__tar) that is a command
103258105723Smrg# writing to stdout a FORMAT-tarball containing the directory
103358105723Smrg# $tardir.
103458105723Smrg#     tardir=directory && $(am__tar) > result.tar
10354d9306dbSmrg#
103658105723Smrg# Substitute a variable $(am__untar) that extract such
103758105723Smrg# a tarball read from stdin.
103858105723Smrg#     $(am__untar) < result.tar
10394d9306dbSmrg#
104058105723SmrgAC_DEFUN([_AM_PROG_TAR],
104158105723Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104258105723Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104358105723SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10447e6533d5Smrg
104558105723Smrg# We'll loop over all known methods to create a tar archive until one works.
104658105723Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10474d9306dbSmrg
104858105723Smrgm4_if([$1], [v7],
104958105723Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10507e6533d5Smrg
105158105723Smrg  [m4_case([$1],
105258105723Smrg    [ustar],
105358105723Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105458105723Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105558105723Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105658105723Smrg      # and bug#13588).
105758105723Smrg      am_max_uid=2097151 # 2^21 - 1
105858105723Smrg      am_max_gid=$am_max_uid
105958105723Smrg      # The $UID and $GID variables are not portable, so we need to resort
106058105723Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106158105723Smrg      # below are definitely unexpected, so allow the users to see them
106258105723Smrg      # (that is, avoid stderr redirection).
106358105723Smrg      am_uid=`id -u || echo unknown`
106458105723Smrg      am_gid=`id -g || echo unknown`
106558105723Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106658105723Smrg      if test $am_uid -le $am_max_uid; then
106758105723Smrg         AC_MSG_RESULT([yes])
106858105723Smrg      else
106958105723Smrg         AC_MSG_RESULT([no])
107058105723Smrg         _am_tools=none
107158105723Smrg      fi
107258105723Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107358105723Smrg      if test $am_gid -le $am_max_gid; then
107458105723Smrg         AC_MSG_RESULT([yes])
107558105723Smrg      else
107658105723Smrg        AC_MSG_RESULT([no])
107758105723Smrg        _am_tools=none
107858105723Smrg      fi],
1079e7fdea5fSmrg
108058105723Smrg  [pax],
108158105723Smrg    [],
1082067610f1Smrg
108358105723Smrg  [m4_fatal([Unknown tar format])])
10844d9306dbSmrg
108558105723Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086aea1d7ffSmrg
108758105723Smrg  # Go ahead even if we have the value already cached.  We do so because we
108858105723Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108958105723Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090aea1d7ffSmrg
109158105723Smrg  for _am_tool in $_am_tools; do
109258105723Smrg    case $_am_tool in
109358105723Smrg    gnutar)
109458105723Smrg      for _am_tar in tar gnutar gtar; do
109558105723Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109658105723Smrg      done
109758105723Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109858105723Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109958105723Smrg      am__untar="$_am_tar -xf -"
110058105723Smrg      ;;
110158105723Smrg    plaintar)
110258105723Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110358105723Smrg      # ustar tarball either.
110458105723Smrg      (tar --version) >/dev/null 2>&1 && continue
110558105723Smrg      am__tar='tar chf - "$$tardir"'
110658105723Smrg      am__tar_='tar chf - "$tardir"'
110758105723Smrg      am__untar='tar xf -'
110858105723Smrg      ;;
110958105723Smrg    pax)
111058105723Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111158105723Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111258105723Smrg      am__untar='pax -r'
111358105723Smrg      ;;
111458105723Smrg    cpio)
111558105723Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111658105723Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111758105723Smrg      am__untar='cpio -i -H $1 -d'
111858105723Smrg      ;;
111958105723Smrg    none)
112058105723Smrg      am__tar=false
112158105723Smrg      am__tar_=false
112258105723Smrg      am__untar=false
112358105723Smrg      ;;
112458105723Smrg    esac
1125aea1d7ffSmrg
112658105723Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112758105723Smrg    # and am__untar set.
112858105723Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129067610f1Smrg
113058105723Smrg    # tar/untar a dummy directory, and stop if the command works.
113158105723Smrg    rm -rf conftest.dir
113258105723Smrg    mkdir conftest.dir
113358105723Smrg    echo GrepMe > conftest.dir/file
113458105723Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113558105723Smrg    rm -rf conftest.dir
113658105723Smrg    if test -s conftest.tar; then
113758105723Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
113858105723Smrg      AM_RUN_LOG([cat conftest.dir/file])
113958105723Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114058105723Smrg    fi
114158105723Smrg  done
114258105723Smrg  rm -rf conftest.dir
1143067610f1Smrg
114458105723Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114558105723Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146067610f1Smrg
114758105723SmrgAC_SUBST([am__tar])
114858105723SmrgAC_SUBST([am__untar])
114958105723Smrg]) # _AM_PROG_TAR
1150067610f1Smrg
115158105723Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
115258105723Smrgdnl serial 11 (pkg-config-0.29)
115358105723Smrgdnl
115458105723Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115558105723Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
115658105723Smrgdnl
115758105723Smrgdnl This program is free software; you can redistribute it and/or modify
115858105723Smrgdnl it under the terms of the GNU General Public License as published by
115958105723Smrgdnl the Free Software Foundation; either version 2 of the License, or
116058105723Smrgdnl (at your option) any later version.
116158105723Smrgdnl
116258105723Smrgdnl This program is distributed in the hope that it will be useful, but
116358105723Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
116458105723Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
116558105723Smrgdnl General Public License for more details.
116658105723Smrgdnl
116758105723Smrgdnl You should have received a copy of the GNU General Public License
116858105723Smrgdnl along with this program; if not, write to the Free Software
116958105723Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
117058105723Smrgdnl 02111-1307, USA.
117158105723Smrgdnl
117258105723Smrgdnl As a special exception to the GNU General Public License, if you
117358105723Smrgdnl distribute this file as part of a program that contains a
117458105723Smrgdnl configuration script generated by Autoconf, you may include it under
117558105723Smrgdnl the same distribution terms that you use for the rest of that
117658105723Smrgdnl program.
1177067610f1Smrg
117858105723Smrgdnl PKG_PREREQ(MIN-VERSION)
117958105723Smrgdnl -----------------------
118058105723Smrgdnl Since: 0.29
118158105723Smrgdnl
118258105723Smrgdnl Verify that the version of the pkg-config macros are at least
118358105723Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
118458105723Smrgdnl installed version of pkg-config, this checks the developer's version
118558105723Smrgdnl of pkg.m4 when generating configure.
118658105723Smrgdnl
118758105723Smrgdnl To ensure that this macro is defined, also add:
118858105723Smrgdnl m4_ifndef([PKG_PREREQ],
118958105723Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
119058105723Smrgdnl
119158105723Smrgdnl See the "Since" comment for each macro you use to see what version
119258105723Smrgdnl of the macros you require.
119358105723Smrgm4_defun([PKG_PREREQ],
119458105723Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
119558105723Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
119658105723Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
119758105723Smrg])dnl PKG_PREREQ
1198067610f1Smrg
119958105723Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
120058105723Smrgdnl ----------------------------------
120158105723Smrgdnl Since: 0.16
120258105723Smrgdnl
120358105723Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
120458105723Smrgdnl first found in the path. Checks that the version of pkg-config found
120558105723Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
120658105723Smrgdnl used since that's the first version where most current features of
120758105723Smrgdnl pkg-config existed.
120858105723SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120958105723Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
121058105723Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
121158105723Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
121258105723SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
121358105723SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
121458105723SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215067610f1Smrg
121658105723Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121758105723Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218067610f1Smrgfi
121958105723Smrgif test -n "$PKG_CONFIG"; then
122058105723Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
122158105723Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122258105723Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122358105723Smrg		AC_MSG_RESULT([yes])
122458105723Smrg	else
122558105723Smrg		AC_MSG_RESULT([no])
122658105723Smrg		PKG_CONFIG=""
122758105723Smrg	fi
122858105723Smrgfi[]dnl
122958105723Smrg])dnl PKG_PROG_PKG_CONFIG
1230067610f1Smrg
123158105723Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
123258105723Smrgdnl -------------------------------------------------------------------
123358105723Smrgdnl Since: 0.18
123458105723Smrgdnl
123558105723Smrgdnl Check to see whether a particular set of modules exists. Similar to
123658105723Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
123758105723Smrgdnl
123858105723Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123958105723Smrgdnl only at the first occurence in configure.ac, so if the first place
124058105723Smrgdnl it's called might be skipped (such as if it is within an "if", you
124158105723Smrgdnl have to call PKG_CHECK_EXISTS manually
124258105723SmrgAC_DEFUN([PKG_CHECK_EXISTS],
124358105723Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124458105723Smrgif test -n "$PKG_CONFIG" && \
124558105723Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
124658105723Smrg  m4_default([$2], [:])
124758105723Smrgm4_ifvaln([$3], [else
124858105723Smrg  $3])dnl
124958105723Smrgfi])
125058105723Smrg
125158105723Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
125258105723Smrgdnl ---------------------------------------------
125358105723Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
125458105723Smrgdnl pkg_failed based on the result.
125558105723Smrgm4_define([_PKG_CONFIG],
125658105723Smrg[if test -n "$$1"; then
125758105723Smrg    pkg_cv_[]$1="$$1"
125858105723Smrg elif test -n "$PKG_CONFIG"; then
125958105723Smrg    PKG_CHECK_EXISTS([$3],
126058105723Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
126158105723Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
126258105723Smrg		     [pkg_failed=yes])
126358105723Smrg else
126458105723Smrg    pkg_failed=untried
126558105723Smrgfi[]dnl
126658105723Smrg])dnl _PKG_CONFIG
126758105723Smrg
126858105723Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
126958105723Smrgdnl ---------------------------
127058105723Smrgdnl Internal check to see if pkg-config supports short errors.
127158105723SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127258105723Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127358105723Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127458105723Smrg        _pkg_short_errors_supported=yes
12754d9306dbSmrgelse
127658105723Smrg        _pkg_short_errors_supported=no
127758105723Smrgfi[]dnl
127858105723Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279067610f1Smrg
1280067610f1Smrg
128158105723Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
128258105723Smrgdnl   [ACTION-IF-NOT-FOUND])
128358105723Smrgdnl --------------------------------------------------------------
128458105723Smrgdnl Since: 0.4.0
128558105723Smrgdnl
128658105723Smrgdnl Note that if there is a possibility the first call to
128758105723Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
128858105723Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128958105723SmrgAC_DEFUN([PKG_CHECK_MODULES],
129058105723Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129158105723SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129258105723SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12937e6533d5Smrg
129458105723Smrgpkg_failed=no
129558105723SmrgAC_MSG_CHECKING([for $1])
12967e6533d5Smrg
129758105723Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129858105723Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299067610f1Smrg
130058105723Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130158105723Smrgand $1[]_LIBS to avoid the need to call pkg-config.
130258105723SmrgSee the pkg-config man page for more details.])
13034d9306dbSmrg
130458105723Smrgif test $pkg_failed = yes; then
130558105723Smrg   	AC_MSG_RESULT([no])
130658105723Smrg        _PKG_SHORT_ERRORS_SUPPORTED
130758105723Smrg        if test $_pkg_short_errors_supported = yes; then
130858105723Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130958105723Smrg        else 
131058105723Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131158105723Smrg        fi
131258105723Smrg	# Put the nasty error message in config.log where it belongs
131358105723Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13147e6533d5Smrg
131558105723Smrg	m4_default([$4], [AC_MSG_ERROR(
131658105723Smrg[Package requirements ($2) were not met:
13174d9306dbSmrg
131858105723Smrg$$1_PKG_ERRORS
131958105723Smrg
132058105723SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132158105723Smrginstalled software in a non-standard prefix.
132258105723Smrg
132358105723Smrg_PKG_TEXT])[]dnl
132458105723Smrg        ])
132558105723Smrgelif test $pkg_failed = untried; then
132658105723Smrg     	AC_MSG_RESULT([no])
132758105723Smrg	m4_default([$4], [AC_MSG_FAILURE(
132858105723Smrg[The pkg-config script could not be found or is too old.  Make sure it
132958105723Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
133058105723Smrgpath to pkg-config.
133158105723Smrg
133258105723Smrg_PKG_TEXT
133358105723Smrg
133458105723SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
133558105723Smrg        ])
13367e6533d5Smrgelse
133758105723Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133858105723Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133958105723Smrg        AC_MSG_RESULT([yes])
134058105723Smrg	$3
134158105723Smrgfi[]dnl
134258105723Smrg])dnl PKG_CHECK_MODULES
13437e6533d5Smrg
13447e6533d5Smrg
134558105723Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
134658105723Smrgdnl   [ACTION-IF-NOT-FOUND])
134758105723Smrgdnl ---------------------------------------------------------------------
134858105723Smrgdnl Since: 0.29
134958105723Smrgdnl
135058105723Smrgdnl Checks for existence of MODULES and gathers its build flags with
135158105723Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
135258105723Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
135358105723Smrgdnl
135458105723Smrgdnl Note that if there is a possibility the first call to
135558105723Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
135658105723Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
135758105723Smrgdnl configure.ac.
135858105723SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
135958105723Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
136058105723Smrg_save_PKG_CONFIG=$PKG_CONFIG
136158105723SmrgPKG_CONFIG="$PKG_CONFIG --static"
136258105723SmrgPKG_CHECK_MODULES($@)
136358105723SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
136458105723Smrg])dnl PKG_CHECK_MODULES_STATIC
1365067610f1Smrg
1366067610f1Smrg
136758105723Smrgdnl PKG_INSTALLDIR([DIRECTORY])
136858105723Smrgdnl -------------------------
136958105723Smrgdnl Since: 0.27
137058105723Smrgdnl
137158105723Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
137258105723Smrgdnl should install pkg-config .pc files. By default the directory is
137358105723Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
137458105723Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
137558105723Smrgdnl parameter.
137658105723SmrgAC_DEFUN([PKG_INSTALLDIR],
137758105723Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
137858105723Smrgm4_pushdef([pkg_description],
137958105723Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
138058105723SmrgAC_ARG_WITH([pkgconfigdir],
138158105723Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
138258105723Smrg    [with_pkgconfigdir=]pkg_default)
138358105723SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
138458105723Smrgm4_popdef([pkg_default])
138558105723Smrgm4_popdef([pkg_description])
138658105723Smrg])dnl PKG_INSTALLDIR
138758105723Smrg
138858105723Smrg
138958105723Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
139058105723Smrgdnl --------------------------------
139158105723Smrgdnl Since: 0.27
139258105723Smrgdnl
139358105723Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
139458105723Smrgdnl module should install arch-independent pkg-config .pc files. By
139558105723Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
139658105723Smrgdnl changed by passing DIRECTORY. The user can override through the
139758105723Smrgdnl --with-noarch-pkgconfigdir parameter.
139858105723SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
139958105723Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
140058105723Smrgm4_pushdef([pkg_description],
140158105723Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
140258105723SmrgAC_ARG_WITH([noarch-pkgconfigdir],
140358105723Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
140458105723Smrg    [with_noarch_pkgconfigdir=]pkg_default)
140558105723SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
140658105723Smrgm4_popdef([pkg_default])
140758105723Smrgm4_popdef([pkg_description])
140858105723Smrg])dnl PKG_NOARCH_INSTALLDIR
140958105723Smrg
1410067610f1Smrg
141158105723Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
141258105723Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
141358105723Smrgdnl -------------------------------------------
141458105723Smrgdnl Since: 0.28
141558105723Smrgdnl
141658105723Smrgdnl Retrieves the value of the pkg-config variable for the given module.
141758105723SmrgAC_DEFUN([PKG_CHECK_VAR],
141858105723Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
141958105723SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420067610f1Smrg
142158105723Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
142258105723SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423067610f1Smrg
142458105723SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
142558105723Smrg])dnl PKG_CHECK_VAR
1426067610f1Smrg
142758105723Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142858105723Smrgdnl
142958105723Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
143058105723Smrgdnl
143158105723Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143258105723Smrgdnl copy of this software and associated documentation files (the "Software"),
143358105723Smrgdnl to deal in the Software without restriction, including without limitation
143458105723Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143558105723Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
143658105723Smrgdnl Software is furnished to do so, subject to the following conditions:
143758105723Smrgdnl
143858105723Smrgdnl The above copyright notice and this permission notice (including the next
143958105723Smrgdnl paragraph) shall be included in all copies or substantial portions of the
144058105723Smrgdnl Software.
144158105723Smrgdnl
144258105723Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144358105723Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144458105723Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144558105723Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144658105723Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144758105723Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144858105723Smrgdnl DEALINGS IN THE SOFTWARE.
1449067610f1Smrg
145058105723Smrg# XORG_MACROS_VERSION(required-version)
145158105723Smrg# -------------------------------------
14524d9306dbSmrg# Minimum version: 1.1.0
14534d9306dbSmrg#
145458105723Smrg# If you're using a macro added in Version 1.1 or newer, include this in
145558105723Smrg# your configure.ac with the minimum required version, such as:
145658105723Smrg# XORG_MACROS_VERSION(1.1)
14574d9306dbSmrg#
145858105723Smrg# To ensure that this macro is defined, also add:
145958105723Smrg# m4_ifndef([XORG_MACROS_VERSION],
146058105723Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14614d9306dbSmrg#
146258105723Smrg#
146358105723Smrg# See the "minimum version" comment for each macro you use to see what
146458105723Smrg# version you require.
146558105723Smrgm4_defun([XORG_MACROS_VERSION],[
146658105723Smrgm4_define([vers_have], [1.19.3])
146758105723Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146858105723Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
146958105723Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147058105723Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147158105723Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147258105723Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147358105723Smrgm4_undefine([vers_have])
147458105723Smrgm4_undefine([maj_have])
147558105723Smrgm4_undefine([maj_needed])
147658105723Smrg]) # XORG_MACROS_VERSION
1477067610f1Smrg
147858105723Smrg# XORG_PROG_RAWCPP()
147958105723Smrg# ------------------
148058105723Smrg# Minimum version: 1.0.0
148158105723Smrg#
148258105723Smrg# Find cpp program and necessary flags for use in pre-processing text files
148358105723Smrg# such as man pages and config files
148458105723SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148558105723SmrgAC_REQUIRE([AC_PROG_CPP])
148658105723SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148758105723Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1488067610f1Smrg
148958105723Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149058105723Smrg# which is not the best choice for supporting other OS'es, but covers most
149158105723Smrg# of the ones we need for now.
149258105723SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149358105723SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149458105723Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149558105723Smrg	AC_MSG_RESULT([no])
149658105723Smrgelse
149758105723Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149858105723Smrg		RAWCPPFLAGS=-undef
149958105723Smrg		AC_MSG_RESULT([yes])
150058105723Smrg	# under Cygwin unix is still defined even with -undef
150158105723Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150258105723Smrg		RAWCPPFLAGS="-undef -ansi"
150358105723Smrg		AC_MSG_RESULT([yes, with -ansi])
150458105723Smrg	else
150558105723Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150658105723Smrg	fi
15074d9306dbSmrgfi
150858105723Smrgrm -f conftest.$ac_ext
1509067610f1Smrg
151058105723SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151158105723SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151258105723Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151358105723Smrg	AC_MSG_RESULT([no])
151458105723Smrgelse
151558105723Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151658105723Smrg		TRADITIONALCPPFLAGS="-traditional"
151758105723Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151858105723Smrg		AC_MSG_RESULT([yes])
151958105723Smrg	else
152058105723Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152158105723Smrg	fi
152258105723Smrgfi
152358105723Smrgrm -f conftest.$ac_ext
152458105723SmrgAC_SUBST(RAWCPPFLAGS)
152558105723SmrgAC_SUBST(TRADITIONALCPPFLAGS)
152658105723Smrg]) # XORG_PROG_RAWCPP
15274d9306dbSmrg
152858105723Smrg# XORG_MANPAGE_SECTIONS()
152958105723Smrg# -----------------------
153058105723Smrg# Minimum version: 1.0.0
15314d9306dbSmrg#
153258105723Smrg# Determine which sections man pages go in for the different man page types
153358105723Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153458105723Smrg# Not sure if there's any better way than just hardcoding by OS name.
153558105723Smrg# Override default settings by setting environment variables
153658105723Smrg# Added MAN_SUBSTS in version 1.8
153758105723Smrg# Added AC_PROG_SED in version 1.8
15387e6533d5Smrg
153958105723SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154058105723SmrgAC_REQUIRE([AC_CANONICAL_HOST])
154158105723SmrgAC_REQUIRE([AC_PROG_SED])
1542067610f1Smrg
154358105723Smrgcase $host_os in
154458105723Smrg    solaris*)
154558105723Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
154658105723Smrg        # check for a man page file found in later versions that use
154758105723Smrg        # traditional section numbers instead
154858105723Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
154958105723Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
155058105723Smrg        ;;
155158105723Smrg    *) SYSV_MAN_SECTIONS=false ;;
155258105723Smrgesac
1553067610f1Smrg
155458105723Smrgif test x$APP_MAN_SUFFIX = x    ; then
155558105723Smrg    APP_MAN_SUFFIX=1
155658105723Smrgfi
155758105723Smrgif test x$APP_MAN_DIR = x    ; then
155858105723Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
155958105723Smrgfi
1560067610f1Smrg
156158105723Smrgif test x$LIB_MAN_SUFFIX = x    ; then
156258105723Smrg    LIB_MAN_SUFFIX=3
156358105723Smrgfi
156458105723Smrgif test x$LIB_MAN_DIR = x    ; then
156558105723Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
156658105723Smrgfi
1567067610f1Smrg
156858105723Smrgif test x$FILE_MAN_SUFFIX = x    ; then
156958105723Smrg    case $SYSV_MAN_SECTIONS in
157058105723Smrg	true)				FILE_MAN_SUFFIX=4  ;;
157158105723Smrg	*)				FILE_MAN_SUFFIX=5  ;;
157258105723Smrg    esac
157358105723Smrgfi
157458105723Smrgif test x$FILE_MAN_DIR = x    ; then
157558105723Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576067610f1Smrgfi
1577067610f1Smrg
157858105723Smrgif test x$MISC_MAN_SUFFIX = x    ; then
157958105723Smrg    case $SYSV_MAN_SECTIONS in
158058105723Smrg	true)				MISC_MAN_SUFFIX=5  ;;
158158105723Smrg	*)				MISC_MAN_SUFFIX=7  ;;
158258105723Smrg    esac
158358105723Smrgfi
158458105723Smrgif test x$MISC_MAN_DIR = x    ; then
158558105723Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586067610f1Smrgfi
1587067610f1Smrg
158858105723Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
158958105723Smrg    case $SYSV_MAN_SECTIONS in
159058105723Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
159158105723Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159258105723Smrg    esac
159358105723Smrgfi
159458105723Smrgif test x$DRIVER_MAN_DIR = x    ; then
159558105723Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159658105723Smrgfi
1597067610f1Smrg
159858105723Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
159958105723Smrg    case $SYSV_MAN_SECTIONS in
160058105723Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
160158105723Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160258105723Smrg    esac
160358105723Smrgfi
160458105723Smrgif test x$ADMIN_MAN_DIR = x    ; then
160558105723Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160658105723Smrgfi
1607067610f1Smrg
16087e6533d5Smrg
160958105723SmrgAC_SUBST([APP_MAN_SUFFIX])
161058105723SmrgAC_SUBST([LIB_MAN_SUFFIX])
161158105723SmrgAC_SUBST([FILE_MAN_SUFFIX])
161258105723SmrgAC_SUBST([MISC_MAN_SUFFIX])
161358105723SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161458105723SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161558105723SmrgAC_SUBST([APP_MAN_DIR])
161658105723SmrgAC_SUBST([LIB_MAN_DIR])
161758105723SmrgAC_SUBST([FILE_MAN_DIR])
161858105723SmrgAC_SUBST([MISC_MAN_DIR])
161958105723SmrgAC_SUBST([DRIVER_MAN_DIR])
162058105723SmrgAC_SUBST([ADMIN_MAN_DIR])
16217e6533d5Smrg
162258105723SmrgXORG_MAN_PAGE="X Version 11"
162358105723SmrgAC_SUBST([XORG_MAN_PAGE])
162458105723SmrgMAN_SUBSTS="\
162558105723Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162658105723Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162758105723Smrg	-e 's|__xservername__|Xorg|g' \
162858105723Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
162958105723Smrg	-e 's|__projectroot__|\$(prefix)|g' \
163058105723Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163158105723Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163258105723Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163358105723Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163458105723Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163558105723Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163658105723Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163758105723SmrgAC_SUBST([MAN_SUBSTS])
16387e6533d5Smrg
163958105723Smrg]) # XORG_MANPAGE_SECTIONS
16407e6533d5Smrg
164158105723Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164258105723Smrg# ------------------------
164358105723Smrg# Minimum version: 1.7.0
1644aea1d7ffSmrg#
164558105723Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164658105723Smrg# provided by xorg-sgml-doctools, if installed.
164758105723SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164858105723SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164958105723SmrgXORG_SGML_PATH=
165058105723SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165158105723Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165258105723Smrg    [m4_ifval([$1],[:],
165358105723Smrg        [if test x"$cross_compiling" != x"yes" ; then
165458105723Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165558105723Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165658105723Smrg         fi])
165758105723Smrg    ])
165858105723Smrg
165958105723Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166058105723Smrg# the path and the name of the doc stylesheet
166158105723Smrgif test "x$XORG_SGML_PATH" != "x" ; then
166258105723Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166358105723Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166458105723Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166558105723Smrgelse
166658105723Smrg   AC_MSG_RESULT([no])
166758105723Smrgfi
166858105723Smrg
166958105723SmrgAC_SUBST(XORG_SGML_PATH)
167058105723SmrgAC_SUBST(STYLESHEET_SRCDIR)
167158105723SmrgAC_SUBST(XSL_STYLESHEET)
167258105723SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167358105723Smrg]) # XORG_CHECK_SGML_DOCTOOLS
167458105723Smrg
167558105723Smrg# XORG_CHECK_LINUXDOC
167658105723Smrg# -------------------
167758105723Smrg# Minimum version: 1.0.0
1678aea1d7ffSmrg#
167958105723Smrg# Defines the variable MAKE_TEXT if the necessary tools and
168058105723Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168158105723Smrg# Whether or not the necessary tools and files are found can be checked
168258105723Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168358105723SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168458105723SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168558105723SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686aea1d7ffSmrg
168758105723SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16884d9306dbSmrg
168958105723SmrgAC_MSG_CHECKING([whether to build documentation])
169058105723Smrg
169158105723Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169258105723Smrg   BUILDDOC=yes
1693aea1d7ffSmrgelse
169458105723Smrg   BUILDDOC=no
1695aea1d7ffSmrgfi
1696aea1d7ffSmrg
169758105723SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698aea1d7ffSmrg
169958105723SmrgAC_MSG_RESULT([$BUILDDOC])
17004d9306dbSmrg
170158105723SmrgAC_MSG_CHECKING([whether to build pdf documentation])
170258105723Smrg
170358105723Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170458105723Smrg   BUILDPDFDOC=yes
170558105723Smrgelse
170658105723Smrg   BUILDPDFDOC=no
170758105723Smrgfi
170858105723Smrg
170958105723SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171058105723Smrg
171158105723SmrgAC_MSG_RESULT([$BUILDPDFDOC])
171258105723Smrg
171358105723SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171458105723SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171558105723SmrgMAKE_PDF="$PS2PDF"
171658105723SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171758105723Smrg
171858105723SmrgAC_SUBST(MAKE_TEXT)
171958105723SmrgAC_SUBST(MAKE_PS)
172058105723SmrgAC_SUBST(MAKE_PDF)
172158105723SmrgAC_SUBST(MAKE_HTML)
172258105723Smrg]) # XORG_CHECK_LINUXDOC
172358105723Smrg
172458105723Smrg# XORG_CHECK_DOCBOOK
172558105723Smrg# -------------------
172658105723Smrg# Minimum version: 1.0.0
172758105723Smrg#
172858105723Smrg# Checks for the ability to build output formats from SGML DocBook source.
172958105723Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173058105723Smrg# indicates whether the necessary tools and files are found and, if set,
173158105723Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173258105723SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173358105723SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
173458105723Smrg
173558105723SmrgBUILDTXTDOC=no
173658105723SmrgBUILDPDFDOC=no
173758105723SmrgBUILDPSDOC=no
173858105723SmrgBUILDHTMLDOC=no
173958105723Smrg
174058105723SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174158105723SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174258105723SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174358105723SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17444d9306dbSmrg
174558105723SmrgAC_MSG_CHECKING([whether to build text documentation])
174658105723Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174758105723Smrg   test x$BUILD_TXTDOC != xno; then
174858105723Smrg	BUILDTXTDOC=yes
174958105723Smrgfi
175058105723SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175158105723SmrgAC_MSG_RESULT([$BUILDTXTDOC])
17524d9306dbSmrg
175358105723SmrgAC_MSG_CHECKING([whether to build PDF documentation])
175458105723Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175558105723Smrg   test x$BUILD_PDFDOC != xno; then
175658105723Smrg	BUILDPDFDOC=yes
175758105723Smrgfi
175858105723SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175958105723SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17604d9306dbSmrg
176158105723SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176258105723Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176358105723Smrg   test x$BUILD_PSDOC != xno; then
176458105723Smrg	BUILDPSDOC=yes
17654d9306dbSmrgfi
176658105723SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176758105723SmrgAC_MSG_RESULT([$BUILDPSDOC])
17684d9306dbSmrg
176958105723SmrgAC_MSG_CHECKING([whether to build HTML documentation])
177058105723Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177158105723Smrg   test x$BUILD_HTMLDOC != xno; then
177258105723Smrg	BUILDHTMLDOC=yes
177358105723Smrgfi
177458105723SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177558105723SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17764d9306dbSmrg
177758105723SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177858105723SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177958105723SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178058105723SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178158105723Smrg
178258105723SmrgAC_SUBST(MAKE_TEXT)
178358105723SmrgAC_SUBST(MAKE_PS)
178458105723SmrgAC_SUBST(MAKE_PDF)
178558105723SmrgAC_SUBST(MAKE_HTML)
178658105723Smrg]) # XORG_CHECK_DOCBOOK
178758105723Smrg
178858105723Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178958105723Smrg# ----------------
179058105723Smrg# Minimum version: 1.5.0
179158105723Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1792aea1d7ffSmrg#
179358105723Smrg# Documentation tools are not always available on all platforms and sometimes
179458105723Smrg# not at the appropriate level. This macro enables a module to test for the
179558105723Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
179658105723Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
179758105723Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179858105723Smrg# --with-xmlto assumes 'auto'.
1799aea1d7ffSmrg#
180058105723Smrg# Interface to module:
180158105723Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180258105723Smrg# XMLTO:	returns the path of the xmlto program found
180358105723Smrg#		returns the path set by the user in the environment
180458105723Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180558105723Smrg#		'no' user instructs the module not to use xmlto
1806aea1d7ffSmrg#
180758105723Smrg# Added in version 1.10.0
180858105723Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180958105723Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810aea1d7ffSmrg#
181158105723Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812aea1d7ffSmrg#
181358105723SmrgAC_DEFUN([XORG_WITH_XMLTO],[
181458105723SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181558105723Smrgm4_define([_defopt], m4_default([$2], [auto]))
181658105723SmrgAC_ARG_WITH(xmlto,
181758105723Smrg	AS_HELP_STRING([--with-xmlto],
181858105723Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181958105723Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182058105723Smrgm4_undefine([_defopt])
1821aea1d7ffSmrg
182258105723Smrgif test "x$use_xmlto" = x"auto"; then
182358105723Smrg   AC_PATH_PROG([XMLTO], [xmlto])
182458105723Smrg   if test "x$XMLTO" = "x"; then
182558105723Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182658105723Smrg	have_xmlto=no
182758105723Smrg   else
182858105723Smrg        have_xmlto=yes
182958105723Smrg   fi
183058105723Smrgelif test "x$use_xmlto" = x"yes" ; then
183158105723Smrg   AC_PATH_PROG([XMLTO], [xmlto])
183258105723Smrg   if test "x$XMLTO" = "x"; then
183358105723Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183458105723Smrg   fi
183558105723Smrg   have_xmlto=yes
183658105723Smrgelif test "x$use_xmlto" = x"no" ; then
183758105723Smrg   if test "x$XMLTO" != "x"; then
183858105723Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183958105723Smrg   fi
184058105723Smrg   have_xmlto=no
184158105723Smrgelse
184258105723Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184358105723Smrgfi
1844aea1d7ffSmrg
184558105723Smrg# Test for a minimum version of xmlto, if provided.
184658105723Smrgm4_ifval([$1],
184758105723Smrg[if test "$have_xmlto" = yes; then
184858105723Smrg    # scrape the xmlto version
184958105723Smrg    AC_MSG_CHECKING([the xmlto version])
185058105723Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185158105723Smrg    AC_MSG_RESULT([$xmlto_version])
185258105723Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185358105723Smrg        [if test "x$use_xmlto" = xauto; then
185458105723Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185558105723Smrg            have_xmlto=no
185658105723Smrg        else
185758105723Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185858105723Smrg        fi])
185958105723Smrgfi])
1860aea1d7ffSmrg
186158105723Smrg# Test for the ability of xmlto to generate a text target
186258105723Smrg#
186358105723Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
186458105723Smrg# following test for empty XML docbook files.
186558105723Smrg# For compatibility reasons use the following empty XML docbook file and if
186658105723Smrg# it fails try it again with a non-empty XML file.
186758105723Smrghave_xmlto_text=no
186858105723Smrgcat > conftest.xml << "EOF"
186958105723SmrgEOF
187058105723SmrgAS_IF([test "$have_xmlto" = yes],
187158105723Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187258105723Smrg             [have_xmlto_text=yes],
187358105723Smrg             [# Try it again with a non-empty XML file.
187458105723Smrg              cat > conftest.xml << "EOF"
187558105723Smrg<x></x>
187658105723SmrgEOF
187758105723Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187858105723Smrg                    [have_xmlto_text=yes],
187958105723Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188058105723Smrgrm -f conftest.xml
188158105723SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188258105723SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188358105723Smrg]) # XORG_WITH_XMLTO
18844d9306dbSmrg
188558105723Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188658105723Smrg# --------------------------------------------
188758105723Smrg# Minimum version: 1.12.0
188858105723Smrg# Minimum version for optional DEFAULT argument: 1.12.0
188958105723Smrg#
189058105723Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189158105723Smrg# XML-based language used for the transformation of XML documents.
189258105723Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189358105723Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189458105723Smrg# The XSLT processor is often used as a standalone tool for transformations.
189558105723Smrg# It should not be assumed that this tool is used only to work with documnetation.
189658105723Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189758105723Smrg#
189858105723Smrg# Interface to module:
189958105723Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190058105723Smrg# XSLTPROC:	 returns the path of the xsltproc program found
190158105723Smrg#		 returns the path set by the user in the environment
190258105723Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190358105723Smrg#		  'no' user instructs the module not to use xsltproc
190458105723Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190558105723Smrg#
190658105723Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190758105723Smrg#
190858105723SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190958105723SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191058105723Smrg# Preserves the interface, should it be implemented later
191158105723Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191258105723Smrgm4_define([_defopt], m4_default([$2], [auto]))
191358105723SmrgAC_ARG_WITH(xsltproc,
191458105723Smrg	AS_HELP_STRING([--with-xsltproc],
191558105723Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191658105723Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191758105723Smrgm4_undefine([_defopt])
19184d9306dbSmrg
191958105723Smrgif test "x$use_xsltproc" = x"auto"; then
192058105723Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192158105723Smrg   if test "x$XSLTPROC" = "x"; then
192258105723Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192358105723Smrg	have_xsltproc=no
192458105723Smrg   else
192558105723Smrg        have_xsltproc=yes
192658105723Smrg   fi
192758105723Smrgelif test "x$use_xsltproc" = x"yes" ; then
192858105723Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192958105723Smrg   if test "x$XSLTPROC" = "x"; then
193058105723Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193158105723Smrg   fi
193258105723Smrg   have_xsltproc=yes
193358105723Smrgelif test "x$use_xsltproc" = x"no" ; then
193458105723Smrg   if test "x$XSLTPROC" != "x"; then
193558105723Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193658105723Smrg   fi
193758105723Smrg   have_xsltproc=no
193858105723Smrgelse
193958105723Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19404d9306dbSmrgfi
19414d9306dbSmrg
194258105723SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194358105723Smrg]) # XORG_WITH_XSLTPROC
194458105723Smrg
194558105723Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194658105723Smrg# ----------------------------------------
194758105723Smrg# Minimum version: 1.15.0
19487e6533d5Smrg#
194958105723Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
195058105723Smrg# scanning arbitrary text files, extracting information from those text files,
195158105723Smrg# and printing reports based on that information.
19527e6533d5Smrg#
195358105723Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
19547e6533d5Smrg#
195558105723Smrg# Interface to module:
195658105723Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
195758105723Smrg# PERL:	     returns the path of the perl program found
195858105723Smrg#	     returns the path set by the user in the environment
195958105723Smrg# --with-perl: 'yes' user instructs the module to use perl
196058105723Smrg#	       'no' user instructs the module not to use perl
196158105723Smrg# have_perl: returns yes if perl found in PATH or no
19627e6533d5Smrg#
196358105723Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196458105723Smrg#
196558105723SmrgAC_DEFUN([XORG_WITH_PERL],[
196658105723SmrgAC_ARG_VAR([PERL], [Path to perl command])
196758105723Smrg# Preserves the interface, should it be implemented later
196858105723Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196958105723Smrgm4_define([_defopt], m4_default([$2], [auto]))
197058105723SmrgAC_ARG_WITH(perl,
197158105723Smrg	AS_HELP_STRING([--with-perl],
197258105723Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197358105723Smrg	   [use_perl=$withval], [use_perl=]_defopt)
197458105723Smrgm4_undefine([_defopt])
19757e6533d5Smrg
197658105723Smrgif test "x$use_perl" = x"auto"; then
197758105723Smrg   AC_PATH_PROG([PERL], [perl])
197858105723Smrg   if test "x$PERL" = "x"; then
197958105723Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198058105723Smrg	have_perl=no
198158105723Smrg   else
198258105723Smrg        have_perl=yes
198358105723Smrg   fi
198458105723Smrgelif test "x$use_perl" = x"yes" ; then
198558105723Smrg   AC_PATH_PROG([PERL], [perl])
198658105723Smrg   if test "x$PERL" = "x"; then
198758105723Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198858105723Smrg   fi
198958105723Smrg   have_perl=yes
199058105723Smrgelif test "x$use_perl" = x"no" ; then
199158105723Smrg   if test "x$PERL" != "x"; then
199258105723Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199358105723Smrg   fi
199458105723Smrg   have_perl=no
199558105723Smrgelse
199658105723Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199758105723Smrgfi
19987e6533d5Smrg
199958105723SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200058105723Smrg]) # XORG_WITH_PERL
20014d9306dbSmrg
200258105723Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
20034d9306dbSmrg# ----------------
200458105723Smrg# Minimum version: 1.5.0
200558105723Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20067e6533d5Smrg#
200758105723Smrg# Documentation tools are not always available on all platforms and sometimes
200858105723Smrg# not at the appropriate level. This macro enables a module to test for the
200958105723Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
201058105723Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
201158105723Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201258105723Smrg# --with-asciidoc assumes 'auto'.
20137e6533d5Smrg#
201458105723Smrg# Interface to module:
201558105723Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201658105723Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
201758105723Smrg#		 returns the path set by the user in the environment
201858105723Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201958105723Smrg#		  'no' user instructs the module not to use asciidoc
20207e6533d5Smrg#
202158105723Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20227e6533d5Smrg#
202358105723SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202458105723SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202558105723Smrgm4_define([_defopt], m4_default([$2], [auto]))
202658105723SmrgAC_ARG_WITH(asciidoc,
202758105723Smrg	AS_HELP_STRING([--with-asciidoc],
202858105723Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202958105723Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203058105723Smrgm4_undefine([_defopt])
20314d9306dbSmrg
203258105723Smrgif test "x$use_asciidoc" = x"auto"; then
203358105723Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203458105723Smrg   if test "x$ASCIIDOC" = "x"; then
203558105723Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203658105723Smrg	have_asciidoc=no
203758105723Smrg   else
203858105723Smrg        have_asciidoc=yes
203958105723Smrg   fi
204058105723Smrgelif test "x$use_asciidoc" = x"yes" ; then
204158105723Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204258105723Smrg   if test "x$ASCIIDOC" = "x"; then
204358105723Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204458105723Smrg   fi
204558105723Smrg   have_asciidoc=yes
204658105723Smrgelif test "x$use_asciidoc" = x"no" ; then
204758105723Smrg   if test "x$ASCIIDOC" != "x"; then
204858105723Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204958105723Smrg   fi
205058105723Smrg   have_asciidoc=no
205158105723Smrgelse
205258105723Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205358105723Smrgfi
205458105723Smrgm4_ifval([$1],
205558105723Smrg[if test "$have_asciidoc" = yes; then
205658105723Smrg    # scrape the asciidoc version
205758105723Smrg    AC_MSG_CHECKING([the asciidoc version])
205858105723Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205958105723Smrg    AC_MSG_RESULT([$asciidoc_version])
206058105723Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206158105723Smrg        [if test "x$use_asciidoc" = xauto; then
206258105723Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206358105723Smrg            have_asciidoc=no
206458105723Smrg        else
206558105723Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206658105723Smrg        fi])
206758105723Smrgfi])
206858105723SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206958105723Smrg]) # XORG_WITH_ASCIIDOC
20704d9306dbSmrg
207158105723Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207258105723Smrg# -------------------------------------------
207358105723Smrg# Minimum version: 1.5.0
207458105723Smrg# Minimum version for optional DEFAULT argument: 1.11.0
207558105723Smrg# Minimum version for optional DOT checking: 1.18.0
20767e6533d5Smrg#
207758105723Smrg# Documentation tools are not always available on all platforms and sometimes
207858105723Smrg# not at the appropriate level. This macro enables a module to test for the
207958105723Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
208058105723Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
208158105723Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208258105723Smrg# --with-doxygen assumes 'auto'.
20837e6533d5Smrg#
208458105723Smrg# Interface to module:
208558105723Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208658105723Smrg# DOXYGEN:	 returns the path of the doxygen program found
208758105723Smrg#		 returns the path set by the user in the environment
208858105723Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208958105723Smrg#		  'no' user instructs the module not to use doxygen
20907e6533d5Smrg#
209158105723Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20927e6533d5Smrg#
209358105723SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209458105723SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209558105723SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209658105723Smrgm4_define([_defopt], m4_default([$2], [auto]))
209758105723SmrgAC_ARG_WITH(doxygen,
209858105723Smrg	AS_HELP_STRING([--with-doxygen],
209958105723Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210058105723Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210158105723Smrgm4_undefine([_defopt])
21027e6533d5Smrg
210358105723Smrgif test "x$use_doxygen" = x"auto"; then
210458105723Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210558105723Smrg   if test "x$DOXYGEN" = "x"; then
210658105723Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210758105723Smrg	have_doxygen=no
210858105723Smrg   else
210958105723Smrg        have_doxygen=yes
211058105723Smrg   fi
211158105723Smrgelif test "x$use_doxygen" = x"yes" ; then
211258105723Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211358105723Smrg   if test "x$DOXYGEN" = "x"; then
211458105723Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211558105723Smrg   fi
211658105723Smrg   have_doxygen=yes
211758105723Smrgelif test "x$use_doxygen" = x"no" ; then
211858105723Smrg   if test "x$DOXYGEN" != "x"; then
211958105723Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212058105723Smrg   fi
212158105723Smrg   have_doxygen=no
21227e6533d5Smrgelse
212358105723Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
21247e6533d5Smrgfi
212558105723Smrgm4_ifval([$1],
212658105723Smrg[if test "$have_doxygen" = yes; then
212758105723Smrg    # scrape the doxygen version
212858105723Smrg    AC_MSG_CHECKING([the doxygen version])
212958105723Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213058105723Smrg    AC_MSG_RESULT([$doxygen_version])
213158105723Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213258105723Smrg        [if test "x$use_doxygen" = xauto; then
213358105723Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213458105723Smrg            have_doxygen=no
213558105723Smrg        else
213658105723Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213758105723Smrg        fi])
213858105723Smrgfi])
21394d9306dbSmrg
214058105723Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214158105723Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214258105723Smrgdnl 	HAVE_DOT = @HAVE_DOT@
214358105723SmrgHAVE_DOT=no
214458105723Smrgif test "x$have_doxygen" = "xyes"; then
214558105723Smrg  AC_PATH_PROG([DOT], [dot])
214658105723Smrg    if test "x$DOT" != "x"; then
214758105723Smrg      HAVE_DOT=yes
214858105723Smrg    fi
214958105723Smrgfi
21504d9306dbSmrg
215158105723SmrgAC_SUBST([HAVE_DOT])
215258105723SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215358105723SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215458105723Smrg]) # XORG_WITH_DOXYGEN
21554d9306dbSmrg
215658105723Smrg# XORG_WITH_GROFF([DEFAULT])
215758105723Smrg# ----------------
215858105723Smrg# Minimum version: 1.6.0
215958105723Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21604d9306dbSmrg#
216158105723Smrg# Documentation tools are not always available on all platforms and sometimes
216258105723Smrg# not at the appropriate level. This macro enables a module to test for the
216358105723Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
216458105723Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
216558105723Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
216658105723Smrg# --with-groff assumes 'auto'.
216758105723Smrg#
216858105723Smrg# Interface to module:
216958105723Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217058105723Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217158105723Smrg# HAVE_GROFF_MS: the -ms macros package
217258105723Smrg# GROFF:	 returns the path of the groff program found
217358105723Smrg#		 returns the path set by the user in the environment
217458105723Smrg# --with-groff:	 'yes' user instructs the module to use groff
217558105723Smrg#		 'no' user instructs the module not to use groff
217658105723Smrg#
217758105723Smrg# Added in version 1.9.0:
217858105723Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217958105723Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218058105723Smrg#		   psselect from the psutils package.
218158105723Smrg#		   the ghostcript package. Refer to the grohtml man pages
218258105723Smrg#
218358105723Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218458105723Smrg#
218558105723Smrg# OS and distros often splits groff in a basic and full package, the former
218658105723Smrg# having the groff program and the later having devices, fonts and macros
218758105723Smrg# Checking for the groff executable is not enough.
218858105723Smrg#
218958105723Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
219058105723Smrg# unset HAVE_GROFF or GROFF env variables.
219158105723Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219258105723Smrg#
219358105723SmrgAC_DEFUN([XORG_WITH_GROFF],[
219458105723SmrgAC_ARG_VAR([GROFF], [Path to groff command])
219558105723Smrgm4_define([_defopt], m4_default([$1], [auto]))
219658105723SmrgAC_ARG_WITH(groff,
219758105723Smrg	AS_HELP_STRING([--with-groff],
219858105723Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219958105723Smrg	   [use_groff=$withval], [use_groff=]_defopt)
220058105723Smrgm4_undefine([_defopt])
22014d9306dbSmrg
220258105723Smrgif test "x$use_groff" = x"auto"; then
220358105723Smrg   AC_PATH_PROG([GROFF], [groff])
220458105723Smrg   if test "x$GROFF" = "x"; then
220558105723Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220658105723Smrg	have_groff=no
220758105723Smrg   else
220858105723Smrg        have_groff=yes
220958105723Smrg   fi
221058105723Smrgelif test "x$use_groff" = x"yes" ; then
221158105723Smrg   AC_PATH_PROG([GROFF], [groff])
221258105723Smrg   if test "x$GROFF" = "x"; then
221358105723Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221458105723Smrg   fi
221558105723Smrg   have_groff=yes
221658105723Smrgelif test "x$use_groff" = x"no" ; then
221758105723Smrg   if test "x$GROFF" != "x"; then
221858105723Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221958105723Smrg   fi
222058105723Smrg   have_groff=no
222158105723Smrgelse
222258105723Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222358105723Smrgfi
22244d9306dbSmrg
222558105723Smrg# We have groff, test for the presence of the macro packages
222658105723Smrgif test "x$have_groff" = x"yes"; then
222758105723Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222858105723Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222958105723Smrg        groff_ms_works=yes
223058105723Smrg    else
223158105723Smrg        groff_ms_works=no
22327e6533d5Smrg    fi
223358105723Smrg    AC_MSG_RESULT([$groff_ms_works])
223458105723Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223558105723Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223658105723Smrg        groff_mm_works=yes
223758105723Smrg    else
223858105723Smrg        groff_mm_works=no
223958105723Smrg    fi
224058105723Smrg    AC_MSG_RESULT([$groff_mm_works])
224158105723Smrgfi
22427e6533d5Smrg
224358105723Smrg# We have groff, test for HTML dependencies, one command per package
224458105723Smrgif test "x$have_groff" = x"yes"; then
224558105723Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224658105723Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224758105723Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224858105723Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224958105723Smrg      have_groff_html=yes
225058105723Smrg   else
225158105723Smrg      have_groff_html=no
225258105723Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225358105723Smrg   fi
225458105723Smrgfi
225558105723Smrg
225658105723Smrg# Set Automake conditionals for Makefiles
225758105723SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225858105723SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225958105723SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226058105723SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226158105723Smrg]) # XORG_WITH_GROFF
226258105723Smrg
226358105723Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226458105723Smrg# ---------------------------------------
226558105723Smrg# Minimum version: 1.6.0
226658105723Smrg# Minimum version for optional DEFAULT argument: 1.11.0
226758105723Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226858105723Smrg#
226958105723Smrg# Documentation tools are not always available on all platforms and sometimes
227058105723Smrg# not at the appropriate level. This macro enables a module to test for the
227158105723Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
227258105723Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
227358105723Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
227458105723Smrg# --with-fop assumes 'auto'.
227558105723Smrg#
227658105723Smrg# Interface to module:
227758105723Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227858105723Smrg# FOP:	 	returns the path of the fop program found
227958105723Smrg#		returns the path set by the user in the environment
228058105723Smrg# --with-fop: 	'yes' user instructs the module to use fop
228158105723Smrg#		'no' user instructs the module not to use fop
228258105723Smrg#
228358105723Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228458105723Smrg#
228558105723SmrgAC_DEFUN([XORG_WITH_FOP],[
228658105723SmrgAC_ARG_VAR([FOP], [Path to fop command])
228758105723Smrgm4_define([_defopt], m4_default([$2], [auto]))
228858105723SmrgAC_ARG_WITH(fop,
228958105723Smrg	AS_HELP_STRING([--with-fop],
229058105723Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229158105723Smrg	   [use_fop=$withval], [use_fop=]_defopt)
229258105723Smrgm4_undefine([_defopt])
229358105723Smrg
229458105723Smrgif test "x$use_fop" = x"auto"; then
229558105723Smrg   AC_PATH_PROG([FOP], [fop])
229658105723Smrg   if test "x$FOP" = "x"; then
229758105723Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229858105723Smrg	have_fop=no
229958105723Smrg   else
230058105723Smrg        have_fop=yes
230158105723Smrg   fi
230258105723Smrgelif test "x$use_fop" = x"yes" ; then
230358105723Smrg   AC_PATH_PROG([FOP], [fop])
230458105723Smrg   if test "x$FOP" = "x"; then
230558105723Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230658105723Smrg   fi
230758105723Smrg   have_fop=yes
230858105723Smrgelif test "x$use_fop" = x"no" ; then
230958105723Smrg   if test "x$FOP" != "x"; then
231058105723Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231158105723Smrg   fi
231258105723Smrg   have_fop=no
23137e6533d5Smrgelse
231458105723Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
23157e6533d5Smrgfi
2316aea1d7ffSmrg
231758105723Smrg# Test for a minimum version of fop, if provided.
231858105723Smrgm4_ifval([$1],
231958105723Smrg[if test "$have_fop" = yes; then
232058105723Smrg    # scrape the fop version
232158105723Smrg    AC_MSG_CHECKING([for fop minimum version])
232258105723Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232358105723Smrg    AC_MSG_RESULT([$fop_version])
232458105723Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
232558105723Smrg        [if test "x$use_fop" = xauto; then
232658105723Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232758105723Smrg            have_fop=no
232858105723Smrg        else
232958105723Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233058105723Smrg        fi])
233158105723Smrgfi])
233258105723SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233358105723Smrg]) # XORG_WITH_FOP
233458105723Smrg
233558105723Smrg# XORG_WITH_M4([MIN-VERSION])
233658105723Smrg# ---------------------------
233758105723Smrg# Minimum version: 1.19.0
233858105723Smrg#
233958105723Smrg# This macro attempts to locate an m4 macro processor which supports
234058105723Smrg# -I option and is only useful for modules relying on M4 in order to
234158105723Smrg# expand macros in source code files.
234258105723Smrg#
234358105723Smrg# Interface to module:
234458105723Smrg# M4:	 	returns the path of the m4 program found
234558105723Smrg#		returns the path set by the user in the environment
234658105723Smrg#
234758105723SmrgAC_DEFUN([XORG_WITH_M4], [
234858105723SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234958105723Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235058105723Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235158105723Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235258105723Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235358105723Smrg   [$PATH:/usr/gnu/bin])])
2354e7fdea5fSmrg
235558105723SmrgAC_SUBST([M4], [$ac_cv_path_M4])
235658105723Smrg]) # XORG_WITH_M4
2357e7fdea5fSmrg
235858105723Smrg# XORG_WITH_PS2PDF([DEFAULT])
235958105723Smrg# ----------------
236058105723Smrg# Minimum version: 1.6.0
236158105723Smrg# Minimum version for optional DEFAULT argument: 1.11.0
236258105723Smrg#
236358105723Smrg# Documentation tools are not always available on all platforms and sometimes
236458105723Smrg# not at the appropriate level. This macro enables a module to test for the
236558105723Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
236658105723Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
236758105723Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236858105723Smrg# --with-ps2pdf assumes 'auto'.
236958105723Smrg#
237058105723Smrg# Interface to module:
237158105723Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237258105723Smrg# PS2PDF:	returns the path of the ps2pdf program found
237358105723Smrg#		returns the path set by the user in the environment
237458105723Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237558105723Smrg#		 'no' user instructs the module not to use ps2pdf
237658105723Smrg#
237758105723Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237858105723Smrg#
237958105723SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238058105723SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238158105723Smrgm4_define([_defopt], m4_default([$1], [auto]))
238258105723SmrgAC_ARG_WITH(ps2pdf,
238358105723Smrg	AS_HELP_STRING([--with-ps2pdf],
238458105723Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238558105723Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238658105723Smrgm4_undefine([_defopt])
23877e6533d5Smrg
238858105723Smrgif test "x$use_ps2pdf" = x"auto"; then
238958105723Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239058105723Smrg   if test "x$PS2PDF" = "x"; then
239158105723Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239258105723Smrg	have_ps2pdf=no
239358105723Smrg   else
239458105723Smrg        have_ps2pdf=yes
239558105723Smrg   fi
239658105723Smrgelif test "x$use_ps2pdf" = x"yes" ; then
239758105723Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239858105723Smrg   if test "x$PS2PDF" = "x"; then
239958105723Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240058105723Smrg   fi
240158105723Smrg   have_ps2pdf=yes
240258105723Smrgelif test "x$use_ps2pdf" = x"no" ; then
240358105723Smrg   if test "x$PS2PDF" != "x"; then
240458105723Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240558105723Smrg   fi
240658105723Smrg   have_ps2pdf=no
240758105723Smrgelse
240858105723Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
24097e6533d5Smrgfi
241058105723SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241158105723Smrg]) # XORG_WITH_PS2PDF
24127e6533d5Smrg
241358105723Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
241458105723Smrg# ----------------
241558105723Smrg# Minimum version: 1.6.0
24167e6533d5Smrg#
241758105723Smrg# Documentation tools are not always available on all platforms and sometimes
241858105723Smrg# not at the appropriate level. This macro enables a builder to skip all
241958105723Smrg# documentation targets except traditional man pages.
242058105723Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242158105723Smrg# maximum flexibilty in controlling documentation building.
242258105723Smrg# Refer to:
242358105723Smrg# XORG_WITH_XMLTO         --with-xmlto
242458105723Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242558105723Smrg# XORG_WITH_DOXYGEN       --with-doxygen
242658105723Smrg# XORG_WITH_FOP           --with-fop
242758105723Smrg# XORG_WITH_GROFF         --with-groff
242858105723Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
242958105723Smrg#
243058105723Smrg# Interface to module:
243158105723Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243258105723Smrg# --enable-docs: 'yes' user instructs the module to generate docs
243358105723Smrg#		 'no' user instructs the module not to generate docs
243458105723Smrg# parm1:	specify the default value, yes or no.
243558105723Smrg#
243658105723SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243758105723Smrgm4_define([docs_default], m4_default([$1], [yes]))
243858105723SmrgAC_ARG_ENABLE(docs,
243958105723Smrg	AS_HELP_STRING([--enable-docs],
244058105723Smrg	   [Enable building the documentation (default: ]docs_default[)]),
244158105723Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
244258105723Smrgm4_undefine([docs_default])
244358105723SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244458105723SmrgAC_MSG_CHECKING([whether to build documentation])
244558105723SmrgAC_MSG_RESULT([$build_docs])
244658105723Smrg]) # XORG_ENABLE_DOCS
2447aea1d7ffSmrg
244858105723Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244958105723Smrg# ----------------
245058105723Smrg# Minimum version: 1.6.0
245158105723Smrg#
245258105723Smrg# This macro enables a builder to skip all developer documentation.
245358105723Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245458105723Smrg# maximum flexibilty in controlling documentation building.
245558105723Smrg# Refer to:
245658105723Smrg# XORG_WITH_XMLTO         --with-xmlto
245758105723Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245858105723Smrg# XORG_WITH_DOXYGEN       --with-doxygen
245958105723Smrg# XORG_WITH_FOP           --with-fop
246058105723Smrg# XORG_WITH_GROFF         --with-groff
246158105723Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
246258105723Smrg#
246358105723Smrg# Interface to module:
246458105723Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246558105723Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246658105723Smrg#			'no' user instructs the module not to generate developer docs
246758105723Smrg# parm1:		specify the default value, yes or no.
246858105723Smrg#
246958105723SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247058105723Smrgm4_define([devel_default], m4_default([$1], [yes]))
247158105723SmrgAC_ARG_ENABLE(devel-docs,
247258105723Smrg	AS_HELP_STRING([--enable-devel-docs],
247358105723Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247458105723Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247558105723Smrgm4_undefine([devel_default])
247658105723SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247758105723SmrgAC_MSG_CHECKING([whether to build developer documentation])
247858105723SmrgAC_MSG_RESULT([$build_devel_docs])
247958105723Smrg]) # XORG_ENABLE_DEVEL_DOCS
2480aea1d7ffSmrg
248158105723Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
248258105723Smrg# ----------------
248358105723Smrg# Minimum version: 1.6.0
248458105723Smrg#
248558105723Smrg# This macro enables a builder to skip all functional specification targets.
248658105723Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248758105723Smrg# maximum flexibilty in controlling documentation building.
248858105723Smrg# Refer to:
248958105723Smrg# XORG_WITH_XMLTO         --with-xmlto
249058105723Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249158105723Smrg# XORG_WITH_DOXYGEN       --with-doxygen
249258105723Smrg# XORG_WITH_FOP           --with-fop
249358105723Smrg# XORG_WITH_GROFF         --with-groff
249458105723Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
249558105723Smrg#
249658105723Smrg# Interface to module:
249758105723Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249858105723Smrg# --enable-specs:	'yes' user instructs the module to generate specs
249958105723Smrg#			'no' user instructs the module not to generate specs
250058105723Smrg# parm1:		specify the default value, yes or no.
250158105723Smrg#
250258105723SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250358105723Smrgm4_define([spec_default], m4_default([$1], [yes]))
250458105723SmrgAC_ARG_ENABLE(specs,
250558105723Smrg	AS_HELP_STRING([--enable-specs],
250658105723Smrg	   [Enable building the specs (default: ]spec_default[)]),
250758105723Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
250858105723Smrgm4_undefine([spec_default])
250958105723SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251058105723SmrgAC_MSG_CHECKING([whether to build functional specifications])
251158105723SmrgAC_MSG_RESULT([$build_specs])
251258105723Smrg]) # XORG_ENABLE_SPECS
25134d9306dbSmrg
251458105723Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251558105723Smrg# ----------------------------------------------
251658105723Smrg# Minimum version: 1.13.0
2517aea1d7ffSmrg#
251858105723Smrg# This macro enables a builder to enable/disable unit testing
251958105723Smrg# It makes no assumption about the test cases implementation
252058105723Smrg# Test cases may or may not use Automake "Support for test suites"
252158105723Smrg# They may or may not use the software utility library GLib
252258105723Smrg#
252358105723Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252458105723Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252558105723Smrg# The variable enable_unit_tests is used by other macros in this file.
252658105723Smrg#
252758105723Smrg# Interface to module:
252858105723Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252958105723Smrg# enable_unit_tests:    used in configure.ac for additional configuration
253058105723Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253158105723Smrg#			'no' user instructs the module not to build tests
253258105723Smrg# parm1:		specify the default value, yes or no.
253358105723Smrg#
253458105723SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253558105723SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253658105723SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253758105723SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253858105723Smrgm4_define([_defopt], m4_default([$1], [auto]))
253958105723SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254058105723Smrg	[Enable building unit test cases (default: ]_defopt[)]),
254158105723Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254258105723Smrgm4_undefine([_defopt])
254358105723SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254458105723SmrgAC_MSG_CHECKING([whether to build unit test cases])
254558105723SmrgAC_MSG_RESULT([$enable_unit_tests])
254658105723Smrg]) # XORG_ENABLE_UNIT_TESTS
2547aea1d7ffSmrg
254858105723Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254958105723Smrg# ------------------------------------------------------
255058105723Smrg# Minimum version: 1.17.0
255158105723Smrg#
255258105723Smrg# This macro enables a builder to enable/disable integration testing
255358105723Smrg# It makes no assumption about the test cases' implementation
255458105723Smrg# Test cases may or may not use Automake "Support for test suites"
255558105723Smrg#
255658105723Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255758105723Smrg# usually requires less dependencies and may be built and run under less
255858105723Smrg# stringent environments than integration tests.
255958105723Smrg#
256058105723Smrg# Interface to module:
256158105723Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256258105723Smrg# enable_integration_tests:   used in configure.ac for additional configuration
256358105723Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256458105723Smrg#                             'no' user instructs the module not to build tests
256558105723Smrg# parm1:                      specify the default value, yes or no.
256658105723Smrg#
256758105723SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256858105723SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256958105723Smrgm4_define([_defopt], m4_default([$1], [auto]))
257058105723SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257158105723Smrg	[Enable building integration test cases (default: ]_defopt[)]),
257258105723Smrg	[enable_integration_tests=$enableval],
257358105723Smrg	[enable_integration_tests=]_defopt)
257458105723Smrgm4_undefine([_defopt])
257558105723SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257658105723Smrg	[test "x$enable_integration_tests" != xno])
257758105723SmrgAC_MSG_CHECKING([whether to build unit test cases])
257858105723SmrgAC_MSG_RESULT([$enable_integration_tests])
257958105723Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580aea1d7ffSmrg
258158105723Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258258105723Smrg# ----------------------------------------
258358105723Smrg# Minimum version: 1.13.0
258458105723Smrg#
258558105723Smrg# GLib is a library which provides advanced data structures and functions.
258658105723Smrg# This macro enables a module to test for the presence of Glib.
258758105723Smrg#
258858105723Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258958105723Smrg# Otherwise the value of $enable_unit_tests is blank.
259058105723Smrg#
259158105723Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259258105723Smrg# test support usually requires less dependencies and may be built and run under
259358105723Smrg# less stringent environments than integration tests.
25944d9306dbSmrg#
259558105723Smrg# Interface to module:
259658105723Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
259758105723Smrg# with_glib: used in configure.ac to know if GLib has been found
259858105723Smrg# --with-glib:	'yes' user instructs the module to use glib
259958105723Smrg#		'no' user instructs the module not to use glib
260058105723Smrg#
260158105723SmrgAC_DEFUN([XORG_WITH_GLIB],[
260258105723SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260358105723Smrgm4_define([_defopt], m4_default([$2], [auto]))
260458105723SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260558105723Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260658105723Smrg	[with_glib=$withval], [with_glib=]_defopt)
260758105723Smrgm4_undefine([_defopt])
2608aea1d7ffSmrg
260958105723Smrghave_glib=no
261058105723Smrg# Do not probe GLib if user explicitly disabled unit testing
261158105723Smrgif test "x$enable_unit_tests" != x"no"; then
261258105723Smrg  # Do not probe GLib if user explicitly disabled it
261358105723Smrg  if test "x$with_glib" != x"no"; then
261458105723Smrg    m4_ifval(
261558105723Smrg      [$1],
261658105723Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261758105723Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261858105723Smrg    )
2619aea1d7ffSmrg  fi
2620aea1d7ffSmrgfi
2621aea1d7ffSmrg
262258105723Smrg# Not having GLib when unit testing has been explicitly requested is an error
262358105723Smrgif test "x$enable_unit_tests" = x"yes"; then
262458105723Smrg  if test "x$have_glib" = x"no"; then
262558105723Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626aea1d7ffSmrg  fi
2627aea1d7ffSmrgfi
2628aea1d7ffSmrg
262958105723Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
263058105723Smrgif test "x$enable_unit_tests" = x"no"; then
263158105723Smrg  if test "x$with_glib" = x"yes"; then
263258105723Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263358105723Smrg  fi
263458105723Smrgfi
2635aea1d7ffSmrg
263658105723Smrg# Not having GLib when it has been explicitly requested is an error
263758105723Smrgif test "x$with_glib" = x"yes"; then
263858105723Smrg  if test "x$have_glib" = x"no"; then
263958105723Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264058105723Smrg  fi
264158105723Smrgfi
2642aea1d7ffSmrg
264358105723SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264458105723Smrg]) # XORG_WITH_GLIB
2645aea1d7ffSmrg
264658105723Smrg# XORG_LD_WRAP([required|optional])
264758105723Smrg# ---------------------------------
264858105723Smrg# Minimum version: 1.13.0
264958105723Smrg#
265058105723Smrg# Check if linker supports -wrap, passed via compiler flags
265158105723Smrg#
265258105723Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265358105723Smrg# Otherwise the value of $enable_unit_tests is blank.
265458105723Smrg#
265558105723Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265658105723Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265758105723Smrg# available, an argument of "optional" allows use when some unit tests require
265858105723Smrg# ld -wrap and others do not.
265958105723Smrg#
266058105723SmrgAC_DEFUN([XORG_LD_WRAP],[
266158105723SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266258105723Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266358105723Smrg                      void __wrap_exit(int status) { return; }],
266458105723Smrg                     [exit(0);])])
266558105723Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
266658105723Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266758105723Smrg  if test "x$have_ld_wrap" = x"no"; then
266858105723Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266958105723Smrg  fi
267058105723Smrgfi
267158105723SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267258105723Smrg#
267358105723Smrg]) # XORG_LD_WRAP
2674aea1d7ffSmrg
267558105723Smrg# XORG_CHECK_LINKER_FLAGS
267658105723Smrg# -----------------------
267758105723Smrg# SYNOPSIS
267858105723Smrg#
267958105723Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268058105723Smrg#
268158105723Smrg# DESCRIPTION
268258105723Smrg#
268358105723Smrg#   Check whether the given linker FLAGS work with the current language's
268458105723Smrg#   linker, or whether they give an error.
268558105723Smrg#
268658105723Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268758105723Smrg#   success/failure.
268858105723Smrg#
268958105723Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
269058105723Smrg#
269158105723Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269258105723Smrg#
269358105723Smrg# LICENSE
269458105723Smrg#
269558105723Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269658105723Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269758105723Smrg#   Copyright (c) 2009 Matteo Frigo
269858105723Smrg#
269958105723Smrg#   This program is free software: you can redistribute it and/or modify it
270058105723Smrg#   under the terms of the GNU General Public License as published by the
270158105723Smrg#   Free Software Foundation, either version 3 of the License, or (at your
270258105723Smrg#   option) any later version.
270358105723Smrg#
270458105723Smrg#   This program is distributed in the hope that it will be useful, but
270558105723Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270658105723Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270758105723Smrg#   Public License for more details.
270858105723Smrg#
270958105723Smrg#   You should have received a copy of the GNU General Public License along
271058105723Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271158105723Smrg#
271258105723Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
271358105723Smrg#   gives unlimited permission to copy, distribute and modify the configure
271458105723Smrg#   scripts that are the output of Autoconf when processing the Macro. You
271558105723Smrg#   need not follow the terms of the GNU General Public License when using
271658105723Smrg#   or distributing such scripts, even though portions of the text of the
271758105723Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271858105723Smrg#   all other use of the material that constitutes the Autoconf Macro.
271958105723Smrg#
272058105723Smrg#   This special exception to the GPL applies to versions of the Autoconf
272158105723Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
272258105723Smrg#   modified version of the Autoconf Macro, you may extend this special
272358105723Smrg#   exception to the GPL to apply to your modified version as well.#
272458105723SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272558105723Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
272658105723Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272758105723SmrgAS_LITERAL_IF([$1],
272858105723Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272958105723Smrg      ax_save_FLAGS=$LDFLAGS
273058105723Smrg      LDFLAGS="$1"
273158105723Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273258105723Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273358105723Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273458105723Smrg      LDFLAGS=$ax_save_FLAGS])],
273558105723Smrg  [ax_save_FLAGS=$LDFLAGS
273658105723Smrg   LDFLAGS="$1"
273758105723Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273858105723Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273958105723Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274058105723Smrg   LDFLAGS=$ax_save_FLAGS])
274158105723Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274258105723SmrgAC_MSG_RESULT($xorg_check_linker_flags)
274358105723Smrgif test "x$xorg_check_linker_flags" = xyes; then
274458105723Smrg	m4_default([$2], :)
274558105723Smrgelse
274658105723Smrg	m4_default([$3], :)
274758105723Smrgfi
274858105723Smrg]) # XORG_CHECK_LINKER_FLAGS
2749aea1d7ffSmrg
275058105723Smrg# XORG_MEMORY_CHECK_FLAGS
275158105723Smrg# -----------------------
275258105723Smrg# Minimum version: 1.16.0
275358105723Smrg#
275458105723Smrg# This macro attempts to find appropriate memory checking functionality
275558105723Smrg# for various platforms which unit testing code may use to catch various
275658105723Smrg# forms of memory allocation and access errors in testing.
275758105723Smrg#
275858105723Smrg# Interface to module:
275958105723Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276058105723Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276158105723Smrg#
276258105723Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276358105723Smrg#
276458105723SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765067610f1Smrg
276658105723SmrgAC_REQUIRE([AC_CANONICAL_HOST])
276758105723SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276858105723Smrg           [Environment variables to enable memory checking in tests])
2769067610f1Smrg
277058105723Smrg# Check for different types of support on different platforms
277158105723Smrgcase $host_os in
277258105723Smrg    solaris*)
277358105723Smrg        AC_CHECK_LIB([umem], [umem_alloc],
277458105723Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277558105723Smrg        ;;
277658105723Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277758105723Smrg        # both directly and inverted, so should not be 0 or 255.
277858105723Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
277958105723Smrg        ;;
278058105723Smrg    darwin*)
278158105723Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278258105723Smrg        ;;
278358105723Smrg    *bsd*)
278458105723Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278558105723Smrg        ;;
278658105723Smrgesac
27874d9306dbSmrg
278858105723Smrg# User supplied flags override default flags
278958105723Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279058105723Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791067610f1Smrgfi
2792067610f1Smrg
279358105723SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279458105723Smrg]) # XORG_WITH_LINT
27957e6533d5Smrg
279658105723Smrg# XORG_CHECK_MALLOC_ZERO
279758105723Smrg# ----------------------
279858105723Smrg# Minimum version: 1.0.0
27994d9306dbSmrg#
280058105723Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280158105723Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280258105723Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280358105723SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280458105723SmrgAC_ARG_ENABLE(malloc0returnsnull,
280558105723Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280658105723Smrg		       [malloc(0) returns NULL (default: auto)]),
280758105723Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280858105723Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
28097e6533d5Smrg
281058105723SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281158105723Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281258105723SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281358105723Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281458105723Smrg#include <stdlib.h>
281558105723Smrg],[
281658105723Smrg    char *m0, *r0, *c0, *p;
281758105723Smrg    m0 = malloc(0);
281858105723Smrg    p = malloc(10);
281958105723Smrg    r0 = realloc(p,0);
282058105723Smrg    c0 = calloc(0,10);
282158105723Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282258105723Smrg])],
282358105723Smrg		[xorg_cv_malloc0_returns_null=yes],
282458105723Smrg		[xorg_cv_malloc0_returns_null=no])])
282558105723SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826067610f1Smrgfi
282758105723SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828067610f1Smrg
282958105723Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283058105723Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283158105723Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283258105723Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28334d9306dbSmrgelse
283458105723Smrg	MALLOC_ZERO_CFLAGS=""
283558105723Smrg	XMALLOC_ZERO_CFLAGS=""
283658105723Smrg	XTMALLOC_ZERO_CFLAGS=""
28374d9306dbSmrgfi
2838067610f1Smrg
283958105723SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284058105723SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284158105723SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284258105723Smrg]) # XORG_CHECK_MALLOC_ZERO
2843067610f1Smrg
284458105723Smrg# XORG_WITH_LINT()
284558105723Smrg# ----------------
284658105723Smrg# Minimum version: 1.1.0
28477e6533d5Smrg#
284858105723Smrg# This macro enables the use of a tool that flags some suspicious and
284958105723Smrg# non-portable constructs (likely to be bugs) in C language source code.
285058105723Smrg# It will attempt to locate the tool and use appropriate options.
285158105723Smrg# There are various lint type tools on different platforms.
2852aea1d7ffSmrg#
285358105723Smrg# Interface to module:
285458105723Smrg# LINT:		returns the path to the tool found on the platform
285558105723Smrg#		or the value set to LINT on the configure cmd line
285658105723Smrg#		also an Automake conditional
285758105723Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
285858105723Smrg#
285958105723Smrg# --with-lint:	'yes' user instructs the module to use lint
286058105723Smrg#		'no' user instructs the module not to use lint (default)
286158105723Smrg#
286258105723Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286358105723Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286458105723Smrg#
286558105723SmrgAC_DEFUN([XORG_WITH_LINT],[
2866aea1d7ffSmrg
286758105723SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286858105723SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286958105723SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287058105723Smrg		[Use a lint-style source code checker (default: disabled)])],
287158105723Smrg		[use_lint=$withval], [use_lint=no])
2872aea1d7ffSmrg
287358105723Smrg# Obtain platform specific info like program name and options
287458105723Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287558105723Smrgcase $host_os in
287658105723Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287758105723Smrg	lint_name=splint
287858105723Smrg	lint_options="-badflag"
287958105723Smrg	;;
288058105723Smrg  *freebsd* | *netbsd*)
288158105723Smrg	lint_name=lint
288258105723Smrg	lint_options="-u -b"
288358105723Smrg	;;
288458105723Smrg  *solaris*)
288558105723Smrg	lint_name=lint
288658105723Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288758105723Smrg	;;
288858105723Smrgesac
288958105723Smrg
289058105723Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289158105723Smrgif test "x$use_lint" = x"yes" ; then
289258105723Smrg   AC_PATH_PROG([LINT], [$lint_name])
289358105723Smrg   if test "x$LINT" = "x"; then
289458105723Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289558105723Smrg   fi
289658105723Smrgelif test "x$use_lint" = x"no" ; then
289758105723Smrg   if test "x$LINT" != "x"; then
289858105723Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289958105723Smrg   fi
29004d9306dbSmrgelse
290158105723Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902aea1d7ffSmrgfi
2903aea1d7ffSmrg
290458105723Smrg# User supplied flags override default flags
290558105723Smrgif test "x$LINT_FLAGS" != "x"; then
290658105723Smrg   lint_options=$LINT_FLAGS
290758105723Smrgfi
2908aea1d7ffSmrg
290958105723SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291058105723SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911aea1d7ffSmrg
291258105723Smrg]) # XORG_WITH_LINT
2913aea1d7ffSmrg
291458105723Smrg# XORG_LINT_LIBRARY(LIBNAME)
291558105723Smrg# --------------------------
291658105723Smrg# Minimum version: 1.1.0
2917aea1d7ffSmrg#
291858105723Smrg# Sets up flags for building lint libraries for checking programs that call
291958105723Smrg# functions in the library.
292058105723Smrg#
292158105723Smrg# Interface to module:
292258105723Smrg# LINTLIB		- Automake variable with the name of lint library file to make
292358105723Smrg# MAKE_LINT_LIB		- Automake conditional
292458105723Smrg#
292558105723Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292658105723Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2927aea1d7ffSmrg
292858105723SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292958105723SmrgAC_REQUIRE([XORG_WITH_LINT])
293058105723SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293158105723Smrg	[Create lint library (default: disabled)])],
293258105723Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293358105723Smrg
293458105723Smrgif test "x$make_lint_lib" = x"yes" ; then
293558105723Smrg   LINTLIB=llib-l$1.ln
293658105723Smrg   if test "x$LINT" = "x"; then
293758105723Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293858105723Smrg   fi
293958105723Smrgelif test "x$make_lint_lib" != x"no" ; then
294058105723Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941aea1d7ffSmrgfi
2942aea1d7ffSmrg
294358105723SmrgAC_SUBST(LINTLIB)
294458105723SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29454d9306dbSmrg
294658105723Smrg]) # XORG_LINT_LIBRARY
29474d9306dbSmrg
294858105723Smrg# XORG_COMPILER_BRAND
29494d9306dbSmrg# -------------------
295058105723Smrg# Minimum version: 1.14.0
29514d9306dbSmrg#
295258105723Smrg# Checks for various brands of compilers and sets flags as appropriate:
295358105723Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295458105723Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295558105723Smrg#   clang compiler - sets CLANGCC to "yes"
295658105723Smrg#   Intel compiler - sets INTELCC to "yes"
295758105723Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295858105723Smrg#
295958105723SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296058105723SmrgAC_LANG_CASE(
296158105723Smrg	[C], [
296258105723Smrg		AC_REQUIRE([AC_PROG_CC_C99])
296358105723Smrg	],
296458105723Smrg	[C++], [
296558105723Smrg		AC_REQUIRE([AC_PROG_CXX])
296658105723Smrg	]
296758105723Smrg)
296858105723SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
296958105723SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297058105723SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297158105723Smrg]) # XORG_COMPILER_BRAND
2972aea1d7ffSmrg
297358105723Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
29744d9306dbSmrg# ---------------
297558105723Smrg# Minimum version: 1.16.0
297658105723Smrg#
297758105723Smrg# Test if the compiler works when passed the given flag as a command line argument.
297858105723Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
297958105723Smrg# next flag in the list until there are no more options.
298058105723Smrg#
298158105723Smrg# Note that this does not guarantee that the compiler supports the flag as some
298258105723Smrg# compilers will simply ignore arguments that they do not understand, but we do
298358105723Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298458105723Smrg# -Werror=unused-command-line-argument
298558105723Smrg#
298658105723SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
298758105723Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298858105723Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2989aea1d7ffSmrg
299058105723SmrgAC_LANG_COMPILER_REQUIRE
2991aea1d7ffSmrg
299258105723SmrgAC_LANG_CASE(
299358105723Smrg	[C], [
299458105723Smrg		AC_REQUIRE([AC_PROG_CC_C99])
299558105723Smrg		define([PREFIX], [C])
299658105723Smrg		define([CACHE_PREFIX], [cc])
299758105723Smrg		define([COMPILER], [$CC])
299858105723Smrg	],
299958105723Smrg	[C++], [
300058105723Smrg		define([PREFIX], [CXX])
300158105723Smrg		define([CACHE_PREFIX], [cxx])
300258105723Smrg		define([COMPILER], [$CXX])
300358105723Smrg	]
300458105723Smrg)
300558105723Smrg
300658105723Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
300758105723Smrg
300858105723Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
300958105723Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301058105723Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301158105723Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
301258105723Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
301358105723Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
301458105723Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
301558105723Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
301658105723Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30174d9306dbSmrgfi
301858105723Smrg
301958105723Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302058105723Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302158105723Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
302258105723Smrg	fi
302358105723Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
302458105723Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
302558105723Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
302658105723Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302758105723Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
302858105723Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
302958105723Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303058105723Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303158105723Smrgfi
303258105723Smrg
303358105723Smrgfound="no"
303458105723Smrgm4_foreach([flag], m4_cdr($@), [
303558105723Smrg	if test $found = "no" ; then
303658105723Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
303758105723Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303858105723Smrg		fi
303958105723Smrg
304058105723Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304158105723Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
304258105723Smrg		fi
304358105723Smrg
304458105723Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
304558105723Smrg
304658105723Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
304758105723Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
304858105723Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
304958105723Smrg		AC_CACHE_VAL($cacheid,
305058105723Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305158105723Smrg					     [eval $cacheid=yes],
305258105723Smrg					     [eval $cacheid=no])])
305358105723Smrg
305458105723Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
305558105723Smrg
305658105723Smrg		eval supported=\$$cacheid
305758105723Smrg		AC_MSG_RESULT([$supported])
305858105723Smrg		if test "$supported" = "yes" ; then
305958105723Smrg			$1="$$1 ]flag["
306058105723Smrg			found="yes"
306158105723Smrg		fi
306258105723Smrg	fi
30634d9306dbSmrg])
306458105723Smrg]) # XORG_TESTSET_CFLAG
3065aea1d7ffSmrg
306658105723Smrg# XORG_COMPILER_FLAGS
306758105723Smrg# ---------------
306858105723Smrg# Minimum version: 1.16.0
30697e6533d5Smrg#
307058105723Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307158105723Smrg# arguments supported by the selected compiler which do NOT alter the generated
307258105723Smrg# code.  These arguments will cause the compiler to print various warnings
307358105723Smrg# during compilation AND turn a conservative set of warnings into errors.
307458105723Smrg#
307558105723Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
307658105723Smrg# future versions of util-macros as options are added to new compilers.
307758105723Smrg#
307858105723SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
307958105723SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30807e6533d5Smrg
308158105723SmrgAC_ARG_ENABLE(selective-werror,
308258105723Smrg              AS_HELP_STRING([--disable-selective-werror],
308358105723Smrg                             [Turn off selective compiler errors. (default: enabled)]),
308458105723Smrg              [SELECTIVE_WERROR=$enableval],
308558105723Smrg              [SELECTIVE_WERROR=yes])
308658105723Smrg
308758105723SmrgAC_LANG_CASE(
308858105723Smrg        [C], [
308958105723Smrg                define([PREFIX], [C])
309058105723Smrg        ],
309158105723Smrg        [C++], [
309258105723Smrg                define([PREFIX], [CXX])
309358105723Smrg        ]
309458105723Smrg)
309558105723Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
309658105723Smrgif test "x$SUNCC" = "xyes"; then
309758105723Smrg    [BASE_]PREFIX[FLAGS]="-v"
30984d9306dbSmrgelse
309958105723Smrg    [BASE_]PREFIX[FLAGS]=""
31004d9306dbSmrgfi
31014d9306dbSmrg
310258105723Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
310358105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
310458105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
310558105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
310658105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31074d9306dbSmrg
310858105723SmrgAC_LANG_CASE(
310958105723Smrg	[C], [
311058105723Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311158105723Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
311258105723Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
311358105723Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
311458105723Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
311558105723Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
311658105723Smrg	]
311758105723Smrg)
31187e6533d5Smrg
311958105723Smrg# This chunk adds additional warnings that could catch undesired effects.
312058105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312158105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
312258105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
312358105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
312458105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
312558105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
312658105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3127aea1d7ffSmrg
312858105723Smrg# These are currently disabled because they are noisy.  They will be enabled
312958105723Smrg# in the future once the codebase is sufficiently modernized to silence
313058105723Smrg# them.  For now, I don't want them to drown out the other warnings.
313158105723Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
313258105723Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
313358105723Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3134aea1d7ffSmrg
313558105723Smrg# Turn some warnings into errors, so we don't accidently get successful builds
313658105723Smrg# when there are problems that should be fixed.
3137aea1d7ffSmrg
313858105723Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
313958105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314058105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314158105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
314258105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
314358105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
314458105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
314558105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
314658105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
314758105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
314858105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
314958105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315058105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315158105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
315258105723Smrgelse
315358105723SmrgAC_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])
315458105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
315558105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
315658105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
315758105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
315858105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
315958105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316058105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316158105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
316258105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
316358105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
316458105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
316558105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
316658105723SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
316758105723Smrgfi
3168aea1d7ffSmrg
316958105723SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317058105723Smrg]) # XORG_COMPILER_FLAGS
31717e6533d5Smrg
317258105723Smrg# XORG_CWARNFLAGS
317358105723Smrg# ---------------
317458105723Smrg# Minimum version: 1.2.0
317558105723Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
31767e6533d5Smrg#
317758105723Smrg# Defines CWARNFLAGS to enable C compiler warnings.
31787e6533d5Smrg#
317958105723Smrg# This function is deprecated because it defines -fno-strict-aliasing
318058105723Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318158105723Smrg# is needed, then it should be added explicitly in the module when
318258105723Smrg# it is updated to use BASE_CFLAGS.
31837e6533d5Smrg#
318458105723SmrgAC_DEFUN([XORG_CWARNFLAGS], [
318558105723SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
318658105723SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
318758105723SmrgAC_LANG_CASE(
318858105723Smrg	[C], [
318958105723Smrg		CWARNFLAGS="$BASE_CFLAGS"
319058105723Smrg		if  test "x$GCC" = xyes ; then
319158105723Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
319258105723Smrg		fi
319358105723Smrg		AC_SUBST(CWARNFLAGS)
319458105723Smrg	]
319558105723Smrg)
319658105723Smrg]) # XORG_CWARNFLAGS
3197e7fdea5fSmrg
319858105723Smrg# XORG_STRICT_OPTION
319958105723Smrg# -----------------------
320058105723Smrg# Minimum version: 1.3.0
320158105723Smrg#
320258105723Smrg# Add configure option to enable strict compilation flags, such as treating
320358105723Smrg# warnings as fatal errors.
320458105723Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
320558105723Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
320658105723Smrg#
320758105723Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
320858105723Smrg# when strict compilation is unconditionally desired.
320958105723SmrgAC_DEFUN([XORG_STRICT_OPTION], [
321058105723SmrgAC_REQUIRE([XORG_CWARNFLAGS])
321158105723SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3212067610f1Smrg
321358105723SmrgAC_ARG_ENABLE(strict-compilation,
321458105723Smrg			  AS_HELP_STRING([--enable-strict-compilation],
321558105723Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
321658105723Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
32174d9306dbSmrg
321858105723SmrgAC_LANG_CASE(
321958105723Smrg        [C], [
322058105723Smrg                define([PREFIX], [C])
322158105723Smrg        ],
322258105723Smrg        [C++], [
322358105723Smrg                define([PREFIX], [CXX])
322458105723Smrg        ]
322558105723Smrg)
32264d9306dbSmrg
322758105723Smrg[STRICT_]PREFIX[FLAGS]=""
322858105723SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
322958105723SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
32304d9306dbSmrg
323158105723Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
323258105723Smrg# activate it with -Werror, so we add it here explicitly.
323358105723SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
32344d9306dbSmrg
323558105723Smrgif test "x$STRICT_COMPILE" = "xyes"; then
323658105723Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
323758105723Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
323858105723Smrgfi
323958105723SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324058105723SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324158105723SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
324258105723Smrg]) # XORG_STRICT_OPTION
32434d9306dbSmrg
324458105723Smrg# XORG_DEFAULT_OPTIONS
324558105723Smrg# --------------------
324658105723Smrg# Minimum version: 1.3.0
324758105723Smrg#
324858105723Smrg# Defines default options for X.Org modules.
324958105723Smrg#
325058105723SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
325158105723SmrgAC_REQUIRE([AC_PROG_INSTALL])
325258105723SmrgXORG_COMPILER_FLAGS
325358105723SmrgXORG_CWARNFLAGS
325458105723SmrgXORG_STRICT_OPTION
325558105723SmrgXORG_RELEASE_VERSION
325658105723SmrgXORG_CHANGELOG
325758105723SmrgXORG_INSTALL
325858105723SmrgXORG_MANPAGE_SECTIONS
325958105723Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326058105723Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
326158105723Smrg]) # XORG_DEFAULT_OPTIONS
32624d9306dbSmrg
326358105723Smrg# XORG_INSTALL()
326458105723Smrg# ----------------
326558105723Smrg# Minimum version: 1.4.0
326658105723Smrg#
326758105723Smrg# Defines the variable INSTALL_CMD as the command to copy
326858105723Smrg# INSTALL from $prefix/share/util-macros.
326958105723Smrg#
327058105723SmrgAC_DEFUN([XORG_INSTALL], [
327158105723SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
327258105723Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
327358105723SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
327458105723Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
327558105723Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
327658105723Smrgtouch \$(top_srcdir)/INSTALL; \
327758105723Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
327858105723SmrgAC_SUBST([INSTALL_CMD])
327958105723Smrg]) # XORG_INSTALL
328058105723Smrgdnl Copyright 2005 Red Hat, Inc
328158105723Smrgdnl
328258105723Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
328358105723Smrgdnl documentation for any purpose is hereby granted without fee, provided that
328458105723Smrgdnl the above copyright notice appear in all copies and that both that
328558105723Smrgdnl copyright notice and this permission notice appear in supporting
328658105723Smrgdnl documentation.
328758105723Smrgdnl
328858105723Smrgdnl The above copyright notice and this permission notice shall be included
328958105723Smrgdnl in all copies or substantial portions of the Software.
329058105723Smrgdnl
329158105723Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
329258105723Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
329358105723Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
329458105723Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
329558105723Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
329658105723Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
329758105723Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
329858105723Smrgdnl
329958105723Smrgdnl Except as contained in this notice, the name of the copyright holders shall
330058105723Smrgdnl not be used in advertising or otherwise to promote the sale, use or
330158105723Smrgdnl other dealings in this Software without prior written authorization
330258105723Smrgdnl from the copyright holders.
330358105723Smrgdnl
33044d9306dbSmrg
330558105723Smrg# XORG_RELEASE_VERSION
330658105723Smrg# --------------------
330758105723Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33084d9306dbSmrg
330958105723SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
331058105723Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
331158105723Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
331258105723Smrg		[Major version of this package])
331358105723Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
331458105723Smrg	if test "x$PVM" = "x"; then
331558105723Smrg		PVM="0"
331658105723Smrg	fi
331758105723Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
331858105723Smrg		[$PVM],
331958105723Smrg		[Minor version of this package])
332058105723Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
332158105723Smrg	if test "x$PVP" = "x"; then
332258105723Smrg		PVP="0"
332358105723Smrg	fi
332458105723Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
332558105723Smrg		[$PVP],
332658105723Smrg		[Patch version of this package])
332758105723Smrg])
33284d9306dbSmrg
332958105723Smrg# XORG_CHANGELOG()
333058105723Smrg# ----------------
333158105723Smrg# Minimum version: 1.2.0
333258105723Smrg#
333358105723Smrg# Defines the variable CHANGELOG_CMD as the command to generate
333458105723Smrg# ChangeLog from git.
333558105723Smrg#
333658105723Smrg#
333758105723SmrgAC_DEFUN([XORG_CHANGELOG], [
333858105723SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
333958105723Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
334058105723Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
334158105723Smrgtouch \$(top_srcdir)/ChangeLog; \
334258105723Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
334358105723SmrgAC_SUBST([CHANGELOG_CMD])
334458105723Smrg]) # XORG_CHANGELOG
33457e6533d5Smrg
3346