aclocal.m4 revision 3b83913f
13b83913fSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2a39bb051Smrg
33b83913fSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4c19de146Smrg
5c19de146Smrg# This file is free software; the Free Software Foundation
6c19de146Smrg# gives unlimited permission to copy and/or distribute it,
7c19de146Smrg# with or without modifications, as long as this notice is preserved.
8c19de146Smrg
9c19de146Smrg# This program is distributed in the hope that it will be useful,
10c19de146Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11c19de146Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12c19de146Smrg# PARTICULAR PURPOSE.
13c19de146Smrg
14a39bb051Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
159ef7378bSmrgm4_ifndef([AC_AUTOCONF_VERSION],
169ef7378bSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
173b83913fSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
183b83913fSmrg[m4_warning([this file was generated for autoconf 2.72.
199ef7378bSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
209ef7378bSmrgIf you have problems, you may need to regenerate the build system entirely.
21a39bb051SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22c19de146Smrg
233b83913fSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
243b83913fSmrg#
253b83913fSmrg# This file is free software; the Free Software Foundation
263b83913fSmrg# gives unlimited permission to copy and/or distribute it,
273b83913fSmrg# with or without modifications, as long as this notice is preserved.
28a39bb051Smrg
293b83913fSmrg# AM_AUTOMAKE_VERSION(VERSION)
303b83913fSmrg# ----------------------------
313b83913fSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
323b83913fSmrg# generated from the m4 files accompanying Automake X.Y.
333b83913fSmrg# (This private macro should not be called outside this file.)
343b83913fSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
353b83913fSmrg[am__api_version='1.16'
363b83913fSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
373b83913fSmrgdnl require some minimum version.  Point them to the right macro.
383b83913fSmrgm4_if([$1], [1.16.5], [],
393b83913fSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
403b83913fSmrg])
41a39bb051Smrg
423b83913fSmrg# _AM_AUTOCONF_VERSION(VERSION)
433b83913fSmrg# -----------------------------
443b83913fSmrg# aclocal traces this macro to find the Autoconf version.
453b83913fSmrg# This is a private macro too.  Using m4_define simplifies
463b83913fSmrg# the logic in aclocal, which can simply ignore this definition.
473b83913fSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48c19de146Smrg
493b83913fSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
503b83913fSmrg# -------------------------------
513b83913fSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
523b83913fSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
533b83913fSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
543b83913fSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
553b83913fSmrgm4_ifndef([AC_AUTOCONF_VERSION],
563b83913fSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
573b83913fSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
589ef7378bSmrg
593b83913fSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60c19de146Smrg
613b83913fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
623b83913fSmrg#
633b83913fSmrg# This file is free software; the Free Software Foundation
643b83913fSmrg# gives unlimited permission to copy and/or distribute it,
653b83913fSmrg# with or without modifications, as long as this notice is preserved.
66c19de146Smrg
673b83913fSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
683b83913fSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
693b83913fSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
703b83913fSmrg#
713b83913fSmrg# Of course, Automake must honor this variable whenever it calls a
723b83913fSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
733b83913fSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
743b83913fSmrg# depending on how configure is run.  This is pretty annoying, since
753b83913fSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
763b83913fSmrg# source directory, any form will work fine, but in subdirectories a
773b83913fSmrg# relative path needs to be adjusted first.
783b83913fSmrg#
793b83913fSmrg# $ac_aux_dir/missing
803b83913fSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
813b83913fSmrg# $top_srcdir/$ac_aux_dir/missing
823b83913fSmrg#    fails if $ac_aux_dir is absolute,
833b83913fSmrg#    fails when called from a subdirectory in a VPATH build with
843b83913fSmrg#          a relative $ac_aux_dir
853b83913fSmrg#
863b83913fSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
873b83913fSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
883b83913fSmrg# harmless because $srcdir is '.', but things will broke when you
893b83913fSmrg# start a VPATH build or use an absolute $srcdir.
903b83913fSmrg#
913b83913fSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
923b83913fSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
933b83913fSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
943b83913fSmrg# and then we would define $MISSING as
953b83913fSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
963b83913fSmrg# This will work as long as MISSING is not called from configure, because
973b83913fSmrg# unfortunately $(top_srcdir) has no meaning in configure.
983b83913fSmrg# However there are other variables, like CC, which are often used in
993b83913fSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1003b83913fSmrg#
1013b83913fSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1023b83913fSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1033b83913fSmrg# configured tree to be moved without reconfiguration.
104c19de146Smrg
1053b83913fSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1063b83913fSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1073b83913fSmrg# Expand $ac_aux_dir to an absolute path.
1083b83913fSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1093b83913fSmrg])
110c19de146Smrg
1113b83913fSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112c19de146Smrg
1133b83913fSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
1143b83913fSmrg#
1153b83913fSmrg# This file is free software; the Free Software Foundation
1163b83913fSmrg# gives unlimited permission to copy and/or distribute it,
1173b83913fSmrg# with or without modifications, as long as this notice is preserved.
118c19de146Smrg
1193b83913fSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1203b83913fSmrg# -------------------------------------
1213b83913fSmrg# Define a conditional.
1223b83913fSmrgAC_DEFUN([AM_CONDITIONAL],
1233b83913fSmrg[AC_PREREQ([2.52])dnl
1243b83913fSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1253b83913fSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1263b83913fSmrgAC_SUBST([$1_TRUE])dnl
1273b83913fSmrgAC_SUBST([$1_FALSE])dnl
1283b83913fSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1293b83913fSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1303b83913fSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1313b83913fSmrgif $2; then
1323b83913fSmrg  $1_TRUE=
1333b83913fSmrg  $1_FALSE='#'
1343b83913fSmrgelse
1353b83913fSmrg  $1_TRUE='#'
1363b83913fSmrg  $1_FALSE=
1373b83913fSmrgfi
1383b83913fSmrgAC_CONFIG_COMMANDS_PRE(
1393b83913fSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1403b83913fSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1413b83913fSmrgUsually this means the macro was only invoked conditionally.]])
1423b83913fSmrgfi])])
143c19de146Smrg
1443b83913fSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
1453b83913fSmrg#
1463b83913fSmrg# This file is free software; the Free Software Foundation
1473b83913fSmrg# gives unlimited permission to copy and/or distribute it,
1483b83913fSmrg# with or without modifications, as long as this notice is preserved.
149c19de146Smrg
150c19de146Smrg
1513b83913fSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1523b83913fSmrg# written in clear, in which case automake, when reading aclocal.m4,
1533b83913fSmrg# will think it sees a *use*, and therefore will trigger all it's
1543b83913fSmrg# C support machinery.  Also note that it means that autoscan, seeing
1553b83913fSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156c19de146Smrg
157c19de146Smrg
1583b83913fSmrg# _AM_DEPENDENCIES(NAME)
1593b83913fSmrg# ----------------------
1603b83913fSmrg# See how the compiler implements dependency checking.
1613b83913fSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1623b83913fSmrg# We try a few techniques and use that to set a single cache variable.
1633b83913fSmrg#
1643b83913fSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1653b83913fSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1663b83913fSmrg# dependency, and given that the user is not expected to run this macro,
1673b83913fSmrg# just rely on AC_PROG_CC.
1683b83913fSmrgAC_DEFUN([_AM_DEPENDENCIES],
1693b83913fSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1703b83913fSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1713b83913fSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1723b83913fSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173c19de146Smrg
1743b83913fSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1753b83913fSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1763b83913fSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1773b83913fSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1783b83913fSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1793b83913fSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1803b83913fSmrg                    [depcc="$$1"   am_compiler_list=])
181c19de146Smrg
1823b83913fSmrgAC_CACHE_CHECK([dependency style of $depcc],
1833b83913fSmrg               [am_cv_$1_dependencies_compiler_type],
1843b83913fSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1853b83913fSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1863b83913fSmrg  # making bogus files that we don't know about and never remove.  For
1873b83913fSmrg  # instance it was reported that on HP-UX the gcc test will end up
1883b83913fSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1893b83913fSmrg  # in D".
1903b83913fSmrg  rm -rf conftest.dir
1913b83913fSmrg  mkdir conftest.dir
1923b83913fSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1933b83913fSmrg  # using a relative directory.
1943b83913fSmrg  cp "$am_depcomp" conftest.dir
1953b83913fSmrg  cd conftest.dir
1963b83913fSmrg  # We will build objects and dependencies in a subdirectory because
1973b83913fSmrg  # it helps to detect inapplicable dependency modes.  For instance
1983b83913fSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1993b83913fSmrg  # side effect of compilation, but ICC will put the dependencies in
2003b83913fSmrg  # the current directory while Tru64 will put them in the object
2013b83913fSmrg  # directory.
2023b83913fSmrg  mkdir sub
203c19de146Smrg
2043b83913fSmrg  am_cv_$1_dependencies_compiler_type=none
2053b83913fSmrg  if test "$am_compiler_list" = ""; then
2063b83913fSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2073b83913fSmrg  fi
2083b83913fSmrg  am__universal=false
2093b83913fSmrg  m4_case([$1], [CC],
2103b83913fSmrg    [case " $depcc " in #(
2113b83913fSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2123b83913fSmrg     esac],
2133b83913fSmrg    [CXX],
2143b83913fSmrg    [case " $depcc " in #(
2153b83913fSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2163b83913fSmrg     esac])
217c19de146Smrg
2183b83913fSmrg  for depmode in $am_compiler_list; do
2193b83913fSmrg    # Setup a source with many dependencies, because some compilers
2203b83913fSmrg    # like to wrap large dependency lists on column 80 (with \), and
2213b83913fSmrg    # we should not choose a depcomp mode which is confused by this.
2223b83913fSmrg    #
2233b83913fSmrg    # We need to recreate these files for each test, as the compiler may
2243b83913fSmrg    # overwrite some of them when testing with obscure command lines.
2253b83913fSmrg    # This happens at least with the AIX C compiler.
2263b83913fSmrg    : > sub/conftest.c
2273b83913fSmrg    for i in 1 2 3 4 5 6; do
2283b83913fSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2293b83913fSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2303b83913fSmrg      # Solaris 10 /bin/sh.
2313b83913fSmrg      echo '/* dummy */' > sub/conftst$i.h
2323b83913fSmrg    done
2333b83913fSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234c19de146Smrg
2353b83913fSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2363b83913fSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2373b83913fSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2383b83913fSmrg    # versions had trouble with output in subdirs.
2393b83913fSmrg    am__obj=sub/conftest.${OBJEXT-o}
2403b83913fSmrg    am__minus_obj="-o $am__obj"
2413b83913fSmrg    case $depmode in
2423b83913fSmrg    gcc)
2433b83913fSmrg      # This depmode causes a compiler race in universal mode.
2443b83913fSmrg      test "$am__universal" = false || continue
2453b83913fSmrg      ;;
2463b83913fSmrg    nosideeffect)
2473b83913fSmrg      # After this tag, mechanisms are not by side-effect, so they'll
2483b83913fSmrg      # only be used when explicitly requested.
2493b83913fSmrg      if test "x$enable_dependency_tracking" = xyes; then
2503b83913fSmrg	continue
2513b83913fSmrg      else
2523b83913fSmrg	break
2533b83913fSmrg      fi
2543b83913fSmrg      ;;
2553b83913fSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2563b83913fSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
2573b83913fSmrg      # not run yet.  These depmodes are late enough in the game, and
2583b83913fSmrg      # so weak that their functioning should not be impacted.
2593b83913fSmrg      am__obj=conftest.${OBJEXT-o}
2603b83913fSmrg      am__minus_obj=
2613b83913fSmrg      ;;
2623b83913fSmrg    none) break ;;
2633b83913fSmrg    esac
2643b83913fSmrg    if depmode=$depmode \
2653b83913fSmrg       source=sub/conftest.c object=$am__obj \
2663b83913fSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2673b83913fSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2683b83913fSmrg         >/dev/null 2>conftest.err &&
2693b83913fSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2703b83913fSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2713b83913fSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2723b83913fSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2733b83913fSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2743b83913fSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2753b83913fSmrg      # that says an option was ignored or not supported.
2763b83913fSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2773b83913fSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2783b83913fSmrg      # The diagnosis changed in icc 8.0:
2793b83913fSmrg      #   icc: Command line remark: option '-MP' not supported
2803b83913fSmrg      if (grep 'ignoring option' conftest.err ||
2813b83913fSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2823b83913fSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2833b83913fSmrg        break
2843b83913fSmrg      fi
2853b83913fSmrg    fi
2863b83913fSmrg  done
287c19de146Smrg
2883b83913fSmrg  cd ..
2893b83913fSmrg  rm -rf conftest.dir
2903b83913fSmrgelse
2913b83913fSmrg  am_cv_$1_dependencies_compiler_type=none
2923b83913fSmrgfi
2933b83913fSmrg])
2943b83913fSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2953b83913fSmrgAM_CONDITIONAL([am__fastdep$1], [
2963b83913fSmrg  test "x$enable_dependency_tracking" != xno \
2973b83913fSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2983b83913fSmrg])
2999ef7378bSmrg
300a39bb051Smrg
3013b83913fSmrg# AM_SET_DEPDIR
3023b83913fSmrg# -------------
3033b83913fSmrg# Choose a directory name for dependency files.
3043b83913fSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3053b83913fSmrgAC_DEFUN([AM_SET_DEPDIR],
3063b83913fSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3073b83913fSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3083b83913fSmrg])
309a39bb051Smrg
310a39bb051Smrg
3113b83913fSmrg# AM_DEP_TRACK
3123b83913fSmrg# ------------
3133b83913fSmrgAC_DEFUN([AM_DEP_TRACK],
3143b83913fSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3153b83913fSmrgAS_HELP_STRING(
3163b83913fSmrg  [--enable-dependency-tracking],
3173b83913fSmrg  [do not reject slow dependency extractors])
3183b83913fSmrgAS_HELP_STRING(
3193b83913fSmrg  [--disable-dependency-tracking],
3203b83913fSmrg  [speeds up one-time build])])
3213b83913fSmrgif test "x$enable_dependency_tracking" != xno; then
3223b83913fSmrg  am_depcomp="$ac_aux_dir/depcomp"
3233b83913fSmrg  AMDEPBACKSLASH='\'
3243b83913fSmrg  am__nodep='_no'
3253b83913fSmrgfi
3263b83913fSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3273b83913fSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3283b83913fSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3293b83913fSmrgAC_SUBST([am__nodep])dnl
3303b83913fSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3313b83913fSmrg])
332a39bb051Smrg
3333b83913fSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334c19de146Smrg
3353b83913fSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3363b83913fSmrg#
3373b83913fSmrg# This file is free software; the Free Software Foundation
3383b83913fSmrg# gives unlimited permission to copy and/or distribute it,
3393b83913fSmrg# with or without modifications, as long as this notice is preserved.
340c19de146Smrg
3413b83913fSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3423b83913fSmrg# ------------------------------
3433b83913fSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3443b83913fSmrg[{
3453b83913fSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
3463b83913fSmrg  # are listed without --file.  Let's play safe and only enable the eval
3473b83913fSmrg  # if we detect the quoting.
3483b83913fSmrg  # TODO: see whether this extra hack can be removed once we start
3493b83913fSmrg  # requiring Autoconf 2.70 or later.
3503b83913fSmrg  AS_CASE([$CONFIG_FILES],
3513b83913fSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
3523b83913fSmrg          [*], [set x $CONFIG_FILES])
3533b83913fSmrg  shift
3543b83913fSmrg  # Used to flag and report bootstrapping failures.
3553b83913fSmrg  am_rc=0
3563b83913fSmrg  for am_mf
3573b83913fSmrg  do
3583b83913fSmrg    # Strip MF so we end up with the name of the file.
3593b83913fSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3603b83913fSmrg    # Check whether this is an Automake generated Makefile which includes
3613b83913fSmrg    # dependency-tracking related rules and includes.
3623b83913fSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3633b83913fSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3643b83913fSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3653b83913fSmrg      || continue
3663b83913fSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3673b83913fSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3683b83913fSmrg    AM_RUN_LOG([cd "$am_dirpart" \
3693b83913fSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3703b83913fSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3713b83913fSmrg  done
3723b83913fSmrg  if test $am_rc -ne 0; then
3733b83913fSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3743b83913fSmrg    for automatic dependency tracking.  If GNU make was not used, consider
3753b83913fSmrg    re-running the configure script with MAKE="gmake" (or whatever is
3763b83913fSmrg    necessary).  You can also try re-running configure with the
3773b83913fSmrg    '--disable-dependency-tracking' option to at least be able to build
3783b83913fSmrg    the package (albeit without support for automatic dependency tracking).])
3793b83913fSmrg  fi
3803b83913fSmrg  AS_UNSET([am_dirpart])
3813b83913fSmrg  AS_UNSET([am_filepart])
3823b83913fSmrg  AS_UNSET([am_mf])
3833b83913fSmrg  AS_UNSET([am_rc])
3843b83913fSmrg  rm -f conftest-deps.mk
3853b83913fSmrg}
3863b83913fSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387c19de146Smrg
388c19de146Smrg
3893b83913fSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3903b83913fSmrg# -----------------------------
3913b83913fSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
392a39bb051Smrg#
3933b83913fSmrg# This code is only required when automatic dependency tracking is enabled.
3943b83913fSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3953b83913fSmrg# order to bootstrap the dependency handling code.
3963b83913fSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3973b83913fSmrg[AC_CONFIG_COMMANDS([depfiles],
3983b83913fSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3993b83913fSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400c19de146Smrg
4013b83913fSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4023b83913fSmrg
4033b83913fSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
404a39bb051Smrg#
4053b83913fSmrg# This file is free software; the Free Software Foundation
4063b83913fSmrg# gives unlimited permission to copy and/or distribute it,
4073b83913fSmrg# with or without modifications, as long as this notice is preserved.
408c19de146Smrg
4093b83913fSmrg# This macro actually does too much.  Some checks are only needed if
4103b83913fSmrg# your package does certain things.  But this isn't really a big deal.
4113b83913fSmrg
4123b83913fSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4133b83913fSmrgm4_define([AC_PROG_CC],
4143b83913fSmrgm4_defn([AC_PROG_CC])
4153b83913fSmrg[_AM_PROG_CC_C_O
4163b83913fSmrg])
4173b83913fSmrg
4183b83913fSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4193b83913fSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4203b83913fSmrg# -----------------------------------------------
4213b83913fSmrg# The call with PACKAGE and VERSION arguments is the old style
4223b83913fSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4233b83913fSmrg# and VERSION should now be passed to AC_INIT and removed from
4243b83913fSmrg# the call to AM_INIT_AUTOMAKE.
4253b83913fSmrg# We support both call styles for the transition.  After
4263b83913fSmrg# the next Automake release, Autoconf can make the AC_INIT
4273b83913fSmrg# arguments mandatory, and then we can depend on a new Autoconf
4283b83913fSmrg# release and drop the old call support.
4293b83913fSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4303b83913fSmrg[AC_PREREQ([2.65])dnl
4313b83913fSmrgm4_ifdef([_$0_ALREADY_INIT],
4323b83913fSmrg  [m4_fatal([$0 expanded multiple times
4333b83913fSmrg]m4_defn([_$0_ALREADY_INIT]))],
4343b83913fSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4353b83913fSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4363b83913fSmrgdnl the ones we care about.
4373b83913fSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4383b83913fSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4393b83913fSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4403b83913fSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4413b83913fSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4423b83913fSmrg  # is not polluted with repeated "-I."
4433b83913fSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4443b83913fSmrg  # test to see if srcdir already configured
4453b83913fSmrg  if test -f $srcdir/config.status; then
4463b83913fSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4473b83913fSmrg  fi
448c19de146Smrgfi
449c19de146Smrg
4503b83913fSmrg# test whether we have cygpath
4513b83913fSmrgif test -z "$CYGPATH_W"; then
4523b83913fSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4533b83913fSmrg    CYGPATH_W='cygpath -w'
4543b83913fSmrg  else
4553b83913fSmrg    CYGPATH_W=echo
4563b83913fSmrg  fi
457a39bb051Smrgfi
4583b83913fSmrgAC_SUBST([CYGPATH_W])
459c19de146Smrg
4603b83913fSmrg# Define the identity of the package.
4613b83913fSmrgdnl Distinguish between old-style and new-style calls.
4623b83913fSmrgm4_ifval([$2],
4633b83913fSmrg[AC_DIAGNOSE([obsolete],
4643b83913fSmrg             [$0: two- and three-arguments forms are deprecated.])
4653b83913fSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4663b83913fSmrg AC_SUBST([PACKAGE], [$1])dnl
4673b83913fSmrg AC_SUBST([VERSION], [$2])],
4683b83913fSmrg[_AM_SET_OPTIONS([$1])dnl
4693b83913fSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4703b83913fSmrgm4_if(
4713b83913fSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4723b83913fSmrg  [ok:ok],,
4733b83913fSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4743b83913fSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4753b83913fSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476c19de146Smrg
4773b83913fSmrg_AM_IF_OPTION([no-define],,
4783b83913fSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4793b83913fSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480c19de146Smrg
4813b83913fSmrg# Some tools Automake needs.
4823b83913fSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4833b83913fSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4843b83913fSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4853b83913fSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4863b83913fSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4873b83913fSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4883b83913fSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4893b83913fSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4903b83913fSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4913b83913fSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4923b83913fSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
4933b83913fSmrg# dies out for good.  For more background, see:
4943b83913fSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4953b83913fSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4963b83913fSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4973b83913fSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
4983b83913fSmrg# system "awk" is bad on some platforms.
4993b83913fSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5003b83913fSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5013b83913fSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5023b83913fSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5033b83913fSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5043b83913fSmrg			     [_AM_PROG_TAR([v7])])])
5053b83913fSmrg_AM_IF_OPTION([no-dependencies],,
5063b83913fSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5073b83913fSmrg		  [_AM_DEPENDENCIES([CC])],
5083b83913fSmrg		  [m4_define([AC_PROG_CC],
5093b83913fSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5103b83913fSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5113b83913fSmrg		  [_AM_DEPENDENCIES([CXX])],
5123b83913fSmrg		  [m4_define([AC_PROG_CXX],
5133b83913fSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5143b83913fSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5153b83913fSmrg		  [_AM_DEPENDENCIES([OBJC])],
5163b83913fSmrg		  [m4_define([AC_PROG_OBJC],
5173b83913fSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5183b83913fSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5193b83913fSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
5203b83913fSmrg		  [m4_define([AC_PROG_OBJCXX],
5213b83913fSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5223b83913fSmrg])
5233b83913fSmrg# Variables for tags utilities; see am/tags.am
5243b83913fSmrgif test -z "$CTAGS"; then
5253b83913fSmrg  CTAGS=ctags
526a39bb051Smrgfi
5273b83913fSmrgAC_SUBST([CTAGS])
5283b83913fSmrgif test -z "$ETAGS"; then
5293b83913fSmrg  ETAGS=etags
530a39bb051Smrgfi
5313b83913fSmrgAC_SUBST([ETAGS])
5323b83913fSmrgif test -z "$CSCOPE"; then
5333b83913fSmrg  CSCOPE=cscope
534a39bb051Smrgfi
5353b83913fSmrgAC_SUBST([CSCOPE])
536c19de146Smrg
5373b83913fSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5383b83913fSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
5393b83913fSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5403b83913fSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5413b83913fSmrgAC_CONFIG_COMMANDS_PRE(dnl
5423b83913fSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5433b83913fSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5449ef7378bSmrg
5453b83913fSmrg# POSIX will say in a future version that running "rm -f" with no argument
5463b83913fSmrg# is OK; and we want to be able to make that assumption in our Makefile
5473b83913fSmrg# recipes.  So use an aggressive probe to check that the usage we want is
5483b83913fSmrg# actually supported "in the wild" to an acceptable degree.
5493b83913fSmrg# See automake bug#10828.
5503b83913fSmrg# To make any issue more visible, cause the running configure to be aborted
5513b83913fSmrg# by default if the 'rm' program in use doesn't match our expectations; the
5523b83913fSmrg# user can still override this though.
5533b83913fSmrgif rm -f && rm -fr && rm -rf; then : OK; else
5543b83913fSmrg  cat >&2 <<'END'
5553b83913fSmrgOops!
556c19de146Smrg
5573b83913fSmrgYour 'rm' program seems unable to run without file operands specified
5583b83913fSmrgon the command line, even when the '-f' option is present.  This is contrary
5593b83913fSmrgto the behaviour of most rm programs out there, and not conforming with
5603b83913fSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561c19de146Smrg
5623b83913fSmrgPlease tell bug-automake@gnu.org about your system, including the value
5633b83913fSmrgof your $PATH and any error possibly output before this message.  This
5643b83913fSmrgcan help us improve future automake versions.
565c19de146Smrg
5663b83913fSmrgEND
5673b83913fSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5683b83913fSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5693b83913fSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5703b83913fSmrg    echo >&2
5713b83913fSmrg  else
5723b83913fSmrg    cat >&2 <<'END'
5733b83913fSmrgAborting the configuration process, to ensure you take notice of the issue.
574c19de146Smrg
5753b83913fSmrgYou can download and install GNU coreutils to get an 'rm' implementation
5763b83913fSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577c19de146Smrg
5783b83913fSmrgIf you want to complete the configuration process using your problematic
5793b83913fSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5803b83913fSmrgto "yes", and re-run configure.
581c19de146Smrg
5823b83913fSmrgEND
5833b83913fSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5843b83913fSmrg  fi
585a39bb051Smrgfi
5863b83913fSmrgdnl The trailing newline in this macro's definition is deliberate, for
5873b83913fSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5883b83913fSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5893b83913fSmrg])
5909ef7378bSmrg
5913b83913fSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5923b83913fSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5933b83913fSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5943b83913fSmrgm4_define([_AC_COMPILER_EXEEXT],
5953b83913fSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596c19de146Smrg
5973b83913fSmrg# When config.status generates a header, we must update the stamp-h file.
5983b83913fSmrg# This file resides in the same directory as the config header
5993b83913fSmrg# that is generated.  The stamp files are numbered to have different names.
600c19de146Smrg
6013b83913fSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
6023b83913fSmrg# loop where config.status creates the headers, so we can generate
6033b83913fSmrg# our stamp files there.
6043b83913fSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
6053b83913fSmrg[# Compute $1's index in $config_headers.
6063b83913fSmrg_am_arg=$1
6073b83913fSmrg_am_stamp_count=1
6083b83913fSmrgfor _am_header in $config_headers :; do
6093b83913fSmrg  case $_am_header in
6103b83913fSmrg    $_am_arg | $_am_arg:* )
6113b83913fSmrg      break ;;
6123b83913fSmrg    * )
6133b83913fSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6143b83913fSmrg  esac
6153b83913fSmrgdone
6163b83913fSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617a39bb051Smrg
6183b83913fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6193b83913fSmrg#
6203b83913fSmrg# This file is free software; the Free Software Foundation
6213b83913fSmrg# gives unlimited permission to copy and/or distribute it,
6223b83913fSmrg# with or without modifications, as long as this notice is preserved.
623a39bb051Smrg
6243b83913fSmrg# AM_PROG_INSTALL_SH
6253b83913fSmrg# ------------------
6263b83913fSmrg# Define $install_sh.
6273b83913fSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6283b83913fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6293b83913fSmrgif test x"${install_sh+set}" != xset; then
6303b83913fSmrg  case $am_aux_dir in
6313b83913fSmrg  *\ * | *\	*)
6323b83913fSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6333b83913fSmrg  *)
6343b83913fSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6353b83913fSmrg  esac
636c19de146Smrgfi
6373b83913fSmrgAC_SUBST([install_sh])])
638c19de146Smrg
6393b83913fSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
6403b83913fSmrg#
6413b83913fSmrg# This file is free software; the Free Software Foundation
6423b83913fSmrg# gives unlimited permission to copy and/or distribute it,
6433b83913fSmrg# with or without modifications, as long as this notice is preserved.
644a39bb051Smrg
6453b83913fSmrg# Check whether the underlying file-system supports filenames
6463b83913fSmrg# with a leading dot.  For instance MS-DOS doesn't.
6473b83913fSmrgAC_DEFUN([AM_SET_LEADING_DOT],
6483b83913fSmrg[rm -rf .tst 2>/dev/null
6493b83913fSmrgmkdir .tst 2>/dev/null
6503b83913fSmrgif test -d .tst; then
6513b83913fSmrg  am__leading_dot=.
6529ef7378bSmrgelse
6533b83913fSmrg  am__leading_dot=_
6549ef7378bSmrgfi
6553b83913fSmrgrmdir .tst 2>/dev/null
6563b83913fSmrgAC_SUBST([am__leading_dot])])
657c19de146Smrg
6583b83913fSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659c19de146Smrg
6603b83913fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6613b83913fSmrg#
6623b83913fSmrg# This file is free software; the Free Software Foundation
6633b83913fSmrg# gives unlimited permission to copy and/or distribute it,
6643b83913fSmrg# with or without modifications, as long as this notice is preserved.
665c19de146Smrg
6663b83913fSmrg# AM_MAKE_INCLUDE()
6673b83913fSmrg# -----------------
6683b83913fSmrg# Check whether make has an 'include' directive that can support all
6693b83913fSmrg# the idioms we need for our automatic dependency tracking code.
6703b83913fSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6713b83913fSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6723b83913fSmrgcat > confinc.mk << 'END'
6733b83913fSmrgam__doit:
6743b83913fSmrg	@echo this is the am__doit target >confinc.out
6753b83913fSmrg.PHONY: am__doit
6763b83913fSmrgEND
6773b83913fSmrgam__include="#"
6783b83913fSmrgam__quote=
6793b83913fSmrg# BSD make does it like this.
6803b83913fSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6813b83913fSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6823b83913fSmrgecho 'include confinc.mk # ignored' > confmf.GNU
6833b83913fSmrg_am_result=no
6843b83913fSmrgfor s in GNU BSD; do
6853b83913fSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6863b83913fSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6873b83913fSmrg      ['0:this is the am__doit target'],
6883b83913fSmrg      [AS_CASE([$s],
6893b83913fSmrg          [BSD], [am__include='.include' am__quote='"'],
6903b83913fSmrg          [am__include='include' am__quote=''])])
6913b83913fSmrg  if test "$am__include" != "#"; then
6923b83913fSmrg    _am_result="yes ($s style)"
6933b83913fSmrg    break
6943b83913fSmrg  fi
6953b83913fSmrgdone
6963b83913fSmrgrm -f confinc.* confmf.*
6973b83913fSmrgAC_MSG_RESULT([${_am_result}])
6983b83913fSmrgAC_SUBST([am__include])])
6993b83913fSmrgAC_SUBST([am__quote])])
700c19de146Smrg
7013b83913fSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702c19de146Smrg
7033b83913fSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
7049ef7378bSmrg#
7053b83913fSmrg# This file is free software; the Free Software Foundation
7063b83913fSmrg# gives unlimited permission to copy and/or distribute it,
7073b83913fSmrg# with or without modifications, as long as this notice is preserved.
708c19de146Smrg
7093b83913fSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7103b83913fSmrg# ------------------------------
7113b83913fSmrgAC_DEFUN([AM_MISSING_PROG],
7123b83913fSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7133b83913fSmrg$1=${$1-"${am_missing_run}$2"}
7143b83913fSmrgAC_SUBST($1)])
715c19de146Smrg
7163b83913fSmrg# AM_MISSING_HAS_RUN
7173b83913fSmrg# ------------------
7183b83913fSmrg# Define MISSING if not defined so far and test if it is modern enough.
7193b83913fSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7203b83913fSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7213b83913fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7223b83913fSmrgAC_REQUIRE_AUX_FILE([missing])dnl
7233b83913fSmrgif test x"${MISSING+set}" != xset; then
7243b83913fSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725a39bb051Smrgfi
7263b83913fSmrg# Use eval to expand $SHELL
7273b83913fSmrgif eval "$MISSING --is-lightweight"; then
7283b83913fSmrg  am_missing_run="$MISSING "
7293b83913fSmrgelse
7303b83913fSmrg  am_missing_run=
7313b83913fSmrg  AC_MSG_WARN(['missing' script is too old or missing])
732a39bb051Smrgfi
7333b83913fSmrg])
734c19de146Smrg
7353b83913fSmrg# Helper functions for option handling.                     -*- Autoconf -*-
736c19de146Smrg
7373b83913fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
7383b83913fSmrg#
7393b83913fSmrg# This file is free software; the Free Software Foundation
7403b83913fSmrg# gives unlimited permission to copy and/or distribute it,
7413b83913fSmrg# with or without modifications, as long as this notice is preserved.
742c19de146Smrg
7433b83913fSmrg# _AM_MANGLE_OPTION(NAME)
7443b83913fSmrg# -----------------------
7453b83913fSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7463b83913fSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747c19de146Smrg
7483b83913fSmrg# _AM_SET_OPTION(NAME)
7493b83913fSmrg# --------------------
7503b83913fSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7513b83913fSmrgAC_DEFUN([_AM_SET_OPTION],
7523b83913fSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753c19de146Smrg
7543b83913fSmrg# _AM_SET_OPTIONS(OPTIONS)
7553b83913fSmrg# ------------------------
7563b83913fSmrg# OPTIONS is a space-separated list of Automake options.
7573b83913fSmrgAC_DEFUN([_AM_SET_OPTIONS],
7583b83913fSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7593b83913fSmrg
7603b83913fSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7613b83913fSmrg# -------------------------------------------
7623b83913fSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7633b83913fSmrgAC_DEFUN([_AM_IF_OPTION],
7643b83913fSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7653b83913fSmrg
7663b83913fSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767a39bb051Smrg#
7683b83913fSmrg# This file is free software; the Free Software Foundation
7693b83913fSmrg# gives unlimited permission to copy and/or distribute it,
7703b83913fSmrg# with or without modifications, as long as this notice is preserved.
771c19de146Smrg
7723b83913fSmrg# _AM_PROG_CC_C_O
7733b83913fSmrg# ---------------
7743b83913fSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7753b83913fSmrg# to automatically call this.
7763b83913fSmrgAC_DEFUN([_AM_PROG_CC_C_O],
7773b83913fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7783b83913fSmrgAC_REQUIRE_AUX_FILE([compile])dnl
7793b83913fSmrgAC_LANG_PUSH([C])dnl
7803b83913fSmrgAC_CACHE_CHECK(
7813b83913fSmrg  [whether $CC understands -c and -o together],
7823b83913fSmrg  [am_cv_prog_cc_c_o],
7833b83913fSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7843b83913fSmrg  # Make sure it works both with $CC and with simple cc.
7853b83913fSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7863b83913fSmrg  # compilers refuse to overwrite an existing .o file with -o,
7873b83913fSmrg  # though they will create one.
7883b83913fSmrg  am_cv_prog_cc_c_o=yes
7893b83913fSmrg  for am_i in 1 2; do
7903b83913fSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7913b83913fSmrg         && test -f conftest2.$ac_objext; then
7923b83913fSmrg      : OK
7933b83913fSmrg    else
7943b83913fSmrg      am_cv_prog_cc_c_o=no
7953b83913fSmrg      break
7963b83913fSmrg    fi
7973b83913fSmrg  done
7983b83913fSmrg  rm -f core conftest*
7993b83913fSmrg  unset am_i])
8003b83913fSmrgif test "$am_cv_prog_cc_c_o" != yes; then
8013b83913fSmrg   # Losing compiler, so override with the script.
8023b83913fSmrg   # FIXME: It is wrong to rewrite CC.
8033b83913fSmrg   # But if we don't then we get into trouble of one sort or another.
8043b83913fSmrg   # A longer-term fix would be to have automake use am__CC in this case,
8053b83913fSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8063b83913fSmrg   CC="$am_aux_dir/compile $CC"
807a39bb051Smrgfi
8083b83913fSmrgAC_LANG_POP([C])])
809c19de146Smrg
8103b83913fSmrg# For backward compatibility.
8113b83913fSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8129ef7378bSmrg
8133b83913fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814c19de146Smrg#
8153b83913fSmrg# This file is free software; the Free Software Foundation
8163b83913fSmrg# gives unlimited permission to copy and/or distribute it,
8173b83913fSmrg# with or without modifications, as long as this notice is preserved.
818c19de146Smrg
8193b83913fSmrg# AM_RUN_LOG(COMMAND)
8203b83913fSmrg# -------------------
8213b83913fSmrg# Run COMMAND, save the exit status in ac_status, and log it.
8223b83913fSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8233b83913fSmrgAC_DEFUN([AM_RUN_LOG],
8243b83913fSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8253b83913fSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8263b83913fSmrg   ac_status=$?
8273b83913fSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8283b83913fSmrg   (exit $ac_status); }])
8293b83913fSmrg
8303b83913fSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8313b83913fSmrg
8323b83913fSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833a39bb051Smrg#
8343b83913fSmrg# This file is free software; the Free Software Foundation
8353b83913fSmrg# gives unlimited permission to copy and/or distribute it,
8363b83913fSmrg# with or without modifications, as long as this notice is preserved.
8379ef7378bSmrg
8383b83913fSmrg# AM_SANITY_CHECK
8393b83913fSmrg# ---------------
8403b83913fSmrgAC_DEFUN([AM_SANITY_CHECK],
8413b83913fSmrg[AC_MSG_CHECKING([whether build environment is sane])
8423b83913fSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8433b83913fSmrg# name.  Accept space and tab only in the latter.
8443b83913fSmrgam_lf='
8453b83913fSmrg'
8463b83913fSmrgcase `pwd` in
8473b83913fSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8483b83913fSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8493b83913fSmrgesac
8503b83913fSmrgcase $srcdir in
8513b83913fSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8523b83913fSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8533b83913fSmrgesac
8543b83913fSmrg
8553b83913fSmrg# Do 'set' in a subshell so we don't clobber the current shell's
8563b83913fSmrg# arguments.  Must try -L first in case configure is actually a
8573b83913fSmrg# symlink; some systems play weird games with the mod time of symlinks
8583b83913fSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8593b83913fSmrg# directory).
8603b83913fSmrgif (
8613b83913fSmrg   am_has_slept=no
8623b83913fSmrg   for am_try in 1 2; do
8633b83913fSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8643b83913fSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8653b83913fSmrg     if test "$[*]" = "X"; then
8663b83913fSmrg	# -L didn't work.
8673b83913fSmrg	set X `ls -t "$srcdir/configure" conftest.file`
8683b83913fSmrg     fi
8693b83913fSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8703b83913fSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8713b83913fSmrg
8723b83913fSmrg	# If neither matched, then we have a broken ls.  This can happen
8733b83913fSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8743b83913fSmrg	# broken ls alias from the environment.  This has actually
8753b83913fSmrg	# happened.  Such a system could not be considered "sane".
8763b83913fSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8773b83913fSmrg  alias in your environment])
8783b83913fSmrg     fi
8793b83913fSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8803b83913fSmrg       break
8813b83913fSmrg     fi
8823b83913fSmrg     # Just in case.
8833b83913fSmrg     sleep 1
8843b83913fSmrg     am_has_slept=yes
8853b83913fSmrg   done
8863b83913fSmrg   test "$[2]" = conftest.file
8873b83913fSmrg   )
8883b83913fSmrgthen
8893b83913fSmrg   # Ok.
8903b83913fSmrg   :
8913b83913fSmrgelse
8923b83913fSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
8933b83913fSmrgCheck your system clock])
8943b83913fSmrgfi
8953b83913fSmrgAC_MSG_RESULT([yes])
8963b83913fSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8973b83913fSmrg# generated files are strictly newer.
8983b83913fSmrgam_sleep_pid=
8993b83913fSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9003b83913fSmrg  ( sleep 1 ) &
9013b83913fSmrg  am_sleep_pid=$!
9023b83913fSmrgfi
9033b83913fSmrgAC_CONFIG_COMMANDS_PRE(
9043b83913fSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9053b83913fSmrg   if test -n "$am_sleep_pid"; then
9063b83913fSmrg     # Hide warnings about reused PIDs.
9073b83913fSmrg     wait $am_sleep_pid 2>/dev/null
908a39bb051Smrg   fi
9093b83913fSmrg   AC_MSG_RESULT([done])])
9103b83913fSmrgrm -f conftest.file
9113b83913fSmrg])
9123b83913fSmrg
9133b83913fSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9143b83913fSmrg#
9153b83913fSmrg# This file is free software; the Free Software Foundation
9163b83913fSmrg# gives unlimited permission to copy and/or distribute it,
9173b83913fSmrg# with or without modifications, as long as this notice is preserved.
9183b83913fSmrg
9193b83913fSmrg# AM_SILENT_RULES([DEFAULT])
9203b83913fSmrg# --------------------------
9213b83913fSmrg# Enable less verbose build rules; with the default set to DEFAULT
9223b83913fSmrg# ("yes" being less verbose, "no" or empty being verbose).
9233b83913fSmrgAC_DEFUN([AM_SILENT_RULES],
9243b83913fSmrg[AC_ARG_ENABLE([silent-rules], [dnl
9253b83913fSmrgAS_HELP_STRING(
9263b83913fSmrg  [--enable-silent-rules],
9273b83913fSmrg  [less verbose build output (undo: "make V=1")])
9283b83913fSmrgAS_HELP_STRING(
9293b83913fSmrg  [--disable-silent-rules],
9303b83913fSmrg  [verbose build output (undo: "make V=0")])dnl
9313b83913fSmrg])
9323b83913fSmrgcase $enable_silent_rules in @%:@ (((
9333b83913fSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
9343b83913fSmrg   no) AM_DEFAULT_VERBOSITY=1;;
9353b83913fSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9363b83913fSmrgesac
9373b83913fSmrgdnl
9383b83913fSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9393b83913fSmrgdnl do not support nested variable expansions.
9403b83913fSmrgdnl See automake bug#9928 and bug#10237.
9413b83913fSmrgam_make=${MAKE-make}
9423b83913fSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9433b83913fSmrg   [am_cv_make_support_nested_variables],
9443b83913fSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9453b83913fSmrgBAR0=false
9463b83913fSmrgBAR1=true
9473b83913fSmrgV=1
9483b83913fSmrgam__doit:
9493b83913fSmrg	@$(TRUE)
9503b83913fSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9513b83913fSmrg  am_cv_make_support_nested_variables=yes
952a39bb051Smrgelse
9533b83913fSmrg  am_cv_make_support_nested_variables=no
9543b83913fSmrgfi])
9553b83913fSmrgif test $am_cv_make_support_nested_variables = yes; then
9563b83913fSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9573b83913fSmrg  AM_V='$(V)'
9583b83913fSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9593b83913fSmrgelse
9603b83913fSmrg  AM_V=$AM_DEFAULT_VERBOSITY
9613b83913fSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962a39bb051Smrgfi
9633b83913fSmrgAC_SUBST([AM_V])dnl
9643b83913fSmrgAM_SUBST_NOTMAKE([AM_V])dnl
9653b83913fSmrgAC_SUBST([AM_DEFAULT_V])dnl
9663b83913fSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9673b83913fSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9683b83913fSmrgAM_BACKSLASH='\'
9693b83913fSmrgAC_SUBST([AM_BACKSLASH])dnl
9703b83913fSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9713b83913fSmrg])
9729ef7378bSmrg
9733b83913fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
9743b83913fSmrg#
9753b83913fSmrg# This file is free software; the Free Software Foundation
9763b83913fSmrg# gives unlimited permission to copy and/or distribute it,
9773b83913fSmrg# with or without modifications, as long as this notice is preserved.
9789ef7378bSmrg
9793b83913fSmrg# AM_PROG_INSTALL_STRIP
9803b83913fSmrg# ---------------------
9813b83913fSmrg# One issue with vendor 'install' (even GNU) is that you can't
9823b83913fSmrg# specify the program used to strip binaries.  This is especially
9833b83913fSmrg# annoying in cross-compiling environments, where the build's strip
9843b83913fSmrg# is unlikely to handle the host's binaries.
9853b83913fSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9863b83913fSmrg# always use install-sh in "make install-strip", and initialize
9873b83913fSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
9883b83913fSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9893b83913fSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9903b83913fSmrg# Installed binaries are usually stripped using 'strip' when the user
9913b83913fSmrg# run "make install-strip".  However 'strip' might not be the right
9923b83913fSmrg# tool to use in cross-compilation environments, therefore Automake
9933b83913fSmrg# will honor the 'STRIP' environment variable to overrule this program.
9943b83913fSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9953b83913fSmrgif test "$cross_compiling" != no; then
9963b83913fSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
9973b83913fSmrgfi
9983b83913fSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9993b83913fSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10003b83913fSmrg
10013b83913fSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002a39bb051Smrg#
10033b83913fSmrg# This file is free software; the Free Software Foundation
10043b83913fSmrg# gives unlimited permission to copy and/or distribute it,
10053b83913fSmrg# with or without modifications, as long as this notice is preserved.
10063b83913fSmrg
10073b83913fSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10083b83913fSmrg# ---------------------------
10093b83913fSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10103b83913fSmrg# This macro is traced by Automake.
10113b83913fSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10123b83913fSmrg
10133b83913fSmrg# AM_SUBST_NOTMAKE(VARIABLE)
10143b83913fSmrg# --------------------------
10153b83913fSmrg# Public sister of _AM_SUBST_NOTMAKE.
10163b83913fSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10173b83913fSmrg
10183b83913fSmrg# Check how to create a tarball.                            -*- Autoconf -*-
10193b83913fSmrg
10203b83913fSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021a39bb051Smrg#
10223b83913fSmrg# This file is free software; the Free Software Foundation
10233b83913fSmrg# gives unlimited permission to copy and/or distribute it,
10243b83913fSmrg# with or without modifications, as long as this notice is preserved.
10253b83913fSmrg
10263b83913fSmrg# _AM_PROG_TAR(FORMAT)
10273b83913fSmrg# --------------------
10283b83913fSmrg# Check how to create a tarball in format FORMAT.
10293b83913fSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030a39bb051Smrg#
10313b83913fSmrg# Substitute a variable $(am__tar) that is a command
10323b83913fSmrg# writing to stdout a FORMAT-tarball containing the directory
10333b83913fSmrg# $tardir.
10343b83913fSmrg#     tardir=directory && $(am__tar) > result.tar
1035a39bb051Smrg#
10363b83913fSmrg# Substitute a variable $(am__untar) that extract such
10373b83913fSmrg# a tarball read from stdin.
10383b83913fSmrg#     $(am__untar) < result.tar
1039a39bb051Smrg#
10403b83913fSmrgAC_DEFUN([_AM_PROG_TAR],
10413b83913fSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10423b83913fSmrg# in the wild :-(  We should find a proper way to deprecate it ...
10433b83913fSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044c19de146Smrg
10453b83913fSmrg# We'll loop over all known methods to create a tar archive until one works.
10463b83913fSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10479ef7378bSmrg
10483b83913fSmrgm4_if([$1], [v7],
10493b83913fSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10509ef7378bSmrg
10513b83913fSmrg  [m4_case([$1],
10523b83913fSmrg    [ustar],
10533b83913fSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10543b83913fSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10553b83913fSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10563b83913fSmrg      # and bug#13588).
10573b83913fSmrg      am_max_uid=2097151 # 2^21 - 1
10583b83913fSmrg      am_max_gid=$am_max_uid
10593b83913fSmrg      # The $UID and $GID variables are not portable, so we need to resort
10603b83913fSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10613b83913fSmrg      # below are definitely unexpected, so allow the users to see them
10623b83913fSmrg      # (that is, avoid stderr redirection).
10633b83913fSmrg      am_uid=`id -u || echo unknown`
10643b83913fSmrg      am_gid=`id -g || echo unknown`
10653b83913fSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10663b83913fSmrg      if test $am_uid -le $am_max_uid; then
10673b83913fSmrg         AC_MSG_RESULT([yes])
10683b83913fSmrg      else
10693b83913fSmrg         AC_MSG_RESULT([no])
10703b83913fSmrg         _am_tools=none
10713b83913fSmrg      fi
10723b83913fSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10733b83913fSmrg      if test $am_gid -le $am_max_gid; then
10743b83913fSmrg         AC_MSG_RESULT([yes])
10753b83913fSmrg      else
10763b83913fSmrg        AC_MSG_RESULT([no])
10773b83913fSmrg        _am_tools=none
10783b83913fSmrg      fi],
1079c19de146Smrg
10803b83913fSmrg  [pax],
10813b83913fSmrg    [],
1082c19de146Smrg
10833b83913fSmrg  [m4_fatal([Unknown tar format])])
1084c19de146Smrg
10853b83913fSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086c19de146Smrg
10873b83913fSmrg  # Go ahead even if we have the value already cached.  We do so because we
10883b83913fSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10893b83913fSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10903b83913fSmrg
10913b83913fSmrg  for _am_tool in $_am_tools; do
10923b83913fSmrg    case $_am_tool in
10933b83913fSmrg    gnutar)
10943b83913fSmrg      for _am_tar in tar gnutar gtar; do
10953b83913fSmrg        AM_RUN_LOG([$_am_tar --version]) && break
10963b83913fSmrg      done
10973b83913fSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10983b83913fSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10993b83913fSmrg      am__untar="$_am_tar -xf -"
11003b83913fSmrg      ;;
11013b83913fSmrg    plaintar)
11023b83913fSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11033b83913fSmrg      # ustar tarball either.
11043b83913fSmrg      (tar --version) >/dev/null 2>&1 && continue
11053b83913fSmrg      am__tar='tar chf - "$$tardir"'
11063b83913fSmrg      am__tar_='tar chf - "$tardir"'
11073b83913fSmrg      am__untar='tar xf -'
11083b83913fSmrg      ;;
11093b83913fSmrg    pax)
11103b83913fSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
11113b83913fSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
11123b83913fSmrg      am__untar='pax -r'
11133b83913fSmrg      ;;
11143b83913fSmrg    cpio)
11153b83913fSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11163b83913fSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11173b83913fSmrg      am__untar='cpio -i -H $1 -d'
11183b83913fSmrg      ;;
11193b83913fSmrg    none)
11203b83913fSmrg      am__tar=false
11213b83913fSmrg      am__tar_=false
11223b83913fSmrg      am__untar=false
11233b83913fSmrg      ;;
11243b83913fSmrg    esac
11253b83913fSmrg
11263b83913fSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
11273b83913fSmrg    # and am__untar set.
11283b83913fSmrg    test -n "${am_cv_prog_tar_$1}" && break
11293b83913fSmrg
11303b83913fSmrg    # tar/untar a dummy directory, and stop if the command works.
11313b83913fSmrg    rm -rf conftest.dir
11323b83913fSmrg    mkdir conftest.dir
11333b83913fSmrg    echo GrepMe > conftest.dir/file
11343b83913fSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11353b83913fSmrg    rm -rf conftest.dir
11363b83913fSmrg    if test -s conftest.tar; then
11373b83913fSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
11383b83913fSmrg      AM_RUN_LOG([cat conftest.dir/file])
11393b83913fSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1140a39bb051Smrg    fi
11413b83913fSmrg  done
11423b83913fSmrg  rm -rf conftest.dir
1143c19de146Smrg
11443b83913fSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11453b83913fSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146c19de146Smrg
11473b83913fSmrgAC_SUBST([am__tar])
11483b83913fSmrgAC_SUBST([am__untar])
11493b83913fSmrg]) # _AM_PROG_TAR
1150a39bb051Smrg
11513b83913fSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
11523b83913fSmrgdnl serial 11 (pkg-config-0.29)
11533b83913fSmrgdnl
11543b83913fSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11553b83913fSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
11563b83913fSmrgdnl
11573b83913fSmrgdnl This program is free software; you can redistribute it and/or modify
11583b83913fSmrgdnl it under the terms of the GNU General Public License as published by
11593b83913fSmrgdnl the Free Software Foundation; either version 2 of the License, or
11603b83913fSmrgdnl (at your option) any later version.
11613b83913fSmrgdnl
11623b83913fSmrgdnl This program is distributed in the hope that it will be useful, but
11633b83913fSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
11643b83913fSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11653b83913fSmrgdnl General Public License for more details.
11663b83913fSmrgdnl
11673b83913fSmrgdnl You should have received a copy of the GNU General Public License
11683b83913fSmrgdnl along with this program; if not, write to the Free Software
11693b83913fSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
11703b83913fSmrgdnl 02111-1307, USA.
11713b83913fSmrgdnl
11723b83913fSmrgdnl As a special exception to the GNU General Public License, if you
11733b83913fSmrgdnl distribute this file as part of a program that contains a
11743b83913fSmrgdnl configuration script generated by Autoconf, you may include it under
11753b83913fSmrgdnl the same distribution terms that you use for the rest of that
11763b83913fSmrgdnl program.
1177a39bb051Smrg
11783b83913fSmrgdnl PKG_PREREQ(MIN-VERSION)
11793b83913fSmrgdnl -----------------------
11803b83913fSmrgdnl Since: 0.29
11813b83913fSmrgdnl
11823b83913fSmrgdnl Verify that the version of the pkg-config macros are at least
11833b83913fSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
11843b83913fSmrgdnl installed version of pkg-config, this checks the developer's version
11853b83913fSmrgdnl of pkg.m4 when generating configure.
11863b83913fSmrgdnl
11873b83913fSmrgdnl To ensure that this macro is defined, also add:
11883b83913fSmrgdnl m4_ifndef([PKG_PREREQ],
11893b83913fSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
11903b83913fSmrgdnl
11913b83913fSmrgdnl See the "Since" comment for each macro you use to see what version
11923b83913fSmrgdnl of the macros you require.
11933b83913fSmrgm4_defun([PKG_PREREQ],
11943b83913fSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
11953b83913fSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
11963b83913fSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
11973b83913fSmrg])dnl PKG_PREREQ
1198a39bb051Smrg
11993b83913fSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
12003b83913fSmrgdnl ----------------------------------
12013b83913fSmrgdnl Since: 0.16
12023b83913fSmrgdnl
12033b83913fSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
12043b83913fSmrgdnl first found in the path. Checks that the version of pkg-config found
12053b83913fSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
12063b83913fSmrgdnl used since that's the first version where most current features of
12073b83913fSmrgdnl pkg-config existed.
12083b83913fSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12093b83913fSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12103b83913fSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
12113b83913fSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
12123b83913fSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
12133b83913fSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
12143b83913fSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215a39bb051Smrg
12163b83913fSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12173b83913fSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218a39bb051Smrgfi
12193b83913fSmrgif test -n "$PKG_CONFIG"; then
12203b83913fSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
12213b83913fSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12223b83913fSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12233b83913fSmrg		AC_MSG_RESULT([yes])
12243b83913fSmrg	else
12253b83913fSmrg		AC_MSG_RESULT([no])
12263b83913fSmrg		PKG_CONFIG=""
12273b83913fSmrg	fi
12283b83913fSmrgfi[]dnl
12293b83913fSmrg])dnl PKG_PROG_PKG_CONFIG
12303b83913fSmrg
12313b83913fSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12323b83913fSmrgdnl -------------------------------------------------------------------
12333b83913fSmrgdnl Since: 0.18
12343b83913fSmrgdnl
12353b83913fSmrgdnl Check to see whether a particular set of modules exists. Similar to
12363b83913fSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
12373b83913fSmrgdnl
12383b83913fSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12393b83913fSmrgdnl only at the first occurence in configure.ac, so if the first place
12403b83913fSmrgdnl it's called might be skipped (such as if it is within an "if", you
12413b83913fSmrgdnl have to call PKG_CHECK_EXISTS manually
12423b83913fSmrgAC_DEFUN([PKG_CHECK_EXISTS],
12433b83913fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12443b83913fSmrgif test -n "$PKG_CONFIG" && \
12453b83913fSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12463b83913fSmrg  m4_default([$2], [:])
12473b83913fSmrgm4_ifvaln([$3], [else
12483b83913fSmrg  $3])dnl
12493b83913fSmrgfi])
12503b83913fSmrg
12513b83913fSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12523b83913fSmrgdnl ---------------------------------------------
12533b83913fSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12543b83913fSmrgdnl pkg_failed based on the result.
12553b83913fSmrgm4_define([_PKG_CONFIG],
12563b83913fSmrg[if test -n "$$1"; then
12573b83913fSmrg    pkg_cv_[]$1="$$1"
12583b83913fSmrg elif test -n "$PKG_CONFIG"; then
12593b83913fSmrg    PKG_CHECK_EXISTS([$3],
12603b83913fSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
12613b83913fSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
12623b83913fSmrg		     [pkg_failed=yes])
12633b83913fSmrg else
12643b83913fSmrg    pkg_failed=untried
12653b83913fSmrgfi[]dnl
12663b83913fSmrg])dnl _PKG_CONFIG
12673b83913fSmrg
12683b83913fSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
12693b83913fSmrgdnl ---------------------------
12703b83913fSmrgdnl Internal check to see if pkg-config supports short errors.
12713b83913fSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12723b83913fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12733b83913fSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12743b83913fSmrg        _pkg_short_errors_supported=yes
1275c918a7e2Smrgelse
12763b83913fSmrg        _pkg_short_errors_supported=no
12773b83913fSmrgfi[]dnl
12783b83913fSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279c918a7e2Smrg
1280c918a7e2Smrg
12813b83913fSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12823b83913fSmrgdnl   [ACTION-IF-NOT-FOUND])
12833b83913fSmrgdnl --------------------------------------------------------------
12843b83913fSmrgdnl Since: 0.4.0
12853b83913fSmrgdnl
12863b83913fSmrgdnl Note that if there is a possibility the first call to
12873b83913fSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
12883b83913fSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12893b83913fSmrgAC_DEFUN([PKG_CHECK_MODULES],
12903b83913fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12913b83913fSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12923b83913fSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293a39bb051Smrg
12943b83913fSmrgpkg_failed=no
12953b83913fSmrgAC_MSG_CHECKING([for $1])
1296a39bb051Smrg
12973b83913fSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12983b83913fSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299a39bb051Smrg
13003b83913fSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
13013b83913fSmrgand $1[]_LIBS to avoid the need to call pkg-config.
13023b83913fSmrgSee the pkg-config man page for more details.])
1303a39bb051Smrg
13043b83913fSmrgif test $pkg_failed = yes; then
13053b83913fSmrg   	AC_MSG_RESULT([no])
13063b83913fSmrg        _PKG_SHORT_ERRORS_SUPPORTED
13073b83913fSmrg        if test $_pkg_short_errors_supported = yes; then
13083b83913fSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
13093b83913fSmrg        else 
13103b83913fSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
13113b83913fSmrg        fi
13123b83913fSmrg	# Put the nasty error message in config.log where it belongs
13133b83913fSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314a39bb051Smrg
13153b83913fSmrg	m4_default([$4], [AC_MSG_ERROR(
13163b83913fSmrg[Package requirements ($2) were not met:
1317a39bb051Smrg
13183b83913fSmrg$$1_PKG_ERRORS
13193b83913fSmrg
13203b83913fSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13213b83913fSmrginstalled software in a non-standard prefix.
13223b83913fSmrg
13233b83913fSmrg_PKG_TEXT])[]dnl
13243b83913fSmrg        ])
13253b83913fSmrgelif test $pkg_failed = untried; then
13263b83913fSmrg     	AC_MSG_RESULT([no])
13273b83913fSmrg	m4_default([$4], [AC_MSG_FAILURE(
13283b83913fSmrg[The pkg-config script could not be found or is too old.  Make sure it
13293b83913fSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
13303b83913fSmrgpath to pkg-config.
13313b83913fSmrg
13323b83913fSmrg_PKG_TEXT
13333b83913fSmrg
13343b83913fSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
13353b83913fSmrg        ])
1336c918a7e2Smrgelse
13373b83913fSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13383b83913fSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13393b83913fSmrg        AC_MSG_RESULT([yes])
13403b83913fSmrg	$3
13413b83913fSmrgfi[]dnl
13423b83913fSmrg])dnl PKG_CHECK_MODULES
1343c918a7e2Smrg
1344a39bb051Smrg
13453b83913fSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
13463b83913fSmrgdnl   [ACTION-IF-NOT-FOUND])
13473b83913fSmrgdnl ---------------------------------------------------------------------
13483b83913fSmrgdnl Since: 0.29
13493b83913fSmrgdnl
13503b83913fSmrgdnl Checks for existence of MODULES and gathers its build flags with
13513b83913fSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
13523b83913fSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
13533b83913fSmrgdnl
13543b83913fSmrgdnl Note that if there is a possibility the first call to
13553b83913fSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
13563b83913fSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
13573b83913fSmrgdnl configure.ac.
13583b83913fSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
13593b83913fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
13603b83913fSmrg_save_PKG_CONFIG=$PKG_CONFIG
13613b83913fSmrgPKG_CONFIG="$PKG_CONFIG --static"
13623b83913fSmrgPKG_CHECK_MODULES($@)
13633b83913fSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
13643b83913fSmrg])dnl PKG_CHECK_MODULES_STATIC
13653b83913fSmrg
13663b83913fSmrg
13673b83913fSmrgdnl PKG_INSTALLDIR([DIRECTORY])
13683b83913fSmrgdnl -------------------------
13693b83913fSmrgdnl Since: 0.27
13703b83913fSmrgdnl
13713b83913fSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
13723b83913fSmrgdnl should install pkg-config .pc files. By default the directory is
13733b83913fSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
13743b83913fSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
13753b83913fSmrgdnl parameter.
13763b83913fSmrgAC_DEFUN([PKG_INSTALLDIR],
13773b83913fSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
13783b83913fSmrgm4_pushdef([pkg_description],
13793b83913fSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
13803b83913fSmrgAC_ARG_WITH([pkgconfigdir],
13813b83913fSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
13823b83913fSmrg    [with_pkgconfigdir=]pkg_default)
13833b83913fSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
13843b83913fSmrgm4_popdef([pkg_default])
13853b83913fSmrgm4_popdef([pkg_description])
13863b83913fSmrg])dnl PKG_INSTALLDIR
1387c918a7e2Smrg
1388a39bb051Smrg
13893b83913fSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
13903b83913fSmrgdnl --------------------------------
13913b83913fSmrgdnl Since: 0.27
13923b83913fSmrgdnl
13933b83913fSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
13943b83913fSmrgdnl module should install arch-independent pkg-config .pc files. By
13953b83913fSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
13963b83913fSmrgdnl changed by passing DIRECTORY. The user can override through the
13973b83913fSmrgdnl --with-noarch-pkgconfigdir parameter.
13983b83913fSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
13993b83913fSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
14003b83913fSmrgm4_pushdef([pkg_description],
14013b83913fSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
14023b83913fSmrgAC_ARG_WITH([noarch-pkgconfigdir],
14033b83913fSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
14043b83913fSmrg    [with_noarch_pkgconfigdir=]pkg_default)
14053b83913fSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
14063b83913fSmrgm4_popdef([pkg_default])
14073b83913fSmrgm4_popdef([pkg_description])
14083b83913fSmrg])dnl PKG_NOARCH_INSTALLDIR
1409a39bb051Smrg
1410c918a7e2Smrg
14113b83913fSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
14123b83913fSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
14133b83913fSmrgdnl -------------------------------------------
14143b83913fSmrgdnl Since: 0.28
14153b83913fSmrgdnl
14163b83913fSmrgdnl Retrieves the value of the pkg-config variable for the given module.
14173b83913fSmrgAC_DEFUN([PKG_CHECK_VAR],
14183b83913fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14193b83913fSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420c918a7e2Smrg
14213b83913fSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
14223b83913fSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423c918a7e2Smrg
14243b83913fSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
14253b83913fSmrg])dnl PKG_CHECK_VAR
1426c918a7e2Smrg
14273b83913fSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14283b83913fSmrgdnl
14293b83913fSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
14303b83913fSmrgdnl
14313b83913fSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14323b83913fSmrgdnl copy of this software and associated documentation files (the "Software"),
14333b83913fSmrgdnl to deal in the Software without restriction, including without limitation
14343b83913fSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14353b83913fSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
14363b83913fSmrgdnl Software is furnished to do so, subject to the following conditions:
14373b83913fSmrgdnl
14383b83913fSmrgdnl The above copyright notice and this permission notice (including the next
14393b83913fSmrgdnl paragraph) shall be included in all copies or substantial portions of the
14403b83913fSmrgdnl Software.
14413b83913fSmrgdnl
14423b83913fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14433b83913fSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14443b83913fSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14453b83913fSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14463b83913fSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14473b83913fSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14483b83913fSmrgdnl DEALINGS IN THE SOFTWARE.
14493b83913fSmrg
14503b83913fSmrg# XORG_MACROS_VERSION(required-version)
14513b83913fSmrg# -------------------------------------
1452a39bb051Smrg# Minimum version: 1.1.0
1453c918a7e2Smrg#
14543b83913fSmrg# If you're using a macro added in Version 1.1 or newer, include this in
14553b83913fSmrg# your configure.ac with the minimum required version, such as:
14563b83913fSmrg# XORG_MACROS_VERSION(1.1)
1457c918a7e2Smrg#
14583b83913fSmrg# To ensure that this macro is defined, also add:
14593b83913fSmrg# m4_ifndef([XORG_MACROS_VERSION],
14603b83913fSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461c918a7e2Smrg#
14623b83913fSmrg#
14633b83913fSmrg# See the "minimum version" comment for each macro you use to see what
14643b83913fSmrg# version you require.
14653b83913fSmrgm4_defun([XORG_MACROS_VERSION],[
14663b83913fSmrgm4_define([vers_have], [1.20.0])
14673b83913fSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14683b83913fSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14693b83913fSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14703b83913fSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14713b83913fSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14723b83913fSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14733b83913fSmrgm4_undefine([vers_have])
14743b83913fSmrgm4_undefine([maj_have])
14753b83913fSmrgm4_undefine([maj_needed])
14763b83913fSmrg]) # XORG_MACROS_VERSION
1477c918a7e2Smrg
14783b83913fSmrg# XORG_PROG_RAWCPP()
14793b83913fSmrg# ------------------
14803b83913fSmrg# Minimum version: 1.0.0
14813b83913fSmrg#
14823b83913fSmrg# Find cpp program and necessary flags for use in pre-processing text files
14833b83913fSmrg# such as man pages and config files
14843b83913fSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14853b83913fSmrgAC_REQUIRE([AC_PROG_CPP])
14863b83913fSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14873b83913fSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1488a39bb051Smrg
14893b83913fSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14903b83913fSmrg# which is not the best choice for supporting other OS'es, but covers most
14913b83913fSmrg# of the ones we need for now.
14923b83913fSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14933b83913fSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14943b83913fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14953b83913fSmrg	AC_MSG_RESULT([no])
14963b83913fSmrgelse
14973b83913fSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14983b83913fSmrg		RAWCPPFLAGS=-undef
14993b83913fSmrg		AC_MSG_RESULT([yes])
15003b83913fSmrg	# under Cygwin unix is still defined even with -undef
15013b83913fSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15023b83913fSmrg		RAWCPPFLAGS="-undef -ansi"
15033b83913fSmrg		AC_MSG_RESULT([yes, with -ansi])
15043b83913fSmrg	else
15053b83913fSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15063b83913fSmrg	fi
1507a39bb051Smrgfi
15083b83913fSmrgrm -f conftest.$ac_ext
1509a39bb051Smrg
15103b83913fSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15113b83913fSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15123b83913fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
15133b83913fSmrg	AC_MSG_RESULT([no])
15143b83913fSmrgelse
15153b83913fSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
15163b83913fSmrg		TRADITIONALCPPFLAGS="-traditional"
15173b83913fSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15183b83913fSmrg		AC_MSG_RESULT([yes])
15193b83913fSmrg	else
15203b83913fSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15213b83913fSmrg	fi
15223b83913fSmrgfi
15233b83913fSmrgrm -f conftest.$ac_ext
15243b83913fSmrgAC_SUBST(RAWCPPFLAGS)
15253b83913fSmrgAC_SUBST(TRADITIONALCPPFLAGS)
15263b83913fSmrg]) # XORG_PROG_RAWCPP
1527a39bb051Smrg
15283b83913fSmrg# XORG_MANPAGE_SECTIONS()
15293b83913fSmrg# -----------------------
15303b83913fSmrg# Minimum version: 1.0.0
1531a39bb051Smrg#
15323b83913fSmrg# Determine which sections man pages go in for the different man page types
15333b83913fSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15343b83913fSmrg# Not sure if there's any better way than just hardcoding by OS name.
15353b83913fSmrg# Override default settings by setting environment variables
15363b83913fSmrg# Added MAN_SUBSTS in version 1.8
15373b83913fSmrg# Added AC_PROG_SED in version 1.8
1538a39bb051Smrg
15393b83913fSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15403b83913fSmrgAC_REQUIRE([AC_CANONICAL_HOST])
15413b83913fSmrgAC_REQUIRE([AC_PROG_SED])
1542a39bb051Smrg
15433b83913fSmrgcase $host_os in
15443b83913fSmrg    solaris*)
15453b83913fSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15463b83913fSmrg        # check for a man page file found in later versions that use
15473b83913fSmrg        # traditional section numbers instead
15483b83913fSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15493b83913fSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15503b83913fSmrg        ;;
15513b83913fSmrg    *) SYSV_MAN_SECTIONS=false ;;
15523b83913fSmrgesac
1553a39bb051Smrg
15543b83913fSmrgif test x$APP_MAN_SUFFIX = x    ; then
15553b83913fSmrg    APP_MAN_SUFFIX=1
15563b83913fSmrgfi
15573b83913fSmrgif test x$APP_MAN_DIR = x    ; then
15583b83913fSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1559a39bb051Smrgfi
1560a39bb051Smrg
15613b83913fSmrgif test x$LIB_MAN_SUFFIX = x    ; then
15623b83913fSmrg    LIB_MAN_SUFFIX=3
15633b83913fSmrgfi
15643b83913fSmrgif test x$LIB_MAN_DIR = x    ; then
15653b83913fSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1566a39bb051Smrgfi
1567a39bb051Smrg
15683b83913fSmrgif test x$FILE_MAN_SUFFIX = x    ; then
15693b83913fSmrg    case $SYSV_MAN_SECTIONS in
15703b83913fSmrg	true)				FILE_MAN_SUFFIX=4  ;;
15713b83913fSmrg	*)				FILE_MAN_SUFFIX=5  ;;
15723b83913fSmrg    esac
15733b83913fSmrgfi
15743b83913fSmrgif test x$FILE_MAN_DIR = x    ; then
15753b83913fSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15763b83913fSmrgfi
1577a39bb051Smrg
15783b83913fSmrgif test x$MISC_MAN_SUFFIX = x    ; then
15793b83913fSmrg    case $SYSV_MAN_SECTIONS in
15803b83913fSmrg	true)				MISC_MAN_SUFFIX=5  ;;
15813b83913fSmrg	*)				MISC_MAN_SUFFIX=7  ;;
15823b83913fSmrg    esac
15833b83913fSmrgfi
15843b83913fSmrgif test x$MISC_MAN_DIR = x    ; then
15853b83913fSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15863b83913fSmrgfi
1587a39bb051Smrg
15883b83913fSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15893b83913fSmrg    case $SYSV_MAN_SECTIONS in
15903b83913fSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
15913b83913fSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
15923b83913fSmrg    esac
15933b83913fSmrgfi
15943b83913fSmrgif test x$DRIVER_MAN_DIR = x    ; then
15953b83913fSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15963b83913fSmrgfi
1597a39bb051Smrg
15983b83913fSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15993b83913fSmrg    case $SYSV_MAN_SECTIONS in
16003b83913fSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16013b83913fSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16023b83913fSmrg    esac
16033b83913fSmrgfi
16043b83913fSmrgif test x$ADMIN_MAN_DIR = x    ; then
16053b83913fSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16063b83913fSmrgfi
1607a39bb051Smrg
1608a39bb051Smrg
16093b83913fSmrgAC_SUBST([APP_MAN_SUFFIX])
16103b83913fSmrgAC_SUBST([LIB_MAN_SUFFIX])
16113b83913fSmrgAC_SUBST([FILE_MAN_SUFFIX])
16123b83913fSmrgAC_SUBST([MISC_MAN_SUFFIX])
16133b83913fSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16143b83913fSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16153b83913fSmrgAC_SUBST([APP_MAN_DIR])
16163b83913fSmrgAC_SUBST([LIB_MAN_DIR])
16173b83913fSmrgAC_SUBST([FILE_MAN_DIR])
16183b83913fSmrgAC_SUBST([MISC_MAN_DIR])
16193b83913fSmrgAC_SUBST([DRIVER_MAN_DIR])
16203b83913fSmrgAC_SUBST([ADMIN_MAN_DIR])
1621a39bb051Smrg
16223b83913fSmrgXORG_MAN_PAGE="X Version 11"
16233b83913fSmrgAC_SUBST([XORG_MAN_PAGE])
16243b83913fSmrgMAN_SUBSTS="\
16253b83913fSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16263b83913fSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16273b83913fSmrg	-e 's|__xservername__|Xorg|g' \
16283b83913fSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
16293b83913fSmrg	-e 's|__projectroot__|\$(prefix)|g' \
16303b83913fSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16313b83913fSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16323b83913fSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16333b83913fSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16343b83913fSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16353b83913fSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16363b83913fSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16373b83913fSmrgAC_SUBST([MAN_SUBSTS])
1638a39bb051Smrg
16393b83913fSmrg]) # XORG_MANPAGE_SECTIONS
1640a39bb051Smrg
16413b83913fSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16423b83913fSmrg# ------------------------
16433b83913fSmrg# Minimum version: 1.7.0
16443b83913fSmrg#
16453b83913fSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16463b83913fSmrg# provided by xorg-sgml-doctools, if installed.
16473b83913fSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16483b83913fSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16493b83913fSmrgXORG_SGML_PATH=
16503b83913fSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16513b83913fSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16523b83913fSmrg    [m4_ifval([$1],[:],
16533b83913fSmrg        [if test x"$cross_compiling" != x"yes" ; then
16543b83913fSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16553b83913fSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16563b83913fSmrg         fi])
16573b83913fSmrg    ])
16583b83913fSmrg
16593b83913fSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16603b83913fSmrg# the path and the name of the doc stylesheet
16613b83913fSmrgif test "x$XORG_SGML_PATH" != "x" ; then
16623b83913fSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16633b83913fSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16643b83913fSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1665c918a7e2Smrgelse
16663b83913fSmrg   AC_MSG_RESULT([no])
1667c918a7e2Smrgfi
1668c918a7e2Smrg
16693b83913fSmrgAC_SUBST(XORG_SGML_PATH)
16703b83913fSmrgAC_SUBST(STYLESHEET_SRCDIR)
16713b83913fSmrgAC_SUBST(XSL_STYLESHEET)
16723b83913fSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16733b83913fSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1674c918a7e2Smrg
16753b83913fSmrg# XORG_CHECK_LINUXDOC
16763b83913fSmrg# -------------------
16773b83913fSmrg# Minimum version: 1.0.0
16783b83913fSmrg#
16793b83913fSmrg# Defines the variable MAKE_TEXT if the necessary tools and
16803b83913fSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16813b83913fSmrg# Whether or not the necessary tools and files are found can be checked
16823b83913fSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16833b83913fSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16843b83913fSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16853b83913fSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686a39bb051Smrg
16873b83913fSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688a39bb051Smrg
16893b83913fSmrgAC_MSG_CHECKING([whether to build documentation])
1690a39bb051Smrg
16913b83913fSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16923b83913fSmrg   BUILDDOC=yes
16933b83913fSmrgelse
16943b83913fSmrg   BUILDDOC=no
1695c918a7e2Smrgfi
1696c918a7e2Smrg
16973b83913fSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698a39bb051Smrg
16993b83913fSmrgAC_MSG_RESULT([$BUILDDOC])
1700c918a7e2Smrg
17013b83913fSmrgAC_MSG_CHECKING([whether to build pdf documentation])
17023b83913fSmrg
17033b83913fSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17043b83913fSmrg   BUILDPDFDOC=yes
17053b83913fSmrgelse
17063b83913fSmrg   BUILDPDFDOC=no
17073b83913fSmrgfi
17083b83913fSmrg
17093b83913fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17103b83913fSmrg
17113b83913fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17123b83913fSmrg
17133b83913fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17143b83913fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17153b83913fSmrgMAKE_PDF="$PS2PDF"
17163b83913fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17173b83913fSmrg
17183b83913fSmrgAC_SUBST(MAKE_TEXT)
17193b83913fSmrgAC_SUBST(MAKE_PS)
17203b83913fSmrgAC_SUBST(MAKE_PDF)
17213b83913fSmrgAC_SUBST(MAKE_HTML)
17223b83913fSmrg]) # XORG_CHECK_LINUXDOC
17233b83913fSmrg
17243b83913fSmrg# XORG_CHECK_DOCBOOK
17253b83913fSmrg# -------------------
17263b83913fSmrg# Minimum version: 1.0.0
1727c918a7e2Smrg#
17283b83913fSmrg# Checks for the ability to build output formats from SGML DocBook source.
17293b83913fSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17303b83913fSmrg# indicates whether the necessary tools and files are found and, if set,
17313b83913fSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17323b83913fSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17333b83913fSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1734c918a7e2Smrg
17353b83913fSmrgBUILDTXTDOC=no
17363b83913fSmrgBUILDPDFDOC=no
17373b83913fSmrgBUILDPSDOC=no
17383b83913fSmrgBUILDHTMLDOC=no
1739a39bb051Smrg
17403b83913fSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17413b83913fSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17423b83913fSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17433b83913fSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744a39bb051Smrg
17453b83913fSmrgAC_MSG_CHECKING([whether to build text documentation])
17463b83913fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17473b83913fSmrg   test x$BUILD_TXTDOC != xno; then
17483b83913fSmrg	BUILDTXTDOC=yes
17493b83913fSmrgfi
17503b83913fSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17513b83913fSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752a39bb051Smrg
17533b83913fSmrgAC_MSG_CHECKING([whether to build PDF documentation])
17543b83913fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17553b83913fSmrg   test x$BUILD_PDFDOC != xno; then
17563b83913fSmrg	BUILDPDFDOC=yes
17573b83913fSmrgfi
17583b83913fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17593b83913fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760a39bb051Smrg
17613b83913fSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17623b83913fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17633b83913fSmrg   test x$BUILD_PSDOC != xno; then
17643b83913fSmrg	BUILDPSDOC=yes
1765a39bb051Smrgfi
17663b83913fSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17673b83913fSmrgAC_MSG_RESULT([$BUILDPSDOC])
1768a39bb051Smrg
17693b83913fSmrgAC_MSG_CHECKING([whether to build HTML documentation])
17703b83913fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17713b83913fSmrg   test x$BUILD_HTMLDOC != xno; then
17723b83913fSmrg	BUILDHTMLDOC=yes
17733b83913fSmrgfi
17743b83913fSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17753b83913fSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776c918a7e2Smrg
17773b83913fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17783b83913fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17793b83913fSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17803b83913fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17813b83913fSmrg
17823b83913fSmrgAC_SUBST(MAKE_TEXT)
17833b83913fSmrgAC_SUBST(MAKE_PS)
17843b83913fSmrgAC_SUBST(MAKE_PDF)
17853b83913fSmrgAC_SUBST(MAKE_HTML)
17863b83913fSmrg]) # XORG_CHECK_DOCBOOK
17873b83913fSmrg
17883b83913fSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1789a39bb051Smrg# ----------------
17903b83913fSmrg# Minimum version: 1.5.0
17913b83913fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
17929ef7378bSmrg#
17933b83913fSmrg# Documentation tools are not always available on all platforms and sometimes
17943b83913fSmrg# not at the appropriate level. This macro enables a module to test for the
17953b83913fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
17963b83913fSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
17973b83913fSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17983b83913fSmrg# --with-xmlto assumes 'auto'.
1799a39bb051Smrg#
18003b83913fSmrg# Interface to module:
18013b83913fSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18023b83913fSmrg# XMLTO:	returns the path of the xmlto program found
18033b83913fSmrg#		returns the path set by the user in the environment
18043b83913fSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18053b83913fSmrg#		'no' user instructs the module not to use xmlto
18063b83913fSmrg#
18073b83913fSmrg# Added in version 1.10.0
18083b83913fSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18093b83913fSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
18103b83913fSmrg#
18113b83913fSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
18123b83913fSmrg#
18133b83913fSmrgAC_DEFUN([XORG_WITH_XMLTO],[
18143b83913fSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18153b83913fSmrgm4_define([_defopt], m4_default([$2], [auto]))
18163b83913fSmrgAC_ARG_WITH(xmlto,
18173b83913fSmrg	AS_HELP_STRING([--with-xmlto],
18183b83913fSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18193b83913fSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18203b83913fSmrgm4_undefine([_defopt])
1821a39bb051Smrg
18223b83913fSmrgif test "x$use_xmlto" = x"auto"; then
18233b83913fSmrg   AC_PATH_PROG([XMLTO], [xmlto])
18243b83913fSmrg   if test "x$XMLTO" = "x"; then
18253b83913fSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18263b83913fSmrg	have_xmlto=no
18273b83913fSmrg   else
18283b83913fSmrg        have_xmlto=yes
18293b83913fSmrg   fi
18303b83913fSmrgelif test "x$use_xmlto" = x"yes" ; then
18313b83913fSmrg   AC_PATH_PROG([XMLTO], [xmlto])
18323b83913fSmrg   if test "x$XMLTO" = "x"; then
18333b83913fSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18343b83913fSmrg   fi
18353b83913fSmrg   have_xmlto=yes
18363b83913fSmrgelif test "x$use_xmlto" = x"no" ; then
18373b83913fSmrg   if test "x$XMLTO" != "x"; then
18383b83913fSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18393b83913fSmrg   fi
18403b83913fSmrg   have_xmlto=no
18413b83913fSmrgelse
18423b83913fSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18433b83913fSmrgfi
18443b83913fSmrg
18453b83913fSmrg# Test for a minimum version of xmlto, if provided.
18463b83913fSmrgm4_ifval([$1],
18473b83913fSmrg[if test "$have_xmlto" = yes; then
18483b83913fSmrg    # scrape the xmlto version
18493b83913fSmrg    AC_MSG_CHECKING([the xmlto version])
18503b83913fSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18513b83913fSmrg    AC_MSG_RESULT([$xmlto_version])
18523b83913fSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18533b83913fSmrg        [if test "x$use_xmlto" = xauto; then
18543b83913fSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18553b83913fSmrg            have_xmlto=no
18563b83913fSmrg        else
18573b83913fSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18583b83913fSmrg        fi])
18593b83913fSmrgfi])
1860a39bb051Smrg
18613b83913fSmrg# Test for the ability of xmlto to generate a text target
18623b83913fSmrg#
18633b83913fSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18643b83913fSmrg# following test for empty XML docbook files.
18653b83913fSmrg# For compatibility reasons use the following empty XML docbook file and if
18663b83913fSmrg# it fails try it again with a non-empty XML file.
18673b83913fSmrghave_xmlto_text=no
18683b83913fSmrgcat > conftest.xml << "EOF"
18693b83913fSmrgEOF
18703b83913fSmrgAS_IF([test "$have_xmlto" = yes],
18713b83913fSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18723b83913fSmrg             [have_xmlto_text=yes],
18733b83913fSmrg             [# Try it again with a non-empty XML file.
18743b83913fSmrg              cat > conftest.xml << "EOF"
18753b83913fSmrg<x></x>
18763b83913fSmrgEOF
18773b83913fSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18783b83913fSmrg                    [have_xmlto_text=yes],
18793b83913fSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
18803b83913fSmrgrm -f conftest.xml
18813b83913fSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18823b83913fSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18833b83913fSmrg]) # XORG_WITH_XMLTO
1884a39bb051Smrg
18853b83913fSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18863b83913fSmrg# --------------------------------------------
18873b83913fSmrg# Minimum version: 1.12.0
18883b83913fSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1889a39bb051Smrg#
18903b83913fSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18913b83913fSmrg# XML-based language used for the transformation of XML documents.
18923b83913fSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18933b83913fSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18943b83913fSmrg# The XSLT processor is often used as a standalone tool for transformations.
18953b83913fSmrg# It should not be assumed that this tool is used only to work with documnetation.
18963b83913fSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1897a39bb051Smrg#
18983b83913fSmrg# Interface to module:
18993b83913fSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19003b83913fSmrg# XSLTPROC:	 returns the path of the xsltproc program found
19013b83913fSmrg#		 returns the path set by the user in the environment
19023b83913fSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19033b83913fSmrg#		  'no' user instructs the module not to use xsltproc
19043b83913fSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1905a39bb051Smrg#
19063b83913fSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1907a39bb051Smrg#
19083b83913fSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19093b83913fSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19103b83913fSmrg# Preserves the interface, should it be implemented later
19113b83913fSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19123b83913fSmrgm4_define([_defopt], m4_default([$2], [auto]))
19133b83913fSmrgAC_ARG_WITH(xsltproc,
19143b83913fSmrg	AS_HELP_STRING([--with-xsltproc],
19153b83913fSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19163b83913fSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19173b83913fSmrgm4_undefine([_defopt])
1918a39bb051Smrg
19193b83913fSmrgif test "x$use_xsltproc" = x"auto"; then
19203b83913fSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19213b83913fSmrg   if test "x$XSLTPROC" = "x"; then
19223b83913fSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19233b83913fSmrg	have_xsltproc=no
19243b83913fSmrg   else
19253b83913fSmrg        have_xsltproc=yes
19263b83913fSmrg   fi
19273b83913fSmrgelif test "x$use_xsltproc" = x"yes" ; then
19283b83913fSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19293b83913fSmrg   if test "x$XSLTPROC" = "x"; then
19303b83913fSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19313b83913fSmrg   fi
19323b83913fSmrg   have_xsltproc=yes
19333b83913fSmrgelif test "x$use_xsltproc" = x"no" ; then
19343b83913fSmrg   if test "x$XSLTPROC" != "x"; then
19353b83913fSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19363b83913fSmrg   fi
19373b83913fSmrg   have_xsltproc=no
19383b83913fSmrgelse
19393b83913fSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19403b83913fSmrgfi
1941a39bb051Smrg
19423b83913fSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19433b83913fSmrg]) # XORG_WITH_XSLTPROC
1944a39bb051Smrg
19453b83913fSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19463b83913fSmrg# ----------------------------------------
19473b83913fSmrg# Minimum version: 1.15.0
1948a39bb051Smrg#
19493b83913fSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
19503b83913fSmrg# scanning arbitrary text files, extracting information from those text files,
19513b83913fSmrg# and printing reports based on that information.
1952a39bb051Smrg#
19533b83913fSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954a39bb051Smrg#
19553b83913fSmrg# Interface to module:
19563b83913fSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
19573b83913fSmrg# PERL:	     returns the path of the perl program found
19583b83913fSmrg#	     returns the path set by the user in the environment
19593b83913fSmrg# --with-perl: 'yes' user instructs the module to use perl
19603b83913fSmrg#	       'no' user instructs the module not to use perl
19613b83913fSmrg# have_perl: returns yes if perl found in PATH or no
1962a39bb051Smrg#
19633b83913fSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1964a39bb051Smrg#
19653b83913fSmrgAC_DEFUN([XORG_WITH_PERL],[
19663b83913fSmrgAC_ARG_VAR([PERL], [Path to perl command])
19673b83913fSmrg# Preserves the interface, should it be implemented later
19683b83913fSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
19693b83913fSmrgm4_define([_defopt], m4_default([$2], [auto]))
19703b83913fSmrgAC_ARG_WITH(perl,
19713b83913fSmrg	AS_HELP_STRING([--with-perl],
19723b83913fSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
19733b83913fSmrg	   [use_perl=$withval], [use_perl=]_defopt)
19743b83913fSmrgm4_undefine([_defopt])
1975a39bb051Smrg
19763b83913fSmrgif test "x$use_perl" = x"auto"; then
19773b83913fSmrg   AC_PATH_PROG([PERL], [perl])
19783b83913fSmrg   if test "x$PERL" = "x"; then
19793b83913fSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19803b83913fSmrg	have_perl=no
19813b83913fSmrg   else
19823b83913fSmrg        have_perl=yes
19833b83913fSmrg   fi
19843b83913fSmrgelif test "x$use_perl" = x"yes" ; then
19853b83913fSmrg   AC_PATH_PROG([PERL], [perl])
19863b83913fSmrg   if test "x$PERL" = "x"; then
19873b83913fSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19883b83913fSmrg   fi
19893b83913fSmrg   have_perl=yes
19903b83913fSmrgelif test "x$use_perl" = x"no" ; then
19913b83913fSmrg   if test "x$PERL" != "x"; then
19923b83913fSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19933b83913fSmrg   fi
19943b83913fSmrg   have_perl=no
19953b83913fSmrgelse
19963b83913fSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19973b83913fSmrgfi
1998a39bb051Smrg
19993b83913fSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20003b83913fSmrg]) # XORG_WITH_PERL
2001a39bb051Smrg
20023b83913fSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
20033b83913fSmrg# ----------------
20043b83913fSmrg# Minimum version: 1.5.0
20053b83913fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20063b83913fSmrg#
20073b83913fSmrg# Documentation tools are not always available on all platforms and sometimes
20083b83913fSmrg# not at the appropriate level. This macro enables a module to test for the
20093b83913fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20103b83913fSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
20113b83913fSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20123b83913fSmrg# --with-asciidoc assumes 'auto'.
20133b83913fSmrg#
20143b83913fSmrg# Interface to module:
20153b83913fSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20163b83913fSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
20173b83913fSmrg#		 returns the path set by the user in the environment
20183b83913fSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20193b83913fSmrg#		  'no' user instructs the module not to use asciidoc
2020a39bb051Smrg#
20213b83913fSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20223b83913fSmrg#
20233b83913fSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20243b83913fSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20253b83913fSmrgm4_define([_defopt], m4_default([$2], [auto]))
20263b83913fSmrgAC_ARG_WITH(asciidoc,
20273b83913fSmrg	AS_HELP_STRING([--with-asciidoc],
20283b83913fSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20293b83913fSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20303b83913fSmrgm4_undefine([_defopt])
2031a39bb051Smrg
20323b83913fSmrgif test "x$use_asciidoc" = x"auto"; then
20333b83913fSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20343b83913fSmrg   if test "x$ASCIIDOC" = "x"; then
20353b83913fSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20363b83913fSmrg	have_asciidoc=no
20373b83913fSmrg   else
20383b83913fSmrg        have_asciidoc=yes
20393b83913fSmrg   fi
20403b83913fSmrgelif test "x$use_asciidoc" = x"yes" ; then
20413b83913fSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20423b83913fSmrg   if test "x$ASCIIDOC" = "x"; then
20433b83913fSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20443b83913fSmrg   fi
20453b83913fSmrg   have_asciidoc=yes
20463b83913fSmrgelif test "x$use_asciidoc" = x"no" ; then
20473b83913fSmrg   if test "x$ASCIIDOC" != "x"; then
20483b83913fSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20493b83913fSmrg   fi
20503b83913fSmrg   have_asciidoc=no
2051a39bb051Smrgelse
20523b83913fSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2053c19de146Smrgfi
20543b83913fSmrgm4_ifval([$1],
20553b83913fSmrg[if test "$have_asciidoc" = yes; then
20563b83913fSmrg    # scrape the asciidoc version
20573b83913fSmrg    AC_MSG_CHECKING([the asciidoc version])
20583b83913fSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20593b83913fSmrg    AC_MSG_RESULT([$asciidoc_version])
20603b83913fSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20613b83913fSmrg        [if test "x$use_asciidoc" = xauto; then
20623b83913fSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20633b83913fSmrg            have_asciidoc=no
20643b83913fSmrg        else
20653b83913fSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20663b83913fSmrg        fi])
20673b83913fSmrgfi])
20683b83913fSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20693b83913fSmrg]) # XORG_WITH_ASCIIDOC
2070a39bb051Smrg
20713b83913fSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20723b83913fSmrg# -------------------------------------------
20733b83913fSmrg# Minimum version: 1.5.0
20743b83913fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20753b83913fSmrg# Minimum version for optional DOT checking: 1.18.0
2076a39bb051Smrg#
20773b83913fSmrg# Documentation tools are not always available on all platforms and sometimes
20783b83913fSmrg# not at the appropriate level. This macro enables a module to test for the
20793b83913fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20803b83913fSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
20813b83913fSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20823b83913fSmrg# --with-doxygen assumes 'auto'.
2083a39bb051Smrg#
20843b83913fSmrg# Interface to module:
20853b83913fSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20863b83913fSmrg# DOXYGEN:	 returns the path of the doxygen program found
20873b83913fSmrg#		 returns the path set by the user in the environment
20883b83913fSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20893b83913fSmrg#		  'no' user instructs the module not to use doxygen
20903b83913fSmrg#
20913b83913fSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20923b83913fSmrg#
20933b83913fSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20943b83913fSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20953b83913fSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20963b83913fSmrgm4_define([_defopt], m4_default([$2], [auto]))
20973b83913fSmrgAC_ARG_WITH(doxygen,
20983b83913fSmrg	AS_HELP_STRING([--with-doxygen],
20993b83913fSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21003b83913fSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21013b83913fSmrgm4_undefine([_defopt])
2102a39bb051Smrg
21033b83913fSmrgif test "x$use_doxygen" = x"auto"; then
21043b83913fSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21053b83913fSmrg   if test "x$DOXYGEN" = "x"; then
21063b83913fSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21073b83913fSmrg	have_doxygen=no
21083b83913fSmrg   else
21093b83913fSmrg        have_doxygen=yes
21103b83913fSmrg   fi
21113b83913fSmrgelif test "x$use_doxygen" = x"yes" ; then
21123b83913fSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21133b83913fSmrg   if test "x$DOXYGEN" = "x"; then
21143b83913fSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21153b83913fSmrg   fi
21163b83913fSmrg   have_doxygen=yes
21173b83913fSmrgelif test "x$use_doxygen" = x"no" ; then
21183b83913fSmrg   if test "x$DOXYGEN" != "x"; then
21193b83913fSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21203b83913fSmrg   fi
21213b83913fSmrg   have_doxygen=no
21223b83913fSmrgelse
21233b83913fSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
21243b83913fSmrgfi
21253b83913fSmrgm4_ifval([$1],
21263b83913fSmrg[if test "$have_doxygen" = yes; then
21273b83913fSmrg    # scrape the doxygen version
21283b83913fSmrg    AC_MSG_CHECKING([the doxygen version])
21293b83913fSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21303b83913fSmrg    AC_MSG_RESULT([$doxygen_version])
21313b83913fSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21323b83913fSmrg        [if test "x$use_doxygen" = xauto; then
21333b83913fSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21343b83913fSmrg            have_doxygen=no
21353b83913fSmrg        else
21363b83913fSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21373b83913fSmrg        fi])
21383b83913fSmrgfi])
21393b83913fSmrg
21403b83913fSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21413b83913fSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21423b83913fSmrgdnl 	HAVE_DOT = @HAVE_DOT@
21433b83913fSmrgHAVE_DOT=no
21443b83913fSmrgif test "x$have_doxygen" = "xyes"; then
21453b83913fSmrg  AC_PATH_PROG([DOT], [dot])
21463b83913fSmrg    if test "x$DOT" != "x"; then
21473b83913fSmrg      HAVE_DOT=yes
2148a39bb051Smrg    fi
21493b83913fSmrgfi
2150c19de146Smrg
21513b83913fSmrgAC_SUBST([HAVE_DOT])
21523b83913fSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21533b83913fSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21543b83913fSmrg]) # XORG_WITH_DOXYGEN
21553b83913fSmrg
21563b83913fSmrg# XORG_WITH_GROFF([DEFAULT])
21573b83913fSmrg# ----------------
21583b83913fSmrg# Minimum version: 1.6.0
21593b83913fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
21603b83913fSmrg#
21613b83913fSmrg# Documentation tools are not always available on all platforms and sometimes
21623b83913fSmrg# not at the appropriate level. This macro enables a module to test for the
21633b83913fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
21643b83913fSmrg# the --with-groff option, it allows maximum flexibility in making decisions
21653b83913fSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
21663b83913fSmrg# --with-groff assumes 'auto'.
21673b83913fSmrg#
21683b83913fSmrg# Interface to module:
21693b83913fSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21703b83913fSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21713b83913fSmrg# HAVE_GROFF_MS: the -ms macros package
21723b83913fSmrg# GROFF:	 returns the path of the groff program found
21733b83913fSmrg#		 returns the path set by the user in the environment
21743b83913fSmrg# --with-groff:	 'yes' user instructs the module to use groff
21753b83913fSmrg#		 'no' user instructs the module not to use groff
21763b83913fSmrg#
21773b83913fSmrg# Added in version 1.9.0:
21783b83913fSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21793b83913fSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21803b83913fSmrg#		   psselect from the psutils package.
21813b83913fSmrg#		   the ghostcript package. Refer to the grohtml man pages
21823b83913fSmrg#
21833b83913fSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21843b83913fSmrg#
21853b83913fSmrg# OS and distros often splits groff in a basic and full package, the former
21863b83913fSmrg# having the groff program and the later having devices, fonts and macros
21873b83913fSmrg# Checking for the groff executable is not enough.
21883b83913fSmrg#
21893b83913fSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
21903b83913fSmrg# unset HAVE_GROFF or GROFF env variables.
21913b83913fSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21923b83913fSmrg#
21933b83913fSmrgAC_DEFUN([XORG_WITH_GROFF],[
21943b83913fSmrgAC_ARG_VAR([GROFF], [Path to groff command])
21953b83913fSmrgm4_define([_defopt], m4_default([$1], [auto]))
21963b83913fSmrgAC_ARG_WITH(groff,
21973b83913fSmrg	AS_HELP_STRING([--with-groff],
21983b83913fSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21993b83913fSmrg	   [use_groff=$withval], [use_groff=]_defopt)
22003b83913fSmrgm4_undefine([_defopt])
22013b83913fSmrg
22023b83913fSmrgif test "x$use_groff" = x"auto"; then
22033b83913fSmrg   AC_PATH_PROG([GROFF], [groff])
22043b83913fSmrg   if test "x$GROFF" = "x"; then
22053b83913fSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22063b83913fSmrg	have_groff=no
22073b83913fSmrg   else
22083b83913fSmrg        have_groff=yes
22093b83913fSmrg   fi
22103b83913fSmrgelif test "x$use_groff" = x"yes" ; then
22113b83913fSmrg   AC_PATH_PROG([GROFF], [groff])
22123b83913fSmrg   if test "x$GROFF" = "x"; then
22133b83913fSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22143b83913fSmrg   fi
22153b83913fSmrg   have_groff=yes
22163b83913fSmrgelif test "x$use_groff" = x"no" ; then
22173b83913fSmrg   if test "x$GROFF" != "x"; then
22183b83913fSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22193b83913fSmrg   fi
22203b83913fSmrg   have_groff=no
2221c19de146Smrgelse
22223b83913fSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2223c19de146Smrgfi
2224c19de146Smrg
22253b83913fSmrg# We have groff, test for the presence of the macro packages
22263b83913fSmrgif test "x$have_groff" = x"yes"; then
22273b83913fSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22283b83913fSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22293b83913fSmrg        groff_ms_works=yes
22303b83913fSmrg    else
22313b83913fSmrg        groff_ms_works=no
22323b83913fSmrg    fi
22333b83913fSmrg    AC_MSG_RESULT([$groff_ms_works])
22343b83913fSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22353b83913fSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22363b83913fSmrg        groff_mm_works=yes
22373b83913fSmrg    else
22383b83913fSmrg        groff_mm_works=no
22393b83913fSmrg    fi
22403b83913fSmrg    AC_MSG_RESULT([$groff_mm_works])
22413b83913fSmrgfi
2242c19de146Smrg
22433b83913fSmrg# We have groff, test for HTML dependencies, one command per package
22443b83913fSmrgif test "x$have_groff" = x"yes"; then
22453b83913fSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22463b83913fSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22473b83913fSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22483b83913fSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22493b83913fSmrg      have_groff_html=yes
22503b83913fSmrg   else
22513b83913fSmrg      have_groff_html=no
22523b83913fSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22533b83913fSmrg   fi
22543b83913fSmrgfi
2255a39bb051Smrg
22563b83913fSmrg# Set Automake conditionals for Makefiles
22573b83913fSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22583b83913fSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22593b83913fSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22603b83913fSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22613b83913fSmrg]) # XORG_WITH_GROFF
2262a39bb051Smrg
22633b83913fSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22643b83913fSmrg# ---------------------------------------
22653b83913fSmrg# Minimum version: 1.6.0
22663b83913fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
22673b83913fSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
22683b83913fSmrg#
22693b83913fSmrg# Documentation tools are not always available on all platforms and sometimes
22703b83913fSmrg# not at the appropriate level. This macro enables a module to test for the
22713b83913fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
22723b83913fSmrg# the --with-fop option, it allows maximum flexibility in making decisions
22733b83913fSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
22743b83913fSmrg# --with-fop assumes 'auto'.
22753b83913fSmrg#
22763b83913fSmrg# Interface to module:
22773b83913fSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22783b83913fSmrg# FOP:	 	returns the path of the fop program found
22793b83913fSmrg#		returns the path set by the user in the environment
22803b83913fSmrg# --with-fop: 	'yes' user instructs the module to use fop
22813b83913fSmrg#		'no' user instructs the module not to use fop
22823b83913fSmrg#
22833b83913fSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22843b83913fSmrg#
22853b83913fSmrgAC_DEFUN([XORG_WITH_FOP],[
22863b83913fSmrgAC_ARG_VAR([FOP], [Path to fop command])
22873b83913fSmrgm4_define([_defopt], m4_default([$2], [auto]))
22883b83913fSmrgAC_ARG_WITH(fop,
22893b83913fSmrg	AS_HELP_STRING([--with-fop],
22903b83913fSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22913b83913fSmrg	   [use_fop=$withval], [use_fop=]_defopt)
22923b83913fSmrgm4_undefine([_defopt])
22933b83913fSmrg
22943b83913fSmrgif test "x$use_fop" = x"auto"; then
22953b83913fSmrg   AC_PATH_PROG([FOP], [fop])
22963b83913fSmrg   if test "x$FOP" = "x"; then
22973b83913fSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22983b83913fSmrg	have_fop=no
22993b83913fSmrg   else
23003b83913fSmrg        have_fop=yes
23013b83913fSmrg   fi
23023b83913fSmrgelif test "x$use_fop" = x"yes" ; then
23033b83913fSmrg   AC_PATH_PROG([FOP], [fop])
23043b83913fSmrg   if test "x$FOP" = "x"; then
23053b83913fSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23063b83913fSmrg   fi
23073b83913fSmrg   have_fop=yes
23083b83913fSmrgelif test "x$use_fop" = x"no" ; then
23093b83913fSmrg   if test "x$FOP" != "x"; then
23103b83913fSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23113b83913fSmrg   fi
23123b83913fSmrg   have_fop=no
23133b83913fSmrgelse
23143b83913fSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315a39bb051Smrgfi
2316a39bb051Smrg
23173b83913fSmrg# Test for a minimum version of fop, if provided.
23183b83913fSmrgm4_ifval([$1],
23193b83913fSmrg[if test "$have_fop" = yes; then
23203b83913fSmrg    # scrape the fop version
23213b83913fSmrg    AC_MSG_CHECKING([for fop minimum version])
23223b83913fSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23233b83913fSmrg    AC_MSG_RESULT([$fop_version])
23243b83913fSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
23253b83913fSmrg        [if test "x$use_fop" = xauto; then
23263b83913fSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23273b83913fSmrg            have_fop=no
23283b83913fSmrg        else
23293b83913fSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23303b83913fSmrg        fi])
23313b83913fSmrgfi])
23323b83913fSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23333b83913fSmrg]) # XORG_WITH_FOP
23343b83913fSmrg
23353b83913fSmrg# XORG_WITH_M4([MIN-VERSION])
23363b83913fSmrg# ---------------------------
23373b83913fSmrg# Minimum version: 1.19.0
23383b83913fSmrg#
23393b83913fSmrg# This macro attempts to locate an m4 macro processor which supports
23403b83913fSmrg# -I option and is only useful for modules relying on M4 in order to
23413b83913fSmrg# expand macros in source code files.
23423b83913fSmrg#
23433b83913fSmrg# Interface to module:
23443b83913fSmrg# M4:	 	returns the path of the m4 program found
23453b83913fSmrg#		returns the path set by the user in the environment
23463b83913fSmrg#
23473b83913fSmrgAC_DEFUN([XORG_WITH_M4], [
23483b83913fSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23493b83913fSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23503b83913fSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23513b83913fSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23523b83913fSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23533b83913fSmrg   [$PATH:/usr/gnu/bin])])
23543b83913fSmrg
23553b83913fSmrgAC_SUBST([M4], [$ac_cv_path_M4])
23563b83913fSmrg]) # XORG_WITH_M4
2357a39bb051Smrg
23583b83913fSmrg# XORG_WITH_PS2PDF([DEFAULT])
23593b83913fSmrg# ----------------
23603b83913fSmrg# Minimum version: 1.6.0
23613b83913fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2362c918a7e2Smrg#
23633b83913fSmrg# Documentation tools are not always available on all platforms and sometimes
23643b83913fSmrg# not at the appropriate level. This macro enables a module to test for the
23653b83913fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
23663b83913fSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
23673b83913fSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23683b83913fSmrg# --with-ps2pdf assumes 'auto'.
23693b83913fSmrg#
23703b83913fSmrg# Interface to module:
23713b83913fSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23723b83913fSmrg# PS2PDF:	returns the path of the ps2pdf program found
23733b83913fSmrg#		returns the path set by the user in the environment
23743b83913fSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23753b83913fSmrg#		 'no' user instructs the module not to use ps2pdf
23763b83913fSmrg#
23773b83913fSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23783b83913fSmrg#
23793b83913fSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23803b83913fSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23813b83913fSmrgm4_define([_defopt], m4_default([$1], [auto]))
23823b83913fSmrgAC_ARG_WITH(ps2pdf,
23833b83913fSmrg	AS_HELP_STRING([--with-ps2pdf],
23843b83913fSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23853b83913fSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23863b83913fSmrgm4_undefine([_defopt])
2387a39bb051Smrg
23883b83913fSmrgif test "x$use_ps2pdf" = x"auto"; then
23893b83913fSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23903b83913fSmrg   if test "x$PS2PDF" = "x"; then
23913b83913fSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23923b83913fSmrg	have_ps2pdf=no
23933b83913fSmrg   else
23943b83913fSmrg        have_ps2pdf=yes
23953b83913fSmrg   fi
23963b83913fSmrgelif test "x$use_ps2pdf" = x"yes" ; then
23973b83913fSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23983b83913fSmrg   if test "x$PS2PDF" = "x"; then
23993b83913fSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24003b83913fSmrg   fi
24013b83913fSmrg   have_ps2pdf=yes
24023b83913fSmrgelif test "x$use_ps2pdf" = x"no" ; then
24033b83913fSmrg   if test "x$PS2PDF" != "x"; then
24043b83913fSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24053b83913fSmrg   fi
24063b83913fSmrg   have_ps2pdf=no
24073b83913fSmrgelse
24083b83913fSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
24093b83913fSmrgfi
24103b83913fSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24113b83913fSmrg]) # XORG_WITH_PS2PDF
2412a39bb051Smrg
24133b83913fSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
24143b83913fSmrg# ----------------
24153b83913fSmrg# Minimum version: 1.6.0
24163b83913fSmrg#
24173b83913fSmrg# Documentation tools are not always available on all platforms and sometimes
24183b83913fSmrg# not at the appropriate level. This macro enables a builder to skip all
24193b83913fSmrg# documentation targets except traditional man pages.
24203b83913fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24213b83913fSmrg# maximum flexibility in controlling documentation building.
24223b83913fSmrg# Refer to:
24233b83913fSmrg# XORG_WITH_XMLTO         --with-xmlto
24243b83913fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24253b83913fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24263b83913fSmrg# XORG_WITH_FOP           --with-fop
24273b83913fSmrg# XORG_WITH_GROFF         --with-groff
24283b83913fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24293b83913fSmrg#
24303b83913fSmrg# Interface to module:
24313b83913fSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24323b83913fSmrg# --enable-docs: 'yes' user instructs the module to generate docs
24333b83913fSmrg#		 'no' user instructs the module not to generate docs
24343b83913fSmrg# parm1:	specify the default value, yes or no.
24353b83913fSmrg#
24363b83913fSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24373b83913fSmrgm4_define([docs_default], m4_default([$1], [yes]))
24383b83913fSmrgAC_ARG_ENABLE(docs,
24393b83913fSmrg	AS_HELP_STRING([--enable-docs],
24403b83913fSmrg	   [Enable building the documentation (default: ]docs_default[)]),
24413b83913fSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
24423b83913fSmrgm4_undefine([docs_default])
24433b83913fSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24443b83913fSmrgAC_MSG_CHECKING([whether to build documentation])
24453b83913fSmrgAC_MSG_RESULT([$build_docs])
24463b83913fSmrg]) # XORG_ENABLE_DOCS
24473b83913fSmrg
24483b83913fSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24493b83913fSmrg# ----------------
24503b83913fSmrg# Minimum version: 1.6.0
24513b83913fSmrg#
24523b83913fSmrg# This macro enables a builder to skip all developer documentation.
24533b83913fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24543b83913fSmrg# maximum flexibility in controlling documentation building.
24553b83913fSmrg# Refer to:
24563b83913fSmrg# XORG_WITH_XMLTO         --with-xmlto
24573b83913fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24583b83913fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24593b83913fSmrg# XORG_WITH_FOP           --with-fop
24603b83913fSmrg# XORG_WITH_GROFF         --with-groff
24613b83913fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24623b83913fSmrg#
24633b83913fSmrg# Interface to module:
24643b83913fSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24653b83913fSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24663b83913fSmrg#			'no' user instructs the module not to generate developer docs
24673b83913fSmrg# parm1:		specify the default value, yes or no.
24683b83913fSmrg#
24693b83913fSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24703b83913fSmrgm4_define([devel_default], m4_default([$1], [yes]))
24713b83913fSmrgAC_ARG_ENABLE(devel-docs,
24723b83913fSmrg	AS_HELP_STRING([--enable-devel-docs],
24733b83913fSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24743b83913fSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24753b83913fSmrgm4_undefine([devel_default])
24763b83913fSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24773b83913fSmrgAC_MSG_CHECKING([whether to build developer documentation])
24783b83913fSmrgAC_MSG_RESULT([$build_devel_docs])
24793b83913fSmrg]) # XORG_ENABLE_DEVEL_DOCS
2480a39bb051Smrg
24813b83913fSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
24823b83913fSmrg# ----------------
24833b83913fSmrg# Minimum version: 1.6.0
24843b83913fSmrg#
24853b83913fSmrg# This macro enables a builder to skip all functional specification targets.
24863b83913fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24873b83913fSmrg# maximum flexibility in controlling documentation building.
24883b83913fSmrg# Refer to:
24893b83913fSmrg# XORG_WITH_XMLTO         --with-xmlto
24903b83913fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24913b83913fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24923b83913fSmrg# XORG_WITH_FOP           --with-fop
24933b83913fSmrg# XORG_WITH_GROFF         --with-groff
24943b83913fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24953b83913fSmrg#
24963b83913fSmrg# Interface to module:
24973b83913fSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24983b83913fSmrg# --enable-specs:	'yes' user instructs the module to generate specs
24993b83913fSmrg#			'no' user instructs the module not to generate specs
25003b83913fSmrg# parm1:		specify the default value, yes or no.
25013b83913fSmrg#
25023b83913fSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25033b83913fSmrgm4_define([spec_default], m4_default([$1], [yes]))
25043b83913fSmrgAC_ARG_ENABLE(specs,
25053b83913fSmrg	AS_HELP_STRING([--enable-specs],
25063b83913fSmrg	   [Enable building the specs (default: ]spec_default[)]),
25073b83913fSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
25083b83913fSmrgm4_undefine([spec_default])
25093b83913fSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25103b83913fSmrgAC_MSG_CHECKING([whether to build functional specifications])
25113b83913fSmrgAC_MSG_RESULT([$build_specs])
25123b83913fSmrg]) # XORG_ENABLE_SPECS
2513a39bb051Smrg
25143b83913fSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25153b83913fSmrg# ----------------------------------------------
25163b83913fSmrg# Minimum version: 1.13.0
2517c918a7e2Smrg#
25183b83913fSmrg# This macro enables a builder to enable/disable unit testing
25193b83913fSmrg# It makes no assumption about the test cases implementation
25203b83913fSmrg# Test cases may or may not use Automake "Support for test suites"
25213b83913fSmrg# They may or may not use the software utility library GLib
25223b83913fSmrg#
25233b83913fSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25243b83913fSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25253b83913fSmrg# The variable enable_unit_tests is used by other macros in this file.
25263b83913fSmrg#
25273b83913fSmrg# Interface to module:
25283b83913fSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25293b83913fSmrg# enable_unit_tests:    used in configure.ac for additional configuration
25303b83913fSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25313b83913fSmrg#			'no' user instructs the module not to build tests
25323b83913fSmrg# parm1:		specify the default value, yes or no.
25333b83913fSmrg#
25343b83913fSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25353b83913fSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25363b83913fSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25373b83913fSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25383b83913fSmrgm4_define([_defopt], m4_default([$1], [auto]))
25393b83913fSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25403b83913fSmrg	[Enable building unit test cases (default: ]_defopt[)]),
25413b83913fSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25423b83913fSmrgm4_undefine([_defopt])
25433b83913fSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25443b83913fSmrgAC_MSG_CHECKING([whether to build unit test cases])
25453b83913fSmrgAC_MSG_RESULT([$enable_unit_tests])
25463b83913fSmrg]) # XORG_ENABLE_UNIT_TESTS
2547a39bb051Smrg
25483b83913fSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25493b83913fSmrg# ------------------------------------------------------
25503b83913fSmrg# Minimum version: 1.17.0
25513b83913fSmrg#
25523b83913fSmrg# This macro enables a builder to enable/disable integration testing
25533b83913fSmrg# It makes no assumption about the test cases' implementation
25543b83913fSmrg# Test cases may or may not use Automake "Support for test suites"
25553b83913fSmrg#
25563b83913fSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25573b83913fSmrg# usually requires less dependencies and may be built and run under less
25583b83913fSmrg# stringent environments than integration tests.
25593b83913fSmrg#
25603b83913fSmrg# Interface to module:
25613b83913fSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25623b83913fSmrg# enable_integration_tests:   used in configure.ac for additional configuration
25633b83913fSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25643b83913fSmrg#                             'no' user instructs the module not to build tests
25653b83913fSmrg# parm1:                      specify the default value, yes or no.
25663b83913fSmrg#
25673b83913fSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
25683b83913fSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25693b83913fSmrgm4_define([_defopt], m4_default([$1], [auto]))
25703b83913fSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
25713b83913fSmrg	[Enable building integration test cases (default: ]_defopt[)]),
25723b83913fSmrg	[enable_integration_tests=$enableval],
25733b83913fSmrg	[enable_integration_tests=]_defopt)
25743b83913fSmrgm4_undefine([_defopt])
25753b83913fSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
25763b83913fSmrg	[test "x$enable_integration_tests" != xno])
25773b83913fSmrgAC_MSG_CHECKING([whether to build unit test cases])
25783b83913fSmrgAC_MSG_RESULT([$enable_integration_tests])
25793b83913fSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580a39bb051Smrg
25813b83913fSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25823b83913fSmrg# ----------------------------------------
25833b83913fSmrg# Minimum version: 1.13.0
25843b83913fSmrg#
25853b83913fSmrg# GLib is a library which provides advanced data structures and functions.
25863b83913fSmrg# This macro enables a module to test for the presence of Glib.
25873b83913fSmrg#
25883b83913fSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25893b83913fSmrg# Otherwise the value of $enable_unit_tests is blank.
25903b83913fSmrg#
25913b83913fSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25923b83913fSmrg# test support usually requires less dependencies and may be built and run under
25933b83913fSmrg# less stringent environments than integration tests.
25949ef7378bSmrg#
25953b83913fSmrg# Interface to module:
25963b83913fSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
25973b83913fSmrg# with_glib: used in configure.ac to know if GLib has been found
25983b83913fSmrg# --with-glib:	'yes' user instructs the module to use glib
25993b83913fSmrg#		'no' user instructs the module not to use glib
26003b83913fSmrg#
26013b83913fSmrgAC_DEFUN([XORG_WITH_GLIB],[
26023b83913fSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26033b83913fSmrgm4_define([_defopt], m4_default([$2], [auto]))
26043b83913fSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26053b83913fSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26063b83913fSmrg	[with_glib=$withval], [with_glib=]_defopt)
26073b83913fSmrgm4_undefine([_defopt])
2608c918a7e2Smrg
26093b83913fSmrghave_glib=no
26103b83913fSmrg# Do not probe GLib if user explicitly disabled unit testing
26113b83913fSmrgif test "x$enable_unit_tests" != x"no"; then
26123b83913fSmrg  # Do not probe GLib if user explicitly disabled it
26133b83913fSmrg  if test "x$with_glib" != x"no"; then
26143b83913fSmrg    m4_ifval(
26153b83913fSmrg      [$1],
26163b83913fSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26173b83913fSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26183b83913fSmrg    )
2619a39bb051Smrg  fi
26209ef7378bSmrgfi
2621c918a7e2Smrg
26223b83913fSmrg# Not having GLib when unit testing has been explicitly requested is an error
26233b83913fSmrgif test "x$enable_unit_tests" = x"yes"; then
26243b83913fSmrg  if test "x$have_glib" = x"no"; then
26253b83913fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626a39bb051Smrg  fi
26279ef7378bSmrgfi
26289ef7378bSmrg
26293b83913fSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
26303b83913fSmrgif test "x$enable_unit_tests" = x"no"; then
26313b83913fSmrg  if test "x$with_glib" = x"yes"; then
26323b83913fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26333b83913fSmrg  fi
26343b83913fSmrgfi
26359ef7378bSmrg
26363b83913fSmrg# Not having GLib when it has been explicitly requested is an error
26373b83913fSmrgif test "x$with_glib" = x"yes"; then
26383b83913fSmrg  if test "x$have_glib" = x"no"; then
26393b83913fSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26403b83913fSmrg  fi
26413b83913fSmrgfi
26429ef7378bSmrg
26433b83913fSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26443b83913fSmrg]) # XORG_WITH_GLIB
2645a39bb051Smrg
26463b83913fSmrg# XORG_LD_WRAP([required|optional])
26473b83913fSmrg# ---------------------------------
26483b83913fSmrg# Minimum version: 1.13.0
26493b83913fSmrg#
26503b83913fSmrg# Check if linker supports -wrap, passed via compiler flags
26513b83913fSmrg#
26523b83913fSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26533b83913fSmrg# Otherwise the value of $enable_unit_tests is blank.
26543b83913fSmrg#
26553b83913fSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26563b83913fSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26573b83913fSmrg# available, an argument of "optional" allows use when some unit tests require
26583b83913fSmrg# ld -wrap and others do not.
26593b83913fSmrg#
26603b83913fSmrgAC_DEFUN([XORG_LD_WRAP],[
26613b83913fSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26623b83913fSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26633b83913fSmrg                      void __wrap_exit(int status) { return; }],
26643b83913fSmrg                     [exit(0);])])
26653b83913fSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
26663b83913fSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
26673b83913fSmrg  if test "x$have_ld_wrap" = x"no"; then
26683b83913fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
26693b83913fSmrg  fi
26703b83913fSmrgfi
26713b83913fSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
26723b83913fSmrg#
26733b83913fSmrg]) # XORG_LD_WRAP
2674a39bb051Smrg
26753b83913fSmrg# XORG_CHECK_LINKER_FLAGS
26763b83913fSmrg# -----------------------
26773b83913fSmrg# SYNOPSIS
26783b83913fSmrg#
26793b83913fSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26803b83913fSmrg#
26813b83913fSmrg# DESCRIPTION
26823b83913fSmrg#
26833b83913fSmrg#   Check whether the given linker FLAGS work with the current language's
26843b83913fSmrg#   linker, or whether they give an error.
26853b83913fSmrg#
26863b83913fSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26873b83913fSmrg#   success/failure.
26883b83913fSmrg#
26893b83913fSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
26903b83913fSmrg#
26913b83913fSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26923b83913fSmrg#
26933b83913fSmrg# LICENSE
26943b83913fSmrg#
26953b83913fSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26963b83913fSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26973b83913fSmrg#   Copyright (c) 2009 Matteo Frigo
26983b83913fSmrg#
26993b83913fSmrg#   This program is free software: you can redistribute it and/or modify it
27003b83913fSmrg#   under the terms of the GNU General Public License as published by the
27013b83913fSmrg#   Free Software Foundation, either version 3 of the License, or (at your
27023b83913fSmrg#   option) any later version.
27033b83913fSmrg#
27043b83913fSmrg#   This program is distributed in the hope that it will be useful, but
27053b83913fSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27063b83913fSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27073b83913fSmrg#   Public License for more details.
27083b83913fSmrg#
27093b83913fSmrg#   You should have received a copy of the GNU General Public License along
27103b83913fSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27113b83913fSmrg#
27123b83913fSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
27133b83913fSmrg#   gives unlimited permission to copy, distribute and modify the configure
27143b83913fSmrg#   scripts that are the output of Autoconf when processing the Macro. You
27153b83913fSmrg#   need not follow the terms of the GNU General Public License when using
27163b83913fSmrg#   or distributing such scripts, even though portions of the text of the
27173b83913fSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27183b83913fSmrg#   all other use of the material that constitutes the Autoconf Macro.
27193b83913fSmrg#
27203b83913fSmrg#   This special exception to the GPL applies to versions of the Autoconf
27213b83913fSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
27223b83913fSmrg#   modified version of the Autoconf Macro, you may extend this special
27233b83913fSmrg#   exception to the GPL to apply to your modified version as well.#
27243b83913fSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27253b83913fSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
27263b83913fSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27273b83913fSmrgAS_LITERAL_IF([$1],
27283b83913fSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27293b83913fSmrg      ax_save_FLAGS=$LDFLAGS
27303b83913fSmrg      LDFLAGS="$1"
27313b83913fSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27323b83913fSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27333b83913fSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27343b83913fSmrg      LDFLAGS=$ax_save_FLAGS])],
27353b83913fSmrg  [ax_save_FLAGS=$LDFLAGS
27363b83913fSmrg   LDFLAGS="$1"
27373b83913fSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27383b83913fSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27393b83913fSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27403b83913fSmrg   LDFLAGS=$ax_save_FLAGS])
27413b83913fSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27423b83913fSmrgAC_MSG_RESULT($xorg_check_linker_flags)
27433b83913fSmrgif test "x$xorg_check_linker_flags" = xyes; then
27443b83913fSmrg	m4_default([$2], :)
27453b83913fSmrgelse
27463b83913fSmrg	m4_default([$3], :)
27473b83913fSmrgfi
27483b83913fSmrg]) # XORG_CHECK_LINKER_FLAGS
2749c918a7e2Smrg
27503b83913fSmrg# XORG_MEMORY_CHECK_FLAGS
27513b83913fSmrg# -----------------------
27523b83913fSmrg# Minimum version: 1.16.0
27533b83913fSmrg#
27543b83913fSmrg# This macro attempts to find appropriate memory checking functionality
27553b83913fSmrg# for various platforms which unit testing code may use to catch various
27563b83913fSmrg# forms of memory allocation and access errors in testing.
27573b83913fSmrg#
27583b83913fSmrg# Interface to module:
27593b83913fSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27603b83913fSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27613b83913fSmrg#
27623b83913fSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27633b83913fSmrg#
27643b83913fSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765a39bb051Smrg
27663b83913fSmrgAC_REQUIRE([AC_CANONICAL_HOST])
27673b83913fSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
27683b83913fSmrg           [Environment variables to enable memory checking in tests])
2769a39bb051Smrg
27703b83913fSmrg# Check for different types of support on different platforms
27713b83913fSmrgcase $host_os in
27723b83913fSmrg    solaris*)
27733b83913fSmrg        AC_CHECK_LIB([umem], [umem_alloc],
27743b83913fSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
27753b83913fSmrg        ;;
27763b83913fSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
27773b83913fSmrg        # both directly and inverted, so should not be 0 or 255.
27783b83913fSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
27793b83913fSmrg        ;;
27803b83913fSmrg    darwin*)
27813b83913fSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
27823b83913fSmrg        ;;
27833b83913fSmrg    *bsd*)
27843b83913fSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27853b83913fSmrg        ;;
27863b83913fSmrgesac
2787a39bb051Smrg
27883b83913fSmrg# User supplied flags override default flags
27893b83913fSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27903b83913fSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27919ef7378bSmrgfi
27929ef7378bSmrg
27933b83913fSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27943b83913fSmrg]) # XORG_WITH_LINT
2795a39bb051Smrg
27963b83913fSmrg# XORG_CHECK_MALLOC_ZERO
27973b83913fSmrg# ----------------------
27983b83913fSmrg# Minimum version: 1.0.0
27999ef7378bSmrg#
28003b83913fSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28013b83913fSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28023b83913fSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28033b83913fSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28043b83913fSmrgAC_ARG_ENABLE(malloc0returnsnull,
28053b83913fSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28063b83913fSmrg		       [malloc(0) returns NULL (default: auto)]),
28073b83913fSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28083b83913fSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809a39bb051Smrg
28103b83913fSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28113b83913fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28123b83913fSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28133b83913fSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28143b83913fSmrg#include <stdlib.h>
28153b83913fSmrg],[
28163b83913fSmrg    char *m0, *r0, *c0, *p;
28173b83913fSmrg    m0 = malloc(0);
28183b83913fSmrg    p = malloc(10);
28193b83913fSmrg    r0 = realloc(p,0);
28203b83913fSmrg    c0 = calloc(0,10);
28213b83913fSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28223b83913fSmrg])],
28233b83913fSmrg		[xorg_cv_malloc0_returns_null=yes],
28243b83913fSmrg		[xorg_cv_malloc0_returns_null=no])])
28253b83913fSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28269ef7378bSmrgfi
28273b83913fSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
28289ef7378bSmrg
28293b83913fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28303b83913fSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28313b83913fSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28323b83913fSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2833a39bb051Smrgelse
28343b83913fSmrg	MALLOC_ZERO_CFLAGS=""
28353b83913fSmrg	XMALLOC_ZERO_CFLAGS=""
28363b83913fSmrg	XTMALLOC_ZERO_CFLAGS=""
28379ef7378bSmrgfi
28389ef7378bSmrg
28393b83913fSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28403b83913fSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28413b83913fSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28423b83913fSmrg]) # XORG_CHECK_MALLOC_ZERO
28439ef7378bSmrg
28443b83913fSmrg# XORG_WITH_LINT()
28453b83913fSmrg# ----------------
28463b83913fSmrg# Minimum version: 1.1.0
28479ef7378bSmrg#
28483b83913fSmrg# This macro enables the use of a tool that flags some suspicious and
28493b83913fSmrg# non-portable constructs (likely to be bugs) in C language source code.
28503b83913fSmrg# It will attempt to locate the tool and use appropriate options.
28513b83913fSmrg# There are various lint type tools on different platforms.
28529ef7378bSmrg#
28533b83913fSmrg# Interface to module:
28543b83913fSmrg# LINT:		returns the path to the tool found on the platform
28553b83913fSmrg#		or the value set to LINT on the configure cmd line
28563b83913fSmrg#		also an Automake conditional
28573b83913fSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
28583b83913fSmrg#
28593b83913fSmrg# --with-lint:	'yes' user instructs the module to use lint
28603b83913fSmrg#		'no' user instructs the module not to use lint (default)
28613b83913fSmrg#
28623b83913fSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28633b83913fSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28643b83913fSmrg#
28653b83913fSmrgAC_DEFUN([XORG_WITH_LINT],[
2866a39bb051Smrg
28673b83913fSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
28683b83913fSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
28693b83913fSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
28703b83913fSmrg		[Use a lint-style source code checker (default: disabled)])],
28713b83913fSmrg		[use_lint=$withval], [use_lint=no])
2872a39bb051Smrg
28733b83913fSmrg# Obtain platform specific info like program name and options
28743b83913fSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
28753b83913fSmrgcase $host_os in
28763b83913fSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
28773b83913fSmrg	lint_name=splint
28783b83913fSmrg	lint_options="-badflag"
28793b83913fSmrg	;;
28803b83913fSmrg  *freebsd* | *netbsd*)
28813b83913fSmrg	lint_name=lint
28823b83913fSmrg	lint_options="-u -b"
28833b83913fSmrg	;;
28843b83913fSmrg  *solaris*)
28853b83913fSmrg	lint_name=lint
28863b83913fSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28873b83913fSmrg	;;
28883b83913fSmrgesac
28893b83913fSmrg
28903b83913fSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28913b83913fSmrgif test "x$use_lint" = x"yes" ; then
28923b83913fSmrg   AC_PATH_PROG([LINT], [$lint_name])
28933b83913fSmrg   if test "x$LINT" = "x"; then
28943b83913fSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28953b83913fSmrg   fi
28963b83913fSmrgelif test "x$use_lint" = x"no" ; then
28973b83913fSmrg   if test "x$LINT" != "x"; then
28983b83913fSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28993b83913fSmrg   fi
2900a39bb051Smrgelse
29013b83913fSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902a39bb051Smrgfi
2903a39bb051Smrg
29043b83913fSmrg# User supplied flags override default flags
29053b83913fSmrgif test "x$LINT_FLAGS" != "x"; then
29063b83913fSmrg   lint_options=$LINT_FLAGS
29073b83913fSmrgfi
2908a39bb051Smrg
29093b83913fSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29103b83913fSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911a39bb051Smrg
29123b83913fSmrg]) # XORG_WITH_LINT
2913a39bb051Smrg
29143b83913fSmrg# XORG_LINT_LIBRARY(LIBNAME)
29153b83913fSmrg# --------------------------
29163b83913fSmrg# Minimum version: 1.1.0
29179ef7378bSmrg#
29183b83913fSmrg# Sets up flags for building lint libraries for checking programs that call
29193b83913fSmrg# functions in the library.
29203b83913fSmrg#
29213b83913fSmrg# Interface to module:
29223b83913fSmrg# LINTLIB		- Automake variable with the name of lint library file to make
29233b83913fSmrg# MAKE_LINT_LIB		- Automake conditional
29243b83913fSmrg#
29253b83913fSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29263b83913fSmrg#			  - 'no' user instructs the module not to create a lint library (default)
29279ef7378bSmrg
29283b83913fSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29293b83913fSmrgAC_REQUIRE([XORG_WITH_LINT])
29303b83913fSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29313b83913fSmrg	[Create lint library (default: disabled)])],
29323b83913fSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
29333b83913fSmrg
29343b83913fSmrgif test "x$make_lint_lib" = x"yes" ; then
29353b83913fSmrg   LINTLIB=llib-l$1.ln
29363b83913fSmrg   if test "x$LINT" = "x"; then
29373b83913fSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29383b83913fSmrg   fi
29393b83913fSmrgelif test "x$make_lint_lib" != x"no" ; then
29403b83913fSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29419ef7378bSmrgfi
29429ef7378bSmrg
29433b83913fSmrgAC_SUBST(LINTLIB)
29443b83913fSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945a39bb051Smrg
29463b83913fSmrg]) # XORG_LINT_LIBRARY
29479ef7378bSmrg
29483b83913fSmrg# XORG_COMPILER_BRAND
2949a39bb051Smrg# -------------------
29503b83913fSmrg# Minimum version: 1.14.0
2951a39bb051Smrg#
29523b83913fSmrg# Checks for various brands of compilers and sets flags as appropriate:
29533b83913fSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29543b83913fSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29553b83913fSmrg#   clang compiler - sets CLANGCC to "yes"
29563b83913fSmrg#   Intel compiler - sets INTELCC to "yes"
29573b83913fSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29583b83913fSmrg#
29593b83913fSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29603b83913fSmrgAC_LANG_CASE(
29613b83913fSmrg	[C], [
29623b83913fSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29633b83913fSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
29643b83913fSmrg		m4_version_prereq([2.70],
29653b83913fSmrg			[AC_REQUIRE([AC_PROG_CC])],
29663b83913fSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
29673b83913fSmrg	],
29683b83913fSmrg	[C++], [
29693b83913fSmrg		AC_REQUIRE([AC_PROG_CXX])
29703b83913fSmrg	]
29713b83913fSmrg)
29723b83913fSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
29733b83913fSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
29743b83913fSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
29753b83913fSmrg]) # XORG_COMPILER_BRAND
29769ef7378bSmrg
29773b83913fSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2978a39bb051Smrg# ---------------
29793b83913fSmrg# Minimum version: 1.16.0
29803b83913fSmrg#
29813b83913fSmrg# Test if the compiler works when passed the given flag as a command line argument.
29823b83913fSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
29833b83913fSmrg# next flag in the list until there are no more options.
29843b83913fSmrg#
29853b83913fSmrg# Note that this does not guarantee that the compiler supports the flag as some
29863b83913fSmrg# compilers will simply ignore arguments that they do not understand, but we do
29873b83913fSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29883b83913fSmrg# -Werror=unused-command-line-argument
29893b83913fSmrg#
29903b83913fSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29913b83913fSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29923b83913fSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29939ef7378bSmrg
29943b83913fSmrgAC_LANG_COMPILER_REQUIRE
2995a39bb051Smrg
29963b83913fSmrgAC_LANG_CASE(
29973b83913fSmrg	[C], [
29983b83913fSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29993b83913fSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
30003b83913fSmrg		m4_version_prereq([2.70],
30013b83913fSmrg			[AC_REQUIRE([AC_PROG_CC])],
30023b83913fSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30033b83913fSmrg		define([PREFIX], [C])
30043b83913fSmrg		define([CACHE_PREFIX], [cc])
30053b83913fSmrg		define([COMPILER], [$CC])
30063b83913fSmrg	],
30073b83913fSmrg	[C++], [
30083b83913fSmrg		define([PREFIX], [CXX])
30093b83913fSmrg		define([CACHE_PREFIX], [cxx])
30103b83913fSmrg		define([COMPILER], [$CXX])
30113b83913fSmrg	]
30123b83913fSmrg)
30133b83913fSmrg
30143b83913fSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30153b83913fSmrg
30163b83913fSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30173b83913fSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30183b83913fSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30193b83913fSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30203b83913fSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30213b83913fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30223b83913fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30233b83913fSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30243b83913fSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3025a39bb051Smrgfi
30263b83913fSmrg
30273b83913fSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30283b83913fSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30293b83913fSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30303b83913fSmrg	fi
30313b83913fSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30323b83913fSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30333b83913fSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30343b83913fSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30353b83913fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30363b83913fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30373b83913fSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30383b83913fSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30393b83913fSmrgfi
30403b83913fSmrg
30413b83913fSmrgfound="no"
30423b83913fSmrgm4_foreach([flag], m4_cdr($@), [
30433b83913fSmrg	if test $found = "no" ; then
30443b83913fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30453b83913fSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30463b83913fSmrg		fi
30473b83913fSmrg
30483b83913fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30493b83913fSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30503b83913fSmrg		fi
30513b83913fSmrg
30523b83913fSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30533b83913fSmrg
30543b83913fSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30553b83913fSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30563b83913fSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30573b83913fSmrg		AC_CACHE_VAL($cacheid,
30583b83913fSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30593b83913fSmrg					     [eval $cacheid=yes],
30603b83913fSmrg					     [eval $cacheid=no])])
30613b83913fSmrg
30623b83913fSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30633b83913fSmrg
30643b83913fSmrg		eval supported=\$$cacheid
30653b83913fSmrg		AC_MSG_RESULT([$supported])
30663b83913fSmrg		if test "$supported" = "yes" ; then
30673b83913fSmrg			$1="$$1 ]flag["
30683b83913fSmrg			found="yes"
30693b83913fSmrg		fi
30703b83913fSmrg	fi
3071a39bb051Smrg])
30723b83913fSmrg]) # XORG_TESTSET_CFLAG
3073a39bb051Smrg
30743b83913fSmrg# XORG_COMPILER_FLAGS
30753b83913fSmrg# ---------------
30763b83913fSmrg# Minimum version: 1.16.0
30779ef7378bSmrg#
30783b83913fSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
30793b83913fSmrg# arguments supported by the selected compiler which do NOT alter the generated
30803b83913fSmrg# code.  These arguments will cause the compiler to print various warnings
30813b83913fSmrg# during compilation AND turn a conservative set of warnings into errors.
30823b83913fSmrg#
30833b83913fSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
30843b83913fSmrg# future versions of util-macros as options are added to new compilers.
30853b83913fSmrg#
30863b83913fSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
30873b83913fSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3088a39bb051Smrg
30893b83913fSmrgAC_ARG_ENABLE(selective-werror,
30903b83913fSmrg              AS_HELP_STRING([--disable-selective-werror],
30913b83913fSmrg                             [Turn off selective compiler errors. (default: enabled)]),
30923b83913fSmrg              [SELECTIVE_WERROR=$enableval],
30933b83913fSmrg              [SELECTIVE_WERROR=yes])
30943b83913fSmrg
30953b83913fSmrgAC_LANG_CASE(
30963b83913fSmrg        [C], [
30973b83913fSmrg                define([PREFIX], [C])
30983b83913fSmrg        ],
30993b83913fSmrg        [C++], [
31003b83913fSmrg                define([PREFIX], [CXX])
31013b83913fSmrg        ]
31023b83913fSmrg)
31033b83913fSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
31043b83913fSmrgif test "x$SUNCC" = "xyes"; then
31053b83913fSmrg    [BASE_]PREFIX[FLAGS]="-v"
3106a39bb051Smrgelse
31073b83913fSmrg    [BASE_]PREFIX[FLAGS]=""
3108a39bb051Smrgfi
3109a39bb051Smrg
31103b83913fSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31113b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31123b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31133b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31143b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3115a39bb051Smrg
31163b83913fSmrgAC_LANG_CASE(
31173b83913fSmrg	[C], [
31183b83913fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31193b83913fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31203b83913fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31213b83913fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31223b83913fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31233b83913fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31243b83913fSmrg	]
31253b83913fSmrg)
3126a39bb051Smrg
31273b83913fSmrg# This chunk adds additional warnings that could catch undesired effects.
31283b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31293b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31303b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31313b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31323b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31333b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31343b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
31359ef7378bSmrg
31363b83913fSmrg# These are currently disabled because they are noisy.  They will be enabled
31373b83913fSmrg# in the future once the codebase is sufficiently modernized to silence
31383b83913fSmrg# them.  For now, I don't want them to drown out the other warnings.
31393b83913fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31403b83913fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31413b83913fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
31429ef7378bSmrg
31433b83913fSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
31443b83913fSmrg# when there are problems that should be fixed.
31459ef7378bSmrg
31463b83913fSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31473b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31483b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31493b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31503b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31513b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31523b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31533b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31543b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31553b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31563b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31573b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31583b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31593b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31603b83913fSmrgelse
31613b83913fSmrgAC_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])
31623b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31633b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31643b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31653b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
31663b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
31673b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
31683b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
31693b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
31703b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
31713b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
31723b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
31733b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
31743b83913fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31753b83913fSmrgfi
31769ef7378bSmrg
31773b83913fSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31783b83913fSmrg]) # XORG_COMPILER_FLAGS
31799ef7378bSmrg
31803b83913fSmrg# XORG_CWARNFLAGS
31813b83913fSmrg# ---------------
31823b83913fSmrg# Minimum version: 1.2.0
31833b83913fSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3184a39bb051Smrg#
31853b83913fSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3186a39bb051Smrg#
31873b83913fSmrg# This function is deprecated because it defines -fno-strict-aliasing
31883b83913fSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
31893b83913fSmrg# is needed, then it should be added explicitly in the module when
31903b83913fSmrg# it is updated to use BASE_CFLAGS.
3191a39bb051Smrg#
31923b83913fSmrgAC_DEFUN([XORG_CWARNFLAGS], [
31933b83913fSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31943b83913fSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31953b83913fSmrgAC_LANG_CASE(
31963b83913fSmrg	[C], [
31973b83913fSmrg		CWARNFLAGS="$BASE_CFLAGS"
31983b83913fSmrg		if  test "x$GCC" = xyes ; then
31993b83913fSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
32003b83913fSmrg		fi
32013b83913fSmrg		AC_SUBST(CWARNFLAGS)
32023b83913fSmrg	]
32033b83913fSmrg)
32043b83913fSmrg]) # XORG_CWARNFLAGS
32059ef7378bSmrg
32063b83913fSmrg# XORG_STRICT_OPTION
32073b83913fSmrg# -----------------------
32083b83913fSmrg# Minimum version: 1.3.0
32093b83913fSmrg#
32103b83913fSmrg# Add configure option to enable strict compilation flags, such as treating
32113b83913fSmrg# warnings as fatal errors.
32123b83913fSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32133b83913fSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32143b83913fSmrg#
32153b83913fSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32163b83913fSmrg# when strict compilation is unconditionally desired.
32173b83913fSmrgAC_DEFUN([XORG_STRICT_OPTION], [
32183b83913fSmrgAC_REQUIRE([XORG_CWARNFLAGS])
32193b83913fSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32209ef7378bSmrg
32213b83913fSmrgAC_ARG_ENABLE(strict-compilation,
32223b83913fSmrg			  AS_HELP_STRING([--enable-strict-compilation],
32233b83913fSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32243b83913fSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3225a39bb051Smrg
32263b83913fSmrgAC_LANG_CASE(
32273b83913fSmrg        [C], [
32283b83913fSmrg                define([PREFIX], [C])
32293b83913fSmrg        ],
32303b83913fSmrg        [C++], [
32313b83913fSmrg                define([PREFIX], [CXX])
32323b83913fSmrg        ]
32333b83913fSmrg)
3234a39bb051Smrg
32353b83913fSmrg[STRICT_]PREFIX[FLAGS]=""
32363b83913fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32373b83913fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3238a39bb051Smrg
32393b83913fSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32403b83913fSmrg# activate it with -Werror, so we add it here explicitly.
32413b83913fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3242a39bb051Smrg
32433b83913fSmrgif test "x$STRICT_COMPILE" = "xyes"; then
32443b83913fSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32453b83913fSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32463b83913fSmrgfi
32473b83913fSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32483b83913fSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32493b83913fSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32503b83913fSmrg]) # XORG_STRICT_OPTION
3251a39bb051Smrg
32523b83913fSmrg# XORG_DEFAULT_NOCODE_OPTIONS
32533b83913fSmrg# ---------------------------
32543b83913fSmrg# Minimum version: 1.20.0
32553b83913fSmrg#
32563b83913fSmrg# Defines default options for X.Org modules which don't compile code,
32573b83913fSmrg# such as fonts, bitmaps, cursors, and docs.
32583b83913fSmrg#
32593b83913fSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
32603b83913fSmrgAC_REQUIRE([AC_PROG_INSTALL])
32613b83913fSmrgXORG_RELEASE_VERSION
32623b83913fSmrgXORG_CHANGELOG
32633b83913fSmrgXORG_INSTALL
32643b83913fSmrgXORG_MANPAGE_SECTIONS
32653b83913fSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32663b83913fSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32673b83913fSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3268a39bb051Smrg
32693b83913fSmrg# XORG_DEFAULT_OPTIONS
32703b83913fSmrg# --------------------
32713b83913fSmrg# Minimum version: 1.3.0
32723b83913fSmrg#
32733b83913fSmrg# Defines default options for X.Org modules which compile code.
32743b83913fSmrg#
32753b83913fSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
32763b83913fSmrgAC_REQUIRE([AC_PROG_INSTALL])
32773b83913fSmrgXORG_COMPILER_FLAGS
32783b83913fSmrgXORG_CWARNFLAGS
32793b83913fSmrgXORG_STRICT_OPTION
32803b83913fSmrgXORG_DEFAULT_NOCODE_OPTIONS
32813b83913fSmrg]) # XORG_DEFAULT_OPTIONS
32829ef7378bSmrg
32833b83913fSmrg# XORG_INSTALL()
32843b83913fSmrg# ----------------
32853b83913fSmrg# Minimum version: 1.4.0
32863b83913fSmrg#
32873b83913fSmrg# Defines the variable INSTALL_CMD as the command to copy
32883b83913fSmrg# INSTALL from $prefix/share/util-macros.
32893b83913fSmrg#
32903b83913fSmrgAC_DEFUN([XORG_INSTALL], [
32913b83913fSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
32923b83913fSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
32933b83913fSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
32943b83913fSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
32953b83913fSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
32963b83913fSmrgtouch \$(top_srcdir)/INSTALL; \
32973b83913fSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
32983b83913fSmrgAC_SUBST([INSTALL_CMD])
32993b83913fSmrg]) # XORG_INSTALL
33003b83913fSmrgdnl Copyright 2005 Red Hat, Inc
33013b83913fSmrgdnl
33023b83913fSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
33033b83913fSmrgdnl documentation for any purpose is hereby granted without fee, provided that
33043b83913fSmrgdnl the above copyright notice appear in all copies and that both that
33053b83913fSmrgdnl copyright notice and this permission notice appear in supporting
33063b83913fSmrgdnl documentation.
33073b83913fSmrgdnl
33083b83913fSmrgdnl The above copyright notice and this permission notice shall be included
33093b83913fSmrgdnl in all copies or substantial portions of the Software.
33103b83913fSmrgdnl
33113b83913fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33123b83913fSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33133b83913fSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33143b83913fSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
33153b83913fSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33163b83913fSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33173b83913fSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
33183b83913fSmrgdnl
33193b83913fSmrgdnl Except as contained in this notice, the name of the copyright holders shall
33203b83913fSmrgdnl not be used in advertising or otherwise to promote the sale, use or
33213b83913fSmrgdnl other dealings in this Software without prior written authorization
33223b83913fSmrgdnl from the copyright holders.
33233b83913fSmrgdnl
3324a39bb051Smrg
33253b83913fSmrg# XORG_RELEASE_VERSION
33263b83913fSmrg# --------------------
33273b83913fSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33289ef7378bSmrg
33293b83913fSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33303b83913fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33313b83913fSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33323b83913fSmrg		[Major version of this package])
33333b83913fSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33343b83913fSmrg	if test "x$PVM" = "x"; then
33353b83913fSmrg		PVM="0"
33363b83913fSmrg	fi
33373b83913fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33383b83913fSmrg		[$PVM],
33393b83913fSmrg		[Minor version of this package])
33403b83913fSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33413b83913fSmrg	if test "x$PVP" = "x"; then
33423b83913fSmrg		PVP="0"
33433b83913fSmrg	fi
33443b83913fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33453b83913fSmrg		[$PVP],
33463b83913fSmrg		[Patch version of this package])
33473b83913fSmrg])
33489ef7378bSmrg
33493b83913fSmrg# XORG_CHANGELOG()
33503b83913fSmrg# ----------------
33513b83913fSmrg# Minimum version: 1.2.0
33523b83913fSmrg#
33533b83913fSmrg# Defines the variable CHANGELOG_CMD as the command to generate
33543b83913fSmrg# ChangeLog from git.
33553b83913fSmrg#
33563b83913fSmrg#
33573b83913fSmrgAC_DEFUN([XORG_CHANGELOG], [
33583b83913fSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33593b83913fSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33603b83913fSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33613b83913fSmrgtouch \$(top_srcdir)/ChangeLog; \
33623b83913fSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33633b83913fSmrgAC_SUBST([CHANGELOG_CMD])
33643b83913fSmrg]) # XORG_CHANGELOG
33659ef7378bSmrg
3366