aclocal.m4 revision f303c8d5
1d67195daSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2b6f5cd12Smrg
3d67195daSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
41e00de39Smrg
51e00de39Smrg# This file is free software; the Free Software Foundation
61e00de39Smrg# gives unlimited permission to copy and/or distribute it,
71e00de39Smrg# with or without modifications, as long as this notice is preserved.
81e00de39Smrg
91e00de39Smrg# This program is distributed in the hope that it will be useful,
101e00de39Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
111e00de39Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
121e00de39Smrg# PARTICULAR PURPOSE.
131e00de39Smrg
14b6f5cd12Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
151e00de39Smrgm4_ifndef([AC_AUTOCONF_VERSION],
161e00de39Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17d67195daSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18d67195daSmrg[m4_warning([this file was generated for autoconf 2.71.
191e00de39SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
201e00de39SmrgIf you have problems, you may need to regenerate the build system entirely.
21b6f5cd12SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
221e00de39Smrg
23d67195daSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
241e00de39Smrg#
2521ecb1efSmrg# This file is free software; the Free Software Foundation
2621ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
2721ecb1efSmrg# with or without modifications, as long as this notice is preserved.
281e00de39Smrg
2921ecb1efSmrg# AM_AUTOMAKE_VERSION(VERSION)
3021ecb1efSmrg# ----------------------------
3121ecb1efSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3221ecb1efSmrg# generated from the m4 files accompanying Automake X.Y.
3321ecb1efSmrg# (This private macro should not be called outside this file.)
3421ecb1efSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35d67195daSmrg[am__api_version='1.16'
3621ecb1efSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3721ecb1efSmrgdnl require some minimum version.  Point them to the right macro.
38d67195daSmrgm4_if([$1], [1.16.5], [],
3921ecb1efSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4021ecb1efSmrg])
411e00de39Smrg
4221ecb1efSmrg# _AM_AUTOCONF_VERSION(VERSION)
4321ecb1efSmrg# -----------------------------
4421ecb1efSmrg# aclocal traces this macro to find the Autoconf version.
4521ecb1efSmrg# This is a private macro too.  Using m4_define simplifies
4621ecb1efSmrg# the logic in aclocal, which can simply ignore this definition.
4721ecb1efSmrgm4_define([_AM_AUTOCONF_VERSION], [])
481e00de39Smrg
4921ecb1efSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5021ecb1efSmrg# -------------------------------
5121ecb1efSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5221ecb1efSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5321ecb1efSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54d67195daSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5521ecb1efSmrgm4_ifndef([AC_AUTOCONF_VERSION],
5621ecb1efSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5721ecb1efSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
581e00de39Smrg
5921ecb1efSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
601e00de39Smrg
61d67195daSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6221ecb1efSmrg#
6321ecb1efSmrg# This file is free software; the Free Software Foundation
6421ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
6521ecb1efSmrg# with or without modifications, as long as this notice is preserved.
661e00de39Smrg
6721ecb1efSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68b6f5cd12Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69b6f5cd12Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
701e00de39Smrg#
7121ecb1efSmrg# Of course, Automake must honor this variable whenever it calls a
7221ecb1efSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7321ecb1efSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7421ecb1efSmrg# depending on how configure is run.  This is pretty annoying, since
7521ecb1efSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7621ecb1efSmrg# source directory, any form will work fine, but in subdirectories a
7721ecb1efSmrg# relative path needs to be adjusted first.
781e00de39Smrg#
7921ecb1efSmrg# $ac_aux_dir/missing
8021ecb1efSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8121ecb1efSmrg# $top_srcdir/$ac_aux_dir/missing
8221ecb1efSmrg#    fails if $ac_aux_dir is absolute,
8321ecb1efSmrg#    fails when called from a subdirectory in a VPATH build with
8421ecb1efSmrg#          a relative $ac_aux_dir
851e00de39Smrg#
8621ecb1efSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8721ecb1efSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
88b6f5cd12Smrg# harmless because $srcdir is '.', but things will broke when you
8921ecb1efSmrg# start a VPATH build or use an absolute $srcdir.
901e00de39Smrg#
9121ecb1efSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9221ecb1efSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9321ecb1efSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9421ecb1efSmrg# and then we would define $MISSING as
9521ecb1efSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9621ecb1efSmrg# This will work as long as MISSING is not called from configure, because
9721ecb1efSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9821ecb1efSmrg# However there are other variables, like CC, which are often used in
9921ecb1efSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10021ecb1efSmrg#
10121ecb1efSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10221ecb1efSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10321ecb1efSmrg# configured tree to be moved without reconfiguration.
1041e00de39Smrg
10521ecb1efSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10679bbd9e8Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10779bbd9e8Smrg# Expand $ac_aux_dir to an absolute path.
10879bbd9e8Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10921ecb1efSmrg])
1101e00de39Smrg
11121ecb1efSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1121e00de39Smrg
113d67195daSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11421ecb1efSmrg#
11521ecb1efSmrg# This file is free software; the Free Software Foundation
11621ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
11721ecb1efSmrg# with or without modifications, as long as this notice is preserved.
1181e00de39Smrg
11921ecb1efSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12021ecb1efSmrg# -------------------------------------
12121ecb1efSmrg# Define a conditional.
12221ecb1efSmrgAC_DEFUN([AM_CONDITIONAL],
123b6f5cd12Smrg[AC_PREREQ([2.52])dnl
124b6f5cd12Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125b6f5cd12Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12621ecb1efSmrgAC_SUBST([$1_TRUE])dnl
12721ecb1efSmrgAC_SUBST([$1_FALSE])dnl
12821ecb1efSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12921ecb1efSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13021ecb1efSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13121ecb1efSmrgif $2; then
13221ecb1efSmrg  $1_TRUE=
13321ecb1efSmrg  $1_FALSE='#'
13421ecb1efSmrgelse
13521ecb1efSmrg  $1_TRUE='#'
13621ecb1efSmrg  $1_FALSE=
13721ecb1efSmrgfi
13821ecb1efSmrgAC_CONFIG_COMMANDS_PRE(
13921ecb1efSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14021ecb1efSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14121ecb1efSmrgUsually this means the macro was only invoked conditionally.]])
14221ecb1efSmrgfi])])
1431e00de39Smrg
144d67195daSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14521ecb1efSmrg#
14621ecb1efSmrg# This file is free software; the Free Software Foundation
14721ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
14821ecb1efSmrg# with or without modifications, as long as this notice is preserved.
1491e00de39Smrg
1501e00de39Smrg
151b6f5cd12Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15221ecb1efSmrg# written in clear, in which case automake, when reading aclocal.m4,
15321ecb1efSmrg# will think it sees a *use*, and therefore will trigger all it's
15421ecb1efSmrg# C support machinery.  Also note that it means that autoscan, seeing
15521ecb1efSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1561e00de39Smrg
1571e00de39Smrg
15821ecb1efSmrg# _AM_DEPENDENCIES(NAME)
15921ecb1efSmrg# ----------------------
16021ecb1efSmrg# See how the compiler implements dependency checking.
161b6f5cd12Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16221ecb1efSmrg# We try a few techniques and use that to set a single cache variable.
1631e00de39Smrg#
16421ecb1efSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16521ecb1efSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16621ecb1efSmrg# dependency, and given that the user is not expected to run this macro,
16721ecb1efSmrg# just rely on AC_PROG_CC.
16821ecb1efSmrgAC_DEFUN([_AM_DEPENDENCIES],
16921ecb1efSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17021ecb1efSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17121ecb1efSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17221ecb1efSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1731e00de39Smrg
174b6f5cd12Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175b6f5cd12Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176b6f5cd12Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177b6f5cd12Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178b6f5cd12Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179b6f5cd12Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180b6f5cd12Smrg                    [depcc="$$1"   am_compiler_list=])
1811e00de39Smrg
18221ecb1efSmrgAC_CACHE_CHECK([dependency style of $depcc],
18321ecb1efSmrg               [am_cv_$1_dependencies_compiler_type],
18421ecb1efSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18521ecb1efSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
18621ecb1efSmrg  # making bogus files that we don't know about and never remove.  For
18721ecb1efSmrg  # instance it was reported that on HP-UX the gcc test will end up
188b6f5cd12Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189b6f5cd12Smrg  # in D".
190b6f5cd12Smrg  rm -rf conftest.dir
19121ecb1efSmrg  mkdir conftest.dir
19221ecb1efSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19321ecb1efSmrg  # using a relative directory.
19421ecb1efSmrg  cp "$am_depcomp" conftest.dir
19521ecb1efSmrg  cd conftest.dir
19621ecb1efSmrg  # We will build objects and dependencies in a subdirectory because
19721ecb1efSmrg  # it helps to detect inapplicable dependency modes.  For instance
19821ecb1efSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19921ecb1efSmrg  # side effect of compilation, but ICC will put the dependencies in
20021ecb1efSmrg  # the current directory while Tru64 will put them in the object
20121ecb1efSmrg  # directory.
20221ecb1efSmrg  mkdir sub
20321ecb1efSmrg
20421ecb1efSmrg  am_cv_$1_dependencies_compiler_type=none
20521ecb1efSmrg  if test "$am_compiler_list" = ""; then
20621ecb1efSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20721ecb1efSmrg  fi
20821ecb1efSmrg  am__universal=false
20921ecb1efSmrg  m4_case([$1], [CC],
21021ecb1efSmrg    [case " $depcc " in #(
21121ecb1efSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21221ecb1efSmrg     esac],
21321ecb1efSmrg    [CXX],
21421ecb1efSmrg    [case " $depcc " in #(
21521ecb1efSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21621ecb1efSmrg     esac])
21721ecb1efSmrg
21821ecb1efSmrg  for depmode in $am_compiler_list; do
21921ecb1efSmrg    # Setup a source with many dependencies, because some compilers
22021ecb1efSmrg    # like to wrap large dependency lists on column 80 (with \), and
22121ecb1efSmrg    # we should not choose a depcomp mode which is confused by this.
22221ecb1efSmrg    #
22321ecb1efSmrg    # We need to recreate these files for each test, as the compiler may
22421ecb1efSmrg    # overwrite some of them when testing with obscure command lines.
22521ecb1efSmrg    # This happens at least with the AIX C compiler.
22621ecb1efSmrg    : > sub/conftest.c
22721ecb1efSmrg    for i in 1 2 3 4 5 6; do
22821ecb1efSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229b6f5cd12Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230b6f5cd12Smrg      # Solaris 10 /bin/sh.
231b6f5cd12Smrg      echo '/* dummy */' > sub/conftst$i.h
23221ecb1efSmrg    done
23321ecb1efSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23421ecb1efSmrg
235b6f5cd12Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23621ecb1efSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237b6f5cd12Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238b6f5cd12Smrg    # versions had trouble with output in subdirs.
23921ecb1efSmrg    am__obj=sub/conftest.${OBJEXT-o}
24021ecb1efSmrg    am__minus_obj="-o $am__obj"
24121ecb1efSmrg    case $depmode in
24221ecb1efSmrg    gcc)
24321ecb1efSmrg      # This depmode causes a compiler race in universal mode.
24421ecb1efSmrg      test "$am__universal" = false || continue
24521ecb1efSmrg      ;;
24621ecb1efSmrg    nosideeffect)
247b6f5cd12Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248b6f5cd12Smrg      # only be used when explicitly requested.
24921ecb1efSmrg      if test "x$enable_dependency_tracking" = xyes; then
25021ecb1efSmrg	continue
25121ecb1efSmrg      else
25221ecb1efSmrg	break
25321ecb1efSmrg      fi
25421ecb1efSmrg      ;;
255b6f5cd12Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256b6f5cd12Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25721ecb1efSmrg      # not run yet.  These depmodes are late enough in the game, and
25821ecb1efSmrg      # so weak that their functioning should not be impacted.
25921ecb1efSmrg      am__obj=conftest.${OBJEXT-o}
26021ecb1efSmrg      am__minus_obj=
26121ecb1efSmrg      ;;
26221ecb1efSmrg    none) break ;;
26321ecb1efSmrg    esac
26421ecb1efSmrg    if depmode=$depmode \
26521ecb1efSmrg       source=sub/conftest.c object=$am__obj \
26621ecb1efSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26721ecb1efSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26821ecb1efSmrg         >/dev/null 2>conftest.err &&
26921ecb1efSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27021ecb1efSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27121ecb1efSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27221ecb1efSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27321ecb1efSmrg      # icc doesn't choke on unknown options, it will just issue warnings
27421ecb1efSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
27521ecb1efSmrg      # that says an option was ignored or not supported.
27621ecb1efSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27721ecb1efSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27821ecb1efSmrg      # The diagnosis changed in icc 8.0:
27921ecb1efSmrg      #   icc: Command line remark: option '-MP' not supported
28021ecb1efSmrg      if (grep 'ignoring option' conftest.err ||
28121ecb1efSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28221ecb1efSmrg        am_cv_$1_dependencies_compiler_type=$depmode
28321ecb1efSmrg        break
28421ecb1efSmrg      fi
28521ecb1efSmrg    fi
28621ecb1efSmrg  done
28721ecb1efSmrg
28821ecb1efSmrg  cd ..
28921ecb1efSmrg  rm -rf conftest.dir
2901e00de39Smrgelse
29121ecb1efSmrg  am_cv_$1_dependencies_compiler_type=none
2921e00de39Smrgfi
29321ecb1efSmrg])
29421ecb1efSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29521ecb1efSmrgAM_CONDITIONAL([am__fastdep$1], [
29621ecb1efSmrg  test "x$enable_dependency_tracking" != xno \
29721ecb1efSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29821ecb1efSmrg])
2991e00de39Smrg
30021ecb1efSmrg
30121ecb1efSmrg# AM_SET_DEPDIR
30221ecb1efSmrg# -------------
30321ecb1efSmrg# Choose a directory name for dependency files.
304b6f5cd12Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30521ecb1efSmrgAC_DEFUN([AM_SET_DEPDIR],
30621ecb1efSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30721ecb1efSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30821ecb1efSmrg])
30921ecb1efSmrg
31021ecb1efSmrg
31121ecb1efSmrg# AM_DEP_TRACK
31221ecb1efSmrg# ------------
31321ecb1efSmrgAC_DEFUN([AM_DEP_TRACK],
314b6f5cd12Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315b6f5cd12SmrgAS_HELP_STRING(
316b6f5cd12Smrg  [--enable-dependency-tracking],
317b6f5cd12Smrg  [do not reject slow dependency extractors])
318b6f5cd12SmrgAS_HELP_STRING(
319b6f5cd12Smrg  [--disable-dependency-tracking],
320b6f5cd12Smrg  [speeds up one-time build])])
32121ecb1efSmrgif test "x$enable_dependency_tracking" != xno; then
32221ecb1efSmrg  am_depcomp="$ac_aux_dir/depcomp"
32321ecb1efSmrg  AMDEPBACKSLASH='\'
324b6f5cd12Smrg  am__nodep='_no'
3251e00de39Smrgfi
32621ecb1efSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32721ecb1efSmrgAC_SUBST([AMDEPBACKSLASH])dnl
32821ecb1efSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329b6f5cd12SmrgAC_SUBST([am__nodep])dnl
330b6f5cd12Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33121ecb1efSmrg])
3321e00de39Smrg
33321ecb1efSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33421ecb1efSmrg
335d67195daSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3361e00de39Smrg#
33721ecb1efSmrg# This file is free software; the Free Software Foundation
33821ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
33921ecb1efSmrg# with or without modifications, as long as this notice is preserved.
3401e00de39Smrg
34121ecb1efSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34221ecb1efSmrg# ------------------------------
34321ecb1efSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34421ecb1efSmrg[{
345b6f5cd12Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34621ecb1efSmrg  # are listed without --file.  Let's play safe and only enable the eval
34721ecb1efSmrg  # if we detect the quoting.
348d67195daSmrg  # TODO: see whether this extra hack can be removed once we start
349d67195daSmrg  # requiring Autoconf 2.70 or later.
350d67195daSmrg  AS_CASE([$CONFIG_FILES],
351d67195daSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
352d67195daSmrg          [*], [set x $CONFIG_FILES])
35321ecb1efSmrg  shift
354d67195daSmrg  # Used to flag and report bootstrapping failures.
355d67195daSmrg  am_rc=0
356d67195daSmrg  for am_mf
35721ecb1efSmrg  do
35821ecb1efSmrg    # Strip MF so we end up with the name of the file.
359d67195daSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360d67195daSmrg    # Check whether this is an Automake generated Makefile which includes
361d67195daSmrg    # dependency-tracking related rules and includes.
362d67195daSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36321ecb1efSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
364d67195daSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365d67195daSmrg      || continue
366d67195daSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367d67195daSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368d67195daSmrg    AM_RUN_LOG([cd "$am_dirpart" \
369d67195daSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370d67195daSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37121ecb1efSmrg  done
372d67195daSmrg  if test $am_rc -ne 0; then
373d67195daSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374d67195daSmrg    for automatic dependency tracking.  If GNU make was not used, consider
375d67195daSmrg    re-running the configure script with MAKE="gmake" (or whatever is
376d67195daSmrg    necessary).  You can also try re-running configure with the
377d67195daSmrg    '--disable-dependency-tracking' option to at least be able to build
378d67195daSmrg    the package (albeit without support for automatic dependency tracking).])
379d67195daSmrg  fi
380d67195daSmrg  AS_UNSET([am_dirpart])
381d67195daSmrg  AS_UNSET([am_filepart])
382d67195daSmrg  AS_UNSET([am_mf])
383d67195daSmrg  AS_UNSET([am_rc])
384d67195daSmrg  rm -f conftest-deps.mk
38521ecb1efSmrg}
38621ecb1efSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3871e00de39Smrg
3881e00de39Smrg
38921ecb1efSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39021ecb1efSmrg# -----------------------------
39121ecb1efSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
39221ecb1efSmrg#
393d67195daSmrg# This code is only required when automatic dependency tracking is enabled.
394d67195daSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395d67195daSmrg# order to bootstrap the dependency handling code.
39621ecb1efSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39721ecb1efSmrg[AC_CONFIG_COMMANDS([depfiles],
39821ecb1efSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399d67195daSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4001e00de39Smrg
40121ecb1efSmrg# Do all the work for Automake.                             -*- Autoconf -*-
40221ecb1efSmrg
403d67195daSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40421ecb1efSmrg#
40521ecb1efSmrg# This file is free software; the Free Software Foundation
40621ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
40721ecb1efSmrg# with or without modifications, as long as this notice is preserved.
40821ecb1efSmrg
40921ecb1efSmrg# This macro actually does too much.  Some checks are only needed if
41021ecb1efSmrg# your package does certain things.  But this isn't really a big deal.
41121ecb1efSmrg
41279bbd9e8Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41379bbd9e8Smrgm4_define([AC_PROG_CC],
41479bbd9e8Smrgm4_defn([AC_PROG_CC])
41579bbd9e8Smrg[_AM_PROG_CC_C_O
41679bbd9e8Smrg])
41779bbd9e8Smrg
41821ecb1efSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41921ecb1efSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42021ecb1efSmrg# -----------------------------------------------
42121ecb1efSmrg# The call with PACKAGE and VERSION arguments is the old style
42221ecb1efSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42321ecb1efSmrg# and VERSION should now be passed to AC_INIT and removed from
42421ecb1efSmrg# the call to AM_INIT_AUTOMAKE.
42521ecb1efSmrg# We support both call styles for the transition.  After
42621ecb1efSmrg# the next Automake release, Autoconf can make the AC_INIT
42721ecb1efSmrg# arguments mandatory, and then we can depend on a new Autoconf
42821ecb1efSmrg# release and drop the old call support.
42921ecb1efSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430b6f5cd12Smrg[AC_PREREQ([2.65])dnl
431d67195daSmrgm4_ifdef([_$0_ALREADY_INIT],
432d67195daSmrg  [m4_fatal([$0 expanded multiple times
433d67195daSmrg]m4_defn([_$0_ALREADY_INIT]))],
434d67195daSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43521ecb1efSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43621ecb1efSmrgdnl the ones we care about.
43721ecb1efSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43821ecb1efSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43921ecb1efSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44021ecb1efSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44121ecb1efSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44221ecb1efSmrg  # is not polluted with repeated "-I."
44321ecb1efSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44421ecb1efSmrg  # test to see if srcdir already configured
44521ecb1efSmrg  if test -f $srcdir/config.status; then
44621ecb1efSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44721ecb1efSmrg  fi
4481e00de39Smrgfi
44921ecb1efSmrg
45021ecb1efSmrg# test whether we have cygpath
45121ecb1efSmrgif test -z "$CYGPATH_W"; then
45221ecb1efSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45321ecb1efSmrg    CYGPATH_W='cygpath -w'
45421ecb1efSmrg  else
45521ecb1efSmrg    CYGPATH_W=echo
45621ecb1efSmrg  fi
4571e00de39Smrgfi
45821ecb1efSmrgAC_SUBST([CYGPATH_W])
4591e00de39Smrg
46021ecb1efSmrg# Define the identity of the package.
46121ecb1efSmrgdnl Distinguish between old-style and new-style calls.
46221ecb1efSmrgm4_ifval([$2],
463b6f5cd12Smrg[AC_DIAGNOSE([obsolete],
464b6f5cd12Smrg             [$0: two- and three-arguments forms are deprecated.])
465b6f5cd12Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46621ecb1efSmrg AC_SUBST([PACKAGE], [$1])dnl
46721ecb1efSmrg AC_SUBST([VERSION], [$2])],
46821ecb1efSmrg[_AM_SET_OPTIONS([$1])dnl
46921ecb1efSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470b6f5cd12Smrgm4_if(
471d67195daSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472b6f5cd12Smrg  [ok:ok],,
47321ecb1efSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47421ecb1efSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47521ecb1efSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4761e00de39Smrg
47721ecb1efSmrg_AM_IF_OPTION([no-define],,
478b6f5cd12Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479b6f5cd12Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4801e00de39Smrg
48121ecb1efSmrg# Some tools Automake needs.
48221ecb1efSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48321ecb1efSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484b6f5cd12SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485b6f5cd12SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486b6f5cd12SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487b6f5cd12SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488b6f5cd12SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48921ecb1efSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49021ecb1efSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491b6f5cd12SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492b6f5cd12Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
493b6f5cd12Smrg# dies out for good.  For more background, see:
494d67195daSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495d67195daSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496b6f5cd12SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49779bbd9e8Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49879bbd9e8Smrg# system "awk" is bad on some platforms.
49921ecb1efSmrgAC_REQUIRE([AC_PROG_AWK])dnl
50021ecb1efSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50121ecb1efSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50221ecb1efSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50321ecb1efSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50421ecb1efSmrg			     [_AM_PROG_TAR([v7])])])
50521ecb1efSmrg_AM_IF_OPTION([no-dependencies],,
50621ecb1efSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507b6f5cd12Smrg		  [_AM_DEPENDENCIES([CC])],
508b6f5cd12Smrg		  [m4_define([AC_PROG_CC],
509b6f5cd12Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51021ecb1efSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511b6f5cd12Smrg		  [_AM_DEPENDENCIES([CXX])],
512b6f5cd12Smrg		  [m4_define([AC_PROG_CXX],
513b6f5cd12Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51421ecb1efSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515b6f5cd12Smrg		  [_AM_DEPENDENCIES([OBJC])],
516b6f5cd12Smrg		  [m4_define([AC_PROG_OBJC],
517b6f5cd12Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518b6f5cd12SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519b6f5cd12Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
520b6f5cd12Smrg		  [m4_define([AC_PROG_OBJCXX],
521b6f5cd12Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52221ecb1efSmrg])
523d67195daSmrg# Variables for tags utilities; see am/tags.am
524d67195daSmrgif test -z "$CTAGS"; then
525d67195daSmrg  CTAGS=ctags
526d67195daSmrgfi
527d67195daSmrgAC_SUBST([CTAGS])
528d67195daSmrgif test -z "$ETAGS"; then
529d67195daSmrg  ETAGS=etags
530d67195daSmrgfi
531d67195daSmrgAC_SUBST([ETAGS])
532d67195daSmrgif test -z "$CSCOPE"; then
533d67195daSmrg  CSCOPE=cscope
534d67195daSmrgfi
535d67195daSmrgAC_SUBST([CSCOPE])
536d67195daSmrg
537b6f5cd12SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
538b6f5cd12Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
539b6f5cd12Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540b6f5cd12Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54121ecb1efSmrgAC_CONFIG_COMMANDS_PRE(dnl
54221ecb1efSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54321ecb1efSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
54479bbd9e8Smrg
54579bbd9e8Smrg# POSIX will say in a future version that running "rm -f" with no argument
54679bbd9e8Smrg# is OK; and we want to be able to make that assumption in our Makefile
54779bbd9e8Smrg# recipes.  So use an aggressive probe to check that the usage we want is
54879bbd9e8Smrg# actually supported "in the wild" to an acceptable degree.
54979bbd9e8Smrg# See automake bug#10828.
55079bbd9e8Smrg# To make any issue more visible, cause the running configure to be aborted
55179bbd9e8Smrg# by default if the 'rm' program in use doesn't match our expectations; the
55279bbd9e8Smrg# user can still override this though.
55379bbd9e8Smrgif rm -f && rm -fr && rm -rf; then : OK; else
55479bbd9e8Smrg  cat >&2 <<'END'
55579bbd9e8SmrgOops!
55679bbd9e8Smrg
55779bbd9e8SmrgYour 'rm' program seems unable to run without file operands specified
55879bbd9e8Smrgon the command line, even when the '-f' option is present.  This is contrary
55979bbd9e8Smrgto the behaviour of most rm programs out there, and not conforming with
56079bbd9e8Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
56179bbd9e8Smrg
56279bbd9e8SmrgPlease tell bug-automake@gnu.org about your system, including the value
56379bbd9e8Smrgof your $PATH and any error possibly output before this message.  This
56479bbd9e8Smrgcan help us improve future automake versions.
56579bbd9e8Smrg
56679bbd9e8SmrgEND
56779bbd9e8Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56879bbd9e8Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56979bbd9e8Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57079bbd9e8Smrg    echo >&2
57179bbd9e8Smrg  else
57279bbd9e8Smrg    cat >&2 <<'END'
57379bbd9e8SmrgAborting the configuration process, to ensure you take notice of the issue.
57479bbd9e8Smrg
57579bbd9e8SmrgYou can download and install GNU coreutils to get an 'rm' implementation
576d67195daSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
57779bbd9e8Smrg
57879bbd9e8SmrgIf you want to complete the configuration process using your problematic
57979bbd9e8Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58079bbd9e8Smrgto "yes", and re-run configure.
58179bbd9e8Smrg
58279bbd9e8SmrgEND
58379bbd9e8Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58479bbd9e8Smrg  fi
58579bbd9e8Smrgfi
58679bbd9e8Smrgdnl The trailing newline in this macro's definition is deliberate, for
58779bbd9e8Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58879bbd9e8Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58921ecb1efSmrg])
5901e00de39Smrg
591b6f5cd12Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59221ecb1efSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59321ecb1efSmrgdnl mangled by Autoconf and run in a shell conditional statement.
59421ecb1efSmrgm4_define([_AC_COMPILER_EXEEXT],
59521ecb1efSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5961e00de39Smrg
59721ecb1efSmrg# When config.status generates a header, we must update the stamp-h file.
59821ecb1efSmrg# This file resides in the same directory as the config header
59921ecb1efSmrg# that is generated.  The stamp files are numbered to have different names.
60021ecb1efSmrg
60121ecb1efSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60221ecb1efSmrg# loop where config.status creates the headers, so we can generate
60321ecb1efSmrg# our stamp files there.
60421ecb1efSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60521ecb1efSmrg[# Compute $1's index in $config_headers.
60621ecb1efSmrg_am_arg=$1
60721ecb1efSmrg_am_stamp_count=1
60821ecb1efSmrgfor _am_header in $config_headers :; do
60921ecb1efSmrg  case $_am_header in
61021ecb1efSmrg    $_am_arg | $_am_arg:* )
61121ecb1efSmrg      break ;;
61221ecb1efSmrg    * )
61321ecb1efSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61421ecb1efSmrg  esac
61521ecb1efSmrgdone
61621ecb1efSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
61721ecb1efSmrg
618d67195daSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61921ecb1efSmrg#
62021ecb1efSmrg# This file is free software; the Free Software Foundation
62121ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
62221ecb1efSmrg# with or without modifications, as long as this notice is preserved.
6231e00de39Smrg
62421ecb1efSmrg# AM_PROG_INSTALL_SH
62521ecb1efSmrg# ------------------
62621ecb1efSmrg# Define $install_sh.
62721ecb1efSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62821ecb1efSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62979bbd9e8Smrgif test x"${install_sh+set}" != xset; then
63021ecb1efSmrg  case $am_aux_dir in
63121ecb1efSmrg  *\ * | *\	*)
63221ecb1efSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63321ecb1efSmrg  *)
63421ecb1efSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63521ecb1efSmrg  esac
6361e00de39Smrgfi
637b6f5cd12SmrgAC_SUBST([install_sh])])
6381e00de39Smrg
639d67195daSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64021ecb1efSmrg#
64121ecb1efSmrg# This file is free software; the Free Software Foundation
64221ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
64321ecb1efSmrg# with or without modifications, as long as this notice is preserved.
6441e00de39Smrg
64521ecb1efSmrg# Check whether the underlying file-system supports filenames
64621ecb1efSmrg# with a leading dot.  For instance MS-DOS doesn't.
64721ecb1efSmrgAC_DEFUN([AM_SET_LEADING_DOT],
64821ecb1efSmrg[rm -rf .tst 2>/dev/null
64921ecb1efSmrgmkdir .tst 2>/dev/null
65021ecb1efSmrgif test -d .tst; then
65121ecb1efSmrg  am__leading_dot=.
6521e00de39Smrgelse
65321ecb1efSmrg  am__leading_dot=_
6541e00de39Smrgfi
65521ecb1efSmrgrmdir .tst 2>/dev/null
65621ecb1efSmrgAC_SUBST([am__leading_dot])])
6571e00de39Smrg
65821ecb1efSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6591e00de39Smrg
660d67195daSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66121ecb1efSmrg#
66221ecb1efSmrg# This file is free software; the Free Software Foundation
66321ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
66421ecb1efSmrg# with or without modifications, as long as this notice is preserved.
6651e00de39Smrg
66621ecb1efSmrg# AM_MAKE_INCLUDE()
66721ecb1efSmrg# -----------------
668d67195daSmrg# Check whether make has an 'include' directive that can support all
669d67195daSmrg# the idioms we need for our automatic dependency tracking code.
67021ecb1efSmrgAC_DEFUN([AM_MAKE_INCLUDE],
671d67195daSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672d67195daSmrgcat > confinc.mk << 'END'
67321ecb1efSmrgam__doit:
674d67195daSmrg	@echo this is the am__doit target >confinc.out
67521ecb1efSmrg.PHONY: am__doit
67621ecb1efSmrgEND
67721ecb1efSmrgam__include="#"
67821ecb1efSmrgam__quote=
679d67195daSmrg# BSD make does it like this.
680d67195daSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681d67195daSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682d67195daSmrgecho 'include confinc.mk # ignored' > confmf.GNU
683d67195daSmrg_am_result=no
684d67195daSmrgfor s in GNU BSD; do
685d67195daSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686d67195daSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687d67195daSmrg      ['0:this is the am__doit target'],
688d67195daSmrg      [AS_CASE([$s],
689d67195daSmrg          [BSD], [am__include='.include' am__quote='"'],
690d67195daSmrg          [am__include='include' am__quote=''])])
691d67195daSmrg  if test "$am__include" != "#"; then
692d67195daSmrg    _am_result="yes ($s style)"
693d67195daSmrg    break
694d67195daSmrg  fi
695d67195daSmrgdone
696d67195daSmrgrm -f confinc.* confmf.*
697d67195daSmrgAC_MSG_RESULT([${_am_result}])
698d67195daSmrgAC_SUBST([am__include])])
699d67195daSmrgAC_SUBST([am__quote])])
7001e00de39Smrg
70121ecb1efSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7021e00de39Smrg
703d67195daSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
70421ecb1efSmrg#
70521ecb1efSmrg# This file is free software; the Free Software Foundation
70621ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
70721ecb1efSmrg# with or without modifications, as long as this notice is preserved.
7081e00de39Smrg
70921ecb1efSmrg# AM_MISSING_PROG(NAME, PROGRAM)
71021ecb1efSmrg# ------------------------------
71121ecb1efSmrgAC_DEFUN([AM_MISSING_PROG],
71221ecb1efSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71321ecb1efSmrg$1=${$1-"${am_missing_run}$2"}
71421ecb1efSmrgAC_SUBST($1)])
7151e00de39Smrg
71621ecb1efSmrg# AM_MISSING_HAS_RUN
71721ecb1efSmrg# ------------------
718b6f5cd12Smrg# Define MISSING if not defined so far and test if it is modern enough.
719b6f5cd12Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72021ecb1efSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72121ecb1efSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72221ecb1efSmrgAC_REQUIRE_AUX_FILE([missing])dnl
72321ecb1efSmrgif test x"${MISSING+set}" != xset; then
724d67195daSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
7251e00de39Smrgfi
72621ecb1efSmrg# Use eval to expand $SHELL
727b6f5cd12Smrgif eval "$MISSING --is-lightweight"; then
728b6f5cd12Smrg  am_missing_run="$MISSING "
7291e00de39Smrgelse
73021ecb1efSmrg  am_missing_run=
731b6f5cd12Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7321e00de39Smrgfi
73321ecb1efSmrg])
7341e00de39Smrg
73521ecb1efSmrg# Helper functions for option handling.                     -*- Autoconf -*-
7361e00de39Smrg
737d67195daSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
7381e00de39Smrg#
73921ecb1efSmrg# This file is free software; the Free Software Foundation
74021ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
74121ecb1efSmrg# with or without modifications, as long as this notice is preserved.
7421e00de39Smrg
74321ecb1efSmrg# _AM_MANGLE_OPTION(NAME)
74421ecb1efSmrg# -----------------------
74521ecb1efSmrgAC_DEFUN([_AM_MANGLE_OPTION],
74621ecb1efSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7471e00de39Smrg
74821ecb1efSmrg# _AM_SET_OPTION(NAME)
749b6f5cd12Smrg# --------------------
75021ecb1efSmrg# Set option NAME.  Presently that only means defining a flag for this option.
75121ecb1efSmrgAC_DEFUN([_AM_SET_OPTION],
752b6f5cd12Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7531e00de39Smrg
75421ecb1efSmrg# _AM_SET_OPTIONS(OPTIONS)
755b6f5cd12Smrg# ------------------------
75621ecb1efSmrg# OPTIONS is a space-separated list of Automake options.
75721ecb1efSmrgAC_DEFUN([_AM_SET_OPTIONS],
75821ecb1efSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75921ecb1efSmrg
76021ecb1efSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76121ecb1efSmrg# -------------------------------------------
76221ecb1efSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76321ecb1efSmrgAC_DEFUN([_AM_IF_OPTION],
76421ecb1efSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76521ecb1efSmrg
766d67195daSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
76779bbd9e8Smrg#
76879bbd9e8Smrg# This file is free software; the Free Software Foundation
76979bbd9e8Smrg# gives unlimited permission to copy and/or distribute it,
77079bbd9e8Smrg# with or without modifications, as long as this notice is preserved.
77179bbd9e8Smrg
77279bbd9e8Smrg# _AM_PROG_CC_C_O
77379bbd9e8Smrg# ---------------
77479bbd9e8Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77579bbd9e8Smrg# to automatically call this.
77679bbd9e8SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77779bbd9e8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77879bbd9e8SmrgAC_REQUIRE_AUX_FILE([compile])dnl
77979bbd9e8SmrgAC_LANG_PUSH([C])dnl
78079bbd9e8SmrgAC_CACHE_CHECK(
78179bbd9e8Smrg  [whether $CC understands -c and -o together],
78279bbd9e8Smrg  [am_cv_prog_cc_c_o],
78379bbd9e8Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78479bbd9e8Smrg  # Make sure it works both with $CC and with simple cc.
78579bbd9e8Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78679bbd9e8Smrg  # compilers refuse to overwrite an existing .o file with -o,
78779bbd9e8Smrg  # though they will create one.
78879bbd9e8Smrg  am_cv_prog_cc_c_o=yes
78979bbd9e8Smrg  for am_i in 1 2; do
79079bbd9e8Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79179bbd9e8Smrg         && test -f conftest2.$ac_objext; then
79279bbd9e8Smrg      : OK
79379bbd9e8Smrg    else
79479bbd9e8Smrg      am_cv_prog_cc_c_o=no
79579bbd9e8Smrg      break
79679bbd9e8Smrg    fi
79779bbd9e8Smrg  done
79879bbd9e8Smrg  rm -f core conftest*
79979bbd9e8Smrg  unset am_i])
80079bbd9e8Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80179bbd9e8Smrg   # Losing compiler, so override with the script.
80279bbd9e8Smrg   # FIXME: It is wrong to rewrite CC.
80379bbd9e8Smrg   # But if we don't then we get into trouble of one sort or another.
80479bbd9e8Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80579bbd9e8Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80679bbd9e8Smrg   CC="$am_aux_dir/compile $CC"
80779bbd9e8Smrgfi
80879bbd9e8SmrgAC_LANG_POP([C])])
80979bbd9e8Smrg
81079bbd9e8Smrg# For backward compatibility.
81179bbd9e8SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
81279bbd9e8Smrg
813d67195daSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
81479bbd9e8Smrg#
81579bbd9e8Smrg# This file is free software; the Free Software Foundation
81679bbd9e8Smrg# gives unlimited permission to copy and/or distribute it,
81779bbd9e8Smrg# with or without modifications, as long as this notice is preserved.
81879bbd9e8Smrg
81979bbd9e8Smrg# AM_RUN_LOG(COMMAND)
82079bbd9e8Smrg# -------------------
82179bbd9e8Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82279bbd9e8Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82379bbd9e8SmrgAC_DEFUN([AM_RUN_LOG],
82479bbd9e8Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82579bbd9e8Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82679bbd9e8Smrg   ac_status=$?
82779bbd9e8Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82879bbd9e8Smrg   (exit $ac_status); }])
82979bbd9e8Smrg
83021ecb1efSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8311e00de39Smrg
832d67195daSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8331e00de39Smrg#
8341e00de39Smrg# This file is free software; the Free Software Foundation
8351e00de39Smrg# gives unlimited permission to copy and/or distribute it,
8361e00de39Smrg# with or without modifications, as long as this notice is preserved.
8371e00de39Smrg
83821ecb1efSmrg# AM_SANITY_CHECK
83921ecb1efSmrg# ---------------
84021ecb1efSmrgAC_DEFUN([AM_SANITY_CHECK],
84121ecb1efSmrg[AC_MSG_CHECKING([whether build environment is sane])
84221ecb1efSmrg# Reject unsafe characters in $srcdir or the absolute working directory
84321ecb1efSmrg# name.  Accept space and tab only in the latter.
84421ecb1efSmrgam_lf='
84521ecb1efSmrg'
84621ecb1efSmrgcase `pwd` in
84721ecb1efSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84821ecb1efSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84921ecb1efSmrgesac
85021ecb1efSmrgcase $srcdir in
85121ecb1efSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
852b6f5cd12Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85321ecb1efSmrgesac
8541e00de39Smrg
855b6f5cd12Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85621ecb1efSmrg# arguments.  Must try -L first in case configure is actually a
85721ecb1efSmrg# symlink; some systems play weird games with the mod time of symlinks
85821ecb1efSmrg# (eg FreeBSD returns the mod time of the symlink's containing
85921ecb1efSmrg# directory).
86021ecb1efSmrgif (
861b6f5cd12Smrg   am_has_slept=no
862b6f5cd12Smrg   for am_try in 1 2; do
863b6f5cd12Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
864b6f5cd12Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
865b6f5cd12Smrg     if test "$[*]" = "X"; then
866b6f5cd12Smrg	# -L didn't work.
867b6f5cd12Smrg	set X `ls -t "$srcdir/configure" conftest.file`
868b6f5cd12Smrg     fi
869b6f5cd12Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
870b6f5cd12Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
871b6f5cd12Smrg
872b6f5cd12Smrg	# If neither matched, then we have a broken ls.  This can happen
873b6f5cd12Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
874b6f5cd12Smrg	# broken ls alias from the environment.  This has actually
875b6f5cd12Smrg	# happened.  Such a system could not be considered "sane".
876b6f5cd12Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
877b6f5cd12Smrg  alias in your environment])
878b6f5cd12Smrg     fi
879b6f5cd12Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
880b6f5cd12Smrg       break
881b6f5cd12Smrg     fi
882b6f5cd12Smrg     # Just in case.
883b6f5cd12Smrg     sleep 1
884b6f5cd12Smrg     am_has_slept=yes
885b6f5cd12Smrg   done
88621ecb1efSmrg   test "$[2]" = conftest.file
88721ecb1efSmrg   )
88821ecb1efSmrgthen
88921ecb1efSmrg   # Ok.
89021ecb1efSmrg   :
89121ecb1efSmrgelse
89221ecb1efSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
89321ecb1efSmrgCheck your system clock])
89421ecb1efSmrgfi
895b6f5cd12SmrgAC_MSG_RESULT([yes])
896b6f5cd12Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
897b6f5cd12Smrg# generated files are strictly newer.
898b6f5cd12Smrgam_sleep_pid=
899b6f5cd12Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
900b6f5cd12Smrg  ( sleep 1 ) &
901b6f5cd12Smrg  am_sleep_pid=$!
902b6f5cd12Smrgfi
903b6f5cd12SmrgAC_CONFIG_COMMANDS_PRE(
904b6f5cd12Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
905b6f5cd12Smrg   if test -n "$am_sleep_pid"; then
906b6f5cd12Smrg     # Hide warnings about reused PIDs.
907b6f5cd12Smrg     wait $am_sleep_pid 2>/dev/null
908b6f5cd12Smrg   fi
909b6f5cd12Smrg   AC_MSG_RESULT([done])])
910b6f5cd12Smrgrm -f conftest.file
911b6f5cd12Smrg])
91221ecb1efSmrg
913d67195daSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9141e00de39Smrg#
9151e00de39Smrg# This file is free software; the Free Software Foundation
9161e00de39Smrg# gives unlimited permission to copy and/or distribute it,
9171e00de39Smrg# with or without modifications, as long as this notice is preserved.
9181e00de39Smrg
91921ecb1efSmrg# AM_SILENT_RULES([DEFAULT])
92021ecb1efSmrg# --------------------------
92121ecb1efSmrg# Enable less verbose build rules; with the default set to DEFAULT
922b6f5cd12Smrg# ("yes" being less verbose, "no" or empty being verbose).
92321ecb1efSmrgAC_DEFUN([AM_SILENT_RULES],
924b6f5cd12Smrg[AC_ARG_ENABLE([silent-rules], [dnl
925b6f5cd12SmrgAS_HELP_STRING(
926b6f5cd12Smrg  [--enable-silent-rules],
927b6f5cd12Smrg  [less verbose build output (undo: "make V=1")])
928b6f5cd12SmrgAS_HELP_STRING(
929b6f5cd12Smrg  [--disable-silent-rules],
930b6f5cd12Smrg  [verbose build output (undo: "make V=0")])dnl
931b6f5cd12Smrg])
932b6f5cd12Smrgcase $enable_silent_rules in @%:@ (((
933b6f5cd12Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
934b6f5cd12Smrg   no) AM_DEFAULT_VERBOSITY=1;;
935b6f5cd12Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93621ecb1efSmrgesac
937b6f5cd12Smrgdnl
938b6f5cd12Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
939b6f5cd12Smrgdnl do not support nested variable expansions.
940b6f5cd12Smrgdnl See automake bug#9928 and bug#10237.
941b6f5cd12Smrgam_make=${MAKE-make}
942b6f5cd12SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
943b6f5cd12Smrg   [am_cv_make_support_nested_variables],
944b6f5cd12Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
945b6f5cd12SmrgBAR0=false
946b6f5cd12SmrgBAR1=true
947b6f5cd12SmrgV=1
948b6f5cd12Smrgam__doit:
949b6f5cd12Smrg	@$(TRUE)
950b6f5cd12Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
951b6f5cd12Smrg  am_cv_make_support_nested_variables=yes
952b6f5cd12Smrgelse
953b6f5cd12Smrg  am_cv_make_support_nested_variables=no
954b6f5cd12Smrgfi])
955b6f5cd12Smrgif test $am_cv_make_support_nested_variables = yes; then
956b6f5cd12Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
957b6f5cd12Smrg  AM_V='$(V)'
958b6f5cd12Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
959b6f5cd12Smrgelse
960b6f5cd12Smrg  AM_V=$AM_DEFAULT_VERBOSITY
961b6f5cd12Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962b6f5cd12Smrgfi
963b6f5cd12SmrgAC_SUBST([AM_V])dnl
964b6f5cd12SmrgAM_SUBST_NOTMAKE([AM_V])dnl
965b6f5cd12SmrgAC_SUBST([AM_DEFAULT_V])dnl
966b6f5cd12SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96721ecb1efSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96821ecb1efSmrgAM_BACKSLASH='\'
96921ecb1efSmrgAC_SUBST([AM_BACKSLASH])dnl
97021ecb1efSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9711e00de39Smrg])
9721e00de39Smrg
973d67195daSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
97421ecb1efSmrg#
97521ecb1efSmrg# This file is free software; the Free Software Foundation
97621ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
97721ecb1efSmrg# with or without modifications, as long as this notice is preserved.
97821ecb1efSmrg
97921ecb1efSmrg# AM_PROG_INSTALL_STRIP
98021ecb1efSmrg# ---------------------
981b6f5cd12Smrg# One issue with vendor 'install' (even GNU) is that you can't
98221ecb1efSmrg# specify the program used to strip binaries.  This is especially
98321ecb1efSmrg# annoying in cross-compiling environments, where the build's strip
98421ecb1efSmrg# is unlikely to handle the host's binaries.
98521ecb1efSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
986b6f5cd12Smrg# always use install-sh in "make install-strip", and initialize
98721ecb1efSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
98821ecb1efSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98921ecb1efSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
990b6f5cd12Smrg# Installed binaries are usually stripped using 'strip' when the user
991b6f5cd12Smrg# run "make install-strip".  However 'strip' might not be the right
99221ecb1efSmrg# tool to use in cross-compilation environments, therefore Automake
993b6f5cd12Smrg# will honor the 'STRIP' environment variable to overrule this program.
994b6f5cd12Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99521ecb1efSmrgif test "$cross_compiling" != no; then
99621ecb1efSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
99721ecb1efSmrgfi
99821ecb1efSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99921ecb1efSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10001e00de39Smrg
1001d67195daSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
10021e00de39Smrg#
10031e00de39Smrg# This file is free software; the Free Software Foundation
10041e00de39Smrg# gives unlimited permission to copy and/or distribute it,
10051e00de39Smrg# with or without modifications, as long as this notice is preserved.
10061e00de39Smrg
100721ecb1efSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
100821ecb1efSmrg# ---------------------------
100921ecb1efSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101021ecb1efSmrg# This macro is traced by Automake.
101121ecb1efSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10121e00de39Smrg
101321ecb1efSmrg# AM_SUBST_NOTMAKE(VARIABLE)
1014b6f5cd12Smrg# --------------------------
101521ecb1efSmrg# Public sister of _AM_SUBST_NOTMAKE.
101621ecb1efSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101721ecb1efSmrg
101821ecb1efSmrg# Check how to create a tarball.                            -*- Autoconf -*-
101921ecb1efSmrg
1020d67195daSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
10211e00de39Smrg#
10221e00de39Smrg# This file is free software; the Free Software Foundation
10231e00de39Smrg# gives unlimited permission to copy and/or distribute it,
10241e00de39Smrg# with or without modifications, as long as this notice is preserved.
10251e00de39Smrg
102621ecb1efSmrg# _AM_PROG_TAR(FORMAT)
102721ecb1efSmrg# --------------------
102821ecb1efSmrg# Check how to create a tarball in format FORMAT.
1029b6f5cd12Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10301e00de39Smrg#
103121ecb1efSmrg# Substitute a variable $(am__tar) that is a command
103221ecb1efSmrg# writing to stdout a FORMAT-tarball containing the directory
103321ecb1efSmrg# $tardir.
103421ecb1efSmrg#     tardir=directory && $(am__tar) > result.tar
103521ecb1efSmrg#
103621ecb1efSmrg# Substitute a variable $(am__untar) that extract such
103721ecb1efSmrg# a tarball read from stdin.
103821ecb1efSmrg#     $(am__untar) < result.tar
1039b6f5cd12Smrg#
104021ecb1efSmrgAC_DEFUN([_AM_PROG_TAR],
1041b6f5cd12Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1042b6f5cd12Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1043b6f5cd12SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044b6f5cd12Smrg
1045b6f5cd12Smrg# We'll loop over all known methods to create a tar archive until one works.
104621ecb1efSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10471e00de39Smrg
1048b6f5cd12Smrgm4_if([$1], [v7],
1049b6f5cd12Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050b6f5cd12Smrg
1051b6f5cd12Smrg  [m4_case([$1],
1052b6f5cd12Smrg    [ustar],
1053b6f5cd12Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1054b6f5cd12Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1055b6f5cd12Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1056b6f5cd12Smrg      # and bug#13588).
1057b6f5cd12Smrg      am_max_uid=2097151 # 2^21 - 1
1058b6f5cd12Smrg      am_max_gid=$am_max_uid
1059b6f5cd12Smrg      # The $UID and $GID variables are not portable, so we need to resort
1060b6f5cd12Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1061b6f5cd12Smrg      # below are definitely unexpected, so allow the users to see them
1062b6f5cd12Smrg      # (that is, avoid stderr redirection).
1063b6f5cd12Smrg      am_uid=`id -u || echo unknown`
1064b6f5cd12Smrg      am_gid=`id -g || echo unknown`
1065b6f5cd12Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1066b6f5cd12Smrg      if test $am_uid -le $am_max_uid; then
1067b6f5cd12Smrg         AC_MSG_RESULT([yes])
1068b6f5cd12Smrg      else
1069b6f5cd12Smrg         AC_MSG_RESULT([no])
1070b6f5cd12Smrg         _am_tools=none
1071b6f5cd12Smrg      fi
1072b6f5cd12Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1073b6f5cd12Smrg      if test $am_gid -le $am_max_gid; then
1074b6f5cd12Smrg         AC_MSG_RESULT([yes])
1075b6f5cd12Smrg      else
1076b6f5cd12Smrg        AC_MSG_RESULT([no])
1077b6f5cd12Smrg        _am_tools=none
1078b6f5cd12Smrg      fi],
1079b6f5cd12Smrg
1080b6f5cd12Smrg  [pax],
1081b6f5cd12Smrg    [],
1082b6f5cd12Smrg
1083b6f5cd12Smrg  [m4_fatal([Unknown tar format])])
1084b6f5cd12Smrg
1085b6f5cd12Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086b6f5cd12Smrg
1087b6f5cd12Smrg  # Go ahead even if we have the value already cached.  We do so because we
1088b6f5cd12Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1089b6f5cd12Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090b6f5cd12Smrg
1091b6f5cd12Smrg  for _am_tool in $_am_tools; do
1092b6f5cd12Smrg    case $_am_tool in
1093b6f5cd12Smrg    gnutar)
1094b6f5cd12Smrg      for _am_tar in tar gnutar gtar; do
1095b6f5cd12Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1096b6f5cd12Smrg      done
1097b6f5cd12Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1098b6f5cd12Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1099b6f5cd12Smrg      am__untar="$_am_tar -xf -"
1100b6f5cd12Smrg      ;;
1101b6f5cd12Smrg    plaintar)
1102b6f5cd12Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1103b6f5cd12Smrg      # ustar tarball either.
1104b6f5cd12Smrg      (tar --version) >/dev/null 2>&1 && continue
1105b6f5cd12Smrg      am__tar='tar chf - "$$tardir"'
1106b6f5cd12Smrg      am__tar_='tar chf - "$tardir"'
1107b6f5cd12Smrg      am__untar='tar xf -'
1108b6f5cd12Smrg      ;;
1109b6f5cd12Smrg    pax)
1110b6f5cd12Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1111b6f5cd12Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1112b6f5cd12Smrg      am__untar='pax -r'
1113b6f5cd12Smrg      ;;
1114b6f5cd12Smrg    cpio)
1115b6f5cd12Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1116b6f5cd12Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1117b6f5cd12Smrg      am__untar='cpio -i -H $1 -d'
1118b6f5cd12Smrg      ;;
1119b6f5cd12Smrg    none)
1120b6f5cd12Smrg      am__tar=false
1121b6f5cd12Smrg      am__tar_=false
1122b6f5cd12Smrg      am__untar=false
1123b6f5cd12Smrg      ;;
1124b6f5cd12Smrg    esac
11251e00de39Smrg
1126b6f5cd12Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1127b6f5cd12Smrg    # and am__untar set.
1128b6f5cd12Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129b6f5cd12Smrg
1130b6f5cd12Smrg    # tar/untar a dummy directory, and stop if the command works.
1131b6f5cd12Smrg    rm -rf conftest.dir
1132b6f5cd12Smrg    mkdir conftest.dir
1133b6f5cd12Smrg    echo GrepMe > conftest.dir/file
1134b6f5cd12Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1135b6f5cd12Smrg    rm -rf conftest.dir
1136b6f5cd12Smrg    if test -s conftest.tar; then
1137b6f5cd12Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1138b6f5cd12Smrg      AM_RUN_LOG([cat conftest.dir/file])
1139b6f5cd12Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1140b6f5cd12Smrg    fi
1141b6f5cd12Smrg  done
114221ecb1efSmrg  rm -rf conftest.dir
114321ecb1efSmrg
1144b6f5cd12Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1145b6f5cd12Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146b6f5cd12Smrg
114721ecb1efSmrgAC_SUBST([am__tar])
114821ecb1efSmrgAC_SUBST([am__untar])
114921ecb1efSmrg]) # _AM_PROG_TAR
115021ecb1efSmrg
1151d67195daSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152d67195daSmrgdnl serial 11 (pkg-config-0.29)
1153d67195daSmrgdnl
1154d67195daSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155d67195daSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1156d67195daSmrgdnl
1157d67195daSmrgdnl This program is free software; you can redistribute it and/or modify
1158d67195daSmrgdnl it under the terms of the GNU General Public License as published by
1159d67195daSmrgdnl the Free Software Foundation; either version 2 of the License, or
1160d67195daSmrgdnl (at your option) any later version.
1161d67195daSmrgdnl
1162d67195daSmrgdnl This program is distributed in the hope that it will be useful, but
1163d67195daSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164d67195daSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165d67195daSmrgdnl General Public License for more details.
1166d67195daSmrgdnl
1167d67195daSmrgdnl You should have received a copy of the GNU General Public License
1168d67195daSmrgdnl along with this program; if not, write to the Free Software
1169d67195daSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170d67195daSmrgdnl 02111-1307, USA.
1171d67195daSmrgdnl
1172d67195daSmrgdnl As a special exception to the GNU General Public License, if you
1173d67195daSmrgdnl distribute this file as part of a program that contains a
1174d67195daSmrgdnl configuration script generated by Autoconf, you may include it under
1175d67195daSmrgdnl the same distribution terms that you use for the rest of that
1176d67195daSmrgdnl program.
1177d67195daSmrg
1178d67195daSmrgdnl PKG_PREREQ(MIN-VERSION)
1179d67195daSmrgdnl -----------------------
1180d67195daSmrgdnl Since: 0.29
1181d67195daSmrgdnl
1182d67195daSmrgdnl Verify that the version of the pkg-config macros are at least
1183d67195daSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184d67195daSmrgdnl installed version of pkg-config, this checks the developer's version
1185d67195daSmrgdnl of pkg.m4 when generating configure.
1186d67195daSmrgdnl
1187d67195daSmrgdnl To ensure that this macro is defined, also add:
1188d67195daSmrgdnl m4_ifndef([PKG_PREREQ],
1189d67195daSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190d67195daSmrgdnl
1191d67195daSmrgdnl See the "Since" comment for each macro you use to see what version
1192d67195daSmrgdnl of the macros you require.
1193d67195daSmrgm4_defun([PKG_PREREQ],
1194d67195daSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195d67195daSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196d67195daSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197d67195daSmrg])dnl PKG_PREREQ
1198d67195daSmrg
1199d67195daSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200d67195daSmrgdnl ----------------------------------
1201d67195daSmrgdnl Since: 0.16
1202d67195daSmrgdnl
1203d67195daSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204d67195daSmrgdnl first found in the path. Checks that the version of pkg-config found
1205d67195daSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206d67195daSmrgdnl used since that's the first version where most current features of
1207d67195daSmrgdnl pkg-config existed.
1208b6f5cd12SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1209b6f5cd12Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210d67195daSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211d67195daSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212d67195daSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213d67195daSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214d67195daSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215d67195daSmrg
1216b6f5cd12Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1217b6f5cd12Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218b6f5cd12Smrgfi
1219b6f5cd12Smrgif test -n "$PKG_CONFIG"; then
1220b6f5cd12Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1221b6f5cd12Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1222b6f5cd12Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1223b6f5cd12Smrg		AC_MSG_RESULT([yes])
1224b6f5cd12Smrg	else
1225b6f5cd12Smrg		AC_MSG_RESULT([no])
1226b6f5cd12Smrg		PKG_CONFIG=""
1227b6f5cd12Smrg	fi
1228b6f5cd12Smrgfi[]dnl
1229d67195daSmrg])dnl PKG_PROG_PKG_CONFIG
1230b6f5cd12Smrg
1231d67195daSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232d67195daSmrgdnl -------------------------------------------------------------------
1233d67195daSmrgdnl Since: 0.18
1234d67195daSmrgdnl
1235d67195daSmrgdnl Check to see whether a particular set of modules exists. Similar to
1236d67195daSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237d67195daSmrgdnl
1238d67195daSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239d67195daSmrgdnl only at the first occurence in configure.ac, so if the first place
1240d67195daSmrgdnl it's called might be skipped (such as if it is within an "if", you
1241d67195daSmrgdnl have to call PKG_CHECK_EXISTS manually
1242b6f5cd12SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1243b6f5cd12Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1244b6f5cd12Smrgif test -n "$PKG_CONFIG" && \
1245b6f5cd12Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246d67195daSmrg  m4_default([$2], [:])
1247b6f5cd12Smrgm4_ifvaln([$3], [else
1248b6f5cd12Smrg  $3])dnl
1249b6f5cd12Smrgfi])
1250b6f5cd12Smrg
1251d67195daSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252d67195daSmrgdnl ---------------------------------------------
1253d67195daSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254d67195daSmrgdnl pkg_failed based on the result.
1255b6f5cd12Smrgm4_define([_PKG_CONFIG],
1256b6f5cd12Smrg[if test -n "$$1"; then
1257b6f5cd12Smrg    pkg_cv_[]$1="$$1"
1258b6f5cd12Smrg elif test -n "$PKG_CONFIG"; then
1259b6f5cd12Smrg    PKG_CHECK_EXISTS([$3],
1260d67195daSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261d67195daSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1262b6f5cd12Smrg		     [pkg_failed=yes])
1263b6f5cd12Smrg else
1264b6f5cd12Smrg    pkg_failed=untried
1265b6f5cd12Smrgfi[]dnl
1266d67195daSmrg])dnl _PKG_CONFIG
1267b6f5cd12Smrg
1268d67195daSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269d67195daSmrgdnl ---------------------------
1270d67195daSmrgdnl Internal check to see if pkg-config supports short errors.
1271b6f5cd12SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1272b6f5cd12Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1273b6f5cd12Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1274b6f5cd12Smrg        _pkg_short_errors_supported=yes
1275b6f5cd12Smrgelse
1276b6f5cd12Smrg        _pkg_short_errors_supported=no
1277b6f5cd12Smrgfi[]dnl
1278d67195daSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279b6f5cd12Smrg
1280b6f5cd12Smrg
1281d67195daSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282d67195daSmrgdnl   [ACTION-IF-NOT-FOUND])
1283d67195daSmrgdnl --------------------------------------------------------------
1284d67195daSmrgdnl Since: 0.4.0
1285d67195daSmrgdnl
1286d67195daSmrgdnl Note that if there is a possibility the first call to
1287d67195daSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288d67195daSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1289b6f5cd12SmrgAC_DEFUN([PKG_CHECK_MODULES],
1290b6f5cd12Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1291b6f5cd12SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1292b6f5cd12SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293b6f5cd12Smrg
1294b6f5cd12Smrgpkg_failed=no
1295b6f5cd12SmrgAC_MSG_CHECKING([for $1])
1296b6f5cd12Smrg
1297b6f5cd12Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1298b6f5cd12Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299b6f5cd12Smrg
1300b6f5cd12Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1301b6f5cd12Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1302b6f5cd12SmrgSee the pkg-config man page for more details.])
1303b6f5cd12Smrg
1304b6f5cd12Smrgif test $pkg_failed = yes; then
1305d67195daSmrg   	AC_MSG_RESULT([no])
1306b6f5cd12Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1307b6f5cd12Smrg        if test $_pkg_short_errors_supported = yes; then
1308d67195daSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1309b6f5cd12Smrg        else 
1310d67195daSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1311b6f5cd12Smrg        fi
1312b6f5cd12Smrg	# Put the nasty error message in config.log where it belongs
1313b6f5cd12Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314b6f5cd12Smrg
1315d67195daSmrg	m4_default([$4], [AC_MSG_ERROR(
1316b6f5cd12Smrg[Package requirements ($2) were not met:
1317b6f5cd12Smrg
1318b6f5cd12Smrg$$1_PKG_ERRORS
1319b6f5cd12Smrg
1320b6f5cd12SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1321b6f5cd12Smrginstalled software in a non-standard prefix.
1322b6f5cd12Smrg
1323d67195daSmrg_PKG_TEXT])[]dnl
1324d67195daSmrg        ])
1325b6f5cd12Smrgelif test $pkg_failed = untried; then
1326d67195daSmrg     	AC_MSG_RESULT([no])
1327d67195daSmrg	m4_default([$4], [AC_MSG_FAILURE(
1328b6f5cd12Smrg[The pkg-config script could not be found or is too old.  Make sure it
1329b6f5cd12Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1330b6f5cd12Smrgpath to pkg-config.
1331b6f5cd12Smrg
1332b6f5cd12Smrg_PKG_TEXT
1333b6f5cd12Smrg
1334d67195daSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335d67195daSmrg        ])
1336b6f5cd12Smrgelse
1337b6f5cd12Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1338b6f5cd12Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1339b6f5cd12Smrg        AC_MSG_RESULT([yes])
1340d67195daSmrg	$3
1341b6f5cd12Smrgfi[]dnl
1342d67195daSmrg])dnl PKG_CHECK_MODULES
1343d67195daSmrg
1344d67195daSmrg
1345d67195daSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346d67195daSmrgdnl   [ACTION-IF-NOT-FOUND])
1347d67195daSmrgdnl ---------------------------------------------------------------------
1348d67195daSmrgdnl Since: 0.29
1349d67195daSmrgdnl
1350d67195daSmrgdnl Checks for existence of MODULES and gathers its build flags with
1351d67195daSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352d67195daSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353d67195daSmrgdnl
1354d67195daSmrgdnl Note that if there is a possibility the first call to
1355d67195daSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356d67195daSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357d67195daSmrgdnl configure.ac.
1358d67195daSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359d67195daSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360d67195daSmrg_save_PKG_CONFIG=$PKG_CONFIG
1361d67195daSmrgPKG_CONFIG="$PKG_CONFIG --static"
1362d67195daSmrgPKG_CHECK_MODULES($@)
1363d67195daSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364d67195daSmrg])dnl PKG_CHECK_MODULES_STATIC
1365d67195daSmrg
1366d67195daSmrg
1367d67195daSmrgdnl PKG_INSTALLDIR([DIRECTORY])
1368d67195daSmrgdnl -------------------------
1369d67195daSmrgdnl Since: 0.27
1370d67195daSmrgdnl
1371d67195daSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372d67195daSmrgdnl should install pkg-config .pc files. By default the directory is
1373d67195daSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374d67195daSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375d67195daSmrgdnl parameter.
1376d67195daSmrgAC_DEFUN([PKG_INSTALLDIR],
1377d67195daSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378d67195daSmrgm4_pushdef([pkg_description],
1379d67195daSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380d67195daSmrgAC_ARG_WITH([pkgconfigdir],
1381d67195daSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382d67195daSmrg    [with_pkgconfigdir=]pkg_default)
1383d67195daSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384d67195daSmrgm4_popdef([pkg_default])
1385d67195daSmrgm4_popdef([pkg_description])
1386d67195daSmrg])dnl PKG_INSTALLDIR
1387d67195daSmrg
1388d67195daSmrg
1389d67195daSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390d67195daSmrgdnl --------------------------------
1391d67195daSmrgdnl Since: 0.27
1392d67195daSmrgdnl
1393d67195daSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394d67195daSmrgdnl module should install arch-independent pkg-config .pc files. By
1395d67195daSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396d67195daSmrgdnl changed by passing DIRECTORY. The user can override through the
1397d67195daSmrgdnl --with-noarch-pkgconfigdir parameter.
1398d67195daSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399d67195daSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400d67195daSmrgm4_pushdef([pkg_description],
1401d67195daSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402d67195daSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403d67195daSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404d67195daSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1405d67195daSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406d67195daSmrgm4_popdef([pkg_default])
1407d67195daSmrgm4_popdef([pkg_description])
1408d67195daSmrg])dnl PKG_NOARCH_INSTALLDIR
1409d67195daSmrg
1410d67195daSmrg
1411d67195daSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412d67195daSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413d67195daSmrgdnl -------------------------------------------
1414d67195daSmrgdnl Since: 0.28
1415d67195daSmrgdnl
1416d67195daSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1417d67195daSmrgAC_DEFUN([PKG_CHECK_VAR],
1418d67195daSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419d67195daSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420d67195daSmrg
1421d67195daSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422d67195daSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423d67195daSmrg
1424d67195daSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425d67195daSmrg])dnl PKG_CHECK_VAR
1426b6f5cd12Smrg
142721ecb1efSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142821ecb1efSmrgdnl
1429f303c8d5Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
143079bbd9e8Smrgdnl
143121ecb1efSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1432604a4f4cSmrgdnl copy of this software and associated documentation files (the "Software"),
1433604a4f4cSmrgdnl to deal in the Software without restriction, including without limitation
1434604a4f4cSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1435604a4f4cSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1436604a4f4cSmrgdnl Software is furnished to do so, subject to the following conditions:
143721ecb1efSmrgdnl
1438604a4f4cSmrgdnl The above copyright notice and this permission notice (including the next
1439604a4f4cSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1440604a4f4cSmrgdnl Software.
144121ecb1efSmrgdnl
1442604a4f4cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1443604a4f4cSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1444604a4f4cSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1445604a4f4cSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1446604a4f4cSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1447604a4f4cSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1448604a4f4cSmrgdnl DEALINGS IN THE SOFTWARE.
144921ecb1efSmrg
145021ecb1efSmrg# XORG_MACROS_VERSION(required-version)
145121ecb1efSmrg# -------------------------------------
145221ecb1efSmrg# Minimum version: 1.1.0
145321ecb1efSmrg#
145421ecb1efSmrg# If you're using a macro added in Version 1.1 or newer, include this in
145521ecb1efSmrg# your configure.ac with the minimum required version, such as:
145621ecb1efSmrg# XORG_MACROS_VERSION(1.1)
145721ecb1efSmrg#
145821ecb1efSmrg# To ensure that this macro is defined, also add:
145921ecb1efSmrg# m4_ifndef([XORG_MACROS_VERSION],
146021ecb1efSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
146121ecb1efSmrg#
146221ecb1efSmrg#
146379bbd9e8Smrg# See the "minimum version" comment for each macro you use to see what
146421ecb1efSmrg# version you require.
146521ecb1efSmrgm4_defun([XORG_MACROS_VERSION],[
1466f303c8d5Smrgm4_define([vers_have], [1.20.0])
146721ecb1efSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146821ecb1efSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
146921ecb1efSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147021ecb1efSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147121ecb1efSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147221ecb1efSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147321ecb1efSmrgm4_undefine([vers_have])
147421ecb1efSmrgm4_undefine([maj_have])
147521ecb1efSmrgm4_undefine([maj_needed])
147621ecb1efSmrg]) # XORG_MACROS_VERSION
147721ecb1efSmrg
147821ecb1efSmrg# XORG_PROG_RAWCPP()
147921ecb1efSmrg# ------------------
148021ecb1efSmrg# Minimum version: 1.0.0
148121ecb1efSmrg#
148221ecb1efSmrg# Find cpp program and necessary flags for use in pre-processing text files
148321ecb1efSmrg# such as man pages and config files
148421ecb1efSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148521ecb1efSmrgAC_REQUIRE([AC_PROG_CPP])
1486d67195daSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148721ecb1efSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14881e00de39Smrg
148921ecb1efSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149021ecb1efSmrg# which is not the best choice for supporting other OS'es, but covers most
149121ecb1efSmrg# of the ones we need for now.
149221ecb1efSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1493b6f5cd12SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149421ecb1efSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149521ecb1efSmrg	AC_MSG_RESULT([no])
149621ecb1efSmrgelse
149721ecb1efSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149821ecb1efSmrg		RAWCPPFLAGS=-undef
149921ecb1efSmrg		AC_MSG_RESULT([yes])
150021ecb1efSmrg	# under Cygwin unix is still defined even with -undef
150121ecb1efSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150221ecb1efSmrg		RAWCPPFLAGS="-undef -ansi"
150321ecb1efSmrg		AC_MSG_RESULT([yes, with -ansi])
150421ecb1efSmrg	else
150521ecb1efSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150621ecb1efSmrg	fi
150721ecb1efSmrgfi
150821ecb1efSmrgrm -f conftest.$ac_ext
15091e00de39Smrg
151021ecb1efSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1511b6f5cd12SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151221ecb1efSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151321ecb1efSmrg	AC_MSG_RESULT([no])
15141e00de39Smrgelse
151521ecb1efSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151679bbd9e8Smrg		TRADITIONALCPPFLAGS="-traditional"
151721ecb1efSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151821ecb1efSmrg		AC_MSG_RESULT([yes])
151921ecb1efSmrg	else
152021ecb1efSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152121ecb1efSmrg	fi
15221e00de39Smrgfi
152321ecb1efSmrgrm -f conftest.$ac_ext
152421ecb1efSmrgAC_SUBST(RAWCPPFLAGS)
152579bbd9e8SmrgAC_SUBST(TRADITIONALCPPFLAGS)
152621ecb1efSmrg]) # XORG_PROG_RAWCPP
15271e00de39Smrg
152821ecb1efSmrg# XORG_MANPAGE_SECTIONS()
152921ecb1efSmrg# -----------------------
153021ecb1efSmrg# Minimum version: 1.0.0
153121ecb1efSmrg#
153221ecb1efSmrg# Determine which sections man pages go in for the different man page types
153321ecb1efSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153421ecb1efSmrg# Not sure if there's any better way than just hardcoding by OS name.
153521ecb1efSmrg# Override default settings by setting environment variables
1536604a4f4cSmrg# Added MAN_SUBSTS in version 1.8
1537604a4f4cSmrg# Added AC_PROG_SED in version 1.8
15381e00de39Smrg
153921ecb1efSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154021ecb1efSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1541604a4f4cSmrgAC_REQUIRE([AC_PROG_SED])
15421e00de39Smrg
1543d67195daSmrgcase $host_os in
1544d67195daSmrg    solaris*)
1545d67195daSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1546d67195daSmrg        # check for a man page file found in later versions that use
1547d67195daSmrg        # traditional section numbers instead
1548d67195daSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1549d67195daSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550d67195daSmrg        ;;
1551d67195daSmrg    *) SYSV_MAN_SECTIONS=false ;;
1552d67195daSmrgesac
1553d67195daSmrg
155421ecb1efSmrgif test x$APP_MAN_SUFFIX = x    ; then
155521ecb1efSmrg    APP_MAN_SUFFIX=1
155621ecb1efSmrgfi
155721ecb1efSmrgif test x$APP_MAN_DIR = x    ; then
155821ecb1efSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
155921ecb1efSmrgfi
15601e00de39Smrg
156121ecb1efSmrgif test x$LIB_MAN_SUFFIX = x    ; then
156221ecb1efSmrg    LIB_MAN_SUFFIX=3
156321ecb1efSmrgfi
156421ecb1efSmrgif test x$LIB_MAN_DIR = x    ; then
156521ecb1efSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15661e00de39Smrgfi
15671e00de39Smrg
156821ecb1efSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1569d67195daSmrg    case $SYSV_MAN_SECTIONS in
1570d67195daSmrg	true)				FILE_MAN_SUFFIX=4  ;;
1571d67195daSmrg	*)				FILE_MAN_SUFFIX=5  ;;
157221ecb1efSmrg    esac
157321ecb1efSmrgfi
157421ecb1efSmrgif test x$FILE_MAN_DIR = x    ; then
157521ecb1efSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
157621ecb1efSmrgfi
15771e00de39Smrg
157821ecb1efSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1579d67195daSmrg    case $SYSV_MAN_SECTIONS in
1580d67195daSmrg	true)				MISC_MAN_SUFFIX=5  ;;
1581d67195daSmrg	*)				MISC_MAN_SUFFIX=7  ;;
158221ecb1efSmrg    esac
158321ecb1efSmrgfi
158421ecb1efSmrgif test x$MISC_MAN_DIR = x    ; then
158521ecb1efSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
158621ecb1efSmrgfi
15871e00de39Smrg
158821ecb1efSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1589d67195daSmrg    case $SYSV_MAN_SECTIONS in
1590d67195daSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1591d67195daSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159221ecb1efSmrg    esac
159321ecb1efSmrgfi
159421ecb1efSmrgif test x$DRIVER_MAN_DIR = x    ; then
159521ecb1efSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159621ecb1efSmrgfi
15971e00de39Smrg
159821ecb1efSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1599d67195daSmrg    case $SYSV_MAN_SECTIONS in
1600d67195daSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1601d67195daSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160221ecb1efSmrg    esac
160321ecb1efSmrgfi
160421ecb1efSmrgif test x$ADMIN_MAN_DIR = x    ; then
160521ecb1efSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160621ecb1efSmrgfi
16071e00de39Smrg
16081e00de39Smrg
160921ecb1efSmrgAC_SUBST([APP_MAN_SUFFIX])
161021ecb1efSmrgAC_SUBST([LIB_MAN_SUFFIX])
161121ecb1efSmrgAC_SUBST([FILE_MAN_SUFFIX])
161221ecb1efSmrgAC_SUBST([MISC_MAN_SUFFIX])
161321ecb1efSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161421ecb1efSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161521ecb1efSmrgAC_SUBST([APP_MAN_DIR])
161621ecb1efSmrgAC_SUBST([LIB_MAN_DIR])
161721ecb1efSmrgAC_SUBST([FILE_MAN_DIR])
161821ecb1efSmrgAC_SUBST([MISC_MAN_DIR])
161921ecb1efSmrgAC_SUBST([DRIVER_MAN_DIR])
162021ecb1efSmrgAC_SUBST([ADMIN_MAN_DIR])
1621604a4f4cSmrg
1622604a4f4cSmrgXORG_MAN_PAGE="X Version 11"
1623604a4f4cSmrgAC_SUBST([XORG_MAN_PAGE])
1624604a4f4cSmrgMAN_SUBSTS="\
1625604a4f4cSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1626604a4f4cSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1627604a4f4cSmrg	-e 's|__xservername__|Xorg|g' \
1628604a4f4cSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1629604a4f4cSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1630604a4f4cSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1631604a4f4cSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1632604a4f4cSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1633604a4f4cSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1634604a4f4cSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1635604a4f4cSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1636604a4f4cSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1637604a4f4cSmrgAC_SUBST([MAN_SUBSTS])
1638604a4f4cSmrg
163921ecb1efSmrg]) # XORG_MANPAGE_SECTIONS
16401e00de39Smrg
1641604a4f4cSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1642604a4f4cSmrg# ------------------------
1643604a4f4cSmrg# Minimum version: 1.7.0
1644604a4f4cSmrg#
1645604a4f4cSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1646604a4f4cSmrg# provided by xorg-sgml-doctools, if installed.
1647604a4f4cSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1648604a4f4cSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1649604a4f4cSmrgXORG_SGML_PATH=
1650604a4f4cSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1651604a4f4cSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1652604a4f4cSmrg    [m4_ifval([$1],[:],
1653604a4f4cSmrg        [if test x"$cross_compiling" != x"yes" ; then
1654604a4f4cSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1655604a4f4cSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1656604a4f4cSmrg         fi])
1657604a4f4cSmrg    ])
1658604a4f4cSmrg
1659604a4f4cSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1660604a4f4cSmrg# the path and the name of the doc stylesheet
1661604a4f4cSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1662604a4f4cSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1663604a4f4cSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1664604a4f4cSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1665604a4f4cSmrgelse
1666604a4f4cSmrg   AC_MSG_RESULT([no])
1667604a4f4cSmrgfi
1668604a4f4cSmrg
1669604a4f4cSmrgAC_SUBST(XORG_SGML_PATH)
1670604a4f4cSmrgAC_SUBST(STYLESHEET_SRCDIR)
1671604a4f4cSmrgAC_SUBST(XSL_STYLESHEET)
1672604a4f4cSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1673604a4f4cSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1674604a4f4cSmrg
167521ecb1efSmrg# XORG_CHECK_LINUXDOC
167621ecb1efSmrg# -------------------
167721ecb1efSmrg# Minimum version: 1.0.0
16781e00de39Smrg#
167921ecb1efSmrg# Defines the variable MAKE_TEXT if the necessary tools and
168021ecb1efSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168121ecb1efSmrg# Whether or not the necessary tools and files are found can be checked
168221ecb1efSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168321ecb1efSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1684604a4f4cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1685604a4f4cSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16861e00de39Smrg
168721ecb1efSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16881e00de39Smrg
1689604a4f4cSmrgAC_MSG_CHECKING([whether to build documentation])
16901e00de39Smrg
1691604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169221ecb1efSmrg   BUILDDOC=yes
169321ecb1efSmrgelse
169421ecb1efSmrg   BUILDDOC=no
16951e00de39Smrgfi
16961e00de39Smrg
169721ecb1efSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16981e00de39Smrg
169921ecb1efSmrgAC_MSG_RESULT([$BUILDDOC])
17001e00de39Smrg
1701604a4f4cSmrgAC_MSG_CHECKING([whether to build pdf documentation])
17021e00de39Smrg
1703604a4f4cSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170421ecb1efSmrg   BUILDPDFDOC=yes
170521ecb1efSmrgelse
170621ecb1efSmrg   BUILDPDFDOC=no
170721ecb1efSmrgfi
17081e00de39Smrg
170921ecb1efSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17101e00de39Smrg
171121ecb1efSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17121e00de39Smrg
1713604a4f4cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171421ecb1efSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171521ecb1efSmrgMAKE_PDF="$PS2PDF"
171621ecb1efSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17171e00de39Smrg
171821ecb1efSmrgAC_SUBST(MAKE_TEXT)
171921ecb1efSmrgAC_SUBST(MAKE_PS)
172021ecb1efSmrgAC_SUBST(MAKE_PDF)
172121ecb1efSmrgAC_SUBST(MAKE_HTML)
172221ecb1efSmrg]) # XORG_CHECK_LINUXDOC
172321ecb1efSmrg
172421ecb1efSmrg# XORG_CHECK_DOCBOOK
172521ecb1efSmrg# -------------------
172621ecb1efSmrg# Minimum version: 1.0.0
17271e00de39Smrg#
172821ecb1efSmrg# Checks for the ability to build output formats from SGML DocBook source.
172921ecb1efSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173021ecb1efSmrg# indicates whether the necessary tools and files are found and, if set,
173121ecb1efSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173221ecb1efSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1733604a4f4cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1734604a4f4cSmrg
173521ecb1efSmrgBUILDTXTDOC=no
173621ecb1efSmrgBUILDPDFDOC=no
173721ecb1efSmrgBUILDPSDOC=no
173821ecb1efSmrgBUILDHTMLDOC=no
17391e00de39Smrg
174021ecb1efSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174121ecb1efSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174221ecb1efSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174321ecb1efSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17441e00de39Smrg
1745604a4f4cSmrgAC_MSG_CHECKING([whether to build text documentation])
1746604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174721ecb1efSmrg   test x$BUILD_TXTDOC != xno; then
174821ecb1efSmrg	BUILDTXTDOC=yes
174921ecb1efSmrgfi
175021ecb1efSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175121ecb1efSmrgAC_MSG_RESULT([$BUILDTXTDOC])
17521e00de39Smrg
1753604a4f4cSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1754604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175521ecb1efSmrg   test x$BUILD_PDFDOC != xno; then
175621ecb1efSmrg	BUILDPDFDOC=yes
17571e00de39Smrgfi
175821ecb1efSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175921ecb1efSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17601e00de39Smrg
1761604a4f4cSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1762604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176321ecb1efSmrg   test x$BUILD_PSDOC != xno; then
176421ecb1efSmrg	BUILDPSDOC=yes
176521ecb1efSmrgfi
176621ecb1efSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176721ecb1efSmrgAC_MSG_RESULT([$BUILDPSDOC])
17681e00de39Smrg
1769604a4f4cSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1770604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177121ecb1efSmrg   test x$BUILD_HTMLDOC != xno; then
177221ecb1efSmrg	BUILDHTMLDOC=yes
177321ecb1efSmrgfi
177421ecb1efSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177521ecb1efSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17761e00de39Smrg
177721ecb1efSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177821ecb1efSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177921ecb1efSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178021ecb1efSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17811e00de39Smrg
178221ecb1efSmrgAC_SUBST(MAKE_TEXT)
178321ecb1efSmrgAC_SUBST(MAKE_PS)
178421ecb1efSmrgAC_SUBST(MAKE_PDF)
178521ecb1efSmrgAC_SUBST(MAKE_HTML)
178621ecb1efSmrg]) # XORG_CHECK_DOCBOOK
17871e00de39Smrg
1788b6f5cd12Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1789604a4f4cSmrg# ----------------
1790604a4f4cSmrg# Minimum version: 1.5.0
1791b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1792604a4f4cSmrg#
1793604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
1794604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
1795604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1796f303c8d5Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1797b6f5cd12Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1798b6f5cd12Smrg# --with-xmlto assumes 'auto'.
1799604a4f4cSmrg#
1800604a4f4cSmrg# Interface to module:
1801604a4f4cSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1802604a4f4cSmrg# XMLTO:	returns the path of the xmlto program found
1803604a4f4cSmrg#		returns the path set by the user in the environment
1804604a4f4cSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1805604a4f4cSmrg#		'no' user instructs the module not to use xmlto
1806604a4f4cSmrg#
1807604a4f4cSmrg# Added in version 1.10.0
1808604a4f4cSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1809604a4f4cSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810604a4f4cSmrg#
1811604a4f4cSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812604a4f4cSmrg#
1813604a4f4cSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1814604a4f4cSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1815b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
1816604a4f4cSmrgAC_ARG_WITH(xmlto,
1817604a4f4cSmrg	AS_HELP_STRING([--with-xmlto],
1818b6f5cd12Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1819b6f5cd12Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1820b6f5cd12Smrgm4_undefine([_defopt])
1821604a4f4cSmrg
1822604a4f4cSmrgif test "x$use_xmlto" = x"auto"; then
1823604a4f4cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1824604a4f4cSmrg   if test "x$XMLTO" = "x"; then
1825604a4f4cSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1826604a4f4cSmrg	have_xmlto=no
1827604a4f4cSmrg   else
1828604a4f4cSmrg        have_xmlto=yes
1829604a4f4cSmrg   fi
1830604a4f4cSmrgelif test "x$use_xmlto" = x"yes" ; then
1831604a4f4cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1832604a4f4cSmrg   if test "x$XMLTO" = "x"; then
1833604a4f4cSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1834604a4f4cSmrg   fi
1835604a4f4cSmrg   have_xmlto=yes
1836604a4f4cSmrgelif test "x$use_xmlto" = x"no" ; then
1837604a4f4cSmrg   if test "x$XMLTO" != "x"; then
1838604a4f4cSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1839604a4f4cSmrg   fi
1840604a4f4cSmrg   have_xmlto=no
1841604a4f4cSmrgelse
1842604a4f4cSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1843604a4f4cSmrgfi
1844604a4f4cSmrg
1845604a4f4cSmrg# Test for a minimum version of xmlto, if provided.
1846604a4f4cSmrgm4_ifval([$1],
1847604a4f4cSmrg[if test "$have_xmlto" = yes; then
1848604a4f4cSmrg    # scrape the xmlto version
1849604a4f4cSmrg    AC_MSG_CHECKING([the xmlto version])
1850604a4f4cSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1851604a4f4cSmrg    AC_MSG_RESULT([$xmlto_version])
1852604a4f4cSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1853604a4f4cSmrg        [if test "x$use_xmlto" = xauto; then
1854604a4f4cSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1855604a4f4cSmrg            have_xmlto=no
1856604a4f4cSmrg        else
1857604a4f4cSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1858604a4f4cSmrg        fi])
1859604a4f4cSmrgfi])
1860604a4f4cSmrg
1861604a4f4cSmrg# Test for the ability of xmlto to generate a text target
1862d67195daSmrg#
1863d67195daSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1864d67195daSmrg# following test for empty XML docbook files.
1865d67195daSmrg# For compatibility reasons use the following empty XML docbook file and if
1866d67195daSmrg# it fails try it again with a non-empty XML file.
1867604a4f4cSmrghave_xmlto_text=no
1868604a4f4cSmrgcat > conftest.xml << "EOF"
1869604a4f4cSmrgEOF
1870604a4f4cSmrgAS_IF([test "$have_xmlto" = yes],
1871604a4f4cSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1872604a4f4cSmrg             [have_xmlto_text=yes],
1873d67195daSmrg             [# Try it again with a non-empty XML file.
1874d67195daSmrg              cat > conftest.xml << "EOF"
1875d67195daSmrg<x></x>
1876d67195daSmrgEOF
1877d67195daSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1878d67195daSmrg                    [have_xmlto_text=yes],
1879d67195daSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1880604a4f4cSmrgrm -f conftest.xml
1881604a4f4cSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1882604a4f4cSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1883604a4f4cSmrg]) # XORG_WITH_XMLTO
1884604a4f4cSmrg
1885b6f5cd12Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1886b6f5cd12Smrg# --------------------------------------------
1887b6f5cd12Smrg# Minimum version: 1.12.0
1888b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1889b6f5cd12Smrg#
1890b6f5cd12Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1891b6f5cd12Smrg# XML-based language used for the transformation of XML documents.
1892b6f5cd12Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1893b6f5cd12Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1894b6f5cd12Smrg# The XSLT processor is often used as a standalone tool for transformations.
1895b6f5cd12Smrg# It should not be assumed that this tool is used only to work with documnetation.
1896b6f5cd12Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1897b6f5cd12Smrg#
1898b6f5cd12Smrg# Interface to module:
1899b6f5cd12Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1900b6f5cd12Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1901b6f5cd12Smrg#		 returns the path set by the user in the environment
1902b6f5cd12Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1903b6f5cd12Smrg#		  'no' user instructs the module not to use xsltproc
1904b6f5cd12Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1905b6f5cd12Smrg#
1906b6f5cd12Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1907b6f5cd12Smrg#
1908b6f5cd12SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1909b6f5cd12SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1910b6f5cd12Smrg# Preserves the interface, should it be implemented later
1911b6f5cd12Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1912b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
1913b6f5cd12SmrgAC_ARG_WITH(xsltproc,
1914b6f5cd12Smrg	AS_HELP_STRING([--with-xsltproc],
1915b6f5cd12Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1916b6f5cd12Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1917b6f5cd12Smrgm4_undefine([_defopt])
1918b6f5cd12Smrg
1919b6f5cd12Smrgif test "x$use_xsltproc" = x"auto"; then
1920b6f5cd12Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1921b6f5cd12Smrg   if test "x$XSLTPROC" = "x"; then
1922b6f5cd12Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1923b6f5cd12Smrg	have_xsltproc=no
1924b6f5cd12Smrg   else
1925b6f5cd12Smrg        have_xsltproc=yes
1926b6f5cd12Smrg   fi
1927b6f5cd12Smrgelif test "x$use_xsltproc" = x"yes" ; then
1928b6f5cd12Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1929b6f5cd12Smrg   if test "x$XSLTPROC" = "x"; then
1930b6f5cd12Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1931b6f5cd12Smrg   fi
1932b6f5cd12Smrg   have_xsltproc=yes
1933b6f5cd12Smrgelif test "x$use_xsltproc" = x"no" ; then
1934b6f5cd12Smrg   if test "x$XSLTPROC" != "x"; then
1935b6f5cd12Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1936b6f5cd12Smrg   fi
1937b6f5cd12Smrg   have_xsltproc=no
1938b6f5cd12Smrgelse
1939b6f5cd12Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940b6f5cd12Smrgfi
1941b6f5cd12Smrg
1942b6f5cd12SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1943b6f5cd12Smrg]) # XORG_WITH_XSLTPROC
1944b6f5cd12Smrg
1945b6f5cd12Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1946b6f5cd12Smrg# ----------------------------------------
1947b6f5cd12Smrg# Minimum version: 1.15.0
1948b6f5cd12Smrg#
1949b6f5cd12Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1950b6f5cd12Smrg# scanning arbitrary text files, extracting information from those text files,
1951b6f5cd12Smrg# and printing reports based on that information.
1952b6f5cd12Smrg#
1953b6f5cd12Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954b6f5cd12Smrg#
1955b6f5cd12Smrg# Interface to module:
1956b6f5cd12Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1957b6f5cd12Smrg# PERL:	     returns the path of the perl program found
1958b6f5cd12Smrg#	     returns the path set by the user in the environment
1959b6f5cd12Smrg# --with-perl: 'yes' user instructs the module to use perl
1960b6f5cd12Smrg#	       'no' user instructs the module not to use perl
1961b6f5cd12Smrg# have_perl: returns yes if perl found in PATH or no
1962b6f5cd12Smrg#
1963b6f5cd12Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1964b6f5cd12Smrg#
1965b6f5cd12SmrgAC_DEFUN([XORG_WITH_PERL],[
1966b6f5cd12SmrgAC_ARG_VAR([PERL], [Path to perl command])
1967b6f5cd12Smrg# Preserves the interface, should it be implemented later
1968b6f5cd12Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1969b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
1970b6f5cd12SmrgAC_ARG_WITH(perl,
1971b6f5cd12Smrg	AS_HELP_STRING([--with-perl],
1972b6f5cd12Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1973b6f5cd12Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1974b6f5cd12Smrgm4_undefine([_defopt])
1975b6f5cd12Smrg
1976b6f5cd12Smrgif test "x$use_perl" = x"auto"; then
1977b6f5cd12Smrg   AC_PATH_PROG([PERL], [perl])
1978b6f5cd12Smrg   if test "x$PERL" = "x"; then
1979b6f5cd12Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1980b6f5cd12Smrg	have_perl=no
1981b6f5cd12Smrg   else
1982b6f5cd12Smrg        have_perl=yes
1983b6f5cd12Smrg   fi
1984b6f5cd12Smrgelif test "x$use_perl" = x"yes" ; then
1985b6f5cd12Smrg   AC_PATH_PROG([PERL], [perl])
1986b6f5cd12Smrg   if test "x$PERL" = "x"; then
1987b6f5cd12Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1988b6f5cd12Smrg   fi
1989b6f5cd12Smrg   have_perl=yes
1990b6f5cd12Smrgelif test "x$use_perl" = x"no" ; then
1991b6f5cd12Smrg   if test "x$PERL" != "x"; then
1992b6f5cd12Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1993b6f5cd12Smrg   fi
1994b6f5cd12Smrg   have_perl=no
1995b6f5cd12Smrgelse
1996b6f5cd12Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1997b6f5cd12Smrgfi
1998b6f5cd12Smrg
1999b6f5cd12SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2000b6f5cd12Smrg]) # XORG_WITH_PERL
2001b6f5cd12Smrg
2002b6f5cd12Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003604a4f4cSmrg# ----------------
2004604a4f4cSmrg# Minimum version: 1.5.0
2005b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2006604a4f4cSmrg#
2007604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
2008604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
2009604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2010f303c8d5Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2011b6f5cd12Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2012b6f5cd12Smrg# --with-asciidoc assumes 'auto'.
2013604a4f4cSmrg#
2014604a4f4cSmrg# Interface to module:
2015604a4f4cSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2016604a4f4cSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
2017604a4f4cSmrg#		 returns the path set by the user in the environment
2018604a4f4cSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2019604a4f4cSmrg#		  'no' user instructs the module not to use asciidoc
2020604a4f4cSmrg#
2021604a4f4cSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2022604a4f4cSmrg#
2023604a4f4cSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2024604a4f4cSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2025b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
2026604a4f4cSmrgAC_ARG_WITH(asciidoc,
2027604a4f4cSmrg	AS_HELP_STRING([--with-asciidoc],
2028b6f5cd12Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2029b6f5cd12Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2030b6f5cd12Smrgm4_undefine([_defopt])
2031604a4f4cSmrg
2032604a4f4cSmrgif test "x$use_asciidoc" = x"auto"; then
2033604a4f4cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2034604a4f4cSmrg   if test "x$ASCIIDOC" = "x"; then
2035604a4f4cSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2036604a4f4cSmrg	have_asciidoc=no
2037604a4f4cSmrg   else
2038604a4f4cSmrg        have_asciidoc=yes
2039604a4f4cSmrg   fi
2040604a4f4cSmrgelif test "x$use_asciidoc" = x"yes" ; then
2041604a4f4cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2042604a4f4cSmrg   if test "x$ASCIIDOC" = "x"; then
2043604a4f4cSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2044604a4f4cSmrg   fi
2045604a4f4cSmrg   have_asciidoc=yes
2046604a4f4cSmrgelif test "x$use_asciidoc" = x"no" ; then
2047604a4f4cSmrg   if test "x$ASCIIDOC" != "x"; then
2048604a4f4cSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2049604a4f4cSmrg   fi
2050604a4f4cSmrg   have_asciidoc=no
2051604a4f4cSmrgelse
2052604a4f4cSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2053604a4f4cSmrgfi
2054604a4f4cSmrgm4_ifval([$1],
2055604a4f4cSmrg[if test "$have_asciidoc" = yes; then
2056604a4f4cSmrg    # scrape the asciidoc version
2057604a4f4cSmrg    AC_MSG_CHECKING([the asciidoc version])
2058604a4f4cSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2059604a4f4cSmrg    AC_MSG_RESULT([$asciidoc_version])
2060604a4f4cSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2061604a4f4cSmrg        [if test "x$use_asciidoc" = xauto; then
2062604a4f4cSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2063604a4f4cSmrg            have_asciidoc=no
2064604a4f4cSmrg        else
2065604a4f4cSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2066604a4f4cSmrg        fi])
2067604a4f4cSmrgfi])
2068604a4f4cSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2069604a4f4cSmrg]) # XORG_WITH_ASCIIDOC
2070604a4f4cSmrg
2071b6f5cd12Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207279bbd9e8Smrg# -------------------------------------------
2073604a4f4cSmrg# Minimum version: 1.5.0
2074b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
207579bbd9e8Smrg# Minimum version for optional DOT checking: 1.18.0
2076604a4f4cSmrg#
2077604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
2078604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
2079604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2080f303c8d5Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2081b6f5cd12Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2082b6f5cd12Smrg# --with-doxygen assumes 'auto'.
2083604a4f4cSmrg#
2084604a4f4cSmrg# Interface to module:
2085604a4f4cSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2086604a4f4cSmrg# DOXYGEN:	 returns the path of the doxygen program found
2087604a4f4cSmrg#		 returns the path set by the user in the environment
2088604a4f4cSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2089604a4f4cSmrg#		  'no' user instructs the module not to use doxygen
2090604a4f4cSmrg#
2091604a4f4cSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092604a4f4cSmrg#
2093604a4f4cSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2094604a4f4cSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209579bbd9e8SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2096b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
2097604a4f4cSmrgAC_ARG_WITH(doxygen,
2098604a4f4cSmrg	AS_HELP_STRING([--with-doxygen],
2099b6f5cd12Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2100b6f5cd12Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2101b6f5cd12Smrgm4_undefine([_defopt])
2102604a4f4cSmrg
2103604a4f4cSmrgif test "x$use_doxygen" = x"auto"; then
2104604a4f4cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2105604a4f4cSmrg   if test "x$DOXYGEN" = "x"; then
2106604a4f4cSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2107604a4f4cSmrg	have_doxygen=no
2108604a4f4cSmrg   else
2109604a4f4cSmrg        have_doxygen=yes
2110604a4f4cSmrg   fi
2111604a4f4cSmrgelif test "x$use_doxygen" = x"yes" ; then
2112604a4f4cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2113604a4f4cSmrg   if test "x$DOXYGEN" = "x"; then
2114604a4f4cSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2115604a4f4cSmrg   fi
2116604a4f4cSmrg   have_doxygen=yes
2117604a4f4cSmrgelif test "x$use_doxygen" = x"no" ; then
2118604a4f4cSmrg   if test "x$DOXYGEN" != "x"; then
2119604a4f4cSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2120604a4f4cSmrg   fi
2121604a4f4cSmrg   have_doxygen=no
2122604a4f4cSmrgelse
2123604a4f4cSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124604a4f4cSmrgfi
2125604a4f4cSmrgm4_ifval([$1],
2126604a4f4cSmrg[if test "$have_doxygen" = yes; then
2127604a4f4cSmrg    # scrape the doxygen version
2128604a4f4cSmrg    AC_MSG_CHECKING([the doxygen version])
2129604a4f4cSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2130604a4f4cSmrg    AC_MSG_RESULT([$doxygen_version])
2131604a4f4cSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2132604a4f4cSmrg        [if test "x$use_doxygen" = xauto; then
2133604a4f4cSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2134604a4f4cSmrg            have_doxygen=no
2135604a4f4cSmrg        else
2136604a4f4cSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2137604a4f4cSmrg        fi])
2138604a4f4cSmrgfi])
213979bbd9e8Smrg
214079bbd9e8Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214179bbd9e8Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214279bbd9e8Smrgdnl 	HAVE_DOT = @HAVE_DOT@
214379bbd9e8SmrgHAVE_DOT=no
214479bbd9e8Smrgif test "x$have_doxygen" = "xyes"; then
214579bbd9e8Smrg  AC_PATH_PROG([DOT], [dot])
214679bbd9e8Smrg    if test "x$DOT" != "x"; then
214779bbd9e8Smrg      HAVE_DOT=yes
214879bbd9e8Smrg    fi
214979bbd9e8Smrgfi
215079bbd9e8Smrg
215179bbd9e8SmrgAC_SUBST([HAVE_DOT])
215279bbd9e8SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2153604a4f4cSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2154604a4f4cSmrg]) # XORG_WITH_DOXYGEN
2155604a4f4cSmrg
2156b6f5cd12Smrg# XORG_WITH_GROFF([DEFAULT])
2157604a4f4cSmrg# ----------------
2158604a4f4cSmrg# Minimum version: 1.6.0
2159b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2160604a4f4cSmrg#
2161604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
2162604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
2163604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2164f303c8d5Smrg# the --with-groff option, it allows maximum flexibility in making decisions
2165b6f5cd12Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2166b6f5cd12Smrg# --with-groff assumes 'auto'.
2167604a4f4cSmrg#
2168604a4f4cSmrg# Interface to module:
2169604a4f4cSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2170604a4f4cSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2171604a4f4cSmrg# HAVE_GROFF_MS: the -ms macros package
2172604a4f4cSmrg# GROFF:	 returns the path of the groff program found
2173604a4f4cSmrg#		 returns the path set by the user in the environment
2174604a4f4cSmrg# --with-groff:	 'yes' user instructs the module to use groff
2175604a4f4cSmrg#		 'no' user instructs the module not to use groff
2176604a4f4cSmrg#
2177604a4f4cSmrg# Added in version 1.9.0:
2178604a4f4cSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2179604a4f4cSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2180604a4f4cSmrg#		   psselect from the psutils package.
2181604a4f4cSmrg#		   the ghostcript package. Refer to the grohtml man pages
2182604a4f4cSmrg#
2183604a4f4cSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2184604a4f4cSmrg#
2185604a4f4cSmrg# OS and distros often splits groff in a basic and full package, the former
2186604a4f4cSmrg# having the groff program and the later having devices, fonts and macros
2187604a4f4cSmrg# Checking for the groff executable is not enough.
2188604a4f4cSmrg#
2189604a4f4cSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2190604a4f4cSmrg# unset HAVE_GROFF or GROFF env variables.
2191604a4f4cSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2192604a4f4cSmrg#
2193604a4f4cSmrgAC_DEFUN([XORG_WITH_GROFF],[
2194604a4f4cSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2195b6f5cd12Smrgm4_define([_defopt], m4_default([$1], [auto]))
2196604a4f4cSmrgAC_ARG_WITH(groff,
2197604a4f4cSmrg	AS_HELP_STRING([--with-groff],
2198b6f5cd12Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2199b6f5cd12Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2200b6f5cd12Smrgm4_undefine([_defopt])
2201604a4f4cSmrg
2202604a4f4cSmrgif test "x$use_groff" = x"auto"; then
2203604a4f4cSmrg   AC_PATH_PROG([GROFF], [groff])
2204604a4f4cSmrg   if test "x$GROFF" = "x"; then
2205604a4f4cSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2206604a4f4cSmrg	have_groff=no
2207604a4f4cSmrg   else
2208604a4f4cSmrg        have_groff=yes
2209604a4f4cSmrg   fi
2210604a4f4cSmrgelif test "x$use_groff" = x"yes" ; then
2211604a4f4cSmrg   AC_PATH_PROG([GROFF], [groff])
2212604a4f4cSmrg   if test "x$GROFF" = "x"; then
2213604a4f4cSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2214604a4f4cSmrg   fi
2215604a4f4cSmrg   have_groff=yes
2216604a4f4cSmrgelif test "x$use_groff" = x"no" ; then
2217604a4f4cSmrg   if test "x$GROFF" != "x"; then
2218604a4f4cSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2219604a4f4cSmrg   fi
2220604a4f4cSmrg   have_groff=no
2221604a4f4cSmrgelse
2222604a4f4cSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2223604a4f4cSmrgfi
2224604a4f4cSmrg
2225604a4f4cSmrg# We have groff, test for the presence of the macro packages
2226604a4f4cSmrgif test "x$have_groff" = x"yes"; then
2227604a4f4cSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2228604a4f4cSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2229604a4f4cSmrg        groff_ms_works=yes
2230604a4f4cSmrg    else
2231604a4f4cSmrg        groff_ms_works=no
2232604a4f4cSmrg    fi
2233604a4f4cSmrg    AC_MSG_RESULT([$groff_ms_works])
2234604a4f4cSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2235604a4f4cSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2236604a4f4cSmrg        groff_mm_works=yes
2237604a4f4cSmrg    else
2238604a4f4cSmrg        groff_mm_works=no
2239604a4f4cSmrg    fi
2240604a4f4cSmrg    AC_MSG_RESULT([$groff_mm_works])
2241604a4f4cSmrgfi
2242604a4f4cSmrg
2243604a4f4cSmrg# We have groff, test for HTML dependencies, one command per package
2244604a4f4cSmrgif test "x$have_groff" = x"yes"; then
2245604a4f4cSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2246604a4f4cSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2247604a4f4cSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2248604a4f4cSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2249604a4f4cSmrg      have_groff_html=yes
2250604a4f4cSmrg   else
2251604a4f4cSmrg      have_groff_html=no
2252604a4f4cSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2253604a4f4cSmrg   fi
2254604a4f4cSmrgfi
2255604a4f4cSmrg
2256604a4f4cSmrg# Set Automake conditionals for Makefiles
2257604a4f4cSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2258604a4f4cSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2259604a4f4cSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2260604a4f4cSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2261604a4f4cSmrg]) # XORG_WITH_GROFF
2262604a4f4cSmrg
2263b6f5cd12Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2264b6f5cd12Smrg# ---------------------------------------
2265604a4f4cSmrg# Minimum version: 1.6.0
2266b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2267b6f5cd12Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2268604a4f4cSmrg#
2269604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
2270604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
2271604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2272f303c8d5Smrg# the --with-fop option, it allows maximum flexibility in making decisions
2273b6f5cd12Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2274b6f5cd12Smrg# --with-fop assumes 'auto'.
2275604a4f4cSmrg#
2276604a4f4cSmrg# Interface to module:
2277604a4f4cSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2278604a4f4cSmrg# FOP:	 	returns the path of the fop program found
2279604a4f4cSmrg#		returns the path set by the user in the environment
2280604a4f4cSmrg# --with-fop: 	'yes' user instructs the module to use fop
2281604a4f4cSmrg#		'no' user instructs the module not to use fop
2282604a4f4cSmrg#
2283604a4f4cSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2284604a4f4cSmrg#
2285604a4f4cSmrgAC_DEFUN([XORG_WITH_FOP],[
2286604a4f4cSmrgAC_ARG_VAR([FOP], [Path to fop command])
2287b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
2288604a4f4cSmrgAC_ARG_WITH(fop,
2289604a4f4cSmrg	AS_HELP_STRING([--with-fop],
2290b6f5cd12Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2291b6f5cd12Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2292b6f5cd12Smrgm4_undefine([_defopt])
2293604a4f4cSmrg
2294604a4f4cSmrgif test "x$use_fop" = x"auto"; then
2295604a4f4cSmrg   AC_PATH_PROG([FOP], [fop])
2296604a4f4cSmrg   if test "x$FOP" = "x"; then
2297604a4f4cSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2298604a4f4cSmrg	have_fop=no
2299604a4f4cSmrg   else
2300604a4f4cSmrg        have_fop=yes
2301604a4f4cSmrg   fi
2302604a4f4cSmrgelif test "x$use_fop" = x"yes" ; then
2303604a4f4cSmrg   AC_PATH_PROG([FOP], [fop])
2304604a4f4cSmrg   if test "x$FOP" = "x"; then
2305604a4f4cSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2306604a4f4cSmrg   fi
2307604a4f4cSmrg   have_fop=yes
2308604a4f4cSmrgelif test "x$use_fop" = x"no" ; then
2309604a4f4cSmrg   if test "x$FOP" != "x"; then
2310604a4f4cSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2311604a4f4cSmrg   fi
2312604a4f4cSmrg   have_fop=no
2313604a4f4cSmrgelse
2314604a4f4cSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315604a4f4cSmrgfi
2316b6f5cd12Smrg
2317b6f5cd12Smrg# Test for a minimum version of fop, if provided.
2318b6f5cd12Smrgm4_ifval([$1],
2319b6f5cd12Smrg[if test "$have_fop" = yes; then
2320b6f5cd12Smrg    # scrape the fop version
2321b6f5cd12Smrg    AC_MSG_CHECKING([for fop minimum version])
2322b6f5cd12Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2323b6f5cd12Smrg    AC_MSG_RESULT([$fop_version])
2324b6f5cd12Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2325b6f5cd12Smrg        [if test "x$use_fop" = xauto; then
2326b6f5cd12Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2327b6f5cd12Smrg            have_fop=no
2328b6f5cd12Smrg        else
2329b6f5cd12Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2330b6f5cd12Smrg        fi])
2331b6f5cd12Smrgfi])
2332604a4f4cSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2333604a4f4cSmrg]) # XORG_WITH_FOP
2334604a4f4cSmrg
233579bbd9e8Smrg# XORG_WITH_M4([MIN-VERSION])
233679bbd9e8Smrg# ---------------------------
233779bbd9e8Smrg# Minimum version: 1.19.0
233879bbd9e8Smrg#
233979bbd9e8Smrg# This macro attempts to locate an m4 macro processor which supports
234079bbd9e8Smrg# -I option and is only useful for modules relying on M4 in order to
234179bbd9e8Smrg# expand macros in source code files.
234279bbd9e8Smrg#
234379bbd9e8Smrg# Interface to module:
234479bbd9e8Smrg# M4:	 	returns the path of the m4 program found
234579bbd9e8Smrg#		returns the path set by the user in the environment
234679bbd9e8Smrg#
234779bbd9e8SmrgAC_DEFUN([XORG_WITH_M4], [
234879bbd9e8SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234979bbd9e8Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235079bbd9e8Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235179bbd9e8Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235279bbd9e8Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235379bbd9e8Smrg   [$PATH:/usr/gnu/bin])])
235479bbd9e8Smrg
235579bbd9e8SmrgAC_SUBST([M4], [$ac_cv_path_M4])
235679bbd9e8Smrg]) # XORG_WITH_M4
235779bbd9e8Smrg
2358b6f5cd12Smrg# XORG_WITH_PS2PDF([DEFAULT])
2359604a4f4cSmrg# ----------------
2360604a4f4cSmrg# Minimum version: 1.6.0
2361b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2362604a4f4cSmrg#
2363604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
2364604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
2365604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2366f303c8d5Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2367b6f5cd12Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2368b6f5cd12Smrg# --with-ps2pdf assumes 'auto'.
2369604a4f4cSmrg#
2370604a4f4cSmrg# Interface to module:
2371604a4f4cSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2372604a4f4cSmrg# PS2PDF:	returns the path of the ps2pdf program found
2373604a4f4cSmrg#		returns the path set by the user in the environment
2374604a4f4cSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2375604a4f4cSmrg#		 'no' user instructs the module not to use ps2pdf
2376604a4f4cSmrg#
2377604a4f4cSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2378604a4f4cSmrg#
2379604a4f4cSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2380604a4f4cSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2381b6f5cd12Smrgm4_define([_defopt], m4_default([$1], [auto]))
2382604a4f4cSmrgAC_ARG_WITH(ps2pdf,
2383604a4f4cSmrg	AS_HELP_STRING([--with-ps2pdf],
2384b6f5cd12Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2385b6f5cd12Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2386b6f5cd12Smrgm4_undefine([_defopt])
2387604a4f4cSmrg
2388604a4f4cSmrgif test "x$use_ps2pdf" = x"auto"; then
2389604a4f4cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2390604a4f4cSmrg   if test "x$PS2PDF" = "x"; then
2391604a4f4cSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2392604a4f4cSmrg	have_ps2pdf=no
2393604a4f4cSmrg   else
2394604a4f4cSmrg        have_ps2pdf=yes
2395604a4f4cSmrg   fi
2396604a4f4cSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2397604a4f4cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2398604a4f4cSmrg   if test "x$PS2PDF" = "x"; then
2399604a4f4cSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2400604a4f4cSmrg   fi
2401604a4f4cSmrg   have_ps2pdf=yes
2402604a4f4cSmrgelif test "x$use_ps2pdf" = x"no" ; then
2403604a4f4cSmrg   if test "x$PS2PDF" != "x"; then
2404604a4f4cSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2405604a4f4cSmrg   fi
2406604a4f4cSmrg   have_ps2pdf=no
2407604a4f4cSmrgelse
2408604a4f4cSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409604a4f4cSmrgfi
2410604a4f4cSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2411604a4f4cSmrg]) # XORG_WITH_PS2PDF
2412604a4f4cSmrg
2413604a4f4cSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2414604a4f4cSmrg# ----------------
2415604a4f4cSmrg# Minimum version: 1.6.0
2416604a4f4cSmrg#
2417604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
2418604a4f4cSmrg# not at the appropriate level. This macro enables a builder to skip all
2419604a4f4cSmrg# documentation targets except traditional man pages.
2420604a4f4cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2421f303c8d5Smrg# maximum flexibility in controlling documentation building.
2422604a4f4cSmrg# Refer to:
2423604a4f4cSmrg# XORG_WITH_XMLTO         --with-xmlto
2424604a4f4cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2425604a4f4cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2426604a4f4cSmrg# XORG_WITH_FOP           --with-fop
2427604a4f4cSmrg# XORG_WITH_GROFF         --with-groff
2428604a4f4cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2429604a4f4cSmrg#
2430604a4f4cSmrg# Interface to module:
2431604a4f4cSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2432604a4f4cSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2433604a4f4cSmrg#		 'no' user instructs the module not to generate docs
2434604a4f4cSmrg# parm1:	specify the default value, yes or no.
2435604a4f4cSmrg#
2436604a4f4cSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2437b6f5cd12Smrgm4_define([docs_default], m4_default([$1], [yes]))
2438604a4f4cSmrgAC_ARG_ENABLE(docs,
2439604a4f4cSmrg	AS_HELP_STRING([--enable-docs],
2440b6f5cd12Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2441b6f5cd12Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2442b6f5cd12Smrgm4_undefine([docs_default])
2443604a4f4cSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2444604a4f4cSmrgAC_MSG_CHECKING([whether to build documentation])
2445604a4f4cSmrgAC_MSG_RESULT([$build_docs])
2446604a4f4cSmrg]) # XORG_ENABLE_DOCS
2447604a4f4cSmrg
2448604a4f4cSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2449604a4f4cSmrg# ----------------
2450604a4f4cSmrg# Minimum version: 1.6.0
2451604a4f4cSmrg#
2452604a4f4cSmrg# This macro enables a builder to skip all developer documentation.
2453604a4f4cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2454f303c8d5Smrg# maximum flexibility in controlling documentation building.
2455604a4f4cSmrg# Refer to:
2456604a4f4cSmrg# XORG_WITH_XMLTO         --with-xmlto
2457604a4f4cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2458604a4f4cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2459604a4f4cSmrg# XORG_WITH_FOP           --with-fop
2460604a4f4cSmrg# XORG_WITH_GROFF         --with-groff
2461604a4f4cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2462604a4f4cSmrg#
2463604a4f4cSmrg# Interface to module:
2464604a4f4cSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2465604a4f4cSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2466604a4f4cSmrg#			'no' user instructs the module not to generate developer docs
2467604a4f4cSmrg# parm1:		specify the default value, yes or no.
2468604a4f4cSmrg#
2469604a4f4cSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2470b6f5cd12Smrgm4_define([devel_default], m4_default([$1], [yes]))
2471604a4f4cSmrgAC_ARG_ENABLE(devel-docs,
2472604a4f4cSmrg	AS_HELP_STRING([--enable-devel-docs],
2473b6f5cd12Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2474b6f5cd12Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2475b6f5cd12Smrgm4_undefine([devel_default])
2476604a4f4cSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2477604a4f4cSmrgAC_MSG_CHECKING([whether to build developer documentation])
2478604a4f4cSmrgAC_MSG_RESULT([$build_devel_docs])
2479604a4f4cSmrg]) # XORG_ENABLE_DEVEL_DOCS
2480604a4f4cSmrg
2481604a4f4cSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2482604a4f4cSmrg# ----------------
2483604a4f4cSmrg# Minimum version: 1.6.0
2484604a4f4cSmrg#
2485604a4f4cSmrg# This macro enables a builder to skip all functional specification targets.
2486604a4f4cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2487f303c8d5Smrg# maximum flexibility in controlling documentation building.
2488604a4f4cSmrg# Refer to:
2489604a4f4cSmrg# XORG_WITH_XMLTO         --with-xmlto
2490604a4f4cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2491604a4f4cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2492604a4f4cSmrg# XORG_WITH_FOP           --with-fop
2493604a4f4cSmrg# XORG_WITH_GROFF         --with-groff
2494604a4f4cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2495604a4f4cSmrg#
2496604a4f4cSmrg# Interface to module:
2497604a4f4cSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2498604a4f4cSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2499604a4f4cSmrg#			'no' user instructs the module not to generate specs
2500604a4f4cSmrg# parm1:		specify the default value, yes or no.
2501604a4f4cSmrg#
2502604a4f4cSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2503b6f5cd12Smrgm4_define([spec_default], m4_default([$1], [yes]))
2504604a4f4cSmrgAC_ARG_ENABLE(specs,
2505604a4f4cSmrg	AS_HELP_STRING([--enable-specs],
2506b6f5cd12Smrg	   [Enable building the specs (default: ]spec_default[)]),
2507b6f5cd12Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2508b6f5cd12Smrgm4_undefine([spec_default])
2509604a4f4cSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2510604a4f4cSmrgAC_MSG_CHECKING([whether to build functional specifications])
2511604a4f4cSmrgAC_MSG_RESULT([$build_specs])
2512604a4f4cSmrg]) # XORG_ENABLE_SPECS
2513604a4f4cSmrg
2514b6f5cd12Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2515b6f5cd12Smrg# ----------------------------------------------
2516b6f5cd12Smrg# Minimum version: 1.13.0
2517b6f5cd12Smrg#
2518b6f5cd12Smrg# This macro enables a builder to enable/disable unit testing
2519b6f5cd12Smrg# It makes no assumption about the test cases implementation
2520b6f5cd12Smrg# Test cases may or may not use Automake "Support for test suites"
2521b6f5cd12Smrg# They may or may not use the software utility library GLib
2522b6f5cd12Smrg#
2523b6f5cd12Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2524b6f5cd12Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2525b6f5cd12Smrg# The variable enable_unit_tests is used by other macros in this file.
2526b6f5cd12Smrg#
2527b6f5cd12Smrg# Interface to module:
2528b6f5cd12Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2529b6f5cd12Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2530b6f5cd12Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2531b6f5cd12Smrg#			'no' user instructs the module not to build tests
2532b6f5cd12Smrg# parm1:		specify the default value, yes or no.
2533b6f5cd12Smrg#
2534b6f5cd12SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2535b6f5cd12SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2536b6f5cd12SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2537b6f5cd12SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2538b6f5cd12Smrgm4_define([_defopt], m4_default([$1], [auto]))
2539b6f5cd12SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2540b6f5cd12Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2541b6f5cd12Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2542b6f5cd12Smrgm4_undefine([_defopt])
2543b6f5cd12SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2544b6f5cd12SmrgAC_MSG_CHECKING([whether to build unit test cases])
2545b6f5cd12SmrgAC_MSG_RESULT([$enable_unit_tests])
2546b6f5cd12Smrg]) # XORG_ENABLE_UNIT_TESTS
2547b6f5cd12Smrg
2548b6f5cd12Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2549b6f5cd12Smrg# ------------------------------------------------------
2550b6f5cd12Smrg# Minimum version: 1.17.0
2551b6f5cd12Smrg#
2552b6f5cd12Smrg# This macro enables a builder to enable/disable integration testing
2553b6f5cd12Smrg# It makes no assumption about the test cases' implementation
2554b6f5cd12Smrg# Test cases may or may not use Automake "Support for test suites"
2555b6f5cd12Smrg#
2556b6f5cd12Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2557b6f5cd12Smrg# usually requires less dependencies and may be built and run under less
2558b6f5cd12Smrg# stringent environments than integration tests.
2559b6f5cd12Smrg#
2560b6f5cd12Smrg# Interface to module:
2561b6f5cd12Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2562b6f5cd12Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2563b6f5cd12Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2564b6f5cd12Smrg#                             'no' user instructs the module not to build tests
2565b6f5cd12Smrg# parm1:                      specify the default value, yes or no.
2566b6f5cd12Smrg#
2567b6f5cd12SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2568b6f5cd12SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2569b6f5cd12Smrgm4_define([_defopt], m4_default([$1], [auto]))
2570b6f5cd12SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2571b6f5cd12Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2572b6f5cd12Smrg	[enable_integration_tests=$enableval],
2573b6f5cd12Smrg	[enable_integration_tests=]_defopt)
2574b6f5cd12Smrgm4_undefine([_defopt])
2575b6f5cd12SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2576b6f5cd12Smrg	[test "x$enable_integration_tests" != xno])
2577b6f5cd12SmrgAC_MSG_CHECKING([whether to build unit test cases])
2578b6f5cd12SmrgAC_MSG_RESULT([$enable_integration_tests])
2579b6f5cd12Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580b6f5cd12Smrg
2581b6f5cd12Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2582b6f5cd12Smrg# ----------------------------------------
2583b6f5cd12Smrg# Minimum version: 1.13.0
2584b6f5cd12Smrg#
2585b6f5cd12Smrg# GLib is a library which provides advanced data structures and functions.
2586b6f5cd12Smrg# This macro enables a module to test for the presence of Glib.
2587b6f5cd12Smrg#
2588b6f5cd12Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2589b6f5cd12Smrg# Otherwise the value of $enable_unit_tests is blank.
2590b6f5cd12Smrg#
2591b6f5cd12Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2592b6f5cd12Smrg# test support usually requires less dependencies and may be built and run under
2593b6f5cd12Smrg# less stringent environments than integration tests.
2594b6f5cd12Smrg#
2595b6f5cd12Smrg# Interface to module:
2596b6f5cd12Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2597b6f5cd12Smrg# with_glib: used in configure.ac to know if GLib has been found
2598b6f5cd12Smrg# --with-glib:	'yes' user instructs the module to use glib
2599b6f5cd12Smrg#		'no' user instructs the module not to use glib
2600b6f5cd12Smrg#
2601b6f5cd12SmrgAC_DEFUN([XORG_WITH_GLIB],[
2602b6f5cd12SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2603b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
2604b6f5cd12SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2605b6f5cd12Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2606b6f5cd12Smrg	[with_glib=$withval], [with_glib=]_defopt)
2607b6f5cd12Smrgm4_undefine([_defopt])
2608b6f5cd12Smrg
2609b6f5cd12Smrghave_glib=no
2610b6f5cd12Smrg# Do not probe GLib if user explicitly disabled unit testing
2611b6f5cd12Smrgif test "x$enable_unit_tests" != x"no"; then
2612b6f5cd12Smrg  # Do not probe GLib if user explicitly disabled it
2613b6f5cd12Smrg  if test "x$with_glib" != x"no"; then
2614b6f5cd12Smrg    m4_ifval(
2615b6f5cd12Smrg      [$1],
2616b6f5cd12Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2617b6f5cd12Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2618b6f5cd12Smrg    )
2619b6f5cd12Smrg  fi
2620b6f5cd12Smrgfi
2621b6f5cd12Smrg
2622b6f5cd12Smrg# Not having GLib when unit testing has been explicitly requested is an error
2623b6f5cd12Smrgif test "x$enable_unit_tests" = x"yes"; then
2624b6f5cd12Smrg  if test "x$have_glib" = x"no"; then
2625b6f5cd12Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626b6f5cd12Smrg  fi
2627b6f5cd12Smrgfi
2628b6f5cd12Smrg
2629b6f5cd12Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2630b6f5cd12Smrgif test "x$enable_unit_tests" = x"no"; then
2631b6f5cd12Smrg  if test "x$with_glib" = x"yes"; then
2632b6f5cd12Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2633b6f5cd12Smrg  fi
2634b6f5cd12Smrgfi
2635b6f5cd12Smrg
2636b6f5cd12Smrg# Not having GLib when it has been explicitly requested is an error
2637b6f5cd12Smrgif test "x$with_glib" = x"yes"; then
2638b6f5cd12Smrg  if test "x$have_glib" = x"no"; then
2639b6f5cd12Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2640b6f5cd12Smrg  fi
2641b6f5cd12Smrgfi
2642b6f5cd12Smrg
2643b6f5cd12SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2644b6f5cd12Smrg]) # XORG_WITH_GLIB
2645b6f5cd12Smrg
2646b6f5cd12Smrg# XORG_LD_WRAP([required|optional])
2647b6f5cd12Smrg# ---------------------------------
2648b6f5cd12Smrg# Minimum version: 1.13.0
2649b6f5cd12Smrg#
2650b6f5cd12Smrg# Check if linker supports -wrap, passed via compiler flags
2651b6f5cd12Smrg#
2652b6f5cd12Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2653b6f5cd12Smrg# Otherwise the value of $enable_unit_tests is blank.
2654b6f5cd12Smrg#
2655b6f5cd12Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2656b6f5cd12Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2657b6f5cd12Smrg# available, an argument of "optional" allows use when some unit tests require
2658b6f5cd12Smrg# ld -wrap and others do not.
2659b6f5cd12Smrg#
2660b6f5cd12SmrgAC_DEFUN([XORG_LD_WRAP],[
2661b6f5cd12SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2662b6f5cd12Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2663b6f5cd12Smrg                      void __wrap_exit(int status) { return; }],
2664b6f5cd12Smrg                     [exit(0);])])
2665b6f5cd12Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2666b6f5cd12Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2667b6f5cd12Smrg  if test "x$have_ld_wrap" = x"no"; then
2668b6f5cd12Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2669b6f5cd12Smrg  fi
2670b6f5cd12Smrgfi
2671b6f5cd12SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2672b6f5cd12Smrg#
2673b6f5cd12Smrg]) # XORG_LD_WRAP
2674b6f5cd12Smrg
2675b6f5cd12Smrg# XORG_CHECK_LINKER_FLAGS
2676b6f5cd12Smrg# -----------------------
2677b6f5cd12Smrg# SYNOPSIS
2678b6f5cd12Smrg#
2679b6f5cd12Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2680b6f5cd12Smrg#
2681b6f5cd12Smrg# DESCRIPTION
2682b6f5cd12Smrg#
2683b6f5cd12Smrg#   Check whether the given linker FLAGS work with the current language's
2684b6f5cd12Smrg#   linker, or whether they give an error.
2685b6f5cd12Smrg#
2686b6f5cd12Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2687b6f5cd12Smrg#   success/failure.
2688b6f5cd12Smrg#
2689b6f5cd12Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2690b6f5cd12Smrg#
2691b6f5cd12Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2692b6f5cd12Smrg#
2693b6f5cd12Smrg# LICENSE
2694b6f5cd12Smrg#
2695b6f5cd12Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2696b6f5cd12Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2697b6f5cd12Smrg#   Copyright (c) 2009 Matteo Frigo
2698b6f5cd12Smrg#
2699b6f5cd12Smrg#   This program is free software: you can redistribute it and/or modify it
2700b6f5cd12Smrg#   under the terms of the GNU General Public License as published by the
2701b6f5cd12Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2702b6f5cd12Smrg#   option) any later version.
2703b6f5cd12Smrg#
2704b6f5cd12Smrg#   This program is distributed in the hope that it will be useful, but
2705b6f5cd12Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2706b6f5cd12Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2707b6f5cd12Smrg#   Public License for more details.
2708b6f5cd12Smrg#
2709b6f5cd12Smrg#   You should have received a copy of the GNU General Public License along
2710b6f5cd12Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2711b6f5cd12Smrg#
2712b6f5cd12Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2713b6f5cd12Smrg#   gives unlimited permission to copy, distribute and modify the configure
2714b6f5cd12Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2715b6f5cd12Smrg#   need not follow the terms of the GNU General Public License when using
2716b6f5cd12Smrg#   or distributing such scripts, even though portions of the text of the
2717b6f5cd12Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2718b6f5cd12Smrg#   all other use of the material that constitutes the Autoconf Macro.
2719b6f5cd12Smrg#
2720b6f5cd12Smrg#   This special exception to the GPL applies to versions of the Autoconf
2721b6f5cd12Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2722b6f5cd12Smrg#   modified version of the Autoconf Macro, you may extend this special
2723b6f5cd12Smrg#   exception to the GPL to apply to your modified version as well.#
2724b6f5cd12SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2725b6f5cd12Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2726b6f5cd12Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2727b6f5cd12SmrgAS_LITERAL_IF([$1],
2728b6f5cd12Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2729b6f5cd12Smrg      ax_save_FLAGS=$LDFLAGS
2730b6f5cd12Smrg      LDFLAGS="$1"
2731b6f5cd12Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2732b6f5cd12Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2733b6f5cd12Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2734b6f5cd12Smrg      LDFLAGS=$ax_save_FLAGS])],
2735b6f5cd12Smrg  [ax_save_FLAGS=$LDFLAGS
2736b6f5cd12Smrg   LDFLAGS="$1"
2737b6f5cd12Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2738b6f5cd12Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2739b6f5cd12Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2740b6f5cd12Smrg   LDFLAGS=$ax_save_FLAGS])
2741b6f5cd12Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2742b6f5cd12SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2743b6f5cd12Smrgif test "x$xorg_check_linker_flags" = xyes; then
2744b6f5cd12Smrg	m4_default([$2], :)
2745b6f5cd12Smrgelse
2746b6f5cd12Smrg	m4_default([$3], :)
2747b6f5cd12Smrgfi
2748b6f5cd12Smrg]) # XORG_CHECK_LINKER_FLAGS
2749b6f5cd12Smrg
2750b6f5cd12Smrg# XORG_MEMORY_CHECK_FLAGS
2751b6f5cd12Smrg# -----------------------
2752b6f5cd12Smrg# Minimum version: 1.16.0
2753b6f5cd12Smrg#
2754b6f5cd12Smrg# This macro attempts to find appropriate memory checking functionality
2755b6f5cd12Smrg# for various platforms which unit testing code may use to catch various
2756b6f5cd12Smrg# forms of memory allocation and access errors in testing.
2757b6f5cd12Smrg#
2758b6f5cd12Smrg# Interface to module:
2759b6f5cd12Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2760b6f5cd12Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2761b6f5cd12Smrg#
2762b6f5cd12Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2763b6f5cd12Smrg#
2764b6f5cd12SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765b6f5cd12Smrg
2766b6f5cd12SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2767b6f5cd12SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2768b6f5cd12Smrg           [Environment variables to enable memory checking in tests])
2769b6f5cd12Smrg
2770b6f5cd12Smrg# Check for different types of support on different platforms
2771b6f5cd12Smrgcase $host_os in
2772b6f5cd12Smrg    solaris*)
2773b6f5cd12Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2774b6f5cd12Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2775b6f5cd12Smrg        ;;
2776b6f5cd12Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2777b6f5cd12Smrg        # both directly and inverted, so should not be 0 or 255.
2778b6f5cd12Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2779b6f5cd12Smrg        ;;
2780b6f5cd12Smrg    darwin*)
2781b6f5cd12Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2782b6f5cd12Smrg        ;;
2783b6f5cd12Smrg    *bsd*)
2784b6f5cd12Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2785b6f5cd12Smrg        ;;
2786b6f5cd12Smrgesac
2787b6f5cd12Smrg
2788b6f5cd12Smrg# User supplied flags override default flags
2789b6f5cd12Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2790b6f5cd12Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791b6f5cd12Smrgfi
2792b6f5cd12Smrg
2793b6f5cd12SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2794b6f5cd12Smrg]) # XORG_WITH_LINT
2795b6f5cd12Smrg
279621ecb1efSmrg# XORG_CHECK_MALLOC_ZERO
279721ecb1efSmrg# ----------------------
279821ecb1efSmrg# Minimum version: 1.0.0
279921ecb1efSmrg#
280021ecb1efSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280121ecb1efSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280221ecb1efSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280321ecb1efSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280421ecb1efSmrgAC_ARG_ENABLE(malloc0returnsnull,
280521ecb1efSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280621ecb1efSmrg		       [malloc(0) returns NULL (default: auto)]),
280721ecb1efSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280821ecb1efSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
28091e00de39Smrg
281021ecb1efSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281121ecb1efSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281279bbd9e8SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281379bbd9e8Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2814b6f5cd12Smrg#include <stdlib.h>
2815b6f5cd12Smrg],[
281621ecb1efSmrg    char *m0, *r0, *c0, *p;
281721ecb1efSmrg    m0 = malloc(0);
281821ecb1efSmrg    p = malloc(10);
281921ecb1efSmrg    r0 = realloc(p,0);
2820b6f5cd12Smrg    c0 = calloc(0,10);
2821b6f5cd12Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2822b6f5cd12Smrg])],
282379bbd9e8Smrg		[xorg_cv_malloc0_returns_null=yes],
282479bbd9e8Smrg		[xorg_cv_malloc0_returns_null=no])])
282579bbd9e8SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
282621ecb1efSmrgfi
282721ecb1efSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
28281e00de39Smrg
282921ecb1efSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283021ecb1efSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283121ecb1efSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283221ecb1efSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
283321ecb1efSmrgelse
283421ecb1efSmrg	MALLOC_ZERO_CFLAGS=""
283521ecb1efSmrg	XMALLOC_ZERO_CFLAGS=""
283621ecb1efSmrg	XTMALLOC_ZERO_CFLAGS=""
283721ecb1efSmrgfi
28381e00de39Smrg
283921ecb1efSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284021ecb1efSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284121ecb1efSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284221ecb1efSmrg]) # XORG_CHECK_MALLOC_ZERO
28431e00de39Smrg
284421ecb1efSmrg# XORG_WITH_LINT()
284521ecb1efSmrg# ----------------
284621ecb1efSmrg# Minimum version: 1.1.0
284721ecb1efSmrg#
2848604a4f4cSmrg# This macro enables the use of a tool that flags some suspicious and
2849604a4f4cSmrg# non-portable constructs (likely to be bugs) in C language source code.
2850604a4f4cSmrg# It will attempt to locate the tool and use appropriate options.
2851604a4f4cSmrg# There are various lint type tools on different platforms.
2852604a4f4cSmrg#
2853604a4f4cSmrg# Interface to module:
2854604a4f4cSmrg# LINT:		returns the path to the tool found on the platform
2855604a4f4cSmrg#		or the value set to LINT on the configure cmd line
2856604a4f4cSmrg#		also an Automake conditional
2857604a4f4cSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2858604a4f4cSmrg#
2859604a4f4cSmrg# --with-lint:	'yes' user instructs the module to use lint
2860604a4f4cSmrg#		'no' user instructs the module not to use lint (default)
2861604a4f4cSmrg#
2862604a4f4cSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2863604a4f4cSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286421ecb1efSmrg#
286521ecb1efSmrgAC_DEFUN([XORG_WITH_LINT],[
286621ecb1efSmrg
2867604a4f4cSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2868604a4f4cSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286921ecb1efSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287021ecb1efSmrg		[Use a lint-style source code checker (default: disabled)])],
287121ecb1efSmrg		[use_lint=$withval], [use_lint=no])
2872604a4f4cSmrg
2873604a4f4cSmrg# Obtain platform specific info like program name and options
2874604a4f4cSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2875604a4f4cSmrgcase $host_os in
2876604a4f4cSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2877604a4f4cSmrg	lint_name=splint
2878604a4f4cSmrg	lint_options="-badflag"
2879604a4f4cSmrg	;;
2880604a4f4cSmrg  *freebsd* | *netbsd*)
2881604a4f4cSmrg	lint_name=lint
2882604a4f4cSmrg	lint_options="-u -b"
2883604a4f4cSmrg	;;
2884604a4f4cSmrg  *solaris*)
2885604a4f4cSmrg	lint_name=lint
2886604a4f4cSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2887604a4f4cSmrg	;;
2888604a4f4cSmrgesac
2889604a4f4cSmrg
2890604a4f4cSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2891604a4f4cSmrgif test "x$use_lint" = x"yes" ; then
2892604a4f4cSmrg   AC_PATH_PROG([LINT], [$lint_name])
2893604a4f4cSmrg   if test "x$LINT" = "x"; then
2894604a4f4cSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2895604a4f4cSmrg   fi
2896604a4f4cSmrgelif test "x$use_lint" = x"no" ; then
2897604a4f4cSmrg   if test "x$LINT" != "x"; then
2898604a4f4cSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2899604a4f4cSmrg   fi
290021ecb1efSmrgelse
2901604a4f4cSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
29021e00de39Smrgfi
2903604a4f4cSmrg
2904604a4f4cSmrg# User supplied flags override default flags
2905604a4f4cSmrgif test "x$LINT_FLAGS" != "x"; then
2906604a4f4cSmrg   lint_options=$LINT_FLAGS
29071e00de39Smrgfi
29081e00de39Smrg
2909604a4f4cSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2910604a4f4cSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
29111e00de39Smrg
291221ecb1efSmrg]) # XORG_WITH_LINT
29131e00de39Smrg
291421ecb1efSmrg# XORG_LINT_LIBRARY(LIBNAME)
291521ecb1efSmrg# --------------------------
291621ecb1efSmrg# Minimum version: 1.1.0
291721ecb1efSmrg#
291821ecb1efSmrg# Sets up flags for building lint libraries for checking programs that call
291921ecb1efSmrg# functions in the library.
292021ecb1efSmrg#
2921604a4f4cSmrg# Interface to module:
2922604a4f4cSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2923604a4f4cSmrg# MAKE_LINT_LIB		- Automake conditional
2924604a4f4cSmrg#
2925604a4f4cSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2926604a4f4cSmrg#			  - 'no' user instructs the module not to create a lint library (default)
29271e00de39Smrg
292821ecb1efSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292921ecb1efSmrgAC_REQUIRE([XORG_WITH_LINT])
293021ecb1efSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293121ecb1efSmrg	[Create lint library (default: disabled)])],
293221ecb1efSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2933604a4f4cSmrg
2934604a4f4cSmrgif test "x$make_lint_lib" = x"yes" ; then
2935604a4f4cSmrg   LINTLIB=llib-l$1.ln
2936604a4f4cSmrg   if test "x$LINT" = "x"; then
2937604a4f4cSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2938604a4f4cSmrg   fi
2939604a4f4cSmrgelif test "x$make_lint_lib" != x"no" ; then
2940604a4f4cSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
294121ecb1efSmrgfi
2942604a4f4cSmrg
294321ecb1efSmrgAC_SUBST(LINTLIB)
294421ecb1efSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29451e00de39Smrg
294621ecb1efSmrg]) # XORG_LINT_LIBRARY
29471e00de39Smrg
2948b6f5cd12Smrg# XORG_COMPILER_BRAND
2949b6f5cd12Smrg# -------------------
2950b6f5cd12Smrg# Minimum version: 1.14.0
2951b6f5cd12Smrg#
2952b6f5cd12Smrg# Checks for various brands of compilers and sets flags as appropriate:
2953b6f5cd12Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2954b6f5cd12Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2955b6f5cd12Smrg#   clang compiler - sets CLANGCC to "yes"
2956b6f5cd12Smrg#   Intel compiler - sets INTELCC to "yes"
2957b6f5cd12Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2958b6f5cd12Smrg#
2959b6f5cd12SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2960b6f5cd12SmrgAC_LANG_CASE(
2961b6f5cd12Smrg	[C], [
2962f303c8d5Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2963f303c8d5Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2964f303c8d5Smrg		m4_version_prereq([2.70],
2965f303c8d5Smrg			[AC_REQUIRE([AC_PROG_CC])],
2966f303c8d5Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
2967b6f5cd12Smrg	],
2968b6f5cd12Smrg	[C++], [
2969b6f5cd12Smrg		AC_REQUIRE([AC_PROG_CXX])
2970b6f5cd12Smrg	]
2971b6f5cd12Smrg)
2972b6f5cd12SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2973b6f5cd12SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2974b6f5cd12SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2975b6f5cd12Smrg]) # XORG_COMPILER_BRAND
2976b6f5cd12Smrg
2977b6f5cd12Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2978b6f5cd12Smrg# ---------------
2979b6f5cd12Smrg# Minimum version: 1.16.0
2980b6f5cd12Smrg#
2981b6f5cd12Smrg# Test if the compiler works when passed the given flag as a command line argument.
2982f303c8d5Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
2983b6f5cd12Smrg# next flag in the list until there are no more options.
2984b6f5cd12Smrg#
2985b6f5cd12Smrg# Note that this does not guarantee that the compiler supports the flag as some
2986b6f5cd12Smrg# compilers will simply ignore arguments that they do not understand, but we do
2987b6f5cd12Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2988b6f5cd12Smrg# -Werror=unused-command-line-argument
2989b6f5cd12Smrg#
2990b6f5cd12SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2991b6f5cd12Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2992b6f5cd12Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993b6f5cd12Smrg
2994b6f5cd12SmrgAC_LANG_COMPILER_REQUIRE
2995b6f5cd12Smrg
2996b6f5cd12SmrgAC_LANG_CASE(
2997b6f5cd12Smrg	[C], [
2998f303c8d5Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2999f303c8d5Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3000f303c8d5Smrg		m4_version_prereq([2.70],
3001f303c8d5Smrg			[AC_REQUIRE([AC_PROG_CC])],
3002f303c8d5Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3003b6f5cd12Smrg		define([PREFIX], [C])
3004b6f5cd12Smrg		define([CACHE_PREFIX], [cc])
3005b6f5cd12Smrg		define([COMPILER], [$CC])
3006b6f5cd12Smrg	],
3007b6f5cd12Smrg	[C++], [
3008b6f5cd12Smrg		define([PREFIX], [CXX])
3009b6f5cd12Smrg		define([CACHE_PREFIX], [cxx])
3010b6f5cd12Smrg		define([COMPILER], [$CXX])
3011b6f5cd12Smrg	]
3012b6f5cd12Smrg)
3013b6f5cd12Smrg
3014b6f5cd12Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3015b6f5cd12Smrg
3016b6f5cd12Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3017b6f5cd12Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3018b6f5cd12Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3019b6f5cd12Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3020b6f5cd12Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3021b6f5cd12Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3022b6f5cd12Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3023b6f5cd12Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3024b6f5cd12Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3025b6f5cd12Smrgfi
3026b6f5cd12Smrg
3027b6f5cd12Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3028b6f5cd12Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3029b6f5cd12Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3030b6f5cd12Smrg	fi
3031b6f5cd12Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3032b6f5cd12Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3033b6f5cd12Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3034b6f5cd12Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3035b6f5cd12Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3036b6f5cd12Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3037b6f5cd12Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3038b6f5cd12Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3039b6f5cd12Smrgfi
3040b6f5cd12Smrg
3041b6f5cd12Smrgfound="no"
3042b6f5cd12Smrgm4_foreach([flag], m4_cdr($@), [
3043b6f5cd12Smrg	if test $found = "no" ; then
304479bbd9e8Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3045b6f5cd12Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3046b6f5cd12Smrg		fi
3047b6f5cd12Smrg
304879bbd9e8Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3049b6f5cd12Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3050b6f5cd12Smrg		fi
3051b6f5cd12Smrg
3052b6f5cd12Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3053b6f5cd12Smrg
3054b6f5cd12Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3055b6f5cd12Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3056b6f5cd12Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3057b6f5cd12Smrg		AC_CACHE_VAL($cacheid,
3058b6f5cd12Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3059b6f5cd12Smrg					     [eval $cacheid=yes],
3060b6f5cd12Smrg					     [eval $cacheid=no])])
3061b6f5cd12Smrg
3062b6f5cd12Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3063b6f5cd12Smrg
3064b6f5cd12Smrg		eval supported=\$$cacheid
3065b6f5cd12Smrg		AC_MSG_RESULT([$supported])
3066b6f5cd12Smrg		if test "$supported" = "yes" ; then
3067b6f5cd12Smrg			$1="$$1 ]flag["
3068b6f5cd12Smrg			found="yes"
3069b6f5cd12Smrg		fi
3070b6f5cd12Smrg	fi
3071b6f5cd12Smrg])
3072b6f5cd12Smrg]) # XORG_TESTSET_CFLAG
3073b6f5cd12Smrg
3074b6f5cd12Smrg# XORG_COMPILER_FLAGS
3075b6f5cd12Smrg# ---------------
3076b6f5cd12Smrg# Minimum version: 1.16.0
3077b6f5cd12Smrg#
3078b6f5cd12Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3079b6f5cd12Smrg# arguments supported by the selected compiler which do NOT alter the generated
3080b6f5cd12Smrg# code.  These arguments will cause the compiler to print various warnings
3081b6f5cd12Smrg# during compilation AND turn a conservative set of warnings into errors.
3082b6f5cd12Smrg#
3083b6f5cd12Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3084b6f5cd12Smrg# future versions of util-macros as options are added to new compilers.
3085b6f5cd12Smrg#
3086b6f5cd12SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3087b6f5cd12SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3088b6f5cd12Smrg
3089b6f5cd12SmrgAC_ARG_ENABLE(selective-werror,
3090b6f5cd12Smrg              AS_HELP_STRING([--disable-selective-werror],
3091b6f5cd12Smrg                             [Turn off selective compiler errors. (default: enabled)]),
3092b6f5cd12Smrg              [SELECTIVE_WERROR=$enableval],
3093b6f5cd12Smrg              [SELECTIVE_WERROR=yes])
3094b6f5cd12Smrg
3095b6f5cd12SmrgAC_LANG_CASE(
3096b6f5cd12Smrg        [C], [
3097b6f5cd12Smrg                define([PREFIX], [C])
3098b6f5cd12Smrg        ],
3099b6f5cd12Smrg        [C++], [
3100b6f5cd12Smrg                define([PREFIX], [CXX])
3101b6f5cd12Smrg        ]
3102b6f5cd12Smrg)
3103b6f5cd12Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3104b6f5cd12Smrgif test "x$SUNCC" = "xyes"; then
3105b6f5cd12Smrg    [BASE_]PREFIX[FLAGS]="-v"
3106b6f5cd12Smrgelse
3107b6f5cd12Smrg    [BASE_]PREFIX[FLAGS]=""
3108b6f5cd12Smrgfi
3109b6f5cd12Smrg
3110b6f5cd12Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3111b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3112b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3113b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3114b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3115b6f5cd12Smrg
3116b6f5cd12SmrgAC_LANG_CASE(
3117b6f5cd12Smrg	[C], [
3118b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3119b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3120b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3121b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
312279bbd9e8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3123b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3124b6f5cd12Smrg	]
3125b6f5cd12Smrg)
3126b6f5cd12Smrg
3127b6f5cd12Smrg# This chunk adds additional warnings that could catch undesired effects.
3128b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3129b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3130b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3131b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3132b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3133b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
313479bbd9e8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3135b6f5cd12Smrg
3136b6f5cd12Smrg# These are currently disabled because they are noisy.  They will be enabled
3137b6f5cd12Smrg# in the future once the codebase is sufficiently modernized to silence
3138b6f5cd12Smrg# them.  For now, I don't want them to drown out the other warnings.
3139b6f5cd12Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3140b6f5cd12Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
314179bbd9e8Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3142b6f5cd12Smrg
3143f303c8d5Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
3144b6f5cd12Smrg# when there are problems that should be fixed.
3145b6f5cd12Smrg
3146b6f5cd12Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3147b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3148b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3149b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3150b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3151b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3152b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3153b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3154b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3155b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3156b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3157b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3158b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3159b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3160b6f5cd12Smrgelse
3161b6f5cd12SmrgAC_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])
3162b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3163b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3164b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3165b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3166b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3167b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3168b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3169b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3170b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3171b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3172b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3173b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3174b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3175b6f5cd12Smrgfi
3176b6f5cd12Smrg
3177b6f5cd12SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3178b6f5cd12Smrg]) # XORG_COMPILER_FLAGS
3179b6f5cd12Smrg
318021ecb1efSmrg# XORG_CWARNFLAGS
318121ecb1efSmrg# ---------------
318221ecb1efSmrg# Minimum version: 1.2.0
3183b6f5cd12Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
318421ecb1efSmrg#
318521ecb1efSmrg# Defines CWARNFLAGS to enable C compiler warnings.
318621ecb1efSmrg#
3187b6f5cd12Smrg# This function is deprecated because it defines -fno-strict-aliasing
3188b6f5cd12Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3189b6f5cd12Smrg# is needed, then it should be added explicitly in the module when
3190b6f5cd12Smrg# it is updated to use BASE_CFLAGS.
3191b6f5cd12Smrg#
319221ecb1efSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3193b6f5cd12SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3194b6f5cd12SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3195b6f5cd12SmrgAC_LANG_CASE(
3196b6f5cd12Smrg	[C], [
3197b6f5cd12Smrg		CWARNFLAGS="$BASE_CFLAGS"
3198b6f5cd12Smrg		if  test "x$GCC" = xyes ; then
3199b6f5cd12Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3200b6f5cd12Smrg		fi
3201b6f5cd12Smrg		AC_SUBST(CWARNFLAGS)
3202b6f5cd12Smrg	]
3203b6f5cd12Smrg)
320421ecb1efSmrg]) # XORG_CWARNFLAGS
32051e00de39Smrg
320621ecb1efSmrg# XORG_STRICT_OPTION
320721ecb1efSmrg# -----------------------
320821ecb1efSmrg# Minimum version: 1.3.0
32091e00de39Smrg#
3210b6f5cd12Smrg# Add configure option to enable strict compilation flags, such as treating
3211b6f5cd12Smrg# warnings as fatal errors.
3212b6f5cd12Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3213b6f5cd12Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3214b6f5cd12Smrg#
3215b6f5cd12Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3216b6f5cd12Smrg# when strict compilation is unconditionally desired.
321721ecb1efSmrgAC_DEFUN([XORG_STRICT_OPTION], [
321821ecb1efSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3219b6f5cd12SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
322021ecb1efSmrg
322121ecb1efSmrgAC_ARG_ENABLE(strict-compilation,
322221ecb1efSmrg			  AS_HELP_STRING([--enable-strict-compilation],
322321ecb1efSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
322421ecb1efSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3225b6f5cd12Smrg
3226b6f5cd12SmrgAC_LANG_CASE(
3227b6f5cd12Smrg        [C], [
3228b6f5cd12Smrg                define([PREFIX], [C])
3229b6f5cd12Smrg        ],
3230b6f5cd12Smrg        [C++], [
3231b6f5cd12Smrg                define([PREFIX], [CXX])
3232b6f5cd12Smrg        ]
3233b6f5cd12Smrg)
3234b6f5cd12Smrg
3235b6f5cd12Smrg[STRICT_]PREFIX[FLAGS]=""
3236b6f5cd12SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3237b6f5cd12SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3238b6f5cd12Smrg
3239b6f5cd12Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3240b6f5cd12Smrg# activate it with -Werror, so we add it here explicitly.
3241b6f5cd12SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3242b6f5cd12Smrg
324321ecb1efSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3244b6f5cd12Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3245b6f5cd12Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
324621ecb1efSmrgfi
3247b6f5cd12SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3248b6f5cd12SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3249b6f5cd12SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
325021ecb1efSmrg]) # XORG_STRICT_OPTION
32511e00de39Smrg
3252f303c8d5Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3253f303c8d5Smrg# ---------------------------
3254f303c8d5Smrg# Minimum version: 1.20.0
3255f303c8d5Smrg#
3256f303c8d5Smrg# Defines default options for X.Org modules which don't compile code,
3257f303c8d5Smrg# such as fonts, bitmaps, cursors, and docs.
3258f303c8d5Smrg#
3259f303c8d5SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3260f303c8d5SmrgAC_REQUIRE([AC_PROG_INSTALL])
3261f303c8d5SmrgXORG_RELEASE_VERSION
3262f303c8d5SmrgXORG_CHANGELOG
3263f303c8d5SmrgXORG_INSTALL
3264f303c8d5SmrgXORG_MANPAGE_SECTIONS
3265f303c8d5Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3266f303c8d5Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3267f303c8d5Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3268f303c8d5Smrg
326921ecb1efSmrg# XORG_DEFAULT_OPTIONS
327021ecb1efSmrg# --------------------
327121ecb1efSmrg# Minimum version: 1.3.0
32721e00de39Smrg#
3273f303c8d5Smrg# Defines default options for X.Org modules which compile code.
327421ecb1efSmrg#
327521ecb1efSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3276604a4f4cSmrgAC_REQUIRE([AC_PROG_INSTALL])
3277b6f5cd12SmrgXORG_COMPILER_FLAGS
327821ecb1efSmrgXORG_CWARNFLAGS
327921ecb1efSmrgXORG_STRICT_OPTION
3280f303c8d5SmrgXORG_DEFAULT_NOCODE_OPTIONS
328121ecb1efSmrg]) # XORG_DEFAULT_OPTIONS
3282604a4f4cSmrg
3283604a4f4cSmrg# XORG_INSTALL()
3284604a4f4cSmrg# ----------------
3285604a4f4cSmrg# Minimum version: 1.4.0
3286604a4f4cSmrg#
3287604a4f4cSmrg# Defines the variable INSTALL_CMD as the command to copy
3288604a4f4cSmrg# INSTALL from $prefix/share/util-macros.
3289604a4f4cSmrg#
3290604a4f4cSmrgAC_DEFUN([XORG_INSTALL], [
3291604a4f4cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3292604a4f4cSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3293604a4f4cSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3294604a4f4cSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3295d67195daSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3296d67195daSmrgtouch \$(top_srcdir)/INSTALL; \
3297d67195daSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3298604a4f4cSmrgAC_SUBST([INSTALL_CMD])
3299604a4f4cSmrg]) # XORG_INSTALL
330021ecb1efSmrgdnl Copyright 2005 Red Hat, Inc
330121ecb1efSmrgdnl
330221ecb1efSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
330321ecb1efSmrgdnl documentation for any purpose is hereby granted without fee, provided that
330421ecb1efSmrgdnl the above copyright notice appear in all copies and that both that
330521ecb1efSmrgdnl copyright notice and this permission notice appear in supporting
330621ecb1efSmrgdnl documentation.
330721ecb1efSmrgdnl
330821ecb1efSmrgdnl The above copyright notice and this permission notice shall be included
330921ecb1efSmrgdnl in all copies or substantial portions of the Software.
331021ecb1efSmrgdnl
331121ecb1efSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
331221ecb1efSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
331321ecb1efSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
331421ecb1efSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
331521ecb1efSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
331621ecb1efSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
331721ecb1efSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
331821ecb1efSmrgdnl
331921ecb1efSmrgdnl Except as contained in this notice, the name of the copyright holders shall
332021ecb1efSmrgdnl not be used in advertising or otherwise to promote the sale, use or
332121ecb1efSmrgdnl other dealings in this Software without prior written authorization
332221ecb1efSmrgdnl from the copyright holders.
332321ecb1efSmrgdnl
33241e00de39Smrg
332521ecb1efSmrg# XORG_RELEASE_VERSION
332621ecb1efSmrg# --------------------
3327604a4f4cSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
332879bbd9e8Smrg
332921ecb1efSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
333021ecb1efSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
333121ecb1efSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
333221ecb1efSmrg		[Major version of this package])
333321ecb1efSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
333421ecb1efSmrg	if test "x$PVM" = "x"; then
333521ecb1efSmrg		PVM="0"
333621ecb1efSmrg	fi
333721ecb1efSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
333821ecb1efSmrg		[$PVM],
333921ecb1efSmrg		[Minor version of this package])
334021ecb1efSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
334121ecb1efSmrg	if test "x$PVP" = "x"; then
334221ecb1efSmrg		PVP="0"
334321ecb1efSmrg	fi
334421ecb1efSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
334521ecb1efSmrg		[$PVP],
334621ecb1efSmrg		[Patch version of this package])
334721ecb1efSmrg])
33481e00de39Smrg
334921ecb1efSmrg# XORG_CHANGELOG()
335021ecb1efSmrg# ----------------
335121ecb1efSmrg# Minimum version: 1.2.0
335221ecb1efSmrg#
335321ecb1efSmrg# Defines the variable CHANGELOG_CMD as the command to generate
335421ecb1efSmrg# ChangeLog from git.
335521ecb1efSmrg#
335621ecb1efSmrg#
335721ecb1efSmrgAC_DEFUN([XORG_CHANGELOG], [
3358d67195daSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3359604a4f4cSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3360d67195daSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3361d67195daSmrgtouch \$(top_srcdir)/ChangeLog; \
3362d67195daSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
336321ecb1efSmrgAC_SUBST([CHANGELOG_CMD])
336421ecb1efSmrg]) # XORG_CHANGELOG
33651e00de39Smrg
3366