aclocal.m4 revision 1c145c9f
11c145c9fSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2df58931aSmrg
31c145c9fSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
44fb28925Smrg
54fb28925Smrg# This file is free software; the Free Software Foundation
64fb28925Smrg# gives unlimited permission to copy and/or distribute it,
74fb28925Smrg# with or without modifications, as long as this notice is preserved.
84fb28925Smrg
94fb28925Smrg# This program is distributed in the hope that it will be useful,
104fb28925Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
114fb28925Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
124fb28925Smrg# PARTICULAR PURPOSE.
134fb28925Smrg
14df58931aSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15b66d1acbSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16b66d1acbSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
171c145c9fSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
181c145c9fSmrg[m4_warning([this file was generated for autoconf 2.71.
19b66d1acbSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20b66d1acbSmrgIf you have problems, you may need to regenerate the build system entirely.
21df58931aSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
224fb28925Smrg
231c145c9fSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
241c145c9fSmrg#
251c145c9fSmrg# This file is free software; the Free Software Foundation
261c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
271c145c9fSmrg# with or without modifications, as long as this notice is preserved.
284929c8f8Smrg
291c145c9fSmrg# AM_AUTOMAKE_VERSION(VERSION)
301c145c9fSmrg# ----------------------------
311c145c9fSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
321c145c9fSmrg# generated from the m4 files accompanying Automake X.Y.
331c145c9fSmrg# (This private macro should not be called outside this file.)
341c145c9fSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
351c145c9fSmrg[am__api_version='1.16'
361c145c9fSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
371c145c9fSmrgdnl require some minimum version.  Point them to the right macro.
381c145c9fSmrgm4_if([$1], [1.16.5], [],
391c145c9fSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
401c145c9fSmrg])
414929c8f8Smrg
421c145c9fSmrg# _AM_AUTOCONF_VERSION(VERSION)
431c145c9fSmrg# -----------------------------
441c145c9fSmrg# aclocal traces this macro to find the Autoconf version.
451c145c9fSmrg# This is a private macro too.  Using m4_define simplifies
461c145c9fSmrg# the logic in aclocal, which can simply ignore this definition.
471c145c9fSmrgm4_define([_AM_AUTOCONF_VERSION], [])
484fb28925Smrg
491c145c9fSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
501c145c9fSmrg# -------------------------------
511c145c9fSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
521c145c9fSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
531c145c9fSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
541c145c9fSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
551c145c9fSmrgm4_ifndef([AC_AUTOCONF_VERSION],
561c145c9fSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
571c145c9fSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58b66d1acbSmrg
591c145c9fSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
604fb28925Smrg
611c145c9fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
621c145c9fSmrg#
631c145c9fSmrg# This file is free software; the Free Software Foundation
641c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
651c145c9fSmrg# with or without modifications, as long as this notice is preserved.
664fb28925Smrg
671c145c9fSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
681c145c9fSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
691c145c9fSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
701c145c9fSmrg#
711c145c9fSmrg# Of course, Automake must honor this variable whenever it calls a
721c145c9fSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
731c145c9fSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
741c145c9fSmrg# depending on how configure is run.  This is pretty annoying, since
751c145c9fSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
761c145c9fSmrg# source directory, any form will work fine, but in subdirectories a
771c145c9fSmrg# relative path needs to be adjusted first.
781c145c9fSmrg#
791c145c9fSmrg# $ac_aux_dir/missing
801c145c9fSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
811c145c9fSmrg# $top_srcdir/$ac_aux_dir/missing
821c145c9fSmrg#    fails if $ac_aux_dir is absolute,
831c145c9fSmrg#    fails when called from a subdirectory in a VPATH build with
841c145c9fSmrg#          a relative $ac_aux_dir
851c145c9fSmrg#
861c145c9fSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
871c145c9fSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
881c145c9fSmrg# harmless because $srcdir is '.', but things will broke when you
891c145c9fSmrg# start a VPATH build or use an absolute $srcdir.
901c145c9fSmrg#
911c145c9fSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
921c145c9fSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
931c145c9fSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
941c145c9fSmrg# and then we would define $MISSING as
951c145c9fSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
961c145c9fSmrg# This will work as long as MISSING is not called from configure, because
971c145c9fSmrg# unfortunately $(top_srcdir) has no meaning in configure.
981c145c9fSmrg# However there are other variables, like CC, which are often used in
991c145c9fSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1001c145c9fSmrg#
1011c145c9fSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1021c145c9fSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1031c145c9fSmrg# configured tree to be moved without reconfiguration.
1044fb28925Smrg
1051c145c9fSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1061c145c9fSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1071c145c9fSmrg# Expand $ac_aux_dir to an absolute path.
1081c145c9fSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1091c145c9fSmrg])
1104fb28925Smrg
1111c145c9fSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1124fb28925Smrg
1131c145c9fSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
1141c145c9fSmrg#
1151c145c9fSmrg# This file is free software; the Free Software Foundation
1161c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
1171c145c9fSmrg# with or without modifications, as long as this notice is preserved.
1184fb28925Smrg
1191c145c9fSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1201c145c9fSmrg# -------------------------------------
1211c145c9fSmrg# Define a conditional.
1221c145c9fSmrgAC_DEFUN([AM_CONDITIONAL],
1231c145c9fSmrg[AC_PREREQ([2.52])dnl
1241c145c9fSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1251c145c9fSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1261c145c9fSmrgAC_SUBST([$1_TRUE])dnl
1271c145c9fSmrgAC_SUBST([$1_FALSE])dnl
1281c145c9fSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1291c145c9fSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1301c145c9fSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1311c145c9fSmrgif $2; then
1321c145c9fSmrg  $1_TRUE=
1331c145c9fSmrg  $1_FALSE='#'
1341c145c9fSmrgelse
1351c145c9fSmrg  $1_TRUE='#'
1361c145c9fSmrg  $1_FALSE=
1371c145c9fSmrgfi
1381c145c9fSmrgAC_CONFIG_COMMANDS_PRE(
1391c145c9fSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1401c145c9fSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1411c145c9fSmrgUsually this means the macro was only invoked conditionally.]])
1421c145c9fSmrgfi])])
1434fb28925Smrg
1441c145c9fSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
1451c145c9fSmrg#
1461c145c9fSmrg# This file is free software; the Free Software Foundation
1471c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
1481c145c9fSmrg# with or without modifications, as long as this notice is preserved.
1494fb28925Smrg
1504fb28925Smrg
1511c145c9fSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1521c145c9fSmrg# written in clear, in which case automake, when reading aclocal.m4,
1531c145c9fSmrg# will think it sees a *use*, and therefore will trigger all it's
1541c145c9fSmrg# C support machinery.  Also note that it means that autoscan, seeing
1551c145c9fSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1564fb28925Smrg
1574fb28925Smrg
1581c145c9fSmrg# _AM_DEPENDENCIES(NAME)
1591c145c9fSmrg# ----------------------
1601c145c9fSmrg# See how the compiler implements dependency checking.
1611c145c9fSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1621c145c9fSmrg# We try a few techniques and use that to set a single cache variable.
1631c145c9fSmrg#
1641c145c9fSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1651c145c9fSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1661c145c9fSmrg# dependency, and given that the user is not expected to run this macro,
1671c145c9fSmrg# just rely on AC_PROG_CC.
1681c145c9fSmrgAC_DEFUN([_AM_DEPENDENCIES],
1691c145c9fSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1701c145c9fSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1711c145c9fSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1721c145c9fSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1734fb28925Smrg
1741c145c9fSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1751c145c9fSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1761c145c9fSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1771c145c9fSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1781c145c9fSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1791c145c9fSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1801c145c9fSmrg                    [depcc="$$1"   am_compiler_list=])
1814fb28925Smrg
1821c145c9fSmrgAC_CACHE_CHECK([dependency style of $depcc],
1831c145c9fSmrg               [am_cv_$1_dependencies_compiler_type],
1841c145c9fSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1851c145c9fSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1861c145c9fSmrg  # making bogus files that we don't know about and never remove.  For
1871c145c9fSmrg  # instance it was reported that on HP-UX the gcc test will end up
1881c145c9fSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1891c145c9fSmrg  # in D".
1901c145c9fSmrg  rm -rf conftest.dir
1911c145c9fSmrg  mkdir conftest.dir
1921c145c9fSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1931c145c9fSmrg  # using a relative directory.
1941c145c9fSmrg  cp "$am_depcomp" conftest.dir
1951c145c9fSmrg  cd conftest.dir
1961c145c9fSmrg  # We will build objects and dependencies in a subdirectory because
1971c145c9fSmrg  # it helps to detect inapplicable dependency modes.  For instance
1981c145c9fSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1991c145c9fSmrg  # side effect of compilation, but ICC will put the dependencies in
2001c145c9fSmrg  # the current directory while Tru64 will put them in the object
2011c145c9fSmrg  # directory.
2021c145c9fSmrg  mkdir sub
2034fb28925Smrg
2041c145c9fSmrg  am_cv_$1_dependencies_compiler_type=none
2051c145c9fSmrg  if test "$am_compiler_list" = ""; then
2061c145c9fSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2071c145c9fSmrg  fi
2081c145c9fSmrg  am__universal=false
2091c145c9fSmrg  m4_case([$1], [CC],
2101c145c9fSmrg    [case " $depcc " in #(
2111c145c9fSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2121c145c9fSmrg     esac],
2131c145c9fSmrg    [CXX],
2141c145c9fSmrg    [case " $depcc " in #(
2151c145c9fSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2161c145c9fSmrg     esac])
2174fb28925Smrg
2181c145c9fSmrg  for depmode in $am_compiler_list; do
2191c145c9fSmrg    # Setup a source with many dependencies, because some compilers
2201c145c9fSmrg    # like to wrap large dependency lists on column 80 (with \), and
2211c145c9fSmrg    # we should not choose a depcomp mode which is confused by this.
2221c145c9fSmrg    #
2231c145c9fSmrg    # We need to recreate these files for each test, as the compiler may
2241c145c9fSmrg    # overwrite some of them when testing with obscure command lines.
2251c145c9fSmrg    # This happens at least with the AIX C compiler.
2261c145c9fSmrg    : > sub/conftest.c
2271c145c9fSmrg    for i in 1 2 3 4 5 6; do
2281c145c9fSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2291c145c9fSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2301c145c9fSmrg      # Solaris 10 /bin/sh.
2311c145c9fSmrg      echo '/* dummy */' > sub/conftst$i.h
2321c145c9fSmrg    done
2331c145c9fSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2344fb28925Smrg
2351c145c9fSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2361c145c9fSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2371c145c9fSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2381c145c9fSmrg    # versions had trouble with output in subdirs.
2391c145c9fSmrg    am__obj=sub/conftest.${OBJEXT-o}
2401c145c9fSmrg    am__minus_obj="-o $am__obj"
2411c145c9fSmrg    case $depmode in
2421c145c9fSmrg    gcc)
2431c145c9fSmrg      # This depmode causes a compiler race in universal mode.
2441c145c9fSmrg      test "$am__universal" = false || continue
2451c145c9fSmrg      ;;
2461c145c9fSmrg    nosideeffect)
2471c145c9fSmrg      # After this tag, mechanisms are not by side-effect, so they'll
2481c145c9fSmrg      # only be used when explicitly requested.
2491c145c9fSmrg      if test "x$enable_dependency_tracking" = xyes; then
2501c145c9fSmrg	continue
2511c145c9fSmrg      else
2521c145c9fSmrg	break
2531c145c9fSmrg      fi
2541c145c9fSmrg      ;;
2551c145c9fSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2561c145c9fSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
2571c145c9fSmrg      # not run yet.  These depmodes are late enough in the game, and
2581c145c9fSmrg      # so weak that their functioning should not be impacted.
2591c145c9fSmrg      am__obj=conftest.${OBJEXT-o}
2601c145c9fSmrg      am__minus_obj=
2611c145c9fSmrg      ;;
2621c145c9fSmrg    none) break ;;
2631c145c9fSmrg    esac
2641c145c9fSmrg    if depmode=$depmode \
2651c145c9fSmrg       source=sub/conftest.c object=$am__obj \
2661c145c9fSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2671c145c9fSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2681c145c9fSmrg         >/dev/null 2>conftest.err &&
2691c145c9fSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2701c145c9fSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2711c145c9fSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2721c145c9fSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2731c145c9fSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2741c145c9fSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2751c145c9fSmrg      # that says an option was ignored or not supported.
2761c145c9fSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2771c145c9fSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2781c145c9fSmrg      # The diagnosis changed in icc 8.0:
2791c145c9fSmrg      #   icc: Command line remark: option '-MP' not supported
2801c145c9fSmrg      if (grep 'ignoring option' conftest.err ||
2811c145c9fSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2821c145c9fSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2831c145c9fSmrg        break
2841c145c9fSmrg      fi
2851c145c9fSmrg    fi
2861c145c9fSmrg  done
287b66d1acbSmrg
2881c145c9fSmrg  cd ..
2891c145c9fSmrg  rm -rf conftest.dir
2901c145c9fSmrgelse
2911c145c9fSmrg  am_cv_$1_dependencies_compiler_type=none
2921c145c9fSmrgfi
2931c145c9fSmrg])
2941c145c9fSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2951c145c9fSmrgAM_CONDITIONAL([am__fastdep$1], [
2961c145c9fSmrg  test "x$enable_dependency_tracking" != xno \
2971c145c9fSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2981c145c9fSmrg])
2994fb28925Smrg
3004929c8f8Smrg
3011c145c9fSmrg# AM_SET_DEPDIR
3021c145c9fSmrg# -------------
3031c145c9fSmrg# Choose a directory name for dependency files.
3041c145c9fSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3051c145c9fSmrgAC_DEFUN([AM_SET_DEPDIR],
3061c145c9fSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3071c145c9fSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3081c145c9fSmrg])
3094929c8f8Smrg
3104929c8f8Smrg
3111c145c9fSmrg# AM_DEP_TRACK
3121c145c9fSmrg# ------------
3131c145c9fSmrgAC_DEFUN([AM_DEP_TRACK],
3141c145c9fSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3151c145c9fSmrgAS_HELP_STRING(
3161c145c9fSmrg  [--enable-dependency-tracking],
3171c145c9fSmrg  [do not reject slow dependency extractors])
3181c145c9fSmrgAS_HELP_STRING(
3191c145c9fSmrg  [--disable-dependency-tracking],
3201c145c9fSmrg  [speeds up one-time build])])
3211c145c9fSmrgif test "x$enable_dependency_tracking" != xno; then
3221c145c9fSmrg  am_depcomp="$ac_aux_dir/depcomp"
3231c145c9fSmrg  AMDEPBACKSLASH='\'
3241c145c9fSmrg  am__nodep='_no'
3251c145c9fSmrgfi
3261c145c9fSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3271c145c9fSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3281c145c9fSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3291c145c9fSmrgAC_SUBST([am__nodep])dnl
3301c145c9fSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3311c145c9fSmrg])
3324929c8f8Smrg
3331c145c9fSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3344929c8f8Smrg
3351c145c9fSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3364929c8f8Smrg#
3371c145c9fSmrg# This file is free software; the Free Software Foundation
3381c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
3391c145c9fSmrg# with or without modifications, as long as this notice is preserved.
3404929c8f8Smrg
3411c145c9fSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3421c145c9fSmrg# ------------------------------
3431c145c9fSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3441c145c9fSmrg[{
3451c145c9fSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
3461c145c9fSmrg  # are listed without --file.  Let's play safe and only enable the eval
3471c145c9fSmrg  # if we detect the quoting.
3481c145c9fSmrg  # TODO: see whether this extra hack can be removed once we start
3491c145c9fSmrg  # requiring Autoconf 2.70 or later.
3501c145c9fSmrg  AS_CASE([$CONFIG_FILES],
3511c145c9fSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
3521c145c9fSmrg          [*], [set x $CONFIG_FILES])
3531c145c9fSmrg  shift
3541c145c9fSmrg  # Used to flag and report bootstrapping failures.
3551c145c9fSmrg  am_rc=0
3561c145c9fSmrg  for am_mf
3571c145c9fSmrg  do
3581c145c9fSmrg    # Strip MF so we end up with the name of the file.
3591c145c9fSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3601c145c9fSmrg    # Check whether this is an Automake generated Makefile which includes
3611c145c9fSmrg    # dependency-tracking related rules and includes.
3621c145c9fSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3631c145c9fSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3641c145c9fSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3651c145c9fSmrg      || continue
3661c145c9fSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3671c145c9fSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3681c145c9fSmrg    AM_RUN_LOG([cd "$am_dirpart" \
3691c145c9fSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3701c145c9fSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3711c145c9fSmrg  done
3721c145c9fSmrg  if test $am_rc -ne 0; then
3731c145c9fSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3741c145c9fSmrg    for automatic dependency tracking.  If GNU make was not used, consider
3751c145c9fSmrg    re-running the configure script with MAKE="gmake" (or whatever is
3761c145c9fSmrg    necessary).  You can also try re-running configure with the
3771c145c9fSmrg    '--disable-dependency-tracking' option to at least be able to build
3781c145c9fSmrg    the package (albeit without support for automatic dependency tracking).])
3791c145c9fSmrg  fi
3801c145c9fSmrg  AS_UNSET([am_dirpart])
3811c145c9fSmrg  AS_UNSET([am_filepart])
3821c145c9fSmrg  AS_UNSET([am_mf])
3831c145c9fSmrg  AS_UNSET([am_rc])
3841c145c9fSmrg  rm -f conftest-deps.mk
3851c145c9fSmrg}
3861c145c9fSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3874fb28925Smrg
3884fb28925Smrg
3891c145c9fSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3901c145c9fSmrg# -----------------------------
3911c145c9fSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3924929c8f8Smrg#
3931c145c9fSmrg# This code is only required when automatic dependency tracking is enabled.
3941c145c9fSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3951c145c9fSmrg# order to bootstrap the dependency handling code.
3961c145c9fSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3971c145c9fSmrg[AC_CONFIG_COMMANDS([depfiles],
3981c145c9fSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3991c145c9fSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4004fb28925Smrg
4011c145c9fSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4024fb28925Smrg
4031c145c9fSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4041c145c9fSmrg#
4051c145c9fSmrg# This file is free software; the Free Software Foundation
4061c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
4071c145c9fSmrg# with or without modifications, as long as this notice is preserved.
4084fb28925Smrg
4091c145c9fSmrg# This macro actually does too much.  Some checks are only needed if
4101c145c9fSmrg# your package does certain things.  But this isn't really a big deal.
4114fb28925Smrg
4121c145c9fSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4131c145c9fSmrgm4_define([AC_PROG_CC],
4141c145c9fSmrgm4_defn([AC_PROG_CC])
4151c145c9fSmrg[_AM_PROG_CC_C_O
4161c145c9fSmrg])
4174fb28925Smrg
4181c145c9fSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4191c145c9fSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4201c145c9fSmrg# -----------------------------------------------
4211c145c9fSmrg# The call with PACKAGE and VERSION arguments is the old style
4221c145c9fSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4231c145c9fSmrg# and VERSION should now be passed to AC_INIT and removed from
4241c145c9fSmrg# the call to AM_INIT_AUTOMAKE.
4251c145c9fSmrg# We support both call styles for the transition.  After
4261c145c9fSmrg# the next Automake release, Autoconf can make the AC_INIT
4271c145c9fSmrg# arguments mandatory, and then we can depend on a new Autoconf
4281c145c9fSmrg# release and drop the old call support.
4291c145c9fSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4301c145c9fSmrg[AC_PREREQ([2.65])dnl
4311c145c9fSmrgm4_ifdef([_$0_ALREADY_INIT],
4321c145c9fSmrg  [m4_fatal([$0 expanded multiple times
4331c145c9fSmrg]m4_defn([_$0_ALREADY_INIT]))],
4341c145c9fSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4351c145c9fSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4361c145c9fSmrgdnl the ones we care about.
4371c145c9fSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4381c145c9fSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4391c145c9fSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4401c145c9fSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4411c145c9fSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4421c145c9fSmrg  # is not polluted with repeated "-I."
4431c145c9fSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4441c145c9fSmrg  # test to see if srcdir already configured
4451c145c9fSmrg  if test -f $srcdir/config.status; then
4461c145c9fSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4471c145c9fSmrg  fi
4484929c8f8Smrgfi
4494fb28925Smrg
4501c145c9fSmrg# test whether we have cygpath
4511c145c9fSmrgif test -z "$CYGPATH_W"; then
4521c145c9fSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4531c145c9fSmrg    CYGPATH_W='cygpath -w'
4541c145c9fSmrg  else
4551c145c9fSmrg    CYGPATH_W=echo
4561c145c9fSmrg  fi
4574929c8f8Smrgfi
4581c145c9fSmrgAC_SUBST([CYGPATH_W])
4594929c8f8Smrg
4601c145c9fSmrg# Define the identity of the package.
4611c145c9fSmrgdnl Distinguish between old-style and new-style calls.
4621c145c9fSmrgm4_ifval([$2],
4631c145c9fSmrg[AC_DIAGNOSE([obsolete],
4641c145c9fSmrg             [$0: two- and three-arguments forms are deprecated.])
4651c145c9fSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4661c145c9fSmrg AC_SUBST([PACKAGE], [$1])dnl
4671c145c9fSmrg AC_SUBST([VERSION], [$2])],
4681c145c9fSmrg[_AM_SET_OPTIONS([$1])dnl
4691c145c9fSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4701c145c9fSmrgm4_if(
4711c145c9fSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4721c145c9fSmrg  [ok:ok],,
4731c145c9fSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4741c145c9fSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4751c145c9fSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4764fb28925Smrg
4771c145c9fSmrg_AM_IF_OPTION([no-define],,
4781c145c9fSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4791c145c9fSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4804fb28925Smrg
4811c145c9fSmrg# Some tools Automake needs.
4821c145c9fSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4831c145c9fSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4841c145c9fSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4851c145c9fSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4861c145c9fSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4871c145c9fSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4881c145c9fSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4891c145c9fSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4901c145c9fSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4911c145c9fSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4921c145c9fSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
4931c145c9fSmrg# dies out for good.  For more background, see:
4941c145c9fSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4951c145c9fSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4961c145c9fSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4971c145c9fSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
4981c145c9fSmrg# system "awk" is bad on some platforms.
4991c145c9fSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5001c145c9fSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5011c145c9fSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5021c145c9fSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5031c145c9fSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5041c145c9fSmrg			     [_AM_PROG_TAR([v7])])])
5051c145c9fSmrg_AM_IF_OPTION([no-dependencies],,
5061c145c9fSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5071c145c9fSmrg		  [_AM_DEPENDENCIES([CC])],
5081c145c9fSmrg		  [m4_define([AC_PROG_CC],
5091c145c9fSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5101c145c9fSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5111c145c9fSmrg		  [_AM_DEPENDENCIES([CXX])],
5121c145c9fSmrg		  [m4_define([AC_PROG_CXX],
5131c145c9fSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5141c145c9fSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5151c145c9fSmrg		  [_AM_DEPENDENCIES([OBJC])],
5161c145c9fSmrg		  [m4_define([AC_PROG_OBJC],
5171c145c9fSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5181c145c9fSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5191c145c9fSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
5201c145c9fSmrg		  [m4_define([AC_PROG_OBJCXX],
5211c145c9fSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5221c145c9fSmrg])
5231c145c9fSmrg# Variables for tags utilities; see am/tags.am
5241c145c9fSmrgif test -z "$CTAGS"; then
5251c145c9fSmrg  CTAGS=ctags
5261c145c9fSmrgfi
5271c145c9fSmrgAC_SUBST([CTAGS])
5281c145c9fSmrgif test -z "$ETAGS"; then
5291c145c9fSmrg  ETAGS=etags
5301c145c9fSmrgfi
5311c145c9fSmrgAC_SUBST([ETAGS])
5321c145c9fSmrgif test -z "$CSCOPE"; then
5331c145c9fSmrg  CSCOPE=cscope
5341c145c9fSmrgfi
5351c145c9fSmrgAC_SUBST([CSCOPE])
5364929c8f8Smrg
5371c145c9fSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5381c145c9fSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
5391c145c9fSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5401c145c9fSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5411c145c9fSmrgAC_CONFIG_COMMANDS_PRE(dnl
5421c145c9fSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5431c145c9fSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5444929c8f8Smrg
5451c145c9fSmrg# POSIX will say in a future version that running "rm -f" with no argument
5461c145c9fSmrg# is OK; and we want to be able to make that assumption in our Makefile
5471c145c9fSmrg# recipes.  So use an aggressive probe to check that the usage we want is
5481c145c9fSmrg# actually supported "in the wild" to an acceptable degree.
5491c145c9fSmrg# See automake bug#10828.
5501c145c9fSmrg# To make any issue more visible, cause the running configure to be aborted
5511c145c9fSmrg# by default if the 'rm' program in use doesn't match our expectations; the
5521c145c9fSmrg# user can still override this though.
5531c145c9fSmrgif rm -f && rm -fr && rm -rf; then : OK; else
5541c145c9fSmrg  cat >&2 <<'END'
5551c145c9fSmrgOops!
5564fb28925Smrg
5571c145c9fSmrgYour 'rm' program seems unable to run without file operands specified
5581c145c9fSmrgon the command line, even when the '-f' option is present.  This is contrary
5591c145c9fSmrgto the behaviour of most rm programs out there, and not conforming with
5601c145c9fSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5614929c8f8Smrg
5621c145c9fSmrgPlease tell bug-automake@gnu.org about your system, including the value
5631c145c9fSmrgof your $PATH and any error possibly output before this message.  This
5641c145c9fSmrgcan help us improve future automake versions.
5654fb28925Smrg
5661c145c9fSmrgEND
5671c145c9fSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5681c145c9fSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5691c145c9fSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5701c145c9fSmrg    echo >&2
5711c145c9fSmrg  else
5721c145c9fSmrg    cat >&2 <<'END'
5731c145c9fSmrgAborting the configuration process, to ensure you take notice of the issue.
5744fb28925Smrg
5751c145c9fSmrgYou can download and install GNU coreutils to get an 'rm' implementation
5761c145c9fSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577b66d1acbSmrg
5781c145c9fSmrgIf you want to complete the configuration process using your problematic
5791c145c9fSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5801c145c9fSmrgto "yes", and re-run configure.
581df58931aSmrg
5821c145c9fSmrgEND
5831c145c9fSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5841c145c9fSmrg  fi
5854fb28925Smrgfi
5861c145c9fSmrgdnl The trailing newline in this macro's definition is deliberate, for
5871c145c9fSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5881c145c9fSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5891c145c9fSmrg])
590b66d1acbSmrg
5911c145c9fSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5921c145c9fSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5931c145c9fSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5941c145c9fSmrgm4_define([_AC_COMPILER_EXEEXT],
5951c145c9fSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5964929c8f8Smrg
5971c145c9fSmrg# When config.status generates a header, we must update the stamp-h file.
5981c145c9fSmrg# This file resides in the same directory as the config header
5991c145c9fSmrg# that is generated.  The stamp files are numbered to have different names.
6004929c8f8Smrg
6011c145c9fSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
6021c145c9fSmrg# loop where config.status creates the headers, so we can generate
6031c145c9fSmrg# our stamp files there.
6041c145c9fSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
6051c145c9fSmrg[# Compute $1's index in $config_headers.
6061c145c9fSmrg_am_arg=$1
6071c145c9fSmrg_am_stamp_count=1
6081c145c9fSmrgfor _am_header in $config_headers :; do
6091c145c9fSmrg  case $_am_header in
6101c145c9fSmrg    $_am_arg | $_am_arg:* )
6111c145c9fSmrg      break ;;
6121c145c9fSmrg    * )
6131c145c9fSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6141c145c9fSmrg  esac
6151c145c9fSmrgdone
6161c145c9fSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6174929c8f8Smrg
6181c145c9fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6191c145c9fSmrg#
6201c145c9fSmrg# This file is free software; the Free Software Foundation
6211c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
6221c145c9fSmrg# with or without modifications, as long as this notice is preserved.
6231c145c9fSmrg
6241c145c9fSmrg# AM_PROG_INSTALL_SH
6251c145c9fSmrg# ------------------
6261c145c9fSmrg# Define $install_sh.
6271c145c9fSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6281c145c9fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6291c145c9fSmrgif test x"${install_sh+set}" != xset; then
6301c145c9fSmrg  case $am_aux_dir in
6311c145c9fSmrg  *\ * | *\	*)
6321c145c9fSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6331c145c9fSmrg  *)
6341c145c9fSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6351c145c9fSmrg  esac
6361c145c9fSmrgfi
6371c145c9fSmrgAC_SUBST([install_sh])])
6381c145c9fSmrg
6391c145c9fSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
6401c145c9fSmrg#
6411c145c9fSmrg# This file is free software; the Free Software Foundation
6421c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
6431c145c9fSmrg# with or without modifications, as long as this notice is preserved.
6441c145c9fSmrg
6451c145c9fSmrg# Check whether the underlying file-system supports filenames
6461c145c9fSmrg# with a leading dot.  For instance MS-DOS doesn't.
6471c145c9fSmrgAC_DEFUN([AM_SET_LEADING_DOT],
6481c145c9fSmrg[rm -rf .tst 2>/dev/null
6491c145c9fSmrgmkdir .tst 2>/dev/null
6501c145c9fSmrgif test -d .tst; then
6511c145c9fSmrg  am__leading_dot=.
6524929c8f8Smrgelse
6531c145c9fSmrg  am__leading_dot=_
6544fb28925Smrgfi
6551c145c9fSmrgrmdir .tst 2>/dev/null
6561c145c9fSmrgAC_SUBST([am__leading_dot])])
6574fb28925Smrg
6581c145c9fSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6594fb28925Smrg
6601c145c9fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6611c145c9fSmrg#
6621c145c9fSmrg# This file is free software; the Free Software Foundation
6631c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
6641c145c9fSmrg# with or without modifications, as long as this notice is preserved.
6654fb28925Smrg
6661c145c9fSmrg# AM_MAKE_INCLUDE()
6671c145c9fSmrg# -----------------
6681c145c9fSmrg# Check whether make has an 'include' directive that can support all
6691c145c9fSmrg# the idioms we need for our automatic dependency tracking code.
6701c145c9fSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6711c145c9fSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6721c145c9fSmrgcat > confinc.mk << 'END'
6731c145c9fSmrgam__doit:
6741c145c9fSmrg	@echo this is the am__doit target >confinc.out
6751c145c9fSmrg.PHONY: am__doit
6761c145c9fSmrgEND
6771c145c9fSmrgam__include="#"
6781c145c9fSmrgam__quote=
6791c145c9fSmrg# BSD make does it like this.
6801c145c9fSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6811c145c9fSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6821c145c9fSmrgecho 'include confinc.mk # ignored' > confmf.GNU
6831c145c9fSmrg_am_result=no
6841c145c9fSmrgfor s in GNU BSD; do
6851c145c9fSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6861c145c9fSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6871c145c9fSmrg      ['0:this is the am__doit target'],
6881c145c9fSmrg      [AS_CASE([$s],
6891c145c9fSmrg          [BSD], [am__include='.include' am__quote='"'],
6901c145c9fSmrg          [am__include='include' am__quote=''])])
6911c145c9fSmrg  if test "$am__include" != "#"; then
6921c145c9fSmrg    _am_result="yes ($s style)"
6931c145c9fSmrg    break
6941c145c9fSmrg  fi
6951c145c9fSmrgdone
6961c145c9fSmrgrm -f confinc.* confmf.*
6971c145c9fSmrgAC_MSG_RESULT([${_am_result}])
6981c145c9fSmrgAC_SUBST([am__include])])
6991c145c9fSmrgAC_SUBST([am__quote])])
7004fb28925Smrg
7011c145c9fSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702df58931aSmrg
7031c145c9fSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
7044929c8f8Smrg#
7051c145c9fSmrg# This file is free software; the Free Software Foundation
7061c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
7071c145c9fSmrg# with or without modifications, as long as this notice is preserved.
708df58931aSmrg
7091c145c9fSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7101c145c9fSmrg# ------------------------------
7111c145c9fSmrgAC_DEFUN([AM_MISSING_PROG],
7121c145c9fSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7131c145c9fSmrg$1=${$1-"${am_missing_run}$2"}
7141c145c9fSmrgAC_SUBST($1)])
715df58931aSmrg
7161c145c9fSmrg# AM_MISSING_HAS_RUN
7171c145c9fSmrg# ------------------
7181c145c9fSmrg# Define MISSING if not defined so far and test if it is modern enough.
7191c145c9fSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7201c145c9fSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7211c145c9fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7221c145c9fSmrgAC_REQUIRE_AUX_FILE([missing])dnl
7231c145c9fSmrgif test x"${MISSING+set}" != xset; then
7241c145c9fSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
7254929c8f8Smrgfi
7261c145c9fSmrg# Use eval to expand $SHELL
7271c145c9fSmrgif eval "$MISSING --is-lightweight"; then
7281c145c9fSmrg  am_missing_run="$MISSING "
7291c145c9fSmrgelse
7301c145c9fSmrg  am_missing_run=
7311c145c9fSmrg  AC_MSG_WARN(['missing' script is too old or missing])
7324929c8f8Smrgfi
7331c145c9fSmrg])
734df58931aSmrg
7351c145c9fSmrg# Helper functions for option handling.                     -*- Autoconf -*-
736df58931aSmrg
7371c145c9fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
7381c145c9fSmrg#
7391c145c9fSmrg# This file is free software; the Free Software Foundation
7401c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
7411c145c9fSmrg# with or without modifications, as long as this notice is preserved.
7424fb28925Smrg
7431c145c9fSmrg# _AM_MANGLE_OPTION(NAME)
7441c145c9fSmrg# -----------------------
7451c145c9fSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7461c145c9fSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747b66d1acbSmrg
7481c145c9fSmrg# _AM_SET_OPTION(NAME)
7491c145c9fSmrg# --------------------
7501c145c9fSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7511c145c9fSmrgAC_DEFUN([_AM_SET_OPTION],
7521c145c9fSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7534fb28925Smrg
7541c145c9fSmrg# _AM_SET_OPTIONS(OPTIONS)
7551c145c9fSmrg# ------------------------
7561c145c9fSmrg# OPTIONS is a space-separated list of Automake options.
7571c145c9fSmrgAC_DEFUN([_AM_SET_OPTIONS],
7581c145c9fSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7591c145c9fSmrg
7601c145c9fSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7611c145c9fSmrg# -------------------------------------------
7621c145c9fSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7631c145c9fSmrgAC_DEFUN([_AM_IF_OPTION],
7641c145c9fSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7651c145c9fSmrg
7661c145c9fSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
7674929c8f8Smrg#
7681c145c9fSmrg# This file is free software; the Free Software Foundation
7691c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
7701c145c9fSmrg# with or without modifications, as long as this notice is preserved.
7714fb28925Smrg
7721c145c9fSmrg# _AM_PROG_CC_C_O
7731c145c9fSmrg# ---------------
7741c145c9fSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7751c145c9fSmrg# to automatically call this.
7761c145c9fSmrgAC_DEFUN([_AM_PROG_CC_C_O],
7771c145c9fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7781c145c9fSmrgAC_REQUIRE_AUX_FILE([compile])dnl
7791c145c9fSmrgAC_LANG_PUSH([C])dnl
7801c145c9fSmrgAC_CACHE_CHECK(
7811c145c9fSmrg  [whether $CC understands -c and -o together],
7821c145c9fSmrg  [am_cv_prog_cc_c_o],
7831c145c9fSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7841c145c9fSmrg  # Make sure it works both with $CC and with simple cc.
7851c145c9fSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7861c145c9fSmrg  # compilers refuse to overwrite an existing .o file with -o,
7871c145c9fSmrg  # though they will create one.
7881c145c9fSmrg  am_cv_prog_cc_c_o=yes
7891c145c9fSmrg  for am_i in 1 2; do
7901c145c9fSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7911c145c9fSmrg         && test -f conftest2.$ac_objext; then
7921c145c9fSmrg      : OK
7931c145c9fSmrg    else
7941c145c9fSmrg      am_cv_prog_cc_c_o=no
7951c145c9fSmrg      break
7961c145c9fSmrg    fi
7971c145c9fSmrg  done
7981c145c9fSmrg  rm -f core conftest*
7991c145c9fSmrg  unset am_i])
8001c145c9fSmrgif test "$am_cv_prog_cc_c_o" != yes; then
8011c145c9fSmrg   # Losing compiler, so override with the script.
8021c145c9fSmrg   # FIXME: It is wrong to rewrite CC.
8031c145c9fSmrg   # But if we don't then we get into trouble of one sort or another.
8041c145c9fSmrg   # A longer-term fix would be to have automake use am__CC in this case,
8051c145c9fSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8061c145c9fSmrg   CC="$am_aux_dir/compile $CC"
807b66d1acbSmrgfi
8081c145c9fSmrgAC_LANG_POP([C])])
8094fb28925Smrg
8101c145c9fSmrg# For backward compatibility.
8111c145c9fSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8124fb28925Smrg
8131c145c9fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814b66d1acbSmrg#
8151c145c9fSmrg# This file is free software; the Free Software Foundation
8161c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
8171c145c9fSmrg# with or without modifications, as long as this notice is preserved.
8184fb28925Smrg
8191c145c9fSmrg# AM_RUN_LOG(COMMAND)
8201c145c9fSmrg# -------------------
8211c145c9fSmrg# Run COMMAND, save the exit status in ac_status, and log it.
8221c145c9fSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8231c145c9fSmrgAC_DEFUN([AM_RUN_LOG],
8241c145c9fSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8251c145c9fSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8261c145c9fSmrg   ac_status=$?
8271c145c9fSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8281c145c9fSmrg   (exit $ac_status); }])
8291c145c9fSmrg
8301c145c9fSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8311c145c9fSmrg
8321c145c9fSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833b66d1acbSmrg#
8341c145c9fSmrg# This file is free software; the Free Software Foundation
8351c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
8361c145c9fSmrg# with or without modifications, as long as this notice is preserved.
8374fb28925Smrg
8381c145c9fSmrg# AM_SANITY_CHECK
8391c145c9fSmrg# ---------------
8401c145c9fSmrgAC_DEFUN([AM_SANITY_CHECK],
8411c145c9fSmrg[AC_MSG_CHECKING([whether build environment is sane])
8421c145c9fSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8431c145c9fSmrg# name.  Accept space and tab only in the latter.
8441c145c9fSmrgam_lf='
8451c145c9fSmrg'
8461c145c9fSmrgcase `pwd` in
8471c145c9fSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8481c145c9fSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8491c145c9fSmrgesac
8501c145c9fSmrgcase $srcdir in
8511c145c9fSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8521c145c9fSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8531c145c9fSmrgesac
8541c145c9fSmrg
8551c145c9fSmrg# Do 'set' in a subshell so we don't clobber the current shell's
8561c145c9fSmrg# arguments.  Must try -L first in case configure is actually a
8571c145c9fSmrg# symlink; some systems play weird games with the mod time of symlinks
8581c145c9fSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8591c145c9fSmrg# directory).
8601c145c9fSmrgif (
8611c145c9fSmrg   am_has_slept=no
8621c145c9fSmrg   for am_try in 1 2; do
8631c145c9fSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8641c145c9fSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8651c145c9fSmrg     if test "$[*]" = "X"; then
8661c145c9fSmrg	# -L didn't work.
8671c145c9fSmrg	set X `ls -t "$srcdir/configure" conftest.file`
8681c145c9fSmrg     fi
8691c145c9fSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8701c145c9fSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8711c145c9fSmrg
8721c145c9fSmrg	# If neither matched, then we have a broken ls.  This can happen
8731c145c9fSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8741c145c9fSmrg	# broken ls alias from the environment.  This has actually
8751c145c9fSmrg	# happened.  Such a system could not be considered "sane".
8761c145c9fSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8771c145c9fSmrg  alias in your environment])
8781c145c9fSmrg     fi
8791c145c9fSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8801c145c9fSmrg       break
8811c145c9fSmrg     fi
8821c145c9fSmrg     # Just in case.
8831c145c9fSmrg     sleep 1
8841c145c9fSmrg     am_has_slept=yes
8851c145c9fSmrg   done
8861c145c9fSmrg   test "$[2]" = conftest.file
8871c145c9fSmrg   )
8881c145c9fSmrgthen
8891c145c9fSmrg   # Ok.
8901c145c9fSmrg   :
891b66d1acbSmrgelse
8921c145c9fSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
8931c145c9fSmrgCheck your system clock])
894b66d1acbSmrgfi
8951c145c9fSmrgAC_MSG_RESULT([yes])
8961c145c9fSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8971c145c9fSmrg# generated files are strictly newer.
8981c145c9fSmrgam_sleep_pid=
8991c145c9fSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9001c145c9fSmrg  ( sleep 1 ) &
9011c145c9fSmrg  am_sleep_pid=$!
9021c145c9fSmrgfi
9031c145c9fSmrgAC_CONFIG_COMMANDS_PRE(
9041c145c9fSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9051c145c9fSmrg   if test -n "$am_sleep_pid"; then
9061c145c9fSmrg     # Hide warnings about reused PIDs.
9071c145c9fSmrg     wait $am_sleep_pid 2>/dev/null
9081c145c9fSmrg   fi
9091c145c9fSmrg   AC_MSG_RESULT([done])])
9101c145c9fSmrgrm -f conftest.file
9111c145c9fSmrg])
9124fb28925Smrg
9131c145c9fSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9144929c8f8Smrg#
9151c145c9fSmrg# This file is free software; the Free Software Foundation
9161c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
9171c145c9fSmrg# with or without modifications, as long as this notice is preserved.
918df58931aSmrg
9191c145c9fSmrg# AM_SILENT_RULES([DEFAULT])
9201c145c9fSmrg# --------------------------
9211c145c9fSmrg# Enable less verbose build rules; with the default set to DEFAULT
9221c145c9fSmrg# ("yes" being less verbose, "no" or empty being verbose).
9231c145c9fSmrgAC_DEFUN([AM_SILENT_RULES],
9241c145c9fSmrg[AC_ARG_ENABLE([silent-rules], [dnl
9251c145c9fSmrgAS_HELP_STRING(
9261c145c9fSmrg  [--enable-silent-rules],
9271c145c9fSmrg  [less verbose build output (undo: "make V=1")])
9281c145c9fSmrgAS_HELP_STRING(
9291c145c9fSmrg  [--disable-silent-rules],
9301c145c9fSmrg  [verbose build output (undo: "make V=0")])dnl
9311c145c9fSmrg])
9321c145c9fSmrgcase $enable_silent_rules in @%:@ (((
9331c145c9fSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
9341c145c9fSmrg   no) AM_DEFAULT_VERBOSITY=1;;
9351c145c9fSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9361c145c9fSmrgesac
9371c145c9fSmrgdnl
9381c145c9fSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9391c145c9fSmrgdnl do not support nested variable expansions.
9401c145c9fSmrgdnl See automake bug#9928 and bug#10237.
9411c145c9fSmrgam_make=${MAKE-make}
9421c145c9fSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9431c145c9fSmrg   [am_cv_make_support_nested_variables],
9441c145c9fSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9451c145c9fSmrgBAR0=false
9461c145c9fSmrgBAR1=true
9471c145c9fSmrgV=1
9481c145c9fSmrgam__doit:
9491c145c9fSmrg	@$(TRUE)
9501c145c9fSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9511c145c9fSmrg  am_cv_make_support_nested_variables=yes
9524929c8f8Smrgelse
9531c145c9fSmrg  am_cv_make_support_nested_variables=no
9541c145c9fSmrgfi])
9551c145c9fSmrgif test $am_cv_make_support_nested_variables = yes; then
9561c145c9fSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9571c145c9fSmrg  AM_V='$(V)'
9581c145c9fSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9591c145c9fSmrgelse
9601c145c9fSmrg  AM_V=$AM_DEFAULT_VERBOSITY
9611c145c9fSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962df58931aSmrgfi
9631c145c9fSmrgAC_SUBST([AM_V])dnl
9641c145c9fSmrgAM_SUBST_NOTMAKE([AM_V])dnl
9651c145c9fSmrgAC_SUBST([AM_DEFAULT_V])dnl
9661c145c9fSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9671c145c9fSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9681c145c9fSmrgAM_BACKSLASH='\'
9691c145c9fSmrgAC_SUBST([AM_BACKSLASH])dnl
9701c145c9fSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9711c145c9fSmrg])
972b66d1acbSmrg
9731c145c9fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
9744929c8f8Smrg#
9751c145c9fSmrg# This file is free software; the Free Software Foundation
9761c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
9771c145c9fSmrg# with or without modifications, as long as this notice is preserved.
978df58931aSmrg
9791c145c9fSmrg# AM_PROG_INSTALL_STRIP
9801c145c9fSmrg# ---------------------
9811c145c9fSmrg# One issue with vendor 'install' (even GNU) is that you can't
9821c145c9fSmrg# specify the program used to strip binaries.  This is especially
9831c145c9fSmrg# annoying in cross-compiling environments, where the build's strip
9841c145c9fSmrg# is unlikely to handle the host's binaries.
9851c145c9fSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9861c145c9fSmrg# always use install-sh in "make install-strip", and initialize
9871c145c9fSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
9881c145c9fSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9891c145c9fSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9901c145c9fSmrg# Installed binaries are usually stripped using 'strip' when the user
9911c145c9fSmrg# run "make install-strip".  However 'strip' might not be the right
9921c145c9fSmrg# tool to use in cross-compilation environments, therefore Automake
9931c145c9fSmrg# will honor the 'STRIP' environment variable to overrule this program.
9941c145c9fSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9951c145c9fSmrgif test "$cross_compiling" != no; then
9961c145c9fSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
997df58931aSmrgfi
9981c145c9fSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9991c145c9fSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1000b66d1acbSmrg
10011c145c9fSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
10024929c8f8Smrg#
10031c145c9fSmrg# This file is free software; the Free Software Foundation
10041c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
10051c145c9fSmrg# with or without modifications, as long as this notice is preserved.
1006b66d1acbSmrg
10071c145c9fSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10081c145c9fSmrg# ---------------------------
10091c145c9fSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10101c145c9fSmrg# This macro is traced by Automake.
10111c145c9fSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10124929c8f8Smrg
10131c145c9fSmrg# AM_SUBST_NOTMAKE(VARIABLE)
10141c145c9fSmrg# --------------------------
10151c145c9fSmrg# Public sister of _AM_SUBST_NOTMAKE.
10161c145c9fSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017b66d1acbSmrg
10181c145c9fSmrg# Check how to create a tarball.                            -*- Autoconf -*-
10194929c8f8Smrg
10201c145c9fSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
10214929c8f8Smrg#
10221c145c9fSmrg# This file is free software; the Free Software Foundation
10231c145c9fSmrg# gives unlimited permission to copy and/or distribute it,
10241c145c9fSmrg# with or without modifications, as long as this notice is preserved.
10251c145c9fSmrg
10261c145c9fSmrg# _AM_PROG_TAR(FORMAT)
10271c145c9fSmrg# --------------------
10281c145c9fSmrg# Check how to create a tarball in format FORMAT.
10291c145c9fSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10304929c8f8Smrg#
10311c145c9fSmrg# Substitute a variable $(am__tar) that is a command
10321c145c9fSmrg# writing to stdout a FORMAT-tarball containing the directory
10331c145c9fSmrg# $tardir.
10341c145c9fSmrg#     tardir=directory && $(am__tar) > result.tar
10354929c8f8Smrg#
10361c145c9fSmrg# Substitute a variable $(am__untar) that extract such
10371c145c9fSmrg# a tarball read from stdin.
10381c145c9fSmrg#     $(am__untar) < result.tar
10394929c8f8Smrg#
10401c145c9fSmrgAC_DEFUN([_AM_PROG_TAR],
10411c145c9fSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10421c145c9fSmrg# in the wild :-(  We should find a proper way to deprecate it ...
10431c145c9fSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10444fb28925Smrg
10451c145c9fSmrg# We'll loop over all known methods to create a tar archive until one works.
10461c145c9fSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10474fb28925Smrg
10481c145c9fSmrgm4_if([$1], [v7],
10491c145c9fSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10504fb28925Smrg
10511c145c9fSmrg  [m4_case([$1],
10521c145c9fSmrg    [ustar],
10531c145c9fSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10541c145c9fSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10551c145c9fSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10561c145c9fSmrg      # and bug#13588).
10571c145c9fSmrg      am_max_uid=2097151 # 2^21 - 1
10581c145c9fSmrg      am_max_gid=$am_max_uid
10591c145c9fSmrg      # The $UID and $GID variables are not portable, so we need to resort
10601c145c9fSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10611c145c9fSmrg      # below are definitely unexpected, so allow the users to see them
10621c145c9fSmrg      # (that is, avoid stderr redirection).
10631c145c9fSmrg      am_uid=`id -u || echo unknown`
10641c145c9fSmrg      am_gid=`id -g || echo unknown`
10651c145c9fSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10661c145c9fSmrg      if test $am_uid -le $am_max_uid; then
10671c145c9fSmrg         AC_MSG_RESULT([yes])
10681c145c9fSmrg      else
10691c145c9fSmrg         AC_MSG_RESULT([no])
10701c145c9fSmrg         _am_tools=none
10711c145c9fSmrg      fi
10721c145c9fSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10731c145c9fSmrg      if test $am_gid -le $am_max_gid; then
10741c145c9fSmrg         AC_MSG_RESULT([yes])
10751c145c9fSmrg      else
10761c145c9fSmrg        AC_MSG_RESULT([no])
10771c145c9fSmrg        _am_tools=none
10781c145c9fSmrg      fi],
10794fb28925Smrg
10801c145c9fSmrg  [pax],
10811c145c9fSmrg    [],
10824fb28925Smrg
10831c145c9fSmrg  [m4_fatal([Unknown tar format])])
1084df58931aSmrg
10851c145c9fSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086df58931aSmrg
10871c145c9fSmrg  # Go ahead even if we have the value already cached.  We do so because we
10881c145c9fSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10891c145c9fSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090df58931aSmrg
10911c145c9fSmrg  for _am_tool in $_am_tools; do
10921c145c9fSmrg    case $_am_tool in
10931c145c9fSmrg    gnutar)
10941c145c9fSmrg      for _am_tar in tar gnutar gtar; do
10951c145c9fSmrg        AM_RUN_LOG([$_am_tar --version]) && break
10961c145c9fSmrg      done
10971c145c9fSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10981c145c9fSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10991c145c9fSmrg      am__untar="$_am_tar -xf -"
11001c145c9fSmrg      ;;
11011c145c9fSmrg    plaintar)
11021c145c9fSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11031c145c9fSmrg      # ustar tarball either.
11041c145c9fSmrg      (tar --version) >/dev/null 2>&1 && continue
11051c145c9fSmrg      am__tar='tar chf - "$$tardir"'
11061c145c9fSmrg      am__tar_='tar chf - "$tardir"'
11071c145c9fSmrg      am__untar='tar xf -'
11081c145c9fSmrg      ;;
11091c145c9fSmrg    pax)
11101c145c9fSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
11111c145c9fSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
11121c145c9fSmrg      am__untar='pax -r'
11131c145c9fSmrg      ;;
11141c145c9fSmrg    cpio)
11151c145c9fSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11161c145c9fSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11171c145c9fSmrg      am__untar='cpio -i -H $1 -d'
11181c145c9fSmrg      ;;
11191c145c9fSmrg    none)
11201c145c9fSmrg      am__tar=false
11211c145c9fSmrg      am__tar_=false
11221c145c9fSmrg      am__untar=false
11231c145c9fSmrg      ;;
11241c145c9fSmrg    esac
1125df58931aSmrg
11261c145c9fSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
11271c145c9fSmrg    # and am__untar set.
11281c145c9fSmrg    test -n "${am_cv_prog_tar_$1}" && break
1129df58931aSmrg
11301c145c9fSmrg    # tar/untar a dummy directory, and stop if the command works.
11311c145c9fSmrg    rm -rf conftest.dir
11321c145c9fSmrg    mkdir conftest.dir
11331c145c9fSmrg    echo GrepMe > conftest.dir/file
11341c145c9fSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11351c145c9fSmrg    rm -rf conftest.dir
11361c145c9fSmrg    if test -s conftest.tar; then
11371c145c9fSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
11381c145c9fSmrg      AM_RUN_LOG([cat conftest.dir/file])
11391c145c9fSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11401c145c9fSmrg    fi
11411c145c9fSmrg  done
11421c145c9fSmrg  rm -rf conftest.dir
1143df58931aSmrg
11441c145c9fSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11451c145c9fSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146df58931aSmrg
11471c145c9fSmrgAC_SUBST([am__tar])
11481c145c9fSmrgAC_SUBST([am__untar])
11491c145c9fSmrg]) # _AM_PROG_TAR
1150df58931aSmrg
11511c145c9fSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
11521c145c9fSmrgdnl serial 11 (pkg-config-0.29)
11531c145c9fSmrgdnl
11541c145c9fSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11551c145c9fSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
11561c145c9fSmrgdnl
11571c145c9fSmrgdnl This program is free software; you can redistribute it and/or modify
11581c145c9fSmrgdnl it under the terms of the GNU General Public License as published by
11591c145c9fSmrgdnl the Free Software Foundation; either version 2 of the License, or
11601c145c9fSmrgdnl (at your option) any later version.
11611c145c9fSmrgdnl
11621c145c9fSmrgdnl This program is distributed in the hope that it will be useful, but
11631c145c9fSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
11641c145c9fSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11651c145c9fSmrgdnl General Public License for more details.
11661c145c9fSmrgdnl
11671c145c9fSmrgdnl You should have received a copy of the GNU General Public License
11681c145c9fSmrgdnl along with this program; if not, write to the Free Software
11691c145c9fSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
11701c145c9fSmrgdnl 02111-1307, USA.
11711c145c9fSmrgdnl
11721c145c9fSmrgdnl As a special exception to the GNU General Public License, if you
11731c145c9fSmrgdnl distribute this file as part of a program that contains a
11741c145c9fSmrgdnl configuration script generated by Autoconf, you may include it under
11751c145c9fSmrgdnl the same distribution terms that you use for the rest of that
11761c145c9fSmrgdnl program.
1177df58931aSmrg
11781c145c9fSmrgdnl PKG_PREREQ(MIN-VERSION)
11791c145c9fSmrgdnl -----------------------
11801c145c9fSmrgdnl Since: 0.29
11811c145c9fSmrgdnl
11821c145c9fSmrgdnl Verify that the version of the pkg-config macros are at least
11831c145c9fSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
11841c145c9fSmrgdnl installed version of pkg-config, this checks the developer's version
11851c145c9fSmrgdnl of pkg.m4 when generating configure.
11861c145c9fSmrgdnl
11871c145c9fSmrgdnl To ensure that this macro is defined, also add:
11881c145c9fSmrgdnl m4_ifndef([PKG_PREREQ],
11891c145c9fSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
11901c145c9fSmrgdnl
11911c145c9fSmrgdnl See the "Since" comment for each macro you use to see what version
11921c145c9fSmrgdnl of the macros you require.
11931c145c9fSmrgm4_defun([PKG_PREREQ],
11941c145c9fSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
11951c145c9fSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
11961c145c9fSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
11971c145c9fSmrg])dnl PKG_PREREQ
11984fb28925Smrg
11991c145c9fSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
12001c145c9fSmrgdnl ----------------------------------
12011c145c9fSmrgdnl Since: 0.16
12021c145c9fSmrgdnl
12031c145c9fSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
12041c145c9fSmrgdnl first found in the path. Checks that the version of pkg-config found
12051c145c9fSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
12061c145c9fSmrgdnl used since that's the first version where most current features of
12071c145c9fSmrgdnl pkg-config existed.
12081c145c9fSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12091c145c9fSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12101c145c9fSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
12111c145c9fSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
12121c145c9fSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
12131c145c9fSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
12141c145c9fSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
12154fb28925Smrg
12161c145c9fSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12171c145c9fSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12184fb28925Smrgfi
12191c145c9fSmrgif test -n "$PKG_CONFIG"; then
12201c145c9fSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
12211c145c9fSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12221c145c9fSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12231c145c9fSmrg		AC_MSG_RESULT([yes])
12241c145c9fSmrg	else
12251c145c9fSmrg		AC_MSG_RESULT([no])
12261c145c9fSmrg		PKG_CONFIG=""
12271c145c9fSmrg	fi
12281c145c9fSmrgfi[]dnl
12291c145c9fSmrg])dnl PKG_PROG_PKG_CONFIG
12304fb28925Smrg
12311c145c9fSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12321c145c9fSmrgdnl -------------------------------------------------------------------
12331c145c9fSmrgdnl Since: 0.18
12341c145c9fSmrgdnl
12351c145c9fSmrgdnl Check to see whether a particular set of modules exists. Similar to
12361c145c9fSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
12371c145c9fSmrgdnl
12381c145c9fSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12391c145c9fSmrgdnl only at the first occurence in configure.ac, so if the first place
12401c145c9fSmrgdnl it's called might be skipped (such as if it is within an "if", you
12411c145c9fSmrgdnl have to call PKG_CHECK_EXISTS manually
12421c145c9fSmrgAC_DEFUN([PKG_CHECK_EXISTS],
12431c145c9fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12441c145c9fSmrgif test -n "$PKG_CONFIG" && \
12451c145c9fSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12461c145c9fSmrg  m4_default([$2], [:])
12471c145c9fSmrgm4_ifvaln([$3], [else
12481c145c9fSmrg  $3])dnl
12491c145c9fSmrgfi])
12501c145c9fSmrg
12511c145c9fSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12521c145c9fSmrgdnl ---------------------------------------------
12531c145c9fSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12541c145c9fSmrgdnl pkg_failed based on the result.
12551c145c9fSmrgm4_define([_PKG_CONFIG],
12561c145c9fSmrg[if test -n "$$1"; then
12571c145c9fSmrg    pkg_cv_[]$1="$$1"
12581c145c9fSmrg elif test -n "$PKG_CONFIG"; then
12591c145c9fSmrg    PKG_CHECK_EXISTS([$3],
12601c145c9fSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
12611c145c9fSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
12621c145c9fSmrg		     [pkg_failed=yes])
12631c145c9fSmrg else
12641c145c9fSmrg    pkg_failed=untried
12651c145c9fSmrgfi[]dnl
12661c145c9fSmrg])dnl _PKG_CONFIG
12671c145c9fSmrg
12681c145c9fSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
12691c145c9fSmrgdnl ---------------------------
12701c145c9fSmrgdnl Internal check to see if pkg-config supports short errors.
12711c145c9fSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12721c145c9fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12731c145c9fSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12741c145c9fSmrg        _pkg_short_errors_supported=yes
12754929c8f8Smrgelse
12761c145c9fSmrg        _pkg_short_errors_supported=no
12771c145c9fSmrgfi[]dnl
12781c145c9fSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
12794fb28925Smrg
12804fb28925Smrg
12811c145c9fSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12821c145c9fSmrgdnl   [ACTION-IF-NOT-FOUND])
12831c145c9fSmrgdnl --------------------------------------------------------------
12841c145c9fSmrgdnl Since: 0.4.0
12851c145c9fSmrgdnl
12861c145c9fSmrgdnl Note that if there is a possibility the first call to
12871c145c9fSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
12881c145c9fSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12891c145c9fSmrgAC_DEFUN([PKG_CHECK_MODULES],
12901c145c9fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12911c145c9fSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12921c145c9fSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12934fb28925Smrg
12941c145c9fSmrgpkg_failed=no
12951c145c9fSmrgAC_MSG_CHECKING([for $1])
1296df58931aSmrg
12971c145c9fSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12981c145c9fSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299df58931aSmrg
13001c145c9fSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
13011c145c9fSmrgand $1[]_LIBS to avoid the need to call pkg-config.
13021c145c9fSmrgSee the pkg-config man page for more details.])
1303df58931aSmrg
13041c145c9fSmrgif test $pkg_failed = yes; then
13051c145c9fSmrg   	AC_MSG_RESULT([no])
13061c145c9fSmrg        _PKG_SHORT_ERRORS_SUPPORTED
13071c145c9fSmrg        if test $_pkg_short_errors_supported = yes; then
13081c145c9fSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
13091c145c9fSmrg        else 
13101c145c9fSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
13111c145c9fSmrg        fi
13121c145c9fSmrg	# Put the nasty error message in config.log where it belongs
13131c145c9fSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13144fb28925Smrg
13151c145c9fSmrg	m4_default([$4], [AC_MSG_ERROR(
13161c145c9fSmrg[Package requirements ($2) were not met:
13174fb28925Smrg
13181c145c9fSmrg$$1_PKG_ERRORS
13191c145c9fSmrg
13201c145c9fSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13211c145c9fSmrginstalled software in a non-standard prefix.
13221c145c9fSmrg
13231c145c9fSmrg_PKG_TEXT])[]dnl
13241c145c9fSmrg        ])
13251c145c9fSmrgelif test $pkg_failed = untried; then
13261c145c9fSmrg     	AC_MSG_RESULT([no])
13271c145c9fSmrg	m4_default([$4], [AC_MSG_FAILURE(
13281c145c9fSmrg[The pkg-config script could not be found or is too old.  Make sure it
13291c145c9fSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
13301c145c9fSmrgpath to pkg-config.
13311c145c9fSmrg
13321c145c9fSmrg_PKG_TEXT
13331c145c9fSmrg
13341c145c9fSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
13351c145c9fSmrg        ])
13364fb28925Smrgelse
13371c145c9fSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13381c145c9fSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13391c145c9fSmrg        AC_MSG_RESULT([yes])
13401c145c9fSmrg	$3
13411c145c9fSmrgfi[]dnl
13421c145c9fSmrg])dnl PKG_CHECK_MODULES
13434fb28925Smrg
13444fb28925Smrg
13451c145c9fSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
13461c145c9fSmrgdnl   [ACTION-IF-NOT-FOUND])
13471c145c9fSmrgdnl ---------------------------------------------------------------------
13481c145c9fSmrgdnl Since: 0.29
13491c145c9fSmrgdnl
13501c145c9fSmrgdnl Checks for existence of MODULES and gathers its build flags with
13511c145c9fSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
13521c145c9fSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
13531c145c9fSmrgdnl
13541c145c9fSmrgdnl Note that if there is a possibility the first call to
13551c145c9fSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
13561c145c9fSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
13571c145c9fSmrgdnl configure.ac.
13581c145c9fSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
13591c145c9fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
13601c145c9fSmrg_save_PKG_CONFIG=$PKG_CONFIG
13611c145c9fSmrgPKG_CONFIG="$PKG_CONFIG --static"
13621c145c9fSmrgPKG_CHECK_MODULES($@)
13631c145c9fSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
13641c145c9fSmrg])dnl PKG_CHECK_MODULES_STATIC
1365b66d1acbSmrg
1366b66d1acbSmrg
13671c145c9fSmrgdnl PKG_INSTALLDIR([DIRECTORY])
13681c145c9fSmrgdnl -------------------------
13691c145c9fSmrgdnl Since: 0.27
13701c145c9fSmrgdnl
13711c145c9fSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
13721c145c9fSmrgdnl should install pkg-config .pc files. By default the directory is
13731c145c9fSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
13741c145c9fSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
13751c145c9fSmrgdnl parameter.
13761c145c9fSmrgAC_DEFUN([PKG_INSTALLDIR],
13771c145c9fSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
13781c145c9fSmrgm4_pushdef([pkg_description],
13791c145c9fSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
13801c145c9fSmrgAC_ARG_WITH([pkgconfigdir],
13811c145c9fSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
13821c145c9fSmrg    [with_pkgconfigdir=]pkg_default)
13831c145c9fSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
13841c145c9fSmrgm4_popdef([pkg_default])
13851c145c9fSmrgm4_popdef([pkg_description])
13861c145c9fSmrg])dnl PKG_INSTALLDIR
13871c145c9fSmrg
13881c145c9fSmrg
13891c145c9fSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
13901c145c9fSmrgdnl --------------------------------
13911c145c9fSmrgdnl Since: 0.27
13921c145c9fSmrgdnl
13931c145c9fSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
13941c145c9fSmrgdnl module should install arch-independent pkg-config .pc files. By
13951c145c9fSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
13961c145c9fSmrgdnl changed by passing DIRECTORY. The user can override through the
13971c145c9fSmrgdnl --with-noarch-pkgconfigdir parameter.
13981c145c9fSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
13991c145c9fSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
14001c145c9fSmrgm4_pushdef([pkg_description],
14011c145c9fSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
14021c145c9fSmrgAC_ARG_WITH([noarch-pkgconfigdir],
14031c145c9fSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
14041c145c9fSmrg    [with_noarch_pkgconfigdir=]pkg_default)
14051c145c9fSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
14061c145c9fSmrgm4_popdef([pkg_default])
14071c145c9fSmrgm4_popdef([pkg_description])
14081c145c9fSmrg])dnl PKG_NOARCH_INSTALLDIR
14091c145c9fSmrg
1410b66d1acbSmrg
14111c145c9fSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
14121c145c9fSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
14131c145c9fSmrgdnl -------------------------------------------
14141c145c9fSmrgdnl Since: 0.28
14151c145c9fSmrgdnl
14161c145c9fSmrgdnl Retrieves the value of the pkg-config variable for the given module.
14171c145c9fSmrgAC_DEFUN([PKG_CHECK_VAR],
14181c145c9fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14191c145c9fSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420df58931aSmrg
14211c145c9fSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
14221c145c9fSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423df58931aSmrg
14241c145c9fSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
14251c145c9fSmrg])dnl PKG_CHECK_VAR
1426df58931aSmrg
14271c145c9fSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14281c145c9fSmrgdnl
14291c145c9fSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
14301c145c9fSmrgdnl
14311c145c9fSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14321c145c9fSmrgdnl copy of this software and associated documentation files (the "Software"),
14331c145c9fSmrgdnl to deal in the Software without restriction, including without limitation
14341c145c9fSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14351c145c9fSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
14361c145c9fSmrgdnl Software is furnished to do so, subject to the following conditions:
14371c145c9fSmrgdnl
14381c145c9fSmrgdnl The above copyright notice and this permission notice (including the next
14391c145c9fSmrgdnl paragraph) shall be included in all copies or substantial portions of the
14401c145c9fSmrgdnl Software.
14411c145c9fSmrgdnl
14421c145c9fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14431c145c9fSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14441c145c9fSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14451c145c9fSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14461c145c9fSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14471c145c9fSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14481c145c9fSmrgdnl DEALINGS IN THE SOFTWARE.
1449df58931aSmrg
14501c145c9fSmrg# XORG_MACROS_VERSION(required-version)
14511c145c9fSmrg# -------------------------------------
14524929c8f8Smrg# Minimum version: 1.1.0
1453df58931aSmrg#
14541c145c9fSmrg# If you're using a macro added in Version 1.1 or newer, include this in
14551c145c9fSmrg# your configure.ac with the minimum required version, such as:
14561c145c9fSmrg# XORG_MACROS_VERSION(1.1)
1457df58931aSmrg#
14581c145c9fSmrg# To ensure that this macro is defined, also add:
14591c145c9fSmrg# m4_ifndef([XORG_MACROS_VERSION],
14601c145c9fSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461df58931aSmrg#
14621c145c9fSmrg#
14631c145c9fSmrg# See the "minimum version" comment for each macro you use to see what
14641c145c9fSmrg# version you require.
14651c145c9fSmrgm4_defun([XORG_MACROS_VERSION],[
14661c145c9fSmrgm4_define([vers_have], [1.19.3])
14671c145c9fSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14681c145c9fSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14691c145c9fSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14701c145c9fSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14711c145c9fSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14721c145c9fSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14731c145c9fSmrgm4_undefine([vers_have])
14741c145c9fSmrgm4_undefine([maj_have])
14751c145c9fSmrgm4_undefine([maj_needed])
14761c145c9fSmrg]) # XORG_MACROS_VERSION
1477df58931aSmrg
14781c145c9fSmrg# XORG_PROG_RAWCPP()
14791c145c9fSmrg# ------------------
14801c145c9fSmrg# Minimum version: 1.0.0
14811c145c9fSmrg#
14821c145c9fSmrg# Find cpp program and necessary flags for use in pre-processing text files
14831c145c9fSmrg# such as man pages and config files
14841c145c9fSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14851c145c9fSmrgAC_REQUIRE([AC_PROG_CPP])
14861c145c9fSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14871c145c9fSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14884929c8f8Smrg
14891c145c9fSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14901c145c9fSmrg# which is not the best choice for supporting other OS'es, but covers most
14911c145c9fSmrg# of the ones we need for now.
14921c145c9fSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14931c145c9fSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14941c145c9fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14951c145c9fSmrg	AC_MSG_RESULT([no])
14961c145c9fSmrgelse
14971c145c9fSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14981c145c9fSmrg		RAWCPPFLAGS=-undef
14991c145c9fSmrg		AC_MSG_RESULT([yes])
15001c145c9fSmrg	# under Cygwin unix is still defined even with -undef
15011c145c9fSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15021c145c9fSmrg		RAWCPPFLAGS="-undef -ansi"
15031c145c9fSmrg		AC_MSG_RESULT([yes, with -ansi])
15041c145c9fSmrg	else
15051c145c9fSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15061c145c9fSmrg	fi
1507df58931aSmrgfi
15081c145c9fSmrgrm -f conftest.$ac_ext
1509df58931aSmrg
15101c145c9fSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15111c145c9fSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15121c145c9fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15131c145c9fSmrg	AC_MSG_RESULT([no])
15141c145c9fSmrgelse
15151c145c9fSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15161c145c9fSmrg		TRADITIONALCPPFLAGS="-traditional"
15171c145c9fSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15181c145c9fSmrg		AC_MSG_RESULT([yes])
15191c145c9fSmrg	else
15201c145c9fSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15211c145c9fSmrg	fi
15221c145c9fSmrgfi
15231c145c9fSmrgrm -f conftest.$ac_ext
15241c145c9fSmrgAC_SUBST(RAWCPPFLAGS)
15251c145c9fSmrgAC_SUBST(TRADITIONALCPPFLAGS)
15261c145c9fSmrg]) # XORG_PROG_RAWCPP
1527df58931aSmrg
15281c145c9fSmrg# XORG_MANPAGE_SECTIONS()
15291c145c9fSmrg# -----------------------
15301c145c9fSmrg# Minimum version: 1.0.0
1531df58931aSmrg#
15321c145c9fSmrg# Determine which sections man pages go in for the different man page types
15331c145c9fSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15341c145c9fSmrg# Not sure if there's any better way than just hardcoding by OS name.
15351c145c9fSmrg# Override default settings by setting environment variables
15361c145c9fSmrg# Added MAN_SUBSTS in version 1.8
15371c145c9fSmrg# Added AC_PROG_SED in version 1.8
15384929c8f8Smrg
15391c145c9fSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15401c145c9fSmrgAC_REQUIRE([AC_CANONICAL_HOST])
15411c145c9fSmrgAC_REQUIRE([AC_PROG_SED])
1542df58931aSmrg
15431c145c9fSmrgcase $host_os in
15441c145c9fSmrg    solaris*)
15451c145c9fSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15461c145c9fSmrg        # check for a man page file found in later versions that use
15471c145c9fSmrg        # traditional section numbers instead
15481c145c9fSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15491c145c9fSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15501c145c9fSmrg        ;;
15511c145c9fSmrg    *) SYSV_MAN_SECTIONS=false ;;
15521c145c9fSmrgesac
1553df58931aSmrg
15541c145c9fSmrgif test x$APP_MAN_SUFFIX = x    ; then
15551c145c9fSmrg    APP_MAN_SUFFIX=1
15561c145c9fSmrgfi
15571c145c9fSmrgif test x$APP_MAN_DIR = x    ; then
15581c145c9fSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15591c145c9fSmrgfi
1560df58931aSmrg
15611c145c9fSmrgif test x$LIB_MAN_SUFFIX = x    ; then
15621c145c9fSmrg    LIB_MAN_SUFFIX=3
15631c145c9fSmrgfi
15641c145c9fSmrgif test x$LIB_MAN_DIR = x    ; then
15651c145c9fSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15661c145c9fSmrgfi
1567df58931aSmrg
15681c145c9fSmrgif test x$FILE_MAN_SUFFIX = x    ; then
15691c145c9fSmrg    case $SYSV_MAN_SECTIONS in
15701c145c9fSmrg	true)				FILE_MAN_SUFFIX=4  ;;
15711c145c9fSmrg	*)				FILE_MAN_SUFFIX=5  ;;
15721c145c9fSmrg    esac
15731c145c9fSmrgfi
15741c145c9fSmrgif test x$FILE_MAN_DIR = x    ; then
15751c145c9fSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576df58931aSmrgfi
1577df58931aSmrg
15781c145c9fSmrgif test x$MISC_MAN_SUFFIX = x    ; then
15791c145c9fSmrg    case $SYSV_MAN_SECTIONS in
15801c145c9fSmrg	true)				MISC_MAN_SUFFIX=5  ;;
15811c145c9fSmrg	*)				MISC_MAN_SUFFIX=7  ;;
15821c145c9fSmrg    esac
15831c145c9fSmrgfi
15841c145c9fSmrgif test x$MISC_MAN_DIR = x    ; then
15851c145c9fSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15864929c8f8Smrgfi
1587df58931aSmrg
15881c145c9fSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15891c145c9fSmrg    case $SYSV_MAN_SECTIONS in
15901c145c9fSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
15911c145c9fSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
15921c145c9fSmrg    esac
15931c145c9fSmrgfi
15941c145c9fSmrgif test x$DRIVER_MAN_DIR = x    ; then
15951c145c9fSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15961c145c9fSmrgfi
15974929c8f8Smrg
15981c145c9fSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15991c145c9fSmrg    case $SYSV_MAN_SECTIONS in
16001c145c9fSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16011c145c9fSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16021c145c9fSmrg    esac
16031c145c9fSmrgfi
16041c145c9fSmrgif test x$ADMIN_MAN_DIR = x    ; then
16051c145c9fSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16061c145c9fSmrgfi
16074929c8f8Smrg
16084929c8f8Smrg
16091c145c9fSmrgAC_SUBST([APP_MAN_SUFFIX])
16101c145c9fSmrgAC_SUBST([LIB_MAN_SUFFIX])
16111c145c9fSmrgAC_SUBST([FILE_MAN_SUFFIX])
16121c145c9fSmrgAC_SUBST([MISC_MAN_SUFFIX])
16131c145c9fSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16141c145c9fSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16151c145c9fSmrgAC_SUBST([APP_MAN_DIR])
16161c145c9fSmrgAC_SUBST([LIB_MAN_DIR])
16171c145c9fSmrgAC_SUBST([FILE_MAN_DIR])
16181c145c9fSmrgAC_SUBST([MISC_MAN_DIR])
16191c145c9fSmrgAC_SUBST([DRIVER_MAN_DIR])
16201c145c9fSmrgAC_SUBST([ADMIN_MAN_DIR])
16214929c8f8Smrg
16221c145c9fSmrgXORG_MAN_PAGE="X Version 11"
16231c145c9fSmrgAC_SUBST([XORG_MAN_PAGE])
16241c145c9fSmrgMAN_SUBSTS="\
16251c145c9fSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16261c145c9fSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16271c145c9fSmrg	-e 's|__xservername__|Xorg|g' \
16281c145c9fSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
16291c145c9fSmrg	-e 's|__projectroot__|\$(prefix)|g' \
16301c145c9fSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16311c145c9fSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16321c145c9fSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16331c145c9fSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16341c145c9fSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16351c145c9fSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16361c145c9fSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16371c145c9fSmrgAC_SUBST([MAN_SUBSTS])
16384929c8f8Smrg
16391c145c9fSmrg]) # XORG_MANPAGE_SECTIONS
16404929c8f8Smrg
16411c145c9fSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16421c145c9fSmrg# ------------------------
16431c145c9fSmrg# Minimum version: 1.7.0
1644df58931aSmrg#
16451c145c9fSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16461c145c9fSmrg# provided by xorg-sgml-doctools, if installed.
16471c145c9fSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16481c145c9fSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16491c145c9fSmrgXORG_SGML_PATH=
16501c145c9fSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16511c145c9fSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16521c145c9fSmrg    [m4_ifval([$1],[:],
16531c145c9fSmrg        [if test x"$cross_compiling" != x"yes" ; then
16541c145c9fSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16551c145c9fSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16561c145c9fSmrg         fi])
16571c145c9fSmrg    ])
16581c145c9fSmrg
16591c145c9fSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16601c145c9fSmrg# the path and the name of the doc stylesheet
16611c145c9fSmrgif test "x$XORG_SGML_PATH" != "x" ; then
16621c145c9fSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16631c145c9fSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16641c145c9fSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16651c145c9fSmrgelse
16661c145c9fSmrg   AC_MSG_RESULT([no])
16671c145c9fSmrgfi
16681c145c9fSmrg
16691c145c9fSmrgAC_SUBST(XORG_SGML_PATH)
16701c145c9fSmrgAC_SUBST(STYLESHEET_SRCDIR)
16711c145c9fSmrgAC_SUBST(XSL_STYLESHEET)
16721c145c9fSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16731c145c9fSmrg]) # XORG_CHECK_SGML_DOCTOOLS
16741c145c9fSmrg
16751c145c9fSmrg# XORG_CHECK_LINUXDOC
16761c145c9fSmrg# -------------------
16771c145c9fSmrg# Minimum version: 1.0.0
1678df58931aSmrg#
16791c145c9fSmrg# Defines the variable MAKE_TEXT if the necessary tools and
16801c145c9fSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16811c145c9fSmrg# Whether or not the necessary tools and files are found can be checked
16821c145c9fSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16831c145c9fSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16841c145c9fSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16851c145c9fSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686df58931aSmrg
16871c145c9fSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16884929c8f8Smrg
16891c145c9fSmrgAC_MSG_CHECKING([whether to build documentation])
16901c145c9fSmrg
16911c145c9fSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16921c145c9fSmrg   BUILDDOC=yes
1693df58931aSmrgelse
16941c145c9fSmrg   BUILDDOC=no
1695df58931aSmrgfi
1696df58931aSmrg
16971c145c9fSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698df58931aSmrg
16991c145c9fSmrgAC_MSG_RESULT([$BUILDDOC])
17004929c8f8Smrg
17011c145c9fSmrgAC_MSG_CHECKING([whether to build pdf documentation])
17021c145c9fSmrg
17031c145c9fSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17041c145c9fSmrg   BUILDPDFDOC=yes
17051c145c9fSmrgelse
17061c145c9fSmrg   BUILDPDFDOC=no
17071c145c9fSmrgfi
17081c145c9fSmrg
17091c145c9fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17101c145c9fSmrg
17111c145c9fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17121c145c9fSmrg
17131c145c9fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17141c145c9fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17151c145c9fSmrgMAKE_PDF="$PS2PDF"
17161c145c9fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17171c145c9fSmrg
17181c145c9fSmrgAC_SUBST(MAKE_TEXT)
17191c145c9fSmrgAC_SUBST(MAKE_PS)
17201c145c9fSmrgAC_SUBST(MAKE_PDF)
17211c145c9fSmrgAC_SUBST(MAKE_HTML)
17221c145c9fSmrg]) # XORG_CHECK_LINUXDOC
17231c145c9fSmrg
17241c145c9fSmrg# XORG_CHECK_DOCBOOK
17251c145c9fSmrg# -------------------
17261c145c9fSmrg# Minimum version: 1.0.0
17271c145c9fSmrg#
17281c145c9fSmrg# Checks for the ability to build output formats from SGML DocBook source.
17291c145c9fSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17301c145c9fSmrg# indicates whether the necessary tools and files are found and, if set,
17311c145c9fSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17321c145c9fSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17331c145c9fSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17341c145c9fSmrg
17351c145c9fSmrgBUILDTXTDOC=no
17361c145c9fSmrgBUILDPDFDOC=no
17371c145c9fSmrgBUILDPSDOC=no
17381c145c9fSmrgBUILDHTMLDOC=no
17391c145c9fSmrg
17401c145c9fSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17411c145c9fSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17421c145c9fSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17431c145c9fSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17444929c8f8Smrg
17451c145c9fSmrgAC_MSG_CHECKING([whether to build text documentation])
17461c145c9fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17471c145c9fSmrg   test x$BUILD_TXTDOC != xno; then
17481c145c9fSmrg	BUILDTXTDOC=yes
17491c145c9fSmrgfi
17501c145c9fSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17511c145c9fSmrgAC_MSG_RESULT([$BUILDTXTDOC])
17524929c8f8Smrg
17531c145c9fSmrgAC_MSG_CHECKING([whether to build PDF documentation])
17541c145c9fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17551c145c9fSmrg   test x$BUILD_PDFDOC != xno; then
17561c145c9fSmrg	BUILDPDFDOC=yes
17571c145c9fSmrgfi
17581c145c9fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17591c145c9fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17604929c8f8Smrg
17611c145c9fSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17621c145c9fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17631c145c9fSmrg   test x$BUILD_PSDOC != xno; then
17641c145c9fSmrg	BUILDPSDOC=yes
1765df58931aSmrgfi
17661c145c9fSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17671c145c9fSmrgAC_MSG_RESULT([$BUILDPSDOC])
1768df58931aSmrg
17691c145c9fSmrgAC_MSG_CHECKING([whether to build HTML documentation])
17701c145c9fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17711c145c9fSmrg   test x$BUILD_HTMLDOC != xno; then
17721c145c9fSmrg	BUILDHTMLDOC=yes
17731c145c9fSmrgfi
17741c145c9fSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17751c145c9fSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17764929c8f8Smrg
17771c145c9fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17781c145c9fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17791c145c9fSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17801c145c9fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17811c145c9fSmrg
17821c145c9fSmrgAC_SUBST(MAKE_TEXT)
17831c145c9fSmrgAC_SUBST(MAKE_PS)
17841c145c9fSmrgAC_SUBST(MAKE_PDF)
17851c145c9fSmrgAC_SUBST(MAKE_HTML)
17861c145c9fSmrg]) # XORG_CHECK_DOCBOOK
17871c145c9fSmrg
17881c145c9fSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17891c145c9fSmrg# ----------------
17901c145c9fSmrg# Minimum version: 1.5.0
17911c145c9fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1792df58931aSmrg#
17931c145c9fSmrg# Documentation tools are not always available on all platforms and sometimes
17941c145c9fSmrg# not at the appropriate level. This macro enables a module to test for the
17951c145c9fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
17961c145c9fSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
17971c145c9fSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17981c145c9fSmrg# --with-xmlto assumes 'auto'.
1799df58931aSmrg#
18001c145c9fSmrg# Interface to module:
18011c145c9fSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18021c145c9fSmrg# XMLTO:	returns the path of the xmlto program found
18031c145c9fSmrg#		returns the path set by the user in the environment
18041c145c9fSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18051c145c9fSmrg#		'no' user instructs the module not to use xmlto
1806df58931aSmrg#
18071c145c9fSmrg# Added in version 1.10.0
18081c145c9fSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18091c145c9fSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810df58931aSmrg#
18111c145c9fSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812df58931aSmrg#
18131c145c9fSmrgAC_DEFUN([XORG_WITH_XMLTO],[
18141c145c9fSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18151c145c9fSmrgm4_define([_defopt], m4_default([$2], [auto]))
18161c145c9fSmrgAC_ARG_WITH(xmlto,
18171c145c9fSmrg	AS_HELP_STRING([--with-xmlto],
18181c145c9fSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18191c145c9fSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18201c145c9fSmrgm4_undefine([_defopt])
1821df58931aSmrg
18221c145c9fSmrgif test "x$use_xmlto" = x"auto"; then
18231c145c9fSmrg   AC_PATH_PROG([XMLTO], [xmlto])
18241c145c9fSmrg   if test "x$XMLTO" = "x"; then
18251c145c9fSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18261c145c9fSmrg	have_xmlto=no
18271c145c9fSmrg   else
18281c145c9fSmrg        have_xmlto=yes
18291c145c9fSmrg   fi
18301c145c9fSmrgelif test "x$use_xmlto" = x"yes" ; then
18311c145c9fSmrg   AC_PATH_PROG([XMLTO], [xmlto])
18321c145c9fSmrg   if test "x$XMLTO" = "x"; then
18331c145c9fSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18341c145c9fSmrg   fi
18351c145c9fSmrg   have_xmlto=yes
18361c145c9fSmrgelif test "x$use_xmlto" = x"no" ; then
18371c145c9fSmrg   if test "x$XMLTO" != "x"; then
18381c145c9fSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18391c145c9fSmrg   fi
18401c145c9fSmrg   have_xmlto=no
18411c145c9fSmrgelse
18421c145c9fSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18431c145c9fSmrgfi
1844df58931aSmrg
18451c145c9fSmrg# Test for a minimum version of xmlto, if provided.
18461c145c9fSmrgm4_ifval([$1],
18471c145c9fSmrg[if test "$have_xmlto" = yes; then
18481c145c9fSmrg    # scrape the xmlto version
18491c145c9fSmrg    AC_MSG_CHECKING([the xmlto version])
18501c145c9fSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18511c145c9fSmrg    AC_MSG_RESULT([$xmlto_version])
18521c145c9fSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18531c145c9fSmrg        [if test "x$use_xmlto" = xauto; then
18541c145c9fSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18551c145c9fSmrg            have_xmlto=no
18561c145c9fSmrg        else
18571c145c9fSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18581c145c9fSmrg        fi])
18591c145c9fSmrgfi])
1860df58931aSmrg
18611c145c9fSmrg# Test for the ability of xmlto to generate a text target
18621c145c9fSmrg#
18631c145c9fSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18641c145c9fSmrg# following test for empty XML docbook files.
18651c145c9fSmrg# For compatibility reasons use the following empty XML docbook file and if
18661c145c9fSmrg# it fails try it again with a non-empty XML file.
18671c145c9fSmrghave_xmlto_text=no
18681c145c9fSmrgcat > conftest.xml << "EOF"
18691c145c9fSmrgEOF
18701c145c9fSmrgAS_IF([test "$have_xmlto" = yes],
18711c145c9fSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18721c145c9fSmrg             [have_xmlto_text=yes],
18731c145c9fSmrg             [# Try it again with a non-empty XML file.
18741c145c9fSmrg              cat > conftest.xml << "EOF"
18751c145c9fSmrg<x></x>
18761c145c9fSmrgEOF
18771c145c9fSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18781c145c9fSmrg                    [have_xmlto_text=yes],
18791c145c9fSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
18801c145c9fSmrgrm -f conftest.xml
18811c145c9fSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18821c145c9fSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18831c145c9fSmrg]) # XORG_WITH_XMLTO
1884df58931aSmrg
18851c145c9fSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18861c145c9fSmrg# --------------------------------------------
18871c145c9fSmrg# Minimum version: 1.12.0
18881c145c9fSmrg# Minimum version for optional DEFAULT argument: 1.12.0
18891c145c9fSmrg#
18901c145c9fSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18911c145c9fSmrg# XML-based language used for the transformation of XML documents.
18921c145c9fSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18931c145c9fSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18941c145c9fSmrg# The XSLT processor is often used as a standalone tool for transformations.
18951c145c9fSmrg# It should not be assumed that this tool is used only to work with documnetation.
18961c145c9fSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18971c145c9fSmrg#
18981c145c9fSmrg# Interface to module:
18991c145c9fSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19001c145c9fSmrg# XSLTPROC:	 returns the path of the xsltproc program found
19011c145c9fSmrg#		 returns the path set by the user in the environment
19021c145c9fSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19031c145c9fSmrg#		  'no' user instructs the module not to use xsltproc
19041c145c9fSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19051c145c9fSmrg#
19061c145c9fSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19071c145c9fSmrg#
19081c145c9fSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19091c145c9fSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19101c145c9fSmrg# Preserves the interface, should it be implemented later
19111c145c9fSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19121c145c9fSmrgm4_define([_defopt], m4_default([$2], [auto]))
19131c145c9fSmrgAC_ARG_WITH(xsltproc,
19141c145c9fSmrg	AS_HELP_STRING([--with-xsltproc],
19151c145c9fSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19161c145c9fSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19171c145c9fSmrgm4_undefine([_defopt])
1918df58931aSmrg
19191c145c9fSmrgif test "x$use_xsltproc" = x"auto"; then
19201c145c9fSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19211c145c9fSmrg   if test "x$XSLTPROC" = "x"; then
19221c145c9fSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19231c145c9fSmrg	have_xsltproc=no
19241c145c9fSmrg   else
19251c145c9fSmrg        have_xsltproc=yes
19261c145c9fSmrg   fi
19271c145c9fSmrgelif test "x$use_xsltproc" = x"yes" ; then
19281c145c9fSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19291c145c9fSmrg   if test "x$XSLTPROC" = "x"; then
19301c145c9fSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19311c145c9fSmrg   fi
19321c145c9fSmrg   have_xsltproc=yes
19331c145c9fSmrgelif test "x$use_xsltproc" = x"no" ; then
19341c145c9fSmrg   if test "x$XSLTPROC" != "x"; then
19351c145c9fSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19361c145c9fSmrg   fi
19371c145c9fSmrg   have_xsltproc=no
19381c145c9fSmrgelse
19391c145c9fSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19404929c8f8Smrgfi
19414929c8f8Smrg
19421c145c9fSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19431c145c9fSmrg]) # XORG_WITH_XSLTPROC
19441c145c9fSmrg
19451c145c9fSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19461c145c9fSmrg# ----------------------------------------
19471c145c9fSmrg# Minimum version: 1.15.0
1948df58931aSmrg#
19491c145c9fSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
19501c145c9fSmrg# scanning arbitrary text files, extracting information from those text files,
19511c145c9fSmrg# and printing reports based on that information.
1952df58931aSmrg#
19531c145c9fSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954df58931aSmrg#
19551c145c9fSmrg# Interface to module:
19561c145c9fSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
19571c145c9fSmrg# PERL:	     returns the path of the perl program found
19581c145c9fSmrg#	     returns the path set by the user in the environment
19591c145c9fSmrg# --with-perl: 'yes' user instructs the module to use perl
19601c145c9fSmrg#	       'no' user instructs the module not to use perl
19611c145c9fSmrg# have_perl: returns yes if perl found in PATH or no
1962df58931aSmrg#
19631c145c9fSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19641c145c9fSmrg#
19651c145c9fSmrgAC_DEFUN([XORG_WITH_PERL],[
19661c145c9fSmrgAC_ARG_VAR([PERL], [Path to perl command])
19671c145c9fSmrg# Preserves the interface, should it be implemented later
19681c145c9fSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
19691c145c9fSmrgm4_define([_defopt], m4_default([$2], [auto]))
19701c145c9fSmrgAC_ARG_WITH(perl,
19711c145c9fSmrg	AS_HELP_STRING([--with-perl],
19721c145c9fSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
19731c145c9fSmrg	   [use_perl=$withval], [use_perl=]_defopt)
19741c145c9fSmrgm4_undefine([_defopt])
1975df58931aSmrg
19761c145c9fSmrgif test "x$use_perl" = x"auto"; then
19771c145c9fSmrg   AC_PATH_PROG([PERL], [perl])
19781c145c9fSmrg   if test "x$PERL" = "x"; then
19791c145c9fSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19801c145c9fSmrg	have_perl=no
19811c145c9fSmrg   else
19821c145c9fSmrg        have_perl=yes
19831c145c9fSmrg   fi
19841c145c9fSmrgelif test "x$use_perl" = x"yes" ; then
19851c145c9fSmrg   AC_PATH_PROG([PERL], [perl])
19861c145c9fSmrg   if test "x$PERL" = "x"; then
19871c145c9fSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19881c145c9fSmrg   fi
19891c145c9fSmrg   have_perl=yes
19901c145c9fSmrgelif test "x$use_perl" = x"no" ; then
19911c145c9fSmrg   if test "x$PERL" != "x"; then
19921c145c9fSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19931c145c9fSmrg   fi
19941c145c9fSmrg   have_perl=no
19951c145c9fSmrgelse
19961c145c9fSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19971c145c9fSmrgfi
1998df58931aSmrg
19991c145c9fSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20001c145c9fSmrg]) # XORG_WITH_PERL
2001df58931aSmrg
20021c145c9fSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003df58931aSmrg# ----------------
20041c145c9fSmrg# Minimum version: 1.5.0
20051c145c9fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2006df58931aSmrg#
20071c145c9fSmrg# Documentation tools are not always available on all platforms and sometimes
20081c145c9fSmrg# not at the appropriate level. This macro enables a module to test for the
20091c145c9fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20101c145c9fSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
20111c145c9fSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20121c145c9fSmrg# --with-asciidoc assumes 'auto'.
2013df58931aSmrg#
20141c145c9fSmrg# Interface to module:
20151c145c9fSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20161c145c9fSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
20171c145c9fSmrg#		 returns the path set by the user in the environment
20181c145c9fSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20191c145c9fSmrg#		  'no' user instructs the module not to use asciidoc
2020df58931aSmrg#
20211c145c9fSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2022df58931aSmrg#
20231c145c9fSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20241c145c9fSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20251c145c9fSmrgm4_define([_defopt], m4_default([$2], [auto]))
20261c145c9fSmrgAC_ARG_WITH(asciidoc,
20271c145c9fSmrg	AS_HELP_STRING([--with-asciidoc],
20281c145c9fSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20291c145c9fSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20301c145c9fSmrgm4_undefine([_defopt])
20314929c8f8Smrg
20321c145c9fSmrgif test "x$use_asciidoc" = x"auto"; then
20331c145c9fSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20341c145c9fSmrg   if test "x$ASCIIDOC" = "x"; then
20351c145c9fSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20361c145c9fSmrg	have_asciidoc=no
20371c145c9fSmrg   else
20381c145c9fSmrg        have_asciidoc=yes
20391c145c9fSmrg   fi
20401c145c9fSmrgelif test "x$use_asciidoc" = x"yes" ; then
20411c145c9fSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20421c145c9fSmrg   if test "x$ASCIIDOC" = "x"; then
20431c145c9fSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20441c145c9fSmrg   fi
20451c145c9fSmrg   have_asciidoc=yes
20461c145c9fSmrgelif test "x$use_asciidoc" = x"no" ; then
20471c145c9fSmrg   if test "x$ASCIIDOC" != "x"; then
20481c145c9fSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20491c145c9fSmrg   fi
20501c145c9fSmrg   have_asciidoc=no
20511c145c9fSmrgelse
20521c145c9fSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20531c145c9fSmrgfi
20541c145c9fSmrgm4_ifval([$1],
20551c145c9fSmrg[if test "$have_asciidoc" = yes; then
20561c145c9fSmrg    # scrape the asciidoc version
20571c145c9fSmrg    AC_MSG_CHECKING([the asciidoc version])
20581c145c9fSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20591c145c9fSmrg    AC_MSG_RESULT([$asciidoc_version])
20601c145c9fSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20611c145c9fSmrg        [if test "x$use_asciidoc" = xauto; then
20621c145c9fSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20631c145c9fSmrg            have_asciidoc=no
20641c145c9fSmrg        else
20651c145c9fSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20661c145c9fSmrg        fi])
20671c145c9fSmrgfi])
20681c145c9fSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20691c145c9fSmrg]) # XORG_WITH_ASCIIDOC
2070df58931aSmrg
20711c145c9fSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20721c145c9fSmrg# -------------------------------------------
20731c145c9fSmrg# Minimum version: 1.5.0
20741c145c9fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20751c145c9fSmrg# Minimum version for optional DOT checking: 1.18.0
2076df58931aSmrg#
20771c145c9fSmrg# Documentation tools are not always available on all platforms and sometimes
20781c145c9fSmrg# not at the appropriate level. This macro enables a module to test for the
20791c145c9fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20801c145c9fSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
20811c145c9fSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20821c145c9fSmrg# --with-doxygen assumes 'auto'.
2083df58931aSmrg#
20841c145c9fSmrg# Interface to module:
20851c145c9fSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20861c145c9fSmrg# DOXYGEN:	 returns the path of the doxygen program found
20871c145c9fSmrg#		 returns the path set by the user in the environment
20881c145c9fSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20891c145c9fSmrg#		  'no' user instructs the module not to use doxygen
2090df58931aSmrg#
20911c145c9fSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092df58931aSmrg#
20931c145c9fSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20941c145c9fSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20951c145c9fSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20961c145c9fSmrgm4_define([_defopt], m4_default([$2], [auto]))
20971c145c9fSmrgAC_ARG_WITH(doxygen,
20981c145c9fSmrg	AS_HELP_STRING([--with-doxygen],
20991c145c9fSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21001c145c9fSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21011c145c9fSmrgm4_undefine([_defopt])
2102df58931aSmrg
21031c145c9fSmrgif test "x$use_doxygen" = x"auto"; then
21041c145c9fSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21051c145c9fSmrg   if test "x$DOXYGEN" = "x"; then
21061c145c9fSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21071c145c9fSmrg	have_doxygen=no
21081c145c9fSmrg   else
21091c145c9fSmrg        have_doxygen=yes
21101c145c9fSmrg   fi
21111c145c9fSmrgelif test "x$use_doxygen" = x"yes" ; then
21121c145c9fSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21131c145c9fSmrg   if test "x$DOXYGEN" = "x"; then
21141c145c9fSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21151c145c9fSmrg   fi
21161c145c9fSmrg   have_doxygen=yes
21171c145c9fSmrgelif test "x$use_doxygen" = x"no" ; then
21181c145c9fSmrg   if test "x$DOXYGEN" != "x"; then
21191c145c9fSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21201c145c9fSmrg   fi
21211c145c9fSmrg   have_doxygen=no
21224929c8f8Smrgelse
21231c145c9fSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
21244929c8f8Smrgfi
21251c145c9fSmrgm4_ifval([$1],
21261c145c9fSmrg[if test "$have_doxygen" = yes; then
21271c145c9fSmrg    # scrape the doxygen version
21281c145c9fSmrg    AC_MSG_CHECKING([the doxygen version])
21291c145c9fSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21301c145c9fSmrg    AC_MSG_RESULT([$doxygen_version])
21311c145c9fSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21321c145c9fSmrg        [if test "x$use_doxygen" = xauto; then
21331c145c9fSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21341c145c9fSmrg            have_doxygen=no
21351c145c9fSmrg        else
21361c145c9fSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21371c145c9fSmrg        fi])
21381c145c9fSmrgfi])
21394929c8f8Smrg
21401c145c9fSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21411c145c9fSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21421c145c9fSmrgdnl 	HAVE_DOT = @HAVE_DOT@
21431c145c9fSmrgHAVE_DOT=no
21441c145c9fSmrgif test "x$have_doxygen" = "xyes"; then
21451c145c9fSmrg  AC_PATH_PROG([DOT], [dot])
21461c145c9fSmrg    if test "x$DOT" != "x"; then
21471c145c9fSmrg      HAVE_DOT=yes
21481c145c9fSmrg    fi
21491c145c9fSmrgfi
21504929c8f8Smrg
21511c145c9fSmrgAC_SUBST([HAVE_DOT])
21521c145c9fSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21531c145c9fSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21541c145c9fSmrg]) # XORG_WITH_DOXYGEN
21554929c8f8Smrg
21561c145c9fSmrg# XORG_WITH_GROFF([DEFAULT])
21571c145c9fSmrg# ----------------
21581c145c9fSmrg# Minimum version: 1.6.0
21591c145c9fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2160df58931aSmrg#
21611c145c9fSmrg# Documentation tools are not always available on all platforms and sometimes
21621c145c9fSmrg# not at the appropriate level. This macro enables a module to test for the
21631c145c9fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
21641c145c9fSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
21651c145c9fSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
21661c145c9fSmrg# --with-groff assumes 'auto'.
21671c145c9fSmrg#
21681c145c9fSmrg# Interface to module:
21691c145c9fSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21701c145c9fSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21711c145c9fSmrg# HAVE_GROFF_MS: the -ms macros package
21721c145c9fSmrg# GROFF:	 returns the path of the groff program found
21731c145c9fSmrg#		 returns the path set by the user in the environment
21741c145c9fSmrg# --with-groff:	 'yes' user instructs the module to use groff
21751c145c9fSmrg#		 'no' user instructs the module not to use groff
21761c145c9fSmrg#
21771c145c9fSmrg# Added in version 1.9.0:
21781c145c9fSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21791c145c9fSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21801c145c9fSmrg#		   psselect from the psutils package.
21811c145c9fSmrg#		   the ghostcript package. Refer to the grohtml man pages
21821c145c9fSmrg#
21831c145c9fSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21841c145c9fSmrg#
21851c145c9fSmrg# OS and distros often splits groff in a basic and full package, the former
21861c145c9fSmrg# having the groff program and the later having devices, fonts and macros
21871c145c9fSmrg# Checking for the groff executable is not enough.
21881c145c9fSmrg#
21891c145c9fSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
21901c145c9fSmrg# unset HAVE_GROFF or GROFF env variables.
21911c145c9fSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21921c145c9fSmrg#
21931c145c9fSmrgAC_DEFUN([XORG_WITH_GROFF],[
21941c145c9fSmrgAC_ARG_VAR([GROFF], [Path to groff command])
21951c145c9fSmrgm4_define([_defopt], m4_default([$1], [auto]))
21961c145c9fSmrgAC_ARG_WITH(groff,
21971c145c9fSmrg	AS_HELP_STRING([--with-groff],
21981c145c9fSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21991c145c9fSmrg	   [use_groff=$withval], [use_groff=]_defopt)
22001c145c9fSmrgm4_undefine([_defopt])
22014929c8f8Smrg
22021c145c9fSmrgif test "x$use_groff" = x"auto"; then
22031c145c9fSmrg   AC_PATH_PROG([GROFF], [groff])
22041c145c9fSmrg   if test "x$GROFF" = "x"; then
22051c145c9fSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22061c145c9fSmrg	have_groff=no
22071c145c9fSmrg   else
22081c145c9fSmrg        have_groff=yes
22091c145c9fSmrg   fi
22101c145c9fSmrgelif test "x$use_groff" = x"yes" ; then
22111c145c9fSmrg   AC_PATH_PROG([GROFF], [groff])
22121c145c9fSmrg   if test "x$GROFF" = "x"; then
22131c145c9fSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22141c145c9fSmrg   fi
22151c145c9fSmrg   have_groff=yes
22161c145c9fSmrgelif test "x$use_groff" = x"no" ; then
22171c145c9fSmrg   if test "x$GROFF" != "x"; then
22181c145c9fSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22191c145c9fSmrg   fi
22201c145c9fSmrg   have_groff=no
22211c145c9fSmrgelse
22221c145c9fSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22231c145c9fSmrgfi
22244929c8f8Smrg
22251c145c9fSmrg# We have groff, test for the presence of the macro packages
22261c145c9fSmrgif test "x$have_groff" = x"yes"; then
22271c145c9fSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22281c145c9fSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22291c145c9fSmrg        groff_ms_works=yes
22301c145c9fSmrg    else
22311c145c9fSmrg        groff_ms_works=no
22324929c8f8Smrg    fi
22331c145c9fSmrg    AC_MSG_RESULT([$groff_ms_works])
22341c145c9fSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22351c145c9fSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22361c145c9fSmrg        groff_mm_works=yes
22371c145c9fSmrg    else
22381c145c9fSmrg        groff_mm_works=no
22391c145c9fSmrg    fi
22401c145c9fSmrg    AC_MSG_RESULT([$groff_mm_works])
22411c145c9fSmrgfi
22424929c8f8Smrg
22431c145c9fSmrg# We have groff, test for HTML dependencies, one command per package
22441c145c9fSmrgif test "x$have_groff" = x"yes"; then
22451c145c9fSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22461c145c9fSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22471c145c9fSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22481c145c9fSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22491c145c9fSmrg      have_groff_html=yes
22501c145c9fSmrg   else
22511c145c9fSmrg      have_groff_html=no
22521c145c9fSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22531c145c9fSmrg   fi
22541c145c9fSmrgfi
22551c145c9fSmrg
22561c145c9fSmrg# Set Automake conditionals for Makefiles
22571c145c9fSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22581c145c9fSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22591c145c9fSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22601c145c9fSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22611c145c9fSmrg]) # XORG_WITH_GROFF
22621c145c9fSmrg
22631c145c9fSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22641c145c9fSmrg# ---------------------------------------
22651c145c9fSmrg# Minimum version: 1.6.0
22661c145c9fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
22671c145c9fSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
22681c145c9fSmrg#
22691c145c9fSmrg# Documentation tools are not always available on all platforms and sometimes
22701c145c9fSmrg# not at the appropriate level. This macro enables a module to test for the
22711c145c9fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
22721c145c9fSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
22731c145c9fSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
22741c145c9fSmrg# --with-fop assumes 'auto'.
22751c145c9fSmrg#
22761c145c9fSmrg# Interface to module:
22771c145c9fSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22781c145c9fSmrg# FOP:	 	returns the path of the fop program found
22791c145c9fSmrg#		returns the path set by the user in the environment
22801c145c9fSmrg# --with-fop: 	'yes' user instructs the module to use fop
22811c145c9fSmrg#		'no' user instructs the module not to use fop
22821c145c9fSmrg#
22831c145c9fSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22841c145c9fSmrg#
22851c145c9fSmrgAC_DEFUN([XORG_WITH_FOP],[
22861c145c9fSmrgAC_ARG_VAR([FOP], [Path to fop command])
22871c145c9fSmrgm4_define([_defopt], m4_default([$2], [auto]))
22881c145c9fSmrgAC_ARG_WITH(fop,
22891c145c9fSmrg	AS_HELP_STRING([--with-fop],
22901c145c9fSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22911c145c9fSmrg	   [use_fop=$withval], [use_fop=]_defopt)
22921c145c9fSmrgm4_undefine([_defopt])
22931c145c9fSmrg
22941c145c9fSmrgif test "x$use_fop" = x"auto"; then
22951c145c9fSmrg   AC_PATH_PROG([FOP], [fop])
22961c145c9fSmrg   if test "x$FOP" = "x"; then
22971c145c9fSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22981c145c9fSmrg	have_fop=no
22991c145c9fSmrg   else
23001c145c9fSmrg        have_fop=yes
23011c145c9fSmrg   fi
23021c145c9fSmrgelif test "x$use_fop" = x"yes" ; then
23031c145c9fSmrg   AC_PATH_PROG([FOP], [fop])
23041c145c9fSmrg   if test "x$FOP" = "x"; then
23051c145c9fSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23061c145c9fSmrg   fi
23071c145c9fSmrg   have_fop=yes
23081c145c9fSmrgelif test "x$use_fop" = x"no" ; then
23091c145c9fSmrg   if test "x$FOP" != "x"; then
23101c145c9fSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23111c145c9fSmrg   fi
23121c145c9fSmrg   have_fop=no
23134929c8f8Smrgelse
23141c145c9fSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315df58931aSmrgfi
2316df58931aSmrg
23171c145c9fSmrg# Test for a minimum version of fop, if provided.
23181c145c9fSmrgm4_ifval([$1],
23191c145c9fSmrg[if test "$have_fop" = yes; then
23201c145c9fSmrg    # scrape the fop version
23211c145c9fSmrg    AC_MSG_CHECKING([for fop minimum version])
23221c145c9fSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23231c145c9fSmrg    AC_MSG_RESULT([$fop_version])
23241c145c9fSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
23251c145c9fSmrg        [if test "x$use_fop" = xauto; then
23261c145c9fSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23271c145c9fSmrg            have_fop=no
23281c145c9fSmrg        else
23291c145c9fSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23301c145c9fSmrg        fi])
23311c145c9fSmrgfi])
23321c145c9fSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23331c145c9fSmrg]) # XORG_WITH_FOP
23341c145c9fSmrg
23351c145c9fSmrg# XORG_WITH_M4([MIN-VERSION])
23361c145c9fSmrg# ---------------------------
23371c145c9fSmrg# Minimum version: 1.19.0
23381c145c9fSmrg#
23391c145c9fSmrg# This macro attempts to locate an m4 macro processor which supports
23401c145c9fSmrg# -I option and is only useful for modules relying on M4 in order to
23411c145c9fSmrg# expand macros in source code files.
23421c145c9fSmrg#
23431c145c9fSmrg# Interface to module:
23441c145c9fSmrg# M4:	 	returns the path of the m4 program found
23451c145c9fSmrg#		returns the path set by the user in the environment
23461c145c9fSmrg#
23471c145c9fSmrgAC_DEFUN([XORG_WITH_M4], [
23481c145c9fSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23491c145c9fSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23501c145c9fSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23511c145c9fSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23521c145c9fSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23531c145c9fSmrg   [$PATH:/usr/gnu/bin])])
23544929c8f8Smrg
23551c145c9fSmrgAC_SUBST([M4], [$ac_cv_path_M4])
23561c145c9fSmrg]) # XORG_WITH_M4
23574929c8f8Smrg
23581c145c9fSmrg# XORG_WITH_PS2PDF([DEFAULT])
23591c145c9fSmrg# ----------------
23601c145c9fSmrg# Minimum version: 1.6.0
23611c145c9fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
23621c145c9fSmrg#
23631c145c9fSmrg# Documentation tools are not always available on all platforms and sometimes
23641c145c9fSmrg# not at the appropriate level. This macro enables a module to test for the
23651c145c9fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
23661c145c9fSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
23671c145c9fSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23681c145c9fSmrg# --with-ps2pdf assumes 'auto'.
23691c145c9fSmrg#
23701c145c9fSmrg# Interface to module:
23711c145c9fSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23721c145c9fSmrg# PS2PDF:	returns the path of the ps2pdf program found
23731c145c9fSmrg#		returns the path set by the user in the environment
23741c145c9fSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23751c145c9fSmrg#		 'no' user instructs the module not to use ps2pdf
23761c145c9fSmrg#
23771c145c9fSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23781c145c9fSmrg#
23791c145c9fSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23801c145c9fSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23811c145c9fSmrgm4_define([_defopt], m4_default([$1], [auto]))
23821c145c9fSmrgAC_ARG_WITH(ps2pdf,
23831c145c9fSmrg	AS_HELP_STRING([--with-ps2pdf],
23841c145c9fSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23851c145c9fSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23861c145c9fSmrgm4_undefine([_defopt])
23874929c8f8Smrg
23881c145c9fSmrgif test "x$use_ps2pdf" = x"auto"; then
23891c145c9fSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23901c145c9fSmrg   if test "x$PS2PDF" = "x"; then
23911c145c9fSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23921c145c9fSmrg	have_ps2pdf=no
23931c145c9fSmrg   else
23941c145c9fSmrg        have_ps2pdf=yes
23951c145c9fSmrg   fi
23961c145c9fSmrgelif test "x$use_ps2pdf" = x"yes" ; then
23971c145c9fSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23981c145c9fSmrg   if test "x$PS2PDF" = "x"; then
23991c145c9fSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24001c145c9fSmrg   fi
24011c145c9fSmrg   have_ps2pdf=yes
24021c145c9fSmrgelif test "x$use_ps2pdf" = x"no" ; then
24031c145c9fSmrg   if test "x$PS2PDF" != "x"; then
24041c145c9fSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24051c145c9fSmrg   fi
24061c145c9fSmrg   have_ps2pdf=no
24071c145c9fSmrgelse
24081c145c9fSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409df58931aSmrgfi
24101c145c9fSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24111c145c9fSmrg]) # XORG_WITH_PS2PDF
24124929c8f8Smrg
24131c145c9fSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
24141c145c9fSmrg# ----------------
24151c145c9fSmrg# Minimum version: 1.6.0
24164929c8f8Smrg#
24171c145c9fSmrg# Documentation tools are not always available on all platforms and sometimes
24181c145c9fSmrg# not at the appropriate level. This macro enables a builder to skip all
24191c145c9fSmrg# documentation targets except traditional man pages.
24201c145c9fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24211c145c9fSmrg# maximum flexibilty in controlling documentation building.
24221c145c9fSmrg# Refer to:
24231c145c9fSmrg# XORG_WITH_XMLTO         --with-xmlto
24241c145c9fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24251c145c9fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24261c145c9fSmrg# XORG_WITH_FOP           --with-fop
24271c145c9fSmrg# XORG_WITH_GROFF         --with-groff
24281c145c9fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24291c145c9fSmrg#
24301c145c9fSmrg# Interface to module:
24311c145c9fSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24321c145c9fSmrg# --enable-docs: 'yes' user instructs the module to generate docs
24331c145c9fSmrg#		 'no' user instructs the module not to generate docs
24341c145c9fSmrg# parm1:	specify the default value, yes or no.
24351c145c9fSmrg#
24361c145c9fSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24371c145c9fSmrgm4_define([docs_default], m4_default([$1], [yes]))
24381c145c9fSmrgAC_ARG_ENABLE(docs,
24391c145c9fSmrg	AS_HELP_STRING([--enable-docs],
24401c145c9fSmrg	   [Enable building the documentation (default: ]docs_default[)]),
24411c145c9fSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
24421c145c9fSmrgm4_undefine([docs_default])
24431c145c9fSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24441c145c9fSmrgAC_MSG_CHECKING([whether to build documentation])
24451c145c9fSmrgAC_MSG_RESULT([$build_docs])
24461c145c9fSmrg]) # XORG_ENABLE_DOCS
24474929c8f8Smrg
24481c145c9fSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24491c145c9fSmrg# ----------------
24501c145c9fSmrg# Minimum version: 1.6.0
24511c145c9fSmrg#
24521c145c9fSmrg# This macro enables a builder to skip all developer documentation.
24531c145c9fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24541c145c9fSmrg# maximum flexibilty in controlling documentation building.
24551c145c9fSmrg# Refer to:
24561c145c9fSmrg# XORG_WITH_XMLTO         --with-xmlto
24571c145c9fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24581c145c9fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24591c145c9fSmrg# XORG_WITH_FOP           --with-fop
24601c145c9fSmrg# XORG_WITH_GROFF         --with-groff
24611c145c9fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24621c145c9fSmrg#
24631c145c9fSmrg# Interface to module:
24641c145c9fSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24651c145c9fSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24661c145c9fSmrg#			'no' user instructs the module not to generate developer docs
24671c145c9fSmrg# parm1:		specify the default value, yes or no.
24681c145c9fSmrg#
24691c145c9fSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24701c145c9fSmrgm4_define([devel_default], m4_default([$1], [yes]))
24711c145c9fSmrgAC_ARG_ENABLE(devel-docs,
24721c145c9fSmrg	AS_HELP_STRING([--enable-devel-docs],
24731c145c9fSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24741c145c9fSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24751c145c9fSmrgm4_undefine([devel_default])
24761c145c9fSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24771c145c9fSmrgAC_MSG_CHECKING([whether to build developer documentation])
24781c145c9fSmrgAC_MSG_RESULT([$build_devel_docs])
24791c145c9fSmrg]) # XORG_ENABLE_DEVEL_DOCS
24804929c8f8Smrg
24811c145c9fSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
24821c145c9fSmrg# ----------------
24831c145c9fSmrg# Minimum version: 1.6.0
24841c145c9fSmrg#
24851c145c9fSmrg# This macro enables a builder to skip all functional specification targets.
24861c145c9fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24871c145c9fSmrg# maximum flexibilty in controlling documentation building.
24881c145c9fSmrg# Refer to:
24891c145c9fSmrg# XORG_WITH_XMLTO         --with-xmlto
24901c145c9fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24911c145c9fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24921c145c9fSmrg# XORG_WITH_FOP           --with-fop
24931c145c9fSmrg# XORG_WITH_GROFF         --with-groff
24941c145c9fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24951c145c9fSmrg#
24961c145c9fSmrg# Interface to module:
24971c145c9fSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24981c145c9fSmrg# --enable-specs:	'yes' user instructs the module to generate specs
24991c145c9fSmrg#			'no' user instructs the module not to generate specs
25001c145c9fSmrg# parm1:		specify the default value, yes or no.
25011c145c9fSmrg#
25021c145c9fSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25031c145c9fSmrgm4_define([spec_default], m4_default([$1], [yes]))
25041c145c9fSmrgAC_ARG_ENABLE(specs,
25051c145c9fSmrg	AS_HELP_STRING([--enable-specs],
25061c145c9fSmrg	   [Enable building the specs (default: ]spec_default[)]),
25071c145c9fSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
25081c145c9fSmrgm4_undefine([spec_default])
25091c145c9fSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25101c145c9fSmrgAC_MSG_CHECKING([whether to build functional specifications])
25111c145c9fSmrgAC_MSG_RESULT([$build_specs])
25121c145c9fSmrg]) # XORG_ENABLE_SPECS
25134929c8f8Smrg
25141c145c9fSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25151c145c9fSmrg# ----------------------------------------------
25161c145c9fSmrg# Minimum version: 1.13.0
25174929c8f8Smrg#
25181c145c9fSmrg# This macro enables a builder to enable/disable unit testing
25191c145c9fSmrg# It makes no assumption about the test cases implementation
25201c145c9fSmrg# Test cases may or may not use Automake "Support for test suites"
25211c145c9fSmrg# They may or may not use the software utility library GLib
25221c145c9fSmrg#
25231c145c9fSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25241c145c9fSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25251c145c9fSmrg# The variable enable_unit_tests is used by other macros in this file.
25261c145c9fSmrg#
25271c145c9fSmrg# Interface to module:
25281c145c9fSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25291c145c9fSmrg# enable_unit_tests:    used in configure.ac for additional configuration
25301c145c9fSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25311c145c9fSmrg#			'no' user instructs the module not to build tests
25321c145c9fSmrg# parm1:		specify the default value, yes or no.
25331c145c9fSmrg#
25341c145c9fSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25351c145c9fSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25361c145c9fSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25371c145c9fSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25381c145c9fSmrgm4_define([_defopt], m4_default([$1], [auto]))
25391c145c9fSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25401c145c9fSmrg	[Enable building unit test cases (default: ]_defopt[)]),
25411c145c9fSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25421c145c9fSmrgm4_undefine([_defopt])
25431c145c9fSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25441c145c9fSmrgAC_MSG_CHECKING([whether to build unit test cases])
25451c145c9fSmrgAC_MSG_RESULT([$enable_unit_tests])
25461c145c9fSmrg]) # XORG_ENABLE_UNIT_TESTS
25474929c8f8Smrg
25481c145c9fSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25491c145c9fSmrg# ------------------------------------------------------
25501c145c9fSmrg# Minimum version: 1.17.0
25511c145c9fSmrg#
25521c145c9fSmrg# This macro enables a builder to enable/disable integration testing
25531c145c9fSmrg# It makes no assumption about the test cases' implementation
25541c145c9fSmrg# Test cases may or may not use Automake "Support for test suites"
25551c145c9fSmrg#
25561c145c9fSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25571c145c9fSmrg# usually requires less dependencies and may be built and run under less
25581c145c9fSmrg# stringent environments than integration tests.
25591c145c9fSmrg#
25601c145c9fSmrg# Interface to module:
25611c145c9fSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25621c145c9fSmrg# enable_integration_tests:   used in configure.ac for additional configuration
25631c145c9fSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25641c145c9fSmrg#                             'no' user instructs the module not to build tests
25651c145c9fSmrg# parm1:                      specify the default value, yes or no.
25661c145c9fSmrg#
25671c145c9fSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
25681c145c9fSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25691c145c9fSmrgm4_define([_defopt], m4_default([$1], [auto]))
25701c145c9fSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
25711c145c9fSmrg	[Enable building integration test cases (default: ]_defopt[)]),
25721c145c9fSmrg	[enable_integration_tests=$enableval],
25731c145c9fSmrg	[enable_integration_tests=]_defopt)
25741c145c9fSmrgm4_undefine([_defopt])
25751c145c9fSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
25761c145c9fSmrg	[test "x$enable_integration_tests" != xno])
25771c145c9fSmrgAC_MSG_CHECKING([whether to build unit test cases])
25781c145c9fSmrgAC_MSG_RESULT([$enable_integration_tests])
25791c145c9fSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
25804929c8f8Smrg
25811c145c9fSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25821c145c9fSmrg# ----------------------------------------
25831c145c9fSmrg# Minimum version: 1.13.0
25841c145c9fSmrg#
25851c145c9fSmrg# GLib is a library which provides advanced data structures and functions.
25861c145c9fSmrg# This macro enables a module to test for the presence of Glib.
25871c145c9fSmrg#
25881c145c9fSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25891c145c9fSmrg# Otherwise the value of $enable_unit_tests is blank.
25901c145c9fSmrg#
25911c145c9fSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25921c145c9fSmrg# test support usually requires less dependencies and may be built and run under
25931c145c9fSmrg# less stringent environments than integration tests.
25944929c8f8Smrg#
25951c145c9fSmrg# Interface to module:
25961c145c9fSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
25971c145c9fSmrg# with_glib: used in configure.ac to know if GLib has been found
25981c145c9fSmrg# --with-glib:	'yes' user instructs the module to use glib
25991c145c9fSmrg#		'no' user instructs the module not to use glib
26001c145c9fSmrg#
26011c145c9fSmrgAC_DEFUN([XORG_WITH_GLIB],[
26021c145c9fSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26031c145c9fSmrgm4_define([_defopt], m4_default([$2], [auto]))
26041c145c9fSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26051c145c9fSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26061c145c9fSmrg	[with_glib=$withval], [with_glib=]_defopt)
26071c145c9fSmrgm4_undefine([_defopt])
2608df58931aSmrg
26091c145c9fSmrghave_glib=no
26101c145c9fSmrg# Do not probe GLib if user explicitly disabled unit testing
26111c145c9fSmrgif test "x$enable_unit_tests" != x"no"; then
26121c145c9fSmrg  # Do not probe GLib if user explicitly disabled it
26131c145c9fSmrg  if test "x$with_glib" != x"no"; then
26141c145c9fSmrg    m4_ifval(
26151c145c9fSmrg      [$1],
26161c145c9fSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26171c145c9fSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26181c145c9fSmrg    )
2619df58931aSmrg  fi
2620df58931aSmrgfi
2621df58931aSmrg
26221c145c9fSmrg# Not having GLib when unit testing has been explicitly requested is an error
26231c145c9fSmrgif test "x$enable_unit_tests" = x"yes"; then
26241c145c9fSmrg  if test "x$have_glib" = x"no"; then
26251c145c9fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626df58931aSmrg  fi
2627df58931aSmrgfi
2628df58931aSmrg
26291c145c9fSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
26301c145c9fSmrgif test "x$enable_unit_tests" = x"no"; then
26311c145c9fSmrg  if test "x$with_glib" = x"yes"; then
26321c145c9fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26331c145c9fSmrg  fi
26341c145c9fSmrgfi
2635df58931aSmrg
26361c145c9fSmrg# Not having GLib when it has been explicitly requested is an error
26371c145c9fSmrgif test "x$with_glib" = x"yes"; then
26381c145c9fSmrg  if test "x$have_glib" = x"no"; then
26391c145c9fSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26401c145c9fSmrg  fi
26411c145c9fSmrgfi
2642df58931aSmrg
26431c145c9fSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26441c145c9fSmrg]) # XORG_WITH_GLIB
2645b66d1acbSmrg
26461c145c9fSmrg# XORG_LD_WRAP([required|optional])
26471c145c9fSmrg# ---------------------------------
26481c145c9fSmrg# Minimum version: 1.13.0
26491c145c9fSmrg#
26501c145c9fSmrg# Check if linker supports -wrap, passed via compiler flags
26511c145c9fSmrg#
26521c145c9fSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26531c145c9fSmrg# Otherwise the value of $enable_unit_tests is blank.
26541c145c9fSmrg#
26551c145c9fSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26561c145c9fSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26571c145c9fSmrg# available, an argument of "optional" allows use when some unit tests require
26581c145c9fSmrg# ld -wrap and others do not.
26591c145c9fSmrg#
26601c145c9fSmrgAC_DEFUN([XORG_LD_WRAP],[
26611c145c9fSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26621c145c9fSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26631c145c9fSmrg                      void __wrap_exit(int status) { return; }],
26641c145c9fSmrg                     [exit(0);])])
26651c145c9fSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
26661c145c9fSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
26671c145c9fSmrg  if test "x$have_ld_wrap" = x"no"; then
26681c145c9fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
26691c145c9fSmrg  fi
26701c145c9fSmrgfi
26711c145c9fSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
26721c145c9fSmrg#
26731c145c9fSmrg]) # XORG_LD_WRAP
2674b66d1acbSmrg
26751c145c9fSmrg# XORG_CHECK_LINKER_FLAGS
26761c145c9fSmrg# -----------------------
26771c145c9fSmrg# SYNOPSIS
26781c145c9fSmrg#
26791c145c9fSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26801c145c9fSmrg#
26811c145c9fSmrg# DESCRIPTION
26821c145c9fSmrg#
26831c145c9fSmrg#   Check whether the given linker FLAGS work with the current language's
26841c145c9fSmrg#   linker, or whether they give an error.
26851c145c9fSmrg#
26861c145c9fSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26871c145c9fSmrg#   success/failure.
26881c145c9fSmrg#
26891c145c9fSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
26901c145c9fSmrg#
26911c145c9fSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26921c145c9fSmrg#
26931c145c9fSmrg# LICENSE
26941c145c9fSmrg#
26951c145c9fSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26961c145c9fSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26971c145c9fSmrg#   Copyright (c) 2009 Matteo Frigo
26981c145c9fSmrg#
26991c145c9fSmrg#   This program is free software: you can redistribute it and/or modify it
27001c145c9fSmrg#   under the terms of the GNU General Public License as published by the
27011c145c9fSmrg#   Free Software Foundation, either version 3 of the License, or (at your
27021c145c9fSmrg#   option) any later version.
27031c145c9fSmrg#
27041c145c9fSmrg#   This program is distributed in the hope that it will be useful, but
27051c145c9fSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27061c145c9fSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27071c145c9fSmrg#   Public License for more details.
27081c145c9fSmrg#
27091c145c9fSmrg#   You should have received a copy of the GNU General Public License along
27101c145c9fSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27111c145c9fSmrg#
27121c145c9fSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
27131c145c9fSmrg#   gives unlimited permission to copy, distribute and modify the configure
27141c145c9fSmrg#   scripts that are the output of Autoconf when processing the Macro. You
27151c145c9fSmrg#   need not follow the terms of the GNU General Public License when using
27161c145c9fSmrg#   or distributing such scripts, even though portions of the text of the
27171c145c9fSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27181c145c9fSmrg#   all other use of the material that constitutes the Autoconf Macro.
27191c145c9fSmrg#
27201c145c9fSmrg#   This special exception to the GPL applies to versions of the Autoconf
27211c145c9fSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
27221c145c9fSmrg#   modified version of the Autoconf Macro, you may extend this special
27231c145c9fSmrg#   exception to the GPL to apply to your modified version as well.#
27241c145c9fSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27251c145c9fSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
27261c145c9fSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27271c145c9fSmrgAS_LITERAL_IF([$1],
27281c145c9fSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27291c145c9fSmrg      ax_save_FLAGS=$LDFLAGS
27301c145c9fSmrg      LDFLAGS="$1"
27311c145c9fSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27321c145c9fSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27331c145c9fSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27341c145c9fSmrg      LDFLAGS=$ax_save_FLAGS])],
27351c145c9fSmrg  [ax_save_FLAGS=$LDFLAGS
27361c145c9fSmrg   LDFLAGS="$1"
27371c145c9fSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27381c145c9fSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27391c145c9fSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27401c145c9fSmrg   LDFLAGS=$ax_save_FLAGS])
27411c145c9fSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27421c145c9fSmrgAC_MSG_RESULT($xorg_check_linker_flags)
27431c145c9fSmrgif test "x$xorg_check_linker_flags" = xyes; then
27441c145c9fSmrg	m4_default([$2], :)
27451c145c9fSmrgelse
27461c145c9fSmrg	m4_default([$3], :)
27471c145c9fSmrgfi
27481c145c9fSmrg]) # XORG_CHECK_LINKER_FLAGS
2749b66d1acbSmrg
27501c145c9fSmrg# XORG_MEMORY_CHECK_FLAGS
27511c145c9fSmrg# -----------------------
27521c145c9fSmrg# Minimum version: 1.16.0
27531c145c9fSmrg#
27541c145c9fSmrg# This macro attempts to find appropriate memory checking functionality
27551c145c9fSmrg# for various platforms which unit testing code may use to catch various
27561c145c9fSmrg# forms of memory allocation and access errors in testing.
27571c145c9fSmrg#
27581c145c9fSmrg# Interface to module:
27591c145c9fSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27601c145c9fSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27611c145c9fSmrg#
27621c145c9fSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27631c145c9fSmrg#
27641c145c9fSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
27654fb28925Smrg
27661c145c9fSmrgAC_REQUIRE([AC_CANONICAL_HOST])
27671c145c9fSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
27681c145c9fSmrg           [Environment variables to enable memory checking in tests])
27694fb28925Smrg
27701c145c9fSmrg# Check for different types of support on different platforms
27711c145c9fSmrgcase $host_os in
27721c145c9fSmrg    solaris*)
27731c145c9fSmrg        AC_CHECK_LIB([umem], [umem_alloc],
27741c145c9fSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
27751c145c9fSmrg        ;;
27761c145c9fSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
27771c145c9fSmrg        # both directly and inverted, so should not be 0 or 255.
27781c145c9fSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
27791c145c9fSmrg        ;;
27801c145c9fSmrg    darwin*)
27811c145c9fSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
27821c145c9fSmrg        ;;
27831c145c9fSmrg    *bsd*)
27841c145c9fSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27851c145c9fSmrg        ;;
27861c145c9fSmrgesac
27874929c8f8Smrg
27881c145c9fSmrg# User supplied flags override default flags
27891c145c9fSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27901c145c9fSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27914fb28925Smrgfi
2792b66d1acbSmrg
27931c145c9fSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27941c145c9fSmrg]) # XORG_WITH_LINT
2795df58931aSmrg
27961c145c9fSmrg# XORG_CHECK_MALLOC_ZERO
27971c145c9fSmrg# ----------------------
27981c145c9fSmrg# Minimum version: 1.0.0
27994929c8f8Smrg#
28001c145c9fSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28011c145c9fSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28021c145c9fSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28031c145c9fSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28041c145c9fSmrgAC_ARG_ENABLE(malloc0returnsnull,
28051c145c9fSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28061c145c9fSmrg		       [malloc(0) returns NULL (default: auto)]),
28071c145c9fSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28081c145c9fSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809df58931aSmrg
28101c145c9fSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28111c145c9fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28121c145c9fSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28131c145c9fSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28141c145c9fSmrg#include <stdlib.h>
28151c145c9fSmrg],[
28161c145c9fSmrg    char *m0, *r0, *c0, *p;
28171c145c9fSmrg    m0 = malloc(0);
28181c145c9fSmrg    p = malloc(10);
28191c145c9fSmrg    r0 = realloc(p,0);
28201c145c9fSmrg    c0 = calloc(0,10);
28211c145c9fSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28221c145c9fSmrg])],
28231c145c9fSmrg		[xorg_cv_malloc0_returns_null=yes],
28241c145c9fSmrg		[xorg_cv_malloc0_returns_null=no])])
28251c145c9fSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826df58931aSmrgfi
28271c145c9fSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828b66d1acbSmrg
28291c145c9fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28301c145c9fSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28311c145c9fSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28321c145c9fSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28334929c8f8Smrgelse
28341c145c9fSmrg	MALLOC_ZERO_CFLAGS=""
28351c145c9fSmrg	XMALLOC_ZERO_CFLAGS=""
28361c145c9fSmrg	XTMALLOC_ZERO_CFLAGS=""
28374929c8f8Smrgfi
2838b66d1acbSmrg
28391c145c9fSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28401c145c9fSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28411c145c9fSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28421c145c9fSmrg]) # XORG_CHECK_MALLOC_ZERO
2843b66d1acbSmrg
28441c145c9fSmrg# XORG_WITH_LINT()
28451c145c9fSmrg# ----------------
28461c145c9fSmrg# Minimum version: 1.1.0
2847df58931aSmrg#
28481c145c9fSmrg# This macro enables the use of a tool that flags some suspicious and
28491c145c9fSmrg# non-portable constructs (likely to be bugs) in C language source code.
28501c145c9fSmrg# It will attempt to locate the tool and use appropriate options.
28511c145c9fSmrg# There are various lint type tools on different platforms.
2852df58931aSmrg#
28531c145c9fSmrg# Interface to module:
28541c145c9fSmrg# LINT:		returns the path to the tool found on the platform
28551c145c9fSmrg#		or the value set to LINT on the configure cmd line
28561c145c9fSmrg#		also an Automake conditional
28571c145c9fSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
28581c145c9fSmrg#
28591c145c9fSmrg# --with-lint:	'yes' user instructs the module to use lint
28601c145c9fSmrg#		'no' user instructs the module not to use lint (default)
28611c145c9fSmrg#
28621c145c9fSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28631c145c9fSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28641c145c9fSmrg#
28651c145c9fSmrgAC_DEFUN([XORG_WITH_LINT],[
2866df58931aSmrg
28671c145c9fSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
28681c145c9fSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
28691c145c9fSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
28701c145c9fSmrg		[Use a lint-style source code checker (default: disabled)])],
28711c145c9fSmrg		[use_lint=$withval], [use_lint=no])
2872df58931aSmrg
28731c145c9fSmrg# Obtain platform specific info like program name and options
28741c145c9fSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
28751c145c9fSmrgcase $host_os in
28761c145c9fSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
28771c145c9fSmrg	lint_name=splint
28781c145c9fSmrg	lint_options="-badflag"
28791c145c9fSmrg	;;
28801c145c9fSmrg  *freebsd* | *netbsd*)
28811c145c9fSmrg	lint_name=lint
28821c145c9fSmrg	lint_options="-u -b"
28831c145c9fSmrg	;;
28841c145c9fSmrg  *solaris*)
28851c145c9fSmrg	lint_name=lint
28861c145c9fSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28871c145c9fSmrg	;;
28881c145c9fSmrgesac
28891c145c9fSmrg
28901c145c9fSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28911c145c9fSmrgif test "x$use_lint" = x"yes" ; then
28921c145c9fSmrg   AC_PATH_PROG([LINT], [$lint_name])
28931c145c9fSmrg   if test "x$LINT" = "x"; then
28941c145c9fSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28951c145c9fSmrg   fi
28961c145c9fSmrgelif test "x$use_lint" = x"no" ; then
28971c145c9fSmrg   if test "x$LINT" != "x"; then
28981c145c9fSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28991c145c9fSmrg   fi
29004929c8f8Smrgelse
29011c145c9fSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902df58931aSmrgfi
2903df58931aSmrg
29041c145c9fSmrg# User supplied flags override default flags
29051c145c9fSmrgif test "x$LINT_FLAGS" != "x"; then
29061c145c9fSmrg   lint_options=$LINT_FLAGS
29071c145c9fSmrgfi
2908df58931aSmrg
29091c145c9fSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29101c145c9fSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911df58931aSmrg
29121c145c9fSmrg]) # XORG_WITH_LINT
2913df58931aSmrg
29141c145c9fSmrg# XORG_LINT_LIBRARY(LIBNAME)
29151c145c9fSmrg# --------------------------
29161c145c9fSmrg# Minimum version: 1.1.0
2917df58931aSmrg#
29181c145c9fSmrg# Sets up flags for building lint libraries for checking programs that call
29191c145c9fSmrg# functions in the library.
29201c145c9fSmrg#
29211c145c9fSmrg# Interface to module:
29221c145c9fSmrg# LINTLIB		- Automake variable with the name of lint library file to make
29231c145c9fSmrg# MAKE_LINT_LIB		- Automake conditional
29241c145c9fSmrg#
29251c145c9fSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29261c145c9fSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2927df58931aSmrg
29281c145c9fSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29291c145c9fSmrgAC_REQUIRE([XORG_WITH_LINT])
29301c145c9fSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29311c145c9fSmrg	[Create lint library (default: disabled)])],
29321c145c9fSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
29331c145c9fSmrg
29341c145c9fSmrgif test "x$make_lint_lib" = x"yes" ; then
29351c145c9fSmrg   LINTLIB=llib-l$1.ln
29361c145c9fSmrg   if test "x$LINT" = "x"; then
29371c145c9fSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29381c145c9fSmrg   fi
29391c145c9fSmrgelif test "x$make_lint_lib" != x"no" ; then
29401c145c9fSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941df58931aSmrgfi
2942df58931aSmrg
29431c145c9fSmrgAC_SUBST(LINTLIB)
29441c145c9fSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29454929c8f8Smrg
29461c145c9fSmrg]) # XORG_LINT_LIBRARY
2947df58931aSmrg
29481c145c9fSmrg# XORG_COMPILER_BRAND
29494929c8f8Smrg# -------------------
29501c145c9fSmrg# Minimum version: 1.14.0
29514929c8f8Smrg#
29521c145c9fSmrg# Checks for various brands of compilers and sets flags as appropriate:
29531c145c9fSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29541c145c9fSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29551c145c9fSmrg#   clang compiler - sets CLANGCC to "yes"
29561c145c9fSmrg#   Intel compiler - sets INTELCC to "yes"
29571c145c9fSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29581c145c9fSmrg#
29591c145c9fSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29601c145c9fSmrgAC_LANG_CASE(
29611c145c9fSmrg	[C], [
29621c145c9fSmrg		AC_REQUIRE([AC_PROG_CC_C99])
29631c145c9fSmrg	],
29641c145c9fSmrg	[C++], [
29651c145c9fSmrg		AC_REQUIRE([AC_PROG_CXX])
29661c145c9fSmrg	]
29671c145c9fSmrg)
29681c145c9fSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
29691c145c9fSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
29701c145c9fSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
29711c145c9fSmrg]) # XORG_COMPILER_BRAND
2972df58931aSmrg
29731c145c9fSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
29744929c8f8Smrg# ---------------
29751c145c9fSmrg# Minimum version: 1.16.0
29761c145c9fSmrg#
29771c145c9fSmrg# Test if the compiler works when passed the given flag as a command line argument.
29781c145c9fSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
29791c145c9fSmrg# next flag in the list until there are no more options.
29801c145c9fSmrg#
29811c145c9fSmrg# Note that this does not guarantee that the compiler supports the flag as some
29821c145c9fSmrg# compilers will simply ignore arguments that they do not understand, but we do
29831c145c9fSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29841c145c9fSmrg# -Werror=unused-command-line-argument
29851c145c9fSmrg#
29861c145c9fSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29871c145c9fSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29881c145c9fSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2989df58931aSmrg
29901c145c9fSmrgAC_LANG_COMPILER_REQUIRE
29914929c8f8Smrg
29921c145c9fSmrgAC_LANG_CASE(
29931c145c9fSmrg	[C], [
29941c145c9fSmrg		AC_REQUIRE([AC_PROG_CC_C99])
29951c145c9fSmrg		define([PREFIX], [C])
29961c145c9fSmrg		define([CACHE_PREFIX], [cc])
29971c145c9fSmrg		define([COMPILER], [$CC])
29981c145c9fSmrg	],
29991c145c9fSmrg	[C++], [
30001c145c9fSmrg		define([PREFIX], [CXX])
30011c145c9fSmrg		define([CACHE_PREFIX], [cxx])
30021c145c9fSmrg		define([COMPILER], [$CXX])
30031c145c9fSmrg	]
30041c145c9fSmrg)
30051c145c9fSmrg
30061c145c9fSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30071c145c9fSmrg
30081c145c9fSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30091c145c9fSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30101c145c9fSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30111c145c9fSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30121c145c9fSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30131c145c9fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30141c145c9fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30151c145c9fSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30161c145c9fSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30174929c8f8Smrgfi
30181c145c9fSmrg
30191c145c9fSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30201c145c9fSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30211c145c9fSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30221c145c9fSmrg	fi
30231c145c9fSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30241c145c9fSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30251c145c9fSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30261c145c9fSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30271c145c9fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30281c145c9fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30291c145c9fSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30301c145c9fSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30311c145c9fSmrgfi
30321c145c9fSmrg
30331c145c9fSmrgfound="no"
30341c145c9fSmrgm4_foreach([flag], m4_cdr($@), [
30351c145c9fSmrg	if test $found = "no" ; then
30361c145c9fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30371c145c9fSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30381c145c9fSmrg		fi
30391c145c9fSmrg
30401c145c9fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30411c145c9fSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30421c145c9fSmrg		fi
30431c145c9fSmrg
30441c145c9fSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30451c145c9fSmrg
30461c145c9fSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30471c145c9fSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30481c145c9fSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30491c145c9fSmrg		AC_CACHE_VAL($cacheid,
30501c145c9fSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30511c145c9fSmrg					     [eval $cacheid=yes],
30521c145c9fSmrg					     [eval $cacheid=no])])
30531c145c9fSmrg
30541c145c9fSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30551c145c9fSmrg
30561c145c9fSmrg		eval supported=\$$cacheid
30571c145c9fSmrg		AC_MSG_RESULT([$supported])
30581c145c9fSmrg		if test "$supported" = "yes" ; then
30591c145c9fSmrg			$1="$$1 ]flag["
30601c145c9fSmrg			found="yes"
30611c145c9fSmrg		fi
30621c145c9fSmrg	fi
30634929c8f8Smrg])
30641c145c9fSmrg]) # XORG_TESTSET_CFLAG
3065df58931aSmrg
30661c145c9fSmrg# XORG_COMPILER_FLAGS
30671c145c9fSmrg# ---------------
30681c145c9fSmrg# Minimum version: 1.16.0
3069b66d1acbSmrg#
30701c145c9fSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
30711c145c9fSmrg# arguments supported by the selected compiler which do NOT alter the generated
30721c145c9fSmrg# code.  These arguments will cause the compiler to print various warnings
30731c145c9fSmrg# during compilation AND turn a conservative set of warnings into errors.
30741c145c9fSmrg#
30751c145c9fSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
30761c145c9fSmrg# future versions of util-macros as options are added to new compilers.
30771c145c9fSmrg#
30781c145c9fSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
30791c145c9fSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3080b66d1acbSmrg
30811c145c9fSmrgAC_ARG_ENABLE(selective-werror,
30821c145c9fSmrg              AS_HELP_STRING([--disable-selective-werror],
30831c145c9fSmrg                             [Turn off selective compiler errors. (default: enabled)]),
30841c145c9fSmrg              [SELECTIVE_WERROR=$enableval],
30851c145c9fSmrg              [SELECTIVE_WERROR=yes])
30861c145c9fSmrg
30871c145c9fSmrgAC_LANG_CASE(
30881c145c9fSmrg        [C], [
30891c145c9fSmrg                define([PREFIX], [C])
30901c145c9fSmrg        ],
30911c145c9fSmrg        [C++], [
30921c145c9fSmrg                define([PREFIX], [CXX])
30931c145c9fSmrg        ]
30941c145c9fSmrg)
30951c145c9fSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
30961c145c9fSmrgif test "x$SUNCC" = "xyes"; then
30971c145c9fSmrg    [BASE_]PREFIX[FLAGS]="-v"
30984929c8f8Smrgelse
30991c145c9fSmrg    [BASE_]PREFIX[FLAGS]=""
31004929c8f8Smrgfi
31014929c8f8Smrg
31021c145c9fSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31031c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31041c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31051c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31061c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31074929c8f8Smrg
31081c145c9fSmrgAC_LANG_CASE(
31091c145c9fSmrg	[C], [
31101c145c9fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31111c145c9fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31121c145c9fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31131c145c9fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31141c145c9fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31151c145c9fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31161c145c9fSmrg	]
31171c145c9fSmrg)
3118b66d1acbSmrg
31191c145c9fSmrg# This chunk adds additional warnings that could catch undesired effects.
31201c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31211c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31221c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31231c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31241c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31251c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31261c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3127df58931aSmrg
31281c145c9fSmrg# These are currently disabled because they are noisy.  They will be enabled
31291c145c9fSmrg# in the future once the codebase is sufficiently modernized to silence
31301c145c9fSmrg# them.  For now, I don't want them to drown out the other warnings.
31311c145c9fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31321c145c9fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31331c145c9fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3134df58931aSmrg
31351c145c9fSmrg# Turn some warnings into errors, so we don't accidently get successful builds
31361c145c9fSmrg# when there are problems that should be fixed.
3137df58931aSmrg
31381c145c9fSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31391c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31401c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31411c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31421c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31431c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31441c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31451c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31461c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31471c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31481c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31491c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31501c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31511c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31521c145c9fSmrgelse
31531c145c9fSmrgAC_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])
31541c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31551c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31561c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31571c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
31581c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
31591c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
31601c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
31611c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
31621c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
31631c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
31641c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
31651c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
31661c145c9fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31671c145c9fSmrgfi
3168df58931aSmrg
31691c145c9fSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31701c145c9fSmrg]) # XORG_COMPILER_FLAGS
3171b66d1acbSmrg
31721c145c9fSmrg# XORG_CWARNFLAGS
31731c145c9fSmrg# ---------------
31741c145c9fSmrg# Minimum version: 1.2.0
31751c145c9fSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3176b66d1acbSmrg#
31771c145c9fSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3178df58931aSmrg#
31791c145c9fSmrg# This function is deprecated because it defines -fno-strict-aliasing
31801c145c9fSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
31811c145c9fSmrg# is needed, then it should be added explicitly in the module when
31821c145c9fSmrg# it is updated to use BASE_CFLAGS.
3183df58931aSmrg#
31841c145c9fSmrgAC_DEFUN([XORG_CWARNFLAGS], [
31851c145c9fSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31861c145c9fSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31871c145c9fSmrgAC_LANG_CASE(
31881c145c9fSmrg	[C], [
31891c145c9fSmrg		CWARNFLAGS="$BASE_CFLAGS"
31901c145c9fSmrg		if  test "x$GCC" = xyes ; then
31911c145c9fSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
31921c145c9fSmrg		fi
31931c145c9fSmrg		AC_SUBST(CWARNFLAGS)
31941c145c9fSmrg	]
31951c145c9fSmrg)
31961c145c9fSmrg]) # XORG_CWARNFLAGS
3197df58931aSmrg
31981c145c9fSmrg# XORG_STRICT_OPTION
31991c145c9fSmrg# -----------------------
32001c145c9fSmrg# Minimum version: 1.3.0
32011c145c9fSmrg#
32021c145c9fSmrg# Add configure option to enable strict compilation flags, such as treating
32031c145c9fSmrg# warnings as fatal errors.
32041c145c9fSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32051c145c9fSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32061c145c9fSmrg#
32071c145c9fSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32081c145c9fSmrg# when strict compilation is unconditionally desired.
32091c145c9fSmrgAC_DEFUN([XORG_STRICT_OPTION], [
32101c145c9fSmrgAC_REQUIRE([XORG_CWARNFLAGS])
32111c145c9fSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32124fb28925Smrg
32131c145c9fSmrgAC_ARG_ENABLE(strict-compilation,
32141c145c9fSmrg			  AS_HELP_STRING([--enable-strict-compilation],
32151c145c9fSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32161c145c9fSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
32174929c8f8Smrg
32181c145c9fSmrgAC_LANG_CASE(
32191c145c9fSmrg        [C], [
32201c145c9fSmrg                define([PREFIX], [C])
32211c145c9fSmrg        ],
32221c145c9fSmrg        [C++], [
32231c145c9fSmrg                define([PREFIX], [CXX])
32241c145c9fSmrg        ]
32251c145c9fSmrg)
32264929c8f8Smrg
32271c145c9fSmrg[STRICT_]PREFIX[FLAGS]=""
32281c145c9fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32291c145c9fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
32304929c8f8Smrg
32311c145c9fSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32321c145c9fSmrg# activate it with -Werror, so we add it here explicitly.
32331c145c9fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
32344929c8f8Smrg
32351c145c9fSmrgif test "x$STRICT_COMPILE" = "xyes"; then
32361c145c9fSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32371c145c9fSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32381c145c9fSmrgfi
32391c145c9fSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32401c145c9fSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32411c145c9fSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32421c145c9fSmrg]) # XORG_STRICT_OPTION
32434929c8f8Smrg
32441c145c9fSmrg# XORG_DEFAULT_OPTIONS
32451c145c9fSmrg# --------------------
32461c145c9fSmrg# Minimum version: 1.3.0
32471c145c9fSmrg#
32481c145c9fSmrg# Defines default options for X.Org modules.
32491c145c9fSmrg#
32501c145c9fSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
32511c145c9fSmrgAC_REQUIRE([AC_PROG_INSTALL])
32521c145c9fSmrgXORG_COMPILER_FLAGS
32531c145c9fSmrgXORG_CWARNFLAGS
32541c145c9fSmrgXORG_STRICT_OPTION
32551c145c9fSmrgXORG_RELEASE_VERSION
32561c145c9fSmrgXORG_CHANGELOG
32571c145c9fSmrgXORG_INSTALL
32581c145c9fSmrgXORG_MANPAGE_SECTIONS
32591c145c9fSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32601c145c9fSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32611c145c9fSmrg]) # XORG_DEFAULT_OPTIONS
32624929c8f8Smrg
32631c145c9fSmrg# XORG_INSTALL()
32641c145c9fSmrg# ----------------
32651c145c9fSmrg# Minimum version: 1.4.0
32661c145c9fSmrg#
32671c145c9fSmrg# Defines the variable INSTALL_CMD as the command to copy
32681c145c9fSmrg# INSTALL from $prefix/share/util-macros.
32691c145c9fSmrg#
32701c145c9fSmrgAC_DEFUN([XORG_INSTALL], [
32711c145c9fSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
32721c145c9fSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
32731c145c9fSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
32741c145c9fSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
32751c145c9fSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
32761c145c9fSmrgtouch \$(top_srcdir)/INSTALL; \
32771c145c9fSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
32781c145c9fSmrgAC_SUBST([INSTALL_CMD])
32791c145c9fSmrg]) # XORG_INSTALL
32801c145c9fSmrgdnl Copyright 2005 Red Hat, Inc
32811c145c9fSmrgdnl
32821c145c9fSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
32831c145c9fSmrgdnl documentation for any purpose is hereby granted without fee, provided that
32841c145c9fSmrgdnl the above copyright notice appear in all copies and that both that
32851c145c9fSmrgdnl copyright notice and this permission notice appear in supporting
32861c145c9fSmrgdnl documentation.
32871c145c9fSmrgdnl
32881c145c9fSmrgdnl The above copyright notice and this permission notice shall be included
32891c145c9fSmrgdnl in all copies or substantial portions of the Software.
32901c145c9fSmrgdnl
32911c145c9fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32921c145c9fSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32931c145c9fSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
32941c145c9fSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
32951c145c9fSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
32961c145c9fSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
32971c145c9fSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
32981c145c9fSmrgdnl
32991c145c9fSmrgdnl Except as contained in this notice, the name of the copyright holders shall
33001c145c9fSmrgdnl not be used in advertising or otherwise to promote the sale, use or
33011c145c9fSmrgdnl other dealings in this Software without prior written authorization
33021c145c9fSmrgdnl from the copyright holders.
33031c145c9fSmrgdnl
33044929c8f8Smrg
33051c145c9fSmrg# XORG_RELEASE_VERSION
33061c145c9fSmrg# --------------------
33071c145c9fSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33084929c8f8Smrg
33091c145c9fSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33101c145c9fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33111c145c9fSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33121c145c9fSmrg		[Major version of this package])
33131c145c9fSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33141c145c9fSmrg	if test "x$PVM" = "x"; then
33151c145c9fSmrg		PVM="0"
33161c145c9fSmrg	fi
33171c145c9fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33181c145c9fSmrg		[$PVM],
33191c145c9fSmrg		[Minor version of this package])
33201c145c9fSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33211c145c9fSmrg	if test "x$PVP" = "x"; then
33221c145c9fSmrg		PVP="0"
33231c145c9fSmrg	fi
33241c145c9fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33251c145c9fSmrg		[$PVP],
33261c145c9fSmrg		[Patch version of this package])
33271c145c9fSmrg])
33284929c8f8Smrg
33291c145c9fSmrg# XORG_CHANGELOG()
33301c145c9fSmrg# ----------------
33311c145c9fSmrg# Minimum version: 1.2.0
33321c145c9fSmrg#
33331c145c9fSmrg# Defines the variable CHANGELOG_CMD as the command to generate
33341c145c9fSmrg# ChangeLog from git.
33351c145c9fSmrg#
33361c145c9fSmrg#
33371c145c9fSmrgAC_DEFUN([XORG_CHANGELOG], [
33381c145c9fSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33391c145c9fSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33401c145c9fSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33411c145c9fSmrgtouch \$(top_srcdir)/ChangeLog; \
33421c145c9fSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33431c145c9fSmrgAC_SUBST([CHANGELOG_CMD])
33441c145c9fSmrg]) # XORG_CHANGELOG
3345b66d1acbSmrg
3346