174835918Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2ac92798bSmrg
374835918Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4a966c04fSmrg
5a966c04fSmrg# This file is free software; the Free Software Foundation
6a966c04fSmrg# gives unlimited permission to copy and/or distribute it,
7a966c04fSmrg# with or without modifications, as long as this notice is preserved.
8a966c04fSmrg
9a966c04fSmrg# This program is distributed in the hope that it will be useful,
10a966c04fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a966c04fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a966c04fSmrg# PARTICULAR PURPOSE.
13a966c04fSmrg
14ac92798bSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
152e2dd055Smrgm4_ifndef([AC_AUTOCONF_VERSION],
162e2dd055Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1774835918Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
1874835918Smrg[m4_warning([this file was generated for autoconf 2.71.
192e2dd055SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
202e2dd055SmrgIf you have problems, you may need to regenerate the build system entirely.
21ac92798bSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22a966c04fSmrg
2352dc082bSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2452dc082bSmrg#
2552dc082bSmrg# This file is free software; the Free Software Foundation
2652dc082bSmrg# gives unlimited permission to copy and/or distribute it,
2752dc082bSmrg# with or without modifications, as long as this notice is preserved.
2874835918Smrg
2952dc082bSmrg# AM_AUTOMAKE_VERSION(VERSION)
3052dc082bSmrg# ----------------------------
3152dc082bSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3252dc082bSmrg# generated from the m4 files accompanying Automake X.Y.
3352dc082bSmrg# (This private macro should not be called outside this file.)
3452dc082bSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3552dc082bSmrg[am__api_version='1.16'
3652dc082bSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3752dc082bSmrgdnl require some minimum version.  Point them to the right macro.
3852dc082bSmrgm4_if([$1], [1.16.5], [],
3952dc082bSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4052dc082bSmrg])
41a966c04fSmrg
4252dc082bSmrg# _AM_AUTOCONF_VERSION(VERSION)
4352dc082bSmrg# -----------------------------
4452dc082bSmrg# aclocal traces this macro to find the Autoconf version.
4552dc082bSmrg# This is a private macro too.  Using m4_define simplifies
4652dc082bSmrg# the logic in aclocal, which can simply ignore this definition.
4752dc082bSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48a966c04fSmrg
4952dc082bSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5052dc082bSmrg# -------------------------------
5152dc082bSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5252dc082bSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5352dc082bSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5452dc082bSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5552dc082bSmrgm4_ifndef([AC_AUTOCONF_VERSION],
5652dc082bSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5752dc082bSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58a966c04fSmrg
5952dc082bSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60a966c04fSmrg
6152dc082bSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6252dc082bSmrg#
6352dc082bSmrg# This file is free software; the Free Software Foundation
6452dc082bSmrg# gives unlimited permission to copy and/or distribute it,
6552dc082bSmrg# with or without modifications, as long as this notice is preserved.
669f00f3a1Smrg
6752dc082bSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6852dc082bSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6952dc082bSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7052dc082bSmrg#
7152dc082bSmrg# Of course, Automake must honor this variable whenever it calls a
7252dc082bSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7352dc082bSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7452dc082bSmrg# depending on how configure is run.  This is pretty annoying, since
7552dc082bSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7652dc082bSmrg# source directory, any form will work fine, but in subdirectories a
7752dc082bSmrg# relative path needs to be adjusted first.
7852dc082bSmrg#
7952dc082bSmrg# $ac_aux_dir/missing
8052dc082bSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8152dc082bSmrg# $top_srcdir/$ac_aux_dir/missing
8252dc082bSmrg#    fails if $ac_aux_dir is absolute,
8352dc082bSmrg#    fails when called from a subdirectory in a VPATH build with
8452dc082bSmrg#          a relative $ac_aux_dir
8552dc082bSmrg#
8652dc082bSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8752dc082bSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
8852dc082bSmrg# harmless because $srcdir is '.', but things will broke when you
8952dc082bSmrg# start a VPATH build or use an absolute $srcdir.
9052dc082bSmrg#
9152dc082bSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9252dc082bSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9352dc082bSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9452dc082bSmrg# and then we would define $MISSING as
9552dc082bSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9652dc082bSmrg# This will work as long as MISSING is not called from configure, because
9752dc082bSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9852dc082bSmrg# However there are other variables, like CC, which are often used in
9952dc082bSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10052dc082bSmrg#
10152dc082bSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10252dc082bSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10352dc082bSmrg# configured tree to be moved without reconfiguration.
104a966c04fSmrg
10552dc082bSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10652dc082bSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10752dc082bSmrg# Expand $ac_aux_dir to an absolute path.
10852dc082bSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10952dc082bSmrg])
110a966c04fSmrg
11152dc082bSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112a966c04fSmrg
11352dc082bSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11452dc082bSmrg#
11552dc082bSmrg# This file is free software; the Free Software Foundation
11652dc082bSmrg# gives unlimited permission to copy and/or distribute it,
11752dc082bSmrg# with or without modifications, as long as this notice is preserved.
118a966c04fSmrg
11952dc082bSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12052dc082bSmrg# -------------------------------------
12152dc082bSmrg# Define a conditional.
12252dc082bSmrgAC_DEFUN([AM_CONDITIONAL],
12352dc082bSmrg[AC_PREREQ([2.52])dnl
12452dc082bSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12552dc082bSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12652dc082bSmrgAC_SUBST([$1_TRUE])dnl
12752dc082bSmrgAC_SUBST([$1_FALSE])dnl
12852dc082bSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12952dc082bSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13052dc082bSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13152dc082bSmrgif $2; then
13252dc082bSmrg  $1_TRUE=
13352dc082bSmrg  $1_FALSE='#'
13452dc082bSmrgelse
13552dc082bSmrg  $1_TRUE='#'
13652dc082bSmrg  $1_FALSE=
13752dc082bSmrgfi
13852dc082bSmrgAC_CONFIG_COMMANDS_PRE(
13952dc082bSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14052dc082bSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14152dc082bSmrgUsually this means the macro was only invoked conditionally.]])
14252dc082bSmrgfi])])
143a966c04fSmrg
14452dc082bSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14552dc082bSmrg#
14652dc082bSmrg# This file is free software; the Free Software Foundation
14752dc082bSmrg# gives unlimited permission to copy and/or distribute it,
14852dc082bSmrg# with or without modifications, as long as this notice is preserved.
149a966c04fSmrg
150a966c04fSmrg
15152dc082bSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15252dc082bSmrg# written in clear, in which case automake, when reading aclocal.m4,
15352dc082bSmrg# will think it sees a *use*, and therefore will trigger all it's
15452dc082bSmrg# C support machinery.  Also note that it means that autoscan, seeing
15552dc082bSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156a966c04fSmrg
157a966c04fSmrg
15852dc082bSmrg# _AM_DEPENDENCIES(NAME)
15952dc082bSmrg# ----------------------
16052dc082bSmrg# See how the compiler implements dependency checking.
16152dc082bSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16252dc082bSmrg# We try a few techniques and use that to set a single cache variable.
16352dc082bSmrg#
16452dc082bSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16552dc082bSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16652dc082bSmrg# dependency, and given that the user is not expected to run this macro,
16752dc082bSmrg# just rely on AC_PROG_CC.
16852dc082bSmrgAC_DEFUN([_AM_DEPENDENCIES],
16952dc082bSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17052dc082bSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17152dc082bSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17252dc082bSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173a966c04fSmrg
17452dc082bSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17552dc082bSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17652dc082bSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17752dc082bSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17852dc082bSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17952dc082bSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18052dc082bSmrg                    [depcc="$$1"   am_compiler_list=])
181edce3322Smrg
18252dc082bSmrgAC_CACHE_CHECK([dependency style of $depcc],
18352dc082bSmrg               [am_cv_$1_dependencies_compiler_type],
18452dc082bSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18552dc082bSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
18652dc082bSmrg  # making bogus files that we don't know about and never remove.  For
18752dc082bSmrg  # instance it was reported that on HP-UX the gcc test will end up
18852dc082bSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18952dc082bSmrg  # in D".
19052dc082bSmrg  rm -rf conftest.dir
19152dc082bSmrg  mkdir conftest.dir
19252dc082bSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19352dc082bSmrg  # using a relative directory.
19452dc082bSmrg  cp "$am_depcomp" conftest.dir
19552dc082bSmrg  cd conftest.dir
19652dc082bSmrg  # We will build objects and dependencies in a subdirectory because
19752dc082bSmrg  # it helps to detect inapplicable dependency modes.  For instance
19852dc082bSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19952dc082bSmrg  # side effect of compilation, but ICC will put the dependencies in
20052dc082bSmrg  # the current directory while Tru64 will put them in the object
20152dc082bSmrg  # directory.
20252dc082bSmrg  mkdir sub
203edce3322Smrg
20452dc082bSmrg  am_cv_$1_dependencies_compiler_type=none
20552dc082bSmrg  if test "$am_compiler_list" = ""; then
20652dc082bSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20752dc082bSmrg  fi
20852dc082bSmrg  am__universal=false
20952dc082bSmrg  m4_case([$1], [CC],
21052dc082bSmrg    [case " $depcc " in #(
21152dc082bSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21252dc082bSmrg     esac],
21352dc082bSmrg    [CXX],
21452dc082bSmrg    [case " $depcc " in #(
21552dc082bSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21652dc082bSmrg     esac])
217edce3322Smrg
21852dc082bSmrg  for depmode in $am_compiler_list; do
21952dc082bSmrg    # Setup a source with many dependencies, because some compilers
22052dc082bSmrg    # like to wrap large dependency lists on column 80 (with \), and
22152dc082bSmrg    # we should not choose a depcomp mode which is confused by this.
22252dc082bSmrg    #
22352dc082bSmrg    # We need to recreate these files for each test, as the compiler may
22452dc082bSmrg    # overwrite some of them when testing with obscure command lines.
22552dc082bSmrg    # This happens at least with the AIX C compiler.
22652dc082bSmrg    : > sub/conftest.c
22752dc082bSmrg    for i in 1 2 3 4 5 6; do
22852dc082bSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22952dc082bSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23052dc082bSmrg      # Solaris 10 /bin/sh.
23152dc082bSmrg      echo '/* dummy */' > sub/conftst$i.h
23252dc082bSmrg    done
23352dc082bSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23452dc082bSmrg
23552dc082bSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23652dc082bSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23752dc082bSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23852dc082bSmrg    # versions had trouble with output in subdirs.
23952dc082bSmrg    am__obj=sub/conftest.${OBJEXT-o}
24052dc082bSmrg    am__minus_obj="-o $am__obj"
24152dc082bSmrg    case $depmode in
24252dc082bSmrg    gcc)
24352dc082bSmrg      # This depmode causes a compiler race in universal mode.
24452dc082bSmrg      test "$am__universal" = false || continue
24552dc082bSmrg      ;;
24652dc082bSmrg    nosideeffect)
24752dc082bSmrg      # After this tag, mechanisms are not by side-effect, so they'll
24852dc082bSmrg      # only be used when explicitly requested.
24952dc082bSmrg      if test "x$enable_dependency_tracking" = xyes; then
25052dc082bSmrg	continue
25152dc082bSmrg      else
25252dc082bSmrg	break
25352dc082bSmrg      fi
25452dc082bSmrg      ;;
25552dc082bSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25652dc082bSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
25752dc082bSmrg      # not run yet.  These depmodes are late enough in the game, and
25852dc082bSmrg      # so weak that their functioning should not be impacted.
25952dc082bSmrg      am__obj=conftest.${OBJEXT-o}
26052dc082bSmrg      am__minus_obj=
26152dc082bSmrg      ;;
26252dc082bSmrg    none) break ;;
26352dc082bSmrg    esac
26452dc082bSmrg    if depmode=$depmode \
26552dc082bSmrg       source=sub/conftest.c object=$am__obj \
26652dc082bSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26752dc082bSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26852dc082bSmrg         >/dev/null 2>conftest.err &&
26952dc082bSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27052dc082bSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27152dc082bSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27252dc082bSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27352dc082bSmrg      # icc doesn't choke on unknown options, it will just issue warnings
27452dc082bSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
27552dc082bSmrg      # that says an option was ignored or not supported.
27652dc082bSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27752dc082bSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27852dc082bSmrg      # The diagnosis changed in icc 8.0:
27952dc082bSmrg      #   icc: Command line remark: option '-MP' not supported
28052dc082bSmrg      if (grep 'ignoring option' conftest.err ||
28152dc082bSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28252dc082bSmrg        am_cv_$1_dependencies_compiler_type=$depmode
28352dc082bSmrg        break
28452dc082bSmrg      fi
28552dc082bSmrg    fi
28652dc082bSmrg  done
28752dc082bSmrg
28852dc082bSmrg  cd ..
28952dc082bSmrg  rm -rf conftest.dir
2901c235774Smrgelse
29152dc082bSmrg  am_cv_$1_dependencies_compiler_type=none
29252dc082bSmrgfi
29352dc082bSmrg])
29452dc082bSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29552dc082bSmrgAM_CONDITIONAL([am__fastdep$1], [
29652dc082bSmrg  test "x$enable_dependency_tracking" != xno \
29752dc082bSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29852dc082bSmrg])
299edce3322Smrg
300edce3322Smrg
30152dc082bSmrg# AM_SET_DEPDIR
30252dc082bSmrg# -------------
30352dc082bSmrg# Choose a directory name for dependency files.
30452dc082bSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30552dc082bSmrgAC_DEFUN([AM_SET_DEPDIR],
30652dc082bSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30752dc082bSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30852dc082bSmrg])
309edce3322Smrg
310edce3322Smrg
31152dc082bSmrg# AM_DEP_TRACK
31252dc082bSmrg# ------------
31352dc082bSmrgAC_DEFUN([AM_DEP_TRACK],
31452dc082bSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31552dc082bSmrgAS_HELP_STRING(
31652dc082bSmrg  [--enable-dependency-tracking],
31752dc082bSmrg  [do not reject slow dependency extractors])
31852dc082bSmrgAS_HELP_STRING(
31952dc082bSmrg  [--disable-dependency-tracking],
32052dc082bSmrg  [speeds up one-time build])])
32152dc082bSmrgif test "x$enable_dependency_tracking" != xno; then
32252dc082bSmrg  am_depcomp="$ac_aux_dir/depcomp"
32352dc082bSmrg  AMDEPBACKSLASH='\'
32452dc082bSmrg  am__nodep='_no'
32552dc082bSmrgfi
32652dc082bSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32752dc082bSmrgAC_SUBST([AMDEPBACKSLASH])dnl
32852dc082bSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32952dc082bSmrgAC_SUBST([am__nodep])dnl
33052dc082bSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33152dc082bSmrg])
332edce3322Smrg
33352dc082bSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334a966c04fSmrg
33552dc082bSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
33652dc082bSmrg#
33752dc082bSmrg# This file is free software; the Free Software Foundation
33852dc082bSmrg# gives unlimited permission to copy and/or distribute it,
33952dc082bSmrg# with or without modifications, as long as this notice is preserved.
340a966c04fSmrg
34152dc082bSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34252dc082bSmrg# ------------------------------
34352dc082bSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34452dc082bSmrg[{
34552dc082bSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
34652dc082bSmrg  # are listed without --file.  Let's play safe and only enable the eval
34752dc082bSmrg  # if we detect the quoting.
34852dc082bSmrg  # TODO: see whether this extra hack can be removed once we start
34952dc082bSmrg  # requiring Autoconf 2.70 or later.
35052dc082bSmrg  AS_CASE([$CONFIG_FILES],
35152dc082bSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
35252dc082bSmrg          [*], [set x $CONFIG_FILES])
35352dc082bSmrg  shift
35452dc082bSmrg  # Used to flag and report bootstrapping failures.
35552dc082bSmrg  am_rc=0
35652dc082bSmrg  for am_mf
35752dc082bSmrg  do
35852dc082bSmrg    # Strip MF so we end up with the name of the file.
35952dc082bSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36052dc082bSmrg    # Check whether this is an Automake generated Makefile which includes
36152dc082bSmrg    # dependency-tracking related rules and includes.
36252dc082bSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36352dc082bSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
36452dc082bSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36552dc082bSmrg      || continue
36652dc082bSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36752dc082bSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36852dc082bSmrg    AM_RUN_LOG([cd "$am_dirpart" \
36952dc082bSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37052dc082bSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37152dc082bSmrg  done
37252dc082bSmrg  if test $am_rc -ne 0; then
37352dc082bSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37452dc082bSmrg    for automatic dependency tracking.  If GNU make was not used, consider
37552dc082bSmrg    re-running the configure script with MAKE="gmake" (or whatever is
37652dc082bSmrg    necessary).  You can also try re-running configure with the
37752dc082bSmrg    '--disable-dependency-tracking' option to at least be able to build
37852dc082bSmrg    the package (albeit without support for automatic dependency tracking).])
37952dc082bSmrg  fi
38052dc082bSmrg  AS_UNSET([am_dirpart])
38152dc082bSmrg  AS_UNSET([am_filepart])
38252dc082bSmrg  AS_UNSET([am_mf])
38352dc082bSmrg  AS_UNSET([am_rc])
38452dc082bSmrg  rm -f conftest-deps.mk
38552dc082bSmrg}
38652dc082bSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387a966c04fSmrg
38874835918Smrg
38952dc082bSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39052dc082bSmrg# -----------------------------
39152dc082bSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
39252dc082bSmrg#
39352dc082bSmrg# This code is only required when automatic dependency tracking is enabled.
39452dc082bSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39552dc082bSmrg# order to bootstrap the dependency handling code.
39652dc082bSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39752dc082bSmrg[AC_CONFIG_COMMANDS([depfiles],
39852dc082bSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39952dc082bSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
40074835918Smrg
40152dc082bSmrg# Do all the work for Automake.                             -*- Autoconf -*-
402edce3322Smrg
40352dc082bSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4041c235774Smrg#
40552dc082bSmrg# This file is free software; the Free Software Foundation
40652dc082bSmrg# gives unlimited permission to copy and/or distribute it,
40752dc082bSmrg# with or without modifications, as long as this notice is preserved.
408a966c04fSmrg
40952dc082bSmrg# This macro actually does too much.  Some checks are only needed if
41052dc082bSmrg# your package does certain things.  But this isn't really a big deal.
4111c235774Smrg
41252dc082bSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41352dc082bSmrgm4_define([AC_PROG_CC],
41452dc082bSmrgm4_defn([AC_PROG_CC])
41552dc082bSmrg[_AM_PROG_CC_C_O
41652dc082bSmrg])
41752dc082bSmrg
41852dc082bSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41952dc082bSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42052dc082bSmrg# -----------------------------------------------
42152dc082bSmrg# The call with PACKAGE and VERSION arguments is the old style
42252dc082bSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42352dc082bSmrg# and VERSION should now be passed to AC_INIT and removed from
42452dc082bSmrg# the call to AM_INIT_AUTOMAKE.
42552dc082bSmrg# We support both call styles for the transition.  After
42652dc082bSmrg# the next Automake release, Autoconf can make the AC_INIT
42752dc082bSmrg# arguments mandatory, and then we can depend on a new Autoconf
42852dc082bSmrg# release and drop the old call support.
42952dc082bSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43052dc082bSmrg[AC_PREREQ([2.65])dnl
43152dc082bSmrgm4_ifdef([_$0_ALREADY_INIT],
43252dc082bSmrg  [m4_fatal([$0 expanded multiple times
43352dc082bSmrg]m4_defn([_$0_ALREADY_INIT]))],
43452dc082bSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43552dc082bSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43652dc082bSmrgdnl the ones we care about.
43752dc082bSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43852dc082bSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43952dc082bSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44052dc082bSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44152dc082bSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44252dc082bSmrg  # is not polluted with repeated "-I."
44352dc082bSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44452dc082bSmrg  # test to see if srcdir already configured
44552dc082bSmrg  if test -f $srcdir/config.status; then
44652dc082bSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44752dc082bSmrg  fi
448a966c04fSmrgfi
449a966c04fSmrg
45052dc082bSmrg# test whether we have cygpath
45152dc082bSmrgif test -z "$CYGPATH_W"; then
45252dc082bSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45352dc082bSmrg    CYGPATH_W='cygpath -w'
45452dc082bSmrg  else
45552dc082bSmrg    CYGPATH_W=echo
45652dc082bSmrg  fi
4579f00f3a1Smrgfi
45852dc082bSmrgAC_SUBST([CYGPATH_W])
459a966c04fSmrg
46052dc082bSmrg# Define the identity of the package.
46152dc082bSmrgdnl Distinguish between old-style and new-style calls.
46252dc082bSmrgm4_ifval([$2],
46352dc082bSmrg[AC_DIAGNOSE([obsolete],
46452dc082bSmrg             [$0: two- and three-arguments forms are deprecated.])
46552dc082bSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46652dc082bSmrg AC_SUBST([PACKAGE], [$1])dnl
46752dc082bSmrg AC_SUBST([VERSION], [$2])],
46852dc082bSmrg[_AM_SET_OPTIONS([$1])dnl
46952dc082bSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47052dc082bSmrgm4_if(
47152dc082bSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47252dc082bSmrg  [ok:ok],,
47352dc082bSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47452dc082bSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47552dc082bSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476a966c04fSmrg
47752dc082bSmrg_AM_IF_OPTION([no-define],,
47852dc082bSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47952dc082bSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480a966c04fSmrg
48152dc082bSmrg# Some tools Automake needs.
48252dc082bSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48352dc082bSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48452dc082bSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48552dc082bSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48652dc082bSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48752dc082bSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48852dc082bSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48952dc082bSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49052dc082bSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49152dc082bSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49252dc082bSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
49352dc082bSmrg# dies out for good.  For more background, see:
49452dc082bSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49552dc082bSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49652dc082bSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49752dc082bSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
49852dc082bSmrg# system "awk" is bad on some platforms.
49952dc082bSmrgAC_REQUIRE([AC_PROG_AWK])dnl
50052dc082bSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50152dc082bSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50252dc082bSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50352dc082bSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50452dc082bSmrg			     [_AM_PROG_TAR([v7])])])
50552dc082bSmrg_AM_IF_OPTION([no-dependencies],,
50652dc082bSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50752dc082bSmrg		  [_AM_DEPENDENCIES([CC])],
50852dc082bSmrg		  [m4_define([AC_PROG_CC],
50952dc082bSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51052dc082bSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51152dc082bSmrg		  [_AM_DEPENDENCIES([CXX])],
51252dc082bSmrg		  [m4_define([AC_PROG_CXX],
51352dc082bSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51452dc082bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51552dc082bSmrg		  [_AM_DEPENDENCIES([OBJC])],
51652dc082bSmrg		  [m4_define([AC_PROG_OBJC],
51752dc082bSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51852dc082bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51952dc082bSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
52052dc082bSmrg		  [m4_define([AC_PROG_OBJCXX],
52152dc082bSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52252dc082bSmrg])
52352dc082bSmrg# Variables for tags utilities; see am/tags.am
52452dc082bSmrgif test -z "$CTAGS"; then
52552dc082bSmrg  CTAGS=ctags
5261c235774Smrgfi
52752dc082bSmrgAC_SUBST([CTAGS])
52852dc082bSmrgif test -z "$ETAGS"; then
52952dc082bSmrg  ETAGS=etags
5301c235774Smrgfi
53152dc082bSmrgAC_SUBST([ETAGS])
53252dc082bSmrgif test -z "$CSCOPE"; then
53352dc082bSmrg  CSCOPE=cscope
5341c235774Smrgfi
53552dc082bSmrgAC_SUBST([CSCOPE])
53619569120Smrg
53752dc082bSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53852dc082bSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
53952dc082bSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54052dc082bSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54152dc082bSmrgAC_CONFIG_COMMANDS_PRE(dnl
54252dc082bSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54352dc082bSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544a966c04fSmrg
54552dc082bSmrg# POSIX will say in a future version that running "rm -f" with no argument
54652dc082bSmrg# is OK; and we want to be able to make that assumption in our Makefile
54752dc082bSmrg# recipes.  So use an aggressive probe to check that the usage we want is
54852dc082bSmrg# actually supported "in the wild" to an acceptable degree.
54952dc082bSmrg# See automake bug#10828.
55052dc082bSmrg# To make any issue more visible, cause the running configure to be aborted
55152dc082bSmrg# by default if the 'rm' program in use doesn't match our expectations; the
55252dc082bSmrg# user can still override this though.
55352dc082bSmrgif rm -f && rm -fr && rm -rf; then : OK; else
55452dc082bSmrg  cat >&2 <<'END'
55552dc082bSmrgOops!
5569f00f3a1Smrg
55752dc082bSmrgYour 'rm' program seems unable to run without file operands specified
55852dc082bSmrgon the command line, even when the '-f' option is present.  This is contrary
55952dc082bSmrgto the behaviour of most rm programs out there, and not conforming with
56052dc082bSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561a966c04fSmrg
56252dc082bSmrgPlease tell bug-automake@gnu.org about your system, including the value
56352dc082bSmrgof your $PATH and any error possibly output before this message.  This
56452dc082bSmrgcan help us improve future automake versions.
565a966c04fSmrg
56652dc082bSmrgEND
56752dc082bSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56852dc082bSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56952dc082bSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57052dc082bSmrg    echo >&2
57152dc082bSmrg  else
57252dc082bSmrg    cat >&2 <<'END'
57352dc082bSmrgAborting the configuration process, to ensure you take notice of the issue.
574ac92798bSmrg
57552dc082bSmrgYou can download and install GNU coreutils to get an 'rm' implementation
57652dc082bSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577a966c04fSmrg
57852dc082bSmrgIf you want to complete the configuration process using your problematic
57952dc082bSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58052dc082bSmrgto "yes", and re-run configure.
5819f00f3a1Smrg
58252dc082bSmrgEND
58352dc082bSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58452dc082bSmrg  fi
585a966c04fSmrgfi
58652dc082bSmrgdnl The trailing newline in this macro's definition is deliberate, for
58752dc082bSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58852dc082bSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58952dc082bSmrg])
590a966c04fSmrg
59152dc082bSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59252dc082bSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59352dc082bSmrgdnl mangled by Autoconf and run in a shell conditional statement.
59452dc082bSmrgm4_define([_AC_COMPILER_EXEEXT],
59552dc082bSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596a966c04fSmrg
59752dc082bSmrg# When config.status generates a header, we must update the stamp-h file.
59852dc082bSmrg# This file resides in the same directory as the config header
59952dc082bSmrg# that is generated.  The stamp files are numbered to have different names.
600ac92798bSmrg
60152dc082bSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60252dc082bSmrg# loop where config.status creates the headers, so we can generate
60352dc082bSmrg# our stamp files there.
60452dc082bSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60552dc082bSmrg[# Compute $1's index in $config_headers.
60652dc082bSmrg_am_arg=$1
60752dc082bSmrg_am_stamp_count=1
60852dc082bSmrgfor _am_header in $config_headers :; do
60952dc082bSmrg  case $_am_header in
61052dc082bSmrg    $_am_arg | $_am_arg:* )
61152dc082bSmrg      break ;;
61252dc082bSmrg    * )
61352dc082bSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61452dc082bSmrg  esac
61552dc082bSmrgdone
61652dc082bSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617ac92798bSmrg
61852dc082bSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61952dc082bSmrg#
62052dc082bSmrg# This file is free software; the Free Software Foundation
62152dc082bSmrg# gives unlimited permission to copy and/or distribute it,
62252dc082bSmrg# with or without modifications, as long as this notice is preserved.
623ac92798bSmrg
62452dc082bSmrg# AM_PROG_INSTALL_SH
62552dc082bSmrg# ------------------
62652dc082bSmrg# Define $install_sh.
62752dc082bSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62852dc082bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62952dc082bSmrgif test x"${install_sh+set}" != xset; then
63052dc082bSmrg  case $am_aux_dir in
63152dc082bSmrg  *\ * | *\	*)
63252dc082bSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63352dc082bSmrg  *)
63452dc082bSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63552dc082bSmrg  esac
6369f00f3a1Smrgfi
63752dc082bSmrgAC_SUBST([install_sh])])
638ac92798bSmrg
63952dc082bSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64052dc082bSmrg#
64152dc082bSmrg# This file is free software; the Free Software Foundation
64252dc082bSmrg# gives unlimited permission to copy and/or distribute it,
64352dc082bSmrg# with or without modifications, as long as this notice is preserved.
644a966c04fSmrg
64552dc082bSmrg# Check whether the underlying file-system supports filenames
64652dc082bSmrg# with a leading dot.  For instance MS-DOS doesn't.
64752dc082bSmrgAC_DEFUN([AM_SET_LEADING_DOT],
64852dc082bSmrg[rm -rf .tst 2>/dev/null
64952dc082bSmrgmkdir .tst 2>/dev/null
65052dc082bSmrgif test -d .tst; then
65152dc082bSmrg  am__leading_dot=.
6521c235774Smrgelse
65352dc082bSmrg  am__leading_dot=_
6541c235774Smrgfi
65552dc082bSmrgrmdir .tst 2>/dev/null
65652dc082bSmrgAC_SUBST([am__leading_dot])])
657a966c04fSmrg
65852dc082bSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659a966c04fSmrg
66052dc082bSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66152dc082bSmrg#
66252dc082bSmrg# This file is free software; the Free Software Foundation
66352dc082bSmrg# gives unlimited permission to copy and/or distribute it,
66452dc082bSmrg# with or without modifications, as long as this notice is preserved.
665a966c04fSmrg
66652dc082bSmrg# AM_MAKE_INCLUDE()
66752dc082bSmrg# -----------------
66852dc082bSmrg# Check whether make has an 'include' directive that can support all
66952dc082bSmrg# the idioms we need for our automatic dependency tracking code.
67052dc082bSmrgAC_DEFUN([AM_MAKE_INCLUDE],
67152dc082bSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
67252dc082bSmrgcat > confinc.mk << 'END'
67352dc082bSmrgam__doit:
67452dc082bSmrg	@echo this is the am__doit target >confinc.out
67552dc082bSmrg.PHONY: am__doit
67652dc082bSmrgEND
67752dc082bSmrgam__include="#"
67852dc082bSmrgam__quote=
67952dc082bSmrg# BSD make does it like this.
68052dc082bSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
68152dc082bSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
68252dc082bSmrgecho 'include confinc.mk # ignored' > confmf.GNU
68352dc082bSmrg_am_result=no
68452dc082bSmrgfor s in GNU BSD; do
68552dc082bSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
68652dc082bSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
68752dc082bSmrg      ['0:this is the am__doit target'],
68852dc082bSmrg      [AS_CASE([$s],
68952dc082bSmrg          [BSD], [am__include='.include' am__quote='"'],
69052dc082bSmrg          [am__include='include' am__quote=''])])
69152dc082bSmrg  if test "$am__include" != "#"; then
69252dc082bSmrg    _am_result="yes ($s style)"
69352dc082bSmrg    break
69452dc082bSmrg  fi
69552dc082bSmrgdone
69652dc082bSmrgrm -f confinc.* confmf.*
69752dc082bSmrgAC_MSG_RESULT([${_am_result}])
69852dc082bSmrgAC_SUBST([am__include])])
69952dc082bSmrgAC_SUBST([am__quote])])
700a966c04fSmrg
70152dc082bSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702a966c04fSmrg
70352dc082bSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
7041c235774Smrg#
70552dc082bSmrg# This file is free software; the Free Software Foundation
70652dc082bSmrg# gives unlimited permission to copy and/or distribute it,
70752dc082bSmrg# with or without modifications, as long as this notice is preserved.
708a966c04fSmrg
70952dc082bSmrg# AM_MISSING_PROG(NAME, PROGRAM)
71052dc082bSmrg# ------------------------------
71152dc082bSmrgAC_DEFUN([AM_MISSING_PROG],
71252dc082bSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71352dc082bSmrg$1=${$1-"${am_missing_run}$2"}
71452dc082bSmrgAC_SUBST($1)])
715a966c04fSmrg
71652dc082bSmrg# AM_MISSING_HAS_RUN
71752dc082bSmrg# ------------------
71852dc082bSmrg# Define MISSING if not defined so far and test if it is modern enough.
71952dc082bSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72052dc082bSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72152dc082bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72252dc082bSmrgAC_REQUIRE_AUX_FILE([missing])dnl
72352dc082bSmrgif test x"${MISSING+set}" != xset; then
72452dc082bSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
7251c235774Smrgfi
72652dc082bSmrg# Use eval to expand $SHELL
72752dc082bSmrgif eval "$MISSING --is-lightweight"; then
72852dc082bSmrg  am_missing_run="$MISSING "
72952dc082bSmrgelse
73052dc082bSmrg  am_missing_run=
73152dc082bSmrg  AC_MSG_WARN(['missing' script is too old or missing])
7321c235774Smrgfi
73352dc082bSmrg])
734ac92798bSmrg
73552dc082bSmrg# Helper functions for option handling.                     -*- Autoconf -*-
7361c235774Smrg
73752dc082bSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73852dc082bSmrg#
73952dc082bSmrg# This file is free software; the Free Software Foundation
74052dc082bSmrg# gives unlimited permission to copy and/or distribute it,
74152dc082bSmrg# with or without modifications, as long as this notice is preserved.
742edce3322Smrg
74352dc082bSmrg# _AM_MANGLE_OPTION(NAME)
74452dc082bSmrg# -----------------------
74552dc082bSmrgAC_DEFUN([_AM_MANGLE_OPTION],
74652dc082bSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7472e2dd055Smrg
74852dc082bSmrg# _AM_SET_OPTION(NAME)
74952dc082bSmrg# --------------------
75052dc082bSmrg# Set option NAME.  Presently that only means defining a flag for this option.
75152dc082bSmrgAC_DEFUN([_AM_SET_OPTION],
75252dc082bSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753a966c04fSmrg
75452dc082bSmrg# _AM_SET_OPTIONS(OPTIONS)
75552dc082bSmrg# ------------------------
75652dc082bSmrg# OPTIONS is a space-separated list of Automake options.
75752dc082bSmrgAC_DEFUN([_AM_SET_OPTIONS],
75852dc082bSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75952dc082bSmrg
76052dc082bSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76152dc082bSmrg# -------------------------------------------
76252dc082bSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76352dc082bSmrgAC_DEFUN([_AM_IF_OPTION],
76452dc082bSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76552dc082bSmrg
76652dc082bSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
7671c235774Smrg#
76852dc082bSmrg# This file is free software; the Free Software Foundation
76952dc082bSmrg# gives unlimited permission to copy and/or distribute it,
77052dc082bSmrg# with or without modifications, as long as this notice is preserved.
771ac92798bSmrg
77252dc082bSmrg# _AM_PROG_CC_C_O
77352dc082bSmrg# ---------------
77452dc082bSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77552dc082bSmrg# to automatically call this.
77652dc082bSmrgAC_DEFUN([_AM_PROG_CC_C_O],
77752dc082bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77852dc082bSmrgAC_REQUIRE_AUX_FILE([compile])dnl
77952dc082bSmrgAC_LANG_PUSH([C])dnl
78052dc082bSmrgAC_CACHE_CHECK(
78152dc082bSmrg  [whether $CC understands -c and -o together],
78252dc082bSmrg  [am_cv_prog_cc_c_o],
78352dc082bSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78452dc082bSmrg  # Make sure it works both with $CC and with simple cc.
78552dc082bSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78652dc082bSmrg  # compilers refuse to overwrite an existing .o file with -o,
78752dc082bSmrg  # though they will create one.
78852dc082bSmrg  am_cv_prog_cc_c_o=yes
78952dc082bSmrg  for am_i in 1 2; do
79052dc082bSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79152dc082bSmrg         && test -f conftest2.$ac_objext; then
79252dc082bSmrg      : OK
79352dc082bSmrg    else
79452dc082bSmrg      am_cv_prog_cc_c_o=no
79552dc082bSmrg      break
79652dc082bSmrg    fi
79752dc082bSmrg  done
79852dc082bSmrg  rm -f core conftest*
79952dc082bSmrg  unset am_i])
80052dc082bSmrgif test "$am_cv_prog_cc_c_o" != yes; then
80152dc082bSmrg   # Losing compiler, so override with the script.
80252dc082bSmrg   # FIXME: It is wrong to rewrite CC.
80352dc082bSmrg   # But if we don't then we get into trouble of one sort or another.
80452dc082bSmrg   # A longer-term fix would be to have automake use am__CC in this case,
80552dc082bSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80652dc082bSmrg   CC="$am_aux_dir/compile $CC"
8079f00f3a1Smrgfi
80852dc082bSmrgAC_LANG_POP([C])])
809ac92798bSmrg
81052dc082bSmrg# For backward compatibility.
81152dc082bSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812a966c04fSmrg
81352dc082bSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
8141c235774Smrg#
81552dc082bSmrg# This file is free software; the Free Software Foundation
81652dc082bSmrg# gives unlimited permission to copy and/or distribute it,
81752dc082bSmrg# with or without modifications, as long as this notice is preserved.
818edce3322Smrg
81952dc082bSmrg# AM_RUN_LOG(COMMAND)
82052dc082bSmrg# -------------------
82152dc082bSmrg# Run COMMAND, save the exit status in ac_status, and log it.
82252dc082bSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82352dc082bSmrgAC_DEFUN([AM_RUN_LOG],
82452dc082bSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82552dc082bSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82652dc082bSmrg   ac_status=$?
82752dc082bSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82852dc082bSmrg   (exit $ac_status); }])
829edce3322Smrg
83052dc082bSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83119569120Smrg
83252dc082bSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8331c235774Smrg#
83452dc082bSmrg# This file is free software; the Free Software Foundation
83552dc082bSmrg# gives unlimited permission to copy and/or distribute it,
83652dc082bSmrg# with or without modifications, as long as this notice is preserved.
837a966c04fSmrg
83852dc082bSmrg# AM_SANITY_CHECK
83952dc082bSmrg# ---------------
84052dc082bSmrgAC_DEFUN([AM_SANITY_CHECK],
84152dc082bSmrg[AC_MSG_CHECKING([whether build environment is sane])
84252dc082bSmrg# Reject unsafe characters in $srcdir or the absolute working directory
84352dc082bSmrg# name.  Accept space and tab only in the latter.
84452dc082bSmrgam_lf='
84552dc082bSmrg'
84652dc082bSmrgcase `pwd` in
84752dc082bSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84852dc082bSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84952dc082bSmrgesac
85052dc082bSmrgcase $srcdir in
85152dc082bSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85252dc082bSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85352dc082bSmrgesac
85419569120Smrg
85552dc082bSmrg# Do 'set' in a subshell so we don't clobber the current shell's
85652dc082bSmrg# arguments.  Must try -L first in case configure is actually a
85752dc082bSmrg# symlink; some systems play weird games with the mod time of symlinks
85852dc082bSmrg# (eg FreeBSD returns the mod time of the symlink's containing
85952dc082bSmrg# directory).
86052dc082bSmrgif (
86152dc082bSmrg   am_has_slept=no
86252dc082bSmrg   for am_try in 1 2; do
86352dc082bSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86452dc082bSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86552dc082bSmrg     if test "$[*]" = "X"; then
86652dc082bSmrg	# -L didn't work.
86752dc082bSmrg	set X `ls -t "$srcdir/configure" conftest.file`
86852dc082bSmrg     fi
86952dc082bSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87052dc082bSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87119569120Smrg
87252dc082bSmrg	# If neither matched, then we have a broken ls.  This can happen
87352dc082bSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87452dc082bSmrg	# broken ls alias from the environment.  This has actually
87552dc082bSmrg	# happened.  Such a system could not be considered "sane".
87652dc082bSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87752dc082bSmrg  alias in your environment])
87852dc082bSmrg     fi
87952dc082bSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88052dc082bSmrg       break
88152dc082bSmrg     fi
88252dc082bSmrg     # Just in case.
88352dc082bSmrg     sleep 1
88452dc082bSmrg     am_has_slept=yes
88552dc082bSmrg   done
88652dc082bSmrg   test "$[2]" = conftest.file
88752dc082bSmrg   )
88852dc082bSmrgthen
88952dc082bSmrg   # Ok.
89052dc082bSmrg   :
8911c235774Smrgelse
89252dc082bSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
89352dc082bSmrgCheck your system clock])
8941c235774Smrgfi
89552dc082bSmrgAC_MSG_RESULT([yes])
89652dc082bSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89752dc082bSmrg# generated files are strictly newer.
89852dc082bSmrgam_sleep_pid=
89952dc082bSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90052dc082bSmrg  ( sleep 1 ) &
90152dc082bSmrg  am_sleep_pid=$!
90252dc082bSmrgfi
90352dc082bSmrgAC_CONFIG_COMMANDS_PRE(
90452dc082bSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90552dc082bSmrg   if test -n "$am_sleep_pid"; then
90652dc082bSmrg     # Hide warnings about reused PIDs.
90752dc082bSmrg     wait $am_sleep_pid 2>/dev/null
90852dc082bSmrg   fi
90952dc082bSmrg   AC_MSG_RESULT([done])])
91052dc082bSmrgrm -f conftest.file
91152dc082bSmrg])
91219569120Smrg
91352dc082bSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9141c235774Smrg#
91552dc082bSmrg# This file is free software; the Free Software Foundation
91652dc082bSmrg# gives unlimited permission to copy and/or distribute it,
91752dc082bSmrg# with or without modifications, as long as this notice is preserved.
91819569120Smrg
91952dc082bSmrg# AM_SILENT_RULES([DEFAULT])
92052dc082bSmrg# --------------------------
92152dc082bSmrg# Enable less verbose build rules; with the default set to DEFAULT
92252dc082bSmrg# ("yes" being less verbose, "no" or empty being verbose).
92352dc082bSmrgAC_DEFUN([AM_SILENT_RULES],
92452dc082bSmrg[AC_ARG_ENABLE([silent-rules], [dnl
92552dc082bSmrgAS_HELP_STRING(
92652dc082bSmrg  [--enable-silent-rules],
92752dc082bSmrg  [less verbose build output (undo: "make V=1")])
92852dc082bSmrgAS_HELP_STRING(
92952dc082bSmrg  [--disable-silent-rules],
93052dc082bSmrg  [verbose build output (undo: "make V=0")])dnl
93152dc082bSmrg])
93252dc082bSmrgcase $enable_silent_rules in @%:@ (((
93352dc082bSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
93452dc082bSmrg   no) AM_DEFAULT_VERBOSITY=1;;
93552dc082bSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93652dc082bSmrgesac
93752dc082bSmrgdnl
93852dc082bSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93952dc082bSmrgdnl do not support nested variable expansions.
94052dc082bSmrgdnl See automake bug#9928 and bug#10237.
94152dc082bSmrgam_make=${MAKE-make}
94252dc082bSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94352dc082bSmrg   [am_cv_make_support_nested_variables],
94452dc082bSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94552dc082bSmrgBAR0=false
94652dc082bSmrgBAR1=true
94752dc082bSmrgV=1
94852dc082bSmrgam__doit:
94952dc082bSmrg	@$(TRUE)
95052dc082bSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95152dc082bSmrg  am_cv_make_support_nested_variables=yes
9521c235774Smrgelse
95352dc082bSmrg  am_cv_make_support_nested_variables=no
9541c235774Smrgfi])
95552dc082bSmrgif test $am_cv_make_support_nested_variables = yes; then
95652dc082bSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95752dc082bSmrg  AM_V='$(V)'
95852dc082bSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95952dc082bSmrgelse
96052dc082bSmrg  AM_V=$AM_DEFAULT_VERBOSITY
96152dc082bSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9621c235774Smrgfi
96352dc082bSmrgAC_SUBST([AM_V])dnl
96452dc082bSmrgAM_SUBST_NOTMAKE([AM_V])dnl
96552dc082bSmrgAC_SUBST([AM_DEFAULT_V])dnl
96652dc082bSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96752dc082bSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96852dc082bSmrgAM_BACKSLASH='\'
96952dc082bSmrgAC_SUBST([AM_BACKSLASH])dnl
97052dc082bSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97152dc082bSmrg])
97219569120Smrg
97352dc082bSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
97452dc082bSmrg#
97552dc082bSmrg# This file is free software; the Free Software Foundation
97652dc082bSmrg# gives unlimited permission to copy and/or distribute it,
97752dc082bSmrg# with or without modifications, as long as this notice is preserved.
97819569120Smrg
97952dc082bSmrg# AM_PROG_INSTALL_STRIP
98052dc082bSmrg# ---------------------
98152dc082bSmrg# One issue with vendor 'install' (even GNU) is that you can't
98252dc082bSmrg# specify the program used to strip binaries.  This is especially
98352dc082bSmrg# annoying in cross-compiling environments, where the build's strip
98452dc082bSmrg# is unlikely to handle the host's binaries.
98552dc082bSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98652dc082bSmrg# always use install-sh in "make install-strip", and initialize
98752dc082bSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
98852dc082bSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98952dc082bSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99052dc082bSmrg# Installed binaries are usually stripped using 'strip' when the user
99152dc082bSmrg# run "make install-strip".  However 'strip' might not be the right
99252dc082bSmrg# tool to use in cross-compilation environments, therefore Automake
99352dc082bSmrg# will honor the 'STRIP' environment variable to overrule this program.
99452dc082bSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99552dc082bSmrgif test "$cross_compiling" != no; then
99652dc082bSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
99752dc082bSmrgfi
99852dc082bSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99952dc082bSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100052dc082bSmrg
100152dc082bSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
10021c235774Smrg#
100352dc082bSmrg# This file is free software; the Free Software Foundation
100452dc082bSmrg# gives unlimited permission to copy and/or distribute it,
100552dc082bSmrg# with or without modifications, as long as this notice is preserved.
100619569120Smrg
100752dc082bSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
100852dc082bSmrg# ---------------------------
100952dc082bSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101052dc082bSmrg# This macro is traced by Automake.
101152dc082bSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101219569120Smrg
101352dc082bSmrg# AM_SUBST_NOTMAKE(VARIABLE)
101452dc082bSmrg# --------------------------
101552dc082bSmrg# Public sister of _AM_SUBST_NOTMAKE.
101652dc082bSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101719569120Smrg
101852dc082bSmrg# Check how to create a tarball.                            -*- Autoconf -*-
101919569120Smrg
102052dc082bSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
10211c235774Smrg#
102252dc082bSmrg# This file is free software; the Free Software Foundation
102352dc082bSmrg# gives unlimited permission to copy and/or distribute it,
102452dc082bSmrg# with or without modifications, as long as this notice is preserved.
102552dc082bSmrg
102652dc082bSmrg# _AM_PROG_TAR(FORMAT)
102752dc082bSmrg# --------------------
102852dc082bSmrg# Check how to create a tarball in format FORMAT.
102952dc082bSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10301c235774Smrg#
103152dc082bSmrg# Substitute a variable $(am__tar) that is a command
103252dc082bSmrg# writing to stdout a FORMAT-tarball containing the directory
103352dc082bSmrg# $tardir.
103452dc082bSmrg#     tardir=directory && $(am__tar) > result.tar
10351c235774Smrg#
103652dc082bSmrg# Substitute a variable $(am__untar) that extract such
103752dc082bSmrg# a tarball read from stdin.
103852dc082bSmrg#     $(am__untar) < result.tar
10391c235774Smrg#
104052dc082bSmrgAC_DEFUN([_AM_PROG_TAR],
104152dc082bSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104252dc082bSmrg# in the wild :-(  We should find a proper way to deprecate it ...
104352dc082bSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
104419569120Smrg
104552dc082bSmrg# We'll loop over all known methods to create a tar archive until one works.
104652dc082bSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047a966c04fSmrg
104852dc082bSmrgm4_if([$1], [v7],
104952dc082bSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050a966c04fSmrg
105152dc082bSmrg  [m4_case([$1],
105252dc082bSmrg    [ustar],
105352dc082bSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105452dc082bSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105552dc082bSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105652dc082bSmrg      # and bug#13588).
105752dc082bSmrg      am_max_uid=2097151 # 2^21 - 1
105852dc082bSmrg      am_max_gid=$am_max_uid
105952dc082bSmrg      # The $UID and $GID variables are not portable, so we need to resort
106052dc082bSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106152dc082bSmrg      # below are definitely unexpected, so allow the users to see them
106252dc082bSmrg      # (that is, avoid stderr redirection).
106352dc082bSmrg      am_uid=`id -u || echo unknown`
106452dc082bSmrg      am_gid=`id -g || echo unknown`
106552dc082bSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106652dc082bSmrg      if test $am_uid -le $am_max_uid; then
106752dc082bSmrg         AC_MSG_RESULT([yes])
106852dc082bSmrg      else
106952dc082bSmrg         AC_MSG_RESULT([no])
107052dc082bSmrg         _am_tools=none
107152dc082bSmrg      fi
107252dc082bSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107352dc082bSmrg      if test $am_gid -le $am_max_gid; then
107452dc082bSmrg         AC_MSG_RESULT([yes])
107552dc082bSmrg      else
107652dc082bSmrg        AC_MSG_RESULT([no])
107752dc082bSmrg        _am_tools=none
107852dc082bSmrg      fi],
10796e7d3316Smrg
108052dc082bSmrg  [pax],
108152dc082bSmrg    [],
10826e7d3316Smrg
108352dc082bSmrg  [m4_fatal([Unknown tar format])])
10846e7d3316Smrg
108552dc082bSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108652dc082bSmrg
108752dc082bSmrg  # Go ahead even if we have the value already cached.  We do so because we
108852dc082bSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108952dc082bSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
109052dc082bSmrg
109152dc082bSmrg  for _am_tool in $_am_tools; do
109252dc082bSmrg    case $_am_tool in
109352dc082bSmrg    gnutar)
109452dc082bSmrg      for _am_tar in tar gnutar gtar; do
109552dc082bSmrg        AM_RUN_LOG([$_am_tar --version]) && break
109652dc082bSmrg      done
109752dc082bSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109852dc082bSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109952dc082bSmrg      am__untar="$_am_tar -xf -"
110052dc082bSmrg      ;;
110152dc082bSmrg    plaintar)
110252dc082bSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110352dc082bSmrg      # ustar tarball either.
110452dc082bSmrg      (tar --version) >/dev/null 2>&1 && continue
110552dc082bSmrg      am__tar='tar chf - "$$tardir"'
110652dc082bSmrg      am__tar_='tar chf - "$tardir"'
110752dc082bSmrg      am__untar='tar xf -'
110852dc082bSmrg      ;;
110952dc082bSmrg    pax)
111052dc082bSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
111152dc082bSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
111252dc082bSmrg      am__untar='pax -r'
111352dc082bSmrg      ;;
111452dc082bSmrg    cpio)
111552dc082bSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111652dc082bSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111752dc082bSmrg      am__untar='cpio -i -H $1 -d'
111852dc082bSmrg      ;;
111952dc082bSmrg    none)
112052dc082bSmrg      am__tar=false
112152dc082bSmrg      am__tar_=false
112252dc082bSmrg      am__untar=false
112352dc082bSmrg      ;;
112452dc082bSmrg    esac
112552dc082bSmrg
112652dc082bSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
112752dc082bSmrg    # and am__untar set.
112852dc082bSmrg    test -n "${am_cv_prog_tar_$1}" && break
112952dc082bSmrg
113052dc082bSmrg    # tar/untar a dummy directory, and stop if the command works.
113152dc082bSmrg    rm -rf conftest.dir
113252dc082bSmrg    mkdir conftest.dir
113352dc082bSmrg    echo GrepMe > conftest.dir/file
113452dc082bSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113552dc082bSmrg    rm -rf conftest.dir
113652dc082bSmrg    if test -s conftest.tar; then
113752dc082bSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
113852dc082bSmrg      AM_RUN_LOG([cat conftest.dir/file])
113952dc082bSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114052dc082bSmrg    fi
114152dc082bSmrg  done
114252dc082bSmrg  rm -rf conftest.dir
114352dc082bSmrg
114452dc082bSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114552dc082bSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
114652dc082bSmrg
114752dc082bSmrgAC_SUBST([am__tar])
114852dc082bSmrgAC_SUBST([am__untar])
114952dc082bSmrg]) # _AM_PROG_TAR
115052dc082bSmrg
115152dc082bSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
115252dc082bSmrgdnl serial 11 (pkg-config-0.29)
115352dc082bSmrgdnl
115452dc082bSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115552dc082bSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
115652dc082bSmrgdnl
115752dc082bSmrgdnl This program is free software; you can redistribute it and/or modify
115852dc082bSmrgdnl it under the terms of the GNU General Public License as published by
115952dc082bSmrgdnl the Free Software Foundation; either version 2 of the License, or
116052dc082bSmrgdnl (at your option) any later version.
116152dc082bSmrgdnl
116252dc082bSmrgdnl This program is distributed in the hope that it will be useful, but
116352dc082bSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
116452dc082bSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
116552dc082bSmrgdnl General Public License for more details.
116652dc082bSmrgdnl
116752dc082bSmrgdnl You should have received a copy of the GNU General Public License
116852dc082bSmrgdnl along with this program; if not, write to the Free Software
116952dc082bSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
117052dc082bSmrgdnl 02111-1307, USA.
117152dc082bSmrgdnl
117252dc082bSmrgdnl As a special exception to the GNU General Public License, if you
117352dc082bSmrgdnl distribute this file as part of a program that contains a
117452dc082bSmrgdnl configuration script generated by Autoconf, you may include it under
117552dc082bSmrgdnl the same distribution terms that you use for the rest of that
117652dc082bSmrgdnl program.
117752dc082bSmrg
117852dc082bSmrgdnl PKG_PREREQ(MIN-VERSION)
117952dc082bSmrgdnl -----------------------
118052dc082bSmrgdnl Since: 0.29
118152dc082bSmrgdnl
118252dc082bSmrgdnl Verify that the version of the pkg-config macros are at least
118352dc082bSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
118452dc082bSmrgdnl installed version of pkg-config, this checks the developer's version
118552dc082bSmrgdnl of pkg.m4 when generating configure.
118652dc082bSmrgdnl
118752dc082bSmrgdnl To ensure that this macro is defined, also add:
118852dc082bSmrgdnl m4_ifndef([PKG_PREREQ],
118952dc082bSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
119052dc082bSmrgdnl
119152dc082bSmrgdnl See the "Since" comment for each macro you use to see what version
119252dc082bSmrgdnl of the macros you require.
119352dc082bSmrgm4_defun([PKG_PREREQ],
119452dc082bSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
119552dc082bSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
119652dc082bSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
119752dc082bSmrg])dnl PKG_PREREQ
119852dc082bSmrg
119952dc082bSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
120052dc082bSmrgdnl ----------------------------------
120152dc082bSmrgdnl Since: 0.16
120252dc082bSmrgdnl
120352dc082bSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
120452dc082bSmrgdnl first found in the path. Checks that the version of pkg-config found
120552dc082bSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
120652dc082bSmrgdnl used since that's the first version where most current features of
120752dc082bSmrgdnl pkg-config existed.
120852dc082bSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120952dc082bSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
121052dc082bSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
121152dc082bSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
121252dc082bSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
121352dc082bSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
121452dc082bSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
121552dc082bSmrg
121652dc082bSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121752dc082bSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12181c235774Smrgfi
121952dc082bSmrgif test -n "$PKG_CONFIG"; then
122052dc082bSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
122152dc082bSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122252dc082bSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122352dc082bSmrg		AC_MSG_RESULT([yes])
122452dc082bSmrg	else
122552dc082bSmrg		AC_MSG_RESULT([no])
122652dc082bSmrg		PKG_CONFIG=""
122752dc082bSmrg	fi
122852dc082bSmrgfi[]dnl
122952dc082bSmrg])dnl PKG_PROG_PKG_CONFIG
12306e7d3316Smrg
123152dc082bSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
123252dc082bSmrgdnl -------------------------------------------------------------------
123352dc082bSmrgdnl Since: 0.18
123452dc082bSmrgdnl
123552dc082bSmrgdnl Check to see whether a particular set of modules exists. Similar to
123652dc082bSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
123752dc082bSmrgdnl
123852dc082bSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123952dc082bSmrgdnl only at the first occurence in configure.ac, so if the first place
124052dc082bSmrgdnl it's called might be skipped (such as if it is within an "if", you
124152dc082bSmrgdnl have to call PKG_CHECK_EXISTS manually
124252dc082bSmrgAC_DEFUN([PKG_CHECK_EXISTS],
124352dc082bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124452dc082bSmrgif test -n "$PKG_CONFIG" && \
124552dc082bSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
124652dc082bSmrg  m4_default([$2], [:])
124752dc082bSmrgm4_ifvaln([$3], [else
124852dc082bSmrg  $3])dnl
124952dc082bSmrgfi])
12506e7d3316Smrg
125152dc082bSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
125252dc082bSmrgdnl ---------------------------------------------
125352dc082bSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
125452dc082bSmrgdnl pkg_failed based on the result.
125552dc082bSmrgm4_define([_PKG_CONFIG],
125652dc082bSmrg[if test -n "$$1"; then
125752dc082bSmrg    pkg_cv_[]$1="$$1"
125852dc082bSmrg elif test -n "$PKG_CONFIG"; then
125952dc082bSmrg    PKG_CHECK_EXISTS([$3],
126052dc082bSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
126152dc082bSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
126252dc082bSmrg		     [pkg_failed=yes])
126352dc082bSmrg else
126452dc082bSmrg    pkg_failed=untried
126552dc082bSmrgfi[]dnl
126652dc082bSmrg])dnl _PKG_CONFIG
126719569120Smrg
126852dc082bSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
126952dc082bSmrgdnl ---------------------------
127052dc082bSmrgdnl Internal check to see if pkg-config supports short errors.
127152dc082bSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127252dc082bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127352dc082bSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127452dc082bSmrg        _pkg_short_errors_supported=yes
127552dc082bSmrgelse
127652dc082bSmrg        _pkg_short_errors_supported=no
127752dc082bSmrgfi[]dnl
127852dc082bSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
127919569120Smrg
128019569120Smrg
128152dc082bSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
128252dc082bSmrgdnl   [ACTION-IF-NOT-FOUND])
128352dc082bSmrgdnl --------------------------------------------------------------
128452dc082bSmrgdnl Since: 0.4.0
128552dc082bSmrgdnl
128652dc082bSmrgdnl Note that if there is a possibility the first call to
128752dc082bSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
128852dc082bSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128952dc082bSmrgAC_DEFUN([PKG_CHECK_MODULES],
129052dc082bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129152dc082bSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129252dc082bSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
129352dc082bSmrg
129452dc082bSmrgpkg_failed=no
129552dc082bSmrgAC_MSG_CHECKING([for $1])
129619569120Smrg
129752dc082bSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129852dc082bSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
129919569120Smrg
130052dc082bSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130152dc082bSmrgand $1[]_LIBS to avoid the need to call pkg-config.
130252dc082bSmrgSee the pkg-config man page for more details.])
130319569120Smrg
130452dc082bSmrgif test $pkg_failed = yes; then
130552dc082bSmrg   	AC_MSG_RESULT([no])
130652dc082bSmrg        _PKG_SHORT_ERRORS_SUPPORTED
130752dc082bSmrg        if test $_pkg_short_errors_supported = yes; then
130852dc082bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130952dc082bSmrg        else 
131052dc082bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131152dc082bSmrg        fi
131252dc082bSmrg	# Put the nasty error message in config.log where it belongs
131352dc082bSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13146e7d3316Smrg
131552dc082bSmrg	m4_default([$4], [AC_MSG_ERROR(
131652dc082bSmrg[Package requirements ($2) were not met:
13176e7d3316Smrg
131852dc082bSmrg$$1_PKG_ERRORS
13196e7d3316Smrg
132052dc082bSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132152dc082bSmrginstalled software in a non-standard prefix.
13226e7d3316Smrg
132352dc082bSmrg_PKG_TEXT])[]dnl
132452dc082bSmrg        ])
132552dc082bSmrgelif test $pkg_failed = untried; then
132652dc082bSmrg     	AC_MSG_RESULT([no])
132752dc082bSmrg	m4_default([$4], [AC_MSG_FAILURE(
132852dc082bSmrg[The pkg-config script could not be found or is too old.  Make sure it
132952dc082bSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
133052dc082bSmrgpath to pkg-config.
13319f00f3a1Smrg
133252dc082bSmrg_PKG_TEXT
133352dc082bSmrg
133452dc082bSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
133552dc082bSmrg        ])
13369f00f3a1Smrgelse
133752dc082bSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133852dc082bSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133952dc082bSmrg        AC_MSG_RESULT([yes])
134052dc082bSmrg	$3
134152dc082bSmrgfi[]dnl
134252dc082bSmrg])dnl PKG_CHECK_MODULES
134352dc082bSmrg
134452dc082bSmrg
134552dc082bSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
134652dc082bSmrgdnl   [ACTION-IF-NOT-FOUND])
134752dc082bSmrgdnl ---------------------------------------------------------------------
134852dc082bSmrgdnl Since: 0.29
134952dc082bSmrgdnl
135052dc082bSmrgdnl Checks for existence of MODULES and gathers its build flags with
135152dc082bSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
135252dc082bSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
135352dc082bSmrgdnl
135452dc082bSmrgdnl Note that if there is a possibility the first call to
135552dc082bSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
135652dc082bSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
135752dc082bSmrgdnl configure.ac.
135852dc082bSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
135952dc082bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
136052dc082bSmrg_save_PKG_CONFIG=$PKG_CONFIG
136152dc082bSmrgPKG_CONFIG="$PKG_CONFIG --static"
136252dc082bSmrgPKG_CHECK_MODULES($@)
136352dc082bSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
136452dc082bSmrg])dnl PKG_CHECK_MODULES_STATIC
136552dc082bSmrg
136652dc082bSmrg
136752dc082bSmrgdnl PKG_INSTALLDIR([DIRECTORY])
136852dc082bSmrgdnl -------------------------
136952dc082bSmrgdnl Since: 0.27
137052dc082bSmrgdnl
137152dc082bSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
137252dc082bSmrgdnl should install pkg-config .pc files. By default the directory is
137352dc082bSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
137452dc082bSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
137552dc082bSmrgdnl parameter.
137652dc082bSmrgAC_DEFUN([PKG_INSTALLDIR],
137752dc082bSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
137852dc082bSmrgm4_pushdef([pkg_description],
137952dc082bSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
138052dc082bSmrgAC_ARG_WITH([pkgconfigdir],
138152dc082bSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
138252dc082bSmrg    [with_pkgconfigdir=]pkg_default)
138352dc082bSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
138452dc082bSmrgm4_popdef([pkg_default])
138552dc082bSmrgm4_popdef([pkg_description])
138652dc082bSmrg])dnl PKG_INSTALLDIR
138752dc082bSmrg
138852dc082bSmrg
138952dc082bSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
139052dc082bSmrgdnl --------------------------------
139152dc082bSmrgdnl Since: 0.27
139252dc082bSmrgdnl
139352dc082bSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
139452dc082bSmrgdnl module should install arch-independent pkg-config .pc files. By
139552dc082bSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
139652dc082bSmrgdnl changed by passing DIRECTORY. The user can override through the
139752dc082bSmrgdnl --with-noarch-pkgconfigdir parameter.
139852dc082bSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
139952dc082bSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
140052dc082bSmrgm4_pushdef([pkg_description],
140152dc082bSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
140252dc082bSmrgAC_ARG_WITH([noarch-pkgconfigdir],
140352dc082bSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
140452dc082bSmrg    [with_noarch_pkgconfigdir=]pkg_default)
140552dc082bSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
140652dc082bSmrgm4_popdef([pkg_default])
140752dc082bSmrgm4_popdef([pkg_description])
140852dc082bSmrg])dnl PKG_NOARCH_INSTALLDIR
1409ac92798bSmrg
14106e7d3316Smrg
141152dc082bSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
141252dc082bSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
141352dc082bSmrgdnl -------------------------------------------
141452dc082bSmrgdnl Since: 0.28
141552dc082bSmrgdnl
141652dc082bSmrgdnl Retrieves the value of the pkg-config variable for the given module.
141752dc082bSmrgAC_DEFUN([PKG_CHECK_VAR],
141852dc082bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
141952dc082bSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
14206e7d3316Smrg
142152dc082bSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
142252dc082bSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
14236e7d3316Smrg
142452dc082bSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
142552dc082bSmrg])dnl PKG_CHECK_VAR
14266e7d3316Smrg
142752dc082bSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142852dc082bSmrgdnl
142952dc082bSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
143052dc082bSmrgdnl
143152dc082bSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143252dc082bSmrgdnl copy of this software and associated documentation files (the "Software"),
143352dc082bSmrgdnl to deal in the Software without restriction, including without limitation
143452dc082bSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143552dc082bSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
143652dc082bSmrgdnl Software is furnished to do so, subject to the following conditions:
143752dc082bSmrgdnl
143852dc082bSmrgdnl The above copyright notice and this permission notice (including the next
143952dc082bSmrgdnl paragraph) shall be included in all copies or substantial portions of the
144052dc082bSmrgdnl Software.
144152dc082bSmrgdnl
144252dc082bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144352dc082bSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144452dc082bSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144552dc082bSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144652dc082bSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144752dc082bSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144852dc082bSmrgdnl DEALINGS IN THE SOFTWARE.
14496e7d3316Smrg
145052dc082bSmrg# XORG_MACROS_VERSION(required-version)
145152dc082bSmrg# -------------------------------------
145252dc082bSmrg# Minimum version: 1.1.0
145352dc082bSmrg#
145452dc082bSmrg# If you're using a macro added in Version 1.1 or newer, include this in
145552dc082bSmrg# your configure.ac with the minimum required version, such as:
145652dc082bSmrg# XORG_MACROS_VERSION(1.1)
145752dc082bSmrg#
145852dc082bSmrg# To ensure that this macro is defined, also add:
145952dc082bSmrg# m4_ifndef([XORG_MACROS_VERSION],
146052dc082bSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
146152dc082bSmrg#
146252dc082bSmrg#
146352dc082bSmrg# See the "minimum version" comment for each macro you use to see what
146452dc082bSmrg# version you require.
146552dc082bSmrgm4_defun([XORG_MACROS_VERSION],[
146652dc082bSmrgm4_define([vers_have], [1.20.0])
146752dc082bSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146852dc082bSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
146952dc082bSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147052dc082bSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147152dc082bSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147252dc082bSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147352dc082bSmrgm4_undefine([vers_have])
147452dc082bSmrgm4_undefine([maj_have])
147552dc082bSmrgm4_undefine([maj_needed])
147652dc082bSmrg]) # XORG_MACROS_VERSION
147752dc082bSmrg
147852dc082bSmrg# XORG_PROG_RAWCPP()
147952dc082bSmrg# ------------------
14801c235774Smrg# Minimum version: 1.0.0
14811c235774Smrg#
148252dc082bSmrg# Find cpp program and necessary flags for use in pre-processing text files
148352dc082bSmrg# such as man pages and config files
148452dc082bSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148552dc082bSmrgAC_REQUIRE([AC_PROG_CPP])
148652dc082bSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148752dc082bSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14886e7d3316Smrg
148952dc082bSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149052dc082bSmrg# which is not the best choice for supporting other OS'es, but covers most
149152dc082bSmrg# of the ones we need for now.
149252dc082bSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149352dc082bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149452dc082bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149552dc082bSmrg	AC_MSG_RESULT([no])
149652dc082bSmrgelse
149752dc082bSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149852dc082bSmrg		RAWCPPFLAGS=-undef
149952dc082bSmrg		AC_MSG_RESULT([yes])
150052dc082bSmrg	# under Cygwin unix is still defined even with -undef
150152dc082bSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150252dc082bSmrg		RAWCPPFLAGS="-undef -ansi"
150352dc082bSmrg		AC_MSG_RESULT([yes, with -ansi])
150452dc082bSmrg	else
150552dc082bSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150652dc082bSmrg	fi
150797cf2ee2Smrgfi
150852dc082bSmrgrm -f conftest.$ac_ext
15096e7d3316Smrg
151052dc082bSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151152dc082bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151252dc082bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151352dc082bSmrg	AC_MSG_RESULT([no])
151419569120Smrgelse
151552dc082bSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151652dc082bSmrg		TRADITIONALCPPFLAGS="-traditional"
151752dc082bSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151852dc082bSmrg		AC_MSG_RESULT([yes])
151952dc082bSmrg	else
152052dc082bSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152152dc082bSmrg	fi
152219569120Smrgfi
152352dc082bSmrgrm -f conftest.$ac_ext
152452dc082bSmrgAC_SUBST(RAWCPPFLAGS)
152552dc082bSmrgAC_SUBST(TRADITIONALCPPFLAGS)
152652dc082bSmrg]) # XORG_PROG_RAWCPP
15276e7d3316Smrg
152852dc082bSmrg# XORG_MANPAGE_SECTIONS()
152952dc082bSmrg# -----------------------
153052dc082bSmrg# Minimum version: 1.0.0
15311c235774Smrg#
153252dc082bSmrg# Determine which sections man pages go in for the different man page types
153352dc082bSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153452dc082bSmrg# Not sure if there's any better way than just hardcoding by OS name.
153552dc082bSmrg# Override default settings by setting environment variables
153652dc082bSmrg# Added MAN_SUBSTS in version 1.8
153752dc082bSmrg# Added AC_PROG_SED in version 1.8
15386e7d3316Smrg
153952dc082bSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154052dc082bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
154152dc082bSmrgAC_REQUIRE([AC_PROG_SED])
15426e7d3316Smrg
15431c235774Smrgcase $host_os in
154452dc082bSmrg    solaris*)
154552dc082bSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
154652dc082bSmrg        # check for a man page file found in later versions that use
154752dc082bSmrg        # traditional section numbers instead
154852dc082bSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
154952dc082bSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
155052dc082bSmrg        ;;
155152dc082bSmrg    *) SYSV_MAN_SECTIONS=false ;;
15521c235774Smrgesac
15536e7d3316Smrg
155452dc082bSmrgif test x$APP_MAN_SUFFIX = x    ; then
155552dc082bSmrg    APP_MAN_SUFFIX=1
155652dc082bSmrgfi
155752dc082bSmrgif test x$APP_MAN_DIR = x    ; then
155852dc082bSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
155952dc082bSmrgfi
156052dc082bSmrg
156152dc082bSmrgif test x$LIB_MAN_SUFFIX = x    ; then
156252dc082bSmrg    LIB_MAN_SUFFIX=3
156352dc082bSmrgfi
156452dc082bSmrgif test x$LIB_MAN_DIR = x    ; then
156552dc082bSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
156619569120Smrgfi
15676e7d3316Smrg
156852dc082bSmrgif test x$FILE_MAN_SUFFIX = x    ; then
156952dc082bSmrg    case $SYSV_MAN_SECTIONS in
157052dc082bSmrg	true)				FILE_MAN_SUFFIX=4  ;;
157152dc082bSmrg	*)				FILE_MAN_SUFFIX=5  ;;
157252dc082bSmrg    esac
157352dc082bSmrgfi
157452dc082bSmrgif test x$FILE_MAN_DIR = x    ; then
157552dc082bSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15761c235774Smrgfi
15776e7d3316Smrg
157852dc082bSmrgif test x$MISC_MAN_SUFFIX = x    ; then
157952dc082bSmrg    case $SYSV_MAN_SECTIONS in
158052dc082bSmrg	true)				MISC_MAN_SUFFIX=5  ;;
158152dc082bSmrg	*)				MISC_MAN_SUFFIX=7  ;;
158252dc082bSmrg    esac
158352dc082bSmrgfi
158452dc082bSmrgif test x$MISC_MAN_DIR = x    ; then
158552dc082bSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
158652dc082bSmrgfi
15879f00f3a1Smrg
158852dc082bSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
158952dc082bSmrg    case $SYSV_MAN_SECTIONS in
159052dc082bSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
159152dc082bSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159252dc082bSmrg    esac
159352dc082bSmrgfi
159452dc082bSmrgif test x$DRIVER_MAN_DIR = x    ; then
159552dc082bSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159652dc082bSmrgfi
15976e7d3316Smrg
159852dc082bSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
159952dc082bSmrg    case $SYSV_MAN_SECTIONS in
160052dc082bSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
160152dc082bSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160252dc082bSmrg    esac
160352dc082bSmrgfi
160452dc082bSmrgif test x$ADMIN_MAN_DIR = x    ; then
160552dc082bSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160652dc082bSmrgfi
16076e7d3316Smrg
16086e7d3316Smrg
160952dc082bSmrgAC_SUBST([APP_MAN_SUFFIX])
161052dc082bSmrgAC_SUBST([LIB_MAN_SUFFIX])
161152dc082bSmrgAC_SUBST([FILE_MAN_SUFFIX])
161252dc082bSmrgAC_SUBST([MISC_MAN_SUFFIX])
161352dc082bSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161452dc082bSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161552dc082bSmrgAC_SUBST([APP_MAN_DIR])
161652dc082bSmrgAC_SUBST([LIB_MAN_DIR])
161752dc082bSmrgAC_SUBST([FILE_MAN_DIR])
161852dc082bSmrgAC_SUBST([MISC_MAN_DIR])
161952dc082bSmrgAC_SUBST([DRIVER_MAN_DIR])
162052dc082bSmrgAC_SUBST([ADMIN_MAN_DIR])
162119569120Smrg
162252dc082bSmrgXORG_MAN_PAGE="X Version 11"
162352dc082bSmrgAC_SUBST([XORG_MAN_PAGE])
162452dc082bSmrgMAN_SUBSTS="\
162552dc082bSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162652dc082bSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162752dc082bSmrg	-e 's|__xservername__|Xorg|g' \
162852dc082bSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
162952dc082bSmrg	-e 's|__projectroot__|\$(prefix)|g' \
163052dc082bSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163152dc082bSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163252dc082bSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163352dc082bSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163452dc082bSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163552dc082bSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163652dc082bSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163752dc082bSmrgAC_SUBST([MAN_SUBSTS])
16386e7d3316Smrg
163952dc082bSmrg]) # XORG_MANPAGE_SECTIONS
1640a966c04fSmrg
164152dc082bSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164252dc082bSmrg# ------------------------
164352dc082bSmrg# Minimum version: 1.7.0
16449f00f3a1Smrg#
164552dc082bSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164652dc082bSmrg# provided by xorg-sgml-doctools, if installed.
164752dc082bSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164852dc082bSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164952dc082bSmrgXORG_SGML_PATH=
165052dc082bSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165152dc082bSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165252dc082bSmrg    [m4_ifval([$1],[:],
165352dc082bSmrg        [if test x"$cross_compiling" != x"yes" ; then
165452dc082bSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165552dc082bSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165652dc082bSmrg         fi])
165752dc082bSmrg    ])
16581c235774Smrg
165952dc082bSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166052dc082bSmrg# the path and the name of the doc stylesheet
166152dc082bSmrgif test "x$XORG_SGML_PATH" != "x" ; then
166252dc082bSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166352dc082bSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166452dc082bSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166552dc082bSmrgelse
166652dc082bSmrg   AC_MSG_RESULT([no])
166752dc082bSmrgfi
1668a966c04fSmrg
166952dc082bSmrgAC_SUBST(XORG_SGML_PATH)
167052dc082bSmrgAC_SUBST(STYLESHEET_SRCDIR)
167152dc082bSmrgAC_SUBST(XSL_STYLESHEET)
167252dc082bSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167352dc082bSmrg]) # XORG_CHECK_SGML_DOCTOOLS
16741c235774Smrg
167552dc082bSmrg# XORG_CHECK_LINUXDOC
167652dc082bSmrg# -------------------
167752dc082bSmrg# Minimum version: 1.0.0
167852dc082bSmrg#
167952dc082bSmrg# Defines the variable MAKE_TEXT if the necessary tools and
168052dc082bSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168152dc082bSmrg# Whether or not the necessary tools and files are found can be checked
168252dc082bSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168352dc082bSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168452dc082bSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168552dc082bSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16861c235774Smrg
168752dc082bSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16881c235774Smrg
168952dc082bSmrgAC_MSG_CHECKING([whether to build documentation])
16901c235774Smrg
169152dc082bSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169252dc082bSmrg   BUILDDOC=yes
169352dc082bSmrgelse
169452dc082bSmrg   BUILDDOC=no
169519569120Smrgfi
1696a966c04fSmrg
169752dc082bSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
169852dc082bSmrg
169952dc082bSmrgAC_MSG_RESULT([$BUILDDOC])
170052dc082bSmrg
170152dc082bSmrgAC_MSG_CHECKING([whether to build pdf documentation])
17026e7d3316Smrg
170352dc082bSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170452dc082bSmrg   BUILDPDFDOC=yes
170552dc082bSmrgelse
170652dc082bSmrg   BUILDPDFDOC=no
170752dc082bSmrgfi
1708a966c04fSmrg
170952dc082bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17101c235774Smrg
171152dc082bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17121c235774Smrg
171352dc082bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171452dc082bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171552dc082bSmrgMAKE_PDF="$PS2PDF"
171652dc082bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17171c235774Smrg
171852dc082bSmrgAC_SUBST(MAKE_TEXT)
171952dc082bSmrgAC_SUBST(MAKE_PS)
172052dc082bSmrgAC_SUBST(MAKE_PDF)
172152dc082bSmrgAC_SUBST(MAKE_HTML)
172252dc082bSmrg]) # XORG_CHECK_LINUXDOC
17231c235774Smrg
172452dc082bSmrg# XORG_CHECK_DOCBOOK
172552dc082bSmrg# -------------------
172652dc082bSmrg# Minimum version: 1.0.0
17279f00f3a1Smrg#
172852dc082bSmrg# Checks for the ability to build output formats from SGML DocBook source.
172952dc082bSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173052dc082bSmrg# indicates whether the necessary tools and files are found and, if set,
173152dc082bSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173252dc082bSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173352dc082bSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1734a966c04fSmrg
173552dc082bSmrgBUILDTXTDOC=no
173652dc082bSmrgBUILDPDFDOC=no
173752dc082bSmrgBUILDPSDOC=no
173852dc082bSmrgBUILDHTMLDOC=no
17391c235774Smrg
174052dc082bSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174152dc082bSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174252dc082bSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174352dc082bSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
174452dc082bSmrg
174552dc082bSmrgAC_MSG_CHECKING([whether to build text documentation])
174652dc082bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174752dc082bSmrg   test x$BUILD_TXTDOC != xno; then
174852dc082bSmrg	BUILDTXTDOC=yes
174919569120Smrgfi
175052dc082bSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175152dc082bSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752edce3322Smrg
175352dc082bSmrgAC_MSG_CHECKING([whether to build PDF documentation])
175452dc082bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175552dc082bSmrg   test x$BUILD_PDFDOC != xno; then
175652dc082bSmrg	BUILDPDFDOC=yes
175752dc082bSmrgfi
175852dc082bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175952dc082bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17606e7d3316Smrg
176152dc082bSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176252dc082bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176352dc082bSmrg   test x$BUILD_PSDOC != xno; then
176452dc082bSmrg	BUILDPSDOC=yes
176552dc082bSmrgfi
176652dc082bSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176752dc082bSmrgAC_MSG_RESULT([$BUILDPSDOC])
1768a966c04fSmrg
176952dc082bSmrgAC_MSG_CHECKING([whether to build HTML documentation])
177052dc082bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177152dc082bSmrg   test x$BUILD_HTMLDOC != xno; then
177252dc082bSmrg	BUILDHTMLDOC=yes
177352dc082bSmrgfi
177452dc082bSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177552dc082bSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17761c235774Smrg
177752dc082bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177852dc082bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177952dc082bSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178052dc082bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17811c235774Smrg
178252dc082bSmrgAC_SUBST(MAKE_TEXT)
178352dc082bSmrgAC_SUBST(MAKE_PS)
178452dc082bSmrgAC_SUBST(MAKE_PDF)
178552dc082bSmrgAC_SUBST(MAKE_HTML)
178652dc082bSmrg]) # XORG_CHECK_DOCBOOK
17871c235774Smrg
178852dc082bSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178952dc082bSmrg# ----------------
179052dc082bSmrg# Minimum version: 1.5.0
179152dc082bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
179252dc082bSmrg#
179352dc082bSmrg# Documentation tools are not always available on all platforms and sometimes
179452dc082bSmrg# not at the appropriate level. This macro enables a module to test for the
179552dc082bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
179652dc082bSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
179752dc082bSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179852dc082bSmrg# --with-xmlto assumes 'auto'.
179952dc082bSmrg#
180052dc082bSmrg# Interface to module:
180152dc082bSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180252dc082bSmrg# XMLTO:	returns the path of the xmlto program found
180352dc082bSmrg#		returns the path set by the user in the environment
180452dc082bSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180552dc082bSmrg#		'no' user instructs the module not to use xmlto
180652dc082bSmrg#
180752dc082bSmrg# Added in version 1.10.0
180852dc082bSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180952dc082bSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
181052dc082bSmrg#
181152dc082bSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
181252dc082bSmrg#
181352dc082bSmrgAC_DEFUN([XORG_WITH_XMLTO],[
181452dc082bSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181552dc082bSmrgm4_define([_defopt], m4_default([$2], [auto]))
181652dc082bSmrgAC_ARG_WITH(xmlto,
181752dc082bSmrg	AS_HELP_STRING([--with-xmlto],
181852dc082bSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181952dc082bSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182052dc082bSmrgm4_undefine([_defopt])
182152dc082bSmrg
182252dc082bSmrgif test "x$use_xmlto" = x"auto"; then
182352dc082bSmrg   AC_PATH_PROG([XMLTO], [xmlto])
182452dc082bSmrg   if test "x$XMLTO" = "x"; then
182552dc082bSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182652dc082bSmrg	have_xmlto=no
182752dc082bSmrg   else
182852dc082bSmrg        have_xmlto=yes
182952dc082bSmrg   fi
183052dc082bSmrgelif test "x$use_xmlto" = x"yes" ; then
183152dc082bSmrg   AC_PATH_PROG([XMLTO], [xmlto])
183252dc082bSmrg   if test "x$XMLTO" = "x"; then
183352dc082bSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183452dc082bSmrg   fi
183552dc082bSmrg   have_xmlto=yes
183652dc082bSmrgelif test "x$use_xmlto" = x"no" ; then
183752dc082bSmrg   if test "x$XMLTO" != "x"; then
183852dc082bSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183952dc082bSmrg   fi
184052dc082bSmrg   have_xmlto=no
184119569120Smrgelse
184252dc082bSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184319569120Smrgfi
1844a966c04fSmrg
184552dc082bSmrg# Test for a minimum version of xmlto, if provided.
184652dc082bSmrgm4_ifval([$1],
184752dc082bSmrg[if test "$have_xmlto" = yes; then
184852dc082bSmrg    # scrape the xmlto version
184952dc082bSmrg    AC_MSG_CHECKING([the xmlto version])
185052dc082bSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185152dc082bSmrg    AC_MSG_RESULT([$xmlto_version])
185252dc082bSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185352dc082bSmrg        [if test "x$use_xmlto" = xauto; then
185452dc082bSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185552dc082bSmrg            have_xmlto=no
185652dc082bSmrg        else
185752dc082bSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185852dc082bSmrg        fi])
185952dc082bSmrgfi])
1860a966c04fSmrg
186152dc082bSmrg# Test for the ability of xmlto to generate a text target
18629f00f3a1Smrg#
186352dc082bSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
186452dc082bSmrg# following test for empty XML docbook files.
186552dc082bSmrg# For compatibility reasons use the following empty XML docbook file and if
186652dc082bSmrg# it fails try it again with a non-empty XML file.
186752dc082bSmrghave_xmlto_text=no
186852dc082bSmrgcat > conftest.xml << "EOF"
186952dc082bSmrgEOF
187052dc082bSmrgAS_IF([test "$have_xmlto" = yes],
187152dc082bSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187252dc082bSmrg             [have_xmlto_text=yes],
187352dc082bSmrg             [# Try it again with a non-empty XML file.
187452dc082bSmrg              cat > conftest.xml << "EOF"
187552dc082bSmrg<x></x>
187652dc082bSmrgEOF
187752dc082bSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187852dc082bSmrg                    [have_xmlto_text=yes],
187952dc082bSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188052dc082bSmrgrm -f conftest.xml
188152dc082bSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188252dc082bSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188352dc082bSmrg]) # XORG_WITH_XMLTO
188452dc082bSmrg
188552dc082bSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188652dc082bSmrg# --------------------------------------------
188752dc082bSmrg# Minimum version: 1.12.0
188852dc082bSmrg# Minimum version for optional DEFAULT argument: 1.12.0
18899f00f3a1Smrg#
189052dc082bSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189152dc082bSmrg# XML-based language used for the transformation of XML documents.
189252dc082bSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189352dc082bSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189452dc082bSmrg# The XSLT processor is often used as a standalone tool for transformations.
189552dc082bSmrg# It should not be assumed that this tool is used only to work with documnetation.
189652dc082bSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18979f00f3a1Smrg#
189852dc082bSmrg# Interface to module:
189952dc082bSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190052dc082bSmrg# XSLTPROC:	 returns the path of the xsltproc program found
190152dc082bSmrg#		 returns the path set by the user in the environment
190252dc082bSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190352dc082bSmrg#		  'no' user instructs the module not to use xsltproc
190452dc082bSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19059f00f3a1Smrg#
190652dc082bSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19071c235774Smrg#
190852dc082bSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190952dc082bSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191052dc082bSmrg# Preserves the interface, should it be implemented later
191152dc082bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191252dc082bSmrgm4_define([_defopt], m4_default([$2], [auto]))
191352dc082bSmrgAC_ARG_WITH(xsltproc,
191452dc082bSmrg	AS_HELP_STRING([--with-xsltproc],
191552dc082bSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191652dc082bSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191752dc082bSmrgm4_undefine([_defopt])
19181c235774Smrg
191952dc082bSmrgif test "x$use_xsltproc" = x"auto"; then
192052dc082bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192152dc082bSmrg   if test "x$XSLTPROC" = "x"; then
192252dc082bSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192352dc082bSmrg	have_xsltproc=no
192452dc082bSmrg   else
192552dc082bSmrg        have_xsltproc=yes
192652dc082bSmrg   fi
192752dc082bSmrgelif test "x$use_xsltproc" = x"yes" ; then
192852dc082bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192952dc082bSmrg   if test "x$XSLTPROC" = "x"; then
193052dc082bSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193152dc082bSmrg   fi
193252dc082bSmrg   have_xsltproc=yes
193352dc082bSmrgelif test "x$use_xsltproc" = x"no" ; then
193452dc082bSmrg   if test "x$XSLTPROC" != "x"; then
193552dc082bSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193652dc082bSmrg   fi
193752dc082bSmrg   have_xsltproc=no
193852dc082bSmrgelse
193952dc082bSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
194019569120Smrgfi
1941a966c04fSmrg
194252dc082bSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194352dc082bSmrg]) # XORG_WITH_XSLTPROC
194474835918Smrg
194552dc082bSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194652dc082bSmrg# ----------------------------------------
194752dc082bSmrg# Minimum version: 1.15.0
194819569120Smrg#
194952dc082bSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
195052dc082bSmrg# scanning arbitrary text files, extracting information from those text files,
195152dc082bSmrg# and printing reports based on that information.
195219569120Smrg#
195352dc082bSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
19549f00f3a1Smrg#
195552dc082bSmrg# Interface to module:
195652dc082bSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
195752dc082bSmrg# PERL:	     returns the path of the perl program found
195852dc082bSmrg#	     returns the path set by the user in the environment
195952dc082bSmrg# --with-perl: 'yes' user instructs the module to use perl
196052dc082bSmrg#	       'no' user instructs the module not to use perl
196152dc082bSmrg# have_perl: returns yes if perl found in PATH or no
196219569120Smrg#
196352dc082bSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196452dc082bSmrg#
196552dc082bSmrgAC_DEFUN([XORG_WITH_PERL],[
196652dc082bSmrgAC_ARG_VAR([PERL], [Path to perl command])
196752dc082bSmrg# Preserves the interface, should it be implemented later
196852dc082bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196952dc082bSmrgm4_define([_defopt], m4_default([$2], [auto]))
197052dc082bSmrgAC_ARG_WITH(perl,
197152dc082bSmrg	AS_HELP_STRING([--with-perl],
197252dc082bSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197352dc082bSmrg	   [use_perl=$withval], [use_perl=]_defopt)
197452dc082bSmrgm4_undefine([_defopt])
1975a966c04fSmrg
197652dc082bSmrgif test "x$use_perl" = x"auto"; then
197752dc082bSmrg   AC_PATH_PROG([PERL], [perl])
197852dc082bSmrg   if test "x$PERL" = "x"; then
197952dc082bSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198052dc082bSmrg	have_perl=no
198152dc082bSmrg   else
198252dc082bSmrg        have_perl=yes
198352dc082bSmrg   fi
198452dc082bSmrgelif test "x$use_perl" = x"yes" ; then
198552dc082bSmrg   AC_PATH_PROG([PERL], [perl])
198652dc082bSmrg   if test "x$PERL" = "x"; then
198752dc082bSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198852dc082bSmrg   fi
198952dc082bSmrg   have_perl=yes
199052dc082bSmrgelif test "x$use_perl" = x"no" ; then
199152dc082bSmrg   if test "x$PERL" != "x"; then
199252dc082bSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199352dc082bSmrg   fi
199452dc082bSmrg   have_perl=no
199552dc082bSmrgelse
199652dc082bSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199752dc082bSmrgfi
1998a966c04fSmrg
199952dc082bSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200052dc082bSmrg]) # XORG_WITH_PERL
20016e7d3316Smrg
200252dc082bSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
200319569120Smrg# ----------------
200452dc082bSmrg# Minimum version: 1.5.0
200552dc082bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
200619569120Smrg#
200752dc082bSmrg# Documentation tools are not always available on all platforms and sometimes
200852dc082bSmrg# not at the appropriate level. This macro enables a module to test for the
200952dc082bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
201052dc082bSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
201152dc082bSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201252dc082bSmrg# --with-asciidoc assumes 'auto'.
201319569120Smrg#
201452dc082bSmrg# Interface to module:
201552dc082bSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201652dc082bSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
201752dc082bSmrg#		 returns the path set by the user in the environment
201852dc082bSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201952dc082bSmrg#		  'no' user instructs the module not to use asciidoc
202019569120Smrg#
202152dc082bSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
202219569120Smrg#
202352dc082bSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202452dc082bSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202552dc082bSmrgm4_define([_defopt], m4_default([$2], [auto]))
202652dc082bSmrgAC_ARG_WITH(asciidoc,
202752dc082bSmrg	AS_HELP_STRING([--with-asciidoc],
202852dc082bSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202952dc082bSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203052dc082bSmrgm4_undefine([_defopt])
20316e7d3316Smrg
203252dc082bSmrgif test "x$use_asciidoc" = x"auto"; then
203352dc082bSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203452dc082bSmrg   if test "x$ASCIIDOC" = "x"; then
203552dc082bSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203652dc082bSmrg	have_asciidoc=no
203752dc082bSmrg   else
203852dc082bSmrg        have_asciidoc=yes
203952dc082bSmrg   fi
204052dc082bSmrgelif test "x$use_asciidoc" = x"yes" ; then
204152dc082bSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204252dc082bSmrg   if test "x$ASCIIDOC" = "x"; then
204352dc082bSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204452dc082bSmrg   fi
204552dc082bSmrg   have_asciidoc=yes
204652dc082bSmrgelif test "x$use_asciidoc" = x"no" ; then
204752dc082bSmrg   if test "x$ASCIIDOC" != "x"; then
204852dc082bSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204952dc082bSmrg   fi
205052dc082bSmrg   have_asciidoc=no
205152dc082bSmrgelse
205252dc082bSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205352dc082bSmrgfi
205452dc082bSmrgm4_ifval([$1],
205552dc082bSmrg[if test "$have_asciidoc" = yes; then
205652dc082bSmrg    # scrape the asciidoc version
205752dc082bSmrg    AC_MSG_CHECKING([the asciidoc version])
205852dc082bSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205952dc082bSmrg    AC_MSG_RESULT([$asciidoc_version])
206052dc082bSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206152dc082bSmrg        [if test "x$use_asciidoc" = xauto; then
206252dc082bSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206352dc082bSmrg            have_asciidoc=no
206452dc082bSmrg        else
206552dc082bSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206652dc082bSmrg        fi])
206752dc082bSmrgfi])
206852dc082bSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206952dc082bSmrg]) # XORG_WITH_ASCIIDOC
207097cf2ee2Smrg
207152dc082bSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207252dc082bSmrg# -------------------------------------------
207352dc082bSmrg# Minimum version: 1.5.0
207452dc082bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
207552dc082bSmrg# Minimum version for optional DOT checking: 1.18.0
207652dc082bSmrg#
207752dc082bSmrg# Documentation tools are not always available on all platforms and sometimes
207852dc082bSmrg# not at the appropriate level. This macro enables a module to test for the
207952dc082bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
208052dc082bSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
208152dc082bSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208252dc082bSmrg# --with-doxygen assumes 'auto'.
208352dc082bSmrg#
208452dc082bSmrg# Interface to module:
208552dc082bSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208652dc082bSmrg# DOXYGEN:	 returns the path of the doxygen program found
208752dc082bSmrg#		 returns the path set by the user in the environment
208852dc082bSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208952dc082bSmrg#		  'no' user instructs the module not to use doxygen
209052dc082bSmrg#
209152dc082bSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
209252dc082bSmrg#
209352dc082bSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209452dc082bSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209552dc082bSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209652dc082bSmrgm4_define([_defopt], m4_default([$2], [auto]))
209752dc082bSmrgAC_ARG_WITH(doxygen,
209852dc082bSmrg	AS_HELP_STRING([--with-doxygen],
209952dc082bSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210052dc082bSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210152dc082bSmrgm4_undefine([_defopt])
210297cf2ee2Smrg
210352dc082bSmrgif test "x$use_doxygen" = x"auto"; then
210452dc082bSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210552dc082bSmrg   if test "x$DOXYGEN" = "x"; then
210652dc082bSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210752dc082bSmrg	have_doxygen=no
210852dc082bSmrg   else
210952dc082bSmrg        have_doxygen=yes
211052dc082bSmrg   fi
211152dc082bSmrgelif test "x$use_doxygen" = x"yes" ; then
211252dc082bSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211352dc082bSmrg   if test "x$DOXYGEN" = "x"; then
211452dc082bSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211552dc082bSmrg   fi
211652dc082bSmrg   have_doxygen=yes
211752dc082bSmrgelif test "x$use_doxygen" = x"no" ; then
211852dc082bSmrg   if test "x$DOXYGEN" != "x"; then
211952dc082bSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212052dc082bSmrg   fi
212152dc082bSmrg   have_doxygen=no
212252dc082bSmrgelse
212352dc082bSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
212452dc082bSmrgfi
212552dc082bSmrgm4_ifval([$1],
212652dc082bSmrg[if test "$have_doxygen" = yes; then
212752dc082bSmrg    # scrape the doxygen version
212852dc082bSmrg    AC_MSG_CHECKING([the doxygen version])
212952dc082bSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213052dc082bSmrg    AC_MSG_RESULT([$doxygen_version])
213152dc082bSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213252dc082bSmrg        [if test "x$use_doxygen" = xauto; then
213352dc082bSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213452dc082bSmrg            have_doxygen=no
213552dc082bSmrg        else
213652dc082bSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213752dc082bSmrg        fi])
213852dc082bSmrgfi])
213997cf2ee2Smrg
214052dc082bSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214152dc082bSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214252dc082bSmrgdnl 	HAVE_DOT = @HAVE_DOT@
214352dc082bSmrgHAVE_DOT=no
214452dc082bSmrgif test "x$have_doxygen" = "xyes"; then
214552dc082bSmrg  AC_PATH_PROG([DOT], [dot])
214652dc082bSmrg    if test "x$DOT" != "x"; then
214752dc082bSmrg      HAVE_DOT=yes
214852dc082bSmrg    fi
214952dc082bSmrgfi
2150a966c04fSmrg
215152dc082bSmrgAC_SUBST([HAVE_DOT])
215252dc082bSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215352dc082bSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215452dc082bSmrg]) # XORG_WITH_DOXYGEN
2155a966c04fSmrg
215652dc082bSmrg# XORG_WITH_GROFF([DEFAULT])
215752dc082bSmrg# ----------------
215852dc082bSmrg# Minimum version: 1.6.0
215952dc082bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
21601c235774Smrg#
216152dc082bSmrg# Documentation tools are not always available on all platforms and sometimes
216252dc082bSmrg# not at the appropriate level. This macro enables a module to test for the
216352dc082bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
216452dc082bSmrg# the --with-groff option, it allows maximum flexibility in making decisions
216552dc082bSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
216652dc082bSmrg# --with-groff assumes 'auto'.
2167ac92798bSmrg#
216852dc082bSmrg# Interface to module:
216952dc082bSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217052dc082bSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217152dc082bSmrg# HAVE_GROFF_MS: the -ms macros package
217252dc082bSmrg# GROFF:	 returns the path of the groff program found
217352dc082bSmrg#		 returns the path set by the user in the environment
217452dc082bSmrg# --with-groff:	 'yes' user instructs the module to use groff
217552dc082bSmrg#		 'no' user instructs the module not to use groff
217652dc082bSmrg#
217752dc082bSmrg# Added in version 1.9.0:
217852dc082bSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217952dc082bSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218052dc082bSmrg#		   psselect from the psutils package.
218152dc082bSmrg#		   the ghostcript package. Refer to the grohtml man pages
218219569120Smrg#
218352dc082bSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218419569120Smrg#
218552dc082bSmrg# OS and distros often splits groff in a basic and full package, the former
218652dc082bSmrg# having the groff program and the later having devices, fonts and macros
218752dc082bSmrg# Checking for the groff executable is not enough.
21881c235774Smrg#
218952dc082bSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
219052dc082bSmrg# unset HAVE_GROFF or GROFF env variables.
219152dc082bSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219219569120Smrg#
219352dc082bSmrgAC_DEFUN([XORG_WITH_GROFF],[
219452dc082bSmrgAC_ARG_VAR([GROFF], [Path to groff command])
219552dc082bSmrgm4_define([_defopt], m4_default([$1], [auto]))
219652dc082bSmrgAC_ARG_WITH(groff,
219752dc082bSmrg	AS_HELP_STRING([--with-groff],
219852dc082bSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219952dc082bSmrg	   [use_groff=$withval], [use_groff=]_defopt)
220052dc082bSmrgm4_undefine([_defopt])
22011c235774Smrg
220252dc082bSmrgif test "x$use_groff" = x"auto"; then
220352dc082bSmrg   AC_PATH_PROG([GROFF], [groff])
220452dc082bSmrg   if test "x$GROFF" = "x"; then
220552dc082bSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220652dc082bSmrg	have_groff=no
220752dc082bSmrg   else
220852dc082bSmrg        have_groff=yes
220952dc082bSmrg   fi
221052dc082bSmrgelif test "x$use_groff" = x"yes" ; then
221152dc082bSmrg   AC_PATH_PROG([GROFF], [groff])
221252dc082bSmrg   if test "x$GROFF" = "x"; then
221352dc082bSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221452dc082bSmrg   fi
221552dc082bSmrg   have_groff=yes
221652dc082bSmrgelif test "x$use_groff" = x"no" ; then
221752dc082bSmrg   if test "x$GROFF" != "x"; then
221852dc082bSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221952dc082bSmrg   fi
222052dc082bSmrg   have_groff=no
22211c235774Smrgelse
222252dc082bSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22231c235774Smrgfi
22241c235774Smrg
222552dc082bSmrg# We have groff, test for the presence of the macro packages
222652dc082bSmrgif test "x$have_groff" = x"yes"; then
222752dc082bSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222852dc082bSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222952dc082bSmrg        groff_ms_works=yes
223052dc082bSmrg    else
223152dc082bSmrg        groff_ms_works=no
22321c235774Smrg    fi
223352dc082bSmrg    AC_MSG_RESULT([$groff_ms_works])
223452dc082bSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223552dc082bSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223652dc082bSmrg        groff_mm_works=yes
223752dc082bSmrg    else
223852dc082bSmrg        groff_mm_works=no
223952dc082bSmrg    fi
224052dc082bSmrg    AC_MSG_RESULT([$groff_mm_works])
224152dc082bSmrgfi
22429f00f3a1Smrg
224352dc082bSmrg# We have groff, test for HTML dependencies, one command per package
224452dc082bSmrgif test "x$have_groff" = x"yes"; then
224552dc082bSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224652dc082bSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224752dc082bSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224852dc082bSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224952dc082bSmrg      have_groff_html=yes
225052dc082bSmrg   else
225152dc082bSmrg      have_groff_html=no
225252dc082bSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225352dc082bSmrg   fi
225452dc082bSmrgfi
22559f00f3a1Smrg
225652dc082bSmrg# Set Automake conditionals for Makefiles
225752dc082bSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225852dc082bSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225952dc082bSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226052dc082bSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226152dc082bSmrg]) # XORG_WITH_GROFF
22629f00f3a1Smrg
226352dc082bSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226452dc082bSmrg# ---------------------------------------
226552dc082bSmrg# Minimum version: 1.6.0
226652dc082bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
226752dc082bSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226852dc082bSmrg#
226952dc082bSmrg# Documentation tools are not always available on all platforms and sometimes
227052dc082bSmrg# not at the appropriate level. This macro enables a module to test for the
227152dc082bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
227252dc082bSmrg# the --with-fop option, it allows maximum flexibility in making decisions
227352dc082bSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
227452dc082bSmrg# --with-fop assumes 'auto'.
227552dc082bSmrg#
227652dc082bSmrg# Interface to module:
227752dc082bSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227852dc082bSmrg# FOP:	 	returns the path of the fop program found
227952dc082bSmrg#		returns the path set by the user in the environment
228052dc082bSmrg# --with-fop: 	'yes' user instructs the module to use fop
228152dc082bSmrg#		'no' user instructs the module not to use fop
228252dc082bSmrg#
228352dc082bSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228452dc082bSmrg#
228552dc082bSmrgAC_DEFUN([XORG_WITH_FOP],[
228652dc082bSmrgAC_ARG_VAR([FOP], [Path to fop command])
228752dc082bSmrgm4_define([_defopt], m4_default([$2], [auto]))
228852dc082bSmrgAC_ARG_WITH(fop,
228952dc082bSmrg	AS_HELP_STRING([--with-fop],
229052dc082bSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229152dc082bSmrg	   [use_fop=$withval], [use_fop=]_defopt)
229252dc082bSmrgm4_undefine([_defopt])
2293a966c04fSmrg
229452dc082bSmrgif test "x$use_fop" = x"auto"; then
229552dc082bSmrg   AC_PATH_PROG([FOP], [fop])
229652dc082bSmrg   if test "x$FOP" = "x"; then
229752dc082bSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229852dc082bSmrg	have_fop=no
229952dc082bSmrg   else
230052dc082bSmrg        have_fop=yes
230152dc082bSmrg   fi
230252dc082bSmrgelif test "x$use_fop" = x"yes" ; then
230352dc082bSmrg   AC_PATH_PROG([FOP], [fop])
230452dc082bSmrg   if test "x$FOP" = "x"; then
230552dc082bSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230652dc082bSmrg   fi
230752dc082bSmrg   have_fop=yes
230852dc082bSmrgelif test "x$use_fop" = x"no" ; then
230952dc082bSmrg   if test "x$FOP" != "x"; then
231052dc082bSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231152dc082bSmrg   fi
231252dc082bSmrg   have_fop=no
231352dc082bSmrgelse
231452dc082bSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
23151c235774Smrgfi
2316a966c04fSmrg
231752dc082bSmrg# Test for a minimum version of fop, if provided.
231852dc082bSmrgm4_ifval([$1],
231952dc082bSmrg[if test "$have_fop" = yes; then
232052dc082bSmrg    # scrape the fop version
232152dc082bSmrg    AC_MSG_CHECKING([for fop minimum version])
232252dc082bSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232352dc082bSmrg    AC_MSG_RESULT([$fop_version])
232452dc082bSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
232552dc082bSmrg        [if test "x$use_fop" = xauto; then
232652dc082bSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232752dc082bSmrg            have_fop=no
232852dc082bSmrg        else
232952dc082bSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233052dc082bSmrg        fi])
233152dc082bSmrgfi])
233252dc082bSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233352dc082bSmrg]) # XORG_WITH_FOP
23349f00f3a1Smrg
233552dc082bSmrg# XORG_WITH_M4([MIN-VERSION])
233652dc082bSmrg# ---------------------------
233752dc082bSmrg# Minimum version: 1.19.0
233819569120Smrg#
233952dc082bSmrg# This macro attempts to locate an m4 macro processor which supports
234052dc082bSmrg# -I option and is only useful for modules relying on M4 in order to
234152dc082bSmrg# expand macros in source code files.
234252dc082bSmrg#
234352dc082bSmrg# Interface to module:
234452dc082bSmrg# M4:	 	returns the path of the m4 program found
234552dc082bSmrg#		returns the path set by the user in the environment
234652dc082bSmrg#
234752dc082bSmrgAC_DEFUN([XORG_WITH_M4], [
234852dc082bSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234952dc082bSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235052dc082bSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235152dc082bSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235252dc082bSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235352dc082bSmrg   [$PATH:/usr/gnu/bin])])
23541c235774Smrg
235552dc082bSmrgAC_SUBST([M4], [$ac_cv_path_M4])
235652dc082bSmrg]) # XORG_WITH_M4
235752dc082bSmrg
235852dc082bSmrg# XORG_WITH_PS2PDF([DEFAULT])
235952dc082bSmrg# ----------------
236052dc082bSmrg# Minimum version: 1.6.0
236152dc082bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
236252dc082bSmrg#
236352dc082bSmrg# Documentation tools are not always available on all platforms and sometimes
236452dc082bSmrg# not at the appropriate level. This macro enables a module to test for the
236552dc082bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
236652dc082bSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
236752dc082bSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236852dc082bSmrg# --with-ps2pdf assumes 'auto'.
236952dc082bSmrg#
237052dc082bSmrg# Interface to module:
237152dc082bSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237252dc082bSmrg# PS2PDF:	returns the path of the ps2pdf program found
237352dc082bSmrg#		returns the path set by the user in the environment
237452dc082bSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237552dc082bSmrg#		 'no' user instructs the module not to use ps2pdf
237652dc082bSmrg#
237752dc082bSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237852dc082bSmrg#
237952dc082bSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238052dc082bSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238152dc082bSmrgm4_define([_defopt], m4_default([$1], [auto]))
238252dc082bSmrgAC_ARG_WITH(ps2pdf,
238352dc082bSmrg	AS_HELP_STRING([--with-ps2pdf],
238452dc082bSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238552dc082bSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238652dc082bSmrgm4_undefine([_defopt])
23871c235774Smrg
238852dc082bSmrgif test "x$use_ps2pdf" = x"auto"; then
238952dc082bSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239052dc082bSmrg   if test "x$PS2PDF" = "x"; then
239152dc082bSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239252dc082bSmrg	have_ps2pdf=no
239352dc082bSmrg   else
239452dc082bSmrg        have_ps2pdf=yes
239552dc082bSmrg   fi
239652dc082bSmrgelif test "x$use_ps2pdf" = x"yes" ; then
239752dc082bSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239852dc082bSmrg   if test "x$PS2PDF" = "x"; then
239952dc082bSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240052dc082bSmrg   fi
240152dc082bSmrg   have_ps2pdf=yes
240252dc082bSmrgelif test "x$use_ps2pdf" = x"no" ; then
240352dc082bSmrg   if test "x$PS2PDF" != "x"; then
240452dc082bSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240552dc082bSmrg   fi
240652dc082bSmrg   have_ps2pdf=no
240752dc082bSmrgelse
240852dc082bSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
240952dc082bSmrgfi
241052dc082bSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241152dc082bSmrg]) # XORG_WITH_PS2PDF
24121c235774Smrg
241352dc082bSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
241452dc082bSmrg# ----------------
241552dc082bSmrg# Minimum version: 1.6.0
241652dc082bSmrg#
241752dc082bSmrg# Documentation tools are not always available on all platforms and sometimes
241852dc082bSmrg# not at the appropriate level. This macro enables a builder to skip all
241952dc082bSmrg# documentation targets except traditional man pages.
242052dc082bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242152dc082bSmrg# maximum flexibility in controlling documentation building.
242252dc082bSmrg# Refer to:
242352dc082bSmrg# XORG_WITH_XMLTO         --with-xmlto
242452dc082bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242552dc082bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
242652dc082bSmrg# XORG_WITH_FOP           --with-fop
242752dc082bSmrg# XORG_WITH_GROFF         --with-groff
242852dc082bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
242919569120Smrg#
243052dc082bSmrg# Interface to module:
243152dc082bSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243252dc082bSmrg# --enable-docs: 'yes' user instructs the module to generate docs
243352dc082bSmrg#		 'no' user instructs the module not to generate docs
243452dc082bSmrg# parm1:	specify the default value, yes or no.
24351c235774Smrg#
243652dc082bSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243752dc082bSmrgm4_define([docs_default], m4_default([$1], [yes]))
243852dc082bSmrgAC_ARG_ENABLE(docs,
243952dc082bSmrg	AS_HELP_STRING([--enable-docs],
244052dc082bSmrg	   [Enable building the documentation (default: ]docs_default[)]),
244152dc082bSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
244252dc082bSmrgm4_undefine([docs_default])
244352dc082bSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244452dc082bSmrgAC_MSG_CHECKING([whether to build documentation])
244552dc082bSmrgAC_MSG_RESULT([$build_docs])
244652dc082bSmrg]) # XORG_ENABLE_DOCS
24471c235774Smrg
244852dc082bSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244952dc082bSmrg# ----------------
245052dc082bSmrg# Minimum version: 1.6.0
245152dc082bSmrg#
245252dc082bSmrg# This macro enables a builder to skip all developer documentation.
245352dc082bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245452dc082bSmrg# maximum flexibility in controlling documentation building.
245552dc082bSmrg# Refer to:
245652dc082bSmrg# XORG_WITH_XMLTO         --with-xmlto
245752dc082bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245852dc082bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
245952dc082bSmrg# XORG_WITH_FOP           --with-fop
246052dc082bSmrg# XORG_WITH_GROFF         --with-groff
246152dc082bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
246252dc082bSmrg#
246352dc082bSmrg# Interface to module:
246452dc082bSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246552dc082bSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246652dc082bSmrg#			'no' user instructs the module not to generate developer docs
246752dc082bSmrg# parm1:		specify the default value, yes or no.
246852dc082bSmrg#
246952dc082bSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247052dc082bSmrgm4_define([devel_default], m4_default([$1], [yes]))
247152dc082bSmrgAC_ARG_ENABLE(devel-docs,
247252dc082bSmrg	AS_HELP_STRING([--enable-devel-docs],
247352dc082bSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247452dc082bSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247552dc082bSmrgm4_undefine([devel_default])
247652dc082bSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247752dc082bSmrgAC_MSG_CHECKING([whether to build developer documentation])
247852dc082bSmrgAC_MSG_RESULT([$build_devel_docs])
247952dc082bSmrg]) # XORG_ENABLE_DEVEL_DOCS
24801c235774Smrg
248152dc082bSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
248252dc082bSmrg# ----------------
248352dc082bSmrg# Minimum version: 1.6.0
248452dc082bSmrg#
248552dc082bSmrg# This macro enables a builder to skip all functional specification targets.
248652dc082bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248752dc082bSmrg# maximum flexibility in controlling documentation building.
248852dc082bSmrg# Refer to:
248952dc082bSmrg# XORG_WITH_XMLTO         --with-xmlto
249052dc082bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249152dc082bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
249252dc082bSmrg# XORG_WITH_FOP           --with-fop
249352dc082bSmrg# XORG_WITH_GROFF         --with-groff
249452dc082bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
249552dc082bSmrg#
249652dc082bSmrg# Interface to module:
249752dc082bSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249852dc082bSmrg# --enable-specs:	'yes' user instructs the module to generate specs
249952dc082bSmrg#			'no' user instructs the module not to generate specs
250052dc082bSmrg# parm1:		specify the default value, yes or no.
250152dc082bSmrg#
250252dc082bSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250352dc082bSmrgm4_define([spec_default], m4_default([$1], [yes]))
250452dc082bSmrgAC_ARG_ENABLE(specs,
250552dc082bSmrg	AS_HELP_STRING([--enable-specs],
250652dc082bSmrg	   [Enable building the specs (default: ]spec_default[)]),
250752dc082bSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
250852dc082bSmrgm4_undefine([spec_default])
250952dc082bSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251052dc082bSmrgAC_MSG_CHECKING([whether to build functional specifications])
251152dc082bSmrgAC_MSG_RESULT([$build_specs])
251252dc082bSmrg]) # XORG_ENABLE_SPECS
2513a966c04fSmrg
251452dc082bSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251552dc082bSmrg# ----------------------------------------------
251652dc082bSmrg# Minimum version: 1.13.0
251752dc082bSmrg#
251852dc082bSmrg# This macro enables a builder to enable/disable unit testing
251952dc082bSmrg# It makes no assumption about the test cases implementation
252052dc082bSmrg# Test cases may or may not use Automake "Support for test suites"
252152dc082bSmrg# They may or may not use the software utility library GLib
252252dc082bSmrg#
252352dc082bSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252452dc082bSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252552dc082bSmrg# The variable enable_unit_tests is used by other macros in this file.
252652dc082bSmrg#
252752dc082bSmrg# Interface to module:
252852dc082bSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252952dc082bSmrg# enable_unit_tests:    used in configure.ac for additional configuration
253052dc082bSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253152dc082bSmrg#			'no' user instructs the module not to build tests
253252dc082bSmrg# parm1:		specify the default value, yes or no.
253352dc082bSmrg#
253452dc082bSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253552dc082bSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253652dc082bSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253752dc082bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253852dc082bSmrgm4_define([_defopt], m4_default([$1], [auto]))
253952dc082bSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254052dc082bSmrg	[Enable building unit test cases (default: ]_defopt[)]),
254152dc082bSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254252dc082bSmrgm4_undefine([_defopt])
254352dc082bSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254452dc082bSmrgAC_MSG_CHECKING([whether to build unit test cases])
254552dc082bSmrgAC_MSG_RESULT([$enable_unit_tests])
254652dc082bSmrg]) # XORG_ENABLE_UNIT_TESTS
2547a966c04fSmrg
254852dc082bSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254952dc082bSmrg# ------------------------------------------------------
255052dc082bSmrg# Minimum version: 1.17.0
255152dc082bSmrg#
255252dc082bSmrg# This macro enables a builder to enable/disable integration testing
255352dc082bSmrg# It makes no assumption about the test cases' implementation
255452dc082bSmrg# Test cases may or may not use Automake "Support for test suites"
255552dc082bSmrg#
255652dc082bSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255752dc082bSmrg# usually requires less dependencies and may be built and run under less
255852dc082bSmrg# stringent environments than integration tests.
255952dc082bSmrg#
256052dc082bSmrg# Interface to module:
256152dc082bSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256252dc082bSmrg# enable_integration_tests:   used in configure.ac for additional configuration
256352dc082bSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256452dc082bSmrg#                             'no' user instructs the module not to build tests
256552dc082bSmrg# parm1:                      specify the default value, yes or no.
256652dc082bSmrg#
256752dc082bSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256852dc082bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256952dc082bSmrgm4_define([_defopt], m4_default([$1], [auto]))
257052dc082bSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257152dc082bSmrg	[Enable building integration test cases (default: ]_defopt[)]),
257252dc082bSmrg	[enable_integration_tests=$enableval],
257352dc082bSmrg	[enable_integration_tests=]_defopt)
257452dc082bSmrgm4_undefine([_defopt])
257552dc082bSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257652dc082bSmrg	[test "x$enable_integration_tests" != xno])
257752dc082bSmrgAC_MSG_CHECKING([whether to build unit test cases])
257852dc082bSmrgAC_MSG_RESULT([$enable_integration_tests])
257952dc082bSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580a966c04fSmrg
258152dc082bSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258252dc082bSmrg# ----------------------------------------
258352dc082bSmrg# Minimum version: 1.13.0
258452dc082bSmrg#
258552dc082bSmrg# GLib is a library which provides advanced data structures and functions.
258652dc082bSmrg# This macro enables a module to test for the presence of Glib.
258752dc082bSmrg#
258852dc082bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258952dc082bSmrg# Otherwise the value of $enable_unit_tests is blank.
259052dc082bSmrg#
259152dc082bSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259252dc082bSmrg# test support usually requires less dependencies and may be built and run under
259352dc082bSmrg# less stringent environments than integration tests.
259452dc082bSmrg#
259552dc082bSmrg# Interface to module:
259652dc082bSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
259752dc082bSmrg# with_glib: used in configure.ac to know if GLib has been found
259852dc082bSmrg# --with-glib:	'yes' user instructs the module to use glib
259952dc082bSmrg#		'no' user instructs the module not to use glib
260052dc082bSmrg#
260152dc082bSmrgAC_DEFUN([XORG_WITH_GLIB],[
260252dc082bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260352dc082bSmrgm4_define([_defopt], m4_default([$2], [auto]))
260452dc082bSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260552dc082bSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260652dc082bSmrg	[with_glib=$withval], [with_glib=]_defopt)
260752dc082bSmrgm4_undefine([_defopt])
26082e2dd055Smrg
260952dc082bSmrghave_glib=no
261052dc082bSmrg# Do not probe GLib if user explicitly disabled unit testing
261152dc082bSmrgif test "x$enable_unit_tests" != x"no"; then
261252dc082bSmrg  # Do not probe GLib if user explicitly disabled it
261352dc082bSmrg  if test "x$with_glib" != x"no"; then
261452dc082bSmrg    m4_ifval(
261552dc082bSmrg      [$1],
261652dc082bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261752dc082bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261852dc082bSmrg    )
261952dc082bSmrg  fi
262074835918Smrgfi
262152dc082bSmrg
262252dc082bSmrg# Not having GLib when unit testing has been explicitly requested is an error
262352dc082bSmrgif test "x$enable_unit_tests" = x"yes"; then
262452dc082bSmrg  if test "x$have_glib" = x"no"; then
262552dc082bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
262652dc082bSmrg  fi
262774835918Smrgfi
262852dc082bSmrg
262952dc082bSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
263052dc082bSmrgif test "x$enable_unit_tests" = x"no"; then
263152dc082bSmrg  if test "x$with_glib" = x"yes"; then
263252dc082bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263352dc082bSmrg  fi
263474835918Smrgfi
263574835918Smrg
263652dc082bSmrg# Not having GLib when it has been explicitly requested is an error
263752dc082bSmrgif test "x$with_glib" = x"yes"; then
263852dc082bSmrg  if test "x$have_glib" = x"no"; then
263952dc082bSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264052dc082bSmrg  fi
264152dc082bSmrgfi
26421c235774Smrg
264352dc082bSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264452dc082bSmrg]) # XORG_WITH_GLIB
26452e2dd055Smrg
264652dc082bSmrg# XORG_LD_WRAP([required|optional])
264752dc082bSmrg# ---------------------------------
264852dc082bSmrg# Minimum version: 1.13.0
264952dc082bSmrg#
265052dc082bSmrg# Check if linker supports -wrap, passed via compiler flags
265152dc082bSmrg#
265252dc082bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265352dc082bSmrg# Otherwise the value of $enable_unit_tests is blank.
265452dc082bSmrg#
265552dc082bSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265652dc082bSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265752dc082bSmrg# available, an argument of "optional" allows use when some unit tests require
265852dc082bSmrg# ld -wrap and others do not.
265952dc082bSmrg#
266052dc082bSmrgAC_DEFUN([XORG_LD_WRAP],[
266152dc082bSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266252dc082bSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266352dc082bSmrg                      void __wrap_exit(int status) { return; }],
266452dc082bSmrg                     [exit(0);])])
266552dc082bSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
266652dc082bSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266752dc082bSmrg  if test "x$have_ld_wrap" = x"no"; then
266852dc082bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266952dc082bSmrg  fi
267052dc082bSmrgfi
267152dc082bSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267252dc082bSmrg#
267352dc082bSmrg]) # XORG_LD_WRAP
26742e2dd055Smrg
267552dc082bSmrg# XORG_CHECK_LINKER_FLAGS
267652dc082bSmrg# -----------------------
267752dc082bSmrg# SYNOPSIS
267852dc082bSmrg#
267952dc082bSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268052dc082bSmrg#
268152dc082bSmrg# DESCRIPTION
268252dc082bSmrg#
268352dc082bSmrg#   Check whether the given linker FLAGS work with the current language's
268452dc082bSmrg#   linker, or whether they give an error.
268552dc082bSmrg#
268652dc082bSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268752dc082bSmrg#   success/failure.
268852dc082bSmrg#
268952dc082bSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
269052dc082bSmrg#
269152dc082bSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269252dc082bSmrg#
269352dc082bSmrg# LICENSE
269452dc082bSmrg#
269552dc082bSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269652dc082bSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269752dc082bSmrg#   Copyright (c) 2009 Matteo Frigo
269852dc082bSmrg#
269952dc082bSmrg#   This program is free software: you can redistribute it and/or modify it
270052dc082bSmrg#   under the terms of the GNU General Public License as published by the
270152dc082bSmrg#   Free Software Foundation, either version 3 of the License, or (at your
270252dc082bSmrg#   option) any later version.
270352dc082bSmrg#
270452dc082bSmrg#   This program is distributed in the hope that it will be useful, but
270552dc082bSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270652dc082bSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270752dc082bSmrg#   Public License for more details.
270852dc082bSmrg#
270952dc082bSmrg#   You should have received a copy of the GNU General Public License along
271052dc082bSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271152dc082bSmrg#
271252dc082bSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
271352dc082bSmrg#   gives unlimited permission to copy, distribute and modify the configure
271452dc082bSmrg#   scripts that are the output of Autoconf when processing the Macro. You
271552dc082bSmrg#   need not follow the terms of the GNU General Public License when using
271652dc082bSmrg#   or distributing such scripts, even though portions of the text of the
271752dc082bSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271852dc082bSmrg#   all other use of the material that constitutes the Autoconf Macro.
271952dc082bSmrg#
272052dc082bSmrg#   This special exception to the GPL applies to versions of the Autoconf
272152dc082bSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
272252dc082bSmrg#   modified version of the Autoconf Macro, you may extend this special
272352dc082bSmrg#   exception to the GPL to apply to your modified version as well.#
272452dc082bSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272552dc082bSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
272652dc082bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272752dc082bSmrgAS_LITERAL_IF([$1],
272852dc082bSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272952dc082bSmrg      ax_save_FLAGS=$LDFLAGS
273052dc082bSmrg      LDFLAGS="$1"
273152dc082bSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273252dc082bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273352dc082bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273452dc082bSmrg      LDFLAGS=$ax_save_FLAGS])],
273552dc082bSmrg  [ax_save_FLAGS=$LDFLAGS
273652dc082bSmrg   LDFLAGS="$1"
273752dc082bSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273852dc082bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273952dc082bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274052dc082bSmrg   LDFLAGS=$ax_save_FLAGS])
274152dc082bSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274252dc082bSmrgAC_MSG_RESULT($xorg_check_linker_flags)
274352dc082bSmrgif test "x$xorg_check_linker_flags" = xyes; then
274452dc082bSmrg	m4_default([$2], :)
274552dc082bSmrgelse
274652dc082bSmrg	m4_default([$3], :)
274752dc082bSmrgfi
274852dc082bSmrg]) # XORG_CHECK_LINKER_FLAGS
27492e2dd055Smrg
275052dc082bSmrg# XORG_MEMORY_CHECK_FLAGS
275152dc082bSmrg# -----------------------
275252dc082bSmrg# Minimum version: 1.16.0
275352dc082bSmrg#
275452dc082bSmrg# This macro attempts to find appropriate memory checking functionality
275552dc082bSmrg# for various platforms which unit testing code may use to catch various
275652dc082bSmrg# forms of memory allocation and access errors in testing.
275752dc082bSmrg#
275852dc082bSmrg# Interface to module:
275952dc082bSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276052dc082bSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276152dc082bSmrg#
276252dc082bSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276352dc082bSmrg#
276452dc082bSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765a966c04fSmrg
276652dc082bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
276752dc082bSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276852dc082bSmrg           [Environment variables to enable memory checking in tests])
27691c235774Smrg
277052dc082bSmrg# Check for different types of support on different platforms
277152dc082bSmrgcase $host_os in
277252dc082bSmrg    solaris*)
277352dc082bSmrg        AC_CHECK_LIB([umem], [umem_alloc],
277452dc082bSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277552dc082bSmrg        ;;
277652dc082bSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277752dc082bSmrg        # both directly and inverted, so should not be 0 or 255.
277852dc082bSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
277952dc082bSmrg        ;;
278052dc082bSmrg    darwin*)
278152dc082bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278252dc082bSmrg        ;;
278352dc082bSmrg    *bsd*)
278452dc082bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278552dc082bSmrg        ;;
278652dc082bSmrgesac
27871c235774Smrg
278852dc082bSmrg# User supplied flags override default flags
278952dc082bSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279052dc082bSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791edce3322Smrgfi
27921c235774Smrg
279352dc082bSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279452dc082bSmrg]) # XORG_WITH_LINT
27951c235774Smrg
279652dc082bSmrg# XORG_CHECK_MALLOC_ZERO
279752dc082bSmrg# ----------------------
279852dc082bSmrg# Minimum version: 1.0.0
279997cf2ee2Smrg#
280052dc082bSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280152dc082bSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280252dc082bSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280352dc082bSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280452dc082bSmrgAC_ARG_ENABLE(malloc0returnsnull,
280552dc082bSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280652dc082bSmrg		       [malloc(0) returns NULL (default: auto)]),
280752dc082bSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280852dc082bSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
28096e7d3316Smrg
281052dc082bSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281152dc082bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281252dc082bSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281352dc082bSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281452dc082bSmrg#include <stdlib.h>
281552dc082bSmrg],[
281652dc082bSmrg    char *m0, *r0, *c0, *p;
281752dc082bSmrg    m0 = malloc(0);
281852dc082bSmrg    p = malloc(10);
281952dc082bSmrg    r0 = realloc(p,0);
282052dc082bSmrg    c0 = calloc(0,10);
282152dc082bSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282252dc082bSmrg])],
282352dc082bSmrg		[xorg_cv_malloc0_returns_null=yes],
282452dc082bSmrg		[xorg_cv_malloc0_returns_null=no])])
282552dc082bSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28269f00f3a1Smrgfi
282752dc082bSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
28281c235774Smrg
282952dc082bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283052dc082bSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283152dc082bSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283252dc082bSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
283397cf2ee2Smrgelse
283452dc082bSmrg	MALLOC_ZERO_CFLAGS=""
283552dc082bSmrg	XMALLOC_ZERO_CFLAGS=""
283652dc082bSmrg	XTMALLOC_ZERO_CFLAGS=""
283797cf2ee2Smrgfi
28386e7d3316Smrg
283952dc082bSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284052dc082bSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284152dc082bSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284252dc082bSmrg]) # XORG_CHECK_MALLOC_ZERO
28436e7d3316Smrg
284452dc082bSmrg# XORG_WITH_LINT()
284552dc082bSmrg# ----------------
284652dc082bSmrg# Minimum version: 1.1.0
284719569120Smrg#
284852dc082bSmrg# This macro enables the use of a tool that flags some suspicious and
284952dc082bSmrg# non-portable constructs (likely to be bugs) in C language source code.
285052dc082bSmrg# It will attempt to locate the tool and use appropriate options.
285152dc082bSmrg# There are various lint type tools on different platforms.
28521c235774Smrg#
285352dc082bSmrg# Interface to module:
285452dc082bSmrg# LINT:		returns the path to the tool found on the platform
285552dc082bSmrg#		or the value set to LINT on the configure cmd line
285652dc082bSmrg#		also an Automake conditional
285752dc082bSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
285852dc082bSmrg#
285952dc082bSmrg# --with-lint:	'yes' user instructs the module to use lint
286052dc082bSmrg#		'no' user instructs the module not to use lint (default)
286152dc082bSmrg#
286252dc082bSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286352dc082bSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286452dc082bSmrg#
286552dc082bSmrgAC_DEFUN([XORG_WITH_LINT],[
28661c235774Smrg
286752dc082bSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286852dc082bSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286952dc082bSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287052dc082bSmrg		[Use a lint-style source code checker (default: disabled)])],
287152dc082bSmrg		[use_lint=$withval], [use_lint=no])
28721c235774Smrg
287352dc082bSmrg# Obtain platform specific info like program name and options
287452dc082bSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287552dc082bSmrgcase $host_os in
287652dc082bSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287752dc082bSmrg	lint_name=splint
287852dc082bSmrg	lint_options="-badflag"
287952dc082bSmrg	;;
288052dc082bSmrg  *freebsd* | *netbsd*)
288152dc082bSmrg	lint_name=lint
288252dc082bSmrg	lint_options="-u -b"
288352dc082bSmrg	;;
288452dc082bSmrg  *solaris*)
288552dc082bSmrg	lint_name=lint
288652dc082bSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288752dc082bSmrg	;;
288852dc082bSmrgesac
288952dc082bSmrg
289052dc082bSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289152dc082bSmrgif test "x$use_lint" = x"yes" ; then
289252dc082bSmrg   AC_PATH_PROG([LINT], [$lint_name])
289352dc082bSmrg   if test "x$LINT" = "x"; then
289452dc082bSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289552dc082bSmrg   fi
289652dc082bSmrgelif test "x$use_lint" = x"no" ; then
289752dc082bSmrg   if test "x$LINT" != "x"; then
289852dc082bSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289952dc082bSmrg   fi
29001c235774Smrgelse
290152dc082bSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
290219569120Smrgfi
290319569120Smrg
290452dc082bSmrg# User supplied flags override default flags
290552dc082bSmrgif test "x$LINT_FLAGS" != "x"; then
290652dc082bSmrg   lint_options=$LINT_FLAGS
290752dc082bSmrgfi
2908a966c04fSmrg
290952dc082bSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291052dc082bSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
29119f00f3a1Smrg
291252dc082bSmrg]) # XORG_WITH_LINT
29139f00f3a1Smrg
291452dc082bSmrg# XORG_LINT_LIBRARY(LIBNAME)
291552dc082bSmrg# --------------------------
291652dc082bSmrg# Minimum version: 1.1.0
29179f00f3a1Smrg#
291852dc082bSmrg# Sets up flags for building lint libraries for checking programs that call
291952dc082bSmrg# functions in the library.
292052dc082bSmrg#
292152dc082bSmrg# Interface to module:
292252dc082bSmrg# LINTLIB		- Automake variable with the name of lint library file to make
292352dc082bSmrg# MAKE_LINT_LIB		- Automake conditional
292452dc082bSmrg#
292552dc082bSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292652dc082bSmrg#			  - 'no' user instructs the module not to create a lint library (default)
292797cf2ee2Smrg
292852dc082bSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292952dc082bSmrgAC_REQUIRE([XORG_WITH_LINT])
293052dc082bSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293152dc082bSmrg	[Create lint library (default: disabled)])],
293252dc082bSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293352dc082bSmrg
293452dc082bSmrgif test "x$make_lint_lib" = x"yes" ; then
293552dc082bSmrg   LINTLIB=llib-l$1.ln
293652dc082bSmrg   if test "x$LINT" = "x"; then
293752dc082bSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293852dc082bSmrg   fi
293952dc082bSmrgelif test "x$make_lint_lib" != x"no" ; then
294052dc082bSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
294197cf2ee2Smrgfi
294219569120Smrg
294352dc082bSmrgAC_SUBST(LINTLIB)
294452dc082bSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
294519569120Smrg
294652dc082bSmrg]) # XORG_LINT_LIBRARY
294719569120Smrg
294852dc082bSmrg# XORG_COMPILER_BRAND
29491c235774Smrg# -------------------
295052dc082bSmrg# Minimum version: 1.14.0
29511c235774Smrg#
295252dc082bSmrg# Checks for various brands of compilers and sets flags as appropriate:
295352dc082bSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295452dc082bSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295552dc082bSmrg#   clang compiler - sets CLANGCC to "yes"
295652dc082bSmrg#   Intel compiler - sets INTELCC to "yes"
295752dc082bSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295852dc082bSmrg#
295952dc082bSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296052dc082bSmrgAC_LANG_CASE(
296152dc082bSmrg	[C], [
296252dc082bSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
296352dc082bSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
296452dc082bSmrg		m4_version_prereq([2.70],
296552dc082bSmrg			[AC_REQUIRE([AC_PROG_CC])],
296652dc082bSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
296752dc082bSmrg	],
296852dc082bSmrg	[C++], [
296952dc082bSmrg		AC_REQUIRE([AC_PROG_CXX])
297052dc082bSmrg	]
297152dc082bSmrg)
297252dc082bSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
297352dc082bSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297452dc082bSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297552dc082bSmrg]) # XORG_COMPILER_BRAND
297619569120Smrg
297752dc082bSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
29781c235774Smrg# ---------------
297952dc082bSmrg# Minimum version: 1.16.0
298052dc082bSmrg#
298152dc082bSmrg# Test if the compiler works when passed the given flag as a command line argument.
298252dc082bSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
298352dc082bSmrg# next flag in the list until there are no more options.
298452dc082bSmrg#
298552dc082bSmrg# Note that this does not guarantee that the compiler supports the flag as some
298652dc082bSmrg# compilers will simply ignore arguments that they do not understand, but we do
298752dc082bSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298852dc082bSmrg# -Werror=unused-command-line-argument
298952dc082bSmrg#
299052dc082bSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
299152dc082bSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
299252dc082bSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29931c235774Smrg
299452dc082bSmrgAC_LANG_COMPILER_REQUIRE
299519569120Smrg
299652dc082bSmrgAC_LANG_CASE(
299752dc082bSmrg	[C], [
299852dc082bSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
299952dc082bSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
300052dc082bSmrg		m4_version_prereq([2.70],
300152dc082bSmrg			[AC_REQUIRE([AC_PROG_CC])],
300252dc082bSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
300352dc082bSmrg		define([PREFIX], [C])
300452dc082bSmrg		define([CACHE_PREFIX], [cc])
300552dc082bSmrg		define([COMPILER], [$CC])
300652dc082bSmrg	],
300752dc082bSmrg	[C++], [
300852dc082bSmrg		define([PREFIX], [CXX])
300952dc082bSmrg		define([CACHE_PREFIX], [cxx])
301052dc082bSmrg		define([COMPILER], [$CXX])
301152dc082bSmrg	]
301252dc082bSmrg)
301352dc082bSmrg
301452dc082bSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
301552dc082bSmrg
301652dc082bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
301752dc082bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301852dc082bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301952dc082bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
302052dc082bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302152dc082bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
302252dc082bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
302352dc082bSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
302452dc082bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30251c235774Smrgfi
302652dc082bSmrg
302752dc082bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302852dc082bSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302952dc082bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303052dc082bSmrg	fi
303152dc082bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
303252dc082bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
303352dc082bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
303452dc082bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
303552dc082bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
303652dc082bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
303752dc082bSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303852dc082bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303952dc082bSmrgfi
304052dc082bSmrg
304152dc082bSmrgfound="no"
304252dc082bSmrgm4_foreach([flag], m4_cdr($@), [
304352dc082bSmrg	if test $found = "no" ; then
304452dc082bSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
304552dc082bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
304652dc082bSmrg		fi
304752dc082bSmrg
304852dc082bSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304952dc082bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
305052dc082bSmrg		fi
305152dc082bSmrg
305252dc082bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
305352dc082bSmrg
305452dc082bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
305552dc082bSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
305652dc082bSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
305752dc082bSmrg		AC_CACHE_VAL($cacheid,
305852dc082bSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305952dc082bSmrg					     [eval $cacheid=yes],
306052dc082bSmrg					     [eval $cacheid=no])])
306152dc082bSmrg
306252dc082bSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
306352dc082bSmrg
306452dc082bSmrg		eval supported=\$$cacheid
306552dc082bSmrg		AC_MSG_RESULT([$supported])
306652dc082bSmrg		if test "$supported" = "yes" ; then
306752dc082bSmrg			$1="$$1 ]flag["
306852dc082bSmrg			found="yes"
306952dc082bSmrg		fi
307052dc082bSmrg	fi
30719f00f3a1Smrg])
307252dc082bSmrg]) # XORG_TESTSET_CFLAG
3073a966c04fSmrg
307452dc082bSmrg# XORG_COMPILER_FLAGS
307552dc082bSmrg# ---------------
307652dc082bSmrg# Minimum version: 1.16.0
307719569120Smrg#
307852dc082bSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307952dc082bSmrg# arguments supported by the selected compiler which do NOT alter the generated
308052dc082bSmrg# code.  These arguments will cause the compiler to print various warnings
308152dc082bSmrg# during compilation AND turn a conservative set of warnings into errors.
308252dc082bSmrg#
308352dc082bSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
308452dc082bSmrg# future versions of util-macros as options are added to new compilers.
308552dc082bSmrg#
308652dc082bSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
308752dc082bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
308819569120Smrg
308952dc082bSmrgAC_ARG_ENABLE(selective-werror,
309052dc082bSmrg              AS_HELP_STRING([--disable-selective-werror],
309152dc082bSmrg                             [Turn off selective compiler errors. (default: enabled)]),
309252dc082bSmrg              [SELECTIVE_WERROR=$enableval],
309352dc082bSmrg              [SELECTIVE_WERROR=yes])
309452dc082bSmrg
309552dc082bSmrgAC_LANG_CASE(
309652dc082bSmrg        [C], [
309752dc082bSmrg                define([PREFIX], [C])
309852dc082bSmrg        ],
309952dc082bSmrg        [C++], [
310052dc082bSmrg                define([PREFIX], [CXX])
310152dc082bSmrg        ]
310252dc082bSmrg)
310352dc082bSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
310452dc082bSmrgif test "x$SUNCC" = "xyes"; then
310552dc082bSmrg    [BASE_]PREFIX[FLAGS]="-v"
31061c235774Smrgelse
310752dc082bSmrg    [BASE_]PREFIX[FLAGS]=""
31089f00f3a1Smrgfi
31099f00f3a1Smrg
311052dc082bSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
311152dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
311252dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
311352dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
311452dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31152e2dd055Smrg
311652dc082bSmrgAC_LANG_CASE(
311752dc082bSmrg	[C], [
311852dc082bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311952dc082bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
312052dc082bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
312152dc082bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
312252dc082bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
312352dc082bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
312452dc082bSmrg	]
312552dc082bSmrg)
31262e2dd055Smrg
312752dc082bSmrg# This chunk adds additional warnings that could catch undesired effects.
312852dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312952dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
313052dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
313152dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
313252dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
313352dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
313452dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3135a966c04fSmrg
313652dc082bSmrg# These are currently disabled because they are noisy.  They will be enabled
313752dc082bSmrg# in the future once the codebase is sufficiently modernized to silence
313852dc082bSmrg# them.  For now, I don't want them to drown out the other warnings.
313952dc082bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
314052dc082bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
314152dc082bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3142a966c04fSmrg
314352dc082bSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
314452dc082bSmrg# when there are problems that should be fixed.
3145a966c04fSmrg
314652dc082bSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
314752dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314852dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314952dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
315052dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
315152dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
315252dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
315352dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
315452dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
315552dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
315652dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
315752dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315852dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315952dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
316052dc082bSmrgelse
316152dc082bSmrgAC_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])
316252dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
316352dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
316452dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
316552dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
316652dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
316752dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316852dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316952dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
317052dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
317152dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
317252dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
317352dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
317452dc082bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
317552dc082bSmrgfi
31766e7d3316Smrg
317752dc082bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317852dc082bSmrg]) # XORG_COMPILER_FLAGS
3179ac92798bSmrg
318052dc082bSmrg# XORG_CWARNFLAGS
318152dc082bSmrg# ---------------
318252dc082bSmrg# Minimum version: 1.2.0
318352dc082bSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
318419569120Smrg#
318552dc082bSmrg# Defines CWARNFLAGS to enable C compiler warnings.
318652dc082bSmrg#
318752dc082bSmrg# This function is deprecated because it defines -fno-strict-aliasing
318852dc082bSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318952dc082bSmrg# is needed, then it should be added explicitly in the module when
319052dc082bSmrg# it is updated to use BASE_CFLAGS.
319152dc082bSmrg#
319252dc082bSmrgAC_DEFUN([XORG_CWARNFLAGS], [
319352dc082bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
319452dc082bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
319552dc082bSmrgAC_LANG_CASE(
319652dc082bSmrg	[C], [
319752dc082bSmrg		CWARNFLAGS="$BASE_CFLAGS"
319852dc082bSmrg		if  test "x$GCC" = xyes ; then
319952dc082bSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
320052dc082bSmrg		fi
320152dc082bSmrg		AC_SUBST(CWARNFLAGS)
320252dc082bSmrg	]
320352dc082bSmrg)
320452dc082bSmrg]) # XORG_CWARNFLAGS
320552dc082bSmrg
320652dc082bSmrg# XORG_STRICT_OPTION
320752dc082bSmrg# -----------------------
320852dc082bSmrg# Minimum version: 1.3.0
320919569120Smrg#
321052dc082bSmrg# Add configure option to enable strict compilation flags, such as treating
321152dc082bSmrg# warnings as fatal errors.
321252dc082bSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
321352dc082bSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32141c235774Smrg#
321552dc082bSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
321652dc082bSmrg# when strict compilation is unconditionally desired.
321752dc082bSmrgAC_DEFUN([XORG_STRICT_OPTION], [
321852dc082bSmrgAC_REQUIRE([XORG_CWARNFLAGS])
321952dc082bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32209f00f3a1Smrg
322152dc082bSmrgAC_ARG_ENABLE(strict-compilation,
322252dc082bSmrg			  AS_HELP_STRING([--enable-strict-compilation],
322352dc082bSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
322452dc082bSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
32259f00f3a1Smrg
322652dc082bSmrgAC_LANG_CASE(
322752dc082bSmrg        [C], [
322852dc082bSmrg                define([PREFIX], [C])
322952dc082bSmrg        ],
323052dc082bSmrg        [C++], [
323152dc082bSmrg                define([PREFIX], [CXX])
323252dc082bSmrg        ]
323352dc082bSmrg)
32349f00f3a1Smrg
323552dc082bSmrg[STRICT_]PREFIX[FLAGS]=""
323652dc082bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
323752dc082bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
32389f00f3a1Smrg
323952dc082bSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
324052dc082bSmrg# activate it with -Werror, so we add it here explicitly.
324152dc082bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
32429f00f3a1Smrg
324352dc082bSmrgif test "x$STRICT_COMPILE" = "xyes"; then
324452dc082bSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
324552dc082bSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
324652dc082bSmrgfi
324752dc082bSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324852dc082bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324952dc082bSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
325052dc082bSmrg]) # XORG_STRICT_OPTION
32519f00f3a1Smrg
325252dc082bSmrg# XORG_DEFAULT_NOCODE_OPTIONS
325352dc082bSmrg# ---------------------------
325452dc082bSmrg# Minimum version: 1.20.0
325552dc082bSmrg#
325652dc082bSmrg# Defines default options for X.Org modules which don't compile code,
325752dc082bSmrg# such as fonts, bitmaps, cursors, and docs.
325852dc082bSmrg#
325952dc082bSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
326052dc082bSmrgAC_REQUIRE([AC_PROG_INSTALL])
326152dc082bSmrgXORG_RELEASE_VERSION
326252dc082bSmrgXORG_CHANGELOG
326352dc082bSmrgXORG_INSTALL
326452dc082bSmrgXORG_MANPAGE_SECTIONS
326552dc082bSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326652dc082bSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
326752dc082bSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
32689f00f3a1Smrg
326952dc082bSmrg# XORG_DEFAULT_OPTIONS
327052dc082bSmrg# --------------------
327152dc082bSmrg# Minimum version: 1.3.0
327252dc082bSmrg#
327352dc082bSmrg# Defines default options for X.Org modules which compile code.
327452dc082bSmrg#
327552dc082bSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
327652dc082bSmrgAC_REQUIRE([AC_PROG_INSTALL])
327752dc082bSmrgXORG_COMPILER_FLAGS
327852dc082bSmrgXORG_CWARNFLAGS
327952dc082bSmrgXORG_STRICT_OPTION
328052dc082bSmrgXORG_DEFAULT_NOCODE_OPTIONS
328152dc082bSmrg]) # XORG_DEFAULT_OPTIONS
3282a966c04fSmrg
328352dc082bSmrg# XORG_INSTALL()
328452dc082bSmrg# ----------------
328552dc082bSmrg# Minimum version: 1.4.0
328652dc082bSmrg#
328752dc082bSmrg# Defines the variable INSTALL_CMD as the command to copy
328852dc082bSmrg# INSTALL from $prefix/share/util-macros.
328952dc082bSmrg#
329052dc082bSmrgAC_DEFUN([XORG_INSTALL], [
329152dc082bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
329252dc082bSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
329352dc082bSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
329452dc082bSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
329552dc082bSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
329652dc082bSmrgtouch \$(top_srcdir)/INSTALL; \
329752dc082bSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
329852dc082bSmrgAC_SUBST([INSTALL_CMD])
329952dc082bSmrg]) # XORG_INSTALL
330052dc082bSmrgdnl Copyright 2005 Red Hat, Inc
330152dc082bSmrgdnl
330252dc082bSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
330352dc082bSmrgdnl documentation for any purpose is hereby granted without fee, provided that
330452dc082bSmrgdnl the above copyright notice appear in all copies and that both that
330552dc082bSmrgdnl copyright notice and this permission notice appear in supporting
330652dc082bSmrgdnl documentation.
330752dc082bSmrgdnl
330852dc082bSmrgdnl The above copyright notice and this permission notice shall be included
330952dc082bSmrgdnl in all copies or substantial portions of the Software.
331052dc082bSmrgdnl
331152dc082bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
331252dc082bSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
331352dc082bSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
331452dc082bSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
331552dc082bSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
331652dc082bSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
331752dc082bSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
331852dc082bSmrgdnl
331952dc082bSmrgdnl Except as contained in this notice, the name of the copyright holders shall
332052dc082bSmrgdnl not be used in advertising or otherwise to promote the sale, use or
332152dc082bSmrgdnl other dealings in this Software without prior written authorization
332252dc082bSmrgdnl from the copyright holders.
332352dc082bSmrgdnl
33249f00f3a1Smrg
332552dc082bSmrg# XORG_RELEASE_VERSION
332652dc082bSmrg# --------------------
332752dc082bSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33281c235774Smrg
332952dc082bSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
333052dc082bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
333152dc082bSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
333252dc082bSmrg		[Major version of this package])
333352dc082bSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
333452dc082bSmrg	if test "x$PVM" = "x"; then
333552dc082bSmrg		PVM="0"
333652dc082bSmrg	fi
333752dc082bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
333852dc082bSmrg		[$PVM],
333952dc082bSmrg		[Minor version of this package])
334052dc082bSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
334152dc082bSmrg	if test "x$PVP" = "x"; then
334252dc082bSmrg		PVP="0"
334352dc082bSmrg	fi
334452dc082bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
334552dc082bSmrg		[$PVP],
334652dc082bSmrg		[Patch version of this package])
334752dc082bSmrg])
33481c235774Smrg
334952dc082bSmrg# XORG_CHANGELOG()
335052dc082bSmrg# ----------------
335152dc082bSmrg# Minimum version: 1.2.0
335252dc082bSmrg#
335352dc082bSmrg# Defines the variable CHANGELOG_CMD as the command to generate
335452dc082bSmrg# ChangeLog from git.
335552dc082bSmrg#
335652dc082bSmrg#
335752dc082bSmrgAC_DEFUN([XORG_CHANGELOG], [
335852dc082bSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
335952dc082bSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
336052dc082bSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
336152dc082bSmrgtouch \$(top_srcdir)/ChangeLog; \
336252dc082bSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
336352dc082bSmrgAC_SUBST([CHANGELOG_CMD])
336452dc082bSmrg]) # XORG_CHANGELOG
33659f00f3a1Smrg
33669f00f3a1Smrgm4_include([m4/ax_define_dir.m4])
33679f00f3a1Smrgm4_include([m4/libtool.m4])
33689f00f3a1Smrgm4_include([m4/ltoptions.m4])
33699f00f3a1Smrgm4_include([m4/ltsugar.m4])
33709f00f3a1Smrgm4_include([m4/ltversion.m4])
33719f00f3a1Smrgm4_include([m4/lt~obsolete.m4])
3372