16eaa481cSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2a733a5bfSmrg
36eaa481cSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
41a30de1fSmrg
51a30de1fSmrg# This file is free software; the Free Software Foundation
61a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
71a30de1fSmrg# with or without modifications, as long as this notice is preserved.
81a30de1fSmrg
91a30de1fSmrg# This program is distributed in the hope that it will be useful,
101a30de1fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
111a30de1fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
121a30de1fSmrg# PARTICULAR PURPOSE.
131a30de1fSmrg
14a733a5bfSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15b7fb5eacSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16b7fb5eacSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
176eaa481cSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
186eaa481cSmrg[m4_warning([this file was generated for autoconf 2.71.
19b7fb5eacSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20b7fb5eacSmrgIf you have problems, you may need to regenerate the build system entirely.
21a733a5bfSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
221a30de1fSmrg
236eaa481cSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
246eaa481cSmrg#
256eaa481cSmrg# This file is free software; the Free Software Foundation
266eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
276eaa481cSmrg# with or without modifications, as long as this notice is preserved.
28423b239cSmrg
296eaa481cSmrg# AM_AUTOMAKE_VERSION(VERSION)
306eaa481cSmrg# ----------------------------
316eaa481cSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
326eaa481cSmrg# generated from the m4 files accompanying Automake X.Y.
336eaa481cSmrg# (This private macro should not be called outside this file.)
346eaa481cSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
356eaa481cSmrg[am__api_version='1.16'
366eaa481cSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
376eaa481cSmrgdnl require some minimum version.  Point them to the right macro.
386eaa481cSmrgm4_if([$1], [1.16.5], [],
396eaa481cSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
406eaa481cSmrg])
41423b239cSmrg
426eaa481cSmrg# _AM_AUTOCONF_VERSION(VERSION)
436eaa481cSmrg# -----------------------------
446eaa481cSmrg# aclocal traces this macro to find the Autoconf version.
456eaa481cSmrg# This is a private macro too.  Using m4_define simplifies
466eaa481cSmrg# the logic in aclocal, which can simply ignore this definition.
476eaa481cSmrgm4_define([_AM_AUTOCONF_VERSION], [])
481a30de1fSmrg
496eaa481cSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
506eaa481cSmrg# -------------------------------
516eaa481cSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
526eaa481cSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
536eaa481cSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
546eaa481cSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
556eaa481cSmrgm4_ifndef([AC_AUTOCONF_VERSION],
566eaa481cSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
576eaa481cSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
581a30de1fSmrg
596eaa481cSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
601a30de1fSmrg
616eaa481cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
626eaa481cSmrg#
636eaa481cSmrg# This file is free software; the Free Software Foundation
646eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
656eaa481cSmrg# with or without modifications, as long as this notice is preserved.
661a30de1fSmrg
676eaa481cSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
686eaa481cSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
696eaa481cSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
706eaa481cSmrg#
716eaa481cSmrg# Of course, Automake must honor this variable whenever it calls a
726eaa481cSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
736eaa481cSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
746eaa481cSmrg# depending on how configure is run.  This is pretty annoying, since
756eaa481cSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
766eaa481cSmrg# source directory, any form will work fine, but in subdirectories a
776eaa481cSmrg# relative path needs to be adjusted first.
786eaa481cSmrg#
796eaa481cSmrg# $ac_aux_dir/missing
806eaa481cSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
816eaa481cSmrg# $top_srcdir/$ac_aux_dir/missing
826eaa481cSmrg#    fails if $ac_aux_dir is absolute,
836eaa481cSmrg#    fails when called from a subdirectory in a VPATH build with
846eaa481cSmrg#          a relative $ac_aux_dir
856eaa481cSmrg#
866eaa481cSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
876eaa481cSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
886eaa481cSmrg# harmless because $srcdir is '.', but things will broke when you
896eaa481cSmrg# start a VPATH build or use an absolute $srcdir.
906eaa481cSmrg#
916eaa481cSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
926eaa481cSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
936eaa481cSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
946eaa481cSmrg# and then we would define $MISSING as
956eaa481cSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
966eaa481cSmrg# This will work as long as MISSING is not called from configure, because
976eaa481cSmrg# unfortunately $(top_srcdir) has no meaning in configure.
986eaa481cSmrg# However there are other variables, like CC, which are often used in
996eaa481cSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1006eaa481cSmrg#
1016eaa481cSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1026eaa481cSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1036eaa481cSmrg# configured tree to be moved without reconfiguration.
1041a30de1fSmrg
1056eaa481cSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1066eaa481cSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1076eaa481cSmrg# Expand $ac_aux_dir to an absolute path.
1086eaa481cSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1096eaa481cSmrg])
1101a30de1fSmrg
1116eaa481cSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1121a30de1fSmrg
1136eaa481cSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
1146eaa481cSmrg#
1156eaa481cSmrg# This file is free software; the Free Software Foundation
1166eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
1176eaa481cSmrg# with or without modifications, as long as this notice is preserved.
1181a30de1fSmrg
1196eaa481cSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1206eaa481cSmrg# -------------------------------------
1216eaa481cSmrg# Define a conditional.
1226eaa481cSmrgAC_DEFUN([AM_CONDITIONAL],
1236eaa481cSmrg[AC_PREREQ([2.52])dnl
1246eaa481cSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1256eaa481cSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1266eaa481cSmrgAC_SUBST([$1_TRUE])dnl
1276eaa481cSmrgAC_SUBST([$1_FALSE])dnl
1286eaa481cSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1296eaa481cSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1306eaa481cSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1316eaa481cSmrgif $2; then
1326eaa481cSmrg  $1_TRUE=
1336eaa481cSmrg  $1_FALSE='#'
1346eaa481cSmrgelse
1356eaa481cSmrg  $1_TRUE='#'
1366eaa481cSmrg  $1_FALSE=
1376eaa481cSmrgfi
1386eaa481cSmrgAC_CONFIG_COMMANDS_PRE(
1396eaa481cSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1406eaa481cSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1416eaa481cSmrgUsually this means the macro was only invoked conditionally.]])
1426eaa481cSmrgfi])])
1431a30de1fSmrg
1446eaa481cSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
1456eaa481cSmrg#
1466eaa481cSmrg# This file is free software; the Free Software Foundation
1476eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
1486eaa481cSmrg# with or without modifications, as long as this notice is preserved.
1491a30de1fSmrg
1501a30de1fSmrg
1516eaa481cSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1526eaa481cSmrg# written in clear, in which case automake, when reading aclocal.m4,
1536eaa481cSmrg# will think it sees a *use*, and therefore will trigger all it's
1546eaa481cSmrg# C support machinery.  Also note that it means that autoscan, seeing
1556eaa481cSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1561a30de1fSmrg
1571a30de1fSmrg
1586eaa481cSmrg# _AM_DEPENDENCIES(NAME)
1596eaa481cSmrg# ----------------------
1606eaa481cSmrg# See how the compiler implements dependency checking.
1616eaa481cSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1626eaa481cSmrg# We try a few techniques and use that to set a single cache variable.
1636eaa481cSmrg#
1646eaa481cSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1656eaa481cSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1666eaa481cSmrg# dependency, and given that the user is not expected to run this macro,
1676eaa481cSmrg# just rely on AC_PROG_CC.
1686eaa481cSmrgAC_DEFUN([_AM_DEPENDENCIES],
1696eaa481cSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1706eaa481cSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1716eaa481cSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1726eaa481cSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1731a30de1fSmrg
1746eaa481cSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1756eaa481cSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1766eaa481cSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1776eaa481cSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1786eaa481cSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1796eaa481cSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1806eaa481cSmrg                    [depcc="$$1"   am_compiler_list=])
1811a30de1fSmrg
1826eaa481cSmrgAC_CACHE_CHECK([dependency style of $depcc],
1836eaa481cSmrg               [am_cv_$1_dependencies_compiler_type],
1846eaa481cSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1856eaa481cSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1866eaa481cSmrg  # making bogus files that we don't know about and never remove.  For
1876eaa481cSmrg  # instance it was reported that on HP-UX the gcc test will end up
1886eaa481cSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1896eaa481cSmrg  # in D".
1906eaa481cSmrg  rm -rf conftest.dir
1916eaa481cSmrg  mkdir conftest.dir
1926eaa481cSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1936eaa481cSmrg  # using a relative directory.
1946eaa481cSmrg  cp "$am_depcomp" conftest.dir
1956eaa481cSmrg  cd conftest.dir
1966eaa481cSmrg  # We will build objects and dependencies in a subdirectory because
1976eaa481cSmrg  # it helps to detect inapplicable dependency modes.  For instance
1986eaa481cSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1996eaa481cSmrg  # side effect of compilation, but ICC will put the dependencies in
2006eaa481cSmrg  # the current directory while Tru64 will put them in the object
2016eaa481cSmrg  # directory.
2026eaa481cSmrg  mkdir sub
2031a30de1fSmrg
2046eaa481cSmrg  am_cv_$1_dependencies_compiler_type=none
2056eaa481cSmrg  if test "$am_compiler_list" = ""; then
2066eaa481cSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2076eaa481cSmrg  fi
2086eaa481cSmrg  am__universal=false
2096eaa481cSmrg  m4_case([$1], [CC],
2106eaa481cSmrg    [case " $depcc " in #(
2116eaa481cSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2126eaa481cSmrg     esac],
2136eaa481cSmrg    [CXX],
2146eaa481cSmrg    [case " $depcc " in #(
2156eaa481cSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2166eaa481cSmrg     esac])
2171a30de1fSmrg
2186eaa481cSmrg  for depmode in $am_compiler_list; do
2196eaa481cSmrg    # Setup a source with many dependencies, because some compilers
2206eaa481cSmrg    # like to wrap large dependency lists on column 80 (with \), and
2216eaa481cSmrg    # we should not choose a depcomp mode which is confused by this.
2226eaa481cSmrg    #
2236eaa481cSmrg    # We need to recreate these files for each test, as the compiler may
2246eaa481cSmrg    # overwrite some of them when testing with obscure command lines.
2256eaa481cSmrg    # This happens at least with the AIX C compiler.
2266eaa481cSmrg    : > sub/conftest.c
2276eaa481cSmrg    for i in 1 2 3 4 5 6; do
2286eaa481cSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2296eaa481cSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2306eaa481cSmrg      # Solaris 10 /bin/sh.
2316eaa481cSmrg      echo '/* dummy */' > sub/conftst$i.h
2326eaa481cSmrg    done
2336eaa481cSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2341a30de1fSmrg
2356eaa481cSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2366eaa481cSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2376eaa481cSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2386eaa481cSmrg    # versions had trouble with output in subdirs.
2396eaa481cSmrg    am__obj=sub/conftest.${OBJEXT-o}
2406eaa481cSmrg    am__minus_obj="-o $am__obj"
2416eaa481cSmrg    case $depmode in
2426eaa481cSmrg    gcc)
2436eaa481cSmrg      # This depmode causes a compiler race in universal mode.
2446eaa481cSmrg      test "$am__universal" = false || continue
2456eaa481cSmrg      ;;
2466eaa481cSmrg    nosideeffect)
2476eaa481cSmrg      # After this tag, mechanisms are not by side-effect, so they'll
2486eaa481cSmrg      # only be used when explicitly requested.
2496eaa481cSmrg      if test "x$enable_dependency_tracking" = xyes; then
2506eaa481cSmrg	continue
2516eaa481cSmrg      else
2526eaa481cSmrg	break
2536eaa481cSmrg      fi
2546eaa481cSmrg      ;;
2556eaa481cSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2566eaa481cSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
2576eaa481cSmrg      # not run yet.  These depmodes are late enough in the game, and
2586eaa481cSmrg      # so weak that their functioning should not be impacted.
2596eaa481cSmrg      am__obj=conftest.${OBJEXT-o}
2606eaa481cSmrg      am__minus_obj=
2616eaa481cSmrg      ;;
2626eaa481cSmrg    none) break ;;
2636eaa481cSmrg    esac
2646eaa481cSmrg    if depmode=$depmode \
2656eaa481cSmrg       source=sub/conftest.c object=$am__obj \
2666eaa481cSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2676eaa481cSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2686eaa481cSmrg         >/dev/null 2>conftest.err &&
2696eaa481cSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2706eaa481cSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2716eaa481cSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2726eaa481cSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2736eaa481cSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2746eaa481cSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2756eaa481cSmrg      # that says an option was ignored or not supported.
2766eaa481cSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2776eaa481cSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2786eaa481cSmrg      # The diagnosis changed in icc 8.0:
2796eaa481cSmrg      #   icc: Command line remark: option '-MP' not supported
2806eaa481cSmrg      if (grep 'ignoring option' conftest.err ||
2816eaa481cSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2826eaa481cSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2836eaa481cSmrg        break
2846eaa481cSmrg      fi
2856eaa481cSmrg    fi
2866eaa481cSmrg  done
287b7fb5eacSmrg
2886eaa481cSmrg  cd ..
2896eaa481cSmrg  rm -rf conftest.dir
2906eaa481cSmrgelse
2916eaa481cSmrg  am_cv_$1_dependencies_compiler_type=none
2926eaa481cSmrgfi
2936eaa481cSmrg])
2946eaa481cSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2956eaa481cSmrgAM_CONDITIONAL([am__fastdep$1], [
2966eaa481cSmrg  test "x$enable_dependency_tracking" != xno \
2976eaa481cSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2986eaa481cSmrg])
2991a30de1fSmrg
300423b239cSmrg
3016eaa481cSmrg# AM_SET_DEPDIR
3026eaa481cSmrg# -------------
3036eaa481cSmrg# Choose a directory name for dependency files.
3046eaa481cSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3056eaa481cSmrgAC_DEFUN([AM_SET_DEPDIR],
3066eaa481cSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3076eaa481cSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3086eaa481cSmrg])
309423b239cSmrg
310423b239cSmrg
3116eaa481cSmrg# AM_DEP_TRACK
3126eaa481cSmrg# ------------
3136eaa481cSmrgAC_DEFUN([AM_DEP_TRACK],
3146eaa481cSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3156eaa481cSmrgAS_HELP_STRING(
3166eaa481cSmrg  [--enable-dependency-tracking],
3176eaa481cSmrg  [do not reject slow dependency extractors])
3186eaa481cSmrgAS_HELP_STRING(
3196eaa481cSmrg  [--disable-dependency-tracking],
3206eaa481cSmrg  [speeds up one-time build])])
3216eaa481cSmrgif test "x$enable_dependency_tracking" != xno; then
3226eaa481cSmrg  am_depcomp="$ac_aux_dir/depcomp"
3236eaa481cSmrg  AMDEPBACKSLASH='\'
3246eaa481cSmrg  am__nodep='_no'
3256eaa481cSmrgfi
3266eaa481cSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3276eaa481cSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3286eaa481cSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3296eaa481cSmrgAC_SUBST([am__nodep])dnl
3306eaa481cSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3316eaa481cSmrg])
332423b239cSmrg
3336eaa481cSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334423b239cSmrg
3356eaa481cSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336423b239cSmrg#
3376eaa481cSmrg# This file is free software; the Free Software Foundation
3386eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
3396eaa481cSmrg# with or without modifications, as long as this notice is preserved.
340423b239cSmrg
3416eaa481cSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3426eaa481cSmrg# ------------------------------
3436eaa481cSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3446eaa481cSmrg[{
3456eaa481cSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
3466eaa481cSmrg  # are listed without --file.  Let's play safe and only enable the eval
3476eaa481cSmrg  # if we detect the quoting.
3486eaa481cSmrg  # TODO: see whether this extra hack can be removed once we start
3496eaa481cSmrg  # requiring Autoconf 2.70 or later.
3506eaa481cSmrg  AS_CASE([$CONFIG_FILES],
3516eaa481cSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
3526eaa481cSmrg          [*], [set x $CONFIG_FILES])
3536eaa481cSmrg  shift
3546eaa481cSmrg  # Used to flag and report bootstrapping failures.
3556eaa481cSmrg  am_rc=0
3566eaa481cSmrg  for am_mf
3576eaa481cSmrg  do
3586eaa481cSmrg    # Strip MF so we end up with the name of the file.
3596eaa481cSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3606eaa481cSmrg    # Check whether this is an Automake generated Makefile which includes
3616eaa481cSmrg    # dependency-tracking related rules and includes.
3626eaa481cSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3636eaa481cSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3646eaa481cSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3656eaa481cSmrg      || continue
3666eaa481cSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3676eaa481cSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3686eaa481cSmrg    AM_RUN_LOG([cd "$am_dirpart" \
3696eaa481cSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3706eaa481cSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3716eaa481cSmrg  done
3726eaa481cSmrg  if test $am_rc -ne 0; then
3736eaa481cSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3746eaa481cSmrg    for automatic dependency tracking.  If GNU make was not used, consider
3756eaa481cSmrg    re-running the configure script with MAKE="gmake" (or whatever is
3766eaa481cSmrg    necessary).  You can also try re-running configure with the
3776eaa481cSmrg    '--disable-dependency-tracking' option to at least be able to build
3786eaa481cSmrg    the package (albeit without support for automatic dependency tracking).])
3796eaa481cSmrg  fi
3806eaa481cSmrg  AS_UNSET([am_dirpart])
3816eaa481cSmrg  AS_UNSET([am_filepart])
3826eaa481cSmrg  AS_UNSET([am_mf])
3836eaa481cSmrg  AS_UNSET([am_rc])
3846eaa481cSmrg  rm -f conftest-deps.mk
3856eaa481cSmrg}
3866eaa481cSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3871a30de1fSmrg
3881a30de1fSmrg
3896eaa481cSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3906eaa481cSmrg# -----------------------------
3916eaa481cSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
392423b239cSmrg#
3936eaa481cSmrg# This code is only required when automatic dependency tracking is enabled.
3946eaa481cSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3956eaa481cSmrg# order to bootstrap the dependency handling code.
3966eaa481cSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3976eaa481cSmrg[AC_CONFIG_COMMANDS([depfiles],
3986eaa481cSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3996eaa481cSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4001a30de1fSmrg
4016eaa481cSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4021a30de1fSmrg
4036eaa481cSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4046eaa481cSmrg#
4056eaa481cSmrg# This file is free software; the Free Software Foundation
4066eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
4076eaa481cSmrg# with or without modifications, as long as this notice is preserved.
4081a30de1fSmrg
4096eaa481cSmrg# This macro actually does too much.  Some checks are only needed if
4106eaa481cSmrg# your package does certain things.  But this isn't really a big deal.
4111a30de1fSmrg
4126eaa481cSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4136eaa481cSmrgm4_define([AC_PROG_CC],
4146eaa481cSmrgm4_defn([AC_PROG_CC])
4156eaa481cSmrg[_AM_PROG_CC_C_O
4166eaa481cSmrg])
4171a30de1fSmrg
4186eaa481cSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4196eaa481cSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4206eaa481cSmrg# -----------------------------------------------
4216eaa481cSmrg# The call with PACKAGE and VERSION arguments is the old style
4226eaa481cSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4236eaa481cSmrg# and VERSION should now be passed to AC_INIT and removed from
4246eaa481cSmrg# the call to AM_INIT_AUTOMAKE.
4256eaa481cSmrg# We support both call styles for the transition.  After
4266eaa481cSmrg# the next Automake release, Autoconf can make the AC_INIT
4276eaa481cSmrg# arguments mandatory, and then we can depend on a new Autoconf
4286eaa481cSmrg# release and drop the old call support.
4296eaa481cSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4306eaa481cSmrg[AC_PREREQ([2.65])dnl
4316eaa481cSmrgm4_ifdef([_$0_ALREADY_INIT],
4326eaa481cSmrg  [m4_fatal([$0 expanded multiple times
4336eaa481cSmrg]m4_defn([_$0_ALREADY_INIT]))],
4346eaa481cSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4356eaa481cSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4366eaa481cSmrgdnl the ones we care about.
4376eaa481cSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4386eaa481cSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4396eaa481cSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4406eaa481cSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4416eaa481cSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4426eaa481cSmrg  # is not polluted with repeated "-I."
4436eaa481cSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4446eaa481cSmrg  # test to see if srcdir already configured
4456eaa481cSmrg  if test -f $srcdir/config.status; then
4466eaa481cSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4476eaa481cSmrg  fi
448423b239cSmrgfi
4491a30de1fSmrg
4506eaa481cSmrg# test whether we have cygpath
4516eaa481cSmrgif test -z "$CYGPATH_W"; then
4526eaa481cSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4536eaa481cSmrg    CYGPATH_W='cygpath -w'
4546eaa481cSmrg  else
4556eaa481cSmrg    CYGPATH_W=echo
4566eaa481cSmrg  fi
457423b239cSmrgfi
4586eaa481cSmrgAC_SUBST([CYGPATH_W])
459423b239cSmrg
4606eaa481cSmrg# Define the identity of the package.
4616eaa481cSmrgdnl Distinguish between old-style and new-style calls.
4626eaa481cSmrgm4_ifval([$2],
4636eaa481cSmrg[AC_DIAGNOSE([obsolete],
4646eaa481cSmrg             [$0: two- and three-arguments forms are deprecated.])
4656eaa481cSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4666eaa481cSmrg AC_SUBST([PACKAGE], [$1])dnl
4676eaa481cSmrg AC_SUBST([VERSION], [$2])],
4686eaa481cSmrg[_AM_SET_OPTIONS([$1])dnl
4696eaa481cSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4706eaa481cSmrgm4_if(
4716eaa481cSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4726eaa481cSmrg  [ok:ok],,
4736eaa481cSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4746eaa481cSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4756eaa481cSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4761a30de1fSmrg
4776eaa481cSmrg_AM_IF_OPTION([no-define],,
4786eaa481cSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4796eaa481cSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4801a30de1fSmrg
4816eaa481cSmrg# Some tools Automake needs.
4826eaa481cSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4836eaa481cSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4846eaa481cSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4856eaa481cSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4866eaa481cSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4876eaa481cSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4886eaa481cSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4896eaa481cSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4906eaa481cSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4916eaa481cSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4926eaa481cSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
4936eaa481cSmrg# dies out for good.  For more background, see:
4946eaa481cSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4956eaa481cSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4966eaa481cSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4976eaa481cSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
4986eaa481cSmrg# system "awk" is bad on some platforms.
4996eaa481cSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5006eaa481cSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5016eaa481cSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5026eaa481cSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5036eaa481cSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5046eaa481cSmrg			     [_AM_PROG_TAR([v7])])])
5056eaa481cSmrg_AM_IF_OPTION([no-dependencies],,
5066eaa481cSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5076eaa481cSmrg		  [_AM_DEPENDENCIES([CC])],
5086eaa481cSmrg		  [m4_define([AC_PROG_CC],
5096eaa481cSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5106eaa481cSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5116eaa481cSmrg		  [_AM_DEPENDENCIES([CXX])],
5126eaa481cSmrg		  [m4_define([AC_PROG_CXX],
5136eaa481cSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5146eaa481cSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5156eaa481cSmrg		  [_AM_DEPENDENCIES([OBJC])],
5166eaa481cSmrg		  [m4_define([AC_PROG_OBJC],
5176eaa481cSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5186eaa481cSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5196eaa481cSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
5206eaa481cSmrg		  [m4_define([AC_PROG_OBJCXX],
5216eaa481cSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5226eaa481cSmrg])
5236eaa481cSmrg# Variables for tags utilities; see am/tags.am
5246eaa481cSmrgif test -z "$CTAGS"; then
5256eaa481cSmrg  CTAGS=ctags
5266eaa481cSmrgfi
5276eaa481cSmrgAC_SUBST([CTAGS])
5286eaa481cSmrgif test -z "$ETAGS"; then
5296eaa481cSmrg  ETAGS=etags
5306eaa481cSmrgfi
5316eaa481cSmrgAC_SUBST([ETAGS])
5326eaa481cSmrgif test -z "$CSCOPE"; then
5336eaa481cSmrg  CSCOPE=cscope
5346eaa481cSmrgfi
5356eaa481cSmrgAC_SUBST([CSCOPE])
536423b239cSmrg
5376eaa481cSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5386eaa481cSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
5396eaa481cSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5406eaa481cSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5416eaa481cSmrgAC_CONFIG_COMMANDS_PRE(dnl
5426eaa481cSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5436eaa481cSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544423b239cSmrg
5456eaa481cSmrg# POSIX will say in a future version that running "rm -f" with no argument
5466eaa481cSmrg# is OK; and we want to be able to make that assumption in our Makefile
5476eaa481cSmrg# recipes.  So use an aggressive probe to check that the usage we want is
5486eaa481cSmrg# actually supported "in the wild" to an acceptable degree.
5496eaa481cSmrg# See automake bug#10828.
5506eaa481cSmrg# To make any issue more visible, cause the running configure to be aborted
5516eaa481cSmrg# by default if the 'rm' program in use doesn't match our expectations; the
5526eaa481cSmrg# user can still override this though.
5536eaa481cSmrgif rm -f && rm -fr && rm -rf; then : OK; else
5546eaa481cSmrg  cat >&2 <<'END'
5556eaa481cSmrgOops!
5561a30de1fSmrg
5576eaa481cSmrgYour 'rm' program seems unable to run without file operands specified
5586eaa481cSmrgon the command line, even when the '-f' option is present.  This is contrary
5596eaa481cSmrgto the behaviour of most rm programs out there, and not conforming with
5606eaa481cSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5611a30de1fSmrg
5626eaa481cSmrgPlease tell bug-automake@gnu.org about your system, including the value
5636eaa481cSmrgof your $PATH and any error possibly output before this message.  This
5646eaa481cSmrgcan help us improve future automake versions.
565423b239cSmrg
5666eaa481cSmrgEND
5676eaa481cSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5686eaa481cSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5696eaa481cSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5706eaa481cSmrg    echo >&2
5716eaa481cSmrg  else
5726eaa481cSmrg    cat >&2 <<'END'
5736eaa481cSmrgAborting the configuration process, to ensure you take notice of the issue.
5741a30de1fSmrg
5756eaa481cSmrgYou can download and install GNU coreutils to get an 'rm' implementation
5766eaa481cSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
5771a30de1fSmrg
5786eaa481cSmrgIf you want to complete the configuration process using your problematic
5796eaa481cSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5806eaa481cSmrgto "yes", and re-run configure.
581a733a5bfSmrg
5826eaa481cSmrgEND
5836eaa481cSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5846eaa481cSmrg  fi
5851a30de1fSmrgfi
5866eaa481cSmrgdnl The trailing newline in this macro's definition is deliberate, for
5876eaa481cSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5886eaa481cSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5896eaa481cSmrg])
5901a30de1fSmrg
5916eaa481cSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5926eaa481cSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5936eaa481cSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5946eaa481cSmrgm4_define([_AC_COMPILER_EXEEXT],
5956eaa481cSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596423b239cSmrg
5976eaa481cSmrg# When config.status generates a header, we must update the stamp-h file.
5986eaa481cSmrg# This file resides in the same directory as the config header
5996eaa481cSmrg# that is generated.  The stamp files are numbered to have different names.
600423b239cSmrg
6016eaa481cSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
6026eaa481cSmrg# loop where config.status creates the headers, so we can generate
6036eaa481cSmrg# our stamp files there.
6046eaa481cSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
6056eaa481cSmrg[# Compute $1's index in $config_headers.
6066eaa481cSmrg_am_arg=$1
6076eaa481cSmrg_am_stamp_count=1
6086eaa481cSmrgfor _am_header in $config_headers :; do
6096eaa481cSmrg  case $_am_header in
6106eaa481cSmrg    $_am_arg | $_am_arg:* )
6116eaa481cSmrg      break ;;
6126eaa481cSmrg    * )
6136eaa481cSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6146eaa481cSmrg  esac
6156eaa481cSmrgdone
6166eaa481cSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617423b239cSmrg
6186eaa481cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6196eaa481cSmrg#
6206eaa481cSmrg# This file is free software; the Free Software Foundation
6216eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
6226eaa481cSmrg# with or without modifications, as long as this notice is preserved.
6236eaa481cSmrg
6246eaa481cSmrg# AM_PROG_INSTALL_SH
6256eaa481cSmrg# ------------------
6266eaa481cSmrg# Define $install_sh.
6276eaa481cSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6286eaa481cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6296eaa481cSmrgif test x"${install_sh+set}" != xset; then
6306eaa481cSmrg  case $am_aux_dir in
6316eaa481cSmrg  *\ * | *\	*)
6326eaa481cSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6336eaa481cSmrg  *)
6346eaa481cSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6356eaa481cSmrg  esac
6366eaa481cSmrgfi
6376eaa481cSmrgAC_SUBST([install_sh])])
6386eaa481cSmrg
6396eaa481cSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
6406eaa481cSmrg#
6416eaa481cSmrg# This file is free software; the Free Software Foundation
6426eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
6436eaa481cSmrg# with or without modifications, as long as this notice is preserved.
6446eaa481cSmrg
6456eaa481cSmrg# Check whether the underlying file-system supports filenames
6466eaa481cSmrg# with a leading dot.  For instance MS-DOS doesn't.
6476eaa481cSmrgAC_DEFUN([AM_SET_LEADING_DOT],
6486eaa481cSmrg[rm -rf .tst 2>/dev/null
6496eaa481cSmrgmkdir .tst 2>/dev/null
6506eaa481cSmrgif test -d .tst; then
6516eaa481cSmrg  am__leading_dot=.
652423b239cSmrgelse
6536eaa481cSmrg  am__leading_dot=_
6541a30de1fSmrgfi
6556eaa481cSmrgrmdir .tst 2>/dev/null
6566eaa481cSmrgAC_SUBST([am__leading_dot])])
6571a30de1fSmrg
6586eaa481cSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6591a30de1fSmrg
6606eaa481cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6616eaa481cSmrg#
6626eaa481cSmrg# This file is free software; the Free Software Foundation
6636eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
6646eaa481cSmrg# with or without modifications, as long as this notice is preserved.
6651a30de1fSmrg
6666eaa481cSmrg# AM_MAKE_INCLUDE()
6676eaa481cSmrg# -----------------
6686eaa481cSmrg# Check whether make has an 'include' directive that can support all
6696eaa481cSmrg# the idioms we need for our automatic dependency tracking code.
6706eaa481cSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6716eaa481cSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6726eaa481cSmrgcat > confinc.mk << 'END'
6736eaa481cSmrgam__doit:
6746eaa481cSmrg	@echo this is the am__doit target >confinc.out
6756eaa481cSmrg.PHONY: am__doit
6766eaa481cSmrgEND
6776eaa481cSmrgam__include="#"
6786eaa481cSmrgam__quote=
6796eaa481cSmrg# BSD make does it like this.
6806eaa481cSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6816eaa481cSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6826eaa481cSmrgecho 'include confinc.mk # ignored' > confmf.GNU
6836eaa481cSmrg_am_result=no
6846eaa481cSmrgfor s in GNU BSD; do
6856eaa481cSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6866eaa481cSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6876eaa481cSmrg      ['0:this is the am__doit target'],
6886eaa481cSmrg      [AS_CASE([$s],
6896eaa481cSmrg          [BSD], [am__include='.include' am__quote='"'],
6906eaa481cSmrg          [am__include='include' am__quote=''])])
6916eaa481cSmrg  if test "$am__include" != "#"; then
6926eaa481cSmrg    _am_result="yes ($s style)"
6936eaa481cSmrg    break
6946eaa481cSmrg  fi
6956eaa481cSmrgdone
6966eaa481cSmrgrm -f confinc.* confmf.*
6976eaa481cSmrgAC_MSG_RESULT([${_am_result}])
6986eaa481cSmrgAC_SUBST([am__include])])
6996eaa481cSmrgAC_SUBST([am__quote])])
7001a30de1fSmrg
7016eaa481cSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702a733a5bfSmrg
7036eaa481cSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
704423b239cSmrg#
7056eaa481cSmrg# This file is free software; the Free Software Foundation
7066eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
7076eaa481cSmrg# with or without modifications, as long as this notice is preserved.
708a733a5bfSmrg
7096eaa481cSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7106eaa481cSmrg# ------------------------------
7116eaa481cSmrgAC_DEFUN([AM_MISSING_PROG],
7126eaa481cSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7136eaa481cSmrg$1=${$1-"${am_missing_run}$2"}
7146eaa481cSmrgAC_SUBST($1)])
715a733a5bfSmrg
7166eaa481cSmrg# AM_MISSING_HAS_RUN
7176eaa481cSmrg# ------------------
7186eaa481cSmrg# Define MISSING if not defined so far and test if it is modern enough.
7196eaa481cSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7206eaa481cSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7216eaa481cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7226eaa481cSmrgAC_REQUIRE_AUX_FILE([missing])dnl
7236eaa481cSmrgif test x"${MISSING+set}" != xset; then
7246eaa481cSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725423b239cSmrgfi
7266eaa481cSmrg# Use eval to expand $SHELL
7276eaa481cSmrgif eval "$MISSING --is-lightweight"; then
7286eaa481cSmrg  am_missing_run="$MISSING "
7296eaa481cSmrgelse
7306eaa481cSmrg  am_missing_run=
7316eaa481cSmrg  AC_MSG_WARN(['missing' script is too old or missing])
732423b239cSmrgfi
7336eaa481cSmrg])
734a733a5bfSmrg
7356eaa481cSmrg# Helper functions for option handling.                     -*- Autoconf -*-
736a733a5bfSmrg
7376eaa481cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
7386eaa481cSmrg#
7396eaa481cSmrg# This file is free software; the Free Software Foundation
7406eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
7416eaa481cSmrg# with or without modifications, as long as this notice is preserved.
742b7fb5eacSmrg
7436eaa481cSmrg# _AM_MANGLE_OPTION(NAME)
7446eaa481cSmrg# -----------------------
7456eaa481cSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7466eaa481cSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7471a30de1fSmrg
7486eaa481cSmrg# _AM_SET_OPTION(NAME)
7496eaa481cSmrg# --------------------
7506eaa481cSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7516eaa481cSmrgAC_DEFUN([_AM_SET_OPTION],
7526eaa481cSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7531a30de1fSmrg
7546eaa481cSmrg# _AM_SET_OPTIONS(OPTIONS)
7556eaa481cSmrg# ------------------------
7566eaa481cSmrg# OPTIONS is a space-separated list of Automake options.
7576eaa481cSmrgAC_DEFUN([_AM_SET_OPTIONS],
7586eaa481cSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7596eaa481cSmrg
7606eaa481cSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7616eaa481cSmrg# -------------------------------------------
7626eaa481cSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7636eaa481cSmrgAC_DEFUN([_AM_IF_OPTION],
7646eaa481cSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7656eaa481cSmrg
7666eaa481cSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767423b239cSmrg#
7686eaa481cSmrg# This file is free software; the Free Software Foundation
7696eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
7706eaa481cSmrg# with or without modifications, as long as this notice is preserved.
7711a30de1fSmrg
7726eaa481cSmrg# _AM_PROG_CC_C_O
7736eaa481cSmrg# ---------------
7746eaa481cSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7756eaa481cSmrg# to automatically call this.
7766eaa481cSmrgAC_DEFUN([_AM_PROG_CC_C_O],
7776eaa481cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7786eaa481cSmrgAC_REQUIRE_AUX_FILE([compile])dnl
7796eaa481cSmrgAC_LANG_PUSH([C])dnl
7806eaa481cSmrgAC_CACHE_CHECK(
7816eaa481cSmrg  [whether $CC understands -c and -o together],
7826eaa481cSmrg  [am_cv_prog_cc_c_o],
7836eaa481cSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7846eaa481cSmrg  # Make sure it works both with $CC and with simple cc.
7856eaa481cSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7866eaa481cSmrg  # compilers refuse to overwrite an existing .o file with -o,
7876eaa481cSmrg  # though they will create one.
7886eaa481cSmrg  am_cv_prog_cc_c_o=yes
7896eaa481cSmrg  for am_i in 1 2; do
7906eaa481cSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7916eaa481cSmrg         && test -f conftest2.$ac_objext; then
7926eaa481cSmrg      : OK
7936eaa481cSmrg    else
7946eaa481cSmrg      am_cv_prog_cc_c_o=no
7956eaa481cSmrg      break
7966eaa481cSmrg    fi
7976eaa481cSmrg  done
7986eaa481cSmrg  rm -f core conftest*
7996eaa481cSmrg  unset am_i])
8006eaa481cSmrgif test "$am_cv_prog_cc_c_o" != yes; then
8016eaa481cSmrg   # Losing compiler, so override with the script.
8026eaa481cSmrg   # FIXME: It is wrong to rewrite CC.
8036eaa481cSmrg   # But if we don't then we get into trouble of one sort or another.
8046eaa481cSmrg   # A longer-term fix would be to have automake use am__CC in this case,
8056eaa481cSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8066eaa481cSmrg   CC="$am_aux_dir/compile $CC"
8071a30de1fSmrgfi
8086eaa481cSmrgAC_LANG_POP([C])])
8091a30de1fSmrg
8106eaa481cSmrg# For backward compatibility.
8116eaa481cSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8121a30de1fSmrg
8136eaa481cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
8141a30de1fSmrg#
8156eaa481cSmrg# This file is free software; the Free Software Foundation
8166eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
8176eaa481cSmrg# with or without modifications, as long as this notice is preserved.
8181a30de1fSmrg
8196eaa481cSmrg# AM_RUN_LOG(COMMAND)
8206eaa481cSmrg# -------------------
8216eaa481cSmrg# Run COMMAND, save the exit status in ac_status, and log it.
8226eaa481cSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8236eaa481cSmrgAC_DEFUN([AM_RUN_LOG],
8246eaa481cSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8256eaa481cSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8266eaa481cSmrg   ac_status=$?
8276eaa481cSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8286eaa481cSmrg   (exit $ac_status); }])
8296eaa481cSmrg
8306eaa481cSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8316eaa481cSmrg
8326eaa481cSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833423b239cSmrg#
8346eaa481cSmrg# This file is free software; the Free Software Foundation
8356eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
8366eaa481cSmrg# with or without modifications, as long as this notice is preserved.
8371a30de1fSmrg
8386eaa481cSmrg# AM_SANITY_CHECK
8396eaa481cSmrg# ---------------
8406eaa481cSmrgAC_DEFUN([AM_SANITY_CHECK],
8416eaa481cSmrg[AC_MSG_CHECKING([whether build environment is sane])
8426eaa481cSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8436eaa481cSmrg# name.  Accept space and tab only in the latter.
8446eaa481cSmrgam_lf='
8456eaa481cSmrg'
8466eaa481cSmrgcase `pwd` in
8476eaa481cSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8486eaa481cSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8496eaa481cSmrgesac
8506eaa481cSmrgcase $srcdir in
8516eaa481cSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8526eaa481cSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8536eaa481cSmrgesac
8546eaa481cSmrg
8556eaa481cSmrg# Do 'set' in a subshell so we don't clobber the current shell's
8566eaa481cSmrg# arguments.  Must try -L first in case configure is actually a
8576eaa481cSmrg# symlink; some systems play weird games with the mod time of symlinks
8586eaa481cSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8596eaa481cSmrg# directory).
8606eaa481cSmrgif (
8616eaa481cSmrg   am_has_slept=no
8626eaa481cSmrg   for am_try in 1 2; do
8636eaa481cSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8646eaa481cSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8656eaa481cSmrg     if test "$[*]" = "X"; then
8666eaa481cSmrg	# -L didn't work.
8676eaa481cSmrg	set X `ls -t "$srcdir/configure" conftest.file`
8686eaa481cSmrg     fi
8696eaa481cSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8706eaa481cSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8716eaa481cSmrg
8726eaa481cSmrg	# If neither matched, then we have a broken ls.  This can happen
8736eaa481cSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8746eaa481cSmrg	# broken ls alias from the environment.  This has actually
8756eaa481cSmrg	# happened.  Such a system could not be considered "sane".
8766eaa481cSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8776eaa481cSmrg  alias in your environment])
8786eaa481cSmrg     fi
8796eaa481cSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8806eaa481cSmrg       break
8816eaa481cSmrg     fi
8826eaa481cSmrg     # Just in case.
8836eaa481cSmrg     sleep 1
8846eaa481cSmrg     am_has_slept=yes
8856eaa481cSmrg   done
8866eaa481cSmrg   test "$[2]" = conftest.file
8876eaa481cSmrg   )
8886eaa481cSmrgthen
8896eaa481cSmrg   # Ok.
8906eaa481cSmrg   :
8911a30de1fSmrgelse
8926eaa481cSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
8936eaa481cSmrgCheck your system clock])
8941a30de1fSmrgfi
8956eaa481cSmrgAC_MSG_RESULT([yes])
8966eaa481cSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8976eaa481cSmrg# generated files are strictly newer.
8986eaa481cSmrgam_sleep_pid=
8996eaa481cSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9006eaa481cSmrg  ( sleep 1 ) &
9016eaa481cSmrg  am_sleep_pid=$!
9026eaa481cSmrgfi
9036eaa481cSmrgAC_CONFIG_COMMANDS_PRE(
9046eaa481cSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9056eaa481cSmrg   if test -n "$am_sleep_pid"; then
9066eaa481cSmrg     # Hide warnings about reused PIDs.
9076eaa481cSmrg     wait $am_sleep_pid 2>/dev/null
9086eaa481cSmrg   fi
9096eaa481cSmrg   AC_MSG_RESULT([done])])
9106eaa481cSmrgrm -f conftest.file
9116eaa481cSmrg])
9121a30de1fSmrg
9136eaa481cSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914423b239cSmrg#
9156eaa481cSmrg# This file is free software; the Free Software Foundation
9166eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
9176eaa481cSmrg# with or without modifications, as long as this notice is preserved.
9181a30de1fSmrg
9196eaa481cSmrg# AM_SILENT_RULES([DEFAULT])
9206eaa481cSmrg# --------------------------
9216eaa481cSmrg# Enable less verbose build rules; with the default set to DEFAULT
9226eaa481cSmrg# ("yes" being less verbose, "no" or empty being verbose).
9236eaa481cSmrgAC_DEFUN([AM_SILENT_RULES],
9246eaa481cSmrg[AC_ARG_ENABLE([silent-rules], [dnl
9256eaa481cSmrgAS_HELP_STRING(
9266eaa481cSmrg  [--enable-silent-rules],
9276eaa481cSmrg  [less verbose build output (undo: "make V=1")])
9286eaa481cSmrgAS_HELP_STRING(
9296eaa481cSmrg  [--disable-silent-rules],
9306eaa481cSmrg  [verbose build output (undo: "make V=0")])dnl
9316eaa481cSmrg])
9326eaa481cSmrgcase $enable_silent_rules in @%:@ (((
9336eaa481cSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
9346eaa481cSmrg   no) AM_DEFAULT_VERBOSITY=1;;
9356eaa481cSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9366eaa481cSmrgesac
9376eaa481cSmrgdnl
9386eaa481cSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9396eaa481cSmrgdnl do not support nested variable expansions.
9406eaa481cSmrgdnl See automake bug#9928 and bug#10237.
9416eaa481cSmrgam_make=${MAKE-make}
9426eaa481cSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9436eaa481cSmrg   [am_cv_make_support_nested_variables],
9446eaa481cSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9456eaa481cSmrgBAR0=false
9466eaa481cSmrgBAR1=true
9476eaa481cSmrgV=1
9486eaa481cSmrgam__doit:
9496eaa481cSmrg	@$(TRUE)
9506eaa481cSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9516eaa481cSmrg  am_cv_make_support_nested_variables=yes
952423b239cSmrgelse
9536eaa481cSmrg  am_cv_make_support_nested_variables=no
9546eaa481cSmrgfi])
9556eaa481cSmrgif test $am_cv_make_support_nested_variables = yes; then
9566eaa481cSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9576eaa481cSmrg  AM_V='$(V)'
9586eaa481cSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9596eaa481cSmrgelse
9606eaa481cSmrg  AM_V=$AM_DEFAULT_VERBOSITY
9616eaa481cSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962423b239cSmrgfi
9636eaa481cSmrgAC_SUBST([AM_V])dnl
9646eaa481cSmrgAM_SUBST_NOTMAKE([AM_V])dnl
9656eaa481cSmrgAC_SUBST([AM_DEFAULT_V])dnl
9666eaa481cSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9676eaa481cSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9686eaa481cSmrgAM_BACKSLASH='\'
9696eaa481cSmrgAC_SUBST([AM_BACKSLASH])dnl
9706eaa481cSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9716eaa481cSmrg])
9721a30de1fSmrg
9736eaa481cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974423b239cSmrg#
9756eaa481cSmrg# This file is free software; the Free Software Foundation
9766eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
9776eaa481cSmrg# with or without modifications, as long as this notice is preserved.
978a733a5bfSmrg
9796eaa481cSmrg# AM_PROG_INSTALL_STRIP
9806eaa481cSmrg# ---------------------
9816eaa481cSmrg# One issue with vendor 'install' (even GNU) is that you can't
9826eaa481cSmrg# specify the program used to strip binaries.  This is especially
9836eaa481cSmrg# annoying in cross-compiling environments, where the build's strip
9846eaa481cSmrg# is unlikely to handle the host's binaries.
9856eaa481cSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9866eaa481cSmrg# always use install-sh in "make install-strip", and initialize
9876eaa481cSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
9886eaa481cSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9896eaa481cSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9906eaa481cSmrg# Installed binaries are usually stripped using 'strip' when the user
9916eaa481cSmrg# run "make install-strip".  However 'strip' might not be the right
9926eaa481cSmrg# tool to use in cross-compilation environments, therefore Automake
9936eaa481cSmrg# will honor the 'STRIP' environment variable to overrule this program.
9946eaa481cSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9956eaa481cSmrgif test "$cross_compiling" != no; then
9966eaa481cSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
997a733a5bfSmrgfi
9986eaa481cSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9996eaa481cSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10001a30de1fSmrg
10016eaa481cSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002423b239cSmrg#
10036eaa481cSmrg# This file is free software; the Free Software Foundation
10046eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
10056eaa481cSmrg# with or without modifications, as long as this notice is preserved.
1006a733a5bfSmrg
10076eaa481cSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10086eaa481cSmrg# ---------------------------
10096eaa481cSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10106eaa481cSmrg# This macro is traced by Automake.
10116eaa481cSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012423b239cSmrg
10136eaa481cSmrg# AM_SUBST_NOTMAKE(VARIABLE)
10146eaa481cSmrg# --------------------------
10156eaa481cSmrg# Public sister of _AM_SUBST_NOTMAKE.
10166eaa481cSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10171a30de1fSmrg
10186eaa481cSmrg# Check how to create a tarball.                            -*- Autoconf -*-
1019b7fb5eacSmrg
10206eaa481cSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021423b239cSmrg#
10226eaa481cSmrg# This file is free software; the Free Software Foundation
10236eaa481cSmrg# gives unlimited permission to copy and/or distribute it,
10246eaa481cSmrg# with or without modifications, as long as this notice is preserved.
10256eaa481cSmrg
10266eaa481cSmrg# _AM_PROG_TAR(FORMAT)
10276eaa481cSmrg# --------------------
10286eaa481cSmrg# Check how to create a tarball in format FORMAT.
10296eaa481cSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030423b239cSmrg#
10316eaa481cSmrg# Substitute a variable $(am__tar) that is a command
10326eaa481cSmrg# writing to stdout a FORMAT-tarball containing the directory
10336eaa481cSmrg# $tardir.
10346eaa481cSmrg#     tardir=directory && $(am__tar) > result.tar
1035423b239cSmrg#
10366eaa481cSmrg# Substitute a variable $(am__untar) that extract such
10376eaa481cSmrg# a tarball read from stdin.
10386eaa481cSmrg#     $(am__untar) < result.tar
1039423b239cSmrg#
10406eaa481cSmrgAC_DEFUN([_AM_PROG_TAR],
10416eaa481cSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10426eaa481cSmrg# in the wild :-(  We should find a proper way to deprecate it ...
10436eaa481cSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10441a30de1fSmrg
10456eaa481cSmrg# We'll loop over all known methods to create a tar archive until one works.
10466eaa481cSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10471a30de1fSmrg
10486eaa481cSmrgm4_if([$1], [v7],
10496eaa481cSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10501a30de1fSmrg
10516eaa481cSmrg  [m4_case([$1],
10526eaa481cSmrg    [ustar],
10536eaa481cSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10546eaa481cSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10556eaa481cSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10566eaa481cSmrg      # and bug#13588).
10576eaa481cSmrg      am_max_uid=2097151 # 2^21 - 1
10586eaa481cSmrg      am_max_gid=$am_max_uid
10596eaa481cSmrg      # The $UID and $GID variables are not portable, so we need to resort
10606eaa481cSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10616eaa481cSmrg      # below are definitely unexpected, so allow the users to see them
10626eaa481cSmrg      # (that is, avoid stderr redirection).
10636eaa481cSmrg      am_uid=`id -u || echo unknown`
10646eaa481cSmrg      am_gid=`id -g || echo unknown`
10656eaa481cSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10666eaa481cSmrg      if test $am_uid -le $am_max_uid; then
10676eaa481cSmrg         AC_MSG_RESULT([yes])
10686eaa481cSmrg      else
10696eaa481cSmrg         AC_MSG_RESULT([no])
10706eaa481cSmrg         _am_tools=none
10716eaa481cSmrg      fi
10726eaa481cSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10736eaa481cSmrg      if test $am_gid -le $am_max_gid; then
10746eaa481cSmrg         AC_MSG_RESULT([yes])
10756eaa481cSmrg      else
10766eaa481cSmrg        AC_MSG_RESULT([no])
10776eaa481cSmrg        _am_tools=none
10786eaa481cSmrg      fi],
1079a733a5bfSmrg
10806eaa481cSmrg  [pax],
10816eaa481cSmrg    [],
1082a733a5bfSmrg
10836eaa481cSmrg  [m4_fatal([Unknown tar format])])
1084a733a5bfSmrg
10856eaa481cSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086a733a5bfSmrg
10876eaa481cSmrg  # Go ahead even if we have the value already cached.  We do so because we
10886eaa481cSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10896eaa481cSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090a733a5bfSmrg
10916eaa481cSmrg  for _am_tool in $_am_tools; do
10926eaa481cSmrg    case $_am_tool in
10936eaa481cSmrg    gnutar)
10946eaa481cSmrg      for _am_tar in tar gnutar gtar; do
10956eaa481cSmrg        AM_RUN_LOG([$_am_tar --version]) && break
10966eaa481cSmrg      done
10976eaa481cSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10986eaa481cSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10996eaa481cSmrg      am__untar="$_am_tar -xf -"
11006eaa481cSmrg      ;;
11016eaa481cSmrg    plaintar)
11026eaa481cSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11036eaa481cSmrg      # ustar tarball either.
11046eaa481cSmrg      (tar --version) >/dev/null 2>&1 && continue
11056eaa481cSmrg      am__tar='tar chf - "$$tardir"'
11066eaa481cSmrg      am__tar_='tar chf - "$tardir"'
11076eaa481cSmrg      am__untar='tar xf -'
11086eaa481cSmrg      ;;
11096eaa481cSmrg    pax)
11106eaa481cSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
11116eaa481cSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
11126eaa481cSmrg      am__untar='pax -r'
11136eaa481cSmrg      ;;
11146eaa481cSmrg    cpio)
11156eaa481cSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11166eaa481cSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11176eaa481cSmrg      am__untar='cpio -i -H $1 -d'
11186eaa481cSmrg      ;;
11196eaa481cSmrg    none)
11206eaa481cSmrg      am__tar=false
11216eaa481cSmrg      am__tar_=false
11226eaa481cSmrg      am__untar=false
11236eaa481cSmrg      ;;
11246eaa481cSmrg    esac
1125a733a5bfSmrg
11266eaa481cSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
11276eaa481cSmrg    # and am__untar set.
11286eaa481cSmrg    test -n "${am_cv_prog_tar_$1}" && break
1129a733a5bfSmrg
11306eaa481cSmrg    # tar/untar a dummy directory, and stop if the command works.
11316eaa481cSmrg    rm -rf conftest.dir
11326eaa481cSmrg    mkdir conftest.dir
11336eaa481cSmrg    echo GrepMe > conftest.dir/file
11346eaa481cSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11356eaa481cSmrg    rm -rf conftest.dir
11366eaa481cSmrg    if test -s conftest.tar; then
11376eaa481cSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
11386eaa481cSmrg      AM_RUN_LOG([cat conftest.dir/file])
11396eaa481cSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11406eaa481cSmrg    fi
11416eaa481cSmrg  done
11426eaa481cSmrg  rm -rf conftest.dir
1143a733a5bfSmrg
11446eaa481cSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11456eaa481cSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146a733a5bfSmrg
11476eaa481cSmrgAC_SUBST([am__tar])
11486eaa481cSmrgAC_SUBST([am__untar])
11496eaa481cSmrg]) # _AM_PROG_TAR
1150a733a5bfSmrg
11516eaa481cSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
11526eaa481cSmrgdnl serial 11 (pkg-config-0.29)
11536eaa481cSmrgdnl
11546eaa481cSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11556eaa481cSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
11566eaa481cSmrgdnl
11576eaa481cSmrgdnl This program is free software; you can redistribute it and/or modify
11586eaa481cSmrgdnl it under the terms of the GNU General Public License as published by
11596eaa481cSmrgdnl the Free Software Foundation; either version 2 of the License, or
11606eaa481cSmrgdnl (at your option) any later version.
11616eaa481cSmrgdnl
11626eaa481cSmrgdnl This program is distributed in the hope that it will be useful, but
11636eaa481cSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
11646eaa481cSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11656eaa481cSmrgdnl General Public License for more details.
11666eaa481cSmrgdnl
11676eaa481cSmrgdnl You should have received a copy of the GNU General Public License
11686eaa481cSmrgdnl along with this program; if not, write to the Free Software
11696eaa481cSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
11706eaa481cSmrgdnl 02111-1307, USA.
11716eaa481cSmrgdnl
11726eaa481cSmrgdnl As a special exception to the GNU General Public License, if you
11736eaa481cSmrgdnl distribute this file as part of a program that contains a
11746eaa481cSmrgdnl configuration script generated by Autoconf, you may include it under
11756eaa481cSmrgdnl the same distribution terms that you use for the rest of that
11766eaa481cSmrgdnl program.
1177a733a5bfSmrg
11786eaa481cSmrgdnl PKG_PREREQ(MIN-VERSION)
11796eaa481cSmrgdnl -----------------------
11806eaa481cSmrgdnl Since: 0.29
11816eaa481cSmrgdnl
11826eaa481cSmrgdnl Verify that the version of the pkg-config macros are at least
11836eaa481cSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
11846eaa481cSmrgdnl installed version of pkg-config, this checks the developer's version
11856eaa481cSmrgdnl of pkg.m4 when generating configure.
11866eaa481cSmrgdnl
11876eaa481cSmrgdnl To ensure that this macro is defined, also add:
11886eaa481cSmrgdnl m4_ifndef([PKG_PREREQ],
11896eaa481cSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
11906eaa481cSmrgdnl
11916eaa481cSmrgdnl See the "Since" comment for each macro you use to see what version
11926eaa481cSmrgdnl of the macros you require.
11936eaa481cSmrgm4_defun([PKG_PREREQ],
11946eaa481cSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
11956eaa481cSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
11966eaa481cSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
11976eaa481cSmrg])dnl PKG_PREREQ
1198a733a5bfSmrg
11996eaa481cSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
12006eaa481cSmrgdnl ----------------------------------
12016eaa481cSmrgdnl Since: 0.16
12026eaa481cSmrgdnl
12036eaa481cSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
12046eaa481cSmrgdnl first found in the path. Checks that the version of pkg-config found
12056eaa481cSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
12066eaa481cSmrgdnl used since that's the first version where most current features of
12076eaa481cSmrgdnl pkg-config existed.
12086eaa481cSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12096eaa481cSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12106eaa481cSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
12116eaa481cSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
12126eaa481cSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
12136eaa481cSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
12146eaa481cSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215a733a5bfSmrg
12166eaa481cSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12176eaa481cSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218a733a5bfSmrgfi
12196eaa481cSmrgif test -n "$PKG_CONFIG"; then
12206eaa481cSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
12216eaa481cSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12226eaa481cSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12236eaa481cSmrg		AC_MSG_RESULT([yes])
12246eaa481cSmrg	else
12256eaa481cSmrg		AC_MSG_RESULT([no])
12266eaa481cSmrg		PKG_CONFIG=""
12276eaa481cSmrg	fi
12286eaa481cSmrgfi[]dnl
12296eaa481cSmrg])dnl PKG_PROG_PKG_CONFIG
1230a733a5bfSmrg
12316eaa481cSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12326eaa481cSmrgdnl -------------------------------------------------------------------
12336eaa481cSmrgdnl Since: 0.18
12346eaa481cSmrgdnl
12356eaa481cSmrgdnl Check to see whether a particular set of modules exists. Similar to
12366eaa481cSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
12376eaa481cSmrgdnl
12386eaa481cSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12396eaa481cSmrgdnl only at the first occurence in configure.ac, so if the first place
12406eaa481cSmrgdnl it's called might be skipped (such as if it is within an "if", you
12416eaa481cSmrgdnl have to call PKG_CHECK_EXISTS manually
12426eaa481cSmrgAC_DEFUN([PKG_CHECK_EXISTS],
12436eaa481cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12446eaa481cSmrgif test -n "$PKG_CONFIG" && \
12456eaa481cSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12466eaa481cSmrg  m4_default([$2], [:])
12476eaa481cSmrgm4_ifvaln([$3], [else
12486eaa481cSmrg  $3])dnl
12496eaa481cSmrgfi])
12506eaa481cSmrg
12516eaa481cSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12526eaa481cSmrgdnl ---------------------------------------------
12536eaa481cSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12546eaa481cSmrgdnl pkg_failed based on the result.
12556eaa481cSmrgm4_define([_PKG_CONFIG],
12566eaa481cSmrg[if test -n "$$1"; then
12576eaa481cSmrg    pkg_cv_[]$1="$$1"
12586eaa481cSmrg elif test -n "$PKG_CONFIG"; then
12596eaa481cSmrg    PKG_CHECK_EXISTS([$3],
12606eaa481cSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
12616eaa481cSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
12626eaa481cSmrg		     [pkg_failed=yes])
12636eaa481cSmrg else
12646eaa481cSmrg    pkg_failed=untried
12656eaa481cSmrgfi[]dnl
12666eaa481cSmrg])dnl _PKG_CONFIG
12676eaa481cSmrg
12686eaa481cSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
12696eaa481cSmrgdnl ---------------------------
12706eaa481cSmrgdnl Internal check to see if pkg-config supports short errors.
12716eaa481cSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12726eaa481cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12736eaa481cSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12746eaa481cSmrg        _pkg_short_errors_supported=yes
1275a733a5bfSmrgelse
12766eaa481cSmrg        _pkg_short_errors_supported=no
12776eaa481cSmrgfi[]dnl
12786eaa481cSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279a733a5bfSmrg
1280a733a5bfSmrg
12816eaa481cSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12826eaa481cSmrgdnl   [ACTION-IF-NOT-FOUND])
12836eaa481cSmrgdnl --------------------------------------------------------------
12846eaa481cSmrgdnl Since: 0.4.0
12856eaa481cSmrgdnl
12866eaa481cSmrgdnl Note that if there is a possibility the first call to
12876eaa481cSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
12886eaa481cSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12896eaa481cSmrgAC_DEFUN([PKG_CHECK_MODULES],
12906eaa481cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12916eaa481cSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12926eaa481cSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12931a30de1fSmrg
12946eaa481cSmrgpkg_failed=no
12956eaa481cSmrgAC_MSG_CHECKING([for $1])
12961a30de1fSmrg
12976eaa481cSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12986eaa481cSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12991a30de1fSmrg
13006eaa481cSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
13016eaa481cSmrgand $1[]_LIBS to avoid the need to call pkg-config.
13026eaa481cSmrgSee the pkg-config man page for more details.])
13031a30de1fSmrg
13046eaa481cSmrgif test $pkg_failed = yes; then
13056eaa481cSmrg   	AC_MSG_RESULT([no])
13066eaa481cSmrg        _PKG_SHORT_ERRORS_SUPPORTED
13076eaa481cSmrg        if test $_pkg_short_errors_supported = yes; then
13086eaa481cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
13096eaa481cSmrg        else 
13106eaa481cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
13116eaa481cSmrg        fi
13126eaa481cSmrg	# Put the nasty error message in config.log where it belongs
13136eaa481cSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13141a30de1fSmrg
13156eaa481cSmrg	m4_default([$4], [AC_MSG_ERROR(
13166eaa481cSmrg[Package requirements ($2) were not met:
13171a30de1fSmrg
13186eaa481cSmrg$$1_PKG_ERRORS
13196eaa481cSmrg
13206eaa481cSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13216eaa481cSmrginstalled software in a non-standard prefix.
13226eaa481cSmrg
13236eaa481cSmrg_PKG_TEXT])[]dnl
13246eaa481cSmrg        ])
13256eaa481cSmrgelif test $pkg_failed = untried; then
13266eaa481cSmrg     	AC_MSG_RESULT([no])
13276eaa481cSmrg	m4_default([$4], [AC_MSG_FAILURE(
13286eaa481cSmrg[The pkg-config script could not be found or is too old.  Make sure it
13296eaa481cSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
13306eaa481cSmrgpath to pkg-config.
13316eaa481cSmrg
13326eaa481cSmrg_PKG_TEXT
13336eaa481cSmrg
13346eaa481cSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
13356eaa481cSmrg        ])
1336ce62200cSmrgelse
13376eaa481cSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13386eaa481cSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13396eaa481cSmrg        AC_MSG_RESULT([yes])
13406eaa481cSmrg	$3
13416eaa481cSmrgfi[]dnl
13426eaa481cSmrg])dnl PKG_CHECK_MODULES
1343ce62200cSmrg
1344ce62200cSmrg
13456eaa481cSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
13466eaa481cSmrgdnl   [ACTION-IF-NOT-FOUND])
13476eaa481cSmrgdnl ---------------------------------------------------------------------
13486eaa481cSmrgdnl Since: 0.29
13496eaa481cSmrgdnl
13506eaa481cSmrgdnl Checks for existence of MODULES and gathers its build flags with
13516eaa481cSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
13526eaa481cSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
13536eaa481cSmrgdnl
13546eaa481cSmrgdnl Note that if there is a possibility the first call to
13556eaa481cSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
13566eaa481cSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
13576eaa481cSmrgdnl configure.ac.
13586eaa481cSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
13596eaa481cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
13606eaa481cSmrg_save_PKG_CONFIG=$PKG_CONFIG
13616eaa481cSmrgPKG_CONFIG="$PKG_CONFIG --static"
13626eaa481cSmrgPKG_CHECK_MODULES($@)
13636eaa481cSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
13646eaa481cSmrg])dnl PKG_CHECK_MODULES_STATIC
13651a30de1fSmrg
13661a30de1fSmrg
13676eaa481cSmrgdnl PKG_INSTALLDIR([DIRECTORY])
13686eaa481cSmrgdnl -------------------------
13696eaa481cSmrgdnl Since: 0.27
13706eaa481cSmrgdnl
13716eaa481cSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
13726eaa481cSmrgdnl should install pkg-config .pc files. By default the directory is
13736eaa481cSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
13746eaa481cSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
13756eaa481cSmrgdnl parameter.
13766eaa481cSmrgAC_DEFUN([PKG_INSTALLDIR],
13776eaa481cSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
13786eaa481cSmrgm4_pushdef([pkg_description],
13796eaa481cSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
13806eaa481cSmrgAC_ARG_WITH([pkgconfigdir],
13816eaa481cSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
13826eaa481cSmrg    [with_pkgconfigdir=]pkg_default)
13836eaa481cSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
13846eaa481cSmrgm4_popdef([pkg_default])
13856eaa481cSmrgm4_popdef([pkg_description])
13866eaa481cSmrg])dnl PKG_INSTALLDIR
13876eaa481cSmrg
13886eaa481cSmrg
13896eaa481cSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
13906eaa481cSmrgdnl --------------------------------
13916eaa481cSmrgdnl Since: 0.27
13926eaa481cSmrgdnl
13936eaa481cSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
13946eaa481cSmrgdnl module should install arch-independent pkg-config .pc files. By
13956eaa481cSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
13966eaa481cSmrgdnl changed by passing DIRECTORY. The user can override through the
13976eaa481cSmrgdnl --with-noarch-pkgconfigdir parameter.
13986eaa481cSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
13996eaa481cSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
14006eaa481cSmrgm4_pushdef([pkg_description],
14016eaa481cSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
14026eaa481cSmrgAC_ARG_WITH([noarch-pkgconfigdir],
14036eaa481cSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
14046eaa481cSmrg    [with_noarch_pkgconfigdir=]pkg_default)
14056eaa481cSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
14066eaa481cSmrgm4_popdef([pkg_default])
14076eaa481cSmrgm4_popdef([pkg_description])
14086eaa481cSmrg])dnl PKG_NOARCH_INSTALLDIR
14096eaa481cSmrg
14101a30de1fSmrg
14116eaa481cSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
14126eaa481cSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
14136eaa481cSmrgdnl -------------------------------------------
14146eaa481cSmrgdnl Since: 0.28
14156eaa481cSmrgdnl
14166eaa481cSmrgdnl Retrieves the value of the pkg-config variable for the given module.
14176eaa481cSmrgAC_DEFUN([PKG_CHECK_VAR],
14186eaa481cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14196eaa481cSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
14201a30de1fSmrg
14216eaa481cSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
14226eaa481cSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
14231a30de1fSmrg
14246eaa481cSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
14256eaa481cSmrg])dnl PKG_CHECK_VAR
14261a30de1fSmrg
14276eaa481cSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14286eaa481cSmrgdnl
14296eaa481cSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
14306eaa481cSmrgdnl
14316eaa481cSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14326eaa481cSmrgdnl copy of this software and associated documentation files (the "Software"),
14336eaa481cSmrgdnl to deal in the Software without restriction, including without limitation
14346eaa481cSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14356eaa481cSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
14366eaa481cSmrgdnl Software is furnished to do so, subject to the following conditions:
14376eaa481cSmrgdnl
14386eaa481cSmrgdnl The above copyright notice and this permission notice (including the next
14396eaa481cSmrgdnl paragraph) shall be included in all copies or substantial portions of the
14406eaa481cSmrgdnl Software.
14416eaa481cSmrgdnl
14426eaa481cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14436eaa481cSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14446eaa481cSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14456eaa481cSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14466eaa481cSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14476eaa481cSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14486eaa481cSmrgdnl DEALINGS IN THE SOFTWARE.
14491a30de1fSmrg
14506eaa481cSmrg# XORG_MACROS_VERSION(required-version)
14516eaa481cSmrg# -------------------------------------
1452423b239cSmrg# Minimum version: 1.1.0
14531a30de1fSmrg#
14546eaa481cSmrg# If you're using a macro added in Version 1.1 or newer, include this in
14556eaa481cSmrg# your configure.ac with the minimum required version, such as:
14566eaa481cSmrg# XORG_MACROS_VERSION(1.1)
1457423b239cSmrg#
14586eaa481cSmrg# To ensure that this macro is defined, also add:
14596eaa481cSmrg# m4_ifndef([XORG_MACROS_VERSION],
14606eaa481cSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461423b239cSmrg#
14626eaa481cSmrg#
14636eaa481cSmrg# See the "minimum version" comment for each macro you use to see what
14646eaa481cSmrg# version you require.
14656eaa481cSmrgm4_defun([XORG_MACROS_VERSION],[
14666eaa481cSmrgm4_define([vers_have], [1.19.3])
14676eaa481cSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14686eaa481cSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14696eaa481cSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14706eaa481cSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14716eaa481cSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14726eaa481cSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14736eaa481cSmrgm4_undefine([vers_have])
14746eaa481cSmrgm4_undefine([maj_have])
14756eaa481cSmrgm4_undefine([maj_needed])
14766eaa481cSmrg]) # XORG_MACROS_VERSION
14771a30de1fSmrg
14786eaa481cSmrg# XORG_PROG_RAWCPP()
14796eaa481cSmrg# ------------------
14806eaa481cSmrg# Minimum version: 1.0.0
14816eaa481cSmrg#
14826eaa481cSmrg# Find cpp program and necessary flags for use in pre-processing text files
14836eaa481cSmrg# such as man pages and config files
14846eaa481cSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14856eaa481cSmrgAC_REQUIRE([AC_PROG_CPP])
14866eaa481cSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14876eaa481cSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14881a30de1fSmrg
14896eaa481cSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14906eaa481cSmrg# which is not the best choice for supporting other OS'es, but covers most
14916eaa481cSmrg# of the ones we need for now.
14926eaa481cSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14936eaa481cSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14946eaa481cSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14956eaa481cSmrg	AC_MSG_RESULT([no])
14966eaa481cSmrgelse
14976eaa481cSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14986eaa481cSmrg		RAWCPPFLAGS=-undef
14996eaa481cSmrg		AC_MSG_RESULT([yes])
15006eaa481cSmrg	# under Cygwin unix is still defined even with -undef
15016eaa481cSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15026eaa481cSmrg		RAWCPPFLAGS="-undef -ansi"
15036eaa481cSmrg		AC_MSG_RESULT([yes, with -ansi])
15046eaa481cSmrg	else
15056eaa481cSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15066eaa481cSmrg	fi
15071a30de1fSmrgfi
15086eaa481cSmrgrm -f conftest.$ac_ext
15091a30de1fSmrg
15106eaa481cSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15116eaa481cSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15126eaa481cSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15136eaa481cSmrg	AC_MSG_RESULT([no])
15146eaa481cSmrgelse
15156eaa481cSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15166eaa481cSmrg		TRADITIONALCPPFLAGS="-traditional"
15176eaa481cSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15186eaa481cSmrg		AC_MSG_RESULT([yes])
15196eaa481cSmrg	else
15206eaa481cSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15216eaa481cSmrg	fi
15226eaa481cSmrgfi
15236eaa481cSmrgrm -f conftest.$ac_ext
15246eaa481cSmrgAC_SUBST(RAWCPPFLAGS)
15256eaa481cSmrgAC_SUBST(TRADITIONALCPPFLAGS)
15266eaa481cSmrg]) # XORG_PROG_RAWCPP
15271a30de1fSmrg
15286eaa481cSmrg# XORG_MANPAGE_SECTIONS()
15296eaa481cSmrg# -----------------------
15306eaa481cSmrg# Minimum version: 1.0.0
1531ce62200cSmrg#
15326eaa481cSmrg# Determine which sections man pages go in for the different man page types
15336eaa481cSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15346eaa481cSmrg# Not sure if there's any better way than just hardcoding by OS name.
15356eaa481cSmrg# Override default settings by setting environment variables
15366eaa481cSmrg# Added MAN_SUBSTS in version 1.8
15376eaa481cSmrg# Added AC_PROG_SED in version 1.8
1538423b239cSmrg
15396eaa481cSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15406eaa481cSmrgAC_REQUIRE([AC_CANONICAL_HOST])
15416eaa481cSmrgAC_REQUIRE([AC_PROG_SED])
1542ce62200cSmrg
15436eaa481cSmrgcase $host_os in
15446eaa481cSmrg    solaris*)
15456eaa481cSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15466eaa481cSmrg        # check for a man page file found in later versions that use
15476eaa481cSmrg        # traditional section numbers instead
15486eaa481cSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15496eaa481cSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15506eaa481cSmrg        ;;
15516eaa481cSmrg    *) SYSV_MAN_SECTIONS=false ;;
15526eaa481cSmrgesac
1553423b239cSmrg
15546eaa481cSmrgif test x$APP_MAN_SUFFIX = x    ; then
15556eaa481cSmrg    APP_MAN_SUFFIX=1
15566eaa481cSmrgfi
15576eaa481cSmrgif test x$APP_MAN_DIR = x    ; then
15586eaa481cSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15596eaa481cSmrgfi
1560423b239cSmrg
15616eaa481cSmrgif test x$LIB_MAN_SUFFIX = x    ; then
15626eaa481cSmrg    LIB_MAN_SUFFIX=3
15636eaa481cSmrgfi
15646eaa481cSmrgif test x$LIB_MAN_DIR = x    ; then
15656eaa481cSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15666eaa481cSmrgfi
1567423b239cSmrg
15686eaa481cSmrgif test x$FILE_MAN_SUFFIX = x    ; then
15696eaa481cSmrg    case $SYSV_MAN_SECTIONS in
15706eaa481cSmrg	true)				FILE_MAN_SUFFIX=4  ;;
15716eaa481cSmrg	*)				FILE_MAN_SUFFIX=5  ;;
15726eaa481cSmrg    esac
15736eaa481cSmrgfi
15746eaa481cSmrgif test x$FILE_MAN_DIR = x    ; then
15756eaa481cSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576ce62200cSmrgfi
1577ce62200cSmrg
15786eaa481cSmrgif test x$MISC_MAN_SUFFIX = x    ; then
15796eaa481cSmrg    case $SYSV_MAN_SECTIONS in
15806eaa481cSmrg	true)				MISC_MAN_SUFFIX=5  ;;
15816eaa481cSmrg	*)				MISC_MAN_SUFFIX=7  ;;
15826eaa481cSmrg    esac
15836eaa481cSmrgfi
15846eaa481cSmrgif test x$MISC_MAN_DIR = x    ; then
15856eaa481cSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586423b239cSmrgfi
1587ce62200cSmrg
15886eaa481cSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15896eaa481cSmrg    case $SYSV_MAN_SECTIONS in
15906eaa481cSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
15916eaa481cSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
15926eaa481cSmrg    esac
15936eaa481cSmrgfi
15946eaa481cSmrgif test x$DRIVER_MAN_DIR = x    ; then
15956eaa481cSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15966eaa481cSmrgfi
1597ce62200cSmrg
15986eaa481cSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15996eaa481cSmrg    case $SYSV_MAN_SECTIONS in
16006eaa481cSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16016eaa481cSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16026eaa481cSmrg    esac
16036eaa481cSmrgfi
16046eaa481cSmrgif test x$ADMIN_MAN_DIR = x    ; then
16056eaa481cSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16066eaa481cSmrgfi
1607423b239cSmrg
1608423b239cSmrg
16096eaa481cSmrgAC_SUBST([APP_MAN_SUFFIX])
16106eaa481cSmrgAC_SUBST([LIB_MAN_SUFFIX])
16116eaa481cSmrgAC_SUBST([FILE_MAN_SUFFIX])
16126eaa481cSmrgAC_SUBST([MISC_MAN_SUFFIX])
16136eaa481cSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16146eaa481cSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16156eaa481cSmrgAC_SUBST([APP_MAN_DIR])
16166eaa481cSmrgAC_SUBST([LIB_MAN_DIR])
16176eaa481cSmrgAC_SUBST([FILE_MAN_DIR])
16186eaa481cSmrgAC_SUBST([MISC_MAN_DIR])
16196eaa481cSmrgAC_SUBST([DRIVER_MAN_DIR])
16206eaa481cSmrgAC_SUBST([ADMIN_MAN_DIR])
1621423b239cSmrg
16226eaa481cSmrgXORG_MAN_PAGE="X Version 11"
16236eaa481cSmrgAC_SUBST([XORG_MAN_PAGE])
16246eaa481cSmrgMAN_SUBSTS="\
16256eaa481cSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16266eaa481cSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16276eaa481cSmrg	-e 's|__xservername__|Xorg|g' \
16286eaa481cSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
16296eaa481cSmrg	-e 's|__projectroot__|\$(prefix)|g' \
16306eaa481cSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16316eaa481cSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16326eaa481cSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16336eaa481cSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16346eaa481cSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16356eaa481cSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16366eaa481cSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16376eaa481cSmrgAC_SUBST([MAN_SUBSTS])
1638423b239cSmrg
16396eaa481cSmrg]) # XORG_MANPAGE_SECTIONS
1640423b239cSmrg
16416eaa481cSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16426eaa481cSmrg# ------------------------
16436eaa481cSmrg# Minimum version: 1.7.0
1644a733a5bfSmrg#
16456eaa481cSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16466eaa481cSmrg# provided by xorg-sgml-doctools, if installed.
16476eaa481cSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16486eaa481cSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16496eaa481cSmrgXORG_SGML_PATH=
16506eaa481cSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16516eaa481cSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16526eaa481cSmrg    [m4_ifval([$1],[:],
16536eaa481cSmrg        [if test x"$cross_compiling" != x"yes" ; then
16546eaa481cSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16556eaa481cSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16566eaa481cSmrg         fi])
16576eaa481cSmrg    ])
16586eaa481cSmrg
16596eaa481cSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16606eaa481cSmrg# the path and the name of the doc stylesheet
16616eaa481cSmrgif test "x$XORG_SGML_PATH" != "x" ; then
16626eaa481cSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16636eaa481cSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16646eaa481cSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16656eaa481cSmrgelse
16666eaa481cSmrg   AC_MSG_RESULT([no])
16676eaa481cSmrgfi
16686eaa481cSmrg
16696eaa481cSmrgAC_SUBST(XORG_SGML_PATH)
16706eaa481cSmrgAC_SUBST(STYLESHEET_SRCDIR)
16716eaa481cSmrgAC_SUBST(XSL_STYLESHEET)
16726eaa481cSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16736eaa481cSmrg]) # XORG_CHECK_SGML_DOCTOOLS
16746eaa481cSmrg
16756eaa481cSmrg# XORG_CHECK_LINUXDOC
16766eaa481cSmrg# -------------------
16776eaa481cSmrg# Minimum version: 1.0.0
1678a733a5bfSmrg#
16796eaa481cSmrg# Defines the variable MAKE_TEXT if the necessary tools and
16806eaa481cSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16816eaa481cSmrg# Whether or not the necessary tools and files are found can be checked
16826eaa481cSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16836eaa481cSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16846eaa481cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16856eaa481cSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686a733a5bfSmrg
16876eaa481cSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688423b239cSmrg
16896eaa481cSmrgAC_MSG_CHECKING([whether to build documentation])
16906eaa481cSmrg
16916eaa481cSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16926eaa481cSmrg   BUILDDOC=yes
1693a733a5bfSmrgelse
16946eaa481cSmrg   BUILDDOC=no
1695a733a5bfSmrgfi
1696a733a5bfSmrg
16976eaa481cSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698a733a5bfSmrg
16996eaa481cSmrgAC_MSG_RESULT([$BUILDDOC])
1700423b239cSmrg
17016eaa481cSmrgAC_MSG_CHECKING([whether to build pdf documentation])
17026eaa481cSmrg
17036eaa481cSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17046eaa481cSmrg   BUILDPDFDOC=yes
17056eaa481cSmrgelse
17066eaa481cSmrg   BUILDPDFDOC=no
17076eaa481cSmrgfi
17086eaa481cSmrg
17096eaa481cSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17106eaa481cSmrg
17116eaa481cSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17126eaa481cSmrg
17136eaa481cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17146eaa481cSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17156eaa481cSmrgMAKE_PDF="$PS2PDF"
17166eaa481cSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17176eaa481cSmrg
17186eaa481cSmrgAC_SUBST(MAKE_TEXT)
17196eaa481cSmrgAC_SUBST(MAKE_PS)
17206eaa481cSmrgAC_SUBST(MAKE_PDF)
17216eaa481cSmrgAC_SUBST(MAKE_HTML)
17226eaa481cSmrg]) # XORG_CHECK_LINUXDOC
17236eaa481cSmrg
17246eaa481cSmrg# XORG_CHECK_DOCBOOK
17256eaa481cSmrg# -------------------
17266eaa481cSmrg# Minimum version: 1.0.0
17276eaa481cSmrg#
17286eaa481cSmrg# Checks for the ability to build output formats from SGML DocBook source.
17296eaa481cSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17306eaa481cSmrg# indicates whether the necessary tools and files are found and, if set,
17316eaa481cSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17326eaa481cSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17336eaa481cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17346eaa481cSmrg
17356eaa481cSmrgBUILDTXTDOC=no
17366eaa481cSmrgBUILDPDFDOC=no
17376eaa481cSmrgBUILDPSDOC=no
17386eaa481cSmrgBUILDHTMLDOC=no
17396eaa481cSmrg
17406eaa481cSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17416eaa481cSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17426eaa481cSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17436eaa481cSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744423b239cSmrg
17456eaa481cSmrgAC_MSG_CHECKING([whether to build text documentation])
17466eaa481cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17476eaa481cSmrg   test x$BUILD_TXTDOC != xno; then
17486eaa481cSmrg	BUILDTXTDOC=yes
17496eaa481cSmrgfi
17506eaa481cSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17516eaa481cSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752423b239cSmrg
17536eaa481cSmrgAC_MSG_CHECKING([whether to build PDF documentation])
17546eaa481cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17556eaa481cSmrg   test x$BUILD_PDFDOC != xno; then
17566eaa481cSmrg	BUILDPDFDOC=yes
17576eaa481cSmrgfi
17586eaa481cSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17596eaa481cSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760423b239cSmrg
17616eaa481cSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17626eaa481cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17636eaa481cSmrg   test x$BUILD_PSDOC != xno; then
17646eaa481cSmrg	BUILDPSDOC=yes
1765423b239cSmrgfi
17666eaa481cSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17676eaa481cSmrgAC_MSG_RESULT([$BUILDPSDOC])
1768423b239cSmrg
17696eaa481cSmrgAC_MSG_CHECKING([whether to build HTML documentation])
17706eaa481cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17716eaa481cSmrg   test x$BUILD_HTMLDOC != xno; then
17726eaa481cSmrg	BUILDHTMLDOC=yes
17736eaa481cSmrgfi
17746eaa481cSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17756eaa481cSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776423b239cSmrg
17776eaa481cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17786eaa481cSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17796eaa481cSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17806eaa481cSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17816eaa481cSmrg
17826eaa481cSmrgAC_SUBST(MAKE_TEXT)
17836eaa481cSmrgAC_SUBST(MAKE_PS)
17846eaa481cSmrgAC_SUBST(MAKE_PDF)
17856eaa481cSmrgAC_SUBST(MAKE_HTML)
17866eaa481cSmrg]) # XORG_CHECK_DOCBOOK
17876eaa481cSmrg
17886eaa481cSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17896eaa481cSmrg# ----------------
17906eaa481cSmrg# Minimum version: 1.5.0
17916eaa481cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1792a733a5bfSmrg#
17936eaa481cSmrg# Documentation tools are not always available on all platforms and sometimes
17946eaa481cSmrg# not at the appropriate level. This macro enables a module to test for the
17956eaa481cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
17966eaa481cSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
17976eaa481cSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17986eaa481cSmrg# --with-xmlto assumes 'auto'.
1799a733a5bfSmrg#
18006eaa481cSmrg# Interface to module:
18016eaa481cSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18026eaa481cSmrg# XMLTO:	returns the path of the xmlto program found
18036eaa481cSmrg#		returns the path set by the user in the environment
18046eaa481cSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18056eaa481cSmrg#		'no' user instructs the module not to use xmlto
1806a733a5bfSmrg#
18076eaa481cSmrg# Added in version 1.10.0
18086eaa481cSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18096eaa481cSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810a733a5bfSmrg#
18116eaa481cSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812a733a5bfSmrg#
18136eaa481cSmrgAC_DEFUN([XORG_WITH_XMLTO],[
18146eaa481cSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18156eaa481cSmrgm4_define([_defopt], m4_default([$2], [auto]))
18166eaa481cSmrgAC_ARG_WITH(xmlto,
18176eaa481cSmrg	AS_HELP_STRING([--with-xmlto],
18186eaa481cSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18196eaa481cSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18206eaa481cSmrgm4_undefine([_defopt])
1821a733a5bfSmrg
18226eaa481cSmrgif test "x$use_xmlto" = x"auto"; then
18236eaa481cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
18246eaa481cSmrg   if test "x$XMLTO" = "x"; then
18256eaa481cSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18266eaa481cSmrg	have_xmlto=no
18276eaa481cSmrg   else
18286eaa481cSmrg        have_xmlto=yes
18296eaa481cSmrg   fi
18306eaa481cSmrgelif test "x$use_xmlto" = x"yes" ; then
18316eaa481cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
18326eaa481cSmrg   if test "x$XMLTO" = "x"; then
18336eaa481cSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18346eaa481cSmrg   fi
18356eaa481cSmrg   have_xmlto=yes
18366eaa481cSmrgelif test "x$use_xmlto" = x"no" ; then
18376eaa481cSmrg   if test "x$XMLTO" != "x"; then
18386eaa481cSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18396eaa481cSmrg   fi
18406eaa481cSmrg   have_xmlto=no
18416eaa481cSmrgelse
18426eaa481cSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18436eaa481cSmrgfi
1844a733a5bfSmrg
18456eaa481cSmrg# Test for a minimum version of xmlto, if provided.
18466eaa481cSmrgm4_ifval([$1],
18476eaa481cSmrg[if test "$have_xmlto" = yes; then
18486eaa481cSmrg    # scrape the xmlto version
18496eaa481cSmrg    AC_MSG_CHECKING([the xmlto version])
18506eaa481cSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18516eaa481cSmrg    AC_MSG_RESULT([$xmlto_version])
18526eaa481cSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18536eaa481cSmrg        [if test "x$use_xmlto" = xauto; then
18546eaa481cSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18556eaa481cSmrg            have_xmlto=no
18566eaa481cSmrg        else
18576eaa481cSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18586eaa481cSmrg        fi])
18596eaa481cSmrgfi])
1860a733a5bfSmrg
18616eaa481cSmrg# Test for the ability of xmlto to generate a text target
18626eaa481cSmrg#
18636eaa481cSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18646eaa481cSmrg# following test for empty XML docbook files.
18656eaa481cSmrg# For compatibility reasons use the following empty XML docbook file and if
18666eaa481cSmrg# it fails try it again with a non-empty XML file.
18676eaa481cSmrghave_xmlto_text=no
18686eaa481cSmrgcat > conftest.xml << "EOF"
18696eaa481cSmrgEOF
18706eaa481cSmrgAS_IF([test "$have_xmlto" = yes],
18716eaa481cSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18726eaa481cSmrg             [have_xmlto_text=yes],
18736eaa481cSmrg             [# Try it again with a non-empty XML file.
18746eaa481cSmrg              cat > conftest.xml << "EOF"
18756eaa481cSmrg<x></x>
18766eaa481cSmrgEOF
18776eaa481cSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18786eaa481cSmrg                    [have_xmlto_text=yes],
18796eaa481cSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
18806eaa481cSmrgrm -f conftest.xml
18816eaa481cSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18826eaa481cSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18836eaa481cSmrg]) # XORG_WITH_XMLTO
1884423b239cSmrg
18856eaa481cSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18866eaa481cSmrg# --------------------------------------------
18876eaa481cSmrg# Minimum version: 1.12.0
18886eaa481cSmrg# Minimum version for optional DEFAULT argument: 1.12.0
18896eaa481cSmrg#
18906eaa481cSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18916eaa481cSmrg# XML-based language used for the transformation of XML documents.
18926eaa481cSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18936eaa481cSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18946eaa481cSmrg# The XSLT processor is often used as a standalone tool for transformations.
18956eaa481cSmrg# It should not be assumed that this tool is used only to work with documnetation.
18966eaa481cSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18976eaa481cSmrg#
18986eaa481cSmrg# Interface to module:
18996eaa481cSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19006eaa481cSmrg# XSLTPROC:	 returns the path of the xsltproc program found
19016eaa481cSmrg#		 returns the path set by the user in the environment
19026eaa481cSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19036eaa481cSmrg#		  'no' user instructs the module not to use xsltproc
19046eaa481cSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19056eaa481cSmrg#
19066eaa481cSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19076eaa481cSmrg#
19086eaa481cSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19096eaa481cSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19106eaa481cSmrg# Preserves the interface, should it be implemented later
19116eaa481cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19126eaa481cSmrgm4_define([_defopt], m4_default([$2], [auto]))
19136eaa481cSmrgAC_ARG_WITH(xsltproc,
19146eaa481cSmrg	AS_HELP_STRING([--with-xsltproc],
19156eaa481cSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19166eaa481cSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19176eaa481cSmrgm4_undefine([_defopt])
1918423b239cSmrg
19196eaa481cSmrgif test "x$use_xsltproc" = x"auto"; then
19206eaa481cSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19216eaa481cSmrg   if test "x$XSLTPROC" = "x"; then
19226eaa481cSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19236eaa481cSmrg	have_xsltproc=no
19246eaa481cSmrg   else
19256eaa481cSmrg        have_xsltproc=yes
19266eaa481cSmrg   fi
19276eaa481cSmrgelif test "x$use_xsltproc" = x"yes" ; then
19286eaa481cSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19296eaa481cSmrg   if test "x$XSLTPROC" = "x"; then
19306eaa481cSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19316eaa481cSmrg   fi
19326eaa481cSmrg   have_xsltproc=yes
19336eaa481cSmrgelif test "x$use_xsltproc" = x"no" ; then
19346eaa481cSmrg   if test "x$XSLTPROC" != "x"; then
19356eaa481cSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19366eaa481cSmrg   fi
19376eaa481cSmrg   have_xsltproc=no
19386eaa481cSmrgelse
19396eaa481cSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940423b239cSmrgfi
1941423b239cSmrg
19426eaa481cSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19436eaa481cSmrg]) # XORG_WITH_XSLTPROC
19446eaa481cSmrg
19456eaa481cSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19466eaa481cSmrg# ----------------------------------------
19476eaa481cSmrg# Minimum version: 1.15.0
1948ce62200cSmrg#
19496eaa481cSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
19506eaa481cSmrg# scanning arbitrary text files, extracting information from those text files,
19516eaa481cSmrg# and printing reports based on that information.
1952ce62200cSmrg#
19536eaa481cSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954ce62200cSmrg#
19556eaa481cSmrg# Interface to module:
19566eaa481cSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
19576eaa481cSmrg# PERL:	     returns the path of the perl program found
19586eaa481cSmrg#	     returns the path set by the user in the environment
19596eaa481cSmrg# --with-perl: 'yes' user instructs the module to use perl
19606eaa481cSmrg#	       'no' user instructs the module not to use perl
19616eaa481cSmrg# have_perl: returns yes if perl found in PATH or no
1962ce62200cSmrg#
19636eaa481cSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19646eaa481cSmrg#
19656eaa481cSmrgAC_DEFUN([XORG_WITH_PERL],[
19666eaa481cSmrgAC_ARG_VAR([PERL], [Path to perl command])
19676eaa481cSmrg# Preserves the interface, should it be implemented later
19686eaa481cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
19696eaa481cSmrgm4_define([_defopt], m4_default([$2], [auto]))
19706eaa481cSmrgAC_ARG_WITH(perl,
19716eaa481cSmrg	AS_HELP_STRING([--with-perl],
19726eaa481cSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
19736eaa481cSmrg	   [use_perl=$withval], [use_perl=]_defopt)
19746eaa481cSmrgm4_undefine([_defopt])
1975ce62200cSmrg
19766eaa481cSmrgif test "x$use_perl" = x"auto"; then
19776eaa481cSmrg   AC_PATH_PROG([PERL], [perl])
19786eaa481cSmrg   if test "x$PERL" = "x"; then
19796eaa481cSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19806eaa481cSmrg	have_perl=no
19816eaa481cSmrg   else
19826eaa481cSmrg        have_perl=yes
19836eaa481cSmrg   fi
19846eaa481cSmrgelif test "x$use_perl" = x"yes" ; then
19856eaa481cSmrg   AC_PATH_PROG([PERL], [perl])
19866eaa481cSmrg   if test "x$PERL" = "x"; then
19876eaa481cSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19886eaa481cSmrg   fi
19896eaa481cSmrg   have_perl=yes
19906eaa481cSmrgelif test "x$use_perl" = x"no" ; then
19916eaa481cSmrg   if test "x$PERL" != "x"; then
19926eaa481cSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19936eaa481cSmrg   fi
19946eaa481cSmrg   have_perl=no
19956eaa481cSmrgelse
19966eaa481cSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19976eaa481cSmrgfi
1998423b239cSmrg
19996eaa481cSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20006eaa481cSmrg]) # XORG_WITH_PERL
2001423b239cSmrg
20026eaa481cSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003423b239cSmrg# ----------------
20046eaa481cSmrg# Minimum version: 1.5.0
20056eaa481cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2006ce62200cSmrg#
20076eaa481cSmrg# Documentation tools are not always available on all platforms and sometimes
20086eaa481cSmrg# not at the appropriate level. This macro enables a module to test for the
20096eaa481cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20106eaa481cSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
20116eaa481cSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20126eaa481cSmrg# --with-asciidoc assumes 'auto'.
2013ce62200cSmrg#
20146eaa481cSmrg# Interface to module:
20156eaa481cSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20166eaa481cSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
20176eaa481cSmrg#		 returns the path set by the user in the environment
20186eaa481cSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20196eaa481cSmrg#		  'no' user instructs the module not to use asciidoc
2020ce62200cSmrg#
20216eaa481cSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2022ce62200cSmrg#
20236eaa481cSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20246eaa481cSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20256eaa481cSmrgm4_define([_defopt], m4_default([$2], [auto]))
20266eaa481cSmrgAC_ARG_WITH(asciidoc,
20276eaa481cSmrg	AS_HELP_STRING([--with-asciidoc],
20286eaa481cSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20296eaa481cSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20306eaa481cSmrgm4_undefine([_defopt])
2031423b239cSmrg
20326eaa481cSmrgif test "x$use_asciidoc" = x"auto"; then
20336eaa481cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20346eaa481cSmrg   if test "x$ASCIIDOC" = "x"; then
20356eaa481cSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20366eaa481cSmrg	have_asciidoc=no
20376eaa481cSmrg   else
20386eaa481cSmrg        have_asciidoc=yes
20396eaa481cSmrg   fi
20406eaa481cSmrgelif test "x$use_asciidoc" = x"yes" ; then
20416eaa481cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20426eaa481cSmrg   if test "x$ASCIIDOC" = "x"; then
20436eaa481cSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20446eaa481cSmrg   fi
20456eaa481cSmrg   have_asciidoc=yes
20466eaa481cSmrgelif test "x$use_asciidoc" = x"no" ; then
20476eaa481cSmrg   if test "x$ASCIIDOC" != "x"; then
20486eaa481cSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20496eaa481cSmrg   fi
20506eaa481cSmrg   have_asciidoc=no
20516eaa481cSmrgelse
20526eaa481cSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20536eaa481cSmrgfi
20546eaa481cSmrgm4_ifval([$1],
20556eaa481cSmrg[if test "$have_asciidoc" = yes; then
20566eaa481cSmrg    # scrape the asciidoc version
20576eaa481cSmrg    AC_MSG_CHECKING([the asciidoc version])
20586eaa481cSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20596eaa481cSmrg    AC_MSG_RESULT([$asciidoc_version])
20606eaa481cSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20616eaa481cSmrg        [if test "x$use_asciidoc" = xauto; then
20626eaa481cSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20636eaa481cSmrg            have_asciidoc=no
20646eaa481cSmrg        else
20656eaa481cSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20666eaa481cSmrg        fi])
20676eaa481cSmrgfi])
20686eaa481cSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20696eaa481cSmrg]) # XORG_WITH_ASCIIDOC
2070423b239cSmrg
20716eaa481cSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20726eaa481cSmrg# -------------------------------------------
20736eaa481cSmrg# Minimum version: 1.5.0
20746eaa481cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20756eaa481cSmrg# Minimum version for optional DOT checking: 1.18.0
2076ce62200cSmrg#
20776eaa481cSmrg# Documentation tools are not always available on all platforms and sometimes
20786eaa481cSmrg# not at the appropriate level. This macro enables a module to test for the
20796eaa481cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20806eaa481cSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
20816eaa481cSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20826eaa481cSmrg# --with-doxygen assumes 'auto'.
2083ce62200cSmrg#
20846eaa481cSmrg# Interface to module:
20856eaa481cSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20866eaa481cSmrg# DOXYGEN:	 returns the path of the doxygen program found
20876eaa481cSmrg#		 returns the path set by the user in the environment
20886eaa481cSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20896eaa481cSmrg#		  'no' user instructs the module not to use doxygen
2090ce62200cSmrg#
20916eaa481cSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092423b239cSmrg#
20936eaa481cSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20946eaa481cSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20956eaa481cSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20966eaa481cSmrgm4_define([_defopt], m4_default([$2], [auto]))
20976eaa481cSmrgAC_ARG_WITH(doxygen,
20986eaa481cSmrg	AS_HELP_STRING([--with-doxygen],
20996eaa481cSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21006eaa481cSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21016eaa481cSmrgm4_undefine([_defopt])
2102423b239cSmrg
21036eaa481cSmrgif test "x$use_doxygen" = x"auto"; then
21046eaa481cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21056eaa481cSmrg   if test "x$DOXYGEN" = "x"; then
21066eaa481cSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21076eaa481cSmrg	have_doxygen=no
21086eaa481cSmrg   else
21096eaa481cSmrg        have_doxygen=yes
21106eaa481cSmrg   fi
21116eaa481cSmrgelif test "x$use_doxygen" = x"yes" ; then
21126eaa481cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21136eaa481cSmrg   if test "x$DOXYGEN" = "x"; then
21146eaa481cSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21156eaa481cSmrg   fi
21166eaa481cSmrg   have_doxygen=yes
21176eaa481cSmrgelif test "x$use_doxygen" = x"no" ; then
21186eaa481cSmrg   if test "x$DOXYGEN" != "x"; then
21196eaa481cSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21206eaa481cSmrg   fi
21216eaa481cSmrg   have_doxygen=no
2122ce62200cSmrgelse
21236eaa481cSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124ce62200cSmrgfi
21256eaa481cSmrgm4_ifval([$1],
21266eaa481cSmrg[if test "$have_doxygen" = yes; then
21276eaa481cSmrg    # scrape the doxygen version
21286eaa481cSmrg    AC_MSG_CHECKING([the doxygen version])
21296eaa481cSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21306eaa481cSmrg    AC_MSG_RESULT([$doxygen_version])
21316eaa481cSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21326eaa481cSmrg        [if test "x$use_doxygen" = xauto; then
21336eaa481cSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21346eaa481cSmrg            have_doxygen=no
21356eaa481cSmrg        else
21366eaa481cSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21376eaa481cSmrg        fi])
21386eaa481cSmrgfi])
2139ce62200cSmrg
21406eaa481cSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21416eaa481cSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21426eaa481cSmrgdnl 	HAVE_DOT = @HAVE_DOT@
21436eaa481cSmrgHAVE_DOT=no
21446eaa481cSmrgif test "x$have_doxygen" = "xyes"; then
21456eaa481cSmrg  AC_PATH_PROG([DOT], [dot])
21466eaa481cSmrg    if test "x$DOT" != "x"; then
21476eaa481cSmrg      HAVE_DOT=yes
21486eaa481cSmrg    fi
21496eaa481cSmrgfi
2150ce62200cSmrg
21516eaa481cSmrgAC_SUBST([HAVE_DOT])
21526eaa481cSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21536eaa481cSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21546eaa481cSmrg]) # XORG_WITH_DOXYGEN
2155423b239cSmrg
21566eaa481cSmrg# XORG_WITH_GROFF([DEFAULT])
21576eaa481cSmrg# ----------------
21586eaa481cSmrg# Minimum version: 1.6.0
21596eaa481cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2160ce62200cSmrg#
21616eaa481cSmrg# Documentation tools are not always available on all platforms and sometimes
21626eaa481cSmrg# not at the appropriate level. This macro enables a module to test for the
21636eaa481cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
21646eaa481cSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
21656eaa481cSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
21666eaa481cSmrg# --with-groff assumes 'auto'.
21676eaa481cSmrg#
21686eaa481cSmrg# Interface to module:
21696eaa481cSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21706eaa481cSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21716eaa481cSmrg# HAVE_GROFF_MS: the -ms macros package
21726eaa481cSmrg# GROFF:	 returns the path of the groff program found
21736eaa481cSmrg#		 returns the path set by the user in the environment
21746eaa481cSmrg# --with-groff:	 'yes' user instructs the module to use groff
21756eaa481cSmrg#		 'no' user instructs the module not to use groff
21766eaa481cSmrg#
21776eaa481cSmrg# Added in version 1.9.0:
21786eaa481cSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21796eaa481cSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21806eaa481cSmrg#		   psselect from the psutils package.
21816eaa481cSmrg#		   the ghostcript package. Refer to the grohtml man pages
21826eaa481cSmrg#
21836eaa481cSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21846eaa481cSmrg#
21856eaa481cSmrg# OS and distros often splits groff in a basic and full package, the former
21866eaa481cSmrg# having the groff program and the later having devices, fonts and macros
21876eaa481cSmrg# Checking for the groff executable is not enough.
21886eaa481cSmrg#
21896eaa481cSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
21906eaa481cSmrg# unset HAVE_GROFF or GROFF env variables.
21916eaa481cSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21926eaa481cSmrg#
21936eaa481cSmrgAC_DEFUN([XORG_WITH_GROFF],[
21946eaa481cSmrgAC_ARG_VAR([GROFF], [Path to groff command])
21956eaa481cSmrgm4_define([_defopt], m4_default([$1], [auto]))
21966eaa481cSmrgAC_ARG_WITH(groff,
21976eaa481cSmrg	AS_HELP_STRING([--with-groff],
21986eaa481cSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21996eaa481cSmrg	   [use_groff=$withval], [use_groff=]_defopt)
22006eaa481cSmrgm4_undefine([_defopt])
22011b983734Smrg
22026eaa481cSmrgif test "x$use_groff" = x"auto"; then
22036eaa481cSmrg   AC_PATH_PROG([GROFF], [groff])
22046eaa481cSmrg   if test "x$GROFF" = "x"; then
22056eaa481cSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22066eaa481cSmrg	have_groff=no
22076eaa481cSmrg   else
22086eaa481cSmrg        have_groff=yes
22096eaa481cSmrg   fi
22106eaa481cSmrgelif test "x$use_groff" = x"yes" ; then
22116eaa481cSmrg   AC_PATH_PROG([GROFF], [groff])
22126eaa481cSmrg   if test "x$GROFF" = "x"; then
22136eaa481cSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22146eaa481cSmrg   fi
22156eaa481cSmrg   have_groff=yes
22166eaa481cSmrgelif test "x$use_groff" = x"no" ; then
22176eaa481cSmrg   if test "x$GROFF" != "x"; then
22186eaa481cSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22196eaa481cSmrg   fi
22206eaa481cSmrg   have_groff=no
22216eaa481cSmrgelse
22226eaa481cSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22236eaa481cSmrgfi
22241b983734Smrg
22256eaa481cSmrg# We have groff, test for the presence of the macro packages
22266eaa481cSmrgif test "x$have_groff" = x"yes"; then
22276eaa481cSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22286eaa481cSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22296eaa481cSmrg        groff_ms_works=yes
22306eaa481cSmrg    else
22316eaa481cSmrg        groff_ms_works=no
2232423b239cSmrg    fi
22336eaa481cSmrg    AC_MSG_RESULT([$groff_ms_works])
22346eaa481cSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22356eaa481cSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22366eaa481cSmrg        groff_mm_works=yes
22376eaa481cSmrg    else
22386eaa481cSmrg        groff_mm_works=no
22396eaa481cSmrg    fi
22406eaa481cSmrg    AC_MSG_RESULT([$groff_mm_works])
22416eaa481cSmrgfi
2242ce62200cSmrg
22436eaa481cSmrg# We have groff, test for HTML dependencies, one command per package
22446eaa481cSmrgif test "x$have_groff" = x"yes"; then
22456eaa481cSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22466eaa481cSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22476eaa481cSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22486eaa481cSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22496eaa481cSmrg      have_groff_html=yes
22506eaa481cSmrg   else
22516eaa481cSmrg      have_groff_html=no
22526eaa481cSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22536eaa481cSmrg   fi
22546eaa481cSmrgfi
22556eaa481cSmrg
22566eaa481cSmrg# Set Automake conditionals for Makefiles
22576eaa481cSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22586eaa481cSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22596eaa481cSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22606eaa481cSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22616eaa481cSmrg]) # XORG_WITH_GROFF
22626eaa481cSmrg
22636eaa481cSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22646eaa481cSmrg# ---------------------------------------
22656eaa481cSmrg# Minimum version: 1.6.0
22666eaa481cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
22676eaa481cSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
22686eaa481cSmrg#
22696eaa481cSmrg# Documentation tools are not always available on all platforms and sometimes
22706eaa481cSmrg# not at the appropriate level. This macro enables a module to test for the
22716eaa481cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
22726eaa481cSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
22736eaa481cSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
22746eaa481cSmrg# --with-fop assumes 'auto'.
22756eaa481cSmrg#
22766eaa481cSmrg# Interface to module:
22776eaa481cSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22786eaa481cSmrg# FOP:	 	returns the path of the fop program found
22796eaa481cSmrg#		returns the path set by the user in the environment
22806eaa481cSmrg# --with-fop: 	'yes' user instructs the module to use fop
22816eaa481cSmrg#		'no' user instructs the module not to use fop
22826eaa481cSmrg#
22836eaa481cSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22846eaa481cSmrg#
22856eaa481cSmrgAC_DEFUN([XORG_WITH_FOP],[
22866eaa481cSmrgAC_ARG_VAR([FOP], [Path to fop command])
22876eaa481cSmrgm4_define([_defopt], m4_default([$2], [auto]))
22886eaa481cSmrgAC_ARG_WITH(fop,
22896eaa481cSmrg	AS_HELP_STRING([--with-fop],
22906eaa481cSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22916eaa481cSmrg	   [use_fop=$withval], [use_fop=]_defopt)
22926eaa481cSmrgm4_undefine([_defopt])
22936eaa481cSmrg
22946eaa481cSmrgif test "x$use_fop" = x"auto"; then
22956eaa481cSmrg   AC_PATH_PROG([FOP], [fop])
22966eaa481cSmrg   if test "x$FOP" = "x"; then
22976eaa481cSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22986eaa481cSmrg	have_fop=no
22996eaa481cSmrg   else
23006eaa481cSmrg        have_fop=yes
23016eaa481cSmrg   fi
23026eaa481cSmrgelif test "x$use_fop" = x"yes" ; then
23036eaa481cSmrg   AC_PATH_PROG([FOP], [fop])
23046eaa481cSmrg   if test "x$FOP" = "x"; then
23056eaa481cSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23066eaa481cSmrg   fi
23076eaa481cSmrg   have_fop=yes
23086eaa481cSmrgelif test "x$use_fop" = x"no" ; then
23096eaa481cSmrg   if test "x$FOP" != "x"; then
23106eaa481cSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23116eaa481cSmrg   fi
23126eaa481cSmrg   have_fop=no
2313ce62200cSmrgelse
23146eaa481cSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315ce62200cSmrgfi
2316ce62200cSmrg
23176eaa481cSmrg# Test for a minimum version of fop, if provided.
23186eaa481cSmrgm4_ifval([$1],
23196eaa481cSmrg[if test "$have_fop" = yes; then
23206eaa481cSmrg    # scrape the fop version
23216eaa481cSmrg    AC_MSG_CHECKING([for fop minimum version])
23226eaa481cSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23236eaa481cSmrg    AC_MSG_RESULT([$fop_version])
23246eaa481cSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
23256eaa481cSmrg        [if test "x$use_fop" = xauto; then
23266eaa481cSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23276eaa481cSmrg            have_fop=no
23286eaa481cSmrg        else
23296eaa481cSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23306eaa481cSmrg        fi])
23316eaa481cSmrgfi])
23326eaa481cSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23336eaa481cSmrg]) # XORG_WITH_FOP
23346eaa481cSmrg
23356eaa481cSmrg# XORG_WITH_M4([MIN-VERSION])
23366eaa481cSmrg# ---------------------------
23376eaa481cSmrg# Minimum version: 1.19.0
23386eaa481cSmrg#
23396eaa481cSmrg# This macro attempts to locate an m4 macro processor which supports
23406eaa481cSmrg# -I option and is only useful for modules relying on M4 in order to
23416eaa481cSmrg# expand macros in source code files.
23426eaa481cSmrg#
23436eaa481cSmrg# Interface to module:
23446eaa481cSmrg# M4:	 	returns the path of the m4 program found
23456eaa481cSmrg#		returns the path set by the user in the environment
23466eaa481cSmrg#
23476eaa481cSmrgAC_DEFUN([XORG_WITH_M4], [
23486eaa481cSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23496eaa481cSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23506eaa481cSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23516eaa481cSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23526eaa481cSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23536eaa481cSmrg   [$PATH:/usr/gnu/bin])])
2354ce62200cSmrg
23556eaa481cSmrgAC_SUBST([M4], [$ac_cv_path_M4])
23566eaa481cSmrg]) # XORG_WITH_M4
2357423b239cSmrg
23586eaa481cSmrg# XORG_WITH_PS2PDF([DEFAULT])
23596eaa481cSmrg# ----------------
23606eaa481cSmrg# Minimum version: 1.6.0
23616eaa481cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
23626eaa481cSmrg#
23636eaa481cSmrg# Documentation tools are not always available on all platforms and sometimes
23646eaa481cSmrg# not at the appropriate level. This macro enables a module to test for the
23656eaa481cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
23666eaa481cSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
23676eaa481cSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23686eaa481cSmrg# --with-ps2pdf assumes 'auto'.
23696eaa481cSmrg#
23706eaa481cSmrg# Interface to module:
23716eaa481cSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23726eaa481cSmrg# PS2PDF:	returns the path of the ps2pdf program found
23736eaa481cSmrg#		returns the path set by the user in the environment
23746eaa481cSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23756eaa481cSmrg#		 'no' user instructs the module not to use ps2pdf
23766eaa481cSmrg#
23776eaa481cSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23786eaa481cSmrg#
23796eaa481cSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23806eaa481cSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23816eaa481cSmrgm4_define([_defopt], m4_default([$1], [auto]))
23826eaa481cSmrgAC_ARG_WITH(ps2pdf,
23836eaa481cSmrg	AS_HELP_STRING([--with-ps2pdf],
23846eaa481cSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23856eaa481cSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23866eaa481cSmrgm4_undefine([_defopt])
2387423b239cSmrg
23886eaa481cSmrgif test "x$use_ps2pdf" = x"auto"; then
23896eaa481cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23906eaa481cSmrg   if test "x$PS2PDF" = "x"; then
23916eaa481cSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23926eaa481cSmrg	have_ps2pdf=no
23936eaa481cSmrg   else
23946eaa481cSmrg        have_ps2pdf=yes
23956eaa481cSmrg   fi
23966eaa481cSmrgelif test "x$use_ps2pdf" = x"yes" ; then
23976eaa481cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23986eaa481cSmrg   if test "x$PS2PDF" = "x"; then
23996eaa481cSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24006eaa481cSmrg   fi
24016eaa481cSmrg   have_ps2pdf=yes
24026eaa481cSmrgelif test "x$use_ps2pdf" = x"no" ; then
24036eaa481cSmrg   if test "x$PS2PDF" != "x"; then
24046eaa481cSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24056eaa481cSmrg   fi
24066eaa481cSmrg   have_ps2pdf=no
24076eaa481cSmrgelse
24086eaa481cSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409423b239cSmrgfi
24106eaa481cSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24116eaa481cSmrg]) # XORG_WITH_PS2PDF
2412ce62200cSmrg
24136eaa481cSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
24146eaa481cSmrg# ----------------
24156eaa481cSmrg# Minimum version: 1.6.0
2416a733a5bfSmrg#
24176eaa481cSmrg# Documentation tools are not always available on all platforms and sometimes
24186eaa481cSmrg# not at the appropriate level. This macro enables a builder to skip all
24196eaa481cSmrg# documentation targets except traditional man pages.
24206eaa481cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24216eaa481cSmrg# maximum flexibilty in controlling documentation building.
24226eaa481cSmrg# Refer to:
24236eaa481cSmrg# XORG_WITH_XMLTO         --with-xmlto
24246eaa481cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24256eaa481cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24266eaa481cSmrg# XORG_WITH_FOP           --with-fop
24276eaa481cSmrg# XORG_WITH_GROFF         --with-groff
24286eaa481cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24296eaa481cSmrg#
24306eaa481cSmrg# Interface to module:
24316eaa481cSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24326eaa481cSmrg# --enable-docs: 'yes' user instructs the module to generate docs
24336eaa481cSmrg#		 'no' user instructs the module not to generate docs
24346eaa481cSmrg# parm1:	specify the default value, yes or no.
24356eaa481cSmrg#
24366eaa481cSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24376eaa481cSmrgm4_define([docs_default], m4_default([$1], [yes]))
24386eaa481cSmrgAC_ARG_ENABLE(docs,
24396eaa481cSmrg	AS_HELP_STRING([--enable-docs],
24406eaa481cSmrg	   [Enable building the documentation (default: ]docs_default[)]),
24416eaa481cSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
24426eaa481cSmrgm4_undefine([docs_default])
24436eaa481cSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24446eaa481cSmrgAC_MSG_CHECKING([whether to build documentation])
24456eaa481cSmrgAC_MSG_RESULT([$build_docs])
24466eaa481cSmrg]) # XORG_ENABLE_DOCS
2447a733a5bfSmrg
24486eaa481cSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24496eaa481cSmrg# ----------------
24506eaa481cSmrg# Minimum version: 1.6.0
24516eaa481cSmrg#
24526eaa481cSmrg# This macro enables a builder to skip all developer documentation.
24536eaa481cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24546eaa481cSmrg# maximum flexibilty in controlling documentation building.
24556eaa481cSmrg# Refer to:
24566eaa481cSmrg# XORG_WITH_XMLTO         --with-xmlto
24576eaa481cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24586eaa481cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24596eaa481cSmrg# XORG_WITH_FOP           --with-fop
24606eaa481cSmrg# XORG_WITH_GROFF         --with-groff
24616eaa481cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24626eaa481cSmrg#
24636eaa481cSmrg# Interface to module:
24646eaa481cSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24656eaa481cSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24666eaa481cSmrg#			'no' user instructs the module not to generate developer docs
24676eaa481cSmrg# parm1:		specify the default value, yes or no.
24686eaa481cSmrg#
24696eaa481cSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24706eaa481cSmrgm4_define([devel_default], m4_default([$1], [yes]))
24716eaa481cSmrgAC_ARG_ENABLE(devel-docs,
24726eaa481cSmrg	AS_HELP_STRING([--enable-devel-docs],
24736eaa481cSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24746eaa481cSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24756eaa481cSmrgm4_undefine([devel_default])
24766eaa481cSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24776eaa481cSmrgAC_MSG_CHECKING([whether to build developer documentation])
24786eaa481cSmrgAC_MSG_RESULT([$build_devel_docs])
24796eaa481cSmrg]) # XORG_ENABLE_DEVEL_DOCS
2480423b239cSmrg
24816eaa481cSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
24826eaa481cSmrg# ----------------
24836eaa481cSmrg# Minimum version: 1.6.0
24846eaa481cSmrg#
24856eaa481cSmrg# This macro enables a builder to skip all functional specification targets.
24866eaa481cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24876eaa481cSmrg# maximum flexibilty in controlling documentation building.
24886eaa481cSmrg# Refer to:
24896eaa481cSmrg# XORG_WITH_XMLTO         --with-xmlto
24906eaa481cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24916eaa481cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24926eaa481cSmrg# XORG_WITH_FOP           --with-fop
24936eaa481cSmrg# XORG_WITH_GROFF         --with-groff
24946eaa481cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24956eaa481cSmrg#
24966eaa481cSmrg# Interface to module:
24976eaa481cSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24986eaa481cSmrg# --enable-specs:	'yes' user instructs the module to generate specs
24996eaa481cSmrg#			'no' user instructs the module not to generate specs
25006eaa481cSmrg# parm1:		specify the default value, yes or no.
25016eaa481cSmrg#
25026eaa481cSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25036eaa481cSmrgm4_define([spec_default], m4_default([$1], [yes]))
25046eaa481cSmrgAC_ARG_ENABLE(specs,
25056eaa481cSmrg	AS_HELP_STRING([--enable-specs],
25066eaa481cSmrg	   [Enable building the specs (default: ]spec_default[)]),
25076eaa481cSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
25086eaa481cSmrgm4_undefine([spec_default])
25096eaa481cSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25106eaa481cSmrgAC_MSG_CHECKING([whether to build functional specifications])
25116eaa481cSmrgAC_MSG_RESULT([$build_specs])
25126eaa481cSmrg]) # XORG_ENABLE_SPECS
2513423b239cSmrg
25146eaa481cSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25156eaa481cSmrg# ----------------------------------------------
25166eaa481cSmrg# Minimum version: 1.13.0
2517a733a5bfSmrg#
25186eaa481cSmrg# This macro enables a builder to enable/disable unit testing
25196eaa481cSmrg# It makes no assumption about the test cases implementation
25206eaa481cSmrg# Test cases may or may not use Automake "Support for test suites"
25216eaa481cSmrg# They may or may not use the software utility library GLib
25226eaa481cSmrg#
25236eaa481cSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25246eaa481cSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25256eaa481cSmrg# The variable enable_unit_tests is used by other macros in this file.
25266eaa481cSmrg#
25276eaa481cSmrg# Interface to module:
25286eaa481cSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25296eaa481cSmrg# enable_unit_tests:    used in configure.ac for additional configuration
25306eaa481cSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25316eaa481cSmrg#			'no' user instructs the module not to build tests
25326eaa481cSmrg# parm1:		specify the default value, yes or no.
25336eaa481cSmrg#
25346eaa481cSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25356eaa481cSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25366eaa481cSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25376eaa481cSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25386eaa481cSmrgm4_define([_defopt], m4_default([$1], [auto]))
25396eaa481cSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25406eaa481cSmrg	[Enable building unit test cases (default: ]_defopt[)]),
25416eaa481cSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25426eaa481cSmrgm4_undefine([_defopt])
25436eaa481cSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25446eaa481cSmrgAC_MSG_CHECKING([whether to build unit test cases])
25456eaa481cSmrgAC_MSG_RESULT([$enable_unit_tests])
25466eaa481cSmrg]) # XORG_ENABLE_UNIT_TESTS
2547423b239cSmrg
25486eaa481cSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25496eaa481cSmrg# ------------------------------------------------------
25506eaa481cSmrg# Minimum version: 1.17.0
25516eaa481cSmrg#
25526eaa481cSmrg# This macro enables a builder to enable/disable integration testing
25536eaa481cSmrg# It makes no assumption about the test cases' implementation
25546eaa481cSmrg# Test cases may or may not use Automake "Support for test suites"
25556eaa481cSmrg#
25566eaa481cSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25576eaa481cSmrg# usually requires less dependencies and may be built and run under less
25586eaa481cSmrg# stringent environments than integration tests.
25596eaa481cSmrg#
25606eaa481cSmrg# Interface to module:
25616eaa481cSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25626eaa481cSmrg# enable_integration_tests:   used in configure.ac for additional configuration
25636eaa481cSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25646eaa481cSmrg#                             'no' user instructs the module not to build tests
25656eaa481cSmrg# parm1:                      specify the default value, yes or no.
25666eaa481cSmrg#
25676eaa481cSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
25686eaa481cSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25696eaa481cSmrgm4_define([_defopt], m4_default([$1], [auto]))
25706eaa481cSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
25716eaa481cSmrg	[Enable building integration test cases (default: ]_defopt[)]),
25726eaa481cSmrg	[enable_integration_tests=$enableval],
25736eaa481cSmrg	[enable_integration_tests=]_defopt)
25746eaa481cSmrgm4_undefine([_defopt])
25756eaa481cSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
25766eaa481cSmrg	[test "x$enable_integration_tests" != xno])
25776eaa481cSmrgAC_MSG_CHECKING([whether to build unit test cases])
25786eaa481cSmrgAC_MSG_RESULT([$enable_integration_tests])
25796eaa481cSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580423b239cSmrg
25816eaa481cSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25826eaa481cSmrg# ----------------------------------------
25836eaa481cSmrg# Minimum version: 1.13.0
25846eaa481cSmrg#
25856eaa481cSmrg# GLib is a library which provides advanced data structures and functions.
25866eaa481cSmrg# This macro enables a module to test for the presence of Glib.
25876eaa481cSmrg#
25886eaa481cSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25896eaa481cSmrg# Otherwise the value of $enable_unit_tests is blank.
25906eaa481cSmrg#
25916eaa481cSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25926eaa481cSmrg# test support usually requires less dependencies and may be built and run under
25936eaa481cSmrg# less stringent environments than integration tests.
2594a733a5bfSmrg#
25956eaa481cSmrg# Interface to module:
25966eaa481cSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
25976eaa481cSmrg# with_glib: used in configure.ac to know if GLib has been found
25986eaa481cSmrg# --with-glib:	'yes' user instructs the module to use glib
25996eaa481cSmrg#		'no' user instructs the module not to use glib
26006eaa481cSmrg#
26016eaa481cSmrgAC_DEFUN([XORG_WITH_GLIB],[
26026eaa481cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26036eaa481cSmrgm4_define([_defopt], m4_default([$2], [auto]))
26046eaa481cSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26056eaa481cSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26066eaa481cSmrg	[with_glib=$withval], [with_glib=]_defopt)
26076eaa481cSmrgm4_undefine([_defopt])
2608a733a5bfSmrg
26096eaa481cSmrghave_glib=no
26106eaa481cSmrg# Do not probe GLib if user explicitly disabled unit testing
26116eaa481cSmrgif test "x$enable_unit_tests" != x"no"; then
26126eaa481cSmrg  # Do not probe GLib if user explicitly disabled it
26136eaa481cSmrg  if test "x$with_glib" != x"no"; then
26146eaa481cSmrg    m4_ifval(
26156eaa481cSmrg      [$1],
26166eaa481cSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26176eaa481cSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26186eaa481cSmrg    )
2619a733a5bfSmrg  fi
2620a733a5bfSmrgfi
2621a733a5bfSmrg
26226eaa481cSmrg# Not having GLib when unit testing has been explicitly requested is an error
26236eaa481cSmrgif test "x$enable_unit_tests" = x"yes"; then
26246eaa481cSmrg  if test "x$have_glib" = x"no"; then
26256eaa481cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626a733a5bfSmrg  fi
2627a733a5bfSmrgfi
2628a733a5bfSmrg
26296eaa481cSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
26306eaa481cSmrgif test "x$enable_unit_tests" = x"no"; then
26316eaa481cSmrg  if test "x$with_glib" = x"yes"; then
26326eaa481cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26336eaa481cSmrg  fi
26346eaa481cSmrgfi
2635a733a5bfSmrg
26366eaa481cSmrg# Not having GLib when it has been explicitly requested is an error
26376eaa481cSmrgif test "x$with_glib" = x"yes"; then
26386eaa481cSmrg  if test "x$have_glib" = x"no"; then
26396eaa481cSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26406eaa481cSmrg  fi
26416eaa481cSmrgfi
2642a733a5bfSmrg
26436eaa481cSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26446eaa481cSmrg]) # XORG_WITH_GLIB
2645a733a5bfSmrg
26466eaa481cSmrg# XORG_LD_WRAP([required|optional])
26476eaa481cSmrg# ---------------------------------
26486eaa481cSmrg# Minimum version: 1.13.0
26496eaa481cSmrg#
26506eaa481cSmrg# Check if linker supports -wrap, passed via compiler flags
26516eaa481cSmrg#
26526eaa481cSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26536eaa481cSmrg# Otherwise the value of $enable_unit_tests is blank.
26546eaa481cSmrg#
26556eaa481cSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26566eaa481cSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26576eaa481cSmrg# available, an argument of "optional" allows use when some unit tests require
26586eaa481cSmrg# ld -wrap and others do not.
26596eaa481cSmrg#
26606eaa481cSmrgAC_DEFUN([XORG_LD_WRAP],[
26616eaa481cSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26626eaa481cSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26636eaa481cSmrg                      void __wrap_exit(int status) { return; }],
26646eaa481cSmrg                     [exit(0);])])
26656eaa481cSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
26666eaa481cSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
26676eaa481cSmrg  if test "x$have_ld_wrap" = x"no"; then
26686eaa481cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
26696eaa481cSmrg  fi
26706eaa481cSmrgfi
26716eaa481cSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
26726eaa481cSmrg#
26736eaa481cSmrg]) # XORG_LD_WRAP
2674a733a5bfSmrg
26756eaa481cSmrg# XORG_CHECK_LINKER_FLAGS
26766eaa481cSmrg# -----------------------
26776eaa481cSmrg# SYNOPSIS
26786eaa481cSmrg#
26796eaa481cSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26806eaa481cSmrg#
26816eaa481cSmrg# DESCRIPTION
26826eaa481cSmrg#
26836eaa481cSmrg#   Check whether the given linker FLAGS work with the current language's
26846eaa481cSmrg#   linker, or whether they give an error.
26856eaa481cSmrg#
26866eaa481cSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26876eaa481cSmrg#   success/failure.
26886eaa481cSmrg#
26896eaa481cSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
26906eaa481cSmrg#
26916eaa481cSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26926eaa481cSmrg#
26936eaa481cSmrg# LICENSE
26946eaa481cSmrg#
26956eaa481cSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26966eaa481cSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26976eaa481cSmrg#   Copyright (c) 2009 Matteo Frigo
26986eaa481cSmrg#
26996eaa481cSmrg#   This program is free software: you can redistribute it and/or modify it
27006eaa481cSmrg#   under the terms of the GNU General Public License as published by the
27016eaa481cSmrg#   Free Software Foundation, either version 3 of the License, or (at your
27026eaa481cSmrg#   option) any later version.
27036eaa481cSmrg#
27046eaa481cSmrg#   This program is distributed in the hope that it will be useful, but
27056eaa481cSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27066eaa481cSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27076eaa481cSmrg#   Public License for more details.
27086eaa481cSmrg#
27096eaa481cSmrg#   You should have received a copy of the GNU General Public License along
27106eaa481cSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27116eaa481cSmrg#
27126eaa481cSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
27136eaa481cSmrg#   gives unlimited permission to copy, distribute and modify the configure
27146eaa481cSmrg#   scripts that are the output of Autoconf when processing the Macro. You
27156eaa481cSmrg#   need not follow the terms of the GNU General Public License when using
27166eaa481cSmrg#   or distributing such scripts, even though portions of the text of the
27176eaa481cSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27186eaa481cSmrg#   all other use of the material that constitutes the Autoconf Macro.
27196eaa481cSmrg#
27206eaa481cSmrg#   This special exception to the GPL applies to versions of the Autoconf
27216eaa481cSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
27226eaa481cSmrg#   modified version of the Autoconf Macro, you may extend this special
27236eaa481cSmrg#   exception to the GPL to apply to your modified version as well.#
27246eaa481cSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27256eaa481cSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
27266eaa481cSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27276eaa481cSmrgAS_LITERAL_IF([$1],
27286eaa481cSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27296eaa481cSmrg      ax_save_FLAGS=$LDFLAGS
27306eaa481cSmrg      LDFLAGS="$1"
27316eaa481cSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27326eaa481cSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27336eaa481cSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27346eaa481cSmrg      LDFLAGS=$ax_save_FLAGS])],
27356eaa481cSmrg  [ax_save_FLAGS=$LDFLAGS
27366eaa481cSmrg   LDFLAGS="$1"
27376eaa481cSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27386eaa481cSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27396eaa481cSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27406eaa481cSmrg   LDFLAGS=$ax_save_FLAGS])
27416eaa481cSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27426eaa481cSmrgAC_MSG_RESULT($xorg_check_linker_flags)
27436eaa481cSmrgif test "x$xorg_check_linker_flags" = xyes; then
27446eaa481cSmrg	m4_default([$2], :)
27456eaa481cSmrgelse
27466eaa481cSmrg	m4_default([$3], :)
27476eaa481cSmrgfi
27486eaa481cSmrg]) # XORG_CHECK_LINKER_FLAGS
2749a733a5bfSmrg
27506eaa481cSmrg# XORG_MEMORY_CHECK_FLAGS
27516eaa481cSmrg# -----------------------
27526eaa481cSmrg# Minimum version: 1.16.0
27536eaa481cSmrg#
27546eaa481cSmrg# This macro attempts to find appropriate memory checking functionality
27556eaa481cSmrg# for various platforms which unit testing code may use to catch various
27566eaa481cSmrg# forms of memory allocation and access errors in testing.
27576eaa481cSmrg#
27586eaa481cSmrg# Interface to module:
27596eaa481cSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27606eaa481cSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27616eaa481cSmrg#
27626eaa481cSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27636eaa481cSmrg#
27646eaa481cSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765a733a5bfSmrg
27666eaa481cSmrgAC_REQUIRE([AC_CANONICAL_HOST])
27676eaa481cSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
27686eaa481cSmrg           [Environment variables to enable memory checking in tests])
2769a733a5bfSmrg
27706eaa481cSmrg# Check for different types of support on different platforms
27716eaa481cSmrgcase $host_os in
27726eaa481cSmrg    solaris*)
27736eaa481cSmrg        AC_CHECK_LIB([umem], [umem_alloc],
27746eaa481cSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
27756eaa481cSmrg        ;;
27766eaa481cSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
27776eaa481cSmrg        # both directly and inverted, so should not be 0 or 255.
27786eaa481cSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
27796eaa481cSmrg        ;;
27806eaa481cSmrg    darwin*)
27816eaa481cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
27826eaa481cSmrg        ;;
27836eaa481cSmrg    *bsd*)
27846eaa481cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27856eaa481cSmrg        ;;
27866eaa481cSmrgesac
27871a30de1fSmrg
27886eaa481cSmrg# User supplied flags override default flags
27896eaa481cSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27906eaa481cSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27911a30de1fSmrgfi
27921a30de1fSmrg
27936eaa481cSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27946eaa481cSmrg]) # XORG_WITH_LINT
2795423b239cSmrg
27966eaa481cSmrg# XORG_CHECK_MALLOC_ZERO
27976eaa481cSmrg# ----------------------
27986eaa481cSmrg# Minimum version: 1.0.0
27991a30de1fSmrg#
28006eaa481cSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28016eaa481cSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28026eaa481cSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28036eaa481cSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28046eaa481cSmrgAC_ARG_ENABLE(malloc0returnsnull,
28056eaa481cSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28066eaa481cSmrg		       [malloc(0) returns NULL (default: auto)]),
28076eaa481cSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28086eaa481cSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
28091a30de1fSmrg
28106eaa481cSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28116eaa481cSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28126eaa481cSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28136eaa481cSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28146eaa481cSmrg#include <stdlib.h>
28156eaa481cSmrg],[
28166eaa481cSmrg    char *m0, *r0, *c0, *p;
28176eaa481cSmrg    m0 = malloc(0);
28186eaa481cSmrg    p = malloc(10);
28196eaa481cSmrg    r0 = realloc(p,0);
28206eaa481cSmrg    c0 = calloc(0,10);
28216eaa481cSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28226eaa481cSmrg])],
28236eaa481cSmrg		[xorg_cv_malloc0_returns_null=yes],
28246eaa481cSmrg		[xorg_cv_malloc0_returns_null=no])])
28256eaa481cSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826423b239cSmrgfi
28276eaa481cSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828ce62200cSmrg
28296eaa481cSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28306eaa481cSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28316eaa481cSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28326eaa481cSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28331a30de1fSmrgelse
28346eaa481cSmrg	MALLOC_ZERO_CFLAGS=""
28356eaa481cSmrg	XMALLOC_ZERO_CFLAGS=""
28366eaa481cSmrg	XTMALLOC_ZERO_CFLAGS=""
28371a30de1fSmrgfi
28381a30de1fSmrg
28396eaa481cSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28406eaa481cSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28416eaa481cSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28426eaa481cSmrg]) # XORG_CHECK_MALLOC_ZERO
28431a30de1fSmrg
28446eaa481cSmrg# XORG_WITH_LINT()
28456eaa481cSmrg# ----------------
28466eaa481cSmrg# Minimum version: 1.1.0
2847ce62200cSmrg#
28486eaa481cSmrg# This macro enables the use of a tool that flags some suspicious and
28496eaa481cSmrg# non-portable constructs (likely to be bugs) in C language source code.
28506eaa481cSmrg# It will attempt to locate the tool and use appropriate options.
28516eaa481cSmrg# There are various lint type tools on different platforms.
2852a733a5bfSmrg#
28536eaa481cSmrg# Interface to module:
28546eaa481cSmrg# LINT:		returns the path to the tool found on the platform
28556eaa481cSmrg#		or the value set to LINT on the configure cmd line
28566eaa481cSmrg#		also an Automake conditional
28576eaa481cSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
28586eaa481cSmrg#
28596eaa481cSmrg# --with-lint:	'yes' user instructs the module to use lint
28606eaa481cSmrg#		'no' user instructs the module not to use lint (default)
28616eaa481cSmrg#
28626eaa481cSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28636eaa481cSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28646eaa481cSmrg#
28656eaa481cSmrgAC_DEFUN([XORG_WITH_LINT],[
2866a733a5bfSmrg
28676eaa481cSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
28686eaa481cSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
28696eaa481cSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
28706eaa481cSmrg		[Use a lint-style source code checker (default: disabled)])],
28716eaa481cSmrg		[use_lint=$withval], [use_lint=no])
2872a733a5bfSmrg
28736eaa481cSmrg# Obtain platform specific info like program name and options
28746eaa481cSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
28756eaa481cSmrgcase $host_os in
28766eaa481cSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
28776eaa481cSmrg	lint_name=splint
28786eaa481cSmrg	lint_options="-badflag"
28796eaa481cSmrg	;;
28806eaa481cSmrg  *freebsd* | *netbsd*)
28816eaa481cSmrg	lint_name=lint
28826eaa481cSmrg	lint_options="-u -b"
28836eaa481cSmrg	;;
28846eaa481cSmrg  *solaris*)
28856eaa481cSmrg	lint_name=lint
28866eaa481cSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28876eaa481cSmrg	;;
28886eaa481cSmrgesac
28896eaa481cSmrg
28906eaa481cSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28916eaa481cSmrgif test "x$use_lint" = x"yes" ; then
28926eaa481cSmrg   AC_PATH_PROG([LINT], [$lint_name])
28936eaa481cSmrg   if test "x$LINT" = "x"; then
28946eaa481cSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28956eaa481cSmrg   fi
28966eaa481cSmrgelif test "x$use_lint" = x"no" ; then
28976eaa481cSmrg   if test "x$LINT" != "x"; then
28986eaa481cSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28996eaa481cSmrg   fi
2900423b239cSmrgelse
29016eaa481cSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902a733a5bfSmrgfi
2903a733a5bfSmrg
29046eaa481cSmrg# User supplied flags override default flags
29056eaa481cSmrgif test "x$LINT_FLAGS" != "x"; then
29066eaa481cSmrg   lint_options=$LINT_FLAGS
29076eaa481cSmrgfi
2908a733a5bfSmrg
29096eaa481cSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29106eaa481cSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911a733a5bfSmrg
29126eaa481cSmrg]) # XORG_WITH_LINT
2913a733a5bfSmrg
29146eaa481cSmrg# XORG_LINT_LIBRARY(LIBNAME)
29156eaa481cSmrg# --------------------------
29166eaa481cSmrg# Minimum version: 1.1.0
2917a733a5bfSmrg#
29186eaa481cSmrg# Sets up flags for building lint libraries for checking programs that call
29196eaa481cSmrg# functions in the library.
29206eaa481cSmrg#
29216eaa481cSmrg# Interface to module:
29226eaa481cSmrg# LINTLIB		- Automake variable with the name of lint library file to make
29236eaa481cSmrg# MAKE_LINT_LIB		- Automake conditional
29246eaa481cSmrg#
29256eaa481cSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29266eaa481cSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2927a733a5bfSmrg
29286eaa481cSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29296eaa481cSmrgAC_REQUIRE([XORG_WITH_LINT])
29306eaa481cSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29316eaa481cSmrg	[Create lint library (default: disabled)])],
29326eaa481cSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
29336eaa481cSmrg
29346eaa481cSmrgif test "x$make_lint_lib" = x"yes" ; then
29356eaa481cSmrg   LINTLIB=llib-l$1.ln
29366eaa481cSmrg   if test "x$LINT" = "x"; then
29376eaa481cSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29386eaa481cSmrg   fi
29396eaa481cSmrgelif test "x$make_lint_lib" != x"no" ; then
29406eaa481cSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941a733a5bfSmrgfi
2942a733a5bfSmrg
29436eaa481cSmrgAC_SUBST(LINTLIB)
29446eaa481cSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945423b239cSmrg
29466eaa481cSmrg]) # XORG_LINT_LIBRARY
2947423b239cSmrg
29486eaa481cSmrg# XORG_COMPILER_BRAND
2949423b239cSmrg# -------------------
29506eaa481cSmrg# Minimum version: 1.14.0
2951423b239cSmrg#
29526eaa481cSmrg# Checks for various brands of compilers and sets flags as appropriate:
29536eaa481cSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29546eaa481cSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29556eaa481cSmrg#   clang compiler - sets CLANGCC to "yes"
29566eaa481cSmrg#   Intel compiler - sets INTELCC to "yes"
29576eaa481cSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29586eaa481cSmrg#
29596eaa481cSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29606eaa481cSmrgAC_LANG_CASE(
29616eaa481cSmrg	[C], [
29626eaa481cSmrg		AC_REQUIRE([AC_PROG_CC_C99])
29636eaa481cSmrg	],
29646eaa481cSmrg	[C++], [
29656eaa481cSmrg		AC_REQUIRE([AC_PROG_CXX])
29666eaa481cSmrg	]
29676eaa481cSmrg)
29686eaa481cSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
29696eaa481cSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
29706eaa481cSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
29716eaa481cSmrg]) # XORG_COMPILER_BRAND
2972a733a5bfSmrg
29736eaa481cSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2974423b239cSmrg# ---------------
29756eaa481cSmrg# Minimum version: 1.16.0
29766eaa481cSmrg#
29776eaa481cSmrg# Test if the compiler works when passed the given flag as a command line argument.
29786eaa481cSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
29796eaa481cSmrg# next flag in the list until there are no more options.
29806eaa481cSmrg#
29816eaa481cSmrg# Note that this does not guarantee that the compiler supports the flag as some
29826eaa481cSmrg# compilers will simply ignore arguments that they do not understand, but we do
29836eaa481cSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29846eaa481cSmrg# -Werror=unused-command-line-argument
29856eaa481cSmrg#
29866eaa481cSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29876eaa481cSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29886eaa481cSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2989a733a5bfSmrg
29906eaa481cSmrgAC_LANG_COMPILER_REQUIRE
2991a733a5bfSmrg
29926eaa481cSmrgAC_LANG_CASE(
29936eaa481cSmrg	[C], [
29946eaa481cSmrg		AC_REQUIRE([AC_PROG_CC_C99])
29956eaa481cSmrg		define([PREFIX], [C])
29966eaa481cSmrg		define([CACHE_PREFIX], [cc])
29976eaa481cSmrg		define([COMPILER], [$CC])
29986eaa481cSmrg	],
29996eaa481cSmrg	[C++], [
30006eaa481cSmrg		define([PREFIX], [CXX])
30016eaa481cSmrg		define([CACHE_PREFIX], [cxx])
30026eaa481cSmrg		define([COMPILER], [$CXX])
30036eaa481cSmrg	]
30046eaa481cSmrg)
30056eaa481cSmrg
30066eaa481cSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30076eaa481cSmrg
30086eaa481cSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30096eaa481cSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30106eaa481cSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30116eaa481cSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30126eaa481cSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30136eaa481cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30146eaa481cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30156eaa481cSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30166eaa481cSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3017423b239cSmrgfi
30186eaa481cSmrg
30196eaa481cSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30206eaa481cSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30216eaa481cSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30226eaa481cSmrg	fi
30236eaa481cSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30246eaa481cSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30256eaa481cSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30266eaa481cSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30276eaa481cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30286eaa481cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30296eaa481cSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30306eaa481cSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30316eaa481cSmrgfi
30326eaa481cSmrg
30336eaa481cSmrgfound="no"
30346eaa481cSmrgm4_foreach([flag], m4_cdr($@), [
30356eaa481cSmrg	if test $found = "no" ; then
30366eaa481cSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30376eaa481cSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30386eaa481cSmrg		fi
30396eaa481cSmrg
30406eaa481cSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30416eaa481cSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30426eaa481cSmrg		fi
30436eaa481cSmrg
30446eaa481cSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30456eaa481cSmrg
30466eaa481cSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30476eaa481cSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30486eaa481cSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30496eaa481cSmrg		AC_CACHE_VAL($cacheid,
30506eaa481cSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30516eaa481cSmrg					     [eval $cacheid=yes],
30526eaa481cSmrg					     [eval $cacheid=no])])
30536eaa481cSmrg
30546eaa481cSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30556eaa481cSmrg
30566eaa481cSmrg		eval supported=\$$cacheid
30576eaa481cSmrg		AC_MSG_RESULT([$supported])
30586eaa481cSmrg		if test "$supported" = "yes" ; then
30596eaa481cSmrg			$1="$$1 ]flag["
30606eaa481cSmrg			found="yes"
30616eaa481cSmrg		fi
30626eaa481cSmrg	fi
3063423b239cSmrg])
30646eaa481cSmrg]) # XORG_TESTSET_CFLAG
3065a733a5bfSmrg
30666eaa481cSmrg# XORG_COMPILER_FLAGS
30676eaa481cSmrg# ---------------
30686eaa481cSmrg# Minimum version: 1.16.0
3069a733a5bfSmrg#
30706eaa481cSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
30716eaa481cSmrg# arguments supported by the selected compiler which do NOT alter the generated
30726eaa481cSmrg# code.  These arguments will cause the compiler to print various warnings
30736eaa481cSmrg# during compilation AND turn a conservative set of warnings into errors.
30746eaa481cSmrg#
30756eaa481cSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
30766eaa481cSmrg# future versions of util-macros as options are added to new compilers.
30776eaa481cSmrg#
30786eaa481cSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
30796eaa481cSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3080b7fb5eacSmrg
30816eaa481cSmrgAC_ARG_ENABLE(selective-werror,
30826eaa481cSmrg              AS_HELP_STRING([--disable-selective-werror],
30836eaa481cSmrg                             [Turn off selective compiler errors. (default: enabled)]),
30846eaa481cSmrg              [SELECTIVE_WERROR=$enableval],
30856eaa481cSmrg              [SELECTIVE_WERROR=yes])
30866eaa481cSmrg
30876eaa481cSmrgAC_LANG_CASE(
30886eaa481cSmrg        [C], [
30896eaa481cSmrg                define([PREFIX], [C])
30906eaa481cSmrg        ],
30916eaa481cSmrg        [C++], [
30926eaa481cSmrg                define([PREFIX], [CXX])
30936eaa481cSmrg        ]
30946eaa481cSmrg)
30956eaa481cSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
30966eaa481cSmrgif test "x$SUNCC" = "xyes"; then
30976eaa481cSmrg    [BASE_]PREFIX[FLAGS]="-v"
3098423b239cSmrgelse
30996eaa481cSmrg    [BASE_]PREFIX[FLAGS]=""
3100423b239cSmrgfi
3101423b239cSmrg
31026eaa481cSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31036eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31046eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31056eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31066eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3107423b239cSmrg
31086eaa481cSmrgAC_LANG_CASE(
31096eaa481cSmrg	[C], [
31106eaa481cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31116eaa481cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31126eaa481cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31136eaa481cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31146eaa481cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31156eaa481cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31166eaa481cSmrg	]
31176eaa481cSmrg)
3118b7fb5eacSmrg
31196eaa481cSmrg# This chunk adds additional warnings that could catch undesired effects.
31206eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31216eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31226eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31236eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31246eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31256eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31266eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3127a733a5bfSmrg
31286eaa481cSmrg# These are currently disabled because they are noisy.  They will be enabled
31296eaa481cSmrg# in the future once the codebase is sufficiently modernized to silence
31306eaa481cSmrg# them.  For now, I don't want them to drown out the other warnings.
31316eaa481cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31326eaa481cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31336eaa481cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3134a733a5bfSmrg
31356eaa481cSmrg# Turn some warnings into errors, so we don't accidently get successful builds
31366eaa481cSmrg# when there are problems that should be fixed.
3137a733a5bfSmrg
31386eaa481cSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31396eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31406eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31416eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31426eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31436eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31446eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31456eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31466eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31476eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31486eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31496eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31506eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31516eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31526eaa481cSmrgelse
31536eaa481cSmrgAC_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])
31546eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31556eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31566eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31576eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
31586eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
31596eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
31606eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
31616eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
31626eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
31636eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
31646eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
31656eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
31666eaa481cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31676eaa481cSmrgfi
3168a733a5bfSmrg
31696eaa481cSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31706eaa481cSmrg]) # XORG_COMPILER_FLAGS
3171b7fb5eacSmrg
31726eaa481cSmrg# XORG_CWARNFLAGS
31736eaa481cSmrg# ---------------
31746eaa481cSmrg# Minimum version: 1.2.0
31756eaa481cSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3176b7fb5eacSmrg#
31776eaa481cSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3178ce62200cSmrg#
31796eaa481cSmrg# This function is deprecated because it defines -fno-strict-aliasing
31806eaa481cSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
31816eaa481cSmrg# is needed, then it should be added explicitly in the module when
31826eaa481cSmrg# it is updated to use BASE_CFLAGS.
3183ce62200cSmrg#
31846eaa481cSmrgAC_DEFUN([XORG_CWARNFLAGS], [
31856eaa481cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31866eaa481cSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31876eaa481cSmrgAC_LANG_CASE(
31886eaa481cSmrg	[C], [
31896eaa481cSmrg		CWARNFLAGS="$BASE_CFLAGS"
31906eaa481cSmrg		if  test "x$GCC" = xyes ; then
31916eaa481cSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
31926eaa481cSmrg		fi
31936eaa481cSmrg		AC_SUBST(CWARNFLAGS)
31946eaa481cSmrg	]
31956eaa481cSmrg)
31966eaa481cSmrg]) # XORG_CWARNFLAGS
3197a733a5bfSmrg
31986eaa481cSmrg# XORG_STRICT_OPTION
31996eaa481cSmrg# -----------------------
32006eaa481cSmrg# Minimum version: 1.3.0
32016eaa481cSmrg#
32026eaa481cSmrg# Add configure option to enable strict compilation flags, such as treating
32036eaa481cSmrg# warnings as fatal errors.
32046eaa481cSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32056eaa481cSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32066eaa481cSmrg#
32076eaa481cSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32086eaa481cSmrg# when strict compilation is unconditionally desired.
32096eaa481cSmrgAC_DEFUN([XORG_STRICT_OPTION], [
32106eaa481cSmrgAC_REQUIRE([XORG_CWARNFLAGS])
32116eaa481cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32121a30de1fSmrg
32136eaa481cSmrgAC_ARG_ENABLE(strict-compilation,
32146eaa481cSmrg			  AS_HELP_STRING([--enable-strict-compilation],
32156eaa481cSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32166eaa481cSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3217423b239cSmrg
32186eaa481cSmrgAC_LANG_CASE(
32196eaa481cSmrg        [C], [
32206eaa481cSmrg                define([PREFIX], [C])
32216eaa481cSmrg        ],
32226eaa481cSmrg        [C++], [
32236eaa481cSmrg                define([PREFIX], [CXX])
32246eaa481cSmrg        ]
32256eaa481cSmrg)
3226423b239cSmrg
32276eaa481cSmrg[STRICT_]PREFIX[FLAGS]=""
32286eaa481cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32296eaa481cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3230423b239cSmrg
32316eaa481cSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32326eaa481cSmrg# activate it with -Werror, so we add it here explicitly.
32336eaa481cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3234423b239cSmrg
32356eaa481cSmrgif test "x$STRICT_COMPILE" = "xyes"; then
32366eaa481cSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32376eaa481cSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32386eaa481cSmrgfi
32396eaa481cSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32406eaa481cSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32416eaa481cSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32426eaa481cSmrg]) # XORG_STRICT_OPTION
3243423b239cSmrg
32446eaa481cSmrg# XORG_DEFAULT_OPTIONS
32456eaa481cSmrg# --------------------
32466eaa481cSmrg# Minimum version: 1.3.0
32476eaa481cSmrg#
32486eaa481cSmrg# Defines default options for X.Org modules.
32496eaa481cSmrg#
32506eaa481cSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
32516eaa481cSmrgAC_REQUIRE([AC_PROG_INSTALL])
32526eaa481cSmrgXORG_COMPILER_FLAGS
32536eaa481cSmrgXORG_CWARNFLAGS
32546eaa481cSmrgXORG_STRICT_OPTION
32556eaa481cSmrgXORG_RELEASE_VERSION
32566eaa481cSmrgXORG_CHANGELOG
32576eaa481cSmrgXORG_INSTALL
32586eaa481cSmrgXORG_MANPAGE_SECTIONS
32596eaa481cSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32606eaa481cSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32616eaa481cSmrg]) # XORG_DEFAULT_OPTIONS
3262423b239cSmrg
32636eaa481cSmrg# XORG_INSTALL()
32646eaa481cSmrg# ----------------
32656eaa481cSmrg# Minimum version: 1.4.0
32666eaa481cSmrg#
32676eaa481cSmrg# Defines the variable INSTALL_CMD as the command to copy
32686eaa481cSmrg# INSTALL from $prefix/share/util-macros.
32696eaa481cSmrg#
32706eaa481cSmrgAC_DEFUN([XORG_INSTALL], [
32716eaa481cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
32726eaa481cSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
32736eaa481cSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
32746eaa481cSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
32756eaa481cSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
32766eaa481cSmrgtouch \$(top_srcdir)/INSTALL; \
32776eaa481cSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
32786eaa481cSmrgAC_SUBST([INSTALL_CMD])
32796eaa481cSmrg]) # XORG_INSTALL
32806eaa481cSmrgdnl Copyright 2005 Red Hat, Inc
32816eaa481cSmrgdnl
32826eaa481cSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
32836eaa481cSmrgdnl documentation for any purpose is hereby granted without fee, provided that
32846eaa481cSmrgdnl the above copyright notice appear in all copies and that both that
32856eaa481cSmrgdnl copyright notice and this permission notice appear in supporting
32866eaa481cSmrgdnl documentation.
32876eaa481cSmrgdnl
32886eaa481cSmrgdnl The above copyright notice and this permission notice shall be included
32896eaa481cSmrgdnl in all copies or substantial portions of the Software.
32906eaa481cSmrgdnl
32916eaa481cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32926eaa481cSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32936eaa481cSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
32946eaa481cSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
32956eaa481cSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
32966eaa481cSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
32976eaa481cSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
32986eaa481cSmrgdnl
32996eaa481cSmrgdnl Except as contained in this notice, the name of the copyright holders shall
33006eaa481cSmrgdnl not be used in advertising or otherwise to promote the sale, use or
33016eaa481cSmrgdnl other dealings in this Software without prior written authorization
33026eaa481cSmrgdnl from the copyright holders.
33036eaa481cSmrgdnl
3304423b239cSmrg
33056eaa481cSmrg# XORG_RELEASE_VERSION
33066eaa481cSmrg# --------------------
33076eaa481cSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3308423b239cSmrg
33096eaa481cSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33106eaa481cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33116eaa481cSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33126eaa481cSmrg		[Major version of this package])
33136eaa481cSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33146eaa481cSmrg	if test "x$PVM" = "x"; then
33156eaa481cSmrg		PVM="0"
33166eaa481cSmrg	fi
33176eaa481cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33186eaa481cSmrg		[$PVM],
33196eaa481cSmrg		[Minor version of this package])
33206eaa481cSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33216eaa481cSmrg	if test "x$PVP" = "x"; then
33226eaa481cSmrg		PVP="0"
33236eaa481cSmrg	fi
33246eaa481cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33256eaa481cSmrg		[$PVP],
33266eaa481cSmrg		[Patch version of this package])
33276eaa481cSmrg])
3328423b239cSmrg
33296eaa481cSmrg# XORG_CHANGELOG()
33306eaa481cSmrg# ----------------
33316eaa481cSmrg# Minimum version: 1.2.0
33326eaa481cSmrg#
33336eaa481cSmrg# Defines the variable CHANGELOG_CMD as the command to generate
33346eaa481cSmrg# ChangeLog from git.
33356eaa481cSmrg#
33366eaa481cSmrg#
33376eaa481cSmrgAC_DEFUN([XORG_CHANGELOG], [
33386eaa481cSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33396eaa481cSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33406eaa481cSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33416eaa481cSmrgtouch \$(top_srcdir)/ChangeLog; \
33426eaa481cSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33436eaa481cSmrgAC_SUBST([CHANGELOG_CMD])
33446eaa481cSmrg]) # XORG_CHANGELOG
3345b7fb5eacSmrg
3346