1889a2364Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
21b2353dbSmrg
3889a2364Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
421c2f794Smrg
521c2f794Smrg# This file is free software; the Free Software Foundation
621c2f794Smrg# gives unlimited permission to copy and/or distribute it,
721c2f794Smrg# with or without modifications, as long as this notice is preserved.
821c2f794Smrg
921c2f794Smrg# This program is distributed in the hope that it will be useful,
1021c2f794Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1121c2f794Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1221c2f794Smrg# PARTICULAR PURPOSE.
1321c2f794Smrg
141b2353dbSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1512391620Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1612391620Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17889a2364Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18889a2364Smrg[m4_warning([this file was generated for autoconf 2.71.
1912391620SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2012391620SmrgIf you have problems, you may need to regenerate the build system entirely.
211b2353dbSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2221c2f794Smrg
23889a2364Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2421c2f794Smrg#
2521c2f794Smrg# This file is free software; the Free Software Foundation
2621c2f794Smrg# gives unlimited permission to copy and/or distribute it,
2721c2f794Smrg# with or without modifications, as long as this notice is preserved.
2821c2f794Smrg
2921c2f794Smrg# AM_AUTOMAKE_VERSION(VERSION)
3021c2f794Smrg# ----------------------------
3121c2f794Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3221c2f794Smrg# generated from the m4 files accompanying Automake X.Y.
3321c2f794Smrg# (This private macro should not be called outside this file.)
3421c2f794SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35889a2364Smrg[am__api_version='1.16'
3621c2f794Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3721c2f794Smrgdnl require some minimum version.  Point them to the right macro.
38889a2364Smrgm4_if([$1], [1.16.5], [],
3921c2f794Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4021c2f794Smrg])
4121c2f794Smrg
4221c2f794Smrg# _AM_AUTOCONF_VERSION(VERSION)
4321c2f794Smrg# -----------------------------
4421c2f794Smrg# aclocal traces this macro to find the Autoconf version.
4521c2f794Smrg# This is a private macro too.  Using m4_define simplifies
4621c2f794Smrg# the logic in aclocal, which can simply ignore this definition.
4721c2f794Smrgm4_define([_AM_AUTOCONF_VERSION], [])
4821c2f794Smrg
4921c2f794Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5021c2f794Smrg# -------------------------------
5121c2f794Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5212391620Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5321c2f794SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54889a2364Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5512391620Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5612391620Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5712391620Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5821c2f794Smrg
5921c2f794Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6021c2f794Smrg
61889a2364Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6221c2f794Smrg#
6321c2f794Smrg# This file is free software; the Free Software Foundation
6421c2f794Smrg# gives unlimited permission to copy and/or distribute it,
6521c2f794Smrg# with or without modifications, as long as this notice is preserved.
6621c2f794Smrg
6721c2f794Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
681b2353dbSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
691b2353dbSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7021c2f794Smrg#
7121c2f794Smrg# Of course, Automake must honor this variable whenever it calls a
7221c2f794Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7321c2f794Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7421c2f794Smrg# depending on how configure is run.  This is pretty annoying, since
7521c2f794Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7621c2f794Smrg# source directory, any form will work fine, but in subdirectories a
7721c2f794Smrg# relative path needs to be adjusted first.
7821c2f794Smrg#
7921c2f794Smrg# $ac_aux_dir/missing
8021c2f794Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8121c2f794Smrg# $top_srcdir/$ac_aux_dir/missing
8221c2f794Smrg#    fails if $ac_aux_dir is absolute,
8321c2f794Smrg#    fails when called from a subdirectory in a VPATH build with
8421c2f794Smrg#          a relative $ac_aux_dir
8521c2f794Smrg#
8621c2f794Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8721c2f794Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
881b2353dbSmrg# harmless because $srcdir is '.', but things will broke when you
8921c2f794Smrg# start a VPATH build or use an absolute $srcdir.
9021c2f794Smrg#
9121c2f794Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9221c2f794Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9321c2f794Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9421c2f794Smrg# and then we would define $MISSING as
9521c2f794Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9621c2f794Smrg# This will work as long as MISSING is not called from configure, because
9721c2f794Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9821c2f794Smrg# However there are other variables, like CC, which are often used in
9921c2f794Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10021c2f794Smrg#
10121c2f794Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10221c2f794Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10321c2f794Smrg# configured tree to be moved without reconfiguration.
10421c2f794Smrg
10521c2f794SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106889a2364Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107889a2364Smrg# Expand $ac_aux_dir to an absolute path.
108889a2364Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10921c2f794Smrg])
11021c2f794Smrg
11121c2f794Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11221c2f794Smrg
113889a2364Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11421c2f794Smrg#
11521c2f794Smrg# This file is free software; the Free Software Foundation
11621c2f794Smrg# gives unlimited permission to copy and/or distribute it,
11721c2f794Smrg# with or without modifications, as long as this notice is preserved.
11821c2f794Smrg
11921c2f794Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12021c2f794Smrg# -------------------------------------
12121c2f794Smrg# Define a conditional.
12221c2f794SmrgAC_DEFUN([AM_CONDITIONAL],
1231b2353dbSmrg[AC_PREREQ([2.52])dnl
1241b2353dbSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1251b2353dbSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12621c2f794SmrgAC_SUBST([$1_TRUE])dnl
12721c2f794SmrgAC_SUBST([$1_FALSE])dnl
12821c2f794Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12921c2f794Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13012391620Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13121c2f794Smrgif $2; then
13221c2f794Smrg  $1_TRUE=
13321c2f794Smrg  $1_FALSE='#'
13421c2f794Smrgelse
13521c2f794Smrg  $1_TRUE='#'
13621c2f794Smrg  $1_FALSE=
13721c2f794Smrgfi
13821c2f794SmrgAC_CONFIG_COMMANDS_PRE(
13921c2f794Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14021c2f794Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14121c2f794SmrgUsually this means the macro was only invoked conditionally.]])
14221c2f794Smrgfi])])
14321c2f794Smrg
144889a2364Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14521c2f794Smrg#
14621c2f794Smrg# This file is free software; the Free Software Foundation
14721c2f794Smrg# gives unlimited permission to copy and/or distribute it,
14821c2f794Smrg# with or without modifications, as long as this notice is preserved.
14921c2f794Smrg
15021c2f794Smrg
1511b2353dbSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15221c2f794Smrg# written in clear, in which case automake, when reading aclocal.m4,
15321c2f794Smrg# will think it sees a *use*, and therefore will trigger all it's
15421c2f794Smrg# C support machinery.  Also note that it means that autoscan, seeing
15521c2f794Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15621c2f794Smrg
15721c2f794Smrg
15821c2f794Smrg# _AM_DEPENDENCIES(NAME)
15921c2f794Smrg# ----------------------
16021c2f794Smrg# See how the compiler implements dependency checking.
1611b2353dbSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16221c2f794Smrg# We try a few techniques and use that to set a single cache variable.
16321c2f794Smrg#
16421c2f794Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16521c2f794Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16621c2f794Smrg# dependency, and given that the user is not expected to run this macro,
16721c2f794Smrg# just rely on AC_PROG_CC.
16821c2f794SmrgAC_DEFUN([_AM_DEPENDENCIES],
16921c2f794Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17021c2f794SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17121c2f794SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17221c2f794SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17321c2f794Smrg
1741b2353dbSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1751b2353dbSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1761b2353dbSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1771b2353dbSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1781b2353dbSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1791b2353dbSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1801b2353dbSmrg                    [depcc="$$1"   am_compiler_list=])
18121c2f794Smrg
18221c2f794SmrgAC_CACHE_CHECK([dependency style of $depcc],
18321c2f794Smrg               [am_cv_$1_dependencies_compiler_type],
18421c2f794Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18521c2f794Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18621c2f794Smrg  # making bogus files that we don't know about and never remove.  For
18721c2f794Smrg  # instance it was reported that on HP-UX the gcc test will end up
1881b2353dbSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1891b2353dbSmrg  # in D".
19082e12b1bSmrg  rm -rf conftest.dir
19121c2f794Smrg  mkdir conftest.dir
19221c2f794Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19321c2f794Smrg  # using a relative directory.
19421c2f794Smrg  cp "$am_depcomp" conftest.dir
19521c2f794Smrg  cd conftest.dir
19621c2f794Smrg  # We will build objects and dependencies in a subdirectory because
19721c2f794Smrg  # it helps to detect inapplicable dependency modes.  For instance
19821c2f794Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19921c2f794Smrg  # side effect of compilation, but ICC will put the dependencies in
20021c2f794Smrg  # the current directory while Tru64 will put them in the object
20121c2f794Smrg  # directory.
20221c2f794Smrg  mkdir sub
20321c2f794Smrg
20421c2f794Smrg  am_cv_$1_dependencies_compiler_type=none
20521c2f794Smrg  if test "$am_compiler_list" = ""; then
20621c2f794Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20721c2f794Smrg  fi
20812391620Smrg  am__universal=false
20912391620Smrg  m4_case([$1], [CC],
21012391620Smrg    [case " $depcc " in #(
21112391620Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21212391620Smrg     esac],
21312391620Smrg    [CXX],
21412391620Smrg    [case " $depcc " in #(
21512391620Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21612391620Smrg     esac])
21712391620Smrg
21821c2f794Smrg  for depmode in $am_compiler_list; do
21921c2f794Smrg    # Setup a source with many dependencies, because some compilers
22021c2f794Smrg    # like to wrap large dependency lists on column 80 (with \), and
22121c2f794Smrg    # we should not choose a depcomp mode which is confused by this.
22221c2f794Smrg    #
22321c2f794Smrg    # We need to recreate these files for each test, as the compiler may
22421c2f794Smrg    # overwrite some of them when testing with obscure command lines.
22521c2f794Smrg    # This happens at least with the AIX C compiler.
22621c2f794Smrg    : > sub/conftest.c
22721c2f794Smrg    for i in 1 2 3 4 5 6; do
22821c2f794Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2291b2353dbSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2301b2353dbSmrg      # Solaris 10 /bin/sh.
2311b2353dbSmrg      echo '/* dummy */' > sub/conftst$i.h
23221c2f794Smrg    done
23321c2f794Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23421c2f794Smrg
2351b2353dbSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23612391620Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2371b2353dbSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2381b2353dbSmrg    # versions had trouble with output in subdirs.
23912391620Smrg    am__obj=sub/conftest.${OBJEXT-o}
24012391620Smrg    am__minus_obj="-o $am__obj"
24121c2f794Smrg    case $depmode in
24212391620Smrg    gcc)
24312391620Smrg      # This depmode causes a compiler race in universal mode.
24412391620Smrg      test "$am__universal" = false || continue
24512391620Smrg      ;;
24621c2f794Smrg    nosideeffect)
2471b2353dbSmrg      # After this tag, mechanisms are not by side-effect, so they'll
2481b2353dbSmrg      # only be used when explicitly requested.
24921c2f794Smrg      if test "x$enable_dependency_tracking" = xyes; then
25021c2f794Smrg	continue
25121c2f794Smrg      else
25221c2f794Smrg	break
25321c2f794Smrg      fi
25421c2f794Smrg      ;;
25582e12b1bSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2561b2353dbSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
25712391620Smrg      # not run yet.  These depmodes are late enough in the game, and
25812391620Smrg      # so weak that their functioning should not be impacted.
25912391620Smrg      am__obj=conftest.${OBJEXT-o}
26012391620Smrg      am__minus_obj=
26112391620Smrg      ;;
26221c2f794Smrg    none) break ;;
26321c2f794Smrg    esac
26421c2f794Smrg    if depmode=$depmode \
26512391620Smrg       source=sub/conftest.c object=$am__obj \
26621c2f794Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26712391620Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26821c2f794Smrg         >/dev/null 2>conftest.err &&
26921c2f794Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27021c2f794Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27112391620Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27221c2f794Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27321c2f794Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27421c2f794Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27521c2f794Smrg      # that says an option was ignored or not supported.
27621c2f794Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27721c2f794Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27821c2f794Smrg      # The diagnosis changed in icc 8.0:
27921c2f794Smrg      #   icc: Command line remark: option '-MP' not supported
28021c2f794Smrg      if (grep 'ignoring option' conftest.err ||
28121c2f794Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28221c2f794Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28321c2f794Smrg        break
28421c2f794Smrg      fi
28521c2f794Smrg    fi
28621c2f794Smrg  done
28721c2f794Smrg
28821c2f794Smrg  cd ..
28921c2f794Smrg  rm -rf conftest.dir
29021c2f794Smrgelse
29121c2f794Smrg  am_cv_$1_dependencies_compiler_type=none
29221c2f794Smrgfi
29321c2f794Smrg])
29421c2f794SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29521c2f794SmrgAM_CONDITIONAL([am__fastdep$1], [
29621c2f794Smrg  test "x$enable_dependency_tracking" != xno \
29721c2f794Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29821c2f794Smrg])
29921c2f794Smrg
30021c2f794Smrg
30121c2f794Smrg# AM_SET_DEPDIR
30221c2f794Smrg# -------------
30321c2f794Smrg# Choose a directory name for dependency files.
3041b2353dbSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30521c2f794SmrgAC_DEFUN([AM_SET_DEPDIR],
30621c2f794Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30721c2f794SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30821c2f794Smrg])
30921c2f794Smrg
31021c2f794Smrg
31121c2f794Smrg# AM_DEP_TRACK
31221c2f794Smrg# ------------
31321c2f794SmrgAC_DEFUN([AM_DEP_TRACK],
3141b2353dbSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3151b2353dbSmrgAS_HELP_STRING(
3161b2353dbSmrg  [--enable-dependency-tracking],
3171b2353dbSmrg  [do not reject slow dependency extractors])
3181b2353dbSmrgAS_HELP_STRING(
3191b2353dbSmrg  [--disable-dependency-tracking],
3201b2353dbSmrg  [speeds up one-time build])])
32121c2f794Smrgif test "x$enable_dependency_tracking" != xno; then
32221c2f794Smrg  am_depcomp="$ac_aux_dir/depcomp"
32321c2f794Smrg  AMDEPBACKSLASH='\'
32482e12b1bSmrg  am__nodep='_no'
32521c2f794Smrgfi
32621c2f794SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32721c2f794SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32821c2f794Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32982e12b1bSmrgAC_SUBST([am__nodep])dnl
33082e12b1bSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33121c2f794Smrg])
33221c2f794Smrg
33321c2f794Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33421c2f794Smrg
335889a2364Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
33621c2f794Smrg#
33721c2f794Smrg# This file is free software; the Free Software Foundation
33821c2f794Smrg# gives unlimited permission to copy and/or distribute it,
33921c2f794Smrg# with or without modifications, as long as this notice is preserved.
34021c2f794Smrg
34121c2f794Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34221c2f794Smrg# ------------------------------
34321c2f794SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34412391620Smrg[{
3451b2353dbSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
34612391620Smrg  # are listed without --file.  Let's play safe and only enable the eval
34712391620Smrg  # if we detect the quoting.
348889a2364Smrg  # TODO: see whether this extra hack can be removed once we start
349889a2364Smrg  # requiring Autoconf 2.70 or later.
350889a2364Smrg  AS_CASE([$CONFIG_FILES],
351889a2364Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352889a2364Smrg          [*], [set x $CONFIG_FILES])
35312391620Smrg  shift
354889a2364Smrg  # Used to flag and report bootstrapping failures.
355889a2364Smrg  am_rc=0
356889a2364Smrg  for am_mf
35712391620Smrg  do
35812391620Smrg    # Strip MF so we end up with the name of the file.
359889a2364Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360889a2364Smrg    # Check whether this is an Automake generated Makefile which includes
361889a2364Smrg    # dependency-tracking related rules and includes.
362889a2364Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36312391620Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364889a2364Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365889a2364Smrg      || continue
366889a2364Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367889a2364Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368889a2364Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369889a2364Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370889a2364Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37121c2f794Smrg  done
372889a2364Smrg  if test $am_rc -ne 0; then
373889a2364Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374889a2364Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375889a2364Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376889a2364Smrg    necessary).  You can also try re-running configure with the
377889a2364Smrg    '--disable-dependency-tracking' option to at least be able to build
378889a2364Smrg    the package (albeit without support for automatic dependency tracking).])
379889a2364Smrg  fi
380889a2364Smrg  AS_UNSET([am_dirpart])
381889a2364Smrg  AS_UNSET([am_filepart])
382889a2364Smrg  AS_UNSET([am_mf])
383889a2364Smrg  AS_UNSET([am_rc])
384889a2364Smrg  rm -f conftest-deps.mk
38512391620Smrg}
38621c2f794Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
38721c2f794Smrg
38821c2f794Smrg
38921c2f794Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39021c2f794Smrg# -----------------------------
39121c2f794Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
39221c2f794Smrg#
393889a2364Smrg# This code is only required when automatic dependency tracking is enabled.
394889a2364Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395889a2364Smrg# order to bootstrap the dependency handling code.
39621c2f794SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39721c2f794Smrg[AC_CONFIG_COMMANDS([depfiles],
39821c2f794Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399889a2364Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
40021c2f794Smrg
40121c2f794Smrg# Do all the work for Automake.                             -*- Autoconf -*-
40221c2f794Smrg
403889a2364Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40421c2f794Smrg#
40521c2f794Smrg# This file is free software; the Free Software Foundation
40621c2f794Smrg# gives unlimited permission to copy and/or distribute it,
40721c2f794Smrg# with or without modifications, as long as this notice is preserved.
40821c2f794Smrg
40921c2f794Smrg# This macro actually does too much.  Some checks are only needed if
41021c2f794Smrg# your package does certain things.  But this isn't really a big deal.
41121c2f794Smrg
4121b2353dbSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4131b2353dbSmrgm4_define([AC_PROG_CC],
4141b2353dbSmrgm4_defn([AC_PROG_CC])
4151b2353dbSmrg[_AM_PROG_CC_C_O
4161b2353dbSmrg])
4171b2353dbSmrg
41821c2f794Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41921c2f794Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42021c2f794Smrg# -----------------------------------------------
42121c2f794Smrg# The call with PACKAGE and VERSION arguments is the old style
42221c2f794Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42321c2f794Smrg# and VERSION should now be passed to AC_INIT and removed from
42421c2f794Smrg# the call to AM_INIT_AUTOMAKE.
42521c2f794Smrg# We support both call styles for the transition.  After
42621c2f794Smrg# the next Automake release, Autoconf can make the AC_INIT
42721c2f794Smrg# arguments mandatory, and then we can depend on a new Autoconf
42821c2f794Smrg# release and drop the old call support.
42921c2f794SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4301b2353dbSmrg[AC_PREREQ([2.65])dnl
431889a2364Smrgm4_ifdef([_$0_ALREADY_INIT],
432889a2364Smrg  [m4_fatal([$0 expanded multiple times
433889a2364Smrg]m4_defn([_$0_ALREADY_INIT]))],
434889a2364Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43521c2f794Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43621c2f794Smrgdnl the ones we care about.
43721c2f794Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43821c2f794SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43921c2f794SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44021c2f794Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44121c2f794Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44221c2f794Smrg  # is not polluted with repeated "-I."
44321c2f794Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44421c2f794Smrg  # test to see if srcdir already configured
44521c2f794Smrg  if test -f $srcdir/config.status; then
44621c2f794Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44721c2f794Smrg  fi
44821c2f794Smrgfi
44921c2f794Smrg
45021c2f794Smrg# test whether we have cygpath
45121c2f794Smrgif test -z "$CYGPATH_W"; then
45221c2f794Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45321c2f794Smrg    CYGPATH_W='cygpath -w'
45421c2f794Smrg  else
45521c2f794Smrg    CYGPATH_W=echo
45621c2f794Smrg  fi
45721c2f794Smrgfi
45821c2f794SmrgAC_SUBST([CYGPATH_W])
45921c2f794Smrg
46021c2f794Smrg# Define the identity of the package.
46121c2f794Smrgdnl Distinguish between old-style and new-style calls.
46221c2f794Smrgm4_ifval([$2],
4631b2353dbSmrg[AC_DIAGNOSE([obsolete],
4641b2353dbSmrg             [$0: two- and three-arguments forms are deprecated.])
4651b2353dbSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46621c2f794Smrg AC_SUBST([PACKAGE], [$1])dnl
46721c2f794Smrg AC_SUBST([VERSION], [$2])],
46821c2f794Smrg[_AM_SET_OPTIONS([$1])dnl
46921c2f794Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4701b2353dbSmrgm4_if(
471889a2364Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4721b2353dbSmrg  [ok:ok],,
47321c2f794Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47421c2f794Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47521c2f794Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47621c2f794Smrg
47721c2f794Smrg_AM_IF_OPTION([no-define],,
4781b2353dbSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4791b2353dbSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48021c2f794Smrg
48121c2f794Smrg# Some tools Automake needs.
48221c2f794SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48321c2f794SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4841b2353dbSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4851b2353dbSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4861b2353dbSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4871b2353dbSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4881b2353dbSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48912391620SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49012391620SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4911b2353dbSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4921b2353dbSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
4931b2353dbSmrg# dies out for good.  For more background, see:
494889a2364Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495889a2364Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4961b2353dbSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497889a2364Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
498889a2364Smrg# system "awk" is bad on some platforms.
49921c2f794SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50021c2f794SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50121c2f794SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50221c2f794Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50312391620Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50412391620Smrg			     [_AM_PROG_TAR([v7])])])
50521c2f794Smrg_AM_IF_OPTION([no-dependencies],,
50621c2f794Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5071b2353dbSmrg		  [_AM_DEPENDENCIES([CC])],
5081b2353dbSmrg		  [m4_define([AC_PROG_CC],
5091b2353dbSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51021c2f794SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5111b2353dbSmrg		  [_AM_DEPENDENCIES([CXX])],
5121b2353dbSmrg		  [m4_define([AC_PROG_CXX],
5131b2353dbSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51421c2f794SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5151b2353dbSmrg		  [_AM_DEPENDENCIES([OBJC])],
5161b2353dbSmrg		  [m4_define([AC_PROG_OBJC],
5171b2353dbSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5181b2353dbSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5191b2353dbSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
5201b2353dbSmrg		  [m4_define([AC_PROG_OBJCXX],
5211b2353dbSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52221c2f794Smrg])
523889a2364Smrg# Variables for tags utilities; see am/tags.am
524889a2364Smrgif test -z "$CTAGS"; then
525889a2364Smrg  CTAGS=ctags
526889a2364Smrgfi
527889a2364SmrgAC_SUBST([CTAGS])
528889a2364Smrgif test -z "$ETAGS"; then
529889a2364Smrg  ETAGS=etags
530889a2364Smrgfi
531889a2364SmrgAC_SUBST([ETAGS])
532889a2364Smrgif test -z "$CSCOPE"; then
533889a2364Smrg  CSCOPE=cscope
534889a2364Smrgfi
535889a2364SmrgAC_SUBST([CSCOPE])
536889a2364Smrg
5371b2353dbSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5381b2353dbSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
5391b2353dbSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5401b2353dbSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54112391620SmrgAC_CONFIG_COMMANDS_PRE(dnl
54212391620Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54312391620Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
54421c2f794Smrg
5451b2353dbSmrg# POSIX will say in a future version that running "rm -f" with no argument
5461b2353dbSmrg# is OK; and we want to be able to make that assumption in our Makefile
5471b2353dbSmrg# recipes.  So use an aggressive probe to check that the usage we want is
5481b2353dbSmrg# actually supported "in the wild" to an acceptable degree.
5491b2353dbSmrg# See automake bug#10828.
5501b2353dbSmrg# To make any issue more visible, cause the running configure to be aborted
5511b2353dbSmrg# by default if the 'rm' program in use doesn't match our expectations; the
5521b2353dbSmrg# user can still override this though.
5531b2353dbSmrgif rm -f && rm -fr && rm -rf; then : OK; else
5541b2353dbSmrg  cat >&2 <<'END'
5551b2353dbSmrgOops!
5561b2353dbSmrg
5571b2353dbSmrgYour 'rm' program seems unable to run without file operands specified
5581b2353dbSmrgon the command line, even when the '-f' option is present.  This is contrary
5591b2353dbSmrgto the behaviour of most rm programs out there, and not conforming with
5601b2353dbSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5611b2353dbSmrg
5621b2353dbSmrgPlease tell bug-automake@gnu.org about your system, including the value
5631b2353dbSmrgof your $PATH and any error possibly output before this message.  This
5641b2353dbSmrgcan help us improve future automake versions.
5651b2353dbSmrg
5661b2353dbSmrgEND
5671b2353dbSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5681b2353dbSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5691b2353dbSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5701b2353dbSmrg    echo >&2
5711b2353dbSmrg  else
5721b2353dbSmrg    cat >&2 <<'END'
5731b2353dbSmrgAborting the configuration process, to ensure you take notice of the issue.
5741b2353dbSmrg
5751b2353dbSmrgYou can download and install GNU coreutils to get an 'rm' implementation
576889a2364Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
5771b2353dbSmrg
5781b2353dbSmrgIf you want to complete the configuration process using your problematic
5791b2353dbSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5801b2353dbSmrgto "yes", and re-run configure.
5811b2353dbSmrg
5821b2353dbSmrgEND
5831b2353dbSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5841b2353dbSmrg  fi
585889a2364Smrgfi
586889a2364Smrgdnl The trailing newline in this macro's definition is deliberate, for
587889a2364Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
588889a2364Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
589889a2364Smrg])
5901b2353dbSmrg
5911b2353dbSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59212391620Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59312391620Smrgdnl mangled by Autoconf and run in a shell conditional statement.
59412391620Smrgm4_define([_AC_COMPILER_EXEEXT],
59512391620Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
59612391620Smrg
59721c2f794Smrg# When config.status generates a header, we must update the stamp-h file.
59821c2f794Smrg# This file resides in the same directory as the config header
59921c2f794Smrg# that is generated.  The stamp files are numbered to have different names.
60021c2f794Smrg
60121c2f794Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60221c2f794Smrg# loop where config.status creates the headers, so we can generate
60321c2f794Smrg# our stamp files there.
60421c2f794SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60521c2f794Smrg[# Compute $1's index in $config_headers.
60612391620Smrg_am_arg=$1
60721c2f794Smrg_am_stamp_count=1
60821c2f794Smrgfor _am_header in $config_headers :; do
60921c2f794Smrg  case $_am_header in
61012391620Smrg    $_am_arg | $_am_arg:* )
61121c2f794Smrg      break ;;
61221c2f794Smrg    * )
61321c2f794Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61421c2f794Smrg  esac
61521c2f794Smrgdone
61612391620Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
61721c2f794Smrg
618889a2364Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61921c2f794Smrg#
62021c2f794Smrg# This file is free software; the Free Software Foundation
62121c2f794Smrg# gives unlimited permission to copy and/or distribute it,
62221c2f794Smrg# with or without modifications, as long as this notice is preserved.
62321c2f794Smrg
62421c2f794Smrg# AM_PROG_INSTALL_SH
62521c2f794Smrg# ------------------
62621c2f794Smrg# Define $install_sh.
62721c2f794SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62821c2f794Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
629889a2364Smrgif test x"${install_sh+set}" != xset; then
63012391620Smrg  case $am_aux_dir in
63112391620Smrg  *\ * | *\	*)
63212391620Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63312391620Smrg  *)
63412391620Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63512391620Smrg  esac
63612391620Smrgfi
6371b2353dbSmrgAC_SUBST([install_sh])])
63821c2f794Smrg
639889a2364Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64021c2f794Smrg#
64121c2f794Smrg# This file is free software; the Free Software Foundation
64221c2f794Smrg# gives unlimited permission to copy and/or distribute it,
64321c2f794Smrg# with or without modifications, as long as this notice is preserved.
64421c2f794Smrg
64521c2f794Smrg# Check whether the underlying file-system supports filenames
64621c2f794Smrg# with a leading dot.  For instance MS-DOS doesn't.
64721c2f794SmrgAC_DEFUN([AM_SET_LEADING_DOT],
64821c2f794Smrg[rm -rf .tst 2>/dev/null
64921c2f794Smrgmkdir .tst 2>/dev/null
65021c2f794Smrgif test -d .tst; then
65121c2f794Smrg  am__leading_dot=.
65221c2f794Smrgelse
65321c2f794Smrg  am__leading_dot=_
65421c2f794Smrgfi
65521c2f794Smrgrmdir .tst 2>/dev/null
65621c2f794SmrgAC_SUBST([am__leading_dot])])
65721c2f794Smrg
65821c2f794Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
65921c2f794Smrg
660889a2364Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66121c2f794Smrg#
66221c2f794Smrg# This file is free software; the Free Software Foundation
66321c2f794Smrg# gives unlimited permission to copy and/or distribute it,
66421c2f794Smrg# with or without modifications, as long as this notice is preserved.
66521c2f794Smrg
66621c2f794Smrg# AM_MAKE_INCLUDE()
66721c2f794Smrg# -----------------
668889a2364Smrg# Check whether make has an 'include' directive that can support all
669889a2364Smrg# the idioms we need for our automatic dependency tracking code.
67021c2f794SmrgAC_DEFUN([AM_MAKE_INCLUDE],
671889a2364Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672889a2364Smrgcat > confinc.mk << 'END'
67321c2f794Smrgam__doit:
674889a2364Smrg	@echo this is the am__doit target >confinc.out
67521c2f794Smrg.PHONY: am__doit
67621c2f794SmrgEND
67721c2f794Smrgam__include="#"
67821c2f794Smrgam__quote=
679889a2364Smrg# BSD make does it like this.
680889a2364Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681889a2364Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682889a2364Smrgecho 'include confinc.mk # ignored' > confmf.GNU
683889a2364Smrg_am_result=no
684889a2364Smrgfor s in GNU BSD; do
685889a2364Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686889a2364Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687889a2364Smrg      ['0:this is the am__doit target'],
688889a2364Smrg      [AS_CASE([$s],
689889a2364Smrg          [BSD], [am__include='.include' am__quote='"'],
690889a2364Smrg          [am__include='include' am__quote=''])])
691889a2364Smrg  if test "$am__include" != "#"; then
692889a2364Smrg    _am_result="yes ($s style)"
693889a2364Smrg    break
694889a2364Smrg  fi
695889a2364Smrgdone
696889a2364Smrgrm -f confinc.* confmf.*
697889a2364SmrgAC_MSG_RESULT([${_am_result}])
698889a2364SmrgAC_SUBST([am__include])])
699889a2364SmrgAC_SUBST([am__quote])])
70021c2f794Smrg
70121c2f794Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
70221c2f794Smrg
703889a2364Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
70421c2f794Smrg#
70521c2f794Smrg# This file is free software; the Free Software Foundation
70621c2f794Smrg# gives unlimited permission to copy and/or distribute it,
70721c2f794Smrg# with or without modifications, as long as this notice is preserved.
70821c2f794Smrg
70921c2f794Smrg# AM_MISSING_PROG(NAME, PROGRAM)
71021c2f794Smrg# ------------------------------
71121c2f794SmrgAC_DEFUN([AM_MISSING_PROG],
71221c2f794Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71321c2f794Smrg$1=${$1-"${am_missing_run}$2"}
71421c2f794SmrgAC_SUBST($1)])
71521c2f794Smrg
71621c2f794Smrg# AM_MISSING_HAS_RUN
71721c2f794Smrg# ------------------
7181b2353dbSmrg# Define MISSING if not defined so far and test if it is modern enough.
7191b2353dbSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72021c2f794SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72121c2f794Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72221c2f794SmrgAC_REQUIRE_AUX_FILE([missing])dnl
72312391620Smrgif test x"${MISSING+set}" != xset; then
724889a2364Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
72512391620Smrgfi
72621c2f794Smrg# Use eval to expand $SHELL
7271b2353dbSmrgif eval "$MISSING --is-lightweight"; then
7281b2353dbSmrg  am_missing_run="$MISSING "
72921c2f794Smrgelse
73021c2f794Smrg  am_missing_run=
7311b2353dbSmrg  AC_MSG_WARN(['missing' script is too old or missing])
73221c2f794Smrgfi
73321c2f794Smrg])
73421c2f794Smrg
73521c2f794Smrg# Helper functions for option handling.                     -*- Autoconf -*-
73621c2f794Smrg
737889a2364Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73821c2f794Smrg#
73921c2f794Smrg# This file is free software; the Free Software Foundation
74021c2f794Smrg# gives unlimited permission to copy and/or distribute it,
74121c2f794Smrg# with or without modifications, as long as this notice is preserved.
74221c2f794Smrg
74321c2f794Smrg# _AM_MANGLE_OPTION(NAME)
74421c2f794Smrg# -----------------------
74521c2f794SmrgAC_DEFUN([_AM_MANGLE_OPTION],
74621c2f794Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
74721c2f794Smrg
74821c2f794Smrg# _AM_SET_OPTION(NAME)
74982e12b1bSmrg# --------------------
75021c2f794Smrg# Set option NAME.  Presently that only means defining a flag for this option.
75121c2f794SmrgAC_DEFUN([_AM_SET_OPTION],
7521b2353dbSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
75321c2f794Smrg
75421c2f794Smrg# _AM_SET_OPTIONS(OPTIONS)
75582e12b1bSmrg# ------------------------
75621c2f794Smrg# OPTIONS is a space-separated list of Automake options.
75721c2f794SmrgAC_DEFUN([_AM_SET_OPTIONS],
75812391620Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75921c2f794Smrg
76021c2f794Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76121c2f794Smrg# -------------------------------------------
76221c2f794Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76321c2f794SmrgAC_DEFUN([_AM_IF_OPTION],
76421c2f794Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76521c2f794Smrg
766889a2364Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
7671b2353dbSmrg#
7681b2353dbSmrg# This file is free software; the Free Software Foundation
7691b2353dbSmrg# gives unlimited permission to copy and/or distribute it,
7701b2353dbSmrg# with or without modifications, as long as this notice is preserved.
77121c2f794Smrg
7721b2353dbSmrg# _AM_PROG_CC_C_O
7731b2353dbSmrg# ---------------
7741b2353dbSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7751b2353dbSmrg# to automatically call this.
7761b2353dbSmrgAC_DEFUN([_AM_PROG_CC_C_O],
7771b2353dbSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7781b2353dbSmrgAC_REQUIRE_AUX_FILE([compile])dnl
7791b2353dbSmrgAC_LANG_PUSH([C])dnl
7801b2353dbSmrgAC_CACHE_CHECK(
7811b2353dbSmrg  [whether $CC understands -c and -o together],
7821b2353dbSmrg  [am_cv_prog_cc_c_o],
7831b2353dbSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7841b2353dbSmrg  # Make sure it works both with $CC and with simple cc.
7851b2353dbSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7861b2353dbSmrg  # compilers refuse to overwrite an existing .o file with -o,
7871b2353dbSmrg  # though they will create one.
7881b2353dbSmrg  am_cv_prog_cc_c_o=yes
7891b2353dbSmrg  for am_i in 1 2; do
7901b2353dbSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7911b2353dbSmrg         && test -f conftest2.$ac_objext; then
7921b2353dbSmrg      : OK
7931b2353dbSmrg    else
7941b2353dbSmrg      am_cv_prog_cc_c_o=no
7951b2353dbSmrg      break
7961b2353dbSmrg    fi
7971b2353dbSmrg  done
7981b2353dbSmrg  rm -f core conftest*
7991b2353dbSmrg  unset am_i])
8001b2353dbSmrgif test "$am_cv_prog_cc_c_o" != yes; then
8011b2353dbSmrg   # Losing compiler, so override with the script.
8021b2353dbSmrg   # FIXME: It is wrong to rewrite CC.
8031b2353dbSmrg   # But if we don't then we get into trouble of one sort or another.
8041b2353dbSmrg   # A longer-term fix would be to have automake use am__CC in this case,
8051b2353dbSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8061b2353dbSmrg   CC="$am_aux_dir/compile $CC"
8071b2353dbSmrgfi
8081b2353dbSmrgAC_LANG_POP([C])])
8091b2353dbSmrg
8101b2353dbSmrg# For backward compatibility.
8111b2353dbSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8121b2353dbSmrg
813889a2364Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
81421c2f794Smrg#
81521c2f794Smrg# This file is free software; the Free Software Foundation
81621c2f794Smrg# gives unlimited permission to copy and/or distribute it,
81721c2f794Smrg# with or without modifications, as long as this notice is preserved.
81821c2f794Smrg
8191b2353dbSmrg# AM_RUN_LOG(COMMAND)
8201b2353dbSmrg# -------------------
8211b2353dbSmrg# Run COMMAND, save the exit status in ac_status, and log it.
8221b2353dbSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8231b2353dbSmrgAC_DEFUN([AM_RUN_LOG],
8241b2353dbSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8251b2353dbSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8261b2353dbSmrg   ac_status=$?
8271b2353dbSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8281b2353dbSmrg   (exit $ac_status); }])
8291b2353dbSmrg
8301b2353dbSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8311b2353dbSmrg
832889a2364Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8331b2353dbSmrg#
8341b2353dbSmrg# This file is free software; the Free Software Foundation
8351b2353dbSmrg# gives unlimited permission to copy and/or distribute it,
8361b2353dbSmrg# with or without modifications, as long as this notice is preserved.
83721c2f794Smrg
83821c2f794Smrg# AM_SANITY_CHECK
83921c2f794Smrg# ---------------
84021c2f794SmrgAC_DEFUN([AM_SANITY_CHECK],
84121c2f794Smrg[AC_MSG_CHECKING([whether build environment is sane])
84212391620Smrg# Reject unsafe characters in $srcdir or the absolute working directory
84312391620Smrg# name.  Accept space and tab only in the latter.
84412391620Smrgam_lf='
84512391620Smrg'
84612391620Smrgcase `pwd` in
84712391620Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84812391620Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84912391620Smrgesac
85012391620Smrgcase $srcdir in
85112391620Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8521b2353dbSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85312391620Smrgesac
85412391620Smrg
8551b2353dbSmrg# Do 'set' in a subshell so we don't clobber the current shell's
85621c2f794Smrg# arguments.  Must try -L first in case configure is actually a
85721c2f794Smrg# symlink; some systems play weird games with the mod time of symlinks
85821c2f794Smrg# (eg FreeBSD returns the mod time of the symlink's containing
85921c2f794Smrg# directory).
86021c2f794Smrgif (
8611b2353dbSmrg   am_has_slept=no
8621b2353dbSmrg   for am_try in 1 2; do
8631b2353dbSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8641b2353dbSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8651b2353dbSmrg     if test "$[*]" = "X"; then
8661b2353dbSmrg	# -L didn't work.
8671b2353dbSmrg	set X `ls -t "$srcdir/configure" conftest.file`
8681b2353dbSmrg     fi
8691b2353dbSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8701b2353dbSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8711b2353dbSmrg
8721b2353dbSmrg	# If neither matched, then we have a broken ls.  This can happen
8731b2353dbSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8741b2353dbSmrg	# broken ls alias from the environment.  This has actually
8751b2353dbSmrg	# happened.  Such a system could not be considered "sane".
8761b2353dbSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8771b2353dbSmrg  alias in your environment])
8781b2353dbSmrg     fi
8791b2353dbSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8801b2353dbSmrg       break
8811b2353dbSmrg     fi
8821b2353dbSmrg     # Just in case.
8831b2353dbSmrg     sleep 1
8841b2353dbSmrg     am_has_slept=yes
8851b2353dbSmrg   done
88621c2f794Smrg   test "$[2]" = conftest.file
88721c2f794Smrg   )
88821c2f794Smrgthen
88921c2f794Smrg   # Ok.
89021c2f794Smrg   :
89121c2f794Smrgelse
89221c2f794Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
89321c2f794SmrgCheck your system clock])
89421c2f794Smrgfi
8951b2353dbSmrgAC_MSG_RESULT([yes])
8961b2353dbSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8971b2353dbSmrg# generated files are strictly newer.
8981b2353dbSmrgam_sleep_pid=
8991b2353dbSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9001b2353dbSmrg  ( sleep 1 ) &
9011b2353dbSmrg  am_sleep_pid=$!
9021b2353dbSmrgfi
9031b2353dbSmrgAC_CONFIG_COMMANDS_PRE(
9041b2353dbSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9051b2353dbSmrg   if test -n "$am_sleep_pid"; then
9061b2353dbSmrg     # Hide warnings about reused PIDs.
9071b2353dbSmrg     wait $am_sleep_pid 2>/dev/null
9081b2353dbSmrg   fi
9091b2353dbSmrg   AC_MSG_RESULT([done])])
9101b2353dbSmrgrm -f conftest.file
9111b2353dbSmrg])
91221c2f794Smrg
913889a2364Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
91412391620Smrg#
91512391620Smrg# This file is free software; the Free Software Foundation
91612391620Smrg# gives unlimited permission to copy and/or distribute it,
91712391620Smrg# with or without modifications, as long as this notice is preserved.
91812391620Smrg
91912391620Smrg# AM_SILENT_RULES([DEFAULT])
92012391620Smrg# --------------------------
92112391620Smrg# Enable less verbose build rules; with the default set to DEFAULT
9221b2353dbSmrg# ("yes" being less verbose, "no" or empty being verbose).
92312391620SmrgAC_DEFUN([AM_SILENT_RULES],
9241b2353dbSmrg[AC_ARG_ENABLE([silent-rules], [dnl
9251b2353dbSmrgAS_HELP_STRING(
9261b2353dbSmrg  [--enable-silent-rules],
9271b2353dbSmrg  [less verbose build output (undo: "make V=1")])
9281b2353dbSmrgAS_HELP_STRING(
9291b2353dbSmrg  [--disable-silent-rules],
9301b2353dbSmrg  [verbose build output (undo: "make V=0")])dnl
9311b2353dbSmrg])
9321b2353dbSmrgcase $enable_silent_rules in @%:@ (((
9331b2353dbSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
9341b2353dbSmrg   no) AM_DEFAULT_VERBOSITY=1;;
9351b2353dbSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93612391620Smrgesac
9371b2353dbSmrgdnl
9381b2353dbSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9391b2353dbSmrgdnl do not support nested variable expansions.
9401b2353dbSmrgdnl See automake bug#9928 and bug#10237.
9411b2353dbSmrgam_make=${MAKE-make}
9421b2353dbSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9431b2353dbSmrg   [am_cv_make_support_nested_variables],
9441b2353dbSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9451b2353dbSmrgBAR0=false
9461b2353dbSmrgBAR1=true
9471b2353dbSmrgV=1
9481b2353dbSmrgam__doit:
9491b2353dbSmrg	@$(TRUE)
9501b2353dbSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9511b2353dbSmrg  am_cv_make_support_nested_variables=yes
9521b2353dbSmrgelse
9531b2353dbSmrg  am_cv_make_support_nested_variables=no
9541b2353dbSmrgfi])
9551b2353dbSmrgif test $am_cv_make_support_nested_variables = yes; then
9561b2353dbSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9571b2353dbSmrg  AM_V='$(V)'
9581b2353dbSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9591b2353dbSmrgelse
9601b2353dbSmrg  AM_V=$AM_DEFAULT_VERBOSITY
9611b2353dbSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9621b2353dbSmrgfi
9631b2353dbSmrgAC_SUBST([AM_V])dnl
9641b2353dbSmrgAM_SUBST_NOTMAKE([AM_V])dnl
9651b2353dbSmrgAC_SUBST([AM_DEFAULT_V])dnl
9661b2353dbSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96712391620SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96812391620SmrgAM_BACKSLASH='\'
96912391620SmrgAC_SUBST([AM_BACKSLASH])dnl
97012391620Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97112391620Smrg])
97212391620Smrg
973889a2364Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
97421c2f794Smrg#
97521c2f794Smrg# This file is free software; the Free Software Foundation
97621c2f794Smrg# gives unlimited permission to copy and/or distribute it,
97721c2f794Smrg# with or without modifications, as long as this notice is preserved.
97821c2f794Smrg
97921c2f794Smrg# AM_PROG_INSTALL_STRIP
98021c2f794Smrg# ---------------------
9811b2353dbSmrg# One issue with vendor 'install' (even GNU) is that you can't
98221c2f794Smrg# specify the program used to strip binaries.  This is especially
98321c2f794Smrg# annoying in cross-compiling environments, where the build's strip
98421c2f794Smrg# is unlikely to handle the host's binaries.
98521c2f794Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9861b2353dbSmrg# always use install-sh in "make install-strip", and initialize
98721c2f794Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
98821c2f794SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98921c2f794Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9901b2353dbSmrg# Installed binaries are usually stripped using 'strip' when the user
9911b2353dbSmrg# run "make install-strip".  However 'strip' might not be the right
99221c2f794Smrg# tool to use in cross-compilation environments, therefore Automake
9931b2353dbSmrg# will honor the 'STRIP' environment variable to overrule this program.
9941b2353dbSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99521c2f794Smrgif test "$cross_compiling" != no; then
99621c2f794Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
99721c2f794Smrgfi
99821c2f794SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99921c2f794SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100021c2f794Smrg
1001889a2364Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
100221c2f794Smrg#
100321c2f794Smrg# This file is free software; the Free Software Foundation
100421c2f794Smrg# gives unlimited permission to copy and/or distribute it,
100521c2f794Smrg# with or without modifications, as long as this notice is preserved.
100621c2f794Smrg
100721c2f794Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
100821c2f794Smrg# ---------------------------
100912391620Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101021c2f794Smrg# This macro is traced by Automake.
101121c2f794SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101221c2f794Smrg
101312391620Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101482e12b1bSmrg# --------------------------
101512391620Smrg# Public sister of _AM_SUBST_NOTMAKE.
101612391620SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101712391620Smrg
101821c2f794Smrg# Check how to create a tarball.                            -*- Autoconf -*-
101921c2f794Smrg
1020889a2364Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
102121c2f794Smrg#
102221c2f794Smrg# This file is free software; the Free Software Foundation
102321c2f794Smrg# gives unlimited permission to copy and/or distribute it,
102421c2f794Smrg# with or without modifications, as long as this notice is preserved.
102521c2f794Smrg
102621c2f794Smrg# _AM_PROG_TAR(FORMAT)
102721c2f794Smrg# --------------------
102821c2f794Smrg# Check how to create a tarball in format FORMAT.
10291b2353dbSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
103021c2f794Smrg#
103121c2f794Smrg# Substitute a variable $(am__tar) that is a command
103221c2f794Smrg# writing to stdout a FORMAT-tarball containing the directory
103321c2f794Smrg# $tardir.
103421c2f794Smrg#     tardir=directory && $(am__tar) > result.tar
103521c2f794Smrg#
103621c2f794Smrg# Substitute a variable $(am__untar) that extract such
103721c2f794Smrg# a tarball read from stdin.
103821c2f794Smrg#     $(am__untar) < result.tar
10391b2353dbSmrg#
104021c2f794SmrgAC_DEFUN([_AM_PROG_TAR],
10411b2353dbSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10421b2353dbSmrg# in the wild :-(  We should find a proper way to deprecate it ...
10431b2353dbSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10441b2353dbSmrg
10451b2353dbSmrg# We'll loop over all known methods to create a tar archive until one works.
104621c2f794Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
104721c2f794Smrg
10481b2353dbSmrgm4_if([$1], [v7],
10491b2353dbSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10501b2353dbSmrg
10511b2353dbSmrg  [m4_case([$1],
10521b2353dbSmrg    [ustar],
10531b2353dbSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10541b2353dbSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10551b2353dbSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10561b2353dbSmrg      # and bug#13588).
10571b2353dbSmrg      am_max_uid=2097151 # 2^21 - 1
10581b2353dbSmrg      am_max_gid=$am_max_uid
10591b2353dbSmrg      # The $UID and $GID variables are not portable, so we need to resort
10601b2353dbSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10611b2353dbSmrg      # below are definitely unexpected, so allow the users to see them
10621b2353dbSmrg      # (that is, avoid stderr redirection).
10631b2353dbSmrg      am_uid=`id -u || echo unknown`
10641b2353dbSmrg      am_gid=`id -g || echo unknown`
10651b2353dbSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10661b2353dbSmrg      if test $am_uid -le $am_max_uid; then
10671b2353dbSmrg         AC_MSG_RESULT([yes])
10681b2353dbSmrg      else
10691b2353dbSmrg         AC_MSG_RESULT([no])
10701b2353dbSmrg         _am_tools=none
10711b2353dbSmrg      fi
10721b2353dbSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10731b2353dbSmrg      if test $am_gid -le $am_max_gid; then
10741b2353dbSmrg         AC_MSG_RESULT([yes])
10751b2353dbSmrg      else
10761b2353dbSmrg        AC_MSG_RESULT([no])
10771b2353dbSmrg        _am_tools=none
10781b2353dbSmrg      fi],
10791b2353dbSmrg
10801b2353dbSmrg  [pax],
10811b2353dbSmrg    [],
10821b2353dbSmrg
10831b2353dbSmrg  [m4_fatal([Unknown tar format])])
10841b2353dbSmrg
10851b2353dbSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
10861b2353dbSmrg
10871b2353dbSmrg  # Go ahead even if we have the value already cached.  We do so because we
10881b2353dbSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10891b2353dbSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10901b2353dbSmrg
10911b2353dbSmrg  for _am_tool in $_am_tools; do
10921b2353dbSmrg    case $_am_tool in
10931b2353dbSmrg    gnutar)
10941b2353dbSmrg      for _am_tar in tar gnutar gtar; do
10951b2353dbSmrg        AM_RUN_LOG([$_am_tar --version]) && break
10961b2353dbSmrg      done
10971b2353dbSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10981b2353dbSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10991b2353dbSmrg      am__untar="$_am_tar -xf -"
11001b2353dbSmrg      ;;
11011b2353dbSmrg    plaintar)
11021b2353dbSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11031b2353dbSmrg      # ustar tarball either.
11041b2353dbSmrg      (tar --version) >/dev/null 2>&1 && continue
11051b2353dbSmrg      am__tar='tar chf - "$$tardir"'
11061b2353dbSmrg      am__tar_='tar chf - "$tardir"'
11071b2353dbSmrg      am__untar='tar xf -'
11081b2353dbSmrg      ;;
11091b2353dbSmrg    pax)
11101b2353dbSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
11111b2353dbSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
11121b2353dbSmrg      am__untar='pax -r'
11131b2353dbSmrg      ;;
11141b2353dbSmrg    cpio)
11151b2353dbSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11161b2353dbSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11171b2353dbSmrg      am__untar='cpio -i -H $1 -d'
11181b2353dbSmrg      ;;
11191b2353dbSmrg    none)
11201b2353dbSmrg      am__tar=false
11211b2353dbSmrg      am__tar_=false
11221b2353dbSmrg      am__untar=false
11231b2353dbSmrg      ;;
11241b2353dbSmrg    esac
112521c2f794Smrg
11261b2353dbSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
11271b2353dbSmrg    # and am__untar set.
11281b2353dbSmrg    test -n "${am_cv_prog_tar_$1}" && break
11291b2353dbSmrg
11301b2353dbSmrg    # tar/untar a dummy directory, and stop if the command works.
11311b2353dbSmrg    rm -rf conftest.dir
11321b2353dbSmrg    mkdir conftest.dir
11331b2353dbSmrg    echo GrepMe > conftest.dir/file
11341b2353dbSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11351b2353dbSmrg    rm -rf conftest.dir
11361b2353dbSmrg    if test -s conftest.tar; then
11371b2353dbSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
11381b2353dbSmrg      AM_RUN_LOG([cat conftest.dir/file])
11391b2353dbSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11401b2353dbSmrg    fi
11411b2353dbSmrg  done
114221c2f794Smrg  rm -rf conftest.dir
114321c2f794Smrg
11441b2353dbSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11451b2353dbSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11461b2353dbSmrg
114721c2f794SmrgAC_SUBST([am__tar])
114821c2f794SmrgAC_SUBST([am__untar])
114921c2f794Smrg]) # _AM_PROG_TAR
115021c2f794Smrg
1151889a2364Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152889a2364Smrgdnl serial 11 (pkg-config-0.29)
1153889a2364Smrgdnl
1154889a2364Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155889a2364Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1156889a2364Smrgdnl
1157889a2364Smrgdnl This program is free software; you can redistribute it and/or modify
1158889a2364Smrgdnl it under the terms of the GNU General Public License as published by
1159889a2364Smrgdnl the Free Software Foundation; either version 2 of the License, or
1160889a2364Smrgdnl (at your option) any later version.
1161889a2364Smrgdnl
1162889a2364Smrgdnl This program is distributed in the hope that it will be useful, but
1163889a2364Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164889a2364Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165889a2364Smrgdnl General Public License for more details.
1166889a2364Smrgdnl
1167889a2364Smrgdnl You should have received a copy of the GNU General Public License
1168889a2364Smrgdnl along with this program; if not, write to the Free Software
1169889a2364Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170889a2364Smrgdnl 02111-1307, USA.
1171889a2364Smrgdnl
1172889a2364Smrgdnl As a special exception to the GNU General Public License, if you
1173889a2364Smrgdnl distribute this file as part of a program that contains a
1174889a2364Smrgdnl configuration script generated by Autoconf, you may include it under
1175889a2364Smrgdnl the same distribution terms that you use for the rest of that
1176889a2364Smrgdnl program.
1177889a2364Smrg
1178889a2364Smrgdnl PKG_PREREQ(MIN-VERSION)
1179889a2364Smrgdnl -----------------------
1180889a2364Smrgdnl Since: 0.29
1181889a2364Smrgdnl
1182889a2364Smrgdnl Verify that the version of the pkg-config macros are at least
1183889a2364Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184889a2364Smrgdnl installed version of pkg-config, this checks the developer's version
1185889a2364Smrgdnl of pkg.m4 when generating configure.
1186889a2364Smrgdnl
1187889a2364Smrgdnl To ensure that this macro is defined, also add:
1188889a2364Smrgdnl m4_ifndef([PKG_PREREQ],
1189889a2364Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190889a2364Smrgdnl
1191889a2364Smrgdnl See the "Since" comment for each macro you use to see what version
1192889a2364Smrgdnl of the macros you require.
1193889a2364Smrgm4_defun([PKG_PREREQ],
1194889a2364Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195889a2364Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196889a2364Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197889a2364Smrg])dnl PKG_PREREQ
1198889a2364Smrg
1199889a2364Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200889a2364Smrgdnl ----------------------------------
1201889a2364Smrgdnl Since: 0.16
1202889a2364Smrgdnl
1203889a2364Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204889a2364Smrgdnl first found in the path. Checks that the version of pkg-config found
1205889a2364Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206889a2364Smrgdnl used since that's the first version where most current features of
1207889a2364Smrgdnl pkg-config existed.
120882e12b1bSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120982e12b1bSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210889a2364Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211889a2364Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212889a2364SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213889a2364SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214889a2364SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215889a2364Smrg
121682e12b1bSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121782e12b1bSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
121882e12b1bSmrgfi
121982e12b1bSmrgif test -n "$PKG_CONFIG"; then
122082e12b1bSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
122182e12b1bSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122282e12b1bSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122382e12b1bSmrg		AC_MSG_RESULT([yes])
122482e12b1bSmrg	else
122582e12b1bSmrg		AC_MSG_RESULT([no])
122682e12b1bSmrg		PKG_CONFIG=""
122782e12b1bSmrg	fi
122882e12b1bSmrgfi[]dnl
1229889a2364Smrg])dnl PKG_PROG_PKG_CONFIG
123082e12b1bSmrg
1231889a2364Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232889a2364Smrgdnl -------------------------------------------------------------------
1233889a2364Smrgdnl Since: 0.18
1234889a2364Smrgdnl
1235889a2364Smrgdnl Check to see whether a particular set of modules exists. Similar to
1236889a2364Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237889a2364Smrgdnl
1238889a2364Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239889a2364Smrgdnl only at the first occurence in configure.ac, so if the first place
1240889a2364Smrgdnl it's called might be skipped (such as if it is within an "if", you
1241889a2364Smrgdnl have to call PKG_CHECK_EXISTS manually
124282e12b1bSmrgAC_DEFUN([PKG_CHECK_EXISTS],
124382e12b1bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124482e12b1bSmrgif test -n "$PKG_CONFIG" && \
124582e12b1bSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246889a2364Smrg  m4_default([$2], [:])
124782e12b1bSmrgm4_ifvaln([$3], [else
124882e12b1bSmrg  $3])dnl
124982e12b1bSmrgfi])
125082e12b1bSmrg
1251889a2364Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252889a2364Smrgdnl ---------------------------------------------
1253889a2364Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254889a2364Smrgdnl pkg_failed based on the result.
125582e12b1bSmrgm4_define([_PKG_CONFIG],
125682e12b1bSmrg[if test -n "$$1"; then
125782e12b1bSmrg    pkg_cv_[]$1="$$1"
125882e12b1bSmrg elif test -n "$PKG_CONFIG"; then
125982e12b1bSmrg    PKG_CHECK_EXISTS([$3],
1260889a2364Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261889a2364Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
126282e12b1bSmrg		     [pkg_failed=yes])
126382e12b1bSmrg else
126482e12b1bSmrg    pkg_failed=untried
126582e12b1bSmrgfi[]dnl
1266889a2364Smrg])dnl _PKG_CONFIG
126782e12b1bSmrg
1268889a2364Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269889a2364Smrgdnl ---------------------------
1270889a2364Smrgdnl Internal check to see if pkg-config supports short errors.
127182e12b1bSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127282e12b1bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127382e12b1bSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127482e12b1bSmrg        _pkg_short_errors_supported=yes
127582e12b1bSmrgelse
127682e12b1bSmrg        _pkg_short_errors_supported=no
127782e12b1bSmrgfi[]dnl
1278889a2364Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
127982e12b1bSmrg
128082e12b1bSmrg
1281889a2364Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282889a2364Smrgdnl   [ACTION-IF-NOT-FOUND])
1283889a2364Smrgdnl --------------------------------------------------------------
1284889a2364Smrgdnl Since: 0.4.0
1285889a2364Smrgdnl
1286889a2364Smrgdnl Note that if there is a possibility the first call to
1287889a2364Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288889a2364Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128982e12b1bSmrgAC_DEFUN([PKG_CHECK_MODULES],
129082e12b1bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129182e12b1bSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129282e12b1bSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
129382e12b1bSmrg
129482e12b1bSmrgpkg_failed=no
129582e12b1bSmrgAC_MSG_CHECKING([for $1])
129682e12b1bSmrg
129782e12b1bSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129882e12b1bSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
129982e12b1bSmrg
130082e12b1bSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130182e12b1bSmrgand $1[]_LIBS to avoid the need to call pkg-config.
130282e12b1bSmrgSee the pkg-config man page for more details.])
130382e12b1bSmrg
130482e12b1bSmrgif test $pkg_failed = yes; then
1305889a2364Smrg   	AC_MSG_RESULT([no])
130682e12b1bSmrg        _PKG_SHORT_ERRORS_SUPPORTED
130782e12b1bSmrg        if test $_pkg_short_errors_supported = yes; then
1308889a2364Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130982e12b1bSmrg        else 
1310889a2364Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131182e12b1bSmrg        fi
131282e12b1bSmrg	# Put the nasty error message in config.log where it belongs
131382e12b1bSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
131482e12b1bSmrg
1315889a2364Smrg	m4_default([$4], [AC_MSG_ERROR(
131682e12b1bSmrg[Package requirements ($2) were not met:
131782e12b1bSmrg
131882e12b1bSmrg$$1_PKG_ERRORS
131982e12b1bSmrg
132082e12b1bSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132182e12b1bSmrginstalled software in a non-standard prefix.
132282e12b1bSmrg
1323889a2364Smrg_PKG_TEXT])[]dnl
1324889a2364Smrg        ])
132582e12b1bSmrgelif test $pkg_failed = untried; then
1326889a2364Smrg     	AC_MSG_RESULT([no])
1327889a2364Smrg	m4_default([$4], [AC_MSG_FAILURE(
132882e12b1bSmrg[The pkg-config script could not be found or is too old.  Make sure it
132982e12b1bSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
133082e12b1bSmrgpath to pkg-config.
133182e12b1bSmrg
133282e12b1bSmrg_PKG_TEXT
133382e12b1bSmrg
1334889a2364SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335889a2364Smrg        ])
133682e12b1bSmrgelse
133782e12b1bSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133882e12b1bSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133982e12b1bSmrg        AC_MSG_RESULT([yes])
1340889a2364Smrg	$3
134182e12b1bSmrgfi[]dnl
1342889a2364Smrg])dnl PKG_CHECK_MODULES
1343889a2364Smrg
1344889a2364Smrg
1345889a2364Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346889a2364Smrgdnl   [ACTION-IF-NOT-FOUND])
1347889a2364Smrgdnl ---------------------------------------------------------------------
1348889a2364Smrgdnl Since: 0.29
1349889a2364Smrgdnl
1350889a2364Smrgdnl Checks for existence of MODULES and gathers its build flags with
1351889a2364Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352889a2364Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353889a2364Smrgdnl
1354889a2364Smrgdnl Note that if there is a possibility the first call to
1355889a2364Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356889a2364Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357889a2364Smrgdnl configure.ac.
1358889a2364SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359889a2364Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360889a2364Smrg_save_PKG_CONFIG=$PKG_CONFIG
1361889a2364SmrgPKG_CONFIG="$PKG_CONFIG --static"
1362889a2364SmrgPKG_CHECK_MODULES($@)
1363889a2364SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364889a2364Smrg])dnl PKG_CHECK_MODULES_STATIC
1365889a2364Smrg
1366889a2364Smrg
1367889a2364Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1368889a2364Smrgdnl -------------------------
1369889a2364Smrgdnl Since: 0.27
1370889a2364Smrgdnl
1371889a2364Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372889a2364Smrgdnl should install pkg-config .pc files. By default the directory is
1373889a2364Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374889a2364Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375889a2364Smrgdnl parameter.
1376889a2364SmrgAC_DEFUN([PKG_INSTALLDIR],
1377889a2364Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378889a2364Smrgm4_pushdef([pkg_description],
1379889a2364Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380889a2364SmrgAC_ARG_WITH([pkgconfigdir],
1381889a2364Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382889a2364Smrg    [with_pkgconfigdir=]pkg_default)
1383889a2364SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384889a2364Smrgm4_popdef([pkg_default])
1385889a2364Smrgm4_popdef([pkg_description])
1386889a2364Smrg])dnl PKG_INSTALLDIR
1387889a2364Smrg
1388889a2364Smrg
1389889a2364Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390889a2364Smrgdnl --------------------------------
1391889a2364Smrgdnl Since: 0.27
1392889a2364Smrgdnl
1393889a2364Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394889a2364Smrgdnl module should install arch-independent pkg-config .pc files. By
1395889a2364Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396889a2364Smrgdnl changed by passing DIRECTORY. The user can override through the
1397889a2364Smrgdnl --with-noarch-pkgconfigdir parameter.
1398889a2364SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399889a2364Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400889a2364Smrgm4_pushdef([pkg_description],
1401889a2364Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402889a2364SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403889a2364Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404889a2364Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1405889a2364SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406889a2364Smrgm4_popdef([pkg_default])
1407889a2364Smrgm4_popdef([pkg_description])
1408889a2364Smrg])dnl PKG_NOARCH_INSTALLDIR
1409889a2364Smrg
1410889a2364Smrg
1411889a2364Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412889a2364Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413889a2364Smrgdnl -------------------------------------------
1414889a2364Smrgdnl Since: 0.28
1415889a2364Smrgdnl
1416889a2364Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1417889a2364SmrgAC_DEFUN([PKG_CHECK_VAR],
1418889a2364Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419889a2364SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420889a2364Smrg
1421889a2364Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422889a2364SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423889a2364Smrg
1424889a2364SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425889a2364Smrg])dnl PKG_CHECK_VAR
142682e12b1bSmrg
142712391620Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142821c2f794Smrgdnl
1429889a2364Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
14301b2353dbSmrgdnl
143121c2f794Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143212391620Smrgdnl copy of this software and associated documentation files (the "Software"),
143312391620Smrgdnl to deal in the Software without restriction, including without limitation
143412391620Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143512391620Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
143612391620Smrgdnl Software is furnished to do so, subject to the following conditions:
143721c2f794Smrgdnl
143812391620Smrgdnl The above copyright notice and this permission notice (including the next
143912391620Smrgdnl paragraph) shall be included in all copies or substantial portions of the
144012391620Smrgdnl Software.
144121c2f794Smrgdnl
144212391620Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144312391620Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144412391620Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144512391620Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144612391620Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144712391620Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144812391620Smrgdnl DEALINGS IN THE SOFTWARE.
144921c2f794Smrg
145021c2f794Smrg# XORG_MACROS_VERSION(required-version)
145121c2f794Smrg# -------------------------------------
145221c2f794Smrg# Minimum version: 1.1.0
145321c2f794Smrg#
145421c2f794Smrg# If you're using a macro added in Version 1.1 or newer, include this in
145521c2f794Smrg# your configure.ac with the minimum required version, such as:
145621c2f794Smrg# XORG_MACROS_VERSION(1.1)
145721c2f794Smrg#
145812391620Smrg# To ensure that this macro is defined, also add:
145912391620Smrg# m4_ifndef([XORG_MACROS_VERSION],
146012391620Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
146121c2f794Smrg#
146221c2f794Smrg#
14631b2353dbSmrg# See the "minimum version" comment for each macro you use to see what
146421c2f794Smrg# version you require.
146512391620Smrgm4_defun([XORG_MACROS_VERSION],[
1466889a2364Smrgm4_define([vers_have], [1.19.3])
146712391620Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146812391620Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
146912391620Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147012391620Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147112391620Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147212391620Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147312391620Smrgm4_undefine([vers_have])
147412391620Smrgm4_undefine([maj_have])
147512391620Smrgm4_undefine([maj_needed])
147621c2f794Smrg]) # XORG_MACROS_VERSION
147721c2f794Smrg
147821c2f794Smrg# XORG_PROG_RAWCPP()
147921c2f794Smrg# ------------------
148021c2f794Smrg# Minimum version: 1.0.0
148121c2f794Smrg#
148221c2f794Smrg# Find cpp program and necessary flags for use in pre-processing text files
148321c2f794Smrg# such as man pages and config files
148421c2f794SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148521c2f794SmrgAC_REQUIRE([AC_PROG_CPP])
1486889a2364SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148721c2f794Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
148821c2f794Smrg
148921c2f794Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149021c2f794Smrg# which is not the best choice for supporting other OS'es, but covers most
149121c2f794Smrg# of the ones we need for now.
149221c2f794SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149382e12b1bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149421c2f794Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149521c2f794Smrg	AC_MSG_RESULT([no])
149621c2f794Smrgelse
149721c2f794Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149821c2f794Smrg		RAWCPPFLAGS=-undef
149921c2f794Smrg		AC_MSG_RESULT([yes])
150012391620Smrg	# under Cygwin unix is still defined even with -undef
150112391620Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150212391620Smrg		RAWCPPFLAGS="-undef -ansi"
150312391620Smrg		AC_MSG_RESULT([yes, with -ansi])
150421c2f794Smrg	else
150521c2f794Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150621c2f794Smrg	fi
150721c2f794Smrgfi
150821c2f794Smrgrm -f conftest.$ac_ext
150921c2f794Smrg
151021c2f794SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151182e12b1bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151221c2f794Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151321c2f794Smrg	AC_MSG_RESULT([no])
151421c2f794Smrgelse
151521c2f794Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15161b2353dbSmrg		TRADITIONALCPPFLAGS="-traditional"
151721c2f794Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151821c2f794Smrg		AC_MSG_RESULT([yes])
151921c2f794Smrg	else
152021c2f794Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152121c2f794Smrg	fi
152221c2f794Smrgfi
152321c2f794Smrgrm -f conftest.$ac_ext
152421c2f794SmrgAC_SUBST(RAWCPPFLAGS)
15251b2353dbSmrgAC_SUBST(TRADITIONALCPPFLAGS)
152621c2f794Smrg]) # XORG_PROG_RAWCPP
152721c2f794Smrg
152821c2f794Smrg# XORG_MANPAGE_SECTIONS()
152921c2f794Smrg# -----------------------
153021c2f794Smrg# Minimum version: 1.0.0
153121c2f794Smrg#
153221c2f794Smrg# Determine which sections man pages go in for the different man page types
153321c2f794Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153421c2f794Smrg# Not sure if there's any better way than just hardcoding by OS name.
153521c2f794Smrg# Override default settings by setting environment variables
153612391620Smrg# Added MAN_SUBSTS in version 1.8
153712391620Smrg# Added AC_PROG_SED in version 1.8
153821c2f794Smrg
153921c2f794SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154021c2f794SmrgAC_REQUIRE([AC_CANONICAL_HOST])
154112391620SmrgAC_REQUIRE([AC_PROG_SED])
154221c2f794Smrg
1543889a2364Smrgcase $host_os in
1544889a2364Smrg    solaris*)
1545889a2364Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1546889a2364Smrg        # check for a man page file found in later versions that use
1547889a2364Smrg        # traditional section numbers instead
1548889a2364Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1549889a2364Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550889a2364Smrg        ;;
1551889a2364Smrg    *) SYSV_MAN_SECTIONS=false ;;
1552889a2364Smrgesac
1553889a2364Smrg
155421c2f794Smrgif test x$APP_MAN_SUFFIX = x    ; then
155521c2f794Smrg    APP_MAN_SUFFIX=1
155621c2f794Smrgfi
155721c2f794Smrgif test x$APP_MAN_DIR = x    ; then
155821c2f794Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
155921c2f794Smrgfi
156021c2f794Smrg
156121c2f794Smrgif test x$LIB_MAN_SUFFIX = x    ; then
156221c2f794Smrg    LIB_MAN_SUFFIX=3
156321c2f794Smrgfi
156421c2f794Smrgif test x$LIB_MAN_DIR = x    ; then
156521c2f794Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
156621c2f794Smrgfi
156721c2f794Smrg
156821c2f794Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1569889a2364Smrg    case $SYSV_MAN_SECTIONS in
1570889a2364Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1571889a2364Smrg	*)				FILE_MAN_SUFFIX=5  ;;
157221c2f794Smrg    esac
157321c2f794Smrgfi
157421c2f794Smrgif test x$FILE_MAN_DIR = x    ; then
157521c2f794Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
157621c2f794Smrgfi
157721c2f794Smrg
157821c2f794Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1579889a2364Smrg    case $SYSV_MAN_SECTIONS in
1580889a2364Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1581889a2364Smrg	*)				MISC_MAN_SUFFIX=7  ;;
158221c2f794Smrg    esac
158321c2f794Smrgfi
158421c2f794Smrgif test x$MISC_MAN_DIR = x    ; then
158521c2f794Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
158621c2f794Smrgfi
158721c2f794Smrg
158821c2f794Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1589889a2364Smrg    case $SYSV_MAN_SECTIONS in
1590889a2364Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1591889a2364Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159221c2f794Smrg    esac
159321c2f794Smrgfi
159421c2f794Smrgif test x$DRIVER_MAN_DIR = x    ; then
159521c2f794Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159621c2f794Smrgfi
159721c2f794Smrg
159821c2f794Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1599889a2364Smrg    case $SYSV_MAN_SECTIONS in
1600889a2364Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1601889a2364Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160221c2f794Smrg    esac
160321c2f794Smrgfi
160421c2f794Smrgif test x$ADMIN_MAN_DIR = x    ; then
160521c2f794Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160621c2f794Smrgfi
160721c2f794Smrg
160821c2f794Smrg
160921c2f794SmrgAC_SUBST([APP_MAN_SUFFIX])
161021c2f794SmrgAC_SUBST([LIB_MAN_SUFFIX])
161121c2f794SmrgAC_SUBST([FILE_MAN_SUFFIX])
161221c2f794SmrgAC_SUBST([MISC_MAN_SUFFIX])
161321c2f794SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161421c2f794SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161521c2f794SmrgAC_SUBST([APP_MAN_DIR])
161621c2f794SmrgAC_SUBST([LIB_MAN_DIR])
161721c2f794SmrgAC_SUBST([FILE_MAN_DIR])
161821c2f794SmrgAC_SUBST([MISC_MAN_DIR])
161921c2f794SmrgAC_SUBST([DRIVER_MAN_DIR])
162021c2f794SmrgAC_SUBST([ADMIN_MAN_DIR])
162112391620Smrg
162212391620SmrgXORG_MAN_PAGE="X Version 11"
162312391620SmrgAC_SUBST([XORG_MAN_PAGE])
162412391620SmrgMAN_SUBSTS="\
162512391620Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162612391620Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162712391620Smrg	-e 's|__xservername__|Xorg|g' \
162812391620Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
162912391620Smrg	-e 's|__projectroot__|\$(prefix)|g' \
163012391620Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163112391620Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163212391620Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163312391620Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163412391620Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163512391620Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163612391620Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163712391620SmrgAC_SUBST([MAN_SUBSTS])
163812391620Smrg
163921c2f794Smrg]) # XORG_MANPAGE_SECTIONS
164021c2f794Smrg
164112391620Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164212391620Smrg# ------------------------
164312391620Smrg# Minimum version: 1.7.0
164412391620Smrg#
164512391620Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164612391620Smrg# provided by xorg-sgml-doctools, if installed.
164712391620SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164812391620SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164912391620SmrgXORG_SGML_PATH=
165012391620SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165112391620Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165212391620Smrg    [m4_ifval([$1],[:],
165312391620Smrg        [if test x"$cross_compiling" != x"yes" ; then
165412391620Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165512391620Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165612391620Smrg         fi])
165712391620Smrg    ])
165812391620Smrg
165912391620Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166012391620Smrg# the path and the name of the doc stylesheet
166112391620Smrgif test "x$XORG_SGML_PATH" != "x" ; then
166212391620Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166312391620Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166412391620Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166512391620Smrgelse
166612391620Smrg   AC_MSG_RESULT([no])
166712391620Smrgfi
166812391620Smrg
166912391620SmrgAC_SUBST(XORG_SGML_PATH)
167012391620SmrgAC_SUBST(STYLESHEET_SRCDIR)
167112391620SmrgAC_SUBST(XSL_STYLESHEET)
167212391620SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167312391620Smrg]) # XORG_CHECK_SGML_DOCTOOLS
167412391620Smrg
167521c2f794Smrg# XORG_CHECK_LINUXDOC
167621c2f794Smrg# -------------------
167721c2f794Smrg# Minimum version: 1.0.0
167821c2f794Smrg#
167921c2f794Smrg# Defines the variable MAKE_TEXT if the necessary tools and
168021c2f794Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168121c2f794Smrg# Whether or not the necessary tools and files are found can be checked
168221c2f794Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168321c2f794SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168412391620SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168512391620SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
168621c2f794Smrg
168721c2f794SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
168821c2f794Smrg
168912391620SmrgAC_MSG_CHECKING([whether to build documentation])
169021c2f794Smrg
169112391620Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169221c2f794Smrg   BUILDDOC=yes
169321c2f794Smrgelse
169421c2f794Smrg   BUILDDOC=no
169521c2f794Smrgfi
169621c2f794Smrg
169721c2f794SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
169821c2f794Smrg
169921c2f794SmrgAC_MSG_RESULT([$BUILDDOC])
170021c2f794Smrg
170112391620SmrgAC_MSG_CHECKING([whether to build pdf documentation])
170221c2f794Smrg
170312391620Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170421c2f794Smrg   BUILDPDFDOC=yes
170521c2f794Smrgelse
170621c2f794Smrg   BUILDPDFDOC=no
170721c2f794Smrgfi
170821c2f794Smrg
170921c2f794SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171021c2f794Smrg
171121c2f794SmrgAC_MSG_RESULT([$BUILDPDFDOC])
171221c2f794Smrg
171312391620SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171421c2f794SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171521c2f794SmrgMAKE_PDF="$PS2PDF"
171621c2f794SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171721c2f794Smrg
171821c2f794SmrgAC_SUBST(MAKE_TEXT)
171921c2f794SmrgAC_SUBST(MAKE_PS)
172021c2f794SmrgAC_SUBST(MAKE_PDF)
172121c2f794SmrgAC_SUBST(MAKE_HTML)
172221c2f794Smrg]) # XORG_CHECK_LINUXDOC
172321c2f794Smrg
172421c2f794Smrg# XORG_CHECK_DOCBOOK
172521c2f794Smrg# -------------------
172621c2f794Smrg# Minimum version: 1.0.0
172721c2f794Smrg#
172821c2f794Smrg# Checks for the ability to build output formats from SGML DocBook source.
172921c2f794Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173021c2f794Smrg# indicates whether the necessary tools and files are found and, if set,
173121c2f794Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173221c2f794SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173312391620SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
173412391620Smrg
173521c2f794SmrgBUILDTXTDOC=no
173621c2f794SmrgBUILDPDFDOC=no
173721c2f794SmrgBUILDPSDOC=no
173821c2f794SmrgBUILDHTMLDOC=no
173921c2f794Smrg
174021c2f794SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174121c2f794SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174221c2f794SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174321c2f794SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
174421c2f794Smrg
174512391620SmrgAC_MSG_CHECKING([whether to build text documentation])
174612391620Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174721c2f794Smrg   test x$BUILD_TXTDOC != xno; then
174821c2f794Smrg	BUILDTXTDOC=yes
174921c2f794Smrgfi
175021c2f794SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175121c2f794SmrgAC_MSG_RESULT([$BUILDTXTDOC])
175221c2f794Smrg
175312391620SmrgAC_MSG_CHECKING([whether to build PDF documentation])
175412391620Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175521c2f794Smrg   test x$BUILD_PDFDOC != xno; then
175621c2f794Smrg	BUILDPDFDOC=yes
175721c2f794Smrgfi
175821c2f794SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175921c2f794SmrgAC_MSG_RESULT([$BUILDPDFDOC])
176021c2f794Smrg
176112391620SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176212391620Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176321c2f794Smrg   test x$BUILD_PSDOC != xno; then
176421c2f794Smrg	BUILDPSDOC=yes
176521c2f794Smrgfi
176621c2f794SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176721c2f794SmrgAC_MSG_RESULT([$BUILDPSDOC])
176821c2f794Smrg
176912391620SmrgAC_MSG_CHECKING([whether to build HTML documentation])
177012391620Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177121c2f794Smrg   test x$BUILD_HTMLDOC != xno; then
177221c2f794Smrg	BUILDHTMLDOC=yes
177321c2f794Smrgfi
177421c2f794SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177521c2f794SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
177621c2f794Smrg
177721c2f794SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177821c2f794SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177921c2f794SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178021c2f794SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178121c2f794Smrg
178221c2f794SmrgAC_SUBST(MAKE_TEXT)
178321c2f794SmrgAC_SUBST(MAKE_PS)
178421c2f794SmrgAC_SUBST(MAKE_PDF)
178521c2f794SmrgAC_SUBST(MAKE_HTML)
178621c2f794Smrg]) # XORG_CHECK_DOCBOOK
178721c2f794Smrg
178812391620Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178912391620Smrg# ----------------
179012391620Smrg# Minimum version: 1.5.0
179112391620Smrg# Minimum version for optional DEFAULT argument: 1.11.0
179212391620Smrg#
179312391620Smrg# Documentation tools are not always available on all platforms and sometimes
179412391620Smrg# not at the appropriate level. This macro enables a module to test for the
179512391620Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
179612391620Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
179712391620Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179812391620Smrg# --with-xmlto assumes 'auto'.
179912391620Smrg#
180012391620Smrg# Interface to module:
180112391620Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180212391620Smrg# XMLTO:	returns the path of the xmlto program found
180312391620Smrg#		returns the path set by the user in the environment
180412391620Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180512391620Smrg#		'no' user instructs the module not to use xmlto
180612391620Smrg#
180712391620Smrg# Added in version 1.10.0
180812391620Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180912391620Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
181012391620Smrg#
181112391620Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
181212391620Smrg#
181312391620SmrgAC_DEFUN([XORG_WITH_XMLTO],[
181412391620SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181512391620Smrgm4_define([_defopt], m4_default([$2], [auto]))
181612391620SmrgAC_ARG_WITH(xmlto,
181712391620Smrg	AS_HELP_STRING([--with-xmlto],
181812391620Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181912391620Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182012391620Smrgm4_undefine([_defopt])
182112391620Smrg
182212391620Smrgif test "x$use_xmlto" = x"auto"; then
182312391620Smrg   AC_PATH_PROG([XMLTO], [xmlto])
182412391620Smrg   if test "x$XMLTO" = "x"; then
182512391620Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182612391620Smrg	have_xmlto=no
182712391620Smrg   else
182812391620Smrg        have_xmlto=yes
182912391620Smrg   fi
183012391620Smrgelif test "x$use_xmlto" = x"yes" ; then
183112391620Smrg   AC_PATH_PROG([XMLTO], [xmlto])
183212391620Smrg   if test "x$XMLTO" = "x"; then
183312391620Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183412391620Smrg   fi
183512391620Smrg   have_xmlto=yes
183612391620Smrgelif test "x$use_xmlto" = x"no" ; then
183712391620Smrg   if test "x$XMLTO" != "x"; then
183812391620Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183912391620Smrg   fi
184012391620Smrg   have_xmlto=no
184112391620Smrgelse
184212391620Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184312391620Smrgfi
184412391620Smrg
184512391620Smrg# Test for a minimum version of xmlto, if provided.
184612391620Smrgm4_ifval([$1],
184712391620Smrg[if test "$have_xmlto" = yes; then
184812391620Smrg    # scrape the xmlto version
184912391620Smrg    AC_MSG_CHECKING([the xmlto version])
185012391620Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185112391620Smrg    AC_MSG_RESULT([$xmlto_version])
185212391620Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185312391620Smrg        [if test "x$use_xmlto" = xauto; then
185412391620Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185512391620Smrg            have_xmlto=no
185612391620Smrg        else
185712391620Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185812391620Smrg        fi])
185912391620Smrgfi])
186012391620Smrg
186112391620Smrg# Test for the ability of xmlto to generate a text target
1862889a2364Smrg#
1863889a2364Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1864889a2364Smrg# following test for empty XML docbook files.
1865889a2364Smrg# For compatibility reasons use the following empty XML docbook file and if
1866889a2364Smrg# it fails try it again with a non-empty XML file.
186712391620Smrghave_xmlto_text=no
186812391620Smrgcat > conftest.xml << "EOF"
186912391620SmrgEOF
187012391620SmrgAS_IF([test "$have_xmlto" = yes],
187112391620Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187212391620Smrg             [have_xmlto_text=yes],
1873889a2364Smrg             [# Try it again with a non-empty XML file.
1874889a2364Smrg              cat > conftest.xml << "EOF"
1875889a2364Smrg<x></x>
1876889a2364SmrgEOF
1877889a2364Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1878889a2364Smrg                    [have_xmlto_text=yes],
1879889a2364Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188012391620Smrgrm -f conftest.xml
188112391620SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188212391620SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188312391620Smrg]) # XORG_WITH_XMLTO
188412391620Smrg
188582e12b1bSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188682e12b1bSmrg# --------------------------------------------
188782e12b1bSmrg# Minimum version: 1.12.0
188882e12b1bSmrg# Minimum version for optional DEFAULT argument: 1.12.0
188982e12b1bSmrg#
189082e12b1bSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189182e12b1bSmrg# XML-based language used for the transformation of XML documents.
189282e12b1bSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189382e12b1bSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189482e12b1bSmrg# The XSLT processor is often used as a standalone tool for transformations.
189582e12b1bSmrg# It should not be assumed that this tool is used only to work with documnetation.
189682e12b1bSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189782e12b1bSmrg#
189882e12b1bSmrg# Interface to module:
189982e12b1bSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190082e12b1bSmrg# XSLTPROC:	 returns the path of the xsltproc program found
190182e12b1bSmrg#		 returns the path set by the user in the environment
190282e12b1bSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190382e12b1bSmrg#		  'no' user instructs the module not to use xsltproc
190482e12b1bSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190582e12b1bSmrg#
190682e12b1bSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190782e12b1bSmrg#
190882e12b1bSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190982e12b1bSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191082e12b1bSmrg# Preserves the interface, should it be implemented later
191182e12b1bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191282e12b1bSmrgm4_define([_defopt], m4_default([$2], [auto]))
191382e12b1bSmrgAC_ARG_WITH(xsltproc,
191482e12b1bSmrg	AS_HELP_STRING([--with-xsltproc],
191582e12b1bSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191682e12b1bSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191782e12b1bSmrgm4_undefine([_defopt])
191882e12b1bSmrg
191982e12b1bSmrgif test "x$use_xsltproc" = x"auto"; then
192082e12b1bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192182e12b1bSmrg   if test "x$XSLTPROC" = "x"; then
192282e12b1bSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192382e12b1bSmrg	have_xsltproc=no
192482e12b1bSmrg   else
192582e12b1bSmrg        have_xsltproc=yes
192682e12b1bSmrg   fi
192782e12b1bSmrgelif test "x$use_xsltproc" = x"yes" ; then
192882e12b1bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192982e12b1bSmrg   if test "x$XSLTPROC" = "x"; then
193082e12b1bSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193182e12b1bSmrg   fi
193282e12b1bSmrg   have_xsltproc=yes
193382e12b1bSmrgelif test "x$use_xsltproc" = x"no" ; then
193482e12b1bSmrg   if test "x$XSLTPROC" != "x"; then
193582e12b1bSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193682e12b1bSmrg   fi
193782e12b1bSmrg   have_xsltproc=no
193882e12b1bSmrgelse
193982e12b1bSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
194082e12b1bSmrgfi
194182e12b1bSmrg
194282e12b1bSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194382e12b1bSmrg]) # XORG_WITH_XSLTPROC
194482e12b1bSmrg
194582e12b1bSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194682e12b1bSmrg# ----------------------------------------
194782e12b1bSmrg# Minimum version: 1.15.0
194882e12b1bSmrg#
194982e12b1bSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
195082e12b1bSmrg# scanning arbitrary text files, extracting information from those text files,
195182e12b1bSmrg# and printing reports based on that information.
195282e12b1bSmrg#
195382e12b1bSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
195482e12b1bSmrg#
195582e12b1bSmrg# Interface to module:
195682e12b1bSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
195782e12b1bSmrg# PERL:	     returns the path of the perl program found
195882e12b1bSmrg#	     returns the path set by the user in the environment
195982e12b1bSmrg# --with-perl: 'yes' user instructs the module to use perl
196082e12b1bSmrg#	       'no' user instructs the module not to use perl
196182e12b1bSmrg# have_perl: returns yes if perl found in PATH or no
196282e12b1bSmrg#
196382e12b1bSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196482e12b1bSmrg#
196582e12b1bSmrgAC_DEFUN([XORG_WITH_PERL],[
196682e12b1bSmrgAC_ARG_VAR([PERL], [Path to perl command])
196782e12b1bSmrg# Preserves the interface, should it be implemented later
196882e12b1bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196982e12b1bSmrgm4_define([_defopt], m4_default([$2], [auto]))
197082e12b1bSmrgAC_ARG_WITH(perl,
197182e12b1bSmrg	AS_HELP_STRING([--with-perl],
197282e12b1bSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197382e12b1bSmrg	   [use_perl=$withval], [use_perl=]_defopt)
197482e12b1bSmrgm4_undefine([_defopt])
197582e12b1bSmrg
197682e12b1bSmrgif test "x$use_perl" = x"auto"; then
197782e12b1bSmrg   AC_PATH_PROG([PERL], [perl])
197882e12b1bSmrg   if test "x$PERL" = "x"; then
197982e12b1bSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198082e12b1bSmrg	have_perl=no
198182e12b1bSmrg   else
198282e12b1bSmrg        have_perl=yes
198382e12b1bSmrg   fi
198482e12b1bSmrgelif test "x$use_perl" = x"yes" ; then
198582e12b1bSmrg   AC_PATH_PROG([PERL], [perl])
198682e12b1bSmrg   if test "x$PERL" = "x"; then
198782e12b1bSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198882e12b1bSmrg   fi
198982e12b1bSmrg   have_perl=yes
199082e12b1bSmrgelif test "x$use_perl" = x"no" ; then
199182e12b1bSmrg   if test "x$PERL" != "x"; then
199282e12b1bSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199382e12b1bSmrg   fi
199482e12b1bSmrg   have_perl=no
199582e12b1bSmrgelse
199682e12b1bSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199782e12b1bSmrgfi
199882e12b1bSmrg
199982e12b1bSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200082e12b1bSmrg]) # XORG_WITH_PERL
200182e12b1bSmrg
200212391620Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
200312391620Smrg# ----------------
200412391620Smrg# Minimum version: 1.5.0
200512391620Smrg# Minimum version for optional DEFAULT argument: 1.11.0
200612391620Smrg#
200712391620Smrg# Documentation tools are not always available on all platforms and sometimes
200812391620Smrg# not at the appropriate level. This macro enables a module to test for the
200912391620Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
201012391620Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
201112391620Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201212391620Smrg# --with-asciidoc assumes 'auto'.
201312391620Smrg#
201412391620Smrg# Interface to module:
201512391620Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201612391620Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
201712391620Smrg#		 returns the path set by the user in the environment
201812391620Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201912391620Smrg#		  'no' user instructs the module not to use asciidoc
202012391620Smrg#
202112391620Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
202212391620Smrg#
202312391620SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202412391620SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202512391620Smrgm4_define([_defopt], m4_default([$2], [auto]))
202612391620SmrgAC_ARG_WITH(asciidoc,
202712391620Smrg	AS_HELP_STRING([--with-asciidoc],
202812391620Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202912391620Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203012391620Smrgm4_undefine([_defopt])
203112391620Smrg
203212391620Smrgif test "x$use_asciidoc" = x"auto"; then
203312391620Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203412391620Smrg   if test "x$ASCIIDOC" = "x"; then
203512391620Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203612391620Smrg	have_asciidoc=no
203712391620Smrg   else
203812391620Smrg        have_asciidoc=yes
203912391620Smrg   fi
204012391620Smrgelif test "x$use_asciidoc" = x"yes" ; then
204112391620Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204212391620Smrg   if test "x$ASCIIDOC" = "x"; then
204312391620Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204412391620Smrg   fi
204512391620Smrg   have_asciidoc=yes
204612391620Smrgelif test "x$use_asciidoc" = x"no" ; then
204712391620Smrg   if test "x$ASCIIDOC" != "x"; then
204812391620Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204912391620Smrg   fi
205012391620Smrg   have_asciidoc=no
205112391620Smrgelse
205212391620Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205312391620Smrgfi
205412391620Smrgm4_ifval([$1],
205512391620Smrg[if test "$have_asciidoc" = yes; then
205612391620Smrg    # scrape the asciidoc version
205712391620Smrg    AC_MSG_CHECKING([the asciidoc version])
205812391620Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205912391620Smrg    AC_MSG_RESULT([$asciidoc_version])
206012391620Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206112391620Smrg        [if test "x$use_asciidoc" = xauto; then
206212391620Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206312391620Smrg            have_asciidoc=no
206412391620Smrg        else
206512391620Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206612391620Smrg        fi])
206712391620Smrgfi])
206812391620SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206912391620Smrg]) # XORG_WITH_ASCIIDOC
207012391620Smrg
207112391620Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20721b2353dbSmrg# -------------------------------------------
207312391620Smrg# Minimum version: 1.5.0
207412391620Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20751b2353dbSmrg# Minimum version for optional DOT checking: 1.18.0
207612391620Smrg#
207712391620Smrg# Documentation tools are not always available on all platforms and sometimes
207812391620Smrg# not at the appropriate level. This macro enables a module to test for the
207912391620Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
208012391620Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
208112391620Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208212391620Smrg# --with-doxygen assumes 'auto'.
208312391620Smrg#
208412391620Smrg# Interface to module:
208512391620Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208612391620Smrg# DOXYGEN:	 returns the path of the doxygen program found
208712391620Smrg#		 returns the path set by the user in the environment
208812391620Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208912391620Smrg#		  'no' user instructs the module not to use doxygen
209012391620Smrg#
209112391620Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
209212391620Smrg#
209312391620SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209412391620SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20951b2353dbSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209612391620Smrgm4_define([_defopt], m4_default([$2], [auto]))
209712391620SmrgAC_ARG_WITH(doxygen,
209812391620Smrg	AS_HELP_STRING([--with-doxygen],
209912391620Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210012391620Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210112391620Smrgm4_undefine([_defopt])
210212391620Smrg
210312391620Smrgif test "x$use_doxygen" = x"auto"; then
210412391620Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210512391620Smrg   if test "x$DOXYGEN" = "x"; then
210612391620Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210712391620Smrg	have_doxygen=no
210812391620Smrg   else
210912391620Smrg        have_doxygen=yes
211012391620Smrg   fi
211112391620Smrgelif test "x$use_doxygen" = x"yes" ; then
211212391620Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211312391620Smrg   if test "x$DOXYGEN" = "x"; then
211412391620Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211512391620Smrg   fi
211612391620Smrg   have_doxygen=yes
211712391620Smrgelif test "x$use_doxygen" = x"no" ; then
211812391620Smrg   if test "x$DOXYGEN" != "x"; then
211912391620Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212012391620Smrg   fi
212112391620Smrg   have_doxygen=no
212212391620Smrgelse
212312391620Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
212412391620Smrgfi
212512391620Smrgm4_ifval([$1],
212612391620Smrg[if test "$have_doxygen" = yes; then
212712391620Smrg    # scrape the doxygen version
212812391620Smrg    AC_MSG_CHECKING([the doxygen version])
212912391620Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213012391620Smrg    AC_MSG_RESULT([$doxygen_version])
213112391620Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213212391620Smrg        [if test "x$use_doxygen" = xauto; then
213312391620Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213412391620Smrg            have_doxygen=no
213512391620Smrg        else
213612391620Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213712391620Smrg        fi])
213812391620Smrgfi])
21391b2353dbSmrg
21401b2353dbSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21411b2353dbSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21421b2353dbSmrgdnl 	HAVE_DOT = @HAVE_DOT@
21431b2353dbSmrgHAVE_DOT=no
21441b2353dbSmrgif test "x$have_doxygen" = "xyes"; then
21451b2353dbSmrg  AC_PATH_PROG([DOT], [dot])
21461b2353dbSmrg    if test "x$DOT" != "x"; then
21471b2353dbSmrg      HAVE_DOT=yes
21481b2353dbSmrg    fi
21491b2353dbSmrgfi
21501b2353dbSmrg
21511b2353dbSmrgAC_SUBST([HAVE_DOT])
21521b2353dbSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215312391620SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215412391620Smrg]) # XORG_WITH_DOXYGEN
215512391620Smrg
215612391620Smrg# XORG_WITH_GROFF([DEFAULT])
215712391620Smrg# ----------------
215812391620Smrg# Minimum version: 1.6.0
215912391620Smrg# Minimum version for optional DEFAULT argument: 1.11.0
216012391620Smrg#
216112391620Smrg# Documentation tools are not always available on all platforms and sometimes
216212391620Smrg# not at the appropriate level. This macro enables a module to test for the
216312391620Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
216412391620Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
216512391620Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
216612391620Smrg# --with-groff assumes 'auto'.
216712391620Smrg#
216812391620Smrg# Interface to module:
216912391620Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217012391620Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217112391620Smrg# HAVE_GROFF_MS: the -ms macros package
217212391620Smrg# GROFF:	 returns the path of the groff program found
217312391620Smrg#		 returns the path set by the user in the environment
217412391620Smrg# --with-groff:	 'yes' user instructs the module to use groff
217512391620Smrg#		 'no' user instructs the module not to use groff
217612391620Smrg#
217712391620Smrg# Added in version 1.9.0:
217812391620Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217912391620Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218012391620Smrg#		   psselect from the psutils package.
218112391620Smrg#		   the ghostcript package. Refer to the grohtml man pages
218212391620Smrg#
218312391620Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218412391620Smrg#
218512391620Smrg# OS and distros often splits groff in a basic and full package, the former
218612391620Smrg# having the groff program and the later having devices, fonts and macros
218712391620Smrg# Checking for the groff executable is not enough.
218812391620Smrg#
218912391620Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
219012391620Smrg# unset HAVE_GROFF or GROFF env variables.
219112391620Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219212391620Smrg#
219312391620SmrgAC_DEFUN([XORG_WITH_GROFF],[
219412391620SmrgAC_ARG_VAR([GROFF], [Path to groff command])
219512391620Smrgm4_define([_defopt], m4_default([$1], [auto]))
219612391620SmrgAC_ARG_WITH(groff,
219712391620Smrg	AS_HELP_STRING([--with-groff],
219812391620Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219912391620Smrg	   [use_groff=$withval], [use_groff=]_defopt)
220012391620Smrgm4_undefine([_defopt])
220112391620Smrg
220212391620Smrgif test "x$use_groff" = x"auto"; then
220312391620Smrg   AC_PATH_PROG([GROFF], [groff])
220412391620Smrg   if test "x$GROFF" = "x"; then
220512391620Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220612391620Smrg	have_groff=no
220712391620Smrg   else
220812391620Smrg        have_groff=yes
220912391620Smrg   fi
221012391620Smrgelif test "x$use_groff" = x"yes" ; then
221112391620Smrg   AC_PATH_PROG([GROFF], [groff])
221212391620Smrg   if test "x$GROFF" = "x"; then
221312391620Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221412391620Smrg   fi
221512391620Smrg   have_groff=yes
221612391620Smrgelif test "x$use_groff" = x"no" ; then
221712391620Smrg   if test "x$GROFF" != "x"; then
221812391620Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221912391620Smrg   fi
222012391620Smrg   have_groff=no
222112391620Smrgelse
222212391620Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222312391620Smrgfi
222412391620Smrg
222512391620Smrg# We have groff, test for the presence of the macro packages
222612391620Smrgif test "x$have_groff" = x"yes"; then
222712391620Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222812391620Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222912391620Smrg        groff_ms_works=yes
223012391620Smrg    else
223112391620Smrg        groff_ms_works=no
223212391620Smrg    fi
223312391620Smrg    AC_MSG_RESULT([$groff_ms_works])
223412391620Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223512391620Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223612391620Smrg        groff_mm_works=yes
223712391620Smrg    else
223812391620Smrg        groff_mm_works=no
223912391620Smrg    fi
224012391620Smrg    AC_MSG_RESULT([$groff_mm_works])
224112391620Smrgfi
224212391620Smrg
224312391620Smrg# We have groff, test for HTML dependencies, one command per package
224412391620Smrgif test "x$have_groff" = x"yes"; then
224512391620Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224612391620Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224712391620Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224812391620Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224912391620Smrg      have_groff_html=yes
225012391620Smrg   else
225112391620Smrg      have_groff_html=no
225212391620Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225312391620Smrg   fi
225412391620Smrgfi
225512391620Smrg
225612391620Smrg# Set Automake conditionals for Makefiles
225712391620SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225812391620SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225912391620SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226012391620SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226112391620Smrg]) # XORG_WITH_GROFF
226212391620Smrg
226382e12b1bSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226482e12b1bSmrg# ---------------------------------------
226512391620Smrg# Minimum version: 1.6.0
226612391620Smrg# Minimum version for optional DEFAULT argument: 1.11.0
226782e12b1bSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226812391620Smrg#
226912391620Smrg# Documentation tools are not always available on all platforms and sometimes
227012391620Smrg# not at the appropriate level. This macro enables a module to test for the
227112391620Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
227212391620Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
227312391620Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
227412391620Smrg# --with-fop assumes 'auto'.
227512391620Smrg#
227612391620Smrg# Interface to module:
227712391620Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227812391620Smrg# FOP:	 	returns the path of the fop program found
227912391620Smrg#		returns the path set by the user in the environment
228012391620Smrg# --with-fop: 	'yes' user instructs the module to use fop
228112391620Smrg#		'no' user instructs the module not to use fop
228212391620Smrg#
228312391620Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228412391620Smrg#
228512391620SmrgAC_DEFUN([XORG_WITH_FOP],[
228612391620SmrgAC_ARG_VAR([FOP], [Path to fop command])
228782e12b1bSmrgm4_define([_defopt], m4_default([$2], [auto]))
228812391620SmrgAC_ARG_WITH(fop,
228912391620Smrg	AS_HELP_STRING([--with-fop],
229012391620Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229112391620Smrg	   [use_fop=$withval], [use_fop=]_defopt)
229212391620Smrgm4_undefine([_defopt])
229312391620Smrg
229412391620Smrgif test "x$use_fop" = x"auto"; then
229512391620Smrg   AC_PATH_PROG([FOP], [fop])
229612391620Smrg   if test "x$FOP" = "x"; then
229712391620Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229812391620Smrg	have_fop=no
229912391620Smrg   else
230012391620Smrg        have_fop=yes
230112391620Smrg   fi
230212391620Smrgelif test "x$use_fop" = x"yes" ; then
230312391620Smrg   AC_PATH_PROG([FOP], [fop])
230412391620Smrg   if test "x$FOP" = "x"; then
230512391620Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230612391620Smrg   fi
230712391620Smrg   have_fop=yes
230812391620Smrgelif test "x$use_fop" = x"no" ; then
230912391620Smrg   if test "x$FOP" != "x"; then
231012391620Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231112391620Smrg   fi
231212391620Smrg   have_fop=no
231312391620Smrgelse
231412391620Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
231512391620Smrgfi
231682e12b1bSmrg
231782e12b1bSmrg# Test for a minimum version of fop, if provided.
231882e12b1bSmrgm4_ifval([$1],
231982e12b1bSmrg[if test "$have_fop" = yes; then
232082e12b1bSmrg    # scrape the fop version
232182e12b1bSmrg    AC_MSG_CHECKING([for fop minimum version])
232282e12b1bSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232382e12b1bSmrg    AC_MSG_RESULT([$fop_version])
232482e12b1bSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
232582e12b1bSmrg        [if test "x$use_fop" = xauto; then
232682e12b1bSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232782e12b1bSmrg            have_fop=no
232882e12b1bSmrg        else
232982e12b1bSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233082e12b1bSmrg        fi])
233182e12b1bSmrgfi])
233212391620SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233312391620Smrg]) # XORG_WITH_FOP
233412391620Smrg
23351b2353dbSmrg# XORG_WITH_M4([MIN-VERSION])
23361b2353dbSmrg# ---------------------------
23371b2353dbSmrg# Minimum version: 1.19.0
23381b2353dbSmrg#
23391b2353dbSmrg# This macro attempts to locate an m4 macro processor which supports
23401b2353dbSmrg# -I option and is only useful for modules relying on M4 in order to
23411b2353dbSmrg# expand macros in source code files.
23421b2353dbSmrg#
23431b2353dbSmrg# Interface to module:
23441b2353dbSmrg# M4:	 	returns the path of the m4 program found
23451b2353dbSmrg#		returns the path set by the user in the environment
23461b2353dbSmrg#
23471b2353dbSmrgAC_DEFUN([XORG_WITH_M4], [
23481b2353dbSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23491b2353dbSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23501b2353dbSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23511b2353dbSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23521b2353dbSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23531b2353dbSmrg   [$PATH:/usr/gnu/bin])])
23541b2353dbSmrg
23551b2353dbSmrgAC_SUBST([M4], [$ac_cv_path_M4])
23561b2353dbSmrg]) # XORG_WITH_M4
23571b2353dbSmrg
235812391620Smrg# XORG_WITH_PS2PDF([DEFAULT])
235912391620Smrg# ----------------
236012391620Smrg# Minimum version: 1.6.0
236112391620Smrg# Minimum version for optional DEFAULT argument: 1.11.0
236212391620Smrg#
236312391620Smrg# Documentation tools are not always available on all platforms and sometimes
236412391620Smrg# not at the appropriate level. This macro enables a module to test for the
236512391620Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
236612391620Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
236712391620Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236812391620Smrg# --with-ps2pdf assumes 'auto'.
236912391620Smrg#
237012391620Smrg# Interface to module:
237112391620Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237212391620Smrg# PS2PDF:	returns the path of the ps2pdf program found
237312391620Smrg#		returns the path set by the user in the environment
237412391620Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237512391620Smrg#		 'no' user instructs the module not to use ps2pdf
237612391620Smrg#
237712391620Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237812391620Smrg#
237912391620SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238012391620SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238112391620Smrgm4_define([_defopt], m4_default([$1], [auto]))
238212391620SmrgAC_ARG_WITH(ps2pdf,
238312391620Smrg	AS_HELP_STRING([--with-ps2pdf],
238412391620Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238512391620Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238612391620Smrgm4_undefine([_defopt])
238712391620Smrg
238812391620Smrgif test "x$use_ps2pdf" = x"auto"; then
238912391620Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239012391620Smrg   if test "x$PS2PDF" = "x"; then
239112391620Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239212391620Smrg	have_ps2pdf=no
239312391620Smrg   else
239412391620Smrg        have_ps2pdf=yes
239512391620Smrg   fi
239612391620Smrgelif test "x$use_ps2pdf" = x"yes" ; then
239712391620Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239812391620Smrg   if test "x$PS2PDF" = "x"; then
239912391620Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240012391620Smrg   fi
240112391620Smrg   have_ps2pdf=yes
240212391620Smrgelif test "x$use_ps2pdf" = x"no" ; then
240312391620Smrg   if test "x$PS2PDF" != "x"; then
240412391620Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240512391620Smrg   fi
240612391620Smrg   have_ps2pdf=no
240712391620Smrgelse
240812391620Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
240912391620Smrgfi
241012391620SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241112391620Smrg]) # XORG_WITH_PS2PDF
241212391620Smrg
241312391620Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
241412391620Smrg# ----------------
241512391620Smrg# Minimum version: 1.6.0
241612391620Smrg#
241712391620Smrg# Documentation tools are not always available on all platforms and sometimes
241812391620Smrg# not at the appropriate level. This macro enables a builder to skip all
241912391620Smrg# documentation targets except traditional man pages.
242012391620Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242112391620Smrg# maximum flexibilty in controlling documentation building.
242212391620Smrg# Refer to:
242312391620Smrg# XORG_WITH_XMLTO         --with-xmlto
242412391620Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242512391620Smrg# XORG_WITH_DOXYGEN       --with-doxygen
242612391620Smrg# XORG_WITH_FOP           --with-fop
242712391620Smrg# XORG_WITH_GROFF         --with-groff
242812391620Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
242912391620Smrg#
243012391620Smrg# Interface to module:
243112391620Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243212391620Smrg# --enable-docs: 'yes' user instructs the module to generate docs
243312391620Smrg#		 'no' user instructs the module not to generate docs
243412391620Smrg# parm1:	specify the default value, yes or no.
243512391620Smrg#
243612391620SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243782e12b1bSmrgm4_define([docs_default], m4_default([$1], [yes]))
243812391620SmrgAC_ARG_ENABLE(docs,
243912391620Smrg	AS_HELP_STRING([--enable-docs],
244082e12b1bSmrg	   [Enable building the documentation (default: ]docs_default[)]),
244182e12b1bSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
244282e12b1bSmrgm4_undefine([docs_default])
244312391620SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244412391620SmrgAC_MSG_CHECKING([whether to build documentation])
244512391620SmrgAC_MSG_RESULT([$build_docs])
244612391620Smrg]) # XORG_ENABLE_DOCS
244712391620Smrg
244812391620Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244912391620Smrg# ----------------
245012391620Smrg# Minimum version: 1.6.0
245112391620Smrg#
245212391620Smrg# This macro enables a builder to skip all developer documentation.
245312391620Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245412391620Smrg# maximum flexibilty in controlling documentation building.
245512391620Smrg# Refer to:
245612391620Smrg# XORG_WITH_XMLTO         --with-xmlto
245712391620Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245812391620Smrg# XORG_WITH_DOXYGEN       --with-doxygen
245912391620Smrg# XORG_WITH_FOP           --with-fop
246012391620Smrg# XORG_WITH_GROFF         --with-groff
246112391620Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
246212391620Smrg#
246312391620Smrg# Interface to module:
246412391620Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246512391620Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246612391620Smrg#			'no' user instructs the module not to generate developer docs
246712391620Smrg# parm1:		specify the default value, yes or no.
246812391620Smrg#
246912391620SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247012391620Smrgm4_define([devel_default], m4_default([$1], [yes]))
247112391620SmrgAC_ARG_ENABLE(devel-docs,
247212391620Smrg	AS_HELP_STRING([--enable-devel-docs],
247312391620Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247412391620Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247512391620Smrgm4_undefine([devel_default])
247612391620SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247712391620SmrgAC_MSG_CHECKING([whether to build developer documentation])
247812391620SmrgAC_MSG_RESULT([$build_devel_docs])
247912391620Smrg]) # XORG_ENABLE_DEVEL_DOCS
248012391620Smrg
248112391620Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
248212391620Smrg# ----------------
248312391620Smrg# Minimum version: 1.6.0
248412391620Smrg#
248512391620Smrg# This macro enables a builder to skip all functional specification targets.
248612391620Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248712391620Smrg# maximum flexibilty in controlling documentation building.
248812391620Smrg# Refer to:
248912391620Smrg# XORG_WITH_XMLTO         --with-xmlto
249012391620Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249112391620Smrg# XORG_WITH_DOXYGEN       --with-doxygen
249212391620Smrg# XORG_WITH_FOP           --with-fop
249312391620Smrg# XORG_WITH_GROFF         --with-groff
249412391620Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
249512391620Smrg#
249612391620Smrg# Interface to module:
249712391620Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249812391620Smrg# --enable-specs:	'yes' user instructs the module to generate specs
249912391620Smrg#			'no' user instructs the module not to generate specs
250012391620Smrg# parm1:		specify the default value, yes or no.
250112391620Smrg#
250212391620SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250312391620Smrgm4_define([spec_default], m4_default([$1], [yes]))
250412391620SmrgAC_ARG_ENABLE(specs,
250512391620Smrg	AS_HELP_STRING([--enable-specs],
250612391620Smrg	   [Enable building the specs (default: ]spec_default[)]),
250712391620Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
250812391620Smrgm4_undefine([spec_default])
250912391620SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251012391620SmrgAC_MSG_CHECKING([whether to build functional specifications])
251112391620SmrgAC_MSG_RESULT([$build_specs])
251212391620Smrg]) # XORG_ENABLE_SPECS
251312391620Smrg
251482e12b1bSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251582e12b1bSmrg# ----------------------------------------------
251682e12b1bSmrg# Minimum version: 1.13.0
251782e12b1bSmrg#
251882e12b1bSmrg# This macro enables a builder to enable/disable unit testing
251982e12b1bSmrg# It makes no assumption about the test cases implementation
252082e12b1bSmrg# Test cases may or may not use Automake "Support for test suites"
252182e12b1bSmrg# They may or may not use the software utility library GLib
252282e12b1bSmrg#
252382e12b1bSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252482e12b1bSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252582e12b1bSmrg# The variable enable_unit_tests is used by other macros in this file.
252682e12b1bSmrg#
252782e12b1bSmrg# Interface to module:
252882e12b1bSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252982e12b1bSmrg# enable_unit_tests:    used in configure.ac for additional configuration
253082e12b1bSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253182e12b1bSmrg#			'no' user instructs the module not to build tests
253282e12b1bSmrg# parm1:		specify the default value, yes or no.
253382e12b1bSmrg#
253482e12b1bSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253582e12b1bSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253682e12b1bSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253782e12b1bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253882e12b1bSmrgm4_define([_defopt], m4_default([$1], [auto]))
253982e12b1bSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254082e12b1bSmrg	[Enable building unit test cases (default: ]_defopt[)]),
254182e12b1bSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254282e12b1bSmrgm4_undefine([_defopt])
254382e12b1bSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254482e12b1bSmrgAC_MSG_CHECKING([whether to build unit test cases])
254582e12b1bSmrgAC_MSG_RESULT([$enable_unit_tests])
254682e12b1bSmrg]) # XORG_ENABLE_UNIT_TESTS
254782e12b1bSmrg
254882e12b1bSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254982e12b1bSmrg# ------------------------------------------------------
255082e12b1bSmrg# Minimum version: 1.17.0
255182e12b1bSmrg#
255282e12b1bSmrg# This macro enables a builder to enable/disable integration testing
255382e12b1bSmrg# It makes no assumption about the test cases' implementation
255482e12b1bSmrg# Test cases may or may not use Automake "Support for test suites"
255582e12b1bSmrg#
255682e12b1bSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255782e12b1bSmrg# usually requires less dependencies and may be built and run under less
255882e12b1bSmrg# stringent environments than integration tests.
255982e12b1bSmrg#
256082e12b1bSmrg# Interface to module:
256182e12b1bSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256282e12b1bSmrg# enable_integration_tests:   used in configure.ac for additional configuration
256382e12b1bSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256482e12b1bSmrg#                             'no' user instructs the module not to build tests
256582e12b1bSmrg# parm1:                      specify the default value, yes or no.
256682e12b1bSmrg#
256782e12b1bSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256882e12b1bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256982e12b1bSmrgm4_define([_defopt], m4_default([$1], [auto]))
257082e12b1bSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257182e12b1bSmrg	[Enable building integration test cases (default: ]_defopt[)]),
257282e12b1bSmrg	[enable_integration_tests=$enableval],
257382e12b1bSmrg	[enable_integration_tests=]_defopt)
257482e12b1bSmrgm4_undefine([_defopt])
257582e12b1bSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257682e12b1bSmrg	[test "x$enable_integration_tests" != xno])
257782e12b1bSmrgAC_MSG_CHECKING([whether to build unit test cases])
257882e12b1bSmrgAC_MSG_RESULT([$enable_integration_tests])
257982e12b1bSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
258082e12b1bSmrg
258182e12b1bSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258282e12b1bSmrg# ----------------------------------------
258382e12b1bSmrg# Minimum version: 1.13.0
258482e12b1bSmrg#
258582e12b1bSmrg# GLib is a library which provides advanced data structures and functions.
258682e12b1bSmrg# This macro enables a module to test for the presence of Glib.
258782e12b1bSmrg#
258882e12b1bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258982e12b1bSmrg# Otherwise the value of $enable_unit_tests is blank.
259082e12b1bSmrg#
259182e12b1bSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259282e12b1bSmrg# test support usually requires less dependencies and may be built and run under
259382e12b1bSmrg# less stringent environments than integration tests.
259482e12b1bSmrg#
259582e12b1bSmrg# Interface to module:
259682e12b1bSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
259782e12b1bSmrg# with_glib: used in configure.ac to know if GLib has been found
259882e12b1bSmrg# --with-glib:	'yes' user instructs the module to use glib
259982e12b1bSmrg#		'no' user instructs the module not to use glib
260082e12b1bSmrg#
260182e12b1bSmrgAC_DEFUN([XORG_WITH_GLIB],[
260282e12b1bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260382e12b1bSmrgm4_define([_defopt], m4_default([$2], [auto]))
260482e12b1bSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260582e12b1bSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260682e12b1bSmrg	[with_glib=$withval], [with_glib=]_defopt)
260782e12b1bSmrgm4_undefine([_defopt])
260882e12b1bSmrg
260982e12b1bSmrghave_glib=no
261082e12b1bSmrg# Do not probe GLib if user explicitly disabled unit testing
261182e12b1bSmrgif test "x$enable_unit_tests" != x"no"; then
261282e12b1bSmrg  # Do not probe GLib if user explicitly disabled it
261382e12b1bSmrg  if test "x$with_glib" != x"no"; then
261482e12b1bSmrg    m4_ifval(
261582e12b1bSmrg      [$1],
261682e12b1bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261782e12b1bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261882e12b1bSmrg    )
261982e12b1bSmrg  fi
262082e12b1bSmrgfi
262182e12b1bSmrg
262282e12b1bSmrg# Not having GLib when unit testing has been explicitly requested is an error
262382e12b1bSmrgif test "x$enable_unit_tests" = x"yes"; then
262482e12b1bSmrg  if test "x$have_glib" = x"no"; then
262582e12b1bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
262682e12b1bSmrg  fi
262782e12b1bSmrgfi
262882e12b1bSmrg
262982e12b1bSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
263082e12b1bSmrgif test "x$enable_unit_tests" = x"no"; then
263182e12b1bSmrg  if test "x$with_glib" = x"yes"; then
263282e12b1bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263382e12b1bSmrg  fi
263482e12b1bSmrgfi
263582e12b1bSmrg
263682e12b1bSmrg# Not having GLib when it has been explicitly requested is an error
263782e12b1bSmrgif test "x$with_glib" = x"yes"; then
263882e12b1bSmrg  if test "x$have_glib" = x"no"; then
263982e12b1bSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264082e12b1bSmrg  fi
264182e12b1bSmrgfi
264282e12b1bSmrg
264382e12b1bSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264482e12b1bSmrg]) # XORG_WITH_GLIB
264582e12b1bSmrg
264682e12b1bSmrg# XORG_LD_WRAP([required|optional])
264782e12b1bSmrg# ---------------------------------
264882e12b1bSmrg# Minimum version: 1.13.0
264982e12b1bSmrg#
265082e12b1bSmrg# Check if linker supports -wrap, passed via compiler flags
265182e12b1bSmrg#
265282e12b1bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265382e12b1bSmrg# Otherwise the value of $enable_unit_tests is blank.
265482e12b1bSmrg#
265582e12b1bSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265682e12b1bSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265782e12b1bSmrg# available, an argument of "optional" allows use when some unit tests require
265882e12b1bSmrg# ld -wrap and others do not.
265982e12b1bSmrg#
266082e12b1bSmrgAC_DEFUN([XORG_LD_WRAP],[
266182e12b1bSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266282e12b1bSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266382e12b1bSmrg                      void __wrap_exit(int status) { return; }],
266482e12b1bSmrg                     [exit(0);])])
266582e12b1bSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
266682e12b1bSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266782e12b1bSmrg  if test "x$have_ld_wrap" = x"no"; then
266882e12b1bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266982e12b1bSmrg  fi
267082e12b1bSmrgfi
267182e12b1bSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267282e12b1bSmrg#
267382e12b1bSmrg]) # XORG_LD_WRAP
267482e12b1bSmrg
267582e12b1bSmrg# XORG_CHECK_LINKER_FLAGS
267682e12b1bSmrg# -----------------------
267782e12b1bSmrg# SYNOPSIS
267882e12b1bSmrg#
267982e12b1bSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268082e12b1bSmrg#
268182e12b1bSmrg# DESCRIPTION
268282e12b1bSmrg#
268382e12b1bSmrg#   Check whether the given linker FLAGS work with the current language's
268482e12b1bSmrg#   linker, or whether they give an error.
268582e12b1bSmrg#
268682e12b1bSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268782e12b1bSmrg#   success/failure.
268882e12b1bSmrg#
268982e12b1bSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
269082e12b1bSmrg#
269182e12b1bSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269282e12b1bSmrg#
269382e12b1bSmrg# LICENSE
269482e12b1bSmrg#
269582e12b1bSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269682e12b1bSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269782e12b1bSmrg#   Copyright (c) 2009 Matteo Frigo
269882e12b1bSmrg#
269982e12b1bSmrg#   This program is free software: you can redistribute it and/or modify it
270082e12b1bSmrg#   under the terms of the GNU General Public License as published by the
270182e12b1bSmrg#   Free Software Foundation, either version 3 of the License, or (at your
270282e12b1bSmrg#   option) any later version.
270382e12b1bSmrg#
270482e12b1bSmrg#   This program is distributed in the hope that it will be useful, but
270582e12b1bSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270682e12b1bSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270782e12b1bSmrg#   Public License for more details.
270882e12b1bSmrg#
270982e12b1bSmrg#   You should have received a copy of the GNU General Public License along
271082e12b1bSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271182e12b1bSmrg#
271282e12b1bSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
271382e12b1bSmrg#   gives unlimited permission to copy, distribute and modify the configure
271482e12b1bSmrg#   scripts that are the output of Autoconf when processing the Macro. You
271582e12b1bSmrg#   need not follow the terms of the GNU General Public License when using
271682e12b1bSmrg#   or distributing such scripts, even though portions of the text of the
271782e12b1bSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271882e12b1bSmrg#   all other use of the material that constitutes the Autoconf Macro.
271982e12b1bSmrg#
272082e12b1bSmrg#   This special exception to the GPL applies to versions of the Autoconf
272182e12b1bSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
272282e12b1bSmrg#   modified version of the Autoconf Macro, you may extend this special
272382e12b1bSmrg#   exception to the GPL to apply to your modified version as well.#
272482e12b1bSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272582e12b1bSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
272682e12b1bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272782e12b1bSmrgAS_LITERAL_IF([$1],
272882e12b1bSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272982e12b1bSmrg      ax_save_FLAGS=$LDFLAGS
273082e12b1bSmrg      LDFLAGS="$1"
273182e12b1bSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273282e12b1bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273382e12b1bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273482e12b1bSmrg      LDFLAGS=$ax_save_FLAGS])],
273582e12b1bSmrg  [ax_save_FLAGS=$LDFLAGS
273682e12b1bSmrg   LDFLAGS="$1"
273782e12b1bSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273882e12b1bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273982e12b1bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274082e12b1bSmrg   LDFLAGS=$ax_save_FLAGS])
274182e12b1bSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274282e12b1bSmrgAC_MSG_RESULT($xorg_check_linker_flags)
274382e12b1bSmrgif test "x$xorg_check_linker_flags" = xyes; then
274482e12b1bSmrg	m4_default([$2], :)
274582e12b1bSmrgelse
274682e12b1bSmrg	m4_default([$3], :)
274782e12b1bSmrgfi
274882e12b1bSmrg]) # XORG_CHECK_LINKER_FLAGS
274982e12b1bSmrg
275082e12b1bSmrg# XORG_MEMORY_CHECK_FLAGS
275182e12b1bSmrg# -----------------------
275282e12b1bSmrg# Minimum version: 1.16.0
275382e12b1bSmrg#
275482e12b1bSmrg# This macro attempts to find appropriate memory checking functionality
275582e12b1bSmrg# for various platforms which unit testing code may use to catch various
275682e12b1bSmrg# forms of memory allocation and access errors in testing.
275782e12b1bSmrg#
275882e12b1bSmrg# Interface to module:
275982e12b1bSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276082e12b1bSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276182e12b1bSmrg#
276282e12b1bSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276382e12b1bSmrg#
276482e12b1bSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
276582e12b1bSmrg
276682e12b1bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
276782e12b1bSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276882e12b1bSmrg           [Environment variables to enable memory checking in tests])
276982e12b1bSmrg
277082e12b1bSmrg# Check for different types of support on different platforms
277182e12b1bSmrgcase $host_os in
277282e12b1bSmrg    solaris*)
277382e12b1bSmrg        AC_CHECK_LIB([umem], [umem_alloc],
277482e12b1bSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277582e12b1bSmrg        ;;
277682e12b1bSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277782e12b1bSmrg        # both directly and inverted, so should not be 0 or 255.
277882e12b1bSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
277982e12b1bSmrg        ;;
278082e12b1bSmrg    darwin*)
278182e12b1bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278282e12b1bSmrg        ;;
278382e12b1bSmrg    *bsd*)
278482e12b1bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278582e12b1bSmrg        ;;
278682e12b1bSmrgesac
278782e12b1bSmrg
278882e12b1bSmrg# User supplied flags override default flags
278982e12b1bSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279082e12b1bSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
279182e12b1bSmrgfi
279282e12b1bSmrg
279382e12b1bSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279482e12b1bSmrg]) # XORG_WITH_LINT
279582e12b1bSmrg
279621c2f794Smrg# XORG_CHECK_MALLOC_ZERO
279721c2f794Smrg# ----------------------
279821c2f794Smrg# Minimum version: 1.0.0
279921c2f794Smrg#
280021c2f794Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280121c2f794Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280221c2f794Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280321c2f794SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280421c2f794SmrgAC_ARG_ENABLE(malloc0returnsnull,
280512391620Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280621c2f794Smrg		       [malloc(0) returns NULL (default: auto)]),
280721c2f794Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280821c2f794Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
280921c2f794Smrg
281021c2f794SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281121c2f794Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28121b2353dbSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28131b2353dbSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281482e12b1bSmrg#include <stdlib.h>
281582e12b1bSmrg],[
281621c2f794Smrg    char *m0, *r0, *c0, *p;
281721c2f794Smrg    m0 = malloc(0);
281821c2f794Smrg    p = malloc(10);
281921c2f794Smrg    r0 = realloc(p,0);
282082e12b1bSmrg    c0 = calloc(0,10);
282182e12b1bSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282282e12b1bSmrg])],
28231b2353dbSmrg		[xorg_cv_malloc0_returns_null=yes],
28241b2353dbSmrg		[xorg_cv_malloc0_returns_null=no])])
28251b2353dbSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
282621c2f794Smrgfi
282721c2f794SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
282821c2f794Smrg
282921c2f794Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283021c2f794Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283121c2f794Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283221c2f794Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
283321c2f794Smrgelse
283421c2f794Smrg	MALLOC_ZERO_CFLAGS=""
283521c2f794Smrg	XMALLOC_ZERO_CFLAGS=""
283621c2f794Smrg	XTMALLOC_ZERO_CFLAGS=""
283721c2f794Smrgfi
283821c2f794Smrg
283921c2f794SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284021c2f794SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284121c2f794SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284221c2f794Smrg]) # XORG_CHECK_MALLOC_ZERO
284321c2f794Smrg
284421c2f794Smrg# XORG_WITH_LINT()
284521c2f794Smrg# ----------------
284621c2f794Smrg# Minimum version: 1.1.0
284721c2f794Smrg#
284812391620Smrg# This macro enables the use of a tool that flags some suspicious and
284912391620Smrg# non-portable constructs (likely to be bugs) in C language source code.
285012391620Smrg# It will attempt to locate the tool and use appropriate options.
285112391620Smrg# There are various lint type tools on different platforms.
285212391620Smrg#
285312391620Smrg# Interface to module:
285412391620Smrg# LINT:		returns the path to the tool found on the platform
285512391620Smrg#		or the value set to LINT on the configure cmd line
285612391620Smrg#		also an Automake conditional
285712391620Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
285812391620Smrg#
285912391620Smrg# --with-lint:	'yes' user instructs the module to use lint
286012391620Smrg#		'no' user instructs the module not to use lint (default)
286112391620Smrg#
286212391620Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286312391620Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286421c2f794Smrg#
286521c2f794SmrgAC_DEFUN([XORG_WITH_LINT],[
286621c2f794Smrg
286712391620SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286812391620SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286912391620SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287021c2f794Smrg		[Use a lint-style source code checker (default: disabled)])],
287121c2f794Smrg		[use_lint=$withval], [use_lint=no])
287212391620Smrg
287312391620Smrg# Obtain platform specific info like program name and options
287412391620Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287512391620Smrgcase $host_os in
287612391620Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287712391620Smrg	lint_name=splint
287812391620Smrg	lint_options="-badflag"
287912391620Smrg	;;
288012391620Smrg  *freebsd* | *netbsd*)
288112391620Smrg	lint_name=lint
288212391620Smrg	lint_options="-u -b"
288312391620Smrg	;;
288412391620Smrg  *solaris*)
288512391620Smrg	lint_name=lint
288612391620Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288712391620Smrg	;;
288812391620Smrgesac
288912391620Smrg
289012391620Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289112391620Smrgif test "x$use_lint" = x"yes" ; then
289212391620Smrg   AC_PATH_PROG([LINT], [$lint_name])
289312391620Smrg   if test "x$LINT" = "x"; then
289412391620Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289512391620Smrg   fi
289612391620Smrgelif test "x$use_lint" = x"no" ; then
289712391620Smrg   if test "x$LINT" != "x"; then
289812391620Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289912391620Smrg   fi
290021c2f794Smrgelse
290112391620Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
290221c2f794Smrgfi
290312391620Smrg
290412391620Smrg# User supplied flags override default flags
290512391620Smrgif test "x$LINT_FLAGS" != "x"; then
290612391620Smrg   lint_options=$LINT_FLAGS
290721c2f794Smrgfi
290821c2f794Smrg
290912391620SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291012391620SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
291121c2f794Smrg
291221c2f794Smrg]) # XORG_WITH_LINT
291321c2f794Smrg
291421c2f794Smrg# XORG_LINT_LIBRARY(LIBNAME)
291521c2f794Smrg# --------------------------
291621c2f794Smrg# Minimum version: 1.1.0
291721c2f794Smrg#
291821c2f794Smrg# Sets up flags for building lint libraries for checking programs that call
291921c2f794Smrg# functions in the library.
292021c2f794Smrg#
292112391620Smrg# Interface to module:
292212391620Smrg# LINTLIB		- Automake variable with the name of lint library file to make
292312391620Smrg# MAKE_LINT_LIB		- Automake conditional
292412391620Smrg#
292512391620Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292612391620Smrg#			  - 'no' user instructs the module not to create a lint library (default)
292721c2f794Smrg
292821c2f794SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292921c2f794SmrgAC_REQUIRE([XORG_WITH_LINT])
293012391620SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293121c2f794Smrg	[Create lint library (default: disabled)])],
293221c2f794Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293312391620Smrg
293412391620Smrgif test "x$make_lint_lib" = x"yes" ; then
293512391620Smrg   LINTLIB=llib-l$1.ln
293612391620Smrg   if test "x$LINT" = "x"; then
293712391620Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293812391620Smrg   fi
293912391620Smrgelif test "x$make_lint_lib" != x"no" ; then
294012391620Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
294121c2f794Smrgfi
294212391620Smrg
294321c2f794SmrgAC_SUBST(LINTLIB)
294421c2f794SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
294521c2f794Smrg
294621c2f794Smrg]) # XORG_LINT_LIBRARY
294721c2f794Smrg
294882e12b1bSmrg# XORG_COMPILER_BRAND
294982e12b1bSmrg# -------------------
295082e12b1bSmrg# Minimum version: 1.14.0
295182e12b1bSmrg#
295282e12b1bSmrg# Checks for various brands of compilers and sets flags as appropriate:
295382e12b1bSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295482e12b1bSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295582e12b1bSmrg#   clang compiler - sets CLANGCC to "yes"
295682e12b1bSmrg#   Intel compiler - sets INTELCC to "yes"
295782e12b1bSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295882e12b1bSmrg#
295982e12b1bSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296082e12b1bSmrgAC_LANG_CASE(
296182e12b1bSmrg	[C], [
296282e12b1bSmrg		AC_REQUIRE([AC_PROG_CC_C99])
296382e12b1bSmrg	],
296482e12b1bSmrg	[C++], [
296582e12b1bSmrg		AC_REQUIRE([AC_PROG_CXX])
296682e12b1bSmrg	]
296782e12b1bSmrg)
296882e12b1bSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
296982e12b1bSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297082e12b1bSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297182e12b1bSmrg]) # XORG_COMPILER_BRAND
297282e12b1bSmrg
297382e12b1bSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
297482e12b1bSmrg# ---------------
297582e12b1bSmrg# Minimum version: 1.16.0
297682e12b1bSmrg#
297782e12b1bSmrg# Test if the compiler works when passed the given flag as a command line argument.
297882e12b1bSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
297982e12b1bSmrg# next flag in the list until there are no more options.
298082e12b1bSmrg#
298182e12b1bSmrg# Note that this does not guarantee that the compiler supports the flag as some
298282e12b1bSmrg# compilers will simply ignore arguments that they do not understand, but we do
298382e12b1bSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298482e12b1bSmrg# -Werror=unused-command-line-argument
298582e12b1bSmrg#
298682e12b1bSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
298782e12b1bSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298882e12b1bSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298982e12b1bSmrg
299082e12b1bSmrgAC_LANG_COMPILER_REQUIRE
299182e12b1bSmrg
299282e12b1bSmrgAC_LANG_CASE(
299382e12b1bSmrg	[C], [
299482e12b1bSmrg		AC_REQUIRE([AC_PROG_CC_C99])
299582e12b1bSmrg		define([PREFIX], [C])
299682e12b1bSmrg		define([CACHE_PREFIX], [cc])
299782e12b1bSmrg		define([COMPILER], [$CC])
299882e12b1bSmrg	],
299982e12b1bSmrg	[C++], [
300082e12b1bSmrg		define([PREFIX], [CXX])
300182e12b1bSmrg		define([CACHE_PREFIX], [cxx])
300282e12b1bSmrg		define([COMPILER], [$CXX])
300382e12b1bSmrg	]
300482e12b1bSmrg)
300582e12b1bSmrg
300682e12b1bSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
300782e12b1bSmrg
300882e12b1bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
300982e12b1bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301082e12b1bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301182e12b1bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
301282e12b1bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
301382e12b1bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
301482e12b1bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
301582e12b1bSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
301682e12b1bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
301782e12b1bSmrgfi
301882e12b1bSmrg
301982e12b1bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302082e12b1bSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302182e12b1bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
302282e12b1bSmrg	fi
302382e12b1bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
302482e12b1bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
302582e12b1bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
302682e12b1bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302782e12b1bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
302882e12b1bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
302982e12b1bSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303082e12b1bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303182e12b1bSmrgfi
303282e12b1bSmrg
303382e12b1bSmrgfound="no"
303482e12b1bSmrgm4_foreach([flag], m4_cdr($@), [
303582e12b1bSmrg	if test $found = "no" ; then
30361b2353dbSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
303782e12b1bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303882e12b1bSmrg		fi
303982e12b1bSmrg
30401b2353dbSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304182e12b1bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
304282e12b1bSmrg		fi
304382e12b1bSmrg
304482e12b1bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
304582e12b1bSmrg
304682e12b1bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
304782e12b1bSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
304882e12b1bSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
304982e12b1bSmrg		AC_CACHE_VAL($cacheid,
305082e12b1bSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305182e12b1bSmrg					     [eval $cacheid=yes],
305282e12b1bSmrg					     [eval $cacheid=no])])
305382e12b1bSmrg
305482e12b1bSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
305582e12b1bSmrg
305682e12b1bSmrg		eval supported=\$$cacheid
305782e12b1bSmrg		AC_MSG_RESULT([$supported])
305882e12b1bSmrg		if test "$supported" = "yes" ; then
305982e12b1bSmrg			$1="$$1 ]flag["
306082e12b1bSmrg			found="yes"
306182e12b1bSmrg		fi
306282e12b1bSmrg	fi
306382e12b1bSmrg])
306482e12b1bSmrg]) # XORG_TESTSET_CFLAG
306582e12b1bSmrg
306682e12b1bSmrg# XORG_COMPILER_FLAGS
306782e12b1bSmrg# ---------------
306882e12b1bSmrg# Minimum version: 1.16.0
306982e12b1bSmrg#
307082e12b1bSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307182e12b1bSmrg# arguments supported by the selected compiler which do NOT alter the generated
307282e12b1bSmrg# code.  These arguments will cause the compiler to print various warnings
307382e12b1bSmrg# during compilation AND turn a conservative set of warnings into errors.
307482e12b1bSmrg#
307582e12b1bSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
307682e12b1bSmrg# future versions of util-macros as options are added to new compilers.
307782e12b1bSmrg#
307882e12b1bSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
307982e12b1bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
308082e12b1bSmrg
308182e12b1bSmrgAC_ARG_ENABLE(selective-werror,
308282e12b1bSmrg              AS_HELP_STRING([--disable-selective-werror],
308382e12b1bSmrg                             [Turn off selective compiler errors. (default: enabled)]),
308482e12b1bSmrg              [SELECTIVE_WERROR=$enableval],
308582e12b1bSmrg              [SELECTIVE_WERROR=yes])
308682e12b1bSmrg
308782e12b1bSmrgAC_LANG_CASE(
308882e12b1bSmrg        [C], [
308982e12b1bSmrg                define([PREFIX], [C])
309082e12b1bSmrg        ],
309182e12b1bSmrg        [C++], [
309282e12b1bSmrg                define([PREFIX], [CXX])
309382e12b1bSmrg        ]
309482e12b1bSmrg)
309582e12b1bSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
309682e12b1bSmrgif test "x$SUNCC" = "xyes"; then
309782e12b1bSmrg    [BASE_]PREFIX[FLAGS]="-v"
309882e12b1bSmrgelse
309982e12b1bSmrg    [BASE_]PREFIX[FLAGS]=""
310082e12b1bSmrgfi
310182e12b1bSmrg
310282e12b1bSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
310382e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
310482e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
310582e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
310682e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
310782e12b1bSmrg
310882e12b1bSmrgAC_LANG_CASE(
310982e12b1bSmrg	[C], [
311082e12b1bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311182e12b1bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
311282e12b1bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
311382e12b1bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31141b2353dbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
311582e12b1bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
311682e12b1bSmrg	]
311782e12b1bSmrg)
311882e12b1bSmrg
311982e12b1bSmrg# This chunk adds additional warnings that could catch undesired effects.
312082e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312182e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
312282e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
312382e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
312482e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
312582e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31261b2353dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
312782e12b1bSmrg
312882e12b1bSmrg# These are currently disabled because they are noisy.  They will be enabled
312982e12b1bSmrg# in the future once the codebase is sufficiently modernized to silence
313082e12b1bSmrg# them.  For now, I don't want them to drown out the other warnings.
313182e12b1bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
313282e12b1bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31331b2353dbSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
313482e12b1bSmrg
313582e12b1bSmrg# Turn some warnings into errors, so we don't accidently get successful builds
313682e12b1bSmrg# when there are problems that should be fixed.
313782e12b1bSmrg
313882e12b1bSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
313982e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314082e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314182e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
314282e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
314382e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
314482e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
314582e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
314682e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
314782e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
314882e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
314982e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315082e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315182e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
315282e12b1bSmrgelse
315382e12b1bSmrgAC_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])
315482e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
315582e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
315682e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
315782e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
315882e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
315982e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316082e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316182e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
316282e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
316382e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
316482e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
316582e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
316682e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
316782e12b1bSmrgfi
316882e12b1bSmrg
316982e12b1bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317082e12b1bSmrg]) # XORG_COMPILER_FLAGS
317182e12b1bSmrg
317212391620Smrg# XORG_CWARNFLAGS
317312391620Smrg# ---------------
317412391620Smrg# Minimum version: 1.2.0
317582e12b1bSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
317612391620Smrg#
317712391620Smrg# Defines CWARNFLAGS to enable C compiler warnings.
317812391620Smrg#
317982e12b1bSmrg# This function is deprecated because it defines -fno-strict-aliasing
318082e12b1bSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318182e12b1bSmrg# is needed, then it should be added explicitly in the module when
318282e12b1bSmrg# it is updated to use BASE_CFLAGS.
318382e12b1bSmrg#
318412391620SmrgAC_DEFUN([XORG_CWARNFLAGS], [
318582e12b1bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
318682e12b1bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
318782e12b1bSmrgAC_LANG_CASE(
318882e12b1bSmrg	[C], [
318982e12b1bSmrg		CWARNFLAGS="$BASE_CFLAGS"
319082e12b1bSmrg		if  test "x$GCC" = xyes ; then
319182e12b1bSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
319282e12b1bSmrg		fi
319382e12b1bSmrg		AC_SUBST(CWARNFLAGS)
319482e12b1bSmrg	]
319582e12b1bSmrg)
319612391620Smrg]) # XORG_CWARNFLAGS
319712391620Smrg
319812391620Smrg# XORG_STRICT_OPTION
319912391620Smrg# -----------------------
320012391620Smrg# Minimum version: 1.3.0
320112391620Smrg#
320282e12b1bSmrg# Add configure option to enable strict compilation flags, such as treating
320382e12b1bSmrg# warnings as fatal errors.
320482e12b1bSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
320582e12b1bSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
320682e12b1bSmrg#
320782e12b1bSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
320882e12b1bSmrg# when strict compilation is unconditionally desired.
320912391620SmrgAC_DEFUN([XORG_STRICT_OPTION], [
321012391620SmrgAC_REQUIRE([XORG_CWARNFLAGS])
321182e12b1bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
321212391620Smrg
321312391620SmrgAC_ARG_ENABLE(strict-compilation,
321412391620Smrg			  AS_HELP_STRING([--enable-strict-compilation],
321512391620Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
321612391620Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
321782e12b1bSmrg
321882e12b1bSmrgAC_LANG_CASE(
321982e12b1bSmrg        [C], [
322082e12b1bSmrg                define([PREFIX], [C])
322182e12b1bSmrg        ],
322282e12b1bSmrg        [C++], [
322382e12b1bSmrg                define([PREFIX], [CXX])
322482e12b1bSmrg        ]
322582e12b1bSmrg)
322682e12b1bSmrg
322782e12b1bSmrg[STRICT_]PREFIX[FLAGS]=""
322882e12b1bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
322982e12b1bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
323082e12b1bSmrg
323182e12b1bSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
323282e12b1bSmrg# activate it with -Werror, so we add it here explicitly.
323382e12b1bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
323482e12b1bSmrg
323512391620Smrgif test "x$STRICT_COMPILE" = "xyes"; then
323682e12b1bSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
323782e12b1bSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
323812391620Smrgfi
323982e12b1bSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324082e12b1bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324182e12b1bSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
324212391620Smrg]) # XORG_STRICT_OPTION
324312391620Smrg
324412391620Smrg# XORG_DEFAULT_OPTIONS
324512391620Smrg# --------------------
324612391620Smrg# Minimum version: 1.3.0
324712391620Smrg#
324812391620Smrg# Defines default options for X.Org modules.
324912391620Smrg#
325012391620SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
325112391620SmrgAC_REQUIRE([AC_PROG_INSTALL])
325282e12b1bSmrgXORG_COMPILER_FLAGS
325312391620SmrgXORG_CWARNFLAGS
325412391620SmrgXORG_STRICT_OPTION
325512391620SmrgXORG_RELEASE_VERSION
325612391620SmrgXORG_CHANGELOG
325712391620SmrgXORG_INSTALL
325812391620SmrgXORG_MANPAGE_SECTIONS
325912391620Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326012391620Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
326112391620Smrg]) # XORG_DEFAULT_OPTIONS
326212391620Smrg
326312391620Smrg# XORG_INSTALL()
326412391620Smrg# ----------------
326512391620Smrg# Minimum version: 1.4.0
326612391620Smrg#
326712391620Smrg# Defines the variable INSTALL_CMD as the command to copy
326812391620Smrg# INSTALL from $prefix/share/util-macros.
326912391620Smrg#
327012391620SmrgAC_DEFUN([XORG_INSTALL], [
327112391620SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
327212391620Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
327312391620SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
327412391620Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3275889a2364Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3276889a2364Smrgtouch \$(top_srcdir)/INSTALL; \
3277889a2364Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
327812391620SmrgAC_SUBST([INSTALL_CMD])
327912391620Smrg]) # XORG_INSTALL
328021c2f794Smrgdnl Copyright 2005 Red Hat, Inc
328121c2f794Smrgdnl
328221c2f794Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
328321c2f794Smrgdnl documentation for any purpose is hereby granted without fee, provided that
328421c2f794Smrgdnl the above copyright notice appear in all copies and that both that
328521c2f794Smrgdnl copyright notice and this permission notice appear in supporting
328621c2f794Smrgdnl documentation.
328721c2f794Smrgdnl
328821c2f794Smrgdnl The above copyright notice and this permission notice shall be included
328921c2f794Smrgdnl in all copies or substantial portions of the Software.
329021c2f794Smrgdnl
329121c2f794Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
329221c2f794Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
329321c2f794Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
329421c2f794Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
329521c2f794Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
329621c2f794Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
329721c2f794Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
329821c2f794Smrgdnl
329921c2f794Smrgdnl Except as contained in this notice, the name of the copyright holders shall
330021c2f794Smrgdnl not be used in advertising or otherwise to promote the sale, use or
330121c2f794Smrgdnl other dealings in this Software without prior written authorization
330221c2f794Smrgdnl from the copyright holders.
330321c2f794Smrgdnl
330421c2f794Smrg
330521c2f794Smrg# XORG_RELEASE_VERSION
330621c2f794Smrg# --------------------
330712391620Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33081b2353dbSmrg
330921c2f794SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
331021c2f794Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
331121c2f794Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
331221c2f794Smrg		[Major version of this package])
331321c2f794Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
331421c2f794Smrg	if test "x$PVM" = "x"; then
331521c2f794Smrg		PVM="0"
331621c2f794Smrg	fi
331721c2f794Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
331821c2f794Smrg		[$PVM],
331921c2f794Smrg		[Minor version of this package])
332021c2f794Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
332121c2f794Smrg	if test "x$PVP" = "x"; then
332221c2f794Smrg		PVP="0"
332321c2f794Smrg	fi
332421c2f794Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
332521c2f794Smrg		[$PVP],
332621c2f794Smrg		[Patch version of this package])
332721c2f794Smrg])
332821c2f794Smrg
332912391620Smrg# XORG_CHANGELOG()
333012391620Smrg# ----------------
333112391620Smrg# Minimum version: 1.2.0
333212391620Smrg#
333312391620Smrg# Defines the variable CHANGELOG_CMD as the command to generate
333412391620Smrg# ChangeLog from git.
333512391620Smrg#
333612391620Smrg#
333712391620SmrgAC_DEFUN([XORG_CHANGELOG], [
3338889a2364SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
333912391620Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3340889a2364Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3341889a2364Smrgtouch \$(top_srcdir)/ChangeLog; \
3342889a2364Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
334312391620SmrgAC_SUBST([CHANGELOG_CMD])
334412391620Smrg]) # XORG_CHANGELOG
334512391620Smrg
3346