131e5d586Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
21afad795Smrg
331e5d586Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4492e1cfeSmrg
5492e1cfeSmrg# This file is free software; the Free Software Foundation
6492e1cfeSmrg# gives unlimited permission to copy and/or distribute it,
7492e1cfeSmrg# with or without modifications, as long as this notice is preserved.
8492e1cfeSmrg
9492e1cfeSmrg# This program is distributed in the hope that it will be useful,
10492e1cfeSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11492e1cfeSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12492e1cfeSmrg# PARTICULAR PURPOSE.
13492e1cfeSmrg
141afad795Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
159e0146f7Smrgm4_ifndef([AC_AUTOCONF_VERSION],
169e0146f7Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1731e5d586Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
1831e5d586Smrg[m4_warning([this file was generated for autoconf 2.71.
199e0146f7SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
209e0146f7SmrgIf you have problems, you may need to regenerate the build system entirely.
211afad795SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22492e1cfeSmrg
2331e5d586Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2431e5d586Smrg#
2531e5d586Smrg# This file is free software; the Free Software Foundation
2631e5d586Smrg# gives unlimited permission to copy and/or distribute it,
2731e5d586Smrg# with or without modifications, as long as this notice is preserved.
28b78bb896Smrg
2931e5d586Smrg# AM_AUTOMAKE_VERSION(VERSION)
3031e5d586Smrg# ----------------------------
3131e5d586Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3231e5d586Smrg# generated from the m4 files accompanying Automake X.Y.
3331e5d586Smrg# (This private macro should not be called outside this file.)
3431e5d586SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3531e5d586Smrg[am__api_version='1.16'
3631e5d586Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3731e5d586Smrgdnl require some minimum version.  Point them to the right macro.
3831e5d586Smrgm4_if([$1], [1.16.5], [],
3931e5d586Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4031e5d586Smrg])
41b78bb896Smrg
4231e5d586Smrg# _AM_AUTOCONF_VERSION(VERSION)
4331e5d586Smrg# -----------------------------
4431e5d586Smrg# aclocal traces this macro to find the Autoconf version.
4531e5d586Smrg# This is a private macro too.  Using m4_define simplifies
4631e5d586Smrg# the logic in aclocal, which can simply ignore this definition.
4731e5d586Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48492e1cfeSmrg
4931e5d586Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5031e5d586Smrg# -------------------------------
5131e5d586Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5231e5d586Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5331e5d586SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5431e5d586Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5531e5d586Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5631e5d586Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5731e5d586Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
589e0146f7Smrg
5931e5d586Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60492e1cfeSmrg
6131e5d586Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6231e5d586Smrg#
6331e5d586Smrg# This file is free software; the Free Software Foundation
6431e5d586Smrg# gives unlimited permission to copy and/or distribute it,
6531e5d586Smrg# with or without modifications, as long as this notice is preserved.
66492e1cfeSmrg
6731e5d586Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6831e5d586Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6931e5d586Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7031e5d586Smrg#
7131e5d586Smrg# Of course, Automake must honor this variable whenever it calls a
7231e5d586Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7331e5d586Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7431e5d586Smrg# depending on how configure is run.  This is pretty annoying, since
7531e5d586Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7631e5d586Smrg# source directory, any form will work fine, but in subdirectories a
7731e5d586Smrg# relative path needs to be adjusted first.
7831e5d586Smrg#
7931e5d586Smrg# $ac_aux_dir/missing
8031e5d586Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8131e5d586Smrg# $top_srcdir/$ac_aux_dir/missing
8231e5d586Smrg#    fails if $ac_aux_dir is absolute,
8331e5d586Smrg#    fails when called from a subdirectory in a VPATH build with
8431e5d586Smrg#          a relative $ac_aux_dir
8531e5d586Smrg#
8631e5d586Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8731e5d586Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8831e5d586Smrg# harmless because $srcdir is '.', but things will broke when you
8931e5d586Smrg# start a VPATH build or use an absolute $srcdir.
9031e5d586Smrg#
9131e5d586Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9231e5d586Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9331e5d586Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9431e5d586Smrg# and then we would define $MISSING as
9531e5d586Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9631e5d586Smrg# This will work as long as MISSING is not called from configure, because
9731e5d586Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9831e5d586Smrg# However there are other variables, like CC, which are often used in
9931e5d586Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10031e5d586Smrg#
10131e5d586Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10231e5d586Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10331e5d586Smrg# configured tree to be moved without reconfiguration.
104492e1cfeSmrg
10531e5d586SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10631e5d586Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10731e5d586Smrg# Expand $ac_aux_dir to an absolute path.
10831e5d586Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10931e5d586Smrg])
110492e1cfeSmrg
11131e5d586Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112492e1cfeSmrg
11331e5d586Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11431e5d586Smrg#
11531e5d586Smrg# This file is free software; the Free Software Foundation
11631e5d586Smrg# gives unlimited permission to copy and/or distribute it,
11731e5d586Smrg# with or without modifications, as long as this notice is preserved.
118492e1cfeSmrg
11931e5d586Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12031e5d586Smrg# -------------------------------------
12131e5d586Smrg# Define a conditional.
12231e5d586SmrgAC_DEFUN([AM_CONDITIONAL],
12331e5d586Smrg[AC_PREREQ([2.52])dnl
12431e5d586Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12531e5d586Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12631e5d586SmrgAC_SUBST([$1_TRUE])dnl
12731e5d586SmrgAC_SUBST([$1_FALSE])dnl
12831e5d586Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12931e5d586Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13031e5d586Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13131e5d586Smrgif $2; then
13231e5d586Smrg  $1_TRUE=
13331e5d586Smrg  $1_FALSE='#'
13431e5d586Smrgelse
13531e5d586Smrg  $1_TRUE='#'
13631e5d586Smrg  $1_FALSE=
13731e5d586Smrgfi
13831e5d586SmrgAC_CONFIG_COMMANDS_PRE(
13931e5d586Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14031e5d586Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14131e5d586SmrgUsually this means the macro was only invoked conditionally.]])
14231e5d586Smrgfi])])
143492e1cfeSmrg
14431e5d586Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14531e5d586Smrg#
14631e5d586Smrg# This file is free software; the Free Software Foundation
14731e5d586Smrg# gives unlimited permission to copy and/or distribute it,
14831e5d586Smrg# with or without modifications, as long as this notice is preserved.
149492e1cfeSmrg
150492e1cfeSmrg
15131e5d586Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15231e5d586Smrg# written in clear, in which case automake, when reading aclocal.m4,
15331e5d586Smrg# will think it sees a *use*, and therefore will trigger all it's
15431e5d586Smrg# C support machinery.  Also note that it means that autoscan, seeing
15531e5d586Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156492e1cfeSmrg
157492e1cfeSmrg
15831e5d586Smrg# _AM_DEPENDENCIES(NAME)
15931e5d586Smrg# ----------------------
16031e5d586Smrg# See how the compiler implements dependency checking.
16131e5d586Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16231e5d586Smrg# We try a few techniques and use that to set a single cache variable.
16331e5d586Smrg#
16431e5d586Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16531e5d586Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16631e5d586Smrg# dependency, and given that the user is not expected to run this macro,
16731e5d586Smrg# just rely on AC_PROG_CC.
16831e5d586SmrgAC_DEFUN([_AM_DEPENDENCIES],
16931e5d586Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17031e5d586SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17131e5d586SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17231e5d586SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173492e1cfeSmrg
17431e5d586Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17531e5d586Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17631e5d586Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17731e5d586Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17831e5d586Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17931e5d586Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18031e5d586Smrg                    [depcc="$$1"   am_compiler_list=])
181492e1cfeSmrg
18231e5d586SmrgAC_CACHE_CHECK([dependency style of $depcc],
18331e5d586Smrg               [am_cv_$1_dependencies_compiler_type],
18431e5d586Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18531e5d586Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18631e5d586Smrg  # making bogus files that we don't know about and never remove.  For
18731e5d586Smrg  # instance it was reported that on HP-UX the gcc test will end up
18831e5d586Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18931e5d586Smrg  # in D".
19031e5d586Smrg  rm -rf conftest.dir
19131e5d586Smrg  mkdir conftest.dir
19231e5d586Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19331e5d586Smrg  # using a relative directory.
19431e5d586Smrg  cp "$am_depcomp" conftest.dir
19531e5d586Smrg  cd conftest.dir
19631e5d586Smrg  # We will build objects and dependencies in a subdirectory because
19731e5d586Smrg  # it helps to detect inapplicable dependency modes.  For instance
19831e5d586Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19931e5d586Smrg  # side effect of compilation, but ICC will put the dependencies in
20031e5d586Smrg  # the current directory while Tru64 will put them in the object
20131e5d586Smrg  # directory.
20231e5d586Smrg  mkdir sub
203492e1cfeSmrg
20431e5d586Smrg  am_cv_$1_dependencies_compiler_type=none
20531e5d586Smrg  if test "$am_compiler_list" = ""; then
20631e5d586Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20731e5d586Smrg  fi
20831e5d586Smrg  am__universal=false
20931e5d586Smrg  m4_case([$1], [CC],
21031e5d586Smrg    [case " $depcc " in #(
21131e5d586Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21231e5d586Smrg     esac],
21331e5d586Smrg    [CXX],
21431e5d586Smrg    [case " $depcc " in #(
21531e5d586Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21631e5d586Smrg     esac])
217492e1cfeSmrg
21831e5d586Smrg  for depmode in $am_compiler_list; do
21931e5d586Smrg    # Setup a source with many dependencies, because some compilers
22031e5d586Smrg    # like to wrap large dependency lists on column 80 (with \), and
22131e5d586Smrg    # we should not choose a depcomp mode which is confused by this.
22231e5d586Smrg    #
22331e5d586Smrg    # We need to recreate these files for each test, as the compiler may
22431e5d586Smrg    # overwrite some of them when testing with obscure command lines.
22531e5d586Smrg    # This happens at least with the AIX C compiler.
22631e5d586Smrg    : > sub/conftest.c
22731e5d586Smrg    for i in 1 2 3 4 5 6; do
22831e5d586Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22931e5d586Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23031e5d586Smrg      # Solaris 10 /bin/sh.
23131e5d586Smrg      echo '/* dummy */' > sub/conftst$i.h
23231e5d586Smrg    done
23331e5d586Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234492e1cfeSmrg
23531e5d586Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23631e5d586Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23731e5d586Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23831e5d586Smrg    # versions had trouble with output in subdirs.
23931e5d586Smrg    am__obj=sub/conftest.${OBJEXT-o}
24031e5d586Smrg    am__minus_obj="-o $am__obj"
24131e5d586Smrg    case $depmode in
24231e5d586Smrg    gcc)
24331e5d586Smrg      # This depmode causes a compiler race in universal mode.
24431e5d586Smrg      test "$am__universal" = false || continue
24531e5d586Smrg      ;;
24631e5d586Smrg    nosideeffect)
24731e5d586Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24831e5d586Smrg      # only be used when explicitly requested.
24931e5d586Smrg      if test "x$enable_dependency_tracking" = xyes; then
25031e5d586Smrg	continue
25131e5d586Smrg      else
25231e5d586Smrg	break
25331e5d586Smrg      fi
25431e5d586Smrg      ;;
25531e5d586Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25631e5d586Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25731e5d586Smrg      # not run yet.  These depmodes are late enough in the game, and
25831e5d586Smrg      # so weak that their functioning should not be impacted.
25931e5d586Smrg      am__obj=conftest.${OBJEXT-o}
26031e5d586Smrg      am__minus_obj=
26131e5d586Smrg      ;;
26231e5d586Smrg    none) break ;;
26331e5d586Smrg    esac
26431e5d586Smrg    if depmode=$depmode \
26531e5d586Smrg       source=sub/conftest.c object=$am__obj \
26631e5d586Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26731e5d586Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26831e5d586Smrg         >/dev/null 2>conftest.err &&
26931e5d586Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27031e5d586Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27131e5d586Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27231e5d586Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27331e5d586Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27431e5d586Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27531e5d586Smrg      # that says an option was ignored or not supported.
27631e5d586Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27731e5d586Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27831e5d586Smrg      # The diagnosis changed in icc 8.0:
27931e5d586Smrg      #   icc: Command line remark: option '-MP' not supported
28031e5d586Smrg      if (grep 'ignoring option' conftest.err ||
28131e5d586Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28231e5d586Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28331e5d586Smrg        break
28431e5d586Smrg      fi
28531e5d586Smrg    fi
28631e5d586Smrg  done
2879e0146f7Smrg
28831e5d586Smrg  cd ..
28931e5d586Smrg  rm -rf conftest.dir
29031e5d586Smrgelse
29131e5d586Smrg  am_cv_$1_dependencies_compiler_type=none
29231e5d586Smrgfi
29331e5d586Smrg])
29431e5d586SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29531e5d586SmrgAM_CONDITIONAL([am__fastdep$1], [
29631e5d586Smrg  test "x$enable_dependency_tracking" != xno \
29731e5d586Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29831e5d586Smrg])
299492e1cfeSmrg
300b78bb896Smrg
30131e5d586Smrg# AM_SET_DEPDIR
30231e5d586Smrg# -------------
30331e5d586Smrg# Choose a directory name for dependency files.
30431e5d586Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30531e5d586SmrgAC_DEFUN([AM_SET_DEPDIR],
30631e5d586Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30731e5d586SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30831e5d586Smrg])
309b78bb896Smrg
310b78bb896Smrg
31131e5d586Smrg# AM_DEP_TRACK
31231e5d586Smrg# ------------
31331e5d586SmrgAC_DEFUN([AM_DEP_TRACK],
31431e5d586Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31531e5d586SmrgAS_HELP_STRING(
31631e5d586Smrg  [--enable-dependency-tracking],
31731e5d586Smrg  [do not reject slow dependency extractors])
31831e5d586SmrgAS_HELP_STRING(
31931e5d586Smrg  [--disable-dependency-tracking],
32031e5d586Smrg  [speeds up one-time build])])
32131e5d586Smrgif test "x$enable_dependency_tracking" != xno; then
32231e5d586Smrg  am_depcomp="$ac_aux_dir/depcomp"
32331e5d586Smrg  AMDEPBACKSLASH='\'
32431e5d586Smrg  am__nodep='_no'
32531e5d586Smrgfi
32631e5d586SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32731e5d586SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32831e5d586Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32931e5d586SmrgAC_SUBST([am__nodep])dnl
33031e5d586Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33131e5d586Smrg])
332b78bb896Smrg
33331e5d586Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334b78bb896Smrg
33531e5d586Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336b78bb896Smrg#
33731e5d586Smrg# This file is free software; the Free Software Foundation
33831e5d586Smrg# gives unlimited permission to copy and/or distribute it,
33931e5d586Smrg# with or without modifications, as long as this notice is preserved.
340b78bb896Smrg
34131e5d586Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34231e5d586Smrg# ------------------------------
34331e5d586SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34431e5d586Smrg[{
34531e5d586Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34631e5d586Smrg  # are listed without --file.  Let's play safe and only enable the eval
34731e5d586Smrg  # if we detect the quoting.
34831e5d586Smrg  # TODO: see whether this extra hack can be removed once we start
34931e5d586Smrg  # requiring Autoconf 2.70 or later.
35031e5d586Smrg  AS_CASE([$CONFIG_FILES],
35131e5d586Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
35231e5d586Smrg          [*], [set x $CONFIG_FILES])
35331e5d586Smrg  shift
35431e5d586Smrg  # Used to flag and report bootstrapping failures.
35531e5d586Smrg  am_rc=0
35631e5d586Smrg  for am_mf
35731e5d586Smrg  do
35831e5d586Smrg    # Strip MF so we end up with the name of the file.
35931e5d586Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36031e5d586Smrg    # Check whether this is an Automake generated Makefile which includes
36131e5d586Smrg    # dependency-tracking related rules and includes.
36231e5d586Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36331e5d586Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36431e5d586Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36531e5d586Smrg      || continue
36631e5d586Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36731e5d586Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36831e5d586Smrg    AM_RUN_LOG([cd "$am_dirpart" \
36931e5d586Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37031e5d586Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37131e5d586Smrg  done
37231e5d586Smrg  if test $am_rc -ne 0; then
37331e5d586Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37431e5d586Smrg    for automatic dependency tracking.  If GNU make was not used, consider
37531e5d586Smrg    re-running the configure script with MAKE="gmake" (or whatever is
37631e5d586Smrg    necessary).  You can also try re-running configure with the
37731e5d586Smrg    '--disable-dependency-tracking' option to at least be able to build
37831e5d586Smrg    the package (albeit without support for automatic dependency tracking).])
37931e5d586Smrg  fi
38031e5d586Smrg  AS_UNSET([am_dirpart])
38131e5d586Smrg  AS_UNSET([am_filepart])
38231e5d586Smrg  AS_UNSET([am_mf])
38331e5d586Smrg  AS_UNSET([am_rc])
38431e5d586Smrg  rm -f conftest-deps.mk
38531e5d586Smrg}
38631e5d586Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387492e1cfeSmrg
388492e1cfeSmrg
38931e5d586Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39031e5d586Smrg# -----------------------------
39131e5d586Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392b78bb896Smrg#
39331e5d586Smrg# This code is only required when automatic dependency tracking is enabled.
39431e5d586Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39531e5d586Smrg# order to bootstrap the dependency handling code.
39631e5d586SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39731e5d586Smrg[AC_CONFIG_COMMANDS([depfiles],
39831e5d586Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39931e5d586Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400492e1cfeSmrg
40131e5d586Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402492e1cfeSmrg
40331e5d586Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40431e5d586Smrg#
40531e5d586Smrg# This file is free software; the Free Software Foundation
40631e5d586Smrg# gives unlimited permission to copy and/or distribute it,
40731e5d586Smrg# with or without modifications, as long as this notice is preserved.
408492e1cfeSmrg
40931e5d586Smrg# This macro actually does too much.  Some checks are only needed if
41031e5d586Smrg# your package does certain things.  But this isn't really a big deal.
411492e1cfeSmrg
41231e5d586Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41331e5d586Smrgm4_define([AC_PROG_CC],
41431e5d586Smrgm4_defn([AC_PROG_CC])
41531e5d586Smrg[_AM_PROG_CC_C_O
41631e5d586Smrg])
417492e1cfeSmrg
41831e5d586Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41931e5d586Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42031e5d586Smrg# -----------------------------------------------
42131e5d586Smrg# The call with PACKAGE and VERSION arguments is the old style
42231e5d586Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42331e5d586Smrg# and VERSION should now be passed to AC_INIT and removed from
42431e5d586Smrg# the call to AM_INIT_AUTOMAKE.
42531e5d586Smrg# We support both call styles for the transition.  After
42631e5d586Smrg# the next Automake release, Autoconf can make the AC_INIT
42731e5d586Smrg# arguments mandatory, and then we can depend on a new Autoconf
42831e5d586Smrg# release and drop the old call support.
42931e5d586SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43031e5d586Smrg[AC_PREREQ([2.65])dnl
43131e5d586Smrgm4_ifdef([_$0_ALREADY_INIT],
43231e5d586Smrg  [m4_fatal([$0 expanded multiple times
43331e5d586Smrg]m4_defn([_$0_ALREADY_INIT]))],
43431e5d586Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43531e5d586Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43631e5d586Smrgdnl the ones we care about.
43731e5d586Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43831e5d586SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43931e5d586SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44031e5d586Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44131e5d586Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44231e5d586Smrg  # is not polluted with repeated "-I."
44331e5d586Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44431e5d586Smrg  # test to see if srcdir already configured
44531e5d586Smrg  if test -f $srcdir/config.status; then
44631e5d586Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44731e5d586Smrg  fi
448b78bb896Smrgfi
449492e1cfeSmrg
45031e5d586Smrg# test whether we have cygpath
45131e5d586Smrgif test -z "$CYGPATH_W"; then
45231e5d586Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45331e5d586Smrg    CYGPATH_W='cygpath -w'
45431e5d586Smrg  else
45531e5d586Smrg    CYGPATH_W=echo
45631e5d586Smrg  fi
457b78bb896Smrgfi
45831e5d586SmrgAC_SUBST([CYGPATH_W])
459b78bb896Smrg
46031e5d586Smrg# Define the identity of the package.
46131e5d586Smrgdnl Distinguish between old-style and new-style calls.
46231e5d586Smrgm4_ifval([$2],
46331e5d586Smrg[AC_DIAGNOSE([obsolete],
46431e5d586Smrg             [$0: two- and three-arguments forms are deprecated.])
46531e5d586Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46631e5d586Smrg AC_SUBST([PACKAGE], [$1])dnl
46731e5d586Smrg AC_SUBST([VERSION], [$2])],
46831e5d586Smrg[_AM_SET_OPTIONS([$1])dnl
46931e5d586Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47031e5d586Smrgm4_if(
47131e5d586Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47231e5d586Smrg  [ok:ok],,
47331e5d586Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47431e5d586Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47531e5d586Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476492e1cfeSmrg
47731e5d586Smrg_AM_IF_OPTION([no-define],,
47831e5d586Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47931e5d586Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480492e1cfeSmrg
48131e5d586Smrg# Some tools Automake needs.
48231e5d586SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48331e5d586SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48431e5d586SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48531e5d586SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48631e5d586SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48731e5d586SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48831e5d586SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48931e5d586SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49031e5d586SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49131e5d586SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49231e5d586Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49331e5d586Smrg# dies out for good.  For more background, see:
49431e5d586Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49531e5d586Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49631e5d586SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49731e5d586Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49831e5d586Smrg# system "awk" is bad on some platforms.
49931e5d586SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50031e5d586SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50131e5d586SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50231e5d586Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50331e5d586Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50431e5d586Smrg			     [_AM_PROG_TAR([v7])])])
50531e5d586Smrg_AM_IF_OPTION([no-dependencies],,
50631e5d586Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50731e5d586Smrg		  [_AM_DEPENDENCIES([CC])],
50831e5d586Smrg		  [m4_define([AC_PROG_CC],
50931e5d586Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51031e5d586SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51131e5d586Smrg		  [_AM_DEPENDENCIES([CXX])],
51231e5d586Smrg		  [m4_define([AC_PROG_CXX],
51331e5d586Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51431e5d586SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51531e5d586Smrg		  [_AM_DEPENDENCIES([OBJC])],
51631e5d586Smrg		  [m4_define([AC_PROG_OBJC],
51731e5d586Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51831e5d586SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51931e5d586Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52031e5d586Smrg		  [m4_define([AC_PROG_OBJCXX],
52131e5d586Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52231e5d586Smrg])
52331e5d586Smrg# Variables for tags utilities; see am/tags.am
52431e5d586Smrgif test -z "$CTAGS"; then
52531e5d586Smrg  CTAGS=ctags
52631e5d586Smrgfi
52731e5d586SmrgAC_SUBST([CTAGS])
52831e5d586Smrgif test -z "$ETAGS"; then
52931e5d586Smrg  ETAGS=etags
53031e5d586Smrgfi
53131e5d586SmrgAC_SUBST([ETAGS])
53231e5d586Smrgif test -z "$CSCOPE"; then
53331e5d586Smrg  CSCOPE=cscope
53431e5d586Smrgfi
53531e5d586SmrgAC_SUBST([CSCOPE])
536b78bb896Smrg
53731e5d586SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53831e5d586Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53931e5d586Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54031e5d586Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54131e5d586SmrgAC_CONFIG_COMMANDS_PRE(dnl
54231e5d586Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54331e5d586Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544b78bb896Smrg
54531e5d586Smrg# POSIX will say in a future version that running "rm -f" with no argument
54631e5d586Smrg# is OK; and we want to be able to make that assumption in our Makefile
54731e5d586Smrg# recipes.  So use an aggressive probe to check that the usage we want is
54831e5d586Smrg# actually supported "in the wild" to an acceptable degree.
54931e5d586Smrg# See automake bug#10828.
55031e5d586Smrg# To make any issue more visible, cause the running configure to be aborted
55131e5d586Smrg# by default if the 'rm' program in use doesn't match our expectations; the
55231e5d586Smrg# user can still override this though.
55331e5d586Smrgif rm -f && rm -fr && rm -rf; then : OK; else
55431e5d586Smrg  cat >&2 <<'END'
55531e5d586SmrgOops!
556492e1cfeSmrg
55731e5d586SmrgYour 'rm' program seems unable to run without file operands specified
55831e5d586Smrgon the command line, even when the '-f' option is present.  This is contrary
55931e5d586Smrgto the behaviour of most rm programs out there, and not conforming with
56031e5d586Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561492e1cfeSmrg
56231e5d586SmrgPlease tell bug-automake@gnu.org about your system, including the value
56331e5d586Smrgof your $PATH and any error possibly output before this message.  This
56431e5d586Smrgcan help us improve future automake versions.
565b78bb896Smrg
56631e5d586SmrgEND
56731e5d586Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56831e5d586Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56931e5d586Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57031e5d586Smrg    echo >&2
57131e5d586Smrg  else
57231e5d586Smrg    cat >&2 <<'END'
57331e5d586SmrgAborting the configuration process, to ensure you take notice of the issue.
5749e0146f7Smrg
57531e5d586SmrgYou can download and install GNU coreutils to get an 'rm' implementation
57631e5d586Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
5779e0146f7Smrg
57831e5d586SmrgIf you want to complete the configuration process using your problematic
57931e5d586Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58031e5d586Smrgto "yes", and re-run configure.
5811afad795Smrg
58231e5d586SmrgEND
58331e5d586Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58431e5d586Smrg  fi
5859e0146f7Smrgfi
58631e5d586Smrgdnl The trailing newline in this macro's definition is deliberate, for
58731e5d586Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58831e5d586Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58931e5d586Smrg])
5909e0146f7Smrg
59131e5d586Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59231e5d586Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59331e5d586Smrgdnl mangled by Autoconf and run in a shell conditional statement.
59431e5d586Smrgm4_define([_AC_COMPILER_EXEEXT],
59531e5d586Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596b78bb896Smrg
59731e5d586Smrg# When config.status generates a header, we must update the stamp-h file.
59831e5d586Smrg# This file resides in the same directory as the config header
59931e5d586Smrg# that is generated.  The stamp files are numbered to have different names.
600b78bb896Smrg
60131e5d586Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60231e5d586Smrg# loop where config.status creates the headers, so we can generate
60331e5d586Smrg# our stamp files there.
60431e5d586SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60531e5d586Smrg[# Compute $1's index in $config_headers.
60631e5d586Smrg_am_arg=$1
60731e5d586Smrg_am_stamp_count=1
60831e5d586Smrgfor _am_header in $config_headers :; do
60931e5d586Smrg  case $_am_header in
61031e5d586Smrg    $_am_arg | $_am_arg:* )
61131e5d586Smrg      break ;;
61231e5d586Smrg    * )
61331e5d586Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61431e5d586Smrg  esac
61531e5d586Smrgdone
61631e5d586Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617b78bb896Smrg
61831e5d586Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61931e5d586Smrg#
62031e5d586Smrg# This file is free software; the Free Software Foundation
62131e5d586Smrg# gives unlimited permission to copy and/or distribute it,
62231e5d586Smrg# with or without modifications, as long as this notice is preserved.
62331e5d586Smrg
62431e5d586Smrg# AM_PROG_INSTALL_SH
62531e5d586Smrg# ------------------
62631e5d586Smrg# Define $install_sh.
62731e5d586SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62831e5d586Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62931e5d586Smrgif test x"${install_sh+set}" != xset; then
63031e5d586Smrg  case $am_aux_dir in
63131e5d586Smrg  *\ * | *\	*)
63231e5d586Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63331e5d586Smrg  *)
63431e5d586Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63531e5d586Smrg  esac
63631e5d586Smrgfi
63731e5d586SmrgAC_SUBST([install_sh])])
63831e5d586Smrg
63931e5d586Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64031e5d586Smrg#
64131e5d586Smrg# This file is free software; the Free Software Foundation
64231e5d586Smrg# gives unlimited permission to copy and/or distribute it,
64331e5d586Smrg# with or without modifications, as long as this notice is preserved.
64431e5d586Smrg
64531e5d586Smrg# Check whether the underlying file-system supports filenames
64631e5d586Smrg# with a leading dot.  For instance MS-DOS doesn't.
64731e5d586SmrgAC_DEFUN([AM_SET_LEADING_DOT],
64831e5d586Smrg[rm -rf .tst 2>/dev/null
64931e5d586Smrgmkdir .tst 2>/dev/null
65031e5d586Smrgif test -d .tst; then
65131e5d586Smrg  am__leading_dot=.
652b78bb896Smrgelse
65331e5d586Smrg  am__leading_dot=_
6549e0146f7Smrgfi
65531e5d586Smrgrmdir .tst 2>/dev/null
65631e5d586SmrgAC_SUBST([am__leading_dot])])
6579e0146f7Smrg
65831e5d586Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6599e0146f7Smrg
66031e5d586Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66131e5d586Smrg#
66231e5d586Smrg# This file is free software; the Free Software Foundation
66331e5d586Smrg# gives unlimited permission to copy and/or distribute it,
66431e5d586Smrg# with or without modifications, as long as this notice is preserved.
6659e0146f7Smrg
66631e5d586Smrg# AM_MAKE_INCLUDE()
66731e5d586Smrg# -----------------
66831e5d586Smrg# Check whether make has an 'include' directive that can support all
66931e5d586Smrg# the idioms we need for our automatic dependency tracking code.
67031e5d586SmrgAC_DEFUN([AM_MAKE_INCLUDE],
67131e5d586Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
67231e5d586Smrgcat > confinc.mk << 'END'
67331e5d586Smrgam__doit:
67431e5d586Smrg	@echo this is the am__doit target >confinc.out
67531e5d586Smrg.PHONY: am__doit
67631e5d586SmrgEND
67731e5d586Smrgam__include="#"
67831e5d586Smrgam__quote=
67931e5d586Smrg# BSD make does it like this.
68031e5d586Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
68131e5d586Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
68231e5d586Smrgecho 'include confinc.mk # ignored' > confmf.GNU
68331e5d586Smrg_am_result=no
68431e5d586Smrgfor s in GNU BSD; do
68531e5d586Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
68631e5d586Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
68731e5d586Smrg      ['0:this is the am__doit target'],
68831e5d586Smrg      [AS_CASE([$s],
68931e5d586Smrg          [BSD], [am__include='.include' am__quote='"'],
69031e5d586Smrg          [am__include='include' am__quote=''])])
69131e5d586Smrg  if test "$am__include" != "#"; then
69231e5d586Smrg    _am_result="yes ($s style)"
69331e5d586Smrg    break
69431e5d586Smrg  fi
69531e5d586Smrgdone
69631e5d586Smrgrm -f confinc.* confmf.*
69731e5d586SmrgAC_MSG_RESULT([${_am_result}])
69831e5d586SmrgAC_SUBST([am__include])])
69931e5d586SmrgAC_SUBST([am__quote])])
7009e0146f7Smrg
70131e5d586Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7021afad795Smrg
70331e5d586Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
704b78bb896Smrg#
70531e5d586Smrg# This file is free software; the Free Software Foundation
70631e5d586Smrg# gives unlimited permission to copy and/or distribute it,
70731e5d586Smrg# with or without modifications, as long as this notice is preserved.
7081afad795Smrg
70931e5d586Smrg# AM_MISSING_PROG(NAME, PROGRAM)
71031e5d586Smrg# ------------------------------
71131e5d586SmrgAC_DEFUN([AM_MISSING_PROG],
71231e5d586Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71331e5d586Smrg$1=${$1-"${am_missing_run}$2"}
71431e5d586SmrgAC_SUBST($1)])
7151afad795Smrg
71631e5d586Smrg# AM_MISSING_HAS_RUN
71731e5d586Smrg# ------------------
71831e5d586Smrg# Define MISSING if not defined so far and test if it is modern enough.
71931e5d586Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72031e5d586SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72131e5d586Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72231e5d586SmrgAC_REQUIRE_AUX_FILE([missing])dnl
72331e5d586Smrgif test x"${MISSING+set}" != xset; then
72431e5d586Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725b78bb896Smrgfi
72631e5d586Smrg# Use eval to expand $SHELL
72731e5d586Smrgif eval "$MISSING --is-lightweight"; then
72831e5d586Smrg  am_missing_run="$MISSING "
72931e5d586Smrgelse
73031e5d586Smrg  am_missing_run=
73131e5d586Smrg  AC_MSG_WARN(['missing' script is too old or missing])
732b78bb896Smrgfi
73331e5d586Smrg])
7341afad795Smrg
73531e5d586Smrg# Helper functions for option handling.                     -*- Autoconf -*-
7361afad795Smrg
73731e5d586Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73831e5d586Smrg#
73931e5d586Smrg# This file is free software; the Free Software Foundation
74031e5d586Smrg# gives unlimited permission to copy and/or distribute it,
74131e5d586Smrg# with or without modifications, as long as this notice is preserved.
7429e0146f7Smrg
74331e5d586Smrg# _AM_MANGLE_OPTION(NAME)
74431e5d586Smrg# -----------------------
74531e5d586SmrgAC_DEFUN([_AM_MANGLE_OPTION],
74631e5d586Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7479e0146f7Smrg
74831e5d586Smrg# _AM_SET_OPTION(NAME)
74931e5d586Smrg# --------------------
75031e5d586Smrg# Set option NAME.  Presently that only means defining a flag for this option.
75131e5d586SmrgAC_DEFUN([_AM_SET_OPTION],
75231e5d586Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7539e0146f7Smrg
75431e5d586Smrg# _AM_SET_OPTIONS(OPTIONS)
75531e5d586Smrg# ------------------------
75631e5d586Smrg# OPTIONS is a space-separated list of Automake options.
75731e5d586SmrgAC_DEFUN([_AM_SET_OPTIONS],
75831e5d586Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75931e5d586Smrg
76031e5d586Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76131e5d586Smrg# -------------------------------------------
76231e5d586Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76331e5d586SmrgAC_DEFUN([_AM_IF_OPTION],
76431e5d586Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76531e5d586Smrg
76631e5d586Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767b78bb896Smrg#
76831e5d586Smrg# This file is free software; the Free Software Foundation
76931e5d586Smrg# gives unlimited permission to copy and/or distribute it,
77031e5d586Smrg# with or without modifications, as long as this notice is preserved.
771492e1cfeSmrg
77231e5d586Smrg# _AM_PROG_CC_C_O
77331e5d586Smrg# ---------------
77431e5d586Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77531e5d586Smrg# to automatically call this.
77631e5d586SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77731e5d586Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77831e5d586SmrgAC_REQUIRE_AUX_FILE([compile])dnl
77931e5d586SmrgAC_LANG_PUSH([C])dnl
78031e5d586SmrgAC_CACHE_CHECK(
78131e5d586Smrg  [whether $CC understands -c and -o together],
78231e5d586Smrg  [am_cv_prog_cc_c_o],
78331e5d586Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78431e5d586Smrg  # Make sure it works both with $CC and with simple cc.
78531e5d586Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78631e5d586Smrg  # compilers refuse to overwrite an existing .o file with -o,
78731e5d586Smrg  # though they will create one.
78831e5d586Smrg  am_cv_prog_cc_c_o=yes
78931e5d586Smrg  for am_i in 1 2; do
79031e5d586Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79131e5d586Smrg         && test -f conftest2.$ac_objext; then
79231e5d586Smrg      : OK
79331e5d586Smrg    else
79431e5d586Smrg      am_cv_prog_cc_c_o=no
79531e5d586Smrg      break
79631e5d586Smrg    fi
79731e5d586Smrg  done
79831e5d586Smrg  rm -f core conftest*
79931e5d586Smrg  unset am_i])
80031e5d586Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80131e5d586Smrg   # Losing compiler, so override with the script.
80231e5d586Smrg   # FIXME: It is wrong to rewrite CC.
80331e5d586Smrg   # But if we don't then we get into trouble of one sort or another.
80431e5d586Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80531e5d586Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80631e5d586Smrg   CC="$am_aux_dir/compile $CC"
8079e0146f7Smrgfi
80831e5d586SmrgAC_LANG_POP([C])])
8099e0146f7Smrg
81031e5d586Smrg# For backward compatibility.
81131e5d586SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8129e0146f7Smrg
81331e5d586Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
8149e0146f7Smrg#
81531e5d586Smrg# This file is free software; the Free Software Foundation
81631e5d586Smrg# gives unlimited permission to copy and/or distribute it,
81731e5d586Smrg# with or without modifications, as long as this notice is preserved.
8189e0146f7Smrg
81931e5d586Smrg# AM_RUN_LOG(COMMAND)
82031e5d586Smrg# -------------------
82131e5d586Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82231e5d586Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82331e5d586SmrgAC_DEFUN([AM_RUN_LOG],
82431e5d586Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82531e5d586Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82631e5d586Smrg   ac_status=$?
82731e5d586Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82831e5d586Smrg   (exit $ac_status); }])
82931e5d586Smrg
83031e5d586Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83131e5d586Smrg
83231e5d586Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8339e0146f7Smrg#
83431e5d586Smrg# This file is free software; the Free Software Foundation
83531e5d586Smrg# gives unlimited permission to copy and/or distribute it,
83631e5d586Smrg# with or without modifications, as long as this notice is preserved.
837492e1cfeSmrg
83831e5d586Smrg# AM_SANITY_CHECK
83931e5d586Smrg# ---------------
84031e5d586SmrgAC_DEFUN([AM_SANITY_CHECK],
84131e5d586Smrg[AC_MSG_CHECKING([whether build environment is sane])
84231e5d586Smrg# Reject unsafe characters in $srcdir or the absolute working directory
84331e5d586Smrg# name.  Accept space and tab only in the latter.
84431e5d586Smrgam_lf='
84531e5d586Smrg'
84631e5d586Smrgcase `pwd` in
84731e5d586Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84831e5d586Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84931e5d586Smrgesac
85031e5d586Smrgcase $srcdir in
85131e5d586Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85231e5d586Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85331e5d586Smrgesac
85431e5d586Smrg
85531e5d586Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85631e5d586Smrg# arguments.  Must try -L first in case configure is actually a
85731e5d586Smrg# symlink; some systems play weird games with the mod time of symlinks
85831e5d586Smrg# (eg FreeBSD returns the mod time of the symlink's containing
85931e5d586Smrg# directory).
86031e5d586Smrgif (
86131e5d586Smrg   am_has_slept=no
86231e5d586Smrg   for am_try in 1 2; do
86331e5d586Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86431e5d586Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86531e5d586Smrg     if test "$[*]" = "X"; then
86631e5d586Smrg	# -L didn't work.
86731e5d586Smrg	set X `ls -t "$srcdir/configure" conftest.file`
86831e5d586Smrg     fi
86931e5d586Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87031e5d586Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87131e5d586Smrg
87231e5d586Smrg	# If neither matched, then we have a broken ls.  This can happen
87331e5d586Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87431e5d586Smrg	# broken ls alias from the environment.  This has actually
87531e5d586Smrg	# happened.  Such a system could not be considered "sane".
87631e5d586Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87731e5d586Smrg  alias in your environment])
87831e5d586Smrg     fi
87931e5d586Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88031e5d586Smrg       break
88131e5d586Smrg     fi
88231e5d586Smrg     # Just in case.
88331e5d586Smrg     sleep 1
88431e5d586Smrg     am_has_slept=yes
88531e5d586Smrg   done
88631e5d586Smrg   test "$[2]" = conftest.file
88731e5d586Smrg   )
88831e5d586Smrgthen
88931e5d586Smrg   # Ok.
89031e5d586Smrg   :
891492e1cfeSmrgelse
89231e5d586Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
89331e5d586SmrgCheck your system clock])
894492e1cfeSmrgfi
89531e5d586SmrgAC_MSG_RESULT([yes])
89631e5d586Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89731e5d586Smrg# generated files are strictly newer.
89831e5d586Smrgam_sleep_pid=
89931e5d586Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90031e5d586Smrg  ( sleep 1 ) &
90131e5d586Smrg  am_sleep_pid=$!
90231e5d586Smrgfi
90331e5d586SmrgAC_CONFIG_COMMANDS_PRE(
90431e5d586Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90531e5d586Smrg   if test -n "$am_sleep_pid"; then
90631e5d586Smrg     # Hide warnings about reused PIDs.
90731e5d586Smrg     wait $am_sleep_pid 2>/dev/null
90831e5d586Smrg   fi
90931e5d586Smrg   AC_MSG_RESULT([done])])
91031e5d586Smrgrm -f conftest.file
91131e5d586Smrg])
912492e1cfeSmrg
91331e5d586Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914b78bb896Smrg#
91531e5d586Smrg# This file is free software; the Free Software Foundation
91631e5d586Smrg# gives unlimited permission to copy and/or distribute it,
91731e5d586Smrg# with or without modifications, as long as this notice is preserved.
918492e1cfeSmrg
91931e5d586Smrg# AM_SILENT_RULES([DEFAULT])
92031e5d586Smrg# --------------------------
92131e5d586Smrg# Enable less verbose build rules; with the default set to DEFAULT
92231e5d586Smrg# ("yes" being less verbose, "no" or empty being verbose).
92331e5d586SmrgAC_DEFUN([AM_SILENT_RULES],
92431e5d586Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92531e5d586SmrgAS_HELP_STRING(
92631e5d586Smrg  [--enable-silent-rules],
92731e5d586Smrg  [less verbose build output (undo: "make V=1")])
92831e5d586SmrgAS_HELP_STRING(
92931e5d586Smrg  [--disable-silent-rules],
93031e5d586Smrg  [verbose build output (undo: "make V=0")])dnl
93131e5d586Smrg])
93231e5d586Smrgcase $enable_silent_rules in @%:@ (((
93331e5d586Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93431e5d586Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93531e5d586Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93631e5d586Smrgesac
93731e5d586Smrgdnl
93831e5d586Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93931e5d586Smrgdnl do not support nested variable expansions.
94031e5d586Smrgdnl See automake bug#9928 and bug#10237.
94131e5d586Smrgam_make=${MAKE-make}
94231e5d586SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94331e5d586Smrg   [am_cv_make_support_nested_variables],
94431e5d586Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94531e5d586SmrgBAR0=false
94631e5d586SmrgBAR1=true
94731e5d586SmrgV=1
94831e5d586Smrgam__doit:
94931e5d586Smrg	@$(TRUE)
95031e5d586Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95131e5d586Smrg  am_cv_make_support_nested_variables=yes
952b78bb896Smrgelse
95331e5d586Smrg  am_cv_make_support_nested_variables=no
95431e5d586Smrgfi])
95531e5d586Smrgif test $am_cv_make_support_nested_variables = yes; then
95631e5d586Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95731e5d586Smrg  AM_V='$(V)'
95831e5d586Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95931e5d586Smrgelse
96031e5d586Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96131e5d586Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9621afad795Smrgfi
96331e5d586SmrgAC_SUBST([AM_V])dnl
96431e5d586SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96531e5d586SmrgAC_SUBST([AM_DEFAULT_V])dnl
96631e5d586SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96731e5d586SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96831e5d586SmrgAM_BACKSLASH='\'
96931e5d586SmrgAC_SUBST([AM_BACKSLASH])dnl
97031e5d586Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97131e5d586Smrg])
9721afad795Smrg
97331e5d586Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974b78bb896Smrg#
97531e5d586Smrg# This file is free software; the Free Software Foundation
97631e5d586Smrg# gives unlimited permission to copy and/or distribute it,
97731e5d586Smrg# with or without modifications, as long as this notice is preserved.
9781afad795Smrg
97931e5d586Smrg# AM_PROG_INSTALL_STRIP
98031e5d586Smrg# ---------------------
98131e5d586Smrg# One issue with vendor 'install' (even GNU) is that you can't
98231e5d586Smrg# specify the program used to strip binaries.  This is especially
98331e5d586Smrg# annoying in cross-compiling environments, where the build's strip
98431e5d586Smrg# is unlikely to handle the host's binaries.
98531e5d586Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98631e5d586Smrg# always use install-sh in "make install-strip", and initialize
98731e5d586Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
98831e5d586SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98931e5d586Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99031e5d586Smrg# Installed binaries are usually stripped using 'strip' when the user
99131e5d586Smrg# run "make install-strip".  However 'strip' might not be the right
99231e5d586Smrg# tool to use in cross-compilation environments, therefore Automake
99331e5d586Smrg# will honor the 'STRIP' environment variable to overrule this program.
99431e5d586Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99531e5d586Smrgif test "$cross_compiling" != no; then
99631e5d586Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9971afad795Smrgfi
99831e5d586SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99931e5d586SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1000492e1cfeSmrg
100131e5d586Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002b78bb896Smrg#
100331e5d586Smrg# This file is free software; the Free Software Foundation
100431e5d586Smrg# gives unlimited permission to copy and/or distribute it,
100531e5d586Smrg# with or without modifications, as long as this notice is preserved.
1006492e1cfeSmrg
100731e5d586Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
100831e5d586Smrg# ---------------------------
100931e5d586Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101031e5d586Smrg# This macro is traced by Automake.
101131e5d586SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012b78bb896Smrg
101331e5d586Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101431e5d586Smrg# --------------------------
101531e5d586Smrg# Public sister of _AM_SUBST_NOTMAKE.
101631e5d586SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10179e0146f7Smrg
101831e5d586Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1019b78bb896Smrg
102031e5d586Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021b78bb896Smrg#
102231e5d586Smrg# This file is free software; the Free Software Foundation
102331e5d586Smrg# gives unlimited permission to copy and/or distribute it,
102431e5d586Smrg# with or without modifications, as long as this notice is preserved.
102531e5d586Smrg
102631e5d586Smrg# _AM_PROG_TAR(FORMAT)
102731e5d586Smrg# --------------------
102831e5d586Smrg# Check how to create a tarball in format FORMAT.
102931e5d586Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030b78bb896Smrg#
103131e5d586Smrg# Substitute a variable $(am__tar) that is a command
103231e5d586Smrg# writing to stdout a FORMAT-tarball containing the directory
103331e5d586Smrg# $tardir.
103431e5d586Smrg#     tardir=directory && $(am__tar) > result.tar
1035b78bb896Smrg#
103631e5d586Smrg# Substitute a variable $(am__untar) that extract such
103731e5d586Smrg# a tarball read from stdin.
103831e5d586Smrg#     $(am__untar) < result.tar
1039b78bb896Smrg#
104031e5d586SmrgAC_DEFUN([_AM_PROG_TAR],
104131e5d586Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104231e5d586Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104331e5d586SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10449e0146f7Smrg
104531e5d586Smrg# We'll loop over all known methods to create a tar archive until one works.
104631e5d586Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047492e1cfeSmrg
104831e5d586Smrgm4_if([$1], [v7],
104931e5d586Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050492e1cfeSmrg
105131e5d586Smrg  [m4_case([$1],
105231e5d586Smrg    [ustar],
105331e5d586Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105431e5d586Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105531e5d586Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105631e5d586Smrg      # and bug#13588).
105731e5d586Smrg      am_max_uid=2097151 # 2^21 - 1
105831e5d586Smrg      am_max_gid=$am_max_uid
105931e5d586Smrg      # The $UID and $GID variables are not portable, so we need to resort
106031e5d586Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106131e5d586Smrg      # below are definitely unexpected, so allow the users to see them
106231e5d586Smrg      # (that is, avoid stderr redirection).
106331e5d586Smrg      am_uid=`id -u || echo unknown`
106431e5d586Smrg      am_gid=`id -g || echo unknown`
106531e5d586Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106631e5d586Smrg      if test $am_uid -le $am_max_uid; then
106731e5d586Smrg         AC_MSG_RESULT([yes])
106831e5d586Smrg      else
106931e5d586Smrg         AC_MSG_RESULT([no])
107031e5d586Smrg         _am_tools=none
107131e5d586Smrg      fi
107231e5d586Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107331e5d586Smrg      if test $am_gid -le $am_max_gid; then
107431e5d586Smrg         AC_MSG_RESULT([yes])
107531e5d586Smrg      else
107631e5d586Smrg        AC_MSG_RESULT([no])
107731e5d586Smrg        _am_tools=none
107831e5d586Smrg      fi],
10793538fbe3Smrg
108031e5d586Smrg  [pax],
108131e5d586Smrg    [],
10823538fbe3Smrg
108331e5d586Smrg  [m4_fatal([Unknown tar format])])
10843538fbe3Smrg
108531e5d586Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
10863538fbe3Smrg
108731e5d586Smrg  # Go ahead even if we have the value already cached.  We do so because we
108831e5d586Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108931e5d586Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10903538fbe3Smrg
109131e5d586Smrg  for _am_tool in $_am_tools; do
109231e5d586Smrg    case $_am_tool in
109331e5d586Smrg    gnutar)
109431e5d586Smrg      for _am_tar in tar gnutar gtar; do
109531e5d586Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109631e5d586Smrg      done
109731e5d586Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109831e5d586Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109931e5d586Smrg      am__untar="$_am_tar -xf -"
110031e5d586Smrg      ;;
110131e5d586Smrg    plaintar)
110231e5d586Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110331e5d586Smrg      # ustar tarball either.
110431e5d586Smrg      (tar --version) >/dev/null 2>&1 && continue
110531e5d586Smrg      am__tar='tar chf - "$$tardir"'
110631e5d586Smrg      am__tar_='tar chf - "$tardir"'
110731e5d586Smrg      am__untar='tar xf -'
110831e5d586Smrg      ;;
110931e5d586Smrg    pax)
111031e5d586Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111131e5d586Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111231e5d586Smrg      am__untar='pax -r'
111331e5d586Smrg      ;;
111431e5d586Smrg    cpio)
111531e5d586Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111631e5d586Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111731e5d586Smrg      am__untar='cpio -i -H $1 -d'
111831e5d586Smrg      ;;
111931e5d586Smrg    none)
112031e5d586Smrg      am__tar=false
112131e5d586Smrg      am__tar_=false
112231e5d586Smrg      am__untar=false
112331e5d586Smrg      ;;
112431e5d586Smrg    esac
11259e0146f7Smrg
112631e5d586Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112731e5d586Smrg    # and am__untar set.
112831e5d586Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129492e1cfeSmrg
113031e5d586Smrg    # tar/untar a dummy directory, and stop if the command works.
113131e5d586Smrg    rm -rf conftest.dir
113231e5d586Smrg    mkdir conftest.dir
113331e5d586Smrg    echo GrepMe > conftest.dir/file
113431e5d586Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113531e5d586Smrg    rm -rf conftest.dir
113631e5d586Smrg    if test -s conftest.tar; then
113731e5d586Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
113831e5d586Smrg      AM_RUN_LOG([cat conftest.dir/file])
113931e5d586Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114031e5d586Smrg    fi
114131e5d586Smrg  done
114231e5d586Smrg  rm -rf conftest.dir
1143492e1cfeSmrg
114431e5d586Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114531e5d586Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146492e1cfeSmrg
114731e5d586SmrgAC_SUBST([am__tar])
114831e5d586SmrgAC_SUBST([am__untar])
114931e5d586Smrg]) # _AM_PROG_TAR
1150492e1cfeSmrg
115131e5d586Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
115231e5d586Smrgdnl serial 11 (pkg-config-0.29)
115331e5d586Smrgdnl
115431e5d586Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115531e5d586Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
115631e5d586Smrgdnl
115731e5d586Smrgdnl This program is free software; you can redistribute it and/or modify
115831e5d586Smrgdnl it under the terms of the GNU General Public License as published by
115931e5d586Smrgdnl the Free Software Foundation; either version 2 of the License, or
116031e5d586Smrgdnl (at your option) any later version.
116131e5d586Smrgdnl
116231e5d586Smrgdnl This program is distributed in the hope that it will be useful, but
116331e5d586Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
116431e5d586Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
116531e5d586Smrgdnl General Public License for more details.
116631e5d586Smrgdnl
116731e5d586Smrgdnl You should have received a copy of the GNU General Public License
116831e5d586Smrgdnl along with this program; if not, write to the Free Software
116931e5d586Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
117031e5d586Smrgdnl 02111-1307, USA.
117131e5d586Smrgdnl
117231e5d586Smrgdnl As a special exception to the GNU General Public License, if you
117331e5d586Smrgdnl distribute this file as part of a program that contains a
117431e5d586Smrgdnl configuration script generated by Autoconf, you may include it under
117531e5d586Smrgdnl the same distribution terms that you use for the rest of that
117631e5d586Smrgdnl program.
1177492e1cfeSmrg
117831e5d586Smrgdnl PKG_PREREQ(MIN-VERSION)
117931e5d586Smrgdnl -----------------------
118031e5d586Smrgdnl Since: 0.29
118131e5d586Smrgdnl
118231e5d586Smrgdnl Verify that the version of the pkg-config macros are at least
118331e5d586Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
118431e5d586Smrgdnl installed version of pkg-config, this checks the developer's version
118531e5d586Smrgdnl of pkg.m4 when generating configure.
118631e5d586Smrgdnl
118731e5d586Smrgdnl To ensure that this macro is defined, also add:
118831e5d586Smrgdnl m4_ifndef([PKG_PREREQ],
118931e5d586Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
119031e5d586Smrgdnl
119131e5d586Smrgdnl See the "Since" comment for each macro you use to see what version
119231e5d586Smrgdnl of the macros you require.
119331e5d586Smrgm4_defun([PKG_PREREQ],
119431e5d586Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
119531e5d586Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
119631e5d586Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
119731e5d586Smrg])dnl PKG_PREREQ
1198492e1cfeSmrg
119931e5d586Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
120031e5d586Smrgdnl ----------------------------------
120131e5d586Smrgdnl Since: 0.16
120231e5d586Smrgdnl
120331e5d586Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
120431e5d586Smrgdnl first found in the path. Checks that the version of pkg-config found
120531e5d586Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
120631e5d586Smrgdnl used since that's the first version where most current features of
120731e5d586Smrgdnl pkg-config existed.
120831e5d586SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120931e5d586Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
121031e5d586Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
121131e5d586Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
121231e5d586SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
121331e5d586SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
121431e5d586SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215492e1cfeSmrg
121631e5d586Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121731e5d586Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218492e1cfeSmrgfi
121931e5d586Smrgif test -n "$PKG_CONFIG"; then
122031e5d586Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
122131e5d586Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122231e5d586Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122331e5d586Smrg		AC_MSG_RESULT([yes])
122431e5d586Smrg	else
122531e5d586Smrg		AC_MSG_RESULT([no])
122631e5d586Smrg		PKG_CONFIG=""
122731e5d586Smrg	fi
122831e5d586Smrgfi[]dnl
122931e5d586Smrg])dnl PKG_PROG_PKG_CONFIG
1230492e1cfeSmrg
123131e5d586Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
123231e5d586Smrgdnl -------------------------------------------------------------------
123331e5d586Smrgdnl Since: 0.18
123431e5d586Smrgdnl
123531e5d586Smrgdnl Check to see whether a particular set of modules exists. Similar to
123631e5d586Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
123731e5d586Smrgdnl
123831e5d586Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123931e5d586Smrgdnl only at the first occurence in configure.ac, so if the first place
124031e5d586Smrgdnl it's called might be skipped (such as if it is within an "if", you
124131e5d586Smrgdnl have to call PKG_CHECK_EXISTS manually
124231e5d586SmrgAC_DEFUN([PKG_CHECK_EXISTS],
124331e5d586Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124431e5d586Smrgif test -n "$PKG_CONFIG" && \
124531e5d586Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
124631e5d586Smrg  m4_default([$2], [:])
124731e5d586Smrgm4_ifvaln([$3], [else
124831e5d586Smrg  $3])dnl
124931e5d586Smrgfi])
125031e5d586Smrg
125131e5d586Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
125231e5d586Smrgdnl ---------------------------------------------
125331e5d586Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
125431e5d586Smrgdnl pkg_failed based on the result.
125531e5d586Smrgm4_define([_PKG_CONFIG],
125631e5d586Smrg[if test -n "$$1"; then
125731e5d586Smrg    pkg_cv_[]$1="$$1"
125831e5d586Smrg elif test -n "$PKG_CONFIG"; then
125931e5d586Smrg    PKG_CHECK_EXISTS([$3],
126031e5d586Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
126131e5d586Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
126231e5d586Smrg		     [pkg_failed=yes])
126331e5d586Smrg else
126431e5d586Smrg    pkg_failed=untried
126531e5d586Smrgfi[]dnl
126631e5d586Smrg])dnl _PKG_CONFIG
126731e5d586Smrg
126831e5d586Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
126931e5d586Smrgdnl ---------------------------
127031e5d586Smrgdnl Internal check to see if pkg-config supports short errors.
127131e5d586SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127231e5d586Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127331e5d586Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127431e5d586Smrg        _pkg_short_errors_supported=yes
1275b78bb896Smrgelse
127631e5d586Smrg        _pkg_short_errors_supported=no
127731e5d586Smrgfi[]dnl
127831e5d586Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279492e1cfeSmrg
1280492e1cfeSmrg
128131e5d586Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
128231e5d586Smrgdnl   [ACTION-IF-NOT-FOUND])
128331e5d586Smrgdnl --------------------------------------------------------------
128431e5d586Smrgdnl Since: 0.4.0
128531e5d586Smrgdnl
128631e5d586Smrgdnl Note that if there is a possibility the first call to
128731e5d586Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
128831e5d586Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128931e5d586SmrgAC_DEFUN([PKG_CHECK_MODULES],
129031e5d586Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129131e5d586SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129231e5d586SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293492e1cfeSmrg
129431e5d586Smrgpkg_failed=no
129531e5d586SmrgAC_MSG_CHECKING([for $1])
12969e0146f7Smrg
129731e5d586Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129831e5d586Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12999e0146f7Smrg
130031e5d586Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130131e5d586Smrgand $1[]_LIBS to avoid the need to call pkg-config.
130231e5d586SmrgSee the pkg-config man page for more details.])
13039e0146f7Smrg
130431e5d586Smrgif test $pkg_failed = yes; then
130531e5d586Smrg   	AC_MSG_RESULT([no])
130631e5d586Smrg        _PKG_SHORT_ERRORS_SUPPORTED
130731e5d586Smrg        if test $_pkg_short_errors_supported = yes; then
130831e5d586Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130931e5d586Smrg        else 
131031e5d586Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131131e5d586Smrg        fi
131231e5d586Smrg	# Put the nasty error message in config.log where it belongs
131331e5d586Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13149e0146f7Smrg
131531e5d586Smrg	m4_default([$4], [AC_MSG_ERROR(
131631e5d586Smrg[Package requirements ($2) were not met:
13179e0146f7Smrg
131831e5d586Smrg$$1_PKG_ERRORS
131931e5d586Smrg
132031e5d586SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132131e5d586Smrginstalled software in a non-standard prefix.
132231e5d586Smrg
132331e5d586Smrg_PKG_TEXT])[]dnl
132431e5d586Smrg        ])
132531e5d586Smrgelif test $pkg_failed = untried; then
132631e5d586Smrg     	AC_MSG_RESULT([no])
132731e5d586Smrg	m4_default([$4], [AC_MSG_FAILURE(
132831e5d586Smrg[The pkg-config script could not be found or is too old.  Make sure it
132931e5d586Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
133031e5d586Smrgpath to pkg-config.
133131e5d586Smrg
133231e5d586Smrg_PKG_TEXT
133331e5d586Smrg
133431e5d586SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
133531e5d586Smrg        ])
13369e0146f7Smrgelse
133731e5d586Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133831e5d586Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133931e5d586Smrg        AC_MSG_RESULT([yes])
134031e5d586Smrg	$3
134131e5d586Smrgfi[]dnl
134231e5d586Smrg])dnl PKG_CHECK_MODULES
13439e0146f7Smrg
13449e0146f7Smrg
134531e5d586Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
134631e5d586Smrgdnl   [ACTION-IF-NOT-FOUND])
134731e5d586Smrgdnl ---------------------------------------------------------------------
134831e5d586Smrgdnl Since: 0.29
134931e5d586Smrgdnl
135031e5d586Smrgdnl Checks for existence of MODULES and gathers its build flags with
135131e5d586Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
135231e5d586Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
135331e5d586Smrgdnl
135431e5d586Smrgdnl Note that if there is a possibility the first call to
135531e5d586Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
135631e5d586Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
135731e5d586Smrgdnl configure.ac.
135831e5d586SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
135931e5d586Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
136031e5d586Smrg_save_PKG_CONFIG=$PKG_CONFIG
136131e5d586SmrgPKG_CONFIG="$PKG_CONFIG --static"
136231e5d586SmrgPKG_CHECK_MODULES($@)
136331e5d586SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
136431e5d586Smrg])dnl PKG_CHECK_MODULES_STATIC
13659e0146f7Smrg
13669e0146f7Smrg
136731e5d586Smrgdnl PKG_INSTALLDIR([DIRECTORY])
136831e5d586Smrgdnl -------------------------
136931e5d586Smrgdnl Since: 0.27
137031e5d586Smrgdnl
137131e5d586Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
137231e5d586Smrgdnl should install pkg-config .pc files. By default the directory is
137331e5d586Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
137431e5d586Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
137531e5d586Smrgdnl parameter.
137631e5d586SmrgAC_DEFUN([PKG_INSTALLDIR],
137731e5d586Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
137831e5d586Smrgm4_pushdef([pkg_description],
137931e5d586Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
138031e5d586SmrgAC_ARG_WITH([pkgconfigdir],
138131e5d586Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
138231e5d586Smrg    [with_pkgconfigdir=]pkg_default)
138331e5d586SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
138431e5d586Smrgm4_popdef([pkg_default])
138531e5d586Smrgm4_popdef([pkg_description])
138631e5d586Smrg])dnl PKG_INSTALLDIR
138731e5d586Smrg
138831e5d586Smrg
138931e5d586Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
139031e5d586Smrgdnl --------------------------------
139131e5d586Smrgdnl Since: 0.27
139231e5d586Smrgdnl
139331e5d586Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
139431e5d586Smrgdnl module should install arch-independent pkg-config .pc files. By
139531e5d586Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
139631e5d586Smrgdnl changed by passing DIRECTORY. The user can override through the
139731e5d586Smrgdnl --with-noarch-pkgconfigdir parameter.
139831e5d586SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
139931e5d586Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
140031e5d586Smrgm4_pushdef([pkg_description],
140131e5d586Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
140231e5d586SmrgAC_ARG_WITH([noarch-pkgconfigdir],
140331e5d586Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
140431e5d586Smrg    [with_noarch_pkgconfigdir=]pkg_default)
140531e5d586SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
140631e5d586Smrgm4_popdef([pkg_default])
140731e5d586Smrgm4_popdef([pkg_description])
140831e5d586Smrg])dnl PKG_NOARCH_INSTALLDIR
140931e5d586Smrg
14109e0146f7Smrg
141131e5d586Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
141231e5d586Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
141331e5d586Smrgdnl -------------------------------------------
141431e5d586Smrgdnl Since: 0.28
141531e5d586Smrgdnl
141631e5d586Smrgdnl Retrieves the value of the pkg-config variable for the given module.
141731e5d586SmrgAC_DEFUN([PKG_CHECK_VAR],
141831e5d586Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
141931e5d586SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
14209e0146f7Smrg
142131e5d586Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
142231e5d586SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
14239e0146f7Smrg
142431e5d586SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
142531e5d586Smrg])dnl PKG_CHECK_VAR
14269e0146f7Smrg
142731e5d586Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142831e5d586Smrgdnl
142931e5d586Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
143031e5d586Smrgdnl
143131e5d586Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143231e5d586Smrgdnl copy of this software and associated documentation files (the "Software"),
143331e5d586Smrgdnl to deal in the Software without restriction, including without limitation
143431e5d586Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143531e5d586Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
143631e5d586Smrgdnl Software is furnished to do so, subject to the following conditions:
143731e5d586Smrgdnl
143831e5d586Smrgdnl The above copyright notice and this permission notice (including the next
143931e5d586Smrgdnl paragraph) shall be included in all copies or substantial portions of the
144031e5d586Smrgdnl Software.
144131e5d586Smrgdnl
144231e5d586Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144331e5d586Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144431e5d586Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144531e5d586Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144631e5d586Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144731e5d586Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144831e5d586Smrgdnl DEALINGS IN THE SOFTWARE.
14499e0146f7Smrg
145031e5d586Smrg# XORG_MACROS_VERSION(required-version)
145131e5d586Smrg# -------------------------------------
1452b78bb896Smrg# Minimum version: 1.1.0
14539e0146f7Smrg#
145431e5d586Smrg# If you're using a macro added in Version 1.1 or newer, include this in
145531e5d586Smrg# your configure.ac with the minimum required version, such as:
145631e5d586Smrg# XORG_MACROS_VERSION(1.1)
14579e0146f7Smrg#
145831e5d586Smrg# To ensure that this macro is defined, also add:
145931e5d586Smrg# m4_ifndef([XORG_MACROS_VERSION],
146031e5d586Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14619e0146f7Smrg#
146231e5d586Smrg#
146331e5d586Smrg# See the "minimum version" comment for each macro you use to see what
146431e5d586Smrg# version you require.
146531e5d586Smrgm4_defun([XORG_MACROS_VERSION],[
146631e5d586Smrgm4_define([vers_have], [1.19.3])
146731e5d586Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146831e5d586Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
146931e5d586Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147031e5d586Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147131e5d586Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147231e5d586Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147331e5d586Smrgm4_undefine([vers_have])
147431e5d586Smrgm4_undefine([maj_have])
147531e5d586Smrgm4_undefine([maj_needed])
147631e5d586Smrg]) # XORG_MACROS_VERSION
14779e0146f7Smrg
147831e5d586Smrg# XORG_PROG_RAWCPP()
147931e5d586Smrg# ------------------
148031e5d586Smrg# Minimum version: 1.0.0
148131e5d586Smrg#
148231e5d586Smrg# Find cpp program and necessary flags for use in pre-processing text files
148331e5d586Smrg# such as man pages and config files
148431e5d586SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148531e5d586SmrgAC_REQUIRE([AC_PROG_CPP])
148631e5d586SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148731e5d586Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1488b78bb896Smrg
148931e5d586Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149031e5d586Smrg# which is not the best choice for supporting other OS'es, but covers most
149131e5d586Smrg# of the ones we need for now.
149231e5d586SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149331e5d586SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149431e5d586Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149531e5d586Smrg	AC_MSG_RESULT([no])
149631e5d586Smrgelse
149731e5d586Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149831e5d586Smrg		RAWCPPFLAGS=-undef
149931e5d586Smrg		AC_MSG_RESULT([yes])
150031e5d586Smrg	# under Cygwin unix is still defined even with -undef
150131e5d586Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150231e5d586Smrg		RAWCPPFLAGS="-undef -ansi"
150331e5d586Smrg		AC_MSG_RESULT([yes, with -ansi])
150431e5d586Smrg	else
150531e5d586Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150631e5d586Smrg	fi
15079e0146f7Smrgfi
150831e5d586Smrgrm -f conftest.$ac_ext
15099e0146f7Smrg
151031e5d586SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151131e5d586SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151231e5d586Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151331e5d586Smrg	AC_MSG_RESULT([no])
151431e5d586Smrgelse
151531e5d586Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151631e5d586Smrg		TRADITIONALCPPFLAGS="-traditional"
151731e5d586Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151831e5d586Smrg		AC_MSG_RESULT([yes])
151931e5d586Smrg	else
152031e5d586Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152131e5d586Smrg	fi
152231e5d586Smrgfi
152331e5d586Smrgrm -f conftest.$ac_ext
152431e5d586SmrgAC_SUBST(RAWCPPFLAGS)
152531e5d586SmrgAC_SUBST(TRADITIONALCPPFLAGS)
152631e5d586Smrg]) # XORG_PROG_RAWCPP
15279e0146f7Smrg
152831e5d586Smrg# XORG_MANPAGE_SECTIONS()
152931e5d586Smrg# -----------------------
153031e5d586Smrg# Minimum version: 1.0.0
15313538fbe3Smrg#
153231e5d586Smrg# Determine which sections man pages go in for the different man page types
153331e5d586Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153431e5d586Smrg# Not sure if there's any better way than just hardcoding by OS name.
153531e5d586Smrg# Override default settings by setting environment variables
153631e5d586Smrg# Added MAN_SUBSTS in version 1.8
153731e5d586Smrg# Added AC_PROG_SED in version 1.8
1538b78bb896Smrg
153931e5d586SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154031e5d586SmrgAC_REQUIRE([AC_CANONICAL_HOST])
154131e5d586SmrgAC_REQUIRE([AC_PROG_SED])
15423538fbe3Smrg
154331e5d586Smrgcase $host_os in
154431e5d586Smrg    solaris*)
154531e5d586Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
154631e5d586Smrg        # check for a man page file found in later versions that use
154731e5d586Smrg        # traditional section numbers instead
154831e5d586Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
154931e5d586Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
155031e5d586Smrg        ;;
155131e5d586Smrg    *) SYSV_MAN_SECTIONS=false ;;
155231e5d586Smrgesac
15533538fbe3Smrg
155431e5d586Smrgif test x$APP_MAN_SUFFIX = x    ; then
155531e5d586Smrg    APP_MAN_SUFFIX=1
155631e5d586Smrgfi
155731e5d586Smrgif test x$APP_MAN_DIR = x    ; then
155831e5d586Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
155931e5d586Smrgfi
15603538fbe3Smrg
156131e5d586Smrgif test x$LIB_MAN_SUFFIX = x    ; then
156231e5d586Smrg    LIB_MAN_SUFFIX=3
156331e5d586Smrgfi
156431e5d586Smrgif test x$LIB_MAN_DIR = x    ; then
156531e5d586Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
156631e5d586Smrgfi
15673538fbe3Smrg
156831e5d586Smrgif test x$FILE_MAN_SUFFIX = x    ; then
156931e5d586Smrg    case $SYSV_MAN_SECTIONS in
157031e5d586Smrg	true)				FILE_MAN_SUFFIX=4  ;;
157131e5d586Smrg	*)				FILE_MAN_SUFFIX=5  ;;
157231e5d586Smrg    esac
157331e5d586Smrgfi
157431e5d586Smrgif test x$FILE_MAN_DIR = x    ; then
157531e5d586Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15763538fbe3Smrgfi
15773538fbe3Smrg
157831e5d586Smrgif test x$MISC_MAN_SUFFIX = x    ; then
157931e5d586Smrg    case $SYSV_MAN_SECTIONS in
158031e5d586Smrg	true)				MISC_MAN_SUFFIX=5  ;;
158131e5d586Smrg	*)				MISC_MAN_SUFFIX=7  ;;
158231e5d586Smrg    esac
158331e5d586Smrgfi
158431e5d586Smrgif test x$MISC_MAN_DIR = x    ; then
158531e5d586Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586b78bb896Smrgfi
15873538fbe3Smrg
158831e5d586Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
158931e5d586Smrg    case $SYSV_MAN_SECTIONS in
159031e5d586Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
159131e5d586Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159231e5d586Smrg    esac
159331e5d586Smrgfi
159431e5d586Smrgif test x$DRIVER_MAN_DIR = x    ; then
159531e5d586Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159631e5d586Smrgfi
1597b78bb896Smrg
159831e5d586Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
159931e5d586Smrg    case $SYSV_MAN_SECTIONS in
160031e5d586Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
160131e5d586Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160231e5d586Smrg    esac
160331e5d586Smrgfi
160431e5d586Smrgif test x$ADMIN_MAN_DIR = x    ; then
160531e5d586Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160631e5d586Smrgfi
1607b78bb896Smrg
1608b78bb896Smrg
160931e5d586SmrgAC_SUBST([APP_MAN_SUFFIX])
161031e5d586SmrgAC_SUBST([LIB_MAN_SUFFIX])
161131e5d586SmrgAC_SUBST([FILE_MAN_SUFFIX])
161231e5d586SmrgAC_SUBST([MISC_MAN_SUFFIX])
161331e5d586SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161431e5d586SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161531e5d586SmrgAC_SUBST([APP_MAN_DIR])
161631e5d586SmrgAC_SUBST([LIB_MAN_DIR])
161731e5d586SmrgAC_SUBST([FILE_MAN_DIR])
161831e5d586SmrgAC_SUBST([MISC_MAN_DIR])
161931e5d586SmrgAC_SUBST([DRIVER_MAN_DIR])
162031e5d586SmrgAC_SUBST([ADMIN_MAN_DIR])
1621b78bb896Smrg
162231e5d586SmrgXORG_MAN_PAGE="X Version 11"
162331e5d586SmrgAC_SUBST([XORG_MAN_PAGE])
162431e5d586SmrgMAN_SUBSTS="\
162531e5d586Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162631e5d586Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162731e5d586Smrg	-e 's|__xservername__|Xorg|g' \
162831e5d586Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
162931e5d586Smrg	-e 's|__projectroot__|\$(prefix)|g' \
163031e5d586Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163131e5d586Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163231e5d586Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163331e5d586Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163431e5d586Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163531e5d586Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163631e5d586Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163731e5d586SmrgAC_SUBST([MAN_SUBSTS])
1638b78bb896Smrg
163931e5d586Smrg]) # XORG_MANPAGE_SECTIONS
1640b78bb896Smrg
164131e5d586Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164231e5d586Smrg# ------------------------
164331e5d586Smrg# Minimum version: 1.7.0
16449e0146f7Smrg#
164531e5d586Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164631e5d586Smrg# provided by xorg-sgml-doctools, if installed.
164731e5d586SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164831e5d586SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164931e5d586SmrgXORG_SGML_PATH=
165031e5d586SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165131e5d586Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165231e5d586Smrg    [m4_ifval([$1],[:],
165331e5d586Smrg        [if test x"$cross_compiling" != x"yes" ; then
165431e5d586Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165531e5d586Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165631e5d586Smrg         fi])
165731e5d586Smrg    ])
165831e5d586Smrg
165931e5d586Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166031e5d586Smrg# the path and the name of the doc stylesheet
166131e5d586Smrgif test "x$XORG_SGML_PATH" != "x" ; then
166231e5d586Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166331e5d586Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166431e5d586Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166531e5d586Smrgelse
166631e5d586Smrg   AC_MSG_RESULT([no])
166731e5d586Smrgfi
166831e5d586Smrg
166931e5d586SmrgAC_SUBST(XORG_SGML_PATH)
167031e5d586SmrgAC_SUBST(STYLESHEET_SRCDIR)
167131e5d586SmrgAC_SUBST(XSL_STYLESHEET)
167231e5d586SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167331e5d586Smrg]) # XORG_CHECK_SGML_DOCTOOLS
167431e5d586Smrg
167531e5d586Smrg# XORG_CHECK_LINUXDOC
167631e5d586Smrg# -------------------
167731e5d586Smrg# Minimum version: 1.0.0
16789e0146f7Smrg#
167931e5d586Smrg# Defines the variable MAKE_TEXT if the necessary tools and
168031e5d586Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168131e5d586Smrg# Whether or not the necessary tools and files are found can be checked
168231e5d586Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168331e5d586SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168431e5d586SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168531e5d586SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16869e0146f7Smrg
168731e5d586SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688b78bb896Smrg
168931e5d586SmrgAC_MSG_CHECKING([whether to build documentation])
169031e5d586Smrg
169131e5d586Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169231e5d586Smrg   BUILDDOC=yes
16939e0146f7Smrgelse
169431e5d586Smrg   BUILDDOC=no
16959e0146f7Smrgfi
16969e0146f7Smrg
169731e5d586SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16989e0146f7Smrg
169931e5d586SmrgAC_MSG_RESULT([$BUILDDOC])
1700b78bb896Smrg
170131e5d586SmrgAC_MSG_CHECKING([whether to build pdf documentation])
170231e5d586Smrg
170331e5d586Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170431e5d586Smrg   BUILDPDFDOC=yes
170531e5d586Smrgelse
170631e5d586Smrg   BUILDPDFDOC=no
170731e5d586Smrgfi
170831e5d586Smrg
170931e5d586SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171031e5d586Smrg
171131e5d586SmrgAC_MSG_RESULT([$BUILDPDFDOC])
171231e5d586Smrg
171331e5d586SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171431e5d586SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171531e5d586SmrgMAKE_PDF="$PS2PDF"
171631e5d586SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171731e5d586Smrg
171831e5d586SmrgAC_SUBST(MAKE_TEXT)
171931e5d586SmrgAC_SUBST(MAKE_PS)
172031e5d586SmrgAC_SUBST(MAKE_PDF)
172131e5d586SmrgAC_SUBST(MAKE_HTML)
172231e5d586Smrg]) # XORG_CHECK_LINUXDOC
172331e5d586Smrg
172431e5d586Smrg# XORG_CHECK_DOCBOOK
172531e5d586Smrg# -------------------
172631e5d586Smrg# Minimum version: 1.0.0
172731e5d586Smrg#
172831e5d586Smrg# Checks for the ability to build output formats from SGML DocBook source.
172931e5d586Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173031e5d586Smrg# indicates whether the necessary tools and files are found and, if set,
173131e5d586Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173231e5d586SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173331e5d586SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
173431e5d586Smrg
173531e5d586SmrgBUILDTXTDOC=no
173631e5d586SmrgBUILDPDFDOC=no
173731e5d586SmrgBUILDPSDOC=no
173831e5d586SmrgBUILDHTMLDOC=no
173931e5d586Smrg
174031e5d586SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174131e5d586SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174231e5d586SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174331e5d586SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744b78bb896Smrg
174531e5d586SmrgAC_MSG_CHECKING([whether to build text documentation])
174631e5d586Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174731e5d586Smrg   test x$BUILD_TXTDOC != xno; then
174831e5d586Smrg	BUILDTXTDOC=yes
174931e5d586Smrgfi
175031e5d586SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175131e5d586SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752b78bb896Smrg
175331e5d586SmrgAC_MSG_CHECKING([whether to build PDF documentation])
175431e5d586Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175531e5d586Smrg   test x$BUILD_PDFDOC != xno; then
175631e5d586Smrg	BUILDPDFDOC=yes
175731e5d586Smrgfi
175831e5d586SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175931e5d586SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760b78bb896Smrg
176131e5d586SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176231e5d586Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176331e5d586Smrg   test x$BUILD_PSDOC != xno; then
176431e5d586Smrg	BUILDPSDOC=yes
17659e0146f7Smrgfi
176631e5d586SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176731e5d586SmrgAC_MSG_RESULT([$BUILDPSDOC])
1768492e1cfeSmrg
176931e5d586SmrgAC_MSG_CHECKING([whether to build HTML documentation])
177031e5d586Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177131e5d586Smrg   test x$BUILD_HTMLDOC != xno; then
177231e5d586Smrg	BUILDHTMLDOC=yes
177331e5d586Smrgfi
177431e5d586SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177531e5d586SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776b78bb896Smrg
177731e5d586SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177831e5d586SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177931e5d586SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178031e5d586SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178131e5d586Smrg
178231e5d586SmrgAC_SUBST(MAKE_TEXT)
178331e5d586SmrgAC_SUBST(MAKE_PS)
178431e5d586SmrgAC_SUBST(MAKE_PDF)
178531e5d586SmrgAC_SUBST(MAKE_HTML)
178631e5d586Smrg]) # XORG_CHECK_DOCBOOK
178731e5d586Smrg
178831e5d586Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178931e5d586Smrg# ----------------
179031e5d586Smrg# Minimum version: 1.5.0
179131e5d586Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17929e0146f7Smrg#
179331e5d586Smrg# Documentation tools are not always available on all platforms and sometimes
179431e5d586Smrg# not at the appropriate level. This macro enables a module to test for the
179531e5d586Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
179631e5d586Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
179731e5d586Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179831e5d586Smrg# --with-xmlto assumes 'auto'.
17999e0146f7Smrg#
180031e5d586Smrg# Interface to module:
180131e5d586Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180231e5d586Smrg# XMLTO:	returns the path of the xmlto program found
180331e5d586Smrg#		returns the path set by the user in the environment
180431e5d586Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180531e5d586Smrg#		'no' user instructs the module not to use xmlto
18069e0146f7Smrg#
180731e5d586Smrg# Added in version 1.10.0
180831e5d586Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180931e5d586Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
18109e0146f7Smrg#
181131e5d586Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
18129e0146f7Smrg#
181331e5d586SmrgAC_DEFUN([XORG_WITH_XMLTO],[
181431e5d586SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181531e5d586Smrgm4_define([_defopt], m4_default([$2], [auto]))
181631e5d586SmrgAC_ARG_WITH(xmlto,
181731e5d586Smrg	AS_HELP_STRING([--with-xmlto],
181831e5d586Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181931e5d586Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182031e5d586Smrgm4_undefine([_defopt])
18219e0146f7Smrg
182231e5d586Smrgif test "x$use_xmlto" = x"auto"; then
182331e5d586Smrg   AC_PATH_PROG([XMLTO], [xmlto])
182431e5d586Smrg   if test "x$XMLTO" = "x"; then
182531e5d586Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182631e5d586Smrg	have_xmlto=no
182731e5d586Smrg   else
182831e5d586Smrg        have_xmlto=yes
182931e5d586Smrg   fi
183031e5d586Smrgelif test "x$use_xmlto" = x"yes" ; then
183131e5d586Smrg   AC_PATH_PROG([XMLTO], [xmlto])
183231e5d586Smrg   if test "x$XMLTO" = "x"; then
183331e5d586Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183431e5d586Smrg   fi
183531e5d586Smrg   have_xmlto=yes
183631e5d586Smrgelif test "x$use_xmlto" = x"no" ; then
183731e5d586Smrg   if test "x$XMLTO" != "x"; then
183831e5d586Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183931e5d586Smrg   fi
184031e5d586Smrg   have_xmlto=no
184131e5d586Smrgelse
184231e5d586Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184331e5d586Smrgfi
1844492e1cfeSmrg
184531e5d586Smrg# Test for a minimum version of xmlto, if provided.
184631e5d586Smrgm4_ifval([$1],
184731e5d586Smrg[if test "$have_xmlto" = yes; then
184831e5d586Smrg    # scrape the xmlto version
184931e5d586Smrg    AC_MSG_CHECKING([the xmlto version])
185031e5d586Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185131e5d586Smrg    AC_MSG_RESULT([$xmlto_version])
185231e5d586Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185331e5d586Smrg        [if test "x$use_xmlto" = xauto; then
185431e5d586Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185531e5d586Smrg            have_xmlto=no
185631e5d586Smrg        else
185731e5d586Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185831e5d586Smrg        fi])
185931e5d586Smrgfi])
1860492e1cfeSmrg
186131e5d586Smrg# Test for the ability of xmlto to generate a text target
186231e5d586Smrg#
186331e5d586Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
186431e5d586Smrg# following test for empty XML docbook files.
186531e5d586Smrg# For compatibility reasons use the following empty XML docbook file and if
186631e5d586Smrg# it fails try it again with a non-empty XML file.
186731e5d586Smrghave_xmlto_text=no
186831e5d586Smrgcat > conftest.xml << "EOF"
186931e5d586SmrgEOF
187031e5d586SmrgAS_IF([test "$have_xmlto" = yes],
187131e5d586Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187231e5d586Smrg             [have_xmlto_text=yes],
187331e5d586Smrg             [# Try it again with a non-empty XML file.
187431e5d586Smrg              cat > conftest.xml << "EOF"
187531e5d586Smrg<x></x>
187631e5d586SmrgEOF
187731e5d586Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187831e5d586Smrg                    [have_xmlto_text=yes],
187931e5d586Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188031e5d586Smrgrm -f conftest.xml
188131e5d586SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188231e5d586SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188331e5d586Smrg]) # XORG_WITH_XMLTO
1884492e1cfeSmrg
188531e5d586Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188631e5d586Smrg# --------------------------------------------
188731e5d586Smrg# Minimum version: 1.12.0
188831e5d586Smrg# Minimum version for optional DEFAULT argument: 1.12.0
188931e5d586Smrg#
189031e5d586Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189131e5d586Smrg# XML-based language used for the transformation of XML documents.
189231e5d586Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189331e5d586Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189431e5d586Smrg# The XSLT processor is often used as a standalone tool for transformations.
189531e5d586Smrg# It should not be assumed that this tool is used only to work with documnetation.
189631e5d586Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189731e5d586Smrg#
189831e5d586Smrg# Interface to module:
189931e5d586Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190031e5d586Smrg# XSLTPROC:	 returns the path of the xsltproc program found
190131e5d586Smrg#		 returns the path set by the user in the environment
190231e5d586Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190331e5d586Smrg#		  'no' user instructs the module not to use xsltproc
190431e5d586Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190531e5d586Smrg#
190631e5d586Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190731e5d586Smrg#
190831e5d586SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190931e5d586SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191031e5d586Smrg# Preserves the interface, should it be implemented later
191131e5d586Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191231e5d586Smrgm4_define([_defopt], m4_default([$2], [auto]))
191331e5d586SmrgAC_ARG_WITH(xsltproc,
191431e5d586Smrg	AS_HELP_STRING([--with-xsltproc],
191531e5d586Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191631e5d586Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191731e5d586Smrgm4_undefine([_defopt])
1918492e1cfeSmrg
191931e5d586Smrgif test "x$use_xsltproc" = x"auto"; then
192031e5d586Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192131e5d586Smrg   if test "x$XSLTPROC" = "x"; then
192231e5d586Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192331e5d586Smrg	have_xsltproc=no
192431e5d586Smrg   else
192531e5d586Smrg        have_xsltproc=yes
192631e5d586Smrg   fi
192731e5d586Smrgelif test "x$use_xsltproc" = x"yes" ; then
192831e5d586Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192931e5d586Smrg   if test "x$XSLTPROC" = "x"; then
193031e5d586Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193131e5d586Smrg   fi
193231e5d586Smrg   have_xsltproc=yes
193331e5d586Smrgelif test "x$use_xsltproc" = x"no" ; then
193431e5d586Smrg   if test "x$XSLTPROC" != "x"; then
193531e5d586Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193631e5d586Smrg   fi
193731e5d586Smrg   have_xsltproc=no
193831e5d586Smrgelse
193931e5d586Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940b78bb896Smrgfi
1941b78bb896Smrg
194231e5d586SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194331e5d586Smrg]) # XORG_WITH_XSLTPROC
194431e5d586Smrg
194531e5d586Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194631e5d586Smrg# ----------------------------------------
194731e5d586Smrg# Minimum version: 1.15.0
19489e0146f7Smrg#
194931e5d586Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
195031e5d586Smrg# scanning arbitrary text files, extracting information from those text files,
195131e5d586Smrg# and printing reports based on that information.
19529e0146f7Smrg#
195331e5d586Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
19549e0146f7Smrg#
195531e5d586Smrg# Interface to module:
195631e5d586Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
195731e5d586Smrg# PERL:	     returns the path of the perl program found
195831e5d586Smrg#	     returns the path set by the user in the environment
195931e5d586Smrg# --with-perl: 'yes' user instructs the module to use perl
196031e5d586Smrg#	       'no' user instructs the module not to use perl
196131e5d586Smrg# have_perl: returns yes if perl found in PATH or no
19629e0146f7Smrg#
196331e5d586Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196431e5d586Smrg#
196531e5d586SmrgAC_DEFUN([XORG_WITH_PERL],[
196631e5d586SmrgAC_ARG_VAR([PERL], [Path to perl command])
196731e5d586Smrg# Preserves the interface, should it be implemented later
196831e5d586Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196931e5d586Smrgm4_define([_defopt], m4_default([$2], [auto]))
197031e5d586SmrgAC_ARG_WITH(perl,
197131e5d586Smrg	AS_HELP_STRING([--with-perl],
197231e5d586Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197331e5d586Smrg	   [use_perl=$withval], [use_perl=]_defopt)
197431e5d586Smrgm4_undefine([_defopt])
19759e0146f7Smrg
197631e5d586Smrgif test "x$use_perl" = x"auto"; then
197731e5d586Smrg   AC_PATH_PROG([PERL], [perl])
197831e5d586Smrg   if test "x$PERL" = "x"; then
197931e5d586Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198031e5d586Smrg	have_perl=no
198131e5d586Smrg   else
198231e5d586Smrg        have_perl=yes
198331e5d586Smrg   fi
198431e5d586Smrgelif test "x$use_perl" = x"yes" ; then
198531e5d586Smrg   AC_PATH_PROG([PERL], [perl])
198631e5d586Smrg   if test "x$PERL" = "x"; then
198731e5d586Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198831e5d586Smrg   fi
198931e5d586Smrg   have_perl=yes
199031e5d586Smrgelif test "x$use_perl" = x"no" ; then
199131e5d586Smrg   if test "x$PERL" != "x"; then
199231e5d586Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199331e5d586Smrg   fi
199431e5d586Smrg   have_perl=no
199531e5d586Smrgelse
199631e5d586Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199731e5d586Smrgfi
19983538fbe3Smrg
199931e5d586SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200031e5d586Smrg]) # XORG_WITH_PERL
2001492e1cfeSmrg
200231e5d586Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
20039e0146f7Smrg# ----------------
200431e5d586Smrg# Minimum version: 1.5.0
200531e5d586Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20069e0146f7Smrg#
200731e5d586Smrg# Documentation tools are not always available on all platforms and sometimes
200831e5d586Smrg# not at the appropriate level. This macro enables a module to test for the
200931e5d586Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
201031e5d586Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
201131e5d586Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201231e5d586Smrg# --with-asciidoc assumes 'auto'.
20139e0146f7Smrg#
201431e5d586Smrg# Interface to module:
201531e5d586Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201631e5d586Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
201731e5d586Smrg#		 returns the path set by the user in the environment
201831e5d586Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201931e5d586Smrg#		  'no' user instructs the module not to use asciidoc
20209e0146f7Smrg#
202131e5d586Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20229e0146f7Smrg#
202331e5d586SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202431e5d586SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202531e5d586Smrgm4_define([_defopt], m4_default([$2], [auto]))
202631e5d586SmrgAC_ARG_WITH(asciidoc,
202731e5d586Smrg	AS_HELP_STRING([--with-asciidoc],
202831e5d586Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202931e5d586Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203031e5d586Smrgm4_undefine([_defopt])
2031b78bb896Smrg
203231e5d586Smrgif test "x$use_asciidoc" = x"auto"; then
203331e5d586Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203431e5d586Smrg   if test "x$ASCIIDOC" = "x"; then
203531e5d586Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203631e5d586Smrg	have_asciidoc=no
203731e5d586Smrg   else
203831e5d586Smrg        have_asciidoc=yes
203931e5d586Smrg   fi
204031e5d586Smrgelif test "x$use_asciidoc" = x"yes" ; then
204131e5d586Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204231e5d586Smrg   if test "x$ASCIIDOC" = "x"; then
204331e5d586Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204431e5d586Smrg   fi
204531e5d586Smrg   have_asciidoc=yes
204631e5d586Smrgelif test "x$use_asciidoc" = x"no" ; then
204731e5d586Smrg   if test "x$ASCIIDOC" != "x"; then
204831e5d586Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204931e5d586Smrg   fi
205031e5d586Smrg   have_asciidoc=no
205131e5d586Smrgelse
205231e5d586Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205331e5d586Smrgfi
205431e5d586Smrgm4_ifval([$1],
205531e5d586Smrg[if test "$have_asciidoc" = yes; then
205631e5d586Smrg    # scrape the asciidoc version
205731e5d586Smrg    AC_MSG_CHECKING([the asciidoc version])
205831e5d586Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205931e5d586Smrg    AC_MSG_RESULT([$asciidoc_version])
206031e5d586Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206131e5d586Smrg        [if test "x$use_asciidoc" = xauto; then
206231e5d586Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206331e5d586Smrg            have_asciidoc=no
206431e5d586Smrg        else
206531e5d586Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206631e5d586Smrg        fi])
206731e5d586Smrgfi])
206831e5d586SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206931e5d586Smrg]) # XORG_WITH_ASCIIDOC
2070b78bb896Smrg
207131e5d586Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207231e5d586Smrg# -------------------------------------------
207331e5d586Smrg# Minimum version: 1.5.0
207431e5d586Smrg# Minimum version for optional DEFAULT argument: 1.11.0
207531e5d586Smrg# Minimum version for optional DOT checking: 1.18.0
20769e0146f7Smrg#
207731e5d586Smrg# Documentation tools are not always available on all platforms and sometimes
207831e5d586Smrg# not at the appropriate level. This macro enables a module to test for the
207931e5d586Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
208031e5d586Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
208131e5d586Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208231e5d586Smrg# --with-doxygen assumes 'auto'.
20839e0146f7Smrg#
208431e5d586Smrg# Interface to module:
208531e5d586Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208631e5d586Smrg# DOXYGEN:	 returns the path of the doxygen program found
208731e5d586Smrg#		 returns the path set by the user in the environment
208831e5d586Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208931e5d586Smrg#		  'no' user instructs the module not to use doxygen
20909e0146f7Smrg#
209131e5d586Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20929e0146f7Smrg#
209331e5d586SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209431e5d586SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209531e5d586SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209631e5d586Smrgm4_define([_defopt], m4_default([$2], [auto]))
209731e5d586SmrgAC_ARG_WITH(doxygen,
209831e5d586Smrg	AS_HELP_STRING([--with-doxygen],
209931e5d586Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210031e5d586Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210131e5d586Smrgm4_undefine([_defopt])
2102b78bb896Smrg
210331e5d586Smrgif test "x$use_doxygen" = x"auto"; then
210431e5d586Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210531e5d586Smrg   if test "x$DOXYGEN" = "x"; then
210631e5d586Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210731e5d586Smrg	have_doxygen=no
210831e5d586Smrg   else
210931e5d586Smrg        have_doxygen=yes
211031e5d586Smrg   fi
211131e5d586Smrgelif test "x$use_doxygen" = x"yes" ; then
211231e5d586Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211331e5d586Smrg   if test "x$DOXYGEN" = "x"; then
211431e5d586Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211531e5d586Smrg   fi
211631e5d586Smrg   have_doxygen=yes
211731e5d586Smrgelif test "x$use_doxygen" = x"no" ; then
211831e5d586Smrg   if test "x$DOXYGEN" != "x"; then
211931e5d586Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212031e5d586Smrg   fi
212131e5d586Smrg   have_doxygen=no
2122b78bb896Smrgelse
212331e5d586Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124b78bb896Smrgfi
212531e5d586Smrgm4_ifval([$1],
212631e5d586Smrg[if test "$have_doxygen" = yes; then
212731e5d586Smrg    # scrape the doxygen version
212831e5d586Smrg    AC_MSG_CHECKING([the doxygen version])
212931e5d586Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213031e5d586Smrg    AC_MSG_RESULT([$doxygen_version])
213131e5d586Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213231e5d586Smrg        [if test "x$use_doxygen" = xauto; then
213331e5d586Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213431e5d586Smrg            have_doxygen=no
213531e5d586Smrg        else
213631e5d586Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213731e5d586Smrg        fi])
213831e5d586Smrgfi])
2139b78bb896Smrg
214031e5d586Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214131e5d586Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214231e5d586Smrgdnl 	HAVE_DOT = @HAVE_DOT@
214331e5d586SmrgHAVE_DOT=no
214431e5d586Smrgif test "x$have_doxygen" = "xyes"; then
214531e5d586Smrg  AC_PATH_PROG([DOT], [dot])
214631e5d586Smrg    if test "x$DOT" != "x"; then
214731e5d586Smrg      HAVE_DOT=yes
214831e5d586Smrg    fi
214931e5d586Smrgfi
2150b78bb896Smrg
215131e5d586SmrgAC_SUBST([HAVE_DOT])
215231e5d586SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215331e5d586SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215431e5d586Smrg]) # XORG_WITH_DOXYGEN
2155b78bb896Smrg
215631e5d586Smrg# XORG_WITH_GROFF([DEFAULT])
215731e5d586Smrg# ----------------
215831e5d586Smrg# Minimum version: 1.6.0
215931e5d586Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21603538fbe3Smrg#
216131e5d586Smrg# Documentation tools are not always available on all platforms and sometimes
216231e5d586Smrg# not at the appropriate level. This macro enables a module to test for the
216331e5d586Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
216431e5d586Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
216531e5d586Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
216631e5d586Smrg# --with-groff assumes 'auto'.
216731e5d586Smrg#
216831e5d586Smrg# Interface to module:
216931e5d586Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217031e5d586Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217131e5d586Smrg# HAVE_GROFF_MS: the -ms macros package
217231e5d586Smrg# GROFF:	 returns the path of the groff program found
217331e5d586Smrg#		 returns the path set by the user in the environment
217431e5d586Smrg# --with-groff:	 'yes' user instructs the module to use groff
217531e5d586Smrg#		 'no' user instructs the module not to use groff
217631e5d586Smrg#
217731e5d586Smrg# Added in version 1.9.0:
217831e5d586Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217931e5d586Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218031e5d586Smrg#		   psselect from the psutils package.
218131e5d586Smrg#		   the ghostcript package. Refer to the grohtml man pages
218231e5d586Smrg#
218331e5d586Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218431e5d586Smrg#
218531e5d586Smrg# OS and distros often splits groff in a basic and full package, the former
218631e5d586Smrg# having the groff program and the later having devices, fonts and macros
218731e5d586Smrg# Checking for the groff executable is not enough.
218831e5d586Smrg#
218931e5d586Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
219031e5d586Smrg# unset HAVE_GROFF or GROFF env variables.
219131e5d586Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219231e5d586Smrg#
219331e5d586SmrgAC_DEFUN([XORG_WITH_GROFF],[
219431e5d586SmrgAC_ARG_VAR([GROFF], [Path to groff command])
219531e5d586Smrgm4_define([_defopt], m4_default([$1], [auto]))
219631e5d586SmrgAC_ARG_WITH(groff,
219731e5d586Smrg	AS_HELP_STRING([--with-groff],
219831e5d586Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219931e5d586Smrg	   [use_groff=$withval], [use_groff=]_defopt)
220031e5d586Smrgm4_undefine([_defopt])
2201b78bb896Smrg
220231e5d586Smrgif test "x$use_groff" = x"auto"; then
220331e5d586Smrg   AC_PATH_PROG([GROFF], [groff])
220431e5d586Smrg   if test "x$GROFF" = "x"; then
220531e5d586Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220631e5d586Smrg	have_groff=no
220731e5d586Smrg   else
220831e5d586Smrg        have_groff=yes
220931e5d586Smrg   fi
221031e5d586Smrgelif test "x$use_groff" = x"yes" ; then
221131e5d586Smrg   AC_PATH_PROG([GROFF], [groff])
221231e5d586Smrg   if test "x$GROFF" = "x"; then
221331e5d586Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221431e5d586Smrg   fi
221531e5d586Smrg   have_groff=yes
221631e5d586Smrgelif test "x$use_groff" = x"no" ; then
221731e5d586Smrg   if test "x$GROFF" != "x"; then
221831e5d586Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221931e5d586Smrg   fi
222031e5d586Smrg   have_groff=no
222131e5d586Smrgelse
222231e5d586Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222331e5d586Smrgfi
2224b78bb896Smrg
222531e5d586Smrg# We have groff, test for the presence of the macro packages
222631e5d586Smrgif test "x$have_groff" = x"yes"; then
222731e5d586Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222831e5d586Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222931e5d586Smrg        groff_ms_works=yes
223031e5d586Smrg    else
223131e5d586Smrg        groff_ms_works=no
2232b78bb896Smrg    fi
223331e5d586Smrg    AC_MSG_RESULT([$groff_ms_works])
223431e5d586Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223531e5d586Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223631e5d586Smrg        groff_mm_works=yes
223731e5d586Smrg    else
223831e5d586Smrg        groff_mm_works=no
223931e5d586Smrg    fi
224031e5d586Smrg    AC_MSG_RESULT([$groff_mm_works])
224131e5d586Smrgfi
2242b78bb896Smrg
224331e5d586Smrg# We have groff, test for HTML dependencies, one command per package
224431e5d586Smrgif test "x$have_groff" = x"yes"; then
224531e5d586Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224631e5d586Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224731e5d586Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224831e5d586Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224931e5d586Smrg      have_groff_html=yes
225031e5d586Smrg   else
225131e5d586Smrg      have_groff_html=no
225231e5d586Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225331e5d586Smrg   fi
225431e5d586Smrgfi
225531e5d586Smrg
225631e5d586Smrg# Set Automake conditionals for Makefiles
225731e5d586SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225831e5d586SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225931e5d586SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226031e5d586SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226131e5d586Smrg]) # XORG_WITH_GROFF
226231e5d586Smrg
226331e5d586Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226431e5d586Smrg# ---------------------------------------
226531e5d586Smrg# Minimum version: 1.6.0
226631e5d586Smrg# Minimum version for optional DEFAULT argument: 1.11.0
226731e5d586Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226831e5d586Smrg#
226931e5d586Smrg# Documentation tools are not always available on all platforms and sometimes
227031e5d586Smrg# not at the appropriate level. This macro enables a module to test for the
227131e5d586Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
227231e5d586Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
227331e5d586Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
227431e5d586Smrg# --with-fop assumes 'auto'.
227531e5d586Smrg#
227631e5d586Smrg# Interface to module:
227731e5d586Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227831e5d586Smrg# FOP:	 	returns the path of the fop program found
227931e5d586Smrg#		returns the path set by the user in the environment
228031e5d586Smrg# --with-fop: 	'yes' user instructs the module to use fop
228131e5d586Smrg#		'no' user instructs the module not to use fop
228231e5d586Smrg#
228331e5d586Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228431e5d586Smrg#
228531e5d586SmrgAC_DEFUN([XORG_WITH_FOP],[
228631e5d586SmrgAC_ARG_VAR([FOP], [Path to fop command])
228731e5d586Smrgm4_define([_defopt], m4_default([$2], [auto]))
228831e5d586SmrgAC_ARG_WITH(fop,
228931e5d586Smrg	AS_HELP_STRING([--with-fop],
229031e5d586Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229131e5d586Smrg	   [use_fop=$withval], [use_fop=]_defopt)
229231e5d586Smrgm4_undefine([_defopt])
229331e5d586Smrg
229431e5d586Smrgif test "x$use_fop" = x"auto"; then
229531e5d586Smrg   AC_PATH_PROG([FOP], [fop])
229631e5d586Smrg   if test "x$FOP" = "x"; then
229731e5d586Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229831e5d586Smrg	have_fop=no
229931e5d586Smrg   else
230031e5d586Smrg        have_fop=yes
230131e5d586Smrg   fi
230231e5d586Smrgelif test "x$use_fop" = x"yes" ; then
230331e5d586Smrg   AC_PATH_PROG([FOP], [fop])
230431e5d586Smrg   if test "x$FOP" = "x"; then
230531e5d586Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230631e5d586Smrg   fi
230731e5d586Smrg   have_fop=yes
230831e5d586Smrgelif test "x$use_fop" = x"no" ; then
230931e5d586Smrg   if test "x$FOP" != "x"; then
231031e5d586Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231131e5d586Smrg   fi
231231e5d586Smrg   have_fop=no
2313b78bb896Smrgelse
231431e5d586Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
23153538fbe3Smrgfi
23163538fbe3Smrg
231731e5d586Smrg# Test for a minimum version of fop, if provided.
231831e5d586Smrgm4_ifval([$1],
231931e5d586Smrg[if test "$have_fop" = yes; then
232031e5d586Smrg    # scrape the fop version
232131e5d586Smrg    AC_MSG_CHECKING([for fop minimum version])
232231e5d586Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232331e5d586Smrg    AC_MSG_RESULT([$fop_version])
232431e5d586Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
232531e5d586Smrg        [if test "x$use_fop" = xauto; then
232631e5d586Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232731e5d586Smrg            have_fop=no
232831e5d586Smrg        else
232931e5d586Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233031e5d586Smrg        fi])
233131e5d586Smrgfi])
233231e5d586SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233331e5d586Smrg]) # XORG_WITH_FOP
233431e5d586Smrg
233531e5d586Smrg# XORG_WITH_M4([MIN-VERSION])
233631e5d586Smrg# ---------------------------
233731e5d586Smrg# Minimum version: 1.19.0
233831e5d586Smrg#
233931e5d586Smrg# This macro attempts to locate an m4 macro processor which supports
234031e5d586Smrg# -I option and is only useful for modules relying on M4 in order to
234131e5d586Smrg# expand macros in source code files.
234231e5d586Smrg#
234331e5d586Smrg# Interface to module:
234431e5d586Smrg# M4:	 	returns the path of the m4 program found
234531e5d586Smrg#		returns the path set by the user in the environment
234631e5d586Smrg#
234731e5d586SmrgAC_DEFUN([XORG_WITH_M4], [
234831e5d586SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234931e5d586Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235031e5d586Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235131e5d586Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235231e5d586Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235331e5d586Smrg   [$PATH:/usr/gnu/bin])])
2354b78bb896Smrg
235531e5d586SmrgAC_SUBST([M4], [$ac_cv_path_M4])
235631e5d586Smrg]) # XORG_WITH_M4
2357b78bb896Smrg
235831e5d586Smrg# XORG_WITH_PS2PDF([DEFAULT])
235931e5d586Smrg# ----------------
236031e5d586Smrg# Minimum version: 1.6.0
236131e5d586Smrg# Minimum version for optional DEFAULT argument: 1.11.0
236231e5d586Smrg#
236331e5d586Smrg# Documentation tools are not always available on all platforms and sometimes
236431e5d586Smrg# not at the appropriate level. This macro enables a module to test for the
236531e5d586Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
236631e5d586Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
236731e5d586Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236831e5d586Smrg# --with-ps2pdf assumes 'auto'.
236931e5d586Smrg#
237031e5d586Smrg# Interface to module:
237131e5d586Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237231e5d586Smrg# PS2PDF:	returns the path of the ps2pdf program found
237331e5d586Smrg#		returns the path set by the user in the environment
237431e5d586Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237531e5d586Smrg#		 'no' user instructs the module not to use ps2pdf
237631e5d586Smrg#
237731e5d586Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237831e5d586Smrg#
237931e5d586SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238031e5d586SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238131e5d586Smrgm4_define([_defopt], m4_default([$1], [auto]))
238231e5d586SmrgAC_ARG_WITH(ps2pdf,
238331e5d586Smrg	AS_HELP_STRING([--with-ps2pdf],
238431e5d586Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238531e5d586Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238631e5d586Smrgm4_undefine([_defopt])
2387b78bb896Smrg
238831e5d586Smrgif test "x$use_ps2pdf" = x"auto"; then
238931e5d586Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239031e5d586Smrg   if test "x$PS2PDF" = "x"; then
239131e5d586Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239231e5d586Smrg	have_ps2pdf=no
239331e5d586Smrg   else
239431e5d586Smrg        have_ps2pdf=yes
239531e5d586Smrg   fi
239631e5d586Smrgelif test "x$use_ps2pdf" = x"yes" ; then
239731e5d586Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239831e5d586Smrg   if test "x$PS2PDF" = "x"; then
239931e5d586Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240031e5d586Smrg   fi
240131e5d586Smrg   have_ps2pdf=yes
240231e5d586Smrgelif test "x$use_ps2pdf" = x"no" ; then
240331e5d586Smrg   if test "x$PS2PDF" != "x"; then
240431e5d586Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240531e5d586Smrg   fi
240631e5d586Smrg   have_ps2pdf=no
240731e5d586Smrgelse
240831e5d586Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
24093538fbe3Smrgfi
241031e5d586SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241131e5d586Smrg]) # XORG_WITH_PS2PDF
2412b78bb896Smrg
241331e5d586Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
241431e5d586Smrg# ----------------
241531e5d586Smrg# Minimum version: 1.6.0
2416b78bb896Smrg#
241731e5d586Smrg# Documentation tools are not always available on all platforms and sometimes
241831e5d586Smrg# not at the appropriate level. This macro enables a builder to skip all
241931e5d586Smrg# documentation targets except traditional man pages.
242031e5d586Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242131e5d586Smrg# maximum flexibilty in controlling documentation building.
242231e5d586Smrg# Refer to:
242331e5d586Smrg# XORG_WITH_XMLTO         --with-xmlto
242431e5d586Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242531e5d586Smrg# XORG_WITH_DOXYGEN       --with-doxygen
242631e5d586Smrg# XORG_WITH_FOP           --with-fop
242731e5d586Smrg# XORG_WITH_GROFF         --with-groff
242831e5d586Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
242931e5d586Smrg#
243031e5d586Smrg# Interface to module:
243131e5d586Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243231e5d586Smrg# --enable-docs: 'yes' user instructs the module to generate docs
243331e5d586Smrg#		 'no' user instructs the module not to generate docs
243431e5d586Smrg# parm1:	specify the default value, yes or no.
243531e5d586Smrg#
243631e5d586SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243731e5d586Smrgm4_define([docs_default], m4_default([$1], [yes]))
243831e5d586SmrgAC_ARG_ENABLE(docs,
243931e5d586Smrg	AS_HELP_STRING([--enable-docs],
244031e5d586Smrg	   [Enable building the documentation (default: ]docs_default[)]),
244131e5d586Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
244231e5d586Smrgm4_undefine([docs_default])
244331e5d586SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244431e5d586SmrgAC_MSG_CHECKING([whether to build documentation])
244531e5d586SmrgAC_MSG_RESULT([$build_docs])
244631e5d586Smrg]) # XORG_ENABLE_DOCS
2447b78bb896Smrg
244831e5d586Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244931e5d586Smrg# ----------------
245031e5d586Smrg# Minimum version: 1.6.0
245131e5d586Smrg#
245231e5d586Smrg# This macro enables a builder to skip all developer documentation.
245331e5d586Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245431e5d586Smrg# maximum flexibilty in controlling documentation building.
245531e5d586Smrg# Refer to:
245631e5d586Smrg# XORG_WITH_XMLTO         --with-xmlto
245731e5d586Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245831e5d586Smrg# XORG_WITH_DOXYGEN       --with-doxygen
245931e5d586Smrg# XORG_WITH_FOP           --with-fop
246031e5d586Smrg# XORG_WITH_GROFF         --with-groff
246131e5d586Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
246231e5d586Smrg#
246331e5d586Smrg# Interface to module:
246431e5d586Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246531e5d586Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246631e5d586Smrg#			'no' user instructs the module not to generate developer docs
246731e5d586Smrg# parm1:		specify the default value, yes or no.
246831e5d586Smrg#
246931e5d586SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247031e5d586Smrgm4_define([devel_default], m4_default([$1], [yes]))
247131e5d586SmrgAC_ARG_ENABLE(devel-docs,
247231e5d586Smrg	AS_HELP_STRING([--enable-devel-docs],
247331e5d586Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247431e5d586Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247531e5d586Smrgm4_undefine([devel_default])
247631e5d586SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247731e5d586SmrgAC_MSG_CHECKING([whether to build developer documentation])
247831e5d586SmrgAC_MSG_RESULT([$build_devel_docs])
247931e5d586Smrg]) # XORG_ENABLE_DEVEL_DOCS
2480b78bb896Smrg
248131e5d586Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
248231e5d586Smrg# ----------------
248331e5d586Smrg# Minimum version: 1.6.0
248431e5d586Smrg#
248531e5d586Smrg# This macro enables a builder to skip all functional specification targets.
248631e5d586Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248731e5d586Smrg# maximum flexibilty in controlling documentation building.
248831e5d586Smrg# Refer to:
248931e5d586Smrg# XORG_WITH_XMLTO         --with-xmlto
249031e5d586Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249131e5d586Smrg# XORG_WITH_DOXYGEN       --with-doxygen
249231e5d586Smrg# XORG_WITH_FOP           --with-fop
249331e5d586Smrg# XORG_WITH_GROFF         --with-groff
249431e5d586Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
249531e5d586Smrg#
249631e5d586Smrg# Interface to module:
249731e5d586Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249831e5d586Smrg# --enable-specs:	'yes' user instructs the module to generate specs
249931e5d586Smrg#			'no' user instructs the module not to generate specs
250031e5d586Smrg# parm1:		specify the default value, yes or no.
250131e5d586Smrg#
250231e5d586SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250331e5d586Smrgm4_define([spec_default], m4_default([$1], [yes]))
250431e5d586SmrgAC_ARG_ENABLE(specs,
250531e5d586Smrg	AS_HELP_STRING([--enable-specs],
250631e5d586Smrg	   [Enable building the specs (default: ]spec_default[)]),
250731e5d586Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
250831e5d586Smrgm4_undefine([spec_default])
250931e5d586SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251031e5d586SmrgAC_MSG_CHECKING([whether to build functional specifications])
251131e5d586SmrgAC_MSG_RESULT([$build_specs])
251231e5d586Smrg]) # XORG_ENABLE_SPECS
2513b78bb896Smrg
251431e5d586Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251531e5d586Smrg# ----------------------------------------------
251631e5d586Smrg# Minimum version: 1.13.0
2517b78bb896Smrg#
251831e5d586Smrg# This macro enables a builder to enable/disable unit testing
251931e5d586Smrg# It makes no assumption about the test cases implementation
252031e5d586Smrg# Test cases may or may not use Automake "Support for test suites"
252131e5d586Smrg# They may or may not use the software utility library GLib
252231e5d586Smrg#
252331e5d586Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252431e5d586Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252531e5d586Smrg# The variable enable_unit_tests is used by other macros in this file.
252631e5d586Smrg#
252731e5d586Smrg# Interface to module:
252831e5d586Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252931e5d586Smrg# enable_unit_tests:    used in configure.ac for additional configuration
253031e5d586Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253131e5d586Smrg#			'no' user instructs the module not to build tests
253231e5d586Smrg# parm1:		specify the default value, yes or no.
253331e5d586Smrg#
253431e5d586SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253531e5d586SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253631e5d586SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253731e5d586SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253831e5d586Smrgm4_define([_defopt], m4_default([$1], [auto]))
253931e5d586SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254031e5d586Smrg	[Enable building unit test cases (default: ]_defopt[)]),
254131e5d586Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254231e5d586Smrgm4_undefine([_defopt])
254331e5d586SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254431e5d586SmrgAC_MSG_CHECKING([whether to build unit test cases])
254531e5d586SmrgAC_MSG_RESULT([$enable_unit_tests])
254631e5d586Smrg]) # XORG_ENABLE_UNIT_TESTS
2547b78bb896Smrg
254831e5d586Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254931e5d586Smrg# ------------------------------------------------------
255031e5d586Smrg# Minimum version: 1.17.0
255131e5d586Smrg#
255231e5d586Smrg# This macro enables a builder to enable/disable integration testing
255331e5d586Smrg# It makes no assumption about the test cases' implementation
255431e5d586Smrg# Test cases may or may not use Automake "Support for test suites"
255531e5d586Smrg#
255631e5d586Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255731e5d586Smrg# usually requires less dependencies and may be built and run under less
255831e5d586Smrg# stringent environments than integration tests.
255931e5d586Smrg#
256031e5d586Smrg# Interface to module:
256131e5d586Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256231e5d586Smrg# enable_integration_tests:   used in configure.ac for additional configuration
256331e5d586Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256431e5d586Smrg#                             'no' user instructs the module not to build tests
256531e5d586Smrg# parm1:                      specify the default value, yes or no.
256631e5d586Smrg#
256731e5d586SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256831e5d586SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256931e5d586Smrgm4_define([_defopt], m4_default([$1], [auto]))
257031e5d586SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257131e5d586Smrg	[Enable building integration test cases (default: ]_defopt[)]),
257231e5d586Smrg	[enable_integration_tests=$enableval],
257331e5d586Smrg	[enable_integration_tests=]_defopt)
257431e5d586Smrgm4_undefine([_defopt])
257531e5d586SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257631e5d586Smrg	[test "x$enable_integration_tests" != xno])
257731e5d586SmrgAC_MSG_CHECKING([whether to build unit test cases])
257831e5d586SmrgAC_MSG_RESULT([$enable_integration_tests])
257931e5d586Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580b78bb896Smrg
258131e5d586Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258231e5d586Smrg# ----------------------------------------
258331e5d586Smrg# Minimum version: 1.13.0
258431e5d586Smrg#
258531e5d586Smrg# GLib is a library which provides advanced data structures and functions.
258631e5d586Smrg# This macro enables a module to test for the presence of Glib.
258731e5d586Smrg#
258831e5d586Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258931e5d586Smrg# Otherwise the value of $enable_unit_tests is blank.
259031e5d586Smrg#
259131e5d586Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259231e5d586Smrg# test support usually requires less dependencies and may be built and run under
259331e5d586Smrg# less stringent environments than integration tests.
2594b78bb896Smrg#
259531e5d586Smrg# Interface to module:
259631e5d586Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
259731e5d586Smrg# with_glib: used in configure.ac to know if GLib has been found
259831e5d586Smrg# --with-glib:	'yes' user instructs the module to use glib
259931e5d586Smrg#		'no' user instructs the module not to use glib
260031e5d586Smrg#
260131e5d586SmrgAC_DEFUN([XORG_WITH_GLIB],[
260231e5d586SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260331e5d586Smrgm4_define([_defopt], m4_default([$2], [auto]))
260431e5d586SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260531e5d586Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260631e5d586Smrg	[with_glib=$withval], [with_glib=]_defopt)
260731e5d586Smrgm4_undefine([_defopt])
2608b78bb896Smrg
260931e5d586Smrghave_glib=no
261031e5d586Smrg# Do not probe GLib if user explicitly disabled unit testing
261131e5d586Smrgif test "x$enable_unit_tests" != x"no"; then
261231e5d586Smrg  # Do not probe GLib if user explicitly disabled it
261331e5d586Smrg  if test "x$with_glib" != x"no"; then
261431e5d586Smrg    m4_ifval(
261531e5d586Smrg      [$1],
261631e5d586Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261731e5d586Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261831e5d586Smrg    )
26193538fbe3Smrg  fi
26203538fbe3Smrgfi
26213538fbe3Smrg
262231e5d586Smrg# Not having GLib when unit testing has been explicitly requested is an error
262331e5d586Smrgif test "x$enable_unit_tests" = x"yes"; then
262431e5d586Smrg  if test "x$have_glib" = x"no"; then
262531e5d586Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26263538fbe3Smrg  fi
26273538fbe3Smrgfi
26283538fbe3Smrg
262931e5d586Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
263031e5d586Smrgif test "x$enable_unit_tests" = x"no"; then
263131e5d586Smrg  if test "x$with_glib" = x"yes"; then
263231e5d586Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263331e5d586Smrg  fi
263431e5d586Smrgfi
26353538fbe3Smrg
263631e5d586Smrg# Not having GLib when it has been explicitly requested is an error
263731e5d586Smrgif test "x$with_glib" = x"yes"; then
263831e5d586Smrg  if test "x$have_glib" = x"no"; then
263931e5d586Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264031e5d586Smrg  fi
264131e5d586Smrgfi
26423538fbe3Smrg
264331e5d586SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264431e5d586Smrg]) # XORG_WITH_GLIB
26453538fbe3Smrg
264631e5d586Smrg# XORG_LD_WRAP([required|optional])
264731e5d586Smrg# ---------------------------------
264831e5d586Smrg# Minimum version: 1.13.0
264931e5d586Smrg#
265031e5d586Smrg# Check if linker supports -wrap, passed via compiler flags
265131e5d586Smrg#
265231e5d586Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265331e5d586Smrg# Otherwise the value of $enable_unit_tests is blank.
265431e5d586Smrg#
265531e5d586Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265631e5d586Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265731e5d586Smrg# available, an argument of "optional" allows use when some unit tests require
265831e5d586Smrg# ld -wrap and others do not.
265931e5d586Smrg#
266031e5d586SmrgAC_DEFUN([XORG_LD_WRAP],[
266131e5d586SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266231e5d586Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266331e5d586Smrg                      void __wrap_exit(int status) { return; }],
266431e5d586Smrg                     [exit(0);])])
266531e5d586Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
266631e5d586Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266731e5d586Smrg  if test "x$have_ld_wrap" = x"no"; then
266831e5d586Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266931e5d586Smrg  fi
267031e5d586Smrgfi
267131e5d586SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267231e5d586Smrg#
267331e5d586Smrg]) # XORG_LD_WRAP
26743538fbe3Smrg
267531e5d586Smrg# XORG_CHECK_LINKER_FLAGS
267631e5d586Smrg# -----------------------
267731e5d586Smrg# SYNOPSIS
267831e5d586Smrg#
267931e5d586Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268031e5d586Smrg#
268131e5d586Smrg# DESCRIPTION
268231e5d586Smrg#
268331e5d586Smrg#   Check whether the given linker FLAGS work with the current language's
268431e5d586Smrg#   linker, or whether they give an error.
268531e5d586Smrg#
268631e5d586Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268731e5d586Smrg#   success/failure.
268831e5d586Smrg#
268931e5d586Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
269031e5d586Smrg#
269131e5d586Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269231e5d586Smrg#
269331e5d586Smrg# LICENSE
269431e5d586Smrg#
269531e5d586Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269631e5d586Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269731e5d586Smrg#   Copyright (c) 2009 Matteo Frigo
269831e5d586Smrg#
269931e5d586Smrg#   This program is free software: you can redistribute it and/or modify it
270031e5d586Smrg#   under the terms of the GNU General Public License as published by the
270131e5d586Smrg#   Free Software Foundation, either version 3 of the License, or (at your
270231e5d586Smrg#   option) any later version.
270331e5d586Smrg#
270431e5d586Smrg#   This program is distributed in the hope that it will be useful, but
270531e5d586Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270631e5d586Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270731e5d586Smrg#   Public License for more details.
270831e5d586Smrg#
270931e5d586Smrg#   You should have received a copy of the GNU General Public License along
271031e5d586Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271131e5d586Smrg#
271231e5d586Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
271331e5d586Smrg#   gives unlimited permission to copy, distribute and modify the configure
271431e5d586Smrg#   scripts that are the output of Autoconf when processing the Macro. You
271531e5d586Smrg#   need not follow the terms of the GNU General Public License when using
271631e5d586Smrg#   or distributing such scripts, even though portions of the text of the
271731e5d586Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271831e5d586Smrg#   all other use of the material that constitutes the Autoconf Macro.
271931e5d586Smrg#
272031e5d586Smrg#   This special exception to the GPL applies to versions of the Autoconf
272131e5d586Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
272231e5d586Smrg#   modified version of the Autoconf Macro, you may extend this special
272331e5d586Smrg#   exception to the GPL to apply to your modified version as well.#
272431e5d586SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272531e5d586Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
272631e5d586Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272731e5d586SmrgAS_LITERAL_IF([$1],
272831e5d586Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272931e5d586Smrg      ax_save_FLAGS=$LDFLAGS
273031e5d586Smrg      LDFLAGS="$1"
273131e5d586Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273231e5d586Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273331e5d586Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273431e5d586Smrg      LDFLAGS=$ax_save_FLAGS])],
273531e5d586Smrg  [ax_save_FLAGS=$LDFLAGS
273631e5d586Smrg   LDFLAGS="$1"
273731e5d586Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273831e5d586Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273931e5d586Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274031e5d586Smrg   LDFLAGS=$ax_save_FLAGS])
274131e5d586Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274231e5d586SmrgAC_MSG_RESULT($xorg_check_linker_flags)
274331e5d586Smrgif test "x$xorg_check_linker_flags" = xyes; then
274431e5d586Smrg	m4_default([$2], :)
274531e5d586Smrgelse
274631e5d586Smrg	m4_default([$3], :)
274731e5d586Smrgfi
274831e5d586Smrg]) # XORG_CHECK_LINKER_FLAGS
27493538fbe3Smrg
275031e5d586Smrg# XORG_MEMORY_CHECK_FLAGS
275131e5d586Smrg# -----------------------
275231e5d586Smrg# Minimum version: 1.16.0
275331e5d586Smrg#
275431e5d586Smrg# This macro attempts to find appropriate memory checking functionality
275531e5d586Smrg# for various platforms which unit testing code may use to catch various
275631e5d586Smrg# forms of memory allocation and access errors in testing.
275731e5d586Smrg#
275831e5d586Smrg# Interface to module:
275931e5d586Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276031e5d586Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276131e5d586Smrg#
276231e5d586Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276331e5d586Smrg#
276431e5d586SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765492e1cfeSmrg
276631e5d586SmrgAC_REQUIRE([AC_CANONICAL_HOST])
276731e5d586SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276831e5d586Smrg           [Environment variables to enable memory checking in tests])
2769492e1cfeSmrg
277031e5d586Smrg# Check for different types of support on different platforms
277131e5d586Smrgcase $host_os in
277231e5d586Smrg    solaris*)
277331e5d586Smrg        AC_CHECK_LIB([umem], [umem_alloc],
277431e5d586Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277531e5d586Smrg        ;;
277631e5d586Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277731e5d586Smrg        # both directly and inverted, so should not be 0 or 255.
277831e5d586Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
277931e5d586Smrg        ;;
278031e5d586Smrg    darwin*)
278131e5d586Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278231e5d586Smrg        ;;
278331e5d586Smrg    *bsd*)
278431e5d586Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278531e5d586Smrg        ;;
278631e5d586Smrgesac
2787b78bb896Smrg
278831e5d586Smrg# User supplied flags override default flags
278931e5d586Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279031e5d586Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791492e1cfeSmrgfi
27929e0146f7Smrg
279331e5d586SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279431e5d586Smrg]) # XORG_WITH_LINT
27959e0146f7Smrg
279631e5d586Smrg# XORG_CHECK_MALLOC_ZERO
279731e5d586Smrg# ----------------------
279831e5d586Smrg# Minimum version: 1.0.0
2799b78bb896Smrg#
280031e5d586Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280131e5d586Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280231e5d586Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280331e5d586SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280431e5d586SmrgAC_ARG_ENABLE(malloc0returnsnull,
280531e5d586Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280631e5d586Smrg		       [malloc(0) returns NULL (default: auto)]),
280731e5d586Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280831e5d586Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
28099e0146f7Smrg
281031e5d586SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281131e5d586Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281231e5d586SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281331e5d586Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281431e5d586Smrg#include <stdlib.h>
281531e5d586Smrg],[
281631e5d586Smrg    char *m0, *r0, *c0, *p;
281731e5d586Smrg    m0 = malloc(0);
281831e5d586Smrg    p = malloc(10);
281931e5d586Smrg    r0 = realloc(p,0);
282031e5d586Smrg    c0 = calloc(0,10);
282131e5d586Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282231e5d586Smrg])],
282331e5d586Smrg		[xorg_cv_malloc0_returns_null=yes],
282431e5d586Smrg		[xorg_cv_malloc0_returns_null=no])])
282531e5d586SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28269e0146f7Smrgfi
282731e5d586SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
28289e0146f7Smrg
282931e5d586Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283031e5d586Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283131e5d586Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283231e5d586Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2833b78bb896Smrgelse
283431e5d586Smrg	MALLOC_ZERO_CFLAGS=""
283531e5d586Smrg	XMALLOC_ZERO_CFLAGS=""
283631e5d586Smrg	XTMALLOC_ZERO_CFLAGS=""
2837b78bb896Smrgfi
28389e0146f7Smrg
283931e5d586SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284031e5d586SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284131e5d586SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284231e5d586Smrg]) # XORG_CHECK_MALLOC_ZERO
28439e0146f7Smrg
284431e5d586Smrg# XORG_WITH_LINT()
284531e5d586Smrg# ----------------
284631e5d586Smrg# Minimum version: 1.1.0
28479e0146f7Smrg#
284831e5d586Smrg# This macro enables the use of a tool that flags some suspicious and
284931e5d586Smrg# non-portable constructs (likely to be bugs) in C language source code.
285031e5d586Smrg# It will attempt to locate the tool and use appropriate options.
285131e5d586Smrg# There are various lint type tools on different platforms.
28523538fbe3Smrg#
285331e5d586Smrg# Interface to module:
285431e5d586Smrg# LINT:		returns the path to the tool found on the platform
285531e5d586Smrg#		or the value set to LINT on the configure cmd line
285631e5d586Smrg#		also an Automake conditional
285731e5d586Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
285831e5d586Smrg#
285931e5d586Smrg# --with-lint:	'yes' user instructs the module to use lint
286031e5d586Smrg#		'no' user instructs the module not to use lint (default)
286131e5d586Smrg#
286231e5d586Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286331e5d586Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286431e5d586Smrg#
286531e5d586SmrgAC_DEFUN([XORG_WITH_LINT],[
28661afad795Smrg
286731e5d586SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286831e5d586SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286931e5d586SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287031e5d586Smrg		[Use a lint-style source code checker (default: disabled)])],
287131e5d586Smrg		[use_lint=$withval], [use_lint=no])
28723538fbe3Smrg
287331e5d586Smrg# Obtain platform specific info like program name and options
287431e5d586Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287531e5d586Smrgcase $host_os in
287631e5d586Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287731e5d586Smrg	lint_name=splint
287831e5d586Smrg	lint_options="-badflag"
287931e5d586Smrg	;;
288031e5d586Smrg  *freebsd* | *netbsd*)
288131e5d586Smrg	lint_name=lint
288231e5d586Smrg	lint_options="-u -b"
288331e5d586Smrg	;;
288431e5d586Smrg  *solaris*)
288531e5d586Smrg	lint_name=lint
288631e5d586Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288731e5d586Smrg	;;
288831e5d586Smrgesac
288931e5d586Smrg
289031e5d586Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289131e5d586Smrgif test "x$use_lint" = x"yes" ; then
289231e5d586Smrg   AC_PATH_PROG([LINT], [$lint_name])
289331e5d586Smrg   if test "x$LINT" = "x"; then
289431e5d586Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289531e5d586Smrg   fi
289631e5d586Smrgelif test "x$use_lint" = x"no" ; then
289731e5d586Smrg   if test "x$LINT" != "x"; then
289831e5d586Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289931e5d586Smrg   fi
2900b78bb896Smrgelse
290131e5d586Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
29023538fbe3Smrgfi
29033538fbe3Smrg
290431e5d586Smrg# User supplied flags override default flags
290531e5d586Smrgif test "x$LINT_FLAGS" != "x"; then
290631e5d586Smrg   lint_options=$LINT_FLAGS
290731e5d586Smrgfi
29083538fbe3Smrg
290931e5d586SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291031e5d586SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
29113538fbe3Smrg
291231e5d586Smrg]) # XORG_WITH_LINT
29133538fbe3Smrg
291431e5d586Smrg# XORG_LINT_LIBRARY(LIBNAME)
291531e5d586Smrg# --------------------------
291631e5d586Smrg# Minimum version: 1.1.0
29173538fbe3Smrg#
291831e5d586Smrg# Sets up flags for building lint libraries for checking programs that call
291931e5d586Smrg# functions in the library.
292031e5d586Smrg#
292131e5d586Smrg# Interface to module:
292231e5d586Smrg# LINTLIB		- Automake variable with the name of lint library file to make
292331e5d586Smrg# MAKE_LINT_LIB		- Automake conditional
292431e5d586Smrg#
292531e5d586Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292631e5d586Smrg#			  - 'no' user instructs the module not to create a lint library (default)
29273538fbe3Smrg
292831e5d586SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292931e5d586SmrgAC_REQUIRE([XORG_WITH_LINT])
293031e5d586SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293131e5d586Smrg	[Create lint library (default: disabled)])],
293231e5d586Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293331e5d586Smrg
293431e5d586Smrgif test "x$make_lint_lib" = x"yes" ; then
293531e5d586Smrg   LINTLIB=llib-l$1.ln
293631e5d586Smrg   if test "x$LINT" = "x"; then
293731e5d586Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293831e5d586Smrg   fi
293931e5d586Smrgelif test "x$make_lint_lib" != x"no" ; then
294031e5d586Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29413538fbe3Smrgfi
29423538fbe3Smrg
294331e5d586SmrgAC_SUBST(LINTLIB)
294431e5d586SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945b78bb896Smrg
294631e5d586Smrg]) # XORG_LINT_LIBRARY
2947b78bb896Smrg
294831e5d586Smrg# XORG_COMPILER_BRAND
2949b78bb896Smrg# -------------------
295031e5d586Smrg# Minimum version: 1.14.0
2951b78bb896Smrg#
295231e5d586Smrg# Checks for various brands of compilers and sets flags as appropriate:
295331e5d586Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295431e5d586Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295531e5d586Smrg#   clang compiler - sets CLANGCC to "yes"
295631e5d586Smrg#   Intel compiler - sets INTELCC to "yes"
295731e5d586Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295831e5d586Smrg#
295931e5d586SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296031e5d586SmrgAC_LANG_CASE(
296131e5d586Smrg	[C], [
296231e5d586Smrg		AC_REQUIRE([AC_PROG_CC_C99])
296331e5d586Smrg	],
296431e5d586Smrg	[C++], [
296531e5d586Smrg		AC_REQUIRE([AC_PROG_CXX])
296631e5d586Smrg	]
296731e5d586Smrg)
296831e5d586SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
296931e5d586SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297031e5d586SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297131e5d586Smrg]) # XORG_COMPILER_BRAND
29723538fbe3Smrg
297331e5d586Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2974b78bb896Smrg# ---------------
297531e5d586Smrg# Minimum version: 1.16.0
297631e5d586Smrg#
297731e5d586Smrg# Test if the compiler works when passed the given flag as a command line argument.
297831e5d586Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
297931e5d586Smrg# next flag in the list until there are no more options.
298031e5d586Smrg#
298131e5d586Smrg# Note that this does not guarantee that the compiler supports the flag as some
298231e5d586Smrg# compilers will simply ignore arguments that they do not understand, but we do
298331e5d586Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298431e5d586Smrg# -Werror=unused-command-line-argument
298531e5d586Smrg#
298631e5d586SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
298731e5d586Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298831e5d586Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29893538fbe3Smrg
299031e5d586SmrgAC_LANG_COMPILER_REQUIRE
29913538fbe3Smrg
299231e5d586SmrgAC_LANG_CASE(
299331e5d586Smrg	[C], [
299431e5d586Smrg		AC_REQUIRE([AC_PROG_CC_C99])
299531e5d586Smrg		define([PREFIX], [C])
299631e5d586Smrg		define([CACHE_PREFIX], [cc])
299731e5d586Smrg		define([COMPILER], [$CC])
299831e5d586Smrg	],
299931e5d586Smrg	[C++], [
300031e5d586Smrg		define([PREFIX], [CXX])
300131e5d586Smrg		define([CACHE_PREFIX], [cxx])
300231e5d586Smrg		define([COMPILER], [$CXX])
300331e5d586Smrg	]
300431e5d586Smrg)
300531e5d586Smrg
300631e5d586Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
300731e5d586Smrg
300831e5d586Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
300931e5d586Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301031e5d586Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301131e5d586Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
301231e5d586Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
301331e5d586Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
301431e5d586Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
301531e5d586Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
301631e5d586Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3017b78bb896Smrgfi
301831e5d586Smrg
301931e5d586Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302031e5d586Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302131e5d586Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
302231e5d586Smrg	fi
302331e5d586Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
302431e5d586Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
302531e5d586Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
302631e5d586Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302731e5d586Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
302831e5d586Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
302931e5d586Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303031e5d586Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303131e5d586Smrgfi
303231e5d586Smrg
303331e5d586Smrgfound="no"
303431e5d586Smrgm4_foreach([flag], m4_cdr($@), [
303531e5d586Smrg	if test $found = "no" ; then
303631e5d586Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
303731e5d586Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303831e5d586Smrg		fi
303931e5d586Smrg
304031e5d586Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304131e5d586Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
304231e5d586Smrg		fi
304331e5d586Smrg
304431e5d586Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
304531e5d586Smrg
304631e5d586Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
304731e5d586Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
304831e5d586Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
304931e5d586Smrg		AC_CACHE_VAL($cacheid,
305031e5d586Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305131e5d586Smrg					     [eval $cacheid=yes],
305231e5d586Smrg					     [eval $cacheid=no])])
305331e5d586Smrg
305431e5d586Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
305531e5d586Smrg
305631e5d586Smrg		eval supported=\$$cacheid
305731e5d586Smrg		AC_MSG_RESULT([$supported])
305831e5d586Smrg		if test "$supported" = "yes" ; then
305931e5d586Smrg			$1="$$1 ]flag["
306031e5d586Smrg			found="yes"
306131e5d586Smrg		fi
306231e5d586Smrg	fi
3063b78bb896Smrg])
306431e5d586Smrg]) # XORG_TESTSET_CFLAG
30651afad795Smrg
306631e5d586Smrg# XORG_COMPILER_FLAGS
306731e5d586Smrg# ---------------
306831e5d586Smrg# Minimum version: 1.16.0
30693538fbe3Smrg#
307031e5d586Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307131e5d586Smrg# arguments supported by the selected compiler which do NOT alter the generated
307231e5d586Smrg# code.  These arguments will cause the compiler to print various warnings
307331e5d586Smrg# during compilation AND turn a conservative set of warnings into errors.
307431e5d586Smrg#
307531e5d586Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
307631e5d586Smrg# future versions of util-macros as options are added to new compilers.
307731e5d586Smrg#
307831e5d586SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
307931e5d586SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30809e0146f7Smrg
308131e5d586SmrgAC_ARG_ENABLE(selective-werror,
308231e5d586Smrg              AS_HELP_STRING([--disable-selective-werror],
308331e5d586Smrg                             [Turn off selective compiler errors. (default: enabled)]),
308431e5d586Smrg              [SELECTIVE_WERROR=$enableval],
308531e5d586Smrg              [SELECTIVE_WERROR=yes])
308631e5d586Smrg
308731e5d586SmrgAC_LANG_CASE(
308831e5d586Smrg        [C], [
308931e5d586Smrg                define([PREFIX], [C])
309031e5d586Smrg        ],
309131e5d586Smrg        [C++], [
309231e5d586Smrg                define([PREFIX], [CXX])
309331e5d586Smrg        ]
309431e5d586Smrg)
309531e5d586Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
309631e5d586Smrgif test "x$SUNCC" = "xyes"; then
309731e5d586Smrg    [BASE_]PREFIX[FLAGS]="-v"
3098b78bb896Smrgelse
309931e5d586Smrg    [BASE_]PREFIX[FLAGS]=""
3100b78bb896Smrgfi
3101b78bb896Smrg
310231e5d586Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
310331e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
310431e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
310531e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
310631e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3107b78bb896Smrg
310831e5d586SmrgAC_LANG_CASE(
310931e5d586Smrg	[C], [
311031e5d586Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311131e5d586Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
311231e5d586Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
311331e5d586Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
311431e5d586Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
311531e5d586Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
311631e5d586Smrg	]
311731e5d586Smrg)
31189e0146f7Smrg
311931e5d586Smrg# This chunk adds additional warnings that could catch undesired effects.
312031e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312131e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
312231e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
312331e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
312431e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
312531e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
312631e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
31273538fbe3Smrg
312831e5d586Smrg# These are currently disabled because they are noisy.  They will be enabled
312931e5d586Smrg# in the future once the codebase is sufficiently modernized to silence
313031e5d586Smrg# them.  For now, I don't want them to drown out the other warnings.
313131e5d586Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
313231e5d586Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
313331e5d586Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
31341afad795Smrg
313531e5d586Smrg# Turn some warnings into errors, so we don't accidently get successful builds
313631e5d586Smrg# when there are problems that should be fixed.
31373538fbe3Smrg
313831e5d586Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
313931e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314031e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314131e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
314231e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
314331e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
314431e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
314531e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
314631e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
314731e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
314831e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
314931e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315031e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315131e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
315231e5d586Smrgelse
315331e5d586SmrgAC_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])
315431e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
315531e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
315631e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
315731e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
315831e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
315931e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316031e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316131e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
316231e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
316331e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
316431e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
316531e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
316631e5d586SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
316731e5d586Smrgfi
31683538fbe3Smrg
316931e5d586SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317031e5d586Smrg]) # XORG_COMPILER_FLAGS
31719e0146f7Smrg
317231e5d586Smrg# XORG_CWARNFLAGS
317331e5d586Smrg# ---------------
317431e5d586Smrg# Minimum version: 1.2.0
317531e5d586Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
31769e0146f7Smrg#
317731e5d586Smrg# Defines CWARNFLAGS to enable C compiler warnings.
31789e0146f7Smrg#
317931e5d586Smrg# This function is deprecated because it defines -fno-strict-aliasing
318031e5d586Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318131e5d586Smrg# is needed, then it should be added explicitly in the module when
318231e5d586Smrg# it is updated to use BASE_CFLAGS.
31839e0146f7Smrg#
318431e5d586SmrgAC_DEFUN([XORG_CWARNFLAGS], [
318531e5d586SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
318631e5d586SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
318731e5d586SmrgAC_LANG_CASE(
318831e5d586Smrg	[C], [
318931e5d586Smrg		CWARNFLAGS="$BASE_CFLAGS"
319031e5d586Smrg		if  test "x$GCC" = xyes ; then
319131e5d586Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
319231e5d586Smrg		fi
319331e5d586Smrg		AC_SUBST(CWARNFLAGS)
319431e5d586Smrg	]
319531e5d586Smrg)
319631e5d586Smrg]) # XORG_CWARNFLAGS
3197492e1cfeSmrg
319831e5d586Smrg# XORG_STRICT_OPTION
319931e5d586Smrg# -----------------------
320031e5d586Smrg# Minimum version: 1.3.0
320131e5d586Smrg#
320231e5d586Smrg# Add configure option to enable strict compilation flags, such as treating
320331e5d586Smrg# warnings as fatal errors.
320431e5d586Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
320531e5d586Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
320631e5d586Smrg#
320731e5d586Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
320831e5d586Smrg# when strict compilation is unconditionally desired.
320931e5d586SmrgAC_DEFUN([XORG_STRICT_OPTION], [
321031e5d586SmrgAC_REQUIRE([XORG_CWARNFLAGS])
321131e5d586SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3212b78bb896Smrg
321331e5d586SmrgAC_ARG_ENABLE(strict-compilation,
321431e5d586Smrg			  AS_HELP_STRING([--enable-strict-compilation],
321531e5d586Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
321631e5d586Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3217b78bb896Smrg
321831e5d586SmrgAC_LANG_CASE(
321931e5d586Smrg        [C], [
322031e5d586Smrg                define([PREFIX], [C])
322131e5d586Smrg        ],
322231e5d586Smrg        [C++], [
322331e5d586Smrg                define([PREFIX], [CXX])
322431e5d586Smrg        ]
322531e5d586Smrg)
3226b78bb896Smrg
322731e5d586Smrg[STRICT_]PREFIX[FLAGS]=""
322831e5d586SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
322931e5d586SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3230b78bb896Smrg
323131e5d586Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
323231e5d586Smrg# activate it with -Werror, so we add it here explicitly.
323331e5d586SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3234b78bb896Smrg
323531e5d586Smrgif test "x$STRICT_COMPILE" = "xyes"; then
323631e5d586Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
323731e5d586Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
323831e5d586Smrgfi
323931e5d586SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324031e5d586SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324131e5d586SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
324231e5d586Smrg]) # XORG_STRICT_OPTION
3243b78bb896Smrg
324431e5d586Smrg# XORG_DEFAULT_OPTIONS
324531e5d586Smrg# --------------------
324631e5d586Smrg# Minimum version: 1.3.0
324731e5d586Smrg#
324831e5d586Smrg# Defines default options for X.Org modules.
324931e5d586Smrg#
325031e5d586SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
325131e5d586SmrgAC_REQUIRE([AC_PROG_INSTALL])
325231e5d586SmrgXORG_COMPILER_FLAGS
325331e5d586SmrgXORG_CWARNFLAGS
325431e5d586SmrgXORG_STRICT_OPTION
325531e5d586SmrgXORG_RELEASE_VERSION
325631e5d586SmrgXORG_CHANGELOG
325731e5d586SmrgXORG_INSTALL
325831e5d586SmrgXORG_MANPAGE_SECTIONS
325931e5d586Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326031e5d586Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
326131e5d586Smrg]) # XORG_DEFAULT_OPTIONS
3262b78bb896Smrg
326331e5d586Smrg# XORG_INSTALL()
326431e5d586Smrg# ----------------
326531e5d586Smrg# Minimum version: 1.4.0
326631e5d586Smrg#
326731e5d586Smrg# Defines the variable INSTALL_CMD as the command to copy
326831e5d586Smrg# INSTALL from $prefix/share/util-macros.
326931e5d586Smrg#
327031e5d586SmrgAC_DEFUN([XORG_INSTALL], [
327131e5d586SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
327231e5d586Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
327331e5d586SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
327431e5d586Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
327531e5d586Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
327631e5d586Smrgtouch \$(top_srcdir)/INSTALL; \
327731e5d586Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
327831e5d586SmrgAC_SUBST([INSTALL_CMD])
327931e5d586Smrg]) # XORG_INSTALL
328031e5d586Smrgdnl Copyright 2005 Red Hat, Inc
328131e5d586Smrgdnl
328231e5d586Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
328331e5d586Smrgdnl documentation for any purpose is hereby granted without fee, provided that
328431e5d586Smrgdnl the above copyright notice appear in all copies and that both that
328531e5d586Smrgdnl copyright notice and this permission notice appear in supporting
328631e5d586Smrgdnl documentation.
328731e5d586Smrgdnl
328831e5d586Smrgdnl The above copyright notice and this permission notice shall be included
328931e5d586Smrgdnl in all copies or substantial portions of the Software.
329031e5d586Smrgdnl
329131e5d586Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
329231e5d586Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
329331e5d586Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
329431e5d586Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
329531e5d586Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
329631e5d586Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
329731e5d586Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
329831e5d586Smrgdnl
329931e5d586Smrgdnl Except as contained in this notice, the name of the copyright holders shall
330031e5d586Smrgdnl not be used in advertising or otherwise to promote the sale, use or
330131e5d586Smrgdnl other dealings in this Software without prior written authorization
330231e5d586Smrgdnl from the copyright holders.
330331e5d586Smrgdnl
3304b78bb896Smrg
330531e5d586Smrg# XORG_RELEASE_VERSION
330631e5d586Smrg# --------------------
330731e5d586Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3308b78bb896Smrg
330931e5d586SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
331031e5d586Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
331131e5d586Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
331231e5d586Smrg		[Major version of this package])
331331e5d586Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
331431e5d586Smrg	if test "x$PVM" = "x"; then
331531e5d586Smrg		PVM="0"
331631e5d586Smrg	fi
331731e5d586Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
331831e5d586Smrg		[$PVM],
331931e5d586Smrg		[Minor version of this package])
332031e5d586Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
332131e5d586Smrg	if test "x$PVP" = "x"; then
332231e5d586Smrg		PVP="0"
332331e5d586Smrg	fi
332431e5d586Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
332531e5d586Smrg		[$PVP],
332631e5d586Smrg		[Patch version of this package])
332731e5d586Smrg])
3328b78bb896Smrg
332931e5d586Smrg# XORG_CHANGELOG()
333031e5d586Smrg# ----------------
333131e5d586Smrg# Minimum version: 1.2.0
333231e5d586Smrg#
333331e5d586Smrg# Defines the variable CHANGELOG_CMD as the command to generate
333431e5d586Smrg# ChangeLog from git.
333531e5d586Smrg#
333631e5d586Smrg#
333731e5d586SmrgAC_DEFUN([XORG_CHANGELOG], [
333831e5d586SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
333931e5d586Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
334031e5d586Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
334131e5d586Smrgtouch \$(top_srcdir)/ChangeLog; \
334231e5d586Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
334331e5d586SmrgAC_SUBST([CHANGELOG_CMD])
334431e5d586Smrg]) # XORG_CHANGELOG
33459e0146f7Smrg
3346