aclocal.m4 revision 79bbd9e8
179bbd9e8Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2b6f5cd12Smrg
379bbd9e8Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
41e00de39Smrg
51e00de39Smrg# This file is free software; the Free Software Foundation
61e00de39Smrg# gives unlimited permission to copy and/or distribute it,
71e00de39Smrg# with or without modifications, as long as this notice is preserved.
81e00de39Smrg
91e00de39Smrg# This program is distributed in the hope that it will be useful,
101e00de39Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
111e00de39Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
121e00de39Smrg# PARTICULAR PURPOSE.
131e00de39Smrg
14b6f5cd12Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
151e00de39Smrgm4_ifndef([AC_AUTOCONF_VERSION],
161e00de39Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1779bbd9e8Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1879bbd9e8Smrg[m4_warning([this file was generated for autoconf 2.69.
191e00de39SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
201e00de39SmrgIf you have problems, you may need to regenerate the build system entirely.
21b6f5cd12SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
221e00de39Smrg
2379bbd9e8Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
241e00de39Smrg#
2521ecb1efSmrg# This file is free software; the Free Software Foundation
2621ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
2721ecb1efSmrg# with or without modifications, as long as this notice is preserved.
281e00de39Smrg
2921ecb1efSmrg# AM_AUTOMAKE_VERSION(VERSION)
3021ecb1efSmrg# ----------------------------
3121ecb1efSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3221ecb1efSmrg# generated from the m4 files accompanying Automake X.Y.
3321ecb1efSmrg# (This private macro should not be called outside this file.)
3421ecb1efSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3579bbd9e8Smrg[am__api_version='1.15'
3621ecb1efSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3721ecb1efSmrgdnl require some minimum version.  Point them to the right macro.
3879bbd9e8Smrgm4_if([$1], [1.15], [],
3921ecb1efSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4021ecb1efSmrg])
411e00de39Smrg
4221ecb1efSmrg# _AM_AUTOCONF_VERSION(VERSION)
4321ecb1efSmrg# -----------------------------
4421ecb1efSmrg# aclocal traces this macro to find the Autoconf version.
4521ecb1efSmrg# This is a private macro too.  Using m4_define simplifies
4621ecb1efSmrg# the logic in aclocal, which can simply ignore this definition.
4721ecb1efSmrgm4_define([_AM_AUTOCONF_VERSION], [])
481e00de39Smrg
4921ecb1efSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5021ecb1efSmrg# -------------------------------
5121ecb1efSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5221ecb1efSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5321ecb1efSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5479bbd9e8Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
5521ecb1efSmrgm4_ifndef([AC_AUTOCONF_VERSION],
5621ecb1efSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5721ecb1efSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
581e00de39Smrg
5921ecb1efSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
601e00de39Smrg
6179bbd9e8Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6221ecb1efSmrg#
6321ecb1efSmrg# This file is free software; the Free Software Foundation
6421ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
6521ecb1efSmrg# with or without modifications, as long as this notice is preserved.
661e00de39Smrg
6721ecb1efSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68b6f5cd12Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69b6f5cd12Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
701e00de39Smrg#
7121ecb1efSmrg# Of course, Automake must honor this variable whenever it calls a
7221ecb1efSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7321ecb1efSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7421ecb1efSmrg# depending on how configure is run.  This is pretty annoying, since
7521ecb1efSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7621ecb1efSmrg# source directory, any form will work fine, but in subdirectories a
7721ecb1efSmrg# relative path needs to be adjusted first.
781e00de39Smrg#
7921ecb1efSmrg# $ac_aux_dir/missing
8021ecb1efSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8121ecb1efSmrg# $top_srcdir/$ac_aux_dir/missing
8221ecb1efSmrg#    fails if $ac_aux_dir is absolute,
8321ecb1efSmrg#    fails when called from a subdirectory in a VPATH build with
8421ecb1efSmrg#          a relative $ac_aux_dir
851e00de39Smrg#
8621ecb1efSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8721ecb1efSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
88b6f5cd12Smrg# harmless because $srcdir is '.', but things will broke when you
8921ecb1efSmrg# start a VPATH build or use an absolute $srcdir.
901e00de39Smrg#
9121ecb1efSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9221ecb1efSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9321ecb1efSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9421ecb1efSmrg# and then we would define $MISSING as
9521ecb1efSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9621ecb1efSmrg# This will work as long as MISSING is not called from configure, because
9721ecb1efSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9821ecb1efSmrg# However there are other variables, like CC, which are often used in
9921ecb1efSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10021ecb1efSmrg#
10121ecb1efSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10221ecb1efSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10321ecb1efSmrg# configured tree to be moved without reconfiguration.
1041e00de39Smrg
10521ecb1efSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10679bbd9e8Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10779bbd9e8Smrg# Expand $ac_aux_dir to an absolute path.
10879bbd9e8Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10921ecb1efSmrg])
1101e00de39Smrg
11121ecb1efSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1121e00de39Smrg
11379bbd9e8Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
11421ecb1efSmrg#
11521ecb1efSmrg# This file is free software; the Free Software Foundation
11621ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
11721ecb1efSmrg# with or without modifications, as long as this notice is preserved.
1181e00de39Smrg
11921ecb1efSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12021ecb1efSmrg# -------------------------------------
12121ecb1efSmrg# Define a conditional.
12221ecb1efSmrgAC_DEFUN([AM_CONDITIONAL],
123b6f5cd12Smrg[AC_PREREQ([2.52])dnl
124b6f5cd12Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125b6f5cd12Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12621ecb1efSmrgAC_SUBST([$1_TRUE])dnl
12721ecb1efSmrgAC_SUBST([$1_FALSE])dnl
12821ecb1efSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12921ecb1efSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13021ecb1efSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13121ecb1efSmrgif $2; then
13221ecb1efSmrg  $1_TRUE=
13321ecb1efSmrg  $1_FALSE='#'
13421ecb1efSmrgelse
13521ecb1efSmrg  $1_TRUE='#'
13621ecb1efSmrg  $1_FALSE=
13721ecb1efSmrgfi
13821ecb1efSmrgAC_CONFIG_COMMANDS_PRE(
13921ecb1efSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14021ecb1efSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14121ecb1efSmrgUsually this means the macro was only invoked conditionally.]])
14221ecb1efSmrgfi])])
1431e00de39Smrg
14479bbd9e8Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
14521ecb1efSmrg#
14621ecb1efSmrg# This file is free software; the Free Software Foundation
14721ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
14821ecb1efSmrg# with or without modifications, as long as this notice is preserved.
1491e00de39Smrg
1501e00de39Smrg
151b6f5cd12Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15221ecb1efSmrg# written in clear, in which case automake, when reading aclocal.m4,
15321ecb1efSmrg# will think it sees a *use*, and therefore will trigger all it's
15421ecb1efSmrg# C support machinery.  Also note that it means that autoscan, seeing
15521ecb1efSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1561e00de39Smrg
1571e00de39Smrg
15821ecb1efSmrg# _AM_DEPENDENCIES(NAME)
15921ecb1efSmrg# ----------------------
16021ecb1efSmrg# See how the compiler implements dependency checking.
161b6f5cd12Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16221ecb1efSmrg# We try a few techniques and use that to set a single cache variable.
1631e00de39Smrg#
16421ecb1efSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16521ecb1efSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16621ecb1efSmrg# dependency, and given that the user is not expected to run this macro,
16721ecb1efSmrg# just rely on AC_PROG_CC.
16821ecb1efSmrgAC_DEFUN([_AM_DEPENDENCIES],
16921ecb1efSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17021ecb1efSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17121ecb1efSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17221ecb1efSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1731e00de39Smrg
174b6f5cd12Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175b6f5cd12Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176b6f5cd12Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177b6f5cd12Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178b6f5cd12Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179b6f5cd12Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180b6f5cd12Smrg                    [depcc="$$1"   am_compiler_list=])
1811e00de39Smrg
18221ecb1efSmrgAC_CACHE_CHECK([dependency style of $depcc],
18321ecb1efSmrg               [am_cv_$1_dependencies_compiler_type],
18421ecb1efSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18521ecb1efSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
18621ecb1efSmrg  # making bogus files that we don't know about and never remove.  For
18721ecb1efSmrg  # instance it was reported that on HP-UX the gcc test will end up
188b6f5cd12Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189b6f5cd12Smrg  # in D".
190b6f5cd12Smrg  rm -rf conftest.dir
19121ecb1efSmrg  mkdir conftest.dir
19221ecb1efSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19321ecb1efSmrg  # using a relative directory.
19421ecb1efSmrg  cp "$am_depcomp" conftest.dir
19521ecb1efSmrg  cd conftest.dir
19621ecb1efSmrg  # We will build objects and dependencies in a subdirectory because
19721ecb1efSmrg  # it helps to detect inapplicable dependency modes.  For instance
19821ecb1efSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19921ecb1efSmrg  # side effect of compilation, but ICC will put the dependencies in
20021ecb1efSmrg  # the current directory while Tru64 will put them in the object
20121ecb1efSmrg  # directory.
20221ecb1efSmrg  mkdir sub
20321ecb1efSmrg
20421ecb1efSmrg  am_cv_$1_dependencies_compiler_type=none
20521ecb1efSmrg  if test "$am_compiler_list" = ""; then
20621ecb1efSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20721ecb1efSmrg  fi
20821ecb1efSmrg  am__universal=false
20921ecb1efSmrg  m4_case([$1], [CC],
21021ecb1efSmrg    [case " $depcc " in #(
21121ecb1efSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21221ecb1efSmrg     esac],
21321ecb1efSmrg    [CXX],
21421ecb1efSmrg    [case " $depcc " in #(
21521ecb1efSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21621ecb1efSmrg     esac])
21721ecb1efSmrg
21821ecb1efSmrg  for depmode in $am_compiler_list; do
21921ecb1efSmrg    # Setup a source with many dependencies, because some compilers
22021ecb1efSmrg    # like to wrap large dependency lists on column 80 (with \), and
22121ecb1efSmrg    # we should not choose a depcomp mode which is confused by this.
22221ecb1efSmrg    #
22321ecb1efSmrg    # We need to recreate these files for each test, as the compiler may
22421ecb1efSmrg    # overwrite some of them when testing with obscure command lines.
22521ecb1efSmrg    # This happens at least with the AIX C compiler.
22621ecb1efSmrg    : > sub/conftest.c
22721ecb1efSmrg    for i in 1 2 3 4 5 6; do
22821ecb1efSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229b6f5cd12Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230b6f5cd12Smrg      # Solaris 10 /bin/sh.
231b6f5cd12Smrg      echo '/* dummy */' > sub/conftst$i.h
23221ecb1efSmrg    done
23321ecb1efSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23421ecb1efSmrg
235b6f5cd12Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23621ecb1efSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237b6f5cd12Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238b6f5cd12Smrg    # versions had trouble with output in subdirs.
23921ecb1efSmrg    am__obj=sub/conftest.${OBJEXT-o}
24021ecb1efSmrg    am__minus_obj="-o $am__obj"
24121ecb1efSmrg    case $depmode in
24221ecb1efSmrg    gcc)
24321ecb1efSmrg      # This depmode causes a compiler race in universal mode.
24421ecb1efSmrg      test "$am__universal" = false || continue
24521ecb1efSmrg      ;;
24621ecb1efSmrg    nosideeffect)
247b6f5cd12Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248b6f5cd12Smrg      # only be used when explicitly requested.
24921ecb1efSmrg      if test "x$enable_dependency_tracking" = xyes; then
25021ecb1efSmrg	continue
25121ecb1efSmrg      else
25221ecb1efSmrg	break
25321ecb1efSmrg      fi
25421ecb1efSmrg      ;;
255b6f5cd12Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256b6f5cd12Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25721ecb1efSmrg      # not run yet.  These depmodes are late enough in the game, and
25821ecb1efSmrg      # so weak that their functioning should not be impacted.
25921ecb1efSmrg      am__obj=conftest.${OBJEXT-o}
26021ecb1efSmrg      am__minus_obj=
26121ecb1efSmrg      ;;
26221ecb1efSmrg    none) break ;;
26321ecb1efSmrg    esac
26421ecb1efSmrg    if depmode=$depmode \
26521ecb1efSmrg       source=sub/conftest.c object=$am__obj \
26621ecb1efSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26721ecb1efSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26821ecb1efSmrg         >/dev/null 2>conftest.err &&
26921ecb1efSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27021ecb1efSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27121ecb1efSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27221ecb1efSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27321ecb1efSmrg      # icc doesn't choke on unknown options, it will just issue warnings
27421ecb1efSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
27521ecb1efSmrg      # that says an option was ignored or not supported.
27621ecb1efSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27721ecb1efSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27821ecb1efSmrg      # The diagnosis changed in icc 8.0:
27921ecb1efSmrg      #   icc: Command line remark: option '-MP' not supported
28021ecb1efSmrg      if (grep 'ignoring option' conftest.err ||
28121ecb1efSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28221ecb1efSmrg        am_cv_$1_dependencies_compiler_type=$depmode
28321ecb1efSmrg        break
28421ecb1efSmrg      fi
28521ecb1efSmrg    fi
28621ecb1efSmrg  done
28721ecb1efSmrg
28821ecb1efSmrg  cd ..
28921ecb1efSmrg  rm -rf conftest.dir
2901e00de39Smrgelse
29121ecb1efSmrg  am_cv_$1_dependencies_compiler_type=none
2921e00de39Smrgfi
29321ecb1efSmrg])
29421ecb1efSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29521ecb1efSmrgAM_CONDITIONAL([am__fastdep$1], [
29621ecb1efSmrg  test "x$enable_dependency_tracking" != xno \
29721ecb1efSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29821ecb1efSmrg])
2991e00de39Smrg
30021ecb1efSmrg
30121ecb1efSmrg# AM_SET_DEPDIR
30221ecb1efSmrg# -------------
30321ecb1efSmrg# Choose a directory name for dependency files.
304b6f5cd12Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30521ecb1efSmrgAC_DEFUN([AM_SET_DEPDIR],
30621ecb1efSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30721ecb1efSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30821ecb1efSmrg])
30921ecb1efSmrg
31021ecb1efSmrg
31121ecb1efSmrg# AM_DEP_TRACK
31221ecb1efSmrg# ------------
31321ecb1efSmrgAC_DEFUN([AM_DEP_TRACK],
314b6f5cd12Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315b6f5cd12SmrgAS_HELP_STRING(
316b6f5cd12Smrg  [--enable-dependency-tracking],
317b6f5cd12Smrg  [do not reject slow dependency extractors])
318b6f5cd12SmrgAS_HELP_STRING(
319b6f5cd12Smrg  [--disable-dependency-tracking],
320b6f5cd12Smrg  [speeds up one-time build])])
32121ecb1efSmrgif test "x$enable_dependency_tracking" != xno; then
32221ecb1efSmrg  am_depcomp="$ac_aux_dir/depcomp"
32321ecb1efSmrg  AMDEPBACKSLASH='\'
324b6f5cd12Smrg  am__nodep='_no'
3251e00de39Smrgfi
32621ecb1efSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32721ecb1efSmrgAC_SUBST([AMDEPBACKSLASH])dnl
32821ecb1efSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329b6f5cd12SmrgAC_SUBST([am__nodep])dnl
330b6f5cd12Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33121ecb1efSmrg])
3321e00de39Smrg
33321ecb1efSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33421ecb1efSmrg
33579bbd9e8Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
3361e00de39Smrg#
33721ecb1efSmrg# This file is free software; the Free Software Foundation
33821ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
33921ecb1efSmrg# with or without modifications, as long as this notice is preserved.
3401e00de39Smrg
3411e00de39Smrg
34221ecb1efSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34321ecb1efSmrg# ------------------------------
34421ecb1efSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34521ecb1efSmrg[{
346b6f5cd12Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34721ecb1efSmrg  # are listed without --file.  Let's play safe and only enable the eval
34821ecb1efSmrg  # if we detect the quoting.
34921ecb1efSmrg  case $CONFIG_FILES in
35021ecb1efSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
35121ecb1efSmrg  *)   set x $CONFIG_FILES ;;
35221ecb1efSmrg  esac
35321ecb1efSmrg  shift
35421ecb1efSmrg  for mf
35521ecb1efSmrg  do
35621ecb1efSmrg    # Strip MF so we end up with the name of the file.
35721ecb1efSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
35821ecb1efSmrg    # Check whether this is an Automake generated Makefile or not.
359b6f5cd12Smrg    # We used to match only the files named 'Makefile.in', but
36021ecb1efSmrg    # some people rename them; so instead we look at the file content.
36121ecb1efSmrg    # Grep'ing the first line is not enough: some people post-process
36221ecb1efSmrg    # each Makefile.in and add a new line on top of each file to say so.
36321ecb1efSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
36421ecb1efSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
36521ecb1efSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
36621ecb1efSmrg      dirpart=`AS_DIRNAME("$mf")`
36721ecb1efSmrg    else
36821ecb1efSmrg      continue
36921ecb1efSmrg    fi
37021ecb1efSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
371b6f5cd12Smrg    # from the Makefile without running 'make'.
37221ecb1efSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
37321ecb1efSmrg    test -z "$DEPDIR" && continue
37421ecb1efSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
375b6f5cd12Smrg    test -z "$am__include" && continue
37621ecb1efSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
37721ecb1efSmrg    # Find all dependency output files, they are included files with
37821ecb1efSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
37921ecb1efSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
38021ecb1efSmrg    # expansion.
38121ecb1efSmrg    for file in `sed -n "
38221ecb1efSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383b6f5cd12Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
38421ecb1efSmrg      # Make sure the directory exists.
38521ecb1efSmrg      test -f "$dirpart/$file" && continue
38621ecb1efSmrg      fdir=`AS_DIRNAME(["$file"])`
38721ecb1efSmrg      AS_MKDIR_P([$dirpart/$fdir])
38821ecb1efSmrg      # echo "creating $dirpart/$file"
38921ecb1efSmrg      echo '# dummy' > "$dirpart/$file"
39021ecb1efSmrg    done
39121ecb1efSmrg  done
39221ecb1efSmrg}
39321ecb1efSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3941e00de39Smrg
3951e00de39Smrg
39621ecb1efSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39721ecb1efSmrg# -----------------------------
39821ecb1efSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
39921ecb1efSmrg#
40021ecb1efSmrg# This code is only required when automatic dependency tracking
401b6f5cd12Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
40221ecb1efSmrg# need in order to bootstrap the dependency handling code.
40321ecb1efSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
40421ecb1efSmrg[AC_CONFIG_COMMANDS([depfiles],
40521ecb1efSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
40621ecb1efSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
40721ecb1efSmrg])
4081e00de39Smrg
40921ecb1efSmrg# Do all the work for Automake.                             -*- Autoconf -*-
41021ecb1efSmrg
41179bbd9e8Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
41221ecb1efSmrg#
41321ecb1efSmrg# This file is free software; the Free Software Foundation
41421ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
41521ecb1efSmrg# with or without modifications, as long as this notice is preserved.
41621ecb1efSmrg
41721ecb1efSmrg# This macro actually does too much.  Some checks are only needed if
41821ecb1efSmrg# your package does certain things.  But this isn't really a big deal.
41921ecb1efSmrg
42079bbd9e8Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
42179bbd9e8Smrgm4_define([AC_PROG_CC],
42279bbd9e8Smrgm4_defn([AC_PROG_CC])
42379bbd9e8Smrg[_AM_PROG_CC_C_O
42479bbd9e8Smrg])
42579bbd9e8Smrg
42621ecb1efSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
42721ecb1efSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42821ecb1efSmrg# -----------------------------------------------
42921ecb1efSmrg# The call with PACKAGE and VERSION arguments is the old style
43021ecb1efSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
43121ecb1efSmrg# and VERSION should now be passed to AC_INIT and removed from
43221ecb1efSmrg# the call to AM_INIT_AUTOMAKE.
43321ecb1efSmrg# We support both call styles for the transition.  After
43421ecb1efSmrg# the next Automake release, Autoconf can make the AC_INIT
43521ecb1efSmrg# arguments mandatory, and then we can depend on a new Autoconf
43621ecb1efSmrg# release and drop the old call support.
43721ecb1efSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
438b6f5cd12Smrg[AC_PREREQ([2.65])dnl
43921ecb1efSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
44021ecb1efSmrgdnl the ones we care about.
44121ecb1efSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
44221ecb1efSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
44321ecb1efSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44421ecb1efSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44521ecb1efSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44621ecb1efSmrg  # is not polluted with repeated "-I."
44721ecb1efSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44821ecb1efSmrg  # test to see if srcdir already configured
44921ecb1efSmrg  if test -f $srcdir/config.status; then
45021ecb1efSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
45121ecb1efSmrg  fi
4521e00de39Smrgfi
45321ecb1efSmrg
45421ecb1efSmrg# test whether we have cygpath
45521ecb1efSmrgif test -z "$CYGPATH_W"; then
45621ecb1efSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45721ecb1efSmrg    CYGPATH_W='cygpath -w'
45821ecb1efSmrg  else
45921ecb1efSmrg    CYGPATH_W=echo
46021ecb1efSmrg  fi
4611e00de39Smrgfi
46221ecb1efSmrgAC_SUBST([CYGPATH_W])
4631e00de39Smrg
46421ecb1efSmrg# Define the identity of the package.
46521ecb1efSmrgdnl Distinguish between old-style and new-style calls.
46621ecb1efSmrgm4_ifval([$2],
467b6f5cd12Smrg[AC_DIAGNOSE([obsolete],
468b6f5cd12Smrg             [$0: two- and three-arguments forms are deprecated.])
469b6f5cd12Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
47021ecb1efSmrg AC_SUBST([PACKAGE], [$1])dnl
47121ecb1efSmrg AC_SUBST([VERSION], [$2])],
47221ecb1efSmrg[_AM_SET_OPTIONS([$1])dnl
47321ecb1efSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
474b6f5cd12Smrgm4_if(
475b6f5cd12Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
476b6f5cd12Smrg  [ok:ok],,
47721ecb1efSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47821ecb1efSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47921ecb1efSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4801e00de39Smrg
48121ecb1efSmrg_AM_IF_OPTION([no-define],,
482b6f5cd12Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
483b6f5cd12Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4841e00de39Smrg
48521ecb1efSmrg# Some tools Automake needs.
48621ecb1efSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48721ecb1efSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
488b6f5cd12SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
489b6f5cd12SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
490b6f5cd12SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
491b6f5cd12SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
492b6f5cd12SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
49321ecb1efSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49421ecb1efSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
495b6f5cd12SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
496b6f5cd12Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
497b6f5cd12Smrg# dies out for good.  For more background, see:
498b6f5cd12Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
499b6f5cd12Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
500b6f5cd12SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
50179bbd9e8Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
50279bbd9e8Smrg# system "awk" is bad on some platforms.
50321ecb1efSmrgAC_REQUIRE([AC_PROG_AWK])dnl
50421ecb1efSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50521ecb1efSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50621ecb1efSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50721ecb1efSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50821ecb1efSmrg			     [_AM_PROG_TAR([v7])])])
50921ecb1efSmrg_AM_IF_OPTION([no-dependencies],,
51021ecb1efSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
511b6f5cd12Smrg		  [_AM_DEPENDENCIES([CC])],
512b6f5cd12Smrg		  [m4_define([AC_PROG_CC],
513b6f5cd12Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51421ecb1efSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
515b6f5cd12Smrg		  [_AM_DEPENDENCIES([CXX])],
516b6f5cd12Smrg		  [m4_define([AC_PROG_CXX],
517b6f5cd12Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51821ecb1efSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
519b6f5cd12Smrg		  [_AM_DEPENDENCIES([OBJC])],
520b6f5cd12Smrg		  [m4_define([AC_PROG_OBJC],
521b6f5cd12Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
522b6f5cd12SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
523b6f5cd12Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
524b6f5cd12Smrg		  [m4_define([AC_PROG_OBJCXX],
525b6f5cd12Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52621ecb1efSmrg])
527b6f5cd12SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
528b6f5cd12Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
529b6f5cd12Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
530b6f5cd12Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
53121ecb1efSmrgAC_CONFIG_COMMANDS_PRE(dnl
53221ecb1efSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
53321ecb1efSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
53479bbd9e8Smrg
53579bbd9e8Smrg# POSIX will say in a future version that running "rm -f" with no argument
53679bbd9e8Smrg# is OK; and we want to be able to make that assumption in our Makefile
53779bbd9e8Smrg# recipes.  So use an aggressive probe to check that the usage we want is
53879bbd9e8Smrg# actually supported "in the wild" to an acceptable degree.
53979bbd9e8Smrg# See automake bug#10828.
54079bbd9e8Smrg# To make any issue more visible, cause the running configure to be aborted
54179bbd9e8Smrg# by default if the 'rm' program in use doesn't match our expectations; the
54279bbd9e8Smrg# user can still override this though.
54379bbd9e8Smrgif rm -f && rm -fr && rm -rf; then : OK; else
54479bbd9e8Smrg  cat >&2 <<'END'
54579bbd9e8SmrgOops!
54679bbd9e8Smrg
54779bbd9e8SmrgYour 'rm' program seems unable to run without file operands specified
54879bbd9e8Smrgon the command line, even when the '-f' option is present.  This is contrary
54979bbd9e8Smrgto the behaviour of most rm programs out there, and not conforming with
55079bbd9e8Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
55179bbd9e8Smrg
55279bbd9e8SmrgPlease tell bug-automake@gnu.org about your system, including the value
55379bbd9e8Smrgof your $PATH and any error possibly output before this message.  This
55479bbd9e8Smrgcan help us improve future automake versions.
55579bbd9e8Smrg
55679bbd9e8SmrgEND
55779bbd9e8Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
55879bbd9e8Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
55979bbd9e8Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
56079bbd9e8Smrg    echo >&2
56179bbd9e8Smrg  else
56279bbd9e8Smrg    cat >&2 <<'END'
56379bbd9e8SmrgAborting the configuration process, to ensure you take notice of the issue.
56479bbd9e8Smrg
56579bbd9e8SmrgYou can download and install GNU coreutils to get an 'rm' implementation
56679bbd9e8Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
56779bbd9e8Smrg
56879bbd9e8SmrgIf you want to complete the configuration process using your problematic
56979bbd9e8Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
57079bbd9e8Smrgto "yes", and re-run configure.
57179bbd9e8Smrg
57279bbd9e8SmrgEND
57379bbd9e8Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
57479bbd9e8Smrg  fi
57579bbd9e8Smrgfi
57679bbd9e8Smrgdnl The trailing newline in this macro's definition is deliberate, for
57779bbd9e8Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
57879bbd9e8Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
57921ecb1efSmrg])
5801e00de39Smrg
581b6f5cd12Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
58221ecb1efSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
58321ecb1efSmrgdnl mangled by Autoconf and run in a shell conditional statement.
58421ecb1efSmrgm4_define([_AC_COMPILER_EXEEXT],
58521ecb1efSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5861e00de39Smrg
58721ecb1efSmrg# When config.status generates a header, we must update the stamp-h file.
58821ecb1efSmrg# This file resides in the same directory as the config header
58921ecb1efSmrg# that is generated.  The stamp files are numbered to have different names.
59021ecb1efSmrg
59121ecb1efSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
59221ecb1efSmrg# loop where config.status creates the headers, so we can generate
59321ecb1efSmrg# our stamp files there.
59421ecb1efSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
59521ecb1efSmrg[# Compute $1's index in $config_headers.
59621ecb1efSmrg_am_arg=$1
59721ecb1efSmrg_am_stamp_count=1
59821ecb1efSmrgfor _am_header in $config_headers :; do
59921ecb1efSmrg  case $_am_header in
60021ecb1efSmrg    $_am_arg | $_am_arg:* )
60121ecb1efSmrg      break ;;
60221ecb1efSmrg    * )
60321ecb1efSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
60421ecb1efSmrg  esac
60521ecb1efSmrgdone
60621ecb1efSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
60721ecb1efSmrg
60879bbd9e8Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
60921ecb1efSmrg#
61021ecb1efSmrg# This file is free software; the Free Software Foundation
61121ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
61221ecb1efSmrg# with or without modifications, as long as this notice is preserved.
6131e00de39Smrg
61421ecb1efSmrg# AM_PROG_INSTALL_SH
61521ecb1efSmrg# ------------------
61621ecb1efSmrg# Define $install_sh.
61721ecb1efSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
61821ecb1efSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
61979bbd9e8Smrgif test x"${install_sh+set}" != xset; then
62021ecb1efSmrg  case $am_aux_dir in
62121ecb1efSmrg  *\ * | *\	*)
62221ecb1efSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
62321ecb1efSmrg  *)
62421ecb1efSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
62521ecb1efSmrg  esac
6261e00de39Smrgfi
627b6f5cd12SmrgAC_SUBST([install_sh])])
6281e00de39Smrg
62979bbd9e8Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
63021ecb1efSmrg#
63121ecb1efSmrg# This file is free software; the Free Software Foundation
63221ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
63321ecb1efSmrg# with or without modifications, as long as this notice is preserved.
6341e00de39Smrg
63521ecb1efSmrg# Check whether the underlying file-system supports filenames
63621ecb1efSmrg# with a leading dot.  For instance MS-DOS doesn't.
63721ecb1efSmrgAC_DEFUN([AM_SET_LEADING_DOT],
63821ecb1efSmrg[rm -rf .tst 2>/dev/null
63921ecb1efSmrgmkdir .tst 2>/dev/null
64021ecb1efSmrgif test -d .tst; then
64121ecb1efSmrg  am__leading_dot=.
6421e00de39Smrgelse
64321ecb1efSmrg  am__leading_dot=_
6441e00de39Smrgfi
64521ecb1efSmrgrmdir .tst 2>/dev/null
64621ecb1efSmrgAC_SUBST([am__leading_dot])])
6471e00de39Smrg
64821ecb1efSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6491e00de39Smrg
65079bbd9e8Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
65121ecb1efSmrg#
65221ecb1efSmrg# This file is free software; the Free Software Foundation
65321ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
65421ecb1efSmrg# with or without modifications, as long as this notice is preserved.
6551e00de39Smrg
65621ecb1efSmrg# AM_MAKE_INCLUDE()
65721ecb1efSmrg# -----------------
65821ecb1efSmrg# Check to see how make treats includes.
65921ecb1efSmrgAC_DEFUN([AM_MAKE_INCLUDE],
66021ecb1efSmrg[am_make=${MAKE-make}
66121ecb1efSmrgcat > confinc << 'END'
66221ecb1efSmrgam__doit:
66321ecb1efSmrg	@echo this is the am__doit target
66421ecb1efSmrg.PHONY: am__doit
66521ecb1efSmrgEND
66621ecb1efSmrg# If we don't find an include directive, just comment out the code.
66721ecb1efSmrgAC_MSG_CHECKING([for style of include used by $am_make])
66821ecb1efSmrgam__include="#"
66921ecb1efSmrgam__quote=
67021ecb1efSmrg_am_result=none
67121ecb1efSmrg# First try GNU make style include.
67221ecb1efSmrgecho "include confinc" > confmf
673b6f5cd12Smrg# Ignore all kinds of additional output from 'make'.
67421ecb1efSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
67521ecb1efSmrg*the\ am__doit\ target*)
67621ecb1efSmrg  am__include=include
67721ecb1efSmrg  am__quote=
67821ecb1efSmrg  _am_result=GNU
67921ecb1efSmrg  ;;
68021ecb1efSmrgesac
68121ecb1efSmrg# Now try BSD make style include.
68221ecb1efSmrgif test "$am__include" = "#"; then
68321ecb1efSmrg   echo '.include "confinc"' > confmf
68421ecb1efSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
68521ecb1efSmrg   *the\ am__doit\ target*)
68621ecb1efSmrg     am__include=.include
68721ecb1efSmrg     am__quote="\""
68821ecb1efSmrg     _am_result=BSD
68921ecb1efSmrg     ;;
69021ecb1efSmrg   esac
6911e00de39Smrgfi
69221ecb1efSmrgAC_SUBST([am__include])
69321ecb1efSmrgAC_SUBST([am__quote])
69421ecb1efSmrgAC_MSG_RESULT([$_am_result])
69521ecb1efSmrgrm -f confinc confmf
69621ecb1efSmrg])
6971e00de39Smrg
69821ecb1efSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6991e00de39Smrg
70079bbd9e8Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
70121ecb1efSmrg#
70221ecb1efSmrg# This file is free software; the Free Software Foundation
70321ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
70421ecb1efSmrg# with or without modifications, as long as this notice is preserved.
7051e00de39Smrg
70621ecb1efSmrg# AM_MISSING_PROG(NAME, PROGRAM)
70721ecb1efSmrg# ------------------------------
70821ecb1efSmrgAC_DEFUN([AM_MISSING_PROG],
70921ecb1efSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71021ecb1efSmrg$1=${$1-"${am_missing_run}$2"}
71121ecb1efSmrgAC_SUBST($1)])
7121e00de39Smrg
71321ecb1efSmrg# AM_MISSING_HAS_RUN
71421ecb1efSmrg# ------------------
715b6f5cd12Smrg# Define MISSING if not defined so far and test if it is modern enough.
716b6f5cd12Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
71721ecb1efSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
71821ecb1efSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
71921ecb1efSmrgAC_REQUIRE_AUX_FILE([missing])dnl
72021ecb1efSmrgif test x"${MISSING+set}" != xset; then
72121ecb1efSmrg  case $am_aux_dir in
72221ecb1efSmrg  *\ * | *\	*)
72321ecb1efSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
72421ecb1efSmrg  *)
72521ecb1efSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
72621ecb1efSmrg  esac
7271e00de39Smrgfi
72821ecb1efSmrg# Use eval to expand $SHELL
729b6f5cd12Smrgif eval "$MISSING --is-lightweight"; then
730b6f5cd12Smrg  am_missing_run="$MISSING "
7311e00de39Smrgelse
73221ecb1efSmrg  am_missing_run=
733b6f5cd12Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7341e00de39Smrgfi
73521ecb1efSmrg])
7361e00de39Smrg
73721ecb1efSmrg# Helper functions for option handling.                     -*- Autoconf -*-
7381e00de39Smrg
73979bbd9e8Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
7401e00de39Smrg#
74121ecb1efSmrg# This file is free software; the Free Software Foundation
74221ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
74321ecb1efSmrg# with or without modifications, as long as this notice is preserved.
7441e00de39Smrg
74521ecb1efSmrg# _AM_MANGLE_OPTION(NAME)
74621ecb1efSmrg# -----------------------
74721ecb1efSmrgAC_DEFUN([_AM_MANGLE_OPTION],
74821ecb1efSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7491e00de39Smrg
75021ecb1efSmrg# _AM_SET_OPTION(NAME)
751b6f5cd12Smrg# --------------------
75221ecb1efSmrg# Set option NAME.  Presently that only means defining a flag for this option.
75321ecb1efSmrgAC_DEFUN([_AM_SET_OPTION],
754b6f5cd12Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7551e00de39Smrg
75621ecb1efSmrg# _AM_SET_OPTIONS(OPTIONS)
757b6f5cd12Smrg# ------------------------
75821ecb1efSmrg# OPTIONS is a space-separated list of Automake options.
75921ecb1efSmrgAC_DEFUN([_AM_SET_OPTIONS],
76021ecb1efSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
76121ecb1efSmrg
76221ecb1efSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76321ecb1efSmrg# -------------------------------------------
76421ecb1efSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76521ecb1efSmrgAC_DEFUN([_AM_IF_OPTION],
76621ecb1efSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76721ecb1efSmrg
76879bbd9e8Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
76979bbd9e8Smrg#
77079bbd9e8Smrg# This file is free software; the Free Software Foundation
77179bbd9e8Smrg# gives unlimited permission to copy and/or distribute it,
77279bbd9e8Smrg# with or without modifications, as long as this notice is preserved.
77379bbd9e8Smrg
77479bbd9e8Smrg# _AM_PROG_CC_C_O
77579bbd9e8Smrg# ---------------
77679bbd9e8Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77779bbd9e8Smrg# to automatically call this.
77879bbd9e8SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77979bbd9e8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
78079bbd9e8SmrgAC_REQUIRE_AUX_FILE([compile])dnl
78179bbd9e8SmrgAC_LANG_PUSH([C])dnl
78279bbd9e8SmrgAC_CACHE_CHECK(
78379bbd9e8Smrg  [whether $CC understands -c and -o together],
78479bbd9e8Smrg  [am_cv_prog_cc_c_o],
78579bbd9e8Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78679bbd9e8Smrg  # Make sure it works both with $CC and with simple cc.
78779bbd9e8Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78879bbd9e8Smrg  # compilers refuse to overwrite an existing .o file with -o,
78979bbd9e8Smrg  # though they will create one.
79079bbd9e8Smrg  am_cv_prog_cc_c_o=yes
79179bbd9e8Smrg  for am_i in 1 2; do
79279bbd9e8Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79379bbd9e8Smrg         && test -f conftest2.$ac_objext; then
79479bbd9e8Smrg      : OK
79579bbd9e8Smrg    else
79679bbd9e8Smrg      am_cv_prog_cc_c_o=no
79779bbd9e8Smrg      break
79879bbd9e8Smrg    fi
79979bbd9e8Smrg  done
80079bbd9e8Smrg  rm -f core conftest*
80179bbd9e8Smrg  unset am_i])
80279bbd9e8Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80379bbd9e8Smrg   # Losing compiler, so override with the script.
80479bbd9e8Smrg   # FIXME: It is wrong to rewrite CC.
80579bbd9e8Smrg   # But if we don't then we get into trouble of one sort or another.
80679bbd9e8Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80779bbd9e8Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80879bbd9e8Smrg   CC="$am_aux_dir/compile $CC"
80979bbd9e8Smrgfi
81079bbd9e8SmrgAC_LANG_POP([C])])
81179bbd9e8Smrg
81279bbd9e8Smrg# For backward compatibility.
81379bbd9e8SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
81479bbd9e8Smrg
81579bbd9e8Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
81679bbd9e8Smrg#
81779bbd9e8Smrg# This file is free software; the Free Software Foundation
81879bbd9e8Smrg# gives unlimited permission to copy and/or distribute it,
81979bbd9e8Smrg# with or without modifications, as long as this notice is preserved.
82079bbd9e8Smrg
82179bbd9e8Smrg# AM_RUN_LOG(COMMAND)
82279bbd9e8Smrg# -------------------
82379bbd9e8Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82479bbd9e8Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82579bbd9e8SmrgAC_DEFUN([AM_RUN_LOG],
82679bbd9e8Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82779bbd9e8Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82879bbd9e8Smrg   ac_status=$?
82979bbd9e8Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
83079bbd9e8Smrg   (exit $ac_status); }])
83179bbd9e8Smrg
83221ecb1efSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8331e00de39Smrg
83479bbd9e8Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
8351e00de39Smrg#
8361e00de39Smrg# This file is free software; the Free Software Foundation
8371e00de39Smrg# gives unlimited permission to copy and/or distribute it,
8381e00de39Smrg# with or without modifications, as long as this notice is preserved.
8391e00de39Smrg
84021ecb1efSmrg# AM_SANITY_CHECK
84121ecb1efSmrg# ---------------
84221ecb1efSmrgAC_DEFUN([AM_SANITY_CHECK],
84321ecb1efSmrg[AC_MSG_CHECKING([whether build environment is sane])
84421ecb1efSmrg# Reject unsafe characters in $srcdir or the absolute working directory
84521ecb1efSmrg# name.  Accept space and tab only in the latter.
84621ecb1efSmrgam_lf='
84721ecb1efSmrg'
84821ecb1efSmrgcase `pwd` in
84921ecb1efSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
85021ecb1efSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
85121ecb1efSmrgesac
85221ecb1efSmrgcase $srcdir in
85321ecb1efSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
854b6f5cd12Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85521ecb1efSmrgesac
8561e00de39Smrg
857b6f5cd12Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85821ecb1efSmrg# arguments.  Must try -L first in case configure is actually a
85921ecb1efSmrg# symlink; some systems play weird games with the mod time of symlinks
86021ecb1efSmrg# (eg FreeBSD returns the mod time of the symlink's containing
86121ecb1efSmrg# directory).
86221ecb1efSmrgif (
863b6f5cd12Smrg   am_has_slept=no
864b6f5cd12Smrg   for am_try in 1 2; do
865b6f5cd12Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
866b6f5cd12Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
867b6f5cd12Smrg     if test "$[*]" = "X"; then
868b6f5cd12Smrg	# -L didn't work.
869b6f5cd12Smrg	set X `ls -t "$srcdir/configure" conftest.file`
870b6f5cd12Smrg     fi
871b6f5cd12Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
872b6f5cd12Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
873b6f5cd12Smrg
874b6f5cd12Smrg	# If neither matched, then we have a broken ls.  This can happen
875b6f5cd12Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
876b6f5cd12Smrg	# broken ls alias from the environment.  This has actually
877b6f5cd12Smrg	# happened.  Such a system could not be considered "sane".
878b6f5cd12Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
879b6f5cd12Smrg  alias in your environment])
880b6f5cd12Smrg     fi
881b6f5cd12Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
882b6f5cd12Smrg       break
883b6f5cd12Smrg     fi
884b6f5cd12Smrg     # Just in case.
885b6f5cd12Smrg     sleep 1
886b6f5cd12Smrg     am_has_slept=yes
887b6f5cd12Smrg   done
88821ecb1efSmrg   test "$[2]" = conftest.file
88921ecb1efSmrg   )
89021ecb1efSmrgthen
89121ecb1efSmrg   # Ok.
89221ecb1efSmrg   :
89321ecb1efSmrgelse
89421ecb1efSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
89521ecb1efSmrgCheck your system clock])
89621ecb1efSmrgfi
897b6f5cd12SmrgAC_MSG_RESULT([yes])
898b6f5cd12Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
899b6f5cd12Smrg# generated files are strictly newer.
900b6f5cd12Smrgam_sleep_pid=
901b6f5cd12Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
902b6f5cd12Smrg  ( sleep 1 ) &
903b6f5cd12Smrg  am_sleep_pid=$!
904b6f5cd12Smrgfi
905b6f5cd12SmrgAC_CONFIG_COMMANDS_PRE(
906b6f5cd12Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
907b6f5cd12Smrg   if test -n "$am_sleep_pid"; then
908b6f5cd12Smrg     # Hide warnings about reused PIDs.
909b6f5cd12Smrg     wait $am_sleep_pid 2>/dev/null
910b6f5cd12Smrg   fi
911b6f5cd12Smrg   AC_MSG_RESULT([done])])
912b6f5cd12Smrgrm -f conftest.file
913b6f5cd12Smrg])
91421ecb1efSmrg
91579bbd9e8Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
9161e00de39Smrg#
9171e00de39Smrg# This file is free software; the Free Software Foundation
9181e00de39Smrg# gives unlimited permission to copy and/or distribute it,
9191e00de39Smrg# with or without modifications, as long as this notice is preserved.
9201e00de39Smrg
92121ecb1efSmrg# AM_SILENT_RULES([DEFAULT])
92221ecb1efSmrg# --------------------------
92321ecb1efSmrg# Enable less verbose build rules; with the default set to DEFAULT
924b6f5cd12Smrg# ("yes" being less verbose, "no" or empty being verbose).
92521ecb1efSmrgAC_DEFUN([AM_SILENT_RULES],
926b6f5cd12Smrg[AC_ARG_ENABLE([silent-rules], [dnl
927b6f5cd12SmrgAS_HELP_STRING(
928b6f5cd12Smrg  [--enable-silent-rules],
929b6f5cd12Smrg  [less verbose build output (undo: "make V=1")])
930b6f5cd12SmrgAS_HELP_STRING(
931b6f5cd12Smrg  [--disable-silent-rules],
932b6f5cd12Smrg  [verbose build output (undo: "make V=0")])dnl
933b6f5cd12Smrg])
934b6f5cd12Smrgcase $enable_silent_rules in @%:@ (((
935b6f5cd12Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
936b6f5cd12Smrg   no) AM_DEFAULT_VERBOSITY=1;;
937b6f5cd12Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93821ecb1efSmrgesac
939b6f5cd12Smrgdnl
940b6f5cd12Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
941b6f5cd12Smrgdnl do not support nested variable expansions.
942b6f5cd12Smrgdnl See automake bug#9928 and bug#10237.
943b6f5cd12Smrgam_make=${MAKE-make}
944b6f5cd12SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
945b6f5cd12Smrg   [am_cv_make_support_nested_variables],
946b6f5cd12Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
947b6f5cd12SmrgBAR0=false
948b6f5cd12SmrgBAR1=true
949b6f5cd12SmrgV=1
950b6f5cd12Smrgam__doit:
951b6f5cd12Smrg	@$(TRUE)
952b6f5cd12Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
953b6f5cd12Smrg  am_cv_make_support_nested_variables=yes
954b6f5cd12Smrgelse
955b6f5cd12Smrg  am_cv_make_support_nested_variables=no
956b6f5cd12Smrgfi])
957b6f5cd12Smrgif test $am_cv_make_support_nested_variables = yes; then
958b6f5cd12Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
959b6f5cd12Smrg  AM_V='$(V)'
960b6f5cd12Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
961b6f5cd12Smrgelse
962b6f5cd12Smrg  AM_V=$AM_DEFAULT_VERBOSITY
963b6f5cd12Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
964b6f5cd12Smrgfi
965b6f5cd12SmrgAC_SUBST([AM_V])dnl
966b6f5cd12SmrgAM_SUBST_NOTMAKE([AM_V])dnl
967b6f5cd12SmrgAC_SUBST([AM_DEFAULT_V])dnl
968b6f5cd12SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96921ecb1efSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
97021ecb1efSmrgAM_BACKSLASH='\'
97121ecb1efSmrgAC_SUBST([AM_BACKSLASH])dnl
97221ecb1efSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9731e00de39Smrg])
9741e00de39Smrg
97579bbd9e8Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
97621ecb1efSmrg#
97721ecb1efSmrg# This file is free software; the Free Software Foundation
97821ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
97921ecb1efSmrg# with or without modifications, as long as this notice is preserved.
98021ecb1efSmrg
98121ecb1efSmrg# AM_PROG_INSTALL_STRIP
98221ecb1efSmrg# ---------------------
983b6f5cd12Smrg# One issue with vendor 'install' (even GNU) is that you can't
98421ecb1efSmrg# specify the program used to strip binaries.  This is especially
98521ecb1efSmrg# annoying in cross-compiling environments, where the build's strip
98621ecb1efSmrg# is unlikely to handle the host's binaries.
98721ecb1efSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
988b6f5cd12Smrg# always use install-sh in "make install-strip", and initialize
98921ecb1efSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
99021ecb1efSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
99121ecb1efSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
992b6f5cd12Smrg# Installed binaries are usually stripped using 'strip' when the user
993b6f5cd12Smrg# run "make install-strip".  However 'strip' might not be the right
99421ecb1efSmrg# tool to use in cross-compilation environments, therefore Automake
995b6f5cd12Smrg# will honor the 'STRIP' environment variable to overrule this program.
996b6f5cd12Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99721ecb1efSmrgif test "$cross_compiling" != no; then
99821ecb1efSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
99921ecb1efSmrgfi
100021ecb1efSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
100121ecb1efSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10021e00de39Smrg
100379bbd9e8Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
10041e00de39Smrg#
10051e00de39Smrg# This file is free software; the Free Software Foundation
10061e00de39Smrg# gives unlimited permission to copy and/or distribute it,
10071e00de39Smrg# with or without modifications, as long as this notice is preserved.
10081e00de39Smrg
100921ecb1efSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
101021ecb1efSmrg# ---------------------------
101121ecb1efSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101221ecb1efSmrg# This macro is traced by Automake.
101321ecb1efSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10141e00de39Smrg
101521ecb1efSmrg# AM_SUBST_NOTMAKE(VARIABLE)
1016b6f5cd12Smrg# --------------------------
101721ecb1efSmrg# Public sister of _AM_SUBST_NOTMAKE.
101821ecb1efSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101921ecb1efSmrg
102021ecb1efSmrg# Check how to create a tarball.                            -*- Autoconf -*-
102121ecb1efSmrg
102279bbd9e8Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
10231e00de39Smrg#
10241e00de39Smrg# This file is free software; the Free Software Foundation
10251e00de39Smrg# gives unlimited permission to copy and/or distribute it,
10261e00de39Smrg# with or without modifications, as long as this notice is preserved.
10271e00de39Smrg
102821ecb1efSmrg# _AM_PROG_TAR(FORMAT)
102921ecb1efSmrg# --------------------
103021ecb1efSmrg# Check how to create a tarball in format FORMAT.
1031b6f5cd12Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10321e00de39Smrg#
103321ecb1efSmrg# Substitute a variable $(am__tar) that is a command
103421ecb1efSmrg# writing to stdout a FORMAT-tarball containing the directory
103521ecb1efSmrg# $tardir.
103621ecb1efSmrg#     tardir=directory && $(am__tar) > result.tar
103721ecb1efSmrg#
103821ecb1efSmrg# Substitute a variable $(am__untar) that extract such
103921ecb1efSmrg# a tarball read from stdin.
104021ecb1efSmrg#     $(am__untar) < result.tar
1041b6f5cd12Smrg#
104221ecb1efSmrgAC_DEFUN([_AM_PROG_TAR],
1043b6f5cd12Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1044b6f5cd12Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1045b6f5cd12SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1046b6f5cd12Smrg
1047b6f5cd12Smrg# We'll loop over all known methods to create a tar archive until one works.
104821ecb1efSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10491e00de39Smrg
1050b6f5cd12Smrgm4_if([$1], [v7],
1051b6f5cd12Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1052b6f5cd12Smrg
1053b6f5cd12Smrg  [m4_case([$1],
1054b6f5cd12Smrg    [ustar],
1055b6f5cd12Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1056b6f5cd12Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1057b6f5cd12Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1058b6f5cd12Smrg      # and bug#13588).
1059b6f5cd12Smrg      am_max_uid=2097151 # 2^21 - 1
1060b6f5cd12Smrg      am_max_gid=$am_max_uid
1061b6f5cd12Smrg      # The $UID and $GID variables are not portable, so we need to resort
1062b6f5cd12Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1063b6f5cd12Smrg      # below are definitely unexpected, so allow the users to see them
1064b6f5cd12Smrg      # (that is, avoid stderr redirection).
1065b6f5cd12Smrg      am_uid=`id -u || echo unknown`
1066b6f5cd12Smrg      am_gid=`id -g || echo unknown`
1067b6f5cd12Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1068b6f5cd12Smrg      if test $am_uid -le $am_max_uid; then
1069b6f5cd12Smrg         AC_MSG_RESULT([yes])
1070b6f5cd12Smrg      else
1071b6f5cd12Smrg         AC_MSG_RESULT([no])
1072b6f5cd12Smrg         _am_tools=none
1073b6f5cd12Smrg      fi
1074b6f5cd12Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1075b6f5cd12Smrg      if test $am_gid -le $am_max_gid; then
1076b6f5cd12Smrg         AC_MSG_RESULT([yes])
1077b6f5cd12Smrg      else
1078b6f5cd12Smrg        AC_MSG_RESULT([no])
1079b6f5cd12Smrg        _am_tools=none
1080b6f5cd12Smrg      fi],
1081b6f5cd12Smrg
1082b6f5cd12Smrg  [pax],
1083b6f5cd12Smrg    [],
1084b6f5cd12Smrg
1085b6f5cd12Smrg  [m4_fatal([Unknown tar format])])
1086b6f5cd12Smrg
1087b6f5cd12Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1088b6f5cd12Smrg
1089b6f5cd12Smrg  # Go ahead even if we have the value already cached.  We do so because we
1090b6f5cd12Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1091b6f5cd12Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1092b6f5cd12Smrg
1093b6f5cd12Smrg  for _am_tool in $_am_tools; do
1094b6f5cd12Smrg    case $_am_tool in
1095b6f5cd12Smrg    gnutar)
1096b6f5cd12Smrg      for _am_tar in tar gnutar gtar; do
1097b6f5cd12Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1098b6f5cd12Smrg      done
1099b6f5cd12Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1100b6f5cd12Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1101b6f5cd12Smrg      am__untar="$_am_tar -xf -"
1102b6f5cd12Smrg      ;;
1103b6f5cd12Smrg    plaintar)
1104b6f5cd12Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1105b6f5cd12Smrg      # ustar tarball either.
1106b6f5cd12Smrg      (tar --version) >/dev/null 2>&1 && continue
1107b6f5cd12Smrg      am__tar='tar chf - "$$tardir"'
1108b6f5cd12Smrg      am__tar_='tar chf - "$tardir"'
1109b6f5cd12Smrg      am__untar='tar xf -'
1110b6f5cd12Smrg      ;;
1111b6f5cd12Smrg    pax)
1112b6f5cd12Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1113b6f5cd12Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1114b6f5cd12Smrg      am__untar='pax -r'
1115b6f5cd12Smrg      ;;
1116b6f5cd12Smrg    cpio)
1117b6f5cd12Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1118b6f5cd12Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1119b6f5cd12Smrg      am__untar='cpio -i -H $1 -d'
1120b6f5cd12Smrg      ;;
1121b6f5cd12Smrg    none)
1122b6f5cd12Smrg      am__tar=false
1123b6f5cd12Smrg      am__tar_=false
1124b6f5cd12Smrg      am__untar=false
1125b6f5cd12Smrg      ;;
1126b6f5cd12Smrg    esac
11271e00de39Smrg
1128b6f5cd12Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1129b6f5cd12Smrg    # and am__untar set.
1130b6f5cd12Smrg    test -n "${am_cv_prog_tar_$1}" && break
1131b6f5cd12Smrg
1132b6f5cd12Smrg    # tar/untar a dummy directory, and stop if the command works.
1133b6f5cd12Smrg    rm -rf conftest.dir
1134b6f5cd12Smrg    mkdir conftest.dir
1135b6f5cd12Smrg    echo GrepMe > conftest.dir/file
1136b6f5cd12Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1137b6f5cd12Smrg    rm -rf conftest.dir
1138b6f5cd12Smrg    if test -s conftest.tar; then
1139b6f5cd12Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1140b6f5cd12Smrg      AM_RUN_LOG([cat conftest.dir/file])
1141b6f5cd12Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1142b6f5cd12Smrg    fi
1143b6f5cd12Smrg  done
114421ecb1efSmrg  rm -rf conftest.dir
114521ecb1efSmrg
1146b6f5cd12Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1147b6f5cd12Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1148b6f5cd12Smrg
114921ecb1efSmrgAC_SUBST([am__tar])
115021ecb1efSmrgAC_SUBST([am__untar])
115121ecb1efSmrg]) # _AM_PROG_TAR
115221ecb1efSmrg
1153b6f5cd12Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1154b6f5cd12Smrg# 
1155b6f5cd12Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1156b6f5cd12Smrg#
1157b6f5cd12Smrg# This program is free software; you can redistribute it and/or modify
1158b6f5cd12Smrg# it under the terms of the GNU General Public License as published by
1159b6f5cd12Smrg# the Free Software Foundation; either version 2 of the License, or
1160b6f5cd12Smrg# (at your option) any later version.
1161b6f5cd12Smrg#
1162b6f5cd12Smrg# This program is distributed in the hope that it will be useful, but
1163b6f5cd12Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1164b6f5cd12Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1165b6f5cd12Smrg# General Public License for more details.
1166b6f5cd12Smrg#
1167b6f5cd12Smrg# You should have received a copy of the GNU General Public License
1168b6f5cd12Smrg# along with this program; if not, write to the Free Software
1169b6f5cd12Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1170b6f5cd12Smrg#
1171b6f5cd12Smrg# As a special exception to the GNU General Public License, if you
1172b6f5cd12Smrg# distribute this file as part of a program that contains a
1173b6f5cd12Smrg# configuration script generated by Autoconf, you may include it under
1174b6f5cd12Smrg# the same distribution terms that you use for the rest of that program.
1175b6f5cd12Smrg
1176b6f5cd12Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1177b6f5cd12Smrg# ----------------------------------
1178b6f5cd12SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1179b6f5cd12Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1180b6f5cd12Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1181b6f5cd12SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1182b6f5cd12Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1183b6f5cd12Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1184b6f5cd12Smrgfi
1185b6f5cd12Smrgif test -n "$PKG_CONFIG"; then
1186b6f5cd12Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1187b6f5cd12Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1188b6f5cd12Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1189b6f5cd12Smrg		AC_MSG_RESULT([yes])
1190b6f5cd12Smrg	else
1191b6f5cd12Smrg		AC_MSG_RESULT([no])
1192b6f5cd12Smrg		PKG_CONFIG=""
1193b6f5cd12Smrg	fi
1194b6f5cd12Smrg		
1195b6f5cd12Smrgfi[]dnl
1196b6f5cd12Smrg])# PKG_PROG_PKG_CONFIG
1197b6f5cd12Smrg
1198b6f5cd12Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1199b6f5cd12Smrg#
1200b6f5cd12Smrg# Check to see whether a particular set of modules exists.  Similar
1201b6f5cd12Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1202b6f5cd12Smrg#
1203b6f5cd12Smrg#
1204b6f5cd12Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1205b6f5cd12Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
1206b6f5cd12Smrg# PKG_CHECK_EXISTS manually
1207b6f5cd12Smrg# --------------------------------------------------------------
1208b6f5cd12SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1209b6f5cd12Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1210b6f5cd12Smrgif test -n "$PKG_CONFIG" && \
1211b6f5cd12Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1212b6f5cd12Smrg  m4_ifval([$2], [$2], [:])
1213b6f5cd12Smrgm4_ifvaln([$3], [else
1214b6f5cd12Smrg  $3])dnl
1215b6f5cd12Smrgfi])
1216b6f5cd12Smrg
1217b6f5cd12Smrg
1218b6f5cd12Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1219b6f5cd12Smrg# ---------------------------------------------
1220b6f5cd12Smrgm4_define([_PKG_CONFIG],
1221b6f5cd12Smrg[if test -n "$$1"; then
1222b6f5cd12Smrg    pkg_cv_[]$1="$$1"
1223b6f5cd12Smrg elif test -n "$PKG_CONFIG"; then
1224b6f5cd12Smrg    PKG_CHECK_EXISTS([$3],
1225b6f5cd12Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1226b6f5cd12Smrg		     [pkg_failed=yes])
1227b6f5cd12Smrg else
1228b6f5cd12Smrg    pkg_failed=untried
1229b6f5cd12Smrgfi[]dnl
1230b6f5cd12Smrg])# _PKG_CONFIG
1231b6f5cd12Smrg
1232b6f5cd12Smrg# _PKG_SHORT_ERRORS_SUPPORTED
1233b6f5cd12Smrg# -----------------------------
1234b6f5cd12SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1235b6f5cd12Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1236b6f5cd12Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1237b6f5cd12Smrg        _pkg_short_errors_supported=yes
1238b6f5cd12Smrgelse
1239b6f5cd12Smrg        _pkg_short_errors_supported=no
1240b6f5cd12Smrgfi[]dnl
1241b6f5cd12Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1242b6f5cd12Smrg
1243b6f5cd12Smrg
1244b6f5cd12Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1245b6f5cd12Smrg# [ACTION-IF-NOT-FOUND])
1246b6f5cd12Smrg#
1247b6f5cd12Smrg#
1248b6f5cd12Smrg# Note that if there is a possibility the first call to
1249b6f5cd12Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1250b6f5cd12Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1251b6f5cd12Smrg#
1252b6f5cd12Smrg#
1253b6f5cd12Smrg# --------------------------------------------------------------
1254b6f5cd12SmrgAC_DEFUN([PKG_CHECK_MODULES],
1255b6f5cd12Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1256b6f5cd12SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1257b6f5cd12SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1258b6f5cd12Smrg
1259b6f5cd12Smrgpkg_failed=no
1260b6f5cd12SmrgAC_MSG_CHECKING([for $1])
1261b6f5cd12Smrg
1262b6f5cd12Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1263b6f5cd12Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1264b6f5cd12Smrg
1265b6f5cd12Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1266b6f5cd12Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1267b6f5cd12SmrgSee the pkg-config man page for more details.])
1268b6f5cd12Smrg
1269b6f5cd12Smrgif test $pkg_failed = yes; then
1270b6f5cd12Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1271b6f5cd12Smrg        if test $_pkg_short_errors_supported = yes; then
1272b6f5cd12Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1273b6f5cd12Smrg        else 
1274b6f5cd12Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1275b6f5cd12Smrg        fi
1276b6f5cd12Smrg	# Put the nasty error message in config.log where it belongs
1277b6f5cd12Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1278b6f5cd12Smrg
1279b6f5cd12Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1280b6f5cd12Smrg[Package requirements ($2) were not met:
1281b6f5cd12Smrg
1282b6f5cd12Smrg$$1_PKG_ERRORS
1283b6f5cd12Smrg
1284b6f5cd12SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1285b6f5cd12Smrginstalled software in a non-standard prefix.
1286b6f5cd12Smrg
1287b6f5cd12Smrg_PKG_TEXT
1288b6f5cd12Smrg])],
1289b6f5cd12Smrg		[AC_MSG_RESULT([no])
1290b6f5cd12Smrg                $4])
1291b6f5cd12Smrgelif test $pkg_failed = untried; then
1292b6f5cd12Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1293b6f5cd12Smrg[The pkg-config script could not be found or is too old.  Make sure it
1294b6f5cd12Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1295b6f5cd12Smrgpath to pkg-config.
1296b6f5cd12Smrg
1297b6f5cd12Smrg_PKG_TEXT
1298b6f5cd12Smrg
1299b6f5cd12SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1300b6f5cd12Smrg		[$4])
1301b6f5cd12Smrgelse
1302b6f5cd12Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1303b6f5cd12Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1304b6f5cd12Smrg        AC_MSG_RESULT([yes])
1305b6f5cd12Smrg	ifelse([$3], , :, [$3])
1306b6f5cd12Smrgfi[]dnl
1307b6f5cd12Smrg])# PKG_CHECK_MODULES
1308b6f5cd12Smrg
130921ecb1efSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
131021ecb1efSmrgdnl
1311604a4f4cSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
131279bbd9e8Smrgdnl
131321ecb1efSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1314604a4f4cSmrgdnl copy of this software and associated documentation files (the "Software"),
1315604a4f4cSmrgdnl to deal in the Software without restriction, including without limitation
1316604a4f4cSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1317604a4f4cSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1318604a4f4cSmrgdnl Software is furnished to do so, subject to the following conditions:
131921ecb1efSmrgdnl
1320604a4f4cSmrgdnl The above copyright notice and this permission notice (including the next
1321604a4f4cSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1322604a4f4cSmrgdnl Software.
132321ecb1efSmrgdnl
1324604a4f4cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1325604a4f4cSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1326604a4f4cSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1327604a4f4cSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1328604a4f4cSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1329604a4f4cSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1330604a4f4cSmrgdnl DEALINGS IN THE SOFTWARE.
133121ecb1efSmrg
133221ecb1efSmrg# XORG_MACROS_VERSION(required-version)
133321ecb1efSmrg# -------------------------------------
133421ecb1efSmrg# Minimum version: 1.1.0
133521ecb1efSmrg#
133621ecb1efSmrg# If you're using a macro added in Version 1.1 or newer, include this in
133721ecb1efSmrg# your configure.ac with the minimum required version, such as:
133821ecb1efSmrg# XORG_MACROS_VERSION(1.1)
133921ecb1efSmrg#
134021ecb1efSmrg# To ensure that this macro is defined, also add:
134121ecb1efSmrg# m4_ifndef([XORG_MACROS_VERSION],
134221ecb1efSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
134321ecb1efSmrg#
134421ecb1efSmrg#
134579bbd9e8Smrg# See the "minimum version" comment for each macro you use to see what
134621ecb1efSmrg# version you require.
134721ecb1efSmrgm4_defun([XORG_MACROS_VERSION],[
134879bbd9e8Smrgm4_define([vers_have], [1.19.0])
134921ecb1efSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
135021ecb1efSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
135121ecb1efSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
135221ecb1efSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
135321ecb1efSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
135421ecb1efSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
135521ecb1efSmrgm4_undefine([vers_have])
135621ecb1efSmrgm4_undefine([maj_have])
135721ecb1efSmrgm4_undefine([maj_needed])
135821ecb1efSmrg]) # XORG_MACROS_VERSION
135921ecb1efSmrg
136021ecb1efSmrg# XORG_PROG_RAWCPP()
136121ecb1efSmrg# ------------------
136221ecb1efSmrg# Minimum version: 1.0.0
136321ecb1efSmrg#
136421ecb1efSmrg# Find cpp program and necessary flags for use in pre-processing text files
136521ecb1efSmrg# such as man pages and config files
136621ecb1efSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
136721ecb1efSmrgAC_REQUIRE([AC_PROG_CPP])
136879bbd9e8SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
136921ecb1efSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
13701e00de39Smrg
137121ecb1efSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
137221ecb1efSmrg# which is not the best choice for supporting other OS'es, but covers most
137321ecb1efSmrg# of the ones we need for now.
137421ecb1efSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1375b6f5cd12SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
137621ecb1efSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
137721ecb1efSmrg	AC_MSG_RESULT([no])
137821ecb1efSmrgelse
137921ecb1efSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
138021ecb1efSmrg		RAWCPPFLAGS=-undef
138121ecb1efSmrg		AC_MSG_RESULT([yes])
138221ecb1efSmrg	# under Cygwin unix is still defined even with -undef
138321ecb1efSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
138421ecb1efSmrg		RAWCPPFLAGS="-undef -ansi"
138521ecb1efSmrg		AC_MSG_RESULT([yes, with -ansi])
138621ecb1efSmrg	else
138721ecb1efSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
138821ecb1efSmrg	fi
138921ecb1efSmrgfi
139021ecb1efSmrgrm -f conftest.$ac_ext
13911e00de39Smrg
139221ecb1efSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1393b6f5cd12SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
139421ecb1efSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
139521ecb1efSmrg	AC_MSG_RESULT([no])
13961e00de39Smrgelse
139721ecb1efSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
139879bbd9e8Smrg		TRADITIONALCPPFLAGS="-traditional"
139921ecb1efSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
140021ecb1efSmrg		AC_MSG_RESULT([yes])
140121ecb1efSmrg	else
140221ecb1efSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
140321ecb1efSmrg	fi
14041e00de39Smrgfi
140521ecb1efSmrgrm -f conftest.$ac_ext
140621ecb1efSmrgAC_SUBST(RAWCPPFLAGS)
140779bbd9e8SmrgAC_SUBST(TRADITIONALCPPFLAGS)
140821ecb1efSmrg]) # XORG_PROG_RAWCPP
14091e00de39Smrg
141021ecb1efSmrg# XORG_MANPAGE_SECTIONS()
141121ecb1efSmrg# -----------------------
141221ecb1efSmrg# Minimum version: 1.0.0
141321ecb1efSmrg#
141421ecb1efSmrg# Determine which sections man pages go in for the different man page types
141521ecb1efSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
141621ecb1efSmrg# Not sure if there's any better way than just hardcoding by OS name.
141721ecb1efSmrg# Override default settings by setting environment variables
1418604a4f4cSmrg# Added MAN_SUBSTS in version 1.8
1419604a4f4cSmrg# Added AC_PROG_SED in version 1.8
14201e00de39Smrg
142121ecb1efSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
142221ecb1efSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1423604a4f4cSmrgAC_REQUIRE([AC_PROG_SED])
14241e00de39Smrg
142521ecb1efSmrgif test x$APP_MAN_SUFFIX = x    ; then
142621ecb1efSmrg    APP_MAN_SUFFIX=1
142721ecb1efSmrgfi
142821ecb1efSmrgif test x$APP_MAN_DIR = x    ; then
142921ecb1efSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
143021ecb1efSmrgfi
14311e00de39Smrg
143221ecb1efSmrgif test x$LIB_MAN_SUFFIX = x    ; then
143321ecb1efSmrg    LIB_MAN_SUFFIX=3
143421ecb1efSmrgfi
143521ecb1efSmrgif test x$LIB_MAN_DIR = x    ; then
143621ecb1efSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
14371e00de39Smrgfi
14381e00de39Smrg
143921ecb1efSmrgif test x$FILE_MAN_SUFFIX = x    ; then
144021ecb1efSmrg    case $host_os in
144121ecb1efSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
144221ecb1efSmrg	*)		FILE_MAN_SUFFIX=5  ;;
144321ecb1efSmrg    esac
144421ecb1efSmrgfi
144521ecb1efSmrgif test x$FILE_MAN_DIR = x    ; then
144621ecb1efSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
144721ecb1efSmrgfi
14481e00de39Smrg
144921ecb1efSmrgif test x$MISC_MAN_SUFFIX = x    ; then
145021ecb1efSmrg    case $host_os in
145121ecb1efSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
145221ecb1efSmrg	*)		MISC_MAN_SUFFIX=7  ;;
145321ecb1efSmrg    esac
145421ecb1efSmrgfi
145521ecb1efSmrgif test x$MISC_MAN_DIR = x    ; then
145621ecb1efSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
145721ecb1efSmrgfi
14581e00de39Smrg
145921ecb1efSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
146021ecb1efSmrg    case $host_os in
146121ecb1efSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
146221ecb1efSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
146321ecb1efSmrg    esac
146421ecb1efSmrgfi
146521ecb1efSmrgif test x$DRIVER_MAN_DIR = x    ; then
146621ecb1efSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
146721ecb1efSmrgfi
14681e00de39Smrg
146921ecb1efSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
147021ecb1efSmrg    case $host_os in
147121ecb1efSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
147221ecb1efSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
147321ecb1efSmrg    esac
147421ecb1efSmrgfi
147521ecb1efSmrgif test x$ADMIN_MAN_DIR = x    ; then
147621ecb1efSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
147721ecb1efSmrgfi
14781e00de39Smrg
14791e00de39Smrg
148021ecb1efSmrgAC_SUBST([APP_MAN_SUFFIX])
148121ecb1efSmrgAC_SUBST([LIB_MAN_SUFFIX])
148221ecb1efSmrgAC_SUBST([FILE_MAN_SUFFIX])
148321ecb1efSmrgAC_SUBST([MISC_MAN_SUFFIX])
148421ecb1efSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
148521ecb1efSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
148621ecb1efSmrgAC_SUBST([APP_MAN_DIR])
148721ecb1efSmrgAC_SUBST([LIB_MAN_DIR])
148821ecb1efSmrgAC_SUBST([FILE_MAN_DIR])
148921ecb1efSmrgAC_SUBST([MISC_MAN_DIR])
149021ecb1efSmrgAC_SUBST([DRIVER_MAN_DIR])
149121ecb1efSmrgAC_SUBST([ADMIN_MAN_DIR])
1492604a4f4cSmrg
1493604a4f4cSmrgXORG_MAN_PAGE="X Version 11"
1494604a4f4cSmrgAC_SUBST([XORG_MAN_PAGE])
1495604a4f4cSmrgMAN_SUBSTS="\
1496604a4f4cSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1497604a4f4cSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1498604a4f4cSmrg	-e 's|__xservername__|Xorg|g' \
1499604a4f4cSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1500604a4f4cSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1501604a4f4cSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1502604a4f4cSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1503604a4f4cSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1504604a4f4cSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1505604a4f4cSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1506604a4f4cSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1507604a4f4cSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1508604a4f4cSmrgAC_SUBST([MAN_SUBSTS])
1509604a4f4cSmrg
151021ecb1efSmrg]) # XORG_MANPAGE_SECTIONS
15111e00de39Smrg
1512604a4f4cSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1513604a4f4cSmrg# ------------------------
1514604a4f4cSmrg# Minimum version: 1.7.0
1515604a4f4cSmrg#
1516604a4f4cSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1517604a4f4cSmrg# provided by xorg-sgml-doctools, if installed.
1518604a4f4cSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1519604a4f4cSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1520604a4f4cSmrgXORG_SGML_PATH=
1521604a4f4cSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1522604a4f4cSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1523604a4f4cSmrg    [m4_ifval([$1],[:],
1524604a4f4cSmrg        [if test x"$cross_compiling" != x"yes" ; then
1525604a4f4cSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1526604a4f4cSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1527604a4f4cSmrg         fi])
1528604a4f4cSmrg    ])
1529604a4f4cSmrg
1530604a4f4cSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1531604a4f4cSmrg# the path and the name of the doc stylesheet
1532604a4f4cSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1533604a4f4cSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1534604a4f4cSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1535604a4f4cSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1536604a4f4cSmrgelse
1537604a4f4cSmrg   AC_MSG_RESULT([no])
1538604a4f4cSmrgfi
1539604a4f4cSmrg
1540604a4f4cSmrgAC_SUBST(XORG_SGML_PATH)
1541604a4f4cSmrgAC_SUBST(STYLESHEET_SRCDIR)
1542604a4f4cSmrgAC_SUBST(XSL_STYLESHEET)
1543604a4f4cSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1544604a4f4cSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1545604a4f4cSmrg
154621ecb1efSmrg# XORG_CHECK_LINUXDOC
154721ecb1efSmrg# -------------------
154821ecb1efSmrg# Minimum version: 1.0.0
15491e00de39Smrg#
155021ecb1efSmrg# Defines the variable MAKE_TEXT if the necessary tools and
155121ecb1efSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
155221ecb1efSmrg# Whether or not the necessary tools and files are found can be checked
155321ecb1efSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
155421ecb1efSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1555604a4f4cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1556604a4f4cSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
15571e00de39Smrg
155821ecb1efSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
15591e00de39Smrg
1560604a4f4cSmrgAC_MSG_CHECKING([whether to build documentation])
15611e00de39Smrg
1562604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
156321ecb1efSmrg   BUILDDOC=yes
156421ecb1efSmrgelse
156521ecb1efSmrg   BUILDDOC=no
15661e00de39Smrgfi
15671e00de39Smrg
156821ecb1efSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
15691e00de39Smrg
157021ecb1efSmrgAC_MSG_RESULT([$BUILDDOC])
15711e00de39Smrg
1572604a4f4cSmrgAC_MSG_CHECKING([whether to build pdf documentation])
15731e00de39Smrg
1574604a4f4cSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
157521ecb1efSmrg   BUILDPDFDOC=yes
157621ecb1efSmrgelse
157721ecb1efSmrg   BUILDPDFDOC=no
157821ecb1efSmrgfi
15791e00de39Smrg
158021ecb1efSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
15811e00de39Smrg
158221ecb1efSmrgAC_MSG_RESULT([$BUILDPDFDOC])
15831e00de39Smrg
1584604a4f4cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
158521ecb1efSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
158621ecb1efSmrgMAKE_PDF="$PS2PDF"
158721ecb1efSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
15881e00de39Smrg
158921ecb1efSmrgAC_SUBST(MAKE_TEXT)
159021ecb1efSmrgAC_SUBST(MAKE_PS)
159121ecb1efSmrgAC_SUBST(MAKE_PDF)
159221ecb1efSmrgAC_SUBST(MAKE_HTML)
159321ecb1efSmrg]) # XORG_CHECK_LINUXDOC
159421ecb1efSmrg
159521ecb1efSmrg# XORG_CHECK_DOCBOOK
159621ecb1efSmrg# -------------------
159721ecb1efSmrg# Minimum version: 1.0.0
15981e00de39Smrg#
159921ecb1efSmrg# Checks for the ability to build output formats from SGML DocBook source.
160021ecb1efSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
160121ecb1efSmrg# indicates whether the necessary tools and files are found and, if set,
160221ecb1efSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
160321ecb1efSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1604604a4f4cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1605604a4f4cSmrg
160621ecb1efSmrgBUILDTXTDOC=no
160721ecb1efSmrgBUILDPDFDOC=no
160821ecb1efSmrgBUILDPSDOC=no
160921ecb1efSmrgBUILDHTMLDOC=no
16101e00de39Smrg
161121ecb1efSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
161221ecb1efSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
161321ecb1efSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
161421ecb1efSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
16151e00de39Smrg
1616604a4f4cSmrgAC_MSG_CHECKING([whether to build text documentation])
1617604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
161821ecb1efSmrg   test x$BUILD_TXTDOC != xno; then
161921ecb1efSmrg	BUILDTXTDOC=yes
162021ecb1efSmrgfi
162121ecb1efSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
162221ecb1efSmrgAC_MSG_RESULT([$BUILDTXTDOC])
16231e00de39Smrg
1624604a4f4cSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1625604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
162621ecb1efSmrg   test x$BUILD_PDFDOC != xno; then
162721ecb1efSmrg	BUILDPDFDOC=yes
16281e00de39Smrgfi
162921ecb1efSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
163021ecb1efSmrgAC_MSG_RESULT([$BUILDPDFDOC])
16311e00de39Smrg
1632604a4f4cSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1633604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
163421ecb1efSmrg   test x$BUILD_PSDOC != xno; then
163521ecb1efSmrg	BUILDPSDOC=yes
163621ecb1efSmrgfi
163721ecb1efSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
163821ecb1efSmrgAC_MSG_RESULT([$BUILDPSDOC])
16391e00de39Smrg
1640604a4f4cSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1641604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
164221ecb1efSmrg   test x$BUILD_HTMLDOC != xno; then
164321ecb1efSmrg	BUILDHTMLDOC=yes
164421ecb1efSmrgfi
164521ecb1efSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
164621ecb1efSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
16471e00de39Smrg
164821ecb1efSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
164921ecb1efSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
165021ecb1efSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
165121ecb1efSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
16521e00de39Smrg
165321ecb1efSmrgAC_SUBST(MAKE_TEXT)
165421ecb1efSmrgAC_SUBST(MAKE_PS)
165521ecb1efSmrgAC_SUBST(MAKE_PDF)
165621ecb1efSmrgAC_SUBST(MAKE_HTML)
165721ecb1efSmrg]) # XORG_CHECK_DOCBOOK
16581e00de39Smrg
1659b6f5cd12Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1660604a4f4cSmrg# ----------------
1661604a4f4cSmrg# Minimum version: 1.5.0
1662b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1663604a4f4cSmrg#
1664604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
1665604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
1666604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1667604a4f4cSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1668b6f5cd12Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1669b6f5cd12Smrg# --with-xmlto assumes 'auto'.
1670604a4f4cSmrg#
1671604a4f4cSmrg# Interface to module:
1672604a4f4cSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1673604a4f4cSmrg# XMLTO:	returns the path of the xmlto program found
1674604a4f4cSmrg#		returns the path set by the user in the environment
1675604a4f4cSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1676604a4f4cSmrg#		'no' user instructs the module not to use xmlto
1677604a4f4cSmrg#
1678604a4f4cSmrg# Added in version 1.10.0
1679604a4f4cSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1680604a4f4cSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1681604a4f4cSmrg#
1682604a4f4cSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1683604a4f4cSmrg#
1684604a4f4cSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1685604a4f4cSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1686b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
1687604a4f4cSmrgAC_ARG_WITH(xmlto,
1688604a4f4cSmrg	AS_HELP_STRING([--with-xmlto],
1689b6f5cd12Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1690b6f5cd12Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1691b6f5cd12Smrgm4_undefine([_defopt])
1692604a4f4cSmrg
1693604a4f4cSmrgif test "x$use_xmlto" = x"auto"; then
1694604a4f4cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1695604a4f4cSmrg   if test "x$XMLTO" = "x"; then
1696604a4f4cSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1697604a4f4cSmrg	have_xmlto=no
1698604a4f4cSmrg   else
1699604a4f4cSmrg        have_xmlto=yes
1700604a4f4cSmrg   fi
1701604a4f4cSmrgelif test "x$use_xmlto" = x"yes" ; then
1702604a4f4cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1703604a4f4cSmrg   if test "x$XMLTO" = "x"; then
1704604a4f4cSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1705604a4f4cSmrg   fi
1706604a4f4cSmrg   have_xmlto=yes
1707604a4f4cSmrgelif test "x$use_xmlto" = x"no" ; then
1708604a4f4cSmrg   if test "x$XMLTO" != "x"; then
1709604a4f4cSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1710604a4f4cSmrg   fi
1711604a4f4cSmrg   have_xmlto=no
1712604a4f4cSmrgelse
1713604a4f4cSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1714604a4f4cSmrgfi
1715604a4f4cSmrg
1716604a4f4cSmrg# Test for a minimum version of xmlto, if provided.
1717604a4f4cSmrgm4_ifval([$1],
1718604a4f4cSmrg[if test "$have_xmlto" = yes; then
1719604a4f4cSmrg    # scrape the xmlto version
1720604a4f4cSmrg    AC_MSG_CHECKING([the xmlto version])
1721604a4f4cSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1722604a4f4cSmrg    AC_MSG_RESULT([$xmlto_version])
1723604a4f4cSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1724604a4f4cSmrg        [if test "x$use_xmlto" = xauto; then
1725604a4f4cSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1726604a4f4cSmrg            have_xmlto=no
1727604a4f4cSmrg        else
1728604a4f4cSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1729604a4f4cSmrg        fi])
1730604a4f4cSmrgfi])
1731604a4f4cSmrg
1732604a4f4cSmrg# Test for the ability of xmlto to generate a text target
1733604a4f4cSmrghave_xmlto_text=no
1734604a4f4cSmrgcat > conftest.xml << "EOF"
1735604a4f4cSmrgEOF
1736604a4f4cSmrgAS_IF([test "$have_xmlto" = yes],
1737604a4f4cSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1738604a4f4cSmrg             [have_xmlto_text=yes],
1739604a4f4cSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1740604a4f4cSmrgrm -f conftest.xml
1741604a4f4cSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1742604a4f4cSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1743604a4f4cSmrg]) # XORG_WITH_XMLTO
1744604a4f4cSmrg
1745b6f5cd12Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1746b6f5cd12Smrg# --------------------------------------------
1747b6f5cd12Smrg# Minimum version: 1.12.0
1748b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1749b6f5cd12Smrg#
1750b6f5cd12Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1751b6f5cd12Smrg# XML-based language used for the transformation of XML documents.
1752b6f5cd12Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1753b6f5cd12Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1754b6f5cd12Smrg# The XSLT processor is often used as a standalone tool for transformations.
1755b6f5cd12Smrg# It should not be assumed that this tool is used only to work with documnetation.
1756b6f5cd12Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1757b6f5cd12Smrg#
1758b6f5cd12Smrg# Interface to module:
1759b6f5cd12Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1760b6f5cd12Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1761b6f5cd12Smrg#		 returns the path set by the user in the environment
1762b6f5cd12Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1763b6f5cd12Smrg#		  'no' user instructs the module not to use xsltproc
1764b6f5cd12Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1765b6f5cd12Smrg#
1766b6f5cd12Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1767b6f5cd12Smrg#
1768b6f5cd12SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1769b6f5cd12SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1770b6f5cd12Smrg# Preserves the interface, should it be implemented later
1771b6f5cd12Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1772b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
1773b6f5cd12SmrgAC_ARG_WITH(xsltproc,
1774b6f5cd12Smrg	AS_HELP_STRING([--with-xsltproc],
1775b6f5cd12Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1776b6f5cd12Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1777b6f5cd12Smrgm4_undefine([_defopt])
1778b6f5cd12Smrg
1779b6f5cd12Smrgif test "x$use_xsltproc" = x"auto"; then
1780b6f5cd12Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1781b6f5cd12Smrg   if test "x$XSLTPROC" = "x"; then
1782b6f5cd12Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1783b6f5cd12Smrg	have_xsltproc=no
1784b6f5cd12Smrg   else
1785b6f5cd12Smrg        have_xsltproc=yes
1786b6f5cd12Smrg   fi
1787b6f5cd12Smrgelif test "x$use_xsltproc" = x"yes" ; then
1788b6f5cd12Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1789b6f5cd12Smrg   if test "x$XSLTPROC" = "x"; then
1790b6f5cd12Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1791b6f5cd12Smrg   fi
1792b6f5cd12Smrg   have_xsltproc=yes
1793b6f5cd12Smrgelif test "x$use_xsltproc" = x"no" ; then
1794b6f5cd12Smrg   if test "x$XSLTPROC" != "x"; then
1795b6f5cd12Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1796b6f5cd12Smrg   fi
1797b6f5cd12Smrg   have_xsltproc=no
1798b6f5cd12Smrgelse
1799b6f5cd12Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1800b6f5cd12Smrgfi
1801b6f5cd12Smrg
1802b6f5cd12SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1803b6f5cd12Smrg]) # XORG_WITH_XSLTPROC
1804b6f5cd12Smrg
1805b6f5cd12Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1806b6f5cd12Smrg# ----------------------------------------
1807b6f5cd12Smrg# Minimum version: 1.15.0
1808b6f5cd12Smrg#
1809b6f5cd12Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1810b6f5cd12Smrg# scanning arbitrary text files, extracting information from those text files,
1811b6f5cd12Smrg# and printing reports based on that information.
1812b6f5cd12Smrg#
1813b6f5cd12Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1814b6f5cd12Smrg#
1815b6f5cd12Smrg# Interface to module:
1816b6f5cd12Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1817b6f5cd12Smrg# PERL:	     returns the path of the perl program found
1818b6f5cd12Smrg#	     returns the path set by the user in the environment
1819b6f5cd12Smrg# --with-perl: 'yes' user instructs the module to use perl
1820b6f5cd12Smrg#	       'no' user instructs the module not to use perl
1821b6f5cd12Smrg# have_perl: returns yes if perl found in PATH or no
1822b6f5cd12Smrg#
1823b6f5cd12Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1824b6f5cd12Smrg#
1825b6f5cd12SmrgAC_DEFUN([XORG_WITH_PERL],[
1826b6f5cd12SmrgAC_ARG_VAR([PERL], [Path to perl command])
1827b6f5cd12Smrg# Preserves the interface, should it be implemented later
1828b6f5cd12Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1829b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
1830b6f5cd12SmrgAC_ARG_WITH(perl,
1831b6f5cd12Smrg	AS_HELP_STRING([--with-perl],
1832b6f5cd12Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1833b6f5cd12Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1834b6f5cd12Smrgm4_undefine([_defopt])
1835b6f5cd12Smrg
1836b6f5cd12Smrgif test "x$use_perl" = x"auto"; then
1837b6f5cd12Smrg   AC_PATH_PROG([PERL], [perl])
1838b6f5cd12Smrg   if test "x$PERL" = "x"; then
1839b6f5cd12Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1840b6f5cd12Smrg	have_perl=no
1841b6f5cd12Smrg   else
1842b6f5cd12Smrg        have_perl=yes
1843b6f5cd12Smrg   fi
1844b6f5cd12Smrgelif test "x$use_perl" = x"yes" ; then
1845b6f5cd12Smrg   AC_PATH_PROG([PERL], [perl])
1846b6f5cd12Smrg   if test "x$PERL" = "x"; then
1847b6f5cd12Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1848b6f5cd12Smrg   fi
1849b6f5cd12Smrg   have_perl=yes
1850b6f5cd12Smrgelif test "x$use_perl" = x"no" ; then
1851b6f5cd12Smrg   if test "x$PERL" != "x"; then
1852b6f5cd12Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1853b6f5cd12Smrg   fi
1854b6f5cd12Smrg   have_perl=no
1855b6f5cd12Smrgelse
1856b6f5cd12Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1857b6f5cd12Smrgfi
1858b6f5cd12Smrg
1859b6f5cd12SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1860b6f5cd12Smrg]) # XORG_WITH_PERL
1861b6f5cd12Smrg
1862b6f5cd12Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1863604a4f4cSmrg# ----------------
1864604a4f4cSmrg# Minimum version: 1.5.0
1865b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1866604a4f4cSmrg#
1867604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
1868604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
1869604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1870604a4f4cSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1871b6f5cd12Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1872b6f5cd12Smrg# --with-asciidoc assumes 'auto'.
1873604a4f4cSmrg#
1874604a4f4cSmrg# Interface to module:
1875604a4f4cSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1876604a4f4cSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1877604a4f4cSmrg#		 returns the path set by the user in the environment
1878604a4f4cSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1879604a4f4cSmrg#		  'no' user instructs the module not to use asciidoc
1880604a4f4cSmrg#
1881604a4f4cSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1882604a4f4cSmrg#
1883604a4f4cSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1884604a4f4cSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1885b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
1886604a4f4cSmrgAC_ARG_WITH(asciidoc,
1887604a4f4cSmrg	AS_HELP_STRING([--with-asciidoc],
1888b6f5cd12Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1889b6f5cd12Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1890b6f5cd12Smrgm4_undefine([_defopt])
1891604a4f4cSmrg
1892604a4f4cSmrgif test "x$use_asciidoc" = x"auto"; then
1893604a4f4cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1894604a4f4cSmrg   if test "x$ASCIIDOC" = "x"; then
1895604a4f4cSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1896604a4f4cSmrg	have_asciidoc=no
1897604a4f4cSmrg   else
1898604a4f4cSmrg        have_asciidoc=yes
1899604a4f4cSmrg   fi
1900604a4f4cSmrgelif test "x$use_asciidoc" = x"yes" ; then
1901604a4f4cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1902604a4f4cSmrg   if test "x$ASCIIDOC" = "x"; then
1903604a4f4cSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1904604a4f4cSmrg   fi
1905604a4f4cSmrg   have_asciidoc=yes
1906604a4f4cSmrgelif test "x$use_asciidoc" = x"no" ; then
1907604a4f4cSmrg   if test "x$ASCIIDOC" != "x"; then
1908604a4f4cSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1909604a4f4cSmrg   fi
1910604a4f4cSmrg   have_asciidoc=no
1911604a4f4cSmrgelse
1912604a4f4cSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1913604a4f4cSmrgfi
1914604a4f4cSmrgm4_ifval([$1],
1915604a4f4cSmrg[if test "$have_asciidoc" = yes; then
1916604a4f4cSmrg    # scrape the asciidoc version
1917604a4f4cSmrg    AC_MSG_CHECKING([the asciidoc version])
1918604a4f4cSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1919604a4f4cSmrg    AC_MSG_RESULT([$asciidoc_version])
1920604a4f4cSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1921604a4f4cSmrg        [if test "x$use_asciidoc" = xauto; then
1922604a4f4cSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1923604a4f4cSmrg            have_asciidoc=no
1924604a4f4cSmrg        else
1925604a4f4cSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1926604a4f4cSmrg        fi])
1927604a4f4cSmrgfi])
1928604a4f4cSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1929604a4f4cSmrg]) # XORG_WITH_ASCIIDOC
1930604a4f4cSmrg
1931b6f5cd12Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
193279bbd9e8Smrg# -------------------------------------------
1933604a4f4cSmrg# Minimum version: 1.5.0
1934b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
193579bbd9e8Smrg# Minimum version for optional DOT checking: 1.18.0
1936604a4f4cSmrg#
1937604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
1938604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
1939604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1940604a4f4cSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1941b6f5cd12Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1942b6f5cd12Smrg# --with-doxygen assumes 'auto'.
1943604a4f4cSmrg#
1944604a4f4cSmrg# Interface to module:
1945604a4f4cSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1946604a4f4cSmrg# DOXYGEN:	 returns the path of the doxygen program found
1947604a4f4cSmrg#		 returns the path set by the user in the environment
1948604a4f4cSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1949604a4f4cSmrg#		  'no' user instructs the module not to use doxygen
1950604a4f4cSmrg#
1951604a4f4cSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1952604a4f4cSmrg#
1953604a4f4cSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1954604a4f4cSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
195579bbd9e8SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
1956b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
1957604a4f4cSmrgAC_ARG_WITH(doxygen,
1958604a4f4cSmrg	AS_HELP_STRING([--with-doxygen],
1959b6f5cd12Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1960b6f5cd12Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1961b6f5cd12Smrgm4_undefine([_defopt])
1962604a4f4cSmrg
1963604a4f4cSmrgif test "x$use_doxygen" = x"auto"; then
1964604a4f4cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1965604a4f4cSmrg   if test "x$DOXYGEN" = "x"; then
1966604a4f4cSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1967604a4f4cSmrg	have_doxygen=no
1968604a4f4cSmrg   else
1969604a4f4cSmrg        have_doxygen=yes
1970604a4f4cSmrg   fi
1971604a4f4cSmrgelif test "x$use_doxygen" = x"yes" ; then
1972604a4f4cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1973604a4f4cSmrg   if test "x$DOXYGEN" = "x"; then
1974604a4f4cSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1975604a4f4cSmrg   fi
1976604a4f4cSmrg   have_doxygen=yes
1977604a4f4cSmrgelif test "x$use_doxygen" = x"no" ; then
1978604a4f4cSmrg   if test "x$DOXYGEN" != "x"; then
1979604a4f4cSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1980604a4f4cSmrg   fi
1981604a4f4cSmrg   have_doxygen=no
1982604a4f4cSmrgelse
1983604a4f4cSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1984604a4f4cSmrgfi
1985604a4f4cSmrgm4_ifval([$1],
1986604a4f4cSmrg[if test "$have_doxygen" = yes; then
1987604a4f4cSmrg    # scrape the doxygen version
1988604a4f4cSmrg    AC_MSG_CHECKING([the doxygen version])
1989604a4f4cSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1990604a4f4cSmrg    AC_MSG_RESULT([$doxygen_version])
1991604a4f4cSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1992604a4f4cSmrg        [if test "x$use_doxygen" = xauto; then
1993604a4f4cSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1994604a4f4cSmrg            have_doxygen=no
1995604a4f4cSmrg        else
1996604a4f4cSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1997604a4f4cSmrg        fi])
1998604a4f4cSmrgfi])
199979bbd9e8Smrg
200079bbd9e8Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
200179bbd9e8Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
200279bbd9e8Smrgdnl 	HAVE_DOT = @HAVE_DOT@
200379bbd9e8SmrgHAVE_DOT=no
200479bbd9e8Smrgif test "x$have_doxygen" = "xyes"; then
200579bbd9e8Smrg  AC_PATH_PROG([DOT], [dot])
200679bbd9e8Smrg    if test "x$DOT" != "x"; then
200779bbd9e8Smrg      HAVE_DOT=yes
200879bbd9e8Smrg    fi
200979bbd9e8Smrgfi
201079bbd9e8Smrg
201179bbd9e8SmrgAC_SUBST([HAVE_DOT])
201279bbd9e8SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2013604a4f4cSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2014604a4f4cSmrg]) # XORG_WITH_DOXYGEN
2015604a4f4cSmrg
2016b6f5cd12Smrg# XORG_WITH_GROFF([DEFAULT])
2017604a4f4cSmrg# ----------------
2018604a4f4cSmrg# Minimum version: 1.6.0
2019b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2020604a4f4cSmrg#
2021604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
2022604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
2023604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2024604a4f4cSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2025b6f5cd12Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2026b6f5cd12Smrg# --with-groff assumes 'auto'.
2027604a4f4cSmrg#
2028604a4f4cSmrg# Interface to module:
2029604a4f4cSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2030604a4f4cSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2031604a4f4cSmrg# HAVE_GROFF_MS: the -ms macros package
2032604a4f4cSmrg# GROFF:	 returns the path of the groff program found
2033604a4f4cSmrg#		 returns the path set by the user in the environment
2034604a4f4cSmrg# --with-groff:	 'yes' user instructs the module to use groff
2035604a4f4cSmrg#		 'no' user instructs the module not to use groff
2036604a4f4cSmrg#
2037604a4f4cSmrg# Added in version 1.9.0:
2038604a4f4cSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2039604a4f4cSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2040604a4f4cSmrg#		   psselect from the psutils package.
2041604a4f4cSmrg#		   the ghostcript package. Refer to the grohtml man pages
2042604a4f4cSmrg#
2043604a4f4cSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2044604a4f4cSmrg#
2045604a4f4cSmrg# OS and distros often splits groff in a basic and full package, the former
2046604a4f4cSmrg# having the groff program and the later having devices, fonts and macros
2047604a4f4cSmrg# Checking for the groff executable is not enough.
2048604a4f4cSmrg#
2049604a4f4cSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2050604a4f4cSmrg# unset HAVE_GROFF or GROFF env variables.
2051604a4f4cSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2052604a4f4cSmrg#
2053604a4f4cSmrgAC_DEFUN([XORG_WITH_GROFF],[
2054604a4f4cSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2055b6f5cd12Smrgm4_define([_defopt], m4_default([$1], [auto]))
2056604a4f4cSmrgAC_ARG_WITH(groff,
2057604a4f4cSmrg	AS_HELP_STRING([--with-groff],
2058b6f5cd12Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2059b6f5cd12Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2060b6f5cd12Smrgm4_undefine([_defopt])
2061604a4f4cSmrg
2062604a4f4cSmrgif test "x$use_groff" = x"auto"; then
2063604a4f4cSmrg   AC_PATH_PROG([GROFF], [groff])
2064604a4f4cSmrg   if test "x$GROFF" = "x"; then
2065604a4f4cSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2066604a4f4cSmrg	have_groff=no
2067604a4f4cSmrg   else
2068604a4f4cSmrg        have_groff=yes
2069604a4f4cSmrg   fi
2070604a4f4cSmrgelif test "x$use_groff" = x"yes" ; then
2071604a4f4cSmrg   AC_PATH_PROG([GROFF], [groff])
2072604a4f4cSmrg   if test "x$GROFF" = "x"; then
2073604a4f4cSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2074604a4f4cSmrg   fi
2075604a4f4cSmrg   have_groff=yes
2076604a4f4cSmrgelif test "x$use_groff" = x"no" ; then
2077604a4f4cSmrg   if test "x$GROFF" != "x"; then
2078604a4f4cSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2079604a4f4cSmrg   fi
2080604a4f4cSmrg   have_groff=no
2081604a4f4cSmrgelse
2082604a4f4cSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2083604a4f4cSmrgfi
2084604a4f4cSmrg
2085604a4f4cSmrg# We have groff, test for the presence of the macro packages
2086604a4f4cSmrgif test "x$have_groff" = x"yes"; then
2087604a4f4cSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2088604a4f4cSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2089604a4f4cSmrg        groff_ms_works=yes
2090604a4f4cSmrg    else
2091604a4f4cSmrg        groff_ms_works=no
2092604a4f4cSmrg    fi
2093604a4f4cSmrg    AC_MSG_RESULT([$groff_ms_works])
2094604a4f4cSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2095604a4f4cSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2096604a4f4cSmrg        groff_mm_works=yes
2097604a4f4cSmrg    else
2098604a4f4cSmrg        groff_mm_works=no
2099604a4f4cSmrg    fi
2100604a4f4cSmrg    AC_MSG_RESULT([$groff_mm_works])
2101604a4f4cSmrgfi
2102604a4f4cSmrg
2103604a4f4cSmrg# We have groff, test for HTML dependencies, one command per package
2104604a4f4cSmrgif test "x$have_groff" = x"yes"; then
2105604a4f4cSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2106604a4f4cSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2107604a4f4cSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2108604a4f4cSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2109604a4f4cSmrg      have_groff_html=yes
2110604a4f4cSmrg   else
2111604a4f4cSmrg      have_groff_html=no
2112604a4f4cSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2113604a4f4cSmrg   fi
2114604a4f4cSmrgfi
2115604a4f4cSmrg
2116604a4f4cSmrg# Set Automake conditionals for Makefiles
2117604a4f4cSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2118604a4f4cSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2119604a4f4cSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2120604a4f4cSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2121604a4f4cSmrg]) # XORG_WITH_GROFF
2122604a4f4cSmrg
2123b6f5cd12Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2124b6f5cd12Smrg# ---------------------------------------
2125604a4f4cSmrg# Minimum version: 1.6.0
2126b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2127b6f5cd12Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2128604a4f4cSmrg#
2129604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
2130604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
2131604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2132604a4f4cSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2133b6f5cd12Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2134b6f5cd12Smrg# --with-fop assumes 'auto'.
2135604a4f4cSmrg#
2136604a4f4cSmrg# Interface to module:
2137604a4f4cSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2138604a4f4cSmrg# FOP:	 	returns the path of the fop program found
2139604a4f4cSmrg#		returns the path set by the user in the environment
2140604a4f4cSmrg# --with-fop: 	'yes' user instructs the module to use fop
2141604a4f4cSmrg#		'no' user instructs the module not to use fop
2142604a4f4cSmrg#
2143604a4f4cSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2144604a4f4cSmrg#
2145604a4f4cSmrgAC_DEFUN([XORG_WITH_FOP],[
2146604a4f4cSmrgAC_ARG_VAR([FOP], [Path to fop command])
2147b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
2148604a4f4cSmrgAC_ARG_WITH(fop,
2149604a4f4cSmrg	AS_HELP_STRING([--with-fop],
2150b6f5cd12Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2151b6f5cd12Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2152b6f5cd12Smrgm4_undefine([_defopt])
2153604a4f4cSmrg
2154604a4f4cSmrgif test "x$use_fop" = x"auto"; then
2155604a4f4cSmrg   AC_PATH_PROG([FOP], [fop])
2156604a4f4cSmrg   if test "x$FOP" = "x"; then
2157604a4f4cSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2158604a4f4cSmrg	have_fop=no
2159604a4f4cSmrg   else
2160604a4f4cSmrg        have_fop=yes
2161604a4f4cSmrg   fi
2162604a4f4cSmrgelif test "x$use_fop" = x"yes" ; then
2163604a4f4cSmrg   AC_PATH_PROG([FOP], [fop])
2164604a4f4cSmrg   if test "x$FOP" = "x"; then
2165604a4f4cSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2166604a4f4cSmrg   fi
2167604a4f4cSmrg   have_fop=yes
2168604a4f4cSmrgelif test "x$use_fop" = x"no" ; then
2169604a4f4cSmrg   if test "x$FOP" != "x"; then
2170604a4f4cSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2171604a4f4cSmrg   fi
2172604a4f4cSmrg   have_fop=no
2173604a4f4cSmrgelse
2174604a4f4cSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2175604a4f4cSmrgfi
2176b6f5cd12Smrg
2177b6f5cd12Smrg# Test for a minimum version of fop, if provided.
2178b6f5cd12Smrgm4_ifval([$1],
2179b6f5cd12Smrg[if test "$have_fop" = yes; then
2180b6f5cd12Smrg    # scrape the fop version
2181b6f5cd12Smrg    AC_MSG_CHECKING([for fop minimum version])
2182b6f5cd12Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2183b6f5cd12Smrg    AC_MSG_RESULT([$fop_version])
2184b6f5cd12Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2185b6f5cd12Smrg        [if test "x$use_fop" = xauto; then
2186b6f5cd12Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2187b6f5cd12Smrg            have_fop=no
2188b6f5cd12Smrg        else
2189b6f5cd12Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2190b6f5cd12Smrg        fi])
2191b6f5cd12Smrgfi])
2192604a4f4cSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2193604a4f4cSmrg]) # XORG_WITH_FOP
2194604a4f4cSmrg
219579bbd9e8Smrg# XORG_WITH_M4([MIN-VERSION])
219679bbd9e8Smrg# ---------------------------
219779bbd9e8Smrg# Minimum version: 1.19.0
219879bbd9e8Smrg#
219979bbd9e8Smrg# This macro attempts to locate an m4 macro processor which supports
220079bbd9e8Smrg# -I option and is only useful for modules relying on M4 in order to
220179bbd9e8Smrg# expand macros in source code files.
220279bbd9e8Smrg#
220379bbd9e8Smrg# Interface to module:
220479bbd9e8Smrg# M4:	 	returns the path of the m4 program found
220579bbd9e8Smrg#		returns the path set by the user in the environment
220679bbd9e8Smrg#
220779bbd9e8SmrgAC_DEFUN([XORG_WITH_M4], [
220879bbd9e8SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
220979bbd9e8Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
221079bbd9e8Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
221179bbd9e8Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
221279bbd9e8Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
221379bbd9e8Smrg   [$PATH:/usr/gnu/bin])])
221479bbd9e8Smrg
221579bbd9e8SmrgAC_SUBST([M4], [$ac_cv_path_M4])
221679bbd9e8Smrg]) # XORG_WITH_M4
221779bbd9e8Smrg
2218b6f5cd12Smrg# XORG_WITH_PS2PDF([DEFAULT])
2219604a4f4cSmrg# ----------------
2220604a4f4cSmrg# Minimum version: 1.6.0
2221b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2222604a4f4cSmrg#
2223604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
2224604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
2225604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2226604a4f4cSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2227b6f5cd12Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2228b6f5cd12Smrg# --with-ps2pdf assumes 'auto'.
2229604a4f4cSmrg#
2230604a4f4cSmrg# Interface to module:
2231604a4f4cSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2232604a4f4cSmrg# PS2PDF:	returns the path of the ps2pdf program found
2233604a4f4cSmrg#		returns the path set by the user in the environment
2234604a4f4cSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2235604a4f4cSmrg#		 'no' user instructs the module not to use ps2pdf
2236604a4f4cSmrg#
2237604a4f4cSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2238604a4f4cSmrg#
2239604a4f4cSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2240604a4f4cSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2241b6f5cd12Smrgm4_define([_defopt], m4_default([$1], [auto]))
2242604a4f4cSmrgAC_ARG_WITH(ps2pdf,
2243604a4f4cSmrg	AS_HELP_STRING([--with-ps2pdf],
2244b6f5cd12Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2245b6f5cd12Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2246b6f5cd12Smrgm4_undefine([_defopt])
2247604a4f4cSmrg
2248604a4f4cSmrgif test "x$use_ps2pdf" = x"auto"; then
2249604a4f4cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2250604a4f4cSmrg   if test "x$PS2PDF" = "x"; then
2251604a4f4cSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2252604a4f4cSmrg	have_ps2pdf=no
2253604a4f4cSmrg   else
2254604a4f4cSmrg        have_ps2pdf=yes
2255604a4f4cSmrg   fi
2256604a4f4cSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2257604a4f4cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2258604a4f4cSmrg   if test "x$PS2PDF" = "x"; then
2259604a4f4cSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2260604a4f4cSmrg   fi
2261604a4f4cSmrg   have_ps2pdf=yes
2262604a4f4cSmrgelif test "x$use_ps2pdf" = x"no" ; then
2263604a4f4cSmrg   if test "x$PS2PDF" != "x"; then
2264604a4f4cSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2265604a4f4cSmrg   fi
2266604a4f4cSmrg   have_ps2pdf=no
2267604a4f4cSmrgelse
2268604a4f4cSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2269604a4f4cSmrgfi
2270604a4f4cSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2271604a4f4cSmrg]) # XORG_WITH_PS2PDF
2272604a4f4cSmrg
2273604a4f4cSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2274604a4f4cSmrg# ----------------
2275604a4f4cSmrg# Minimum version: 1.6.0
2276604a4f4cSmrg#
2277604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
2278604a4f4cSmrg# not at the appropriate level. This macro enables a builder to skip all
2279604a4f4cSmrg# documentation targets except traditional man pages.
2280604a4f4cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2281604a4f4cSmrg# maximum flexibilty in controlling documentation building.
2282604a4f4cSmrg# Refer to:
2283604a4f4cSmrg# XORG_WITH_XMLTO         --with-xmlto
2284604a4f4cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2285604a4f4cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2286604a4f4cSmrg# XORG_WITH_FOP           --with-fop
2287604a4f4cSmrg# XORG_WITH_GROFF         --with-groff
2288604a4f4cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2289604a4f4cSmrg#
2290604a4f4cSmrg# Interface to module:
2291604a4f4cSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2292604a4f4cSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2293604a4f4cSmrg#		 'no' user instructs the module not to generate docs
2294604a4f4cSmrg# parm1:	specify the default value, yes or no.
2295604a4f4cSmrg#
2296604a4f4cSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2297b6f5cd12Smrgm4_define([docs_default], m4_default([$1], [yes]))
2298604a4f4cSmrgAC_ARG_ENABLE(docs,
2299604a4f4cSmrg	AS_HELP_STRING([--enable-docs],
2300b6f5cd12Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2301b6f5cd12Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2302b6f5cd12Smrgm4_undefine([docs_default])
2303604a4f4cSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2304604a4f4cSmrgAC_MSG_CHECKING([whether to build documentation])
2305604a4f4cSmrgAC_MSG_RESULT([$build_docs])
2306604a4f4cSmrg]) # XORG_ENABLE_DOCS
2307604a4f4cSmrg
2308604a4f4cSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2309604a4f4cSmrg# ----------------
2310604a4f4cSmrg# Minimum version: 1.6.0
2311604a4f4cSmrg#
2312604a4f4cSmrg# This macro enables a builder to skip all developer documentation.
2313604a4f4cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2314604a4f4cSmrg# maximum flexibilty in controlling documentation building.
2315604a4f4cSmrg# Refer to:
2316604a4f4cSmrg# XORG_WITH_XMLTO         --with-xmlto
2317604a4f4cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2318604a4f4cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2319604a4f4cSmrg# XORG_WITH_FOP           --with-fop
2320604a4f4cSmrg# XORG_WITH_GROFF         --with-groff
2321604a4f4cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2322604a4f4cSmrg#
2323604a4f4cSmrg# Interface to module:
2324604a4f4cSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2325604a4f4cSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2326604a4f4cSmrg#			'no' user instructs the module not to generate developer docs
2327604a4f4cSmrg# parm1:		specify the default value, yes or no.
2328604a4f4cSmrg#
2329604a4f4cSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2330b6f5cd12Smrgm4_define([devel_default], m4_default([$1], [yes]))
2331604a4f4cSmrgAC_ARG_ENABLE(devel-docs,
2332604a4f4cSmrg	AS_HELP_STRING([--enable-devel-docs],
2333b6f5cd12Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2334b6f5cd12Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2335b6f5cd12Smrgm4_undefine([devel_default])
2336604a4f4cSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2337604a4f4cSmrgAC_MSG_CHECKING([whether to build developer documentation])
2338604a4f4cSmrgAC_MSG_RESULT([$build_devel_docs])
2339604a4f4cSmrg]) # XORG_ENABLE_DEVEL_DOCS
2340604a4f4cSmrg
2341604a4f4cSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2342604a4f4cSmrg# ----------------
2343604a4f4cSmrg# Minimum version: 1.6.0
2344604a4f4cSmrg#
2345604a4f4cSmrg# This macro enables a builder to skip all functional specification targets.
2346604a4f4cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2347604a4f4cSmrg# maximum flexibilty in controlling documentation building.
2348604a4f4cSmrg# Refer to:
2349604a4f4cSmrg# XORG_WITH_XMLTO         --with-xmlto
2350604a4f4cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2351604a4f4cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2352604a4f4cSmrg# XORG_WITH_FOP           --with-fop
2353604a4f4cSmrg# XORG_WITH_GROFF         --with-groff
2354604a4f4cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2355604a4f4cSmrg#
2356604a4f4cSmrg# Interface to module:
2357604a4f4cSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2358604a4f4cSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2359604a4f4cSmrg#			'no' user instructs the module not to generate specs
2360604a4f4cSmrg# parm1:		specify the default value, yes or no.
2361604a4f4cSmrg#
2362604a4f4cSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2363b6f5cd12Smrgm4_define([spec_default], m4_default([$1], [yes]))
2364604a4f4cSmrgAC_ARG_ENABLE(specs,
2365604a4f4cSmrg	AS_HELP_STRING([--enable-specs],
2366b6f5cd12Smrg	   [Enable building the specs (default: ]spec_default[)]),
2367b6f5cd12Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2368b6f5cd12Smrgm4_undefine([spec_default])
2369604a4f4cSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2370604a4f4cSmrgAC_MSG_CHECKING([whether to build functional specifications])
2371604a4f4cSmrgAC_MSG_RESULT([$build_specs])
2372604a4f4cSmrg]) # XORG_ENABLE_SPECS
2373604a4f4cSmrg
2374b6f5cd12Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2375b6f5cd12Smrg# ----------------------------------------------
2376b6f5cd12Smrg# Minimum version: 1.13.0
2377b6f5cd12Smrg#
2378b6f5cd12Smrg# This macro enables a builder to enable/disable unit testing
2379b6f5cd12Smrg# It makes no assumption about the test cases implementation
2380b6f5cd12Smrg# Test cases may or may not use Automake "Support for test suites"
2381b6f5cd12Smrg# They may or may not use the software utility library GLib
2382b6f5cd12Smrg#
2383b6f5cd12Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2384b6f5cd12Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2385b6f5cd12Smrg# The variable enable_unit_tests is used by other macros in this file.
2386b6f5cd12Smrg#
2387b6f5cd12Smrg# Interface to module:
2388b6f5cd12Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2389b6f5cd12Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2390b6f5cd12Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2391b6f5cd12Smrg#			'no' user instructs the module not to build tests
2392b6f5cd12Smrg# parm1:		specify the default value, yes or no.
2393b6f5cd12Smrg#
2394b6f5cd12SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2395b6f5cd12SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2396b6f5cd12SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2397b6f5cd12SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2398b6f5cd12Smrgm4_define([_defopt], m4_default([$1], [auto]))
2399b6f5cd12SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2400b6f5cd12Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2401b6f5cd12Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2402b6f5cd12Smrgm4_undefine([_defopt])
2403b6f5cd12SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2404b6f5cd12SmrgAC_MSG_CHECKING([whether to build unit test cases])
2405b6f5cd12SmrgAC_MSG_RESULT([$enable_unit_tests])
2406b6f5cd12Smrg]) # XORG_ENABLE_UNIT_TESTS
2407b6f5cd12Smrg
2408b6f5cd12Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2409b6f5cd12Smrg# ------------------------------------------------------
2410b6f5cd12Smrg# Minimum version: 1.17.0
2411b6f5cd12Smrg#
2412b6f5cd12Smrg# This macro enables a builder to enable/disable integration testing
2413b6f5cd12Smrg# It makes no assumption about the test cases' implementation
2414b6f5cd12Smrg# Test cases may or may not use Automake "Support for test suites"
2415b6f5cd12Smrg#
2416b6f5cd12Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2417b6f5cd12Smrg# usually requires less dependencies and may be built and run under less
2418b6f5cd12Smrg# stringent environments than integration tests.
2419b6f5cd12Smrg#
2420b6f5cd12Smrg# Interface to module:
2421b6f5cd12Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2422b6f5cd12Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2423b6f5cd12Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2424b6f5cd12Smrg#                             'no' user instructs the module not to build tests
2425b6f5cd12Smrg# parm1:                      specify the default value, yes or no.
2426b6f5cd12Smrg#
2427b6f5cd12SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2428b6f5cd12SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2429b6f5cd12Smrgm4_define([_defopt], m4_default([$1], [auto]))
2430b6f5cd12SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2431b6f5cd12Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2432b6f5cd12Smrg	[enable_integration_tests=$enableval],
2433b6f5cd12Smrg	[enable_integration_tests=]_defopt)
2434b6f5cd12Smrgm4_undefine([_defopt])
2435b6f5cd12SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2436b6f5cd12Smrg	[test "x$enable_integration_tests" != xno])
2437b6f5cd12SmrgAC_MSG_CHECKING([whether to build unit test cases])
2438b6f5cd12SmrgAC_MSG_RESULT([$enable_integration_tests])
2439b6f5cd12Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2440b6f5cd12Smrg
2441b6f5cd12Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2442b6f5cd12Smrg# ----------------------------------------
2443b6f5cd12Smrg# Minimum version: 1.13.0
2444b6f5cd12Smrg#
2445b6f5cd12Smrg# GLib is a library which provides advanced data structures and functions.
2446b6f5cd12Smrg# This macro enables a module to test for the presence of Glib.
2447b6f5cd12Smrg#
2448b6f5cd12Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2449b6f5cd12Smrg# Otherwise the value of $enable_unit_tests is blank.
2450b6f5cd12Smrg#
2451b6f5cd12Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2452b6f5cd12Smrg# test support usually requires less dependencies and may be built and run under
2453b6f5cd12Smrg# less stringent environments than integration tests.
2454b6f5cd12Smrg#
2455b6f5cd12Smrg# Interface to module:
2456b6f5cd12Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2457b6f5cd12Smrg# with_glib: used in configure.ac to know if GLib has been found
2458b6f5cd12Smrg# --with-glib:	'yes' user instructs the module to use glib
2459b6f5cd12Smrg#		'no' user instructs the module not to use glib
2460b6f5cd12Smrg#
2461b6f5cd12SmrgAC_DEFUN([XORG_WITH_GLIB],[
2462b6f5cd12SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2463b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
2464b6f5cd12SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2465b6f5cd12Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2466b6f5cd12Smrg	[with_glib=$withval], [with_glib=]_defopt)
2467b6f5cd12Smrgm4_undefine([_defopt])
2468b6f5cd12Smrg
2469b6f5cd12Smrghave_glib=no
2470b6f5cd12Smrg# Do not probe GLib if user explicitly disabled unit testing
2471b6f5cd12Smrgif test "x$enable_unit_tests" != x"no"; then
2472b6f5cd12Smrg  # Do not probe GLib if user explicitly disabled it
2473b6f5cd12Smrg  if test "x$with_glib" != x"no"; then
2474b6f5cd12Smrg    m4_ifval(
2475b6f5cd12Smrg      [$1],
2476b6f5cd12Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2477b6f5cd12Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2478b6f5cd12Smrg    )
2479b6f5cd12Smrg  fi
2480b6f5cd12Smrgfi
2481b6f5cd12Smrg
2482b6f5cd12Smrg# Not having GLib when unit testing has been explicitly requested is an error
2483b6f5cd12Smrgif test "x$enable_unit_tests" = x"yes"; then
2484b6f5cd12Smrg  if test "x$have_glib" = x"no"; then
2485b6f5cd12Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2486b6f5cd12Smrg  fi
2487b6f5cd12Smrgfi
2488b6f5cd12Smrg
2489b6f5cd12Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2490b6f5cd12Smrgif test "x$enable_unit_tests" = x"no"; then
2491b6f5cd12Smrg  if test "x$with_glib" = x"yes"; then
2492b6f5cd12Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2493b6f5cd12Smrg  fi
2494b6f5cd12Smrgfi
2495b6f5cd12Smrg
2496b6f5cd12Smrg# Not having GLib when it has been explicitly requested is an error
2497b6f5cd12Smrgif test "x$with_glib" = x"yes"; then
2498b6f5cd12Smrg  if test "x$have_glib" = x"no"; then
2499b6f5cd12Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2500b6f5cd12Smrg  fi
2501b6f5cd12Smrgfi
2502b6f5cd12Smrg
2503b6f5cd12SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2504b6f5cd12Smrg]) # XORG_WITH_GLIB
2505b6f5cd12Smrg
2506b6f5cd12Smrg# XORG_LD_WRAP([required|optional])
2507b6f5cd12Smrg# ---------------------------------
2508b6f5cd12Smrg# Minimum version: 1.13.0
2509b6f5cd12Smrg#
2510b6f5cd12Smrg# Check if linker supports -wrap, passed via compiler flags
2511b6f5cd12Smrg#
2512b6f5cd12Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2513b6f5cd12Smrg# Otherwise the value of $enable_unit_tests is blank.
2514b6f5cd12Smrg#
2515b6f5cd12Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2516b6f5cd12Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2517b6f5cd12Smrg# available, an argument of "optional" allows use when some unit tests require
2518b6f5cd12Smrg# ld -wrap and others do not.
2519b6f5cd12Smrg#
2520b6f5cd12SmrgAC_DEFUN([XORG_LD_WRAP],[
2521b6f5cd12SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2522b6f5cd12Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2523b6f5cd12Smrg                      void __wrap_exit(int status) { return; }],
2524b6f5cd12Smrg                     [exit(0);])])
2525b6f5cd12Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2526b6f5cd12Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2527b6f5cd12Smrg  if test "x$have_ld_wrap" = x"no"; then
2528b6f5cd12Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2529b6f5cd12Smrg  fi
2530b6f5cd12Smrgfi
2531b6f5cd12SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2532b6f5cd12Smrg#
2533b6f5cd12Smrg]) # XORG_LD_WRAP
2534b6f5cd12Smrg
2535b6f5cd12Smrg# XORG_CHECK_LINKER_FLAGS
2536b6f5cd12Smrg# -----------------------
2537b6f5cd12Smrg# SYNOPSIS
2538b6f5cd12Smrg#
2539b6f5cd12Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2540b6f5cd12Smrg#
2541b6f5cd12Smrg# DESCRIPTION
2542b6f5cd12Smrg#
2543b6f5cd12Smrg#   Check whether the given linker FLAGS work with the current language's
2544b6f5cd12Smrg#   linker, or whether they give an error.
2545b6f5cd12Smrg#
2546b6f5cd12Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2547b6f5cd12Smrg#   success/failure.
2548b6f5cd12Smrg#
2549b6f5cd12Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2550b6f5cd12Smrg#
2551b6f5cd12Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2552b6f5cd12Smrg#
2553b6f5cd12Smrg# LICENSE
2554b6f5cd12Smrg#
2555b6f5cd12Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2556b6f5cd12Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2557b6f5cd12Smrg#   Copyright (c) 2009 Matteo Frigo
2558b6f5cd12Smrg#
2559b6f5cd12Smrg#   This program is free software: you can redistribute it and/or modify it
2560b6f5cd12Smrg#   under the terms of the GNU General Public License as published by the
2561b6f5cd12Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2562b6f5cd12Smrg#   option) any later version.
2563b6f5cd12Smrg#
2564b6f5cd12Smrg#   This program is distributed in the hope that it will be useful, but
2565b6f5cd12Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2566b6f5cd12Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2567b6f5cd12Smrg#   Public License for more details.
2568b6f5cd12Smrg#
2569b6f5cd12Smrg#   You should have received a copy of the GNU General Public License along
2570b6f5cd12Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2571b6f5cd12Smrg#
2572b6f5cd12Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2573b6f5cd12Smrg#   gives unlimited permission to copy, distribute and modify the configure
2574b6f5cd12Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2575b6f5cd12Smrg#   need not follow the terms of the GNU General Public License when using
2576b6f5cd12Smrg#   or distributing such scripts, even though portions of the text of the
2577b6f5cd12Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2578b6f5cd12Smrg#   all other use of the material that constitutes the Autoconf Macro.
2579b6f5cd12Smrg#
2580b6f5cd12Smrg#   This special exception to the GPL applies to versions of the Autoconf
2581b6f5cd12Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2582b6f5cd12Smrg#   modified version of the Autoconf Macro, you may extend this special
2583b6f5cd12Smrg#   exception to the GPL to apply to your modified version as well.#
2584b6f5cd12SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2585b6f5cd12Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2586b6f5cd12Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2587b6f5cd12SmrgAS_LITERAL_IF([$1],
2588b6f5cd12Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2589b6f5cd12Smrg      ax_save_FLAGS=$LDFLAGS
2590b6f5cd12Smrg      LDFLAGS="$1"
2591b6f5cd12Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2592b6f5cd12Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2593b6f5cd12Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2594b6f5cd12Smrg      LDFLAGS=$ax_save_FLAGS])],
2595b6f5cd12Smrg  [ax_save_FLAGS=$LDFLAGS
2596b6f5cd12Smrg   LDFLAGS="$1"
2597b6f5cd12Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2598b6f5cd12Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2599b6f5cd12Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2600b6f5cd12Smrg   LDFLAGS=$ax_save_FLAGS])
2601b6f5cd12Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2602b6f5cd12SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2603b6f5cd12Smrgif test "x$xorg_check_linker_flags" = xyes; then
2604b6f5cd12Smrg	m4_default([$2], :)
2605b6f5cd12Smrgelse
2606b6f5cd12Smrg	m4_default([$3], :)
2607b6f5cd12Smrgfi
2608b6f5cd12Smrg]) # XORG_CHECK_LINKER_FLAGS
2609b6f5cd12Smrg
2610b6f5cd12Smrg# XORG_MEMORY_CHECK_FLAGS
2611b6f5cd12Smrg# -----------------------
2612b6f5cd12Smrg# Minimum version: 1.16.0
2613b6f5cd12Smrg#
2614b6f5cd12Smrg# This macro attempts to find appropriate memory checking functionality
2615b6f5cd12Smrg# for various platforms which unit testing code may use to catch various
2616b6f5cd12Smrg# forms of memory allocation and access errors in testing.
2617b6f5cd12Smrg#
2618b6f5cd12Smrg# Interface to module:
2619b6f5cd12Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2620b6f5cd12Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2621b6f5cd12Smrg#
2622b6f5cd12Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2623b6f5cd12Smrg#
2624b6f5cd12SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2625b6f5cd12Smrg
2626b6f5cd12SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2627b6f5cd12SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2628b6f5cd12Smrg           [Environment variables to enable memory checking in tests])
2629b6f5cd12Smrg
2630b6f5cd12Smrg# Check for different types of support on different platforms
2631b6f5cd12Smrgcase $host_os in
2632b6f5cd12Smrg    solaris*)
2633b6f5cd12Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2634b6f5cd12Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2635b6f5cd12Smrg        ;;
2636b6f5cd12Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2637b6f5cd12Smrg        # both directly and inverted, so should not be 0 or 255.
2638b6f5cd12Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2639b6f5cd12Smrg        ;;
2640b6f5cd12Smrg    darwin*)
2641b6f5cd12Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2642b6f5cd12Smrg        ;;
2643b6f5cd12Smrg    *bsd*)
2644b6f5cd12Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2645b6f5cd12Smrg        ;;
2646b6f5cd12Smrgesac
2647b6f5cd12Smrg
2648b6f5cd12Smrg# User supplied flags override default flags
2649b6f5cd12Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2650b6f5cd12Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2651b6f5cd12Smrgfi
2652b6f5cd12Smrg
2653b6f5cd12SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2654b6f5cd12Smrg]) # XORG_WITH_LINT
2655b6f5cd12Smrg
265621ecb1efSmrg# XORG_CHECK_MALLOC_ZERO
265721ecb1efSmrg# ----------------------
265821ecb1efSmrg# Minimum version: 1.0.0
265921ecb1efSmrg#
266021ecb1efSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
266121ecb1efSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
266221ecb1efSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
266321ecb1efSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
266421ecb1efSmrgAC_ARG_ENABLE(malloc0returnsnull,
266521ecb1efSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
266621ecb1efSmrg		       [malloc(0) returns NULL (default: auto)]),
266721ecb1efSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
266821ecb1efSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
26691e00de39Smrg
267021ecb1efSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
267121ecb1efSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
267279bbd9e8SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
267379bbd9e8Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2674b6f5cd12Smrg#include <stdlib.h>
2675b6f5cd12Smrg],[
267621ecb1efSmrg    char *m0, *r0, *c0, *p;
267721ecb1efSmrg    m0 = malloc(0);
267821ecb1efSmrg    p = malloc(10);
267921ecb1efSmrg    r0 = realloc(p,0);
2680b6f5cd12Smrg    c0 = calloc(0,10);
2681b6f5cd12Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2682b6f5cd12Smrg])],
268379bbd9e8Smrg		[xorg_cv_malloc0_returns_null=yes],
268479bbd9e8Smrg		[xorg_cv_malloc0_returns_null=no])])
268579bbd9e8SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
268621ecb1efSmrgfi
268721ecb1efSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
26881e00de39Smrg
268921ecb1efSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
269021ecb1efSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
269121ecb1efSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
269221ecb1efSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
269321ecb1efSmrgelse
269421ecb1efSmrg	MALLOC_ZERO_CFLAGS=""
269521ecb1efSmrg	XMALLOC_ZERO_CFLAGS=""
269621ecb1efSmrg	XTMALLOC_ZERO_CFLAGS=""
269721ecb1efSmrgfi
26981e00de39Smrg
269921ecb1efSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
270021ecb1efSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
270121ecb1efSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
270221ecb1efSmrg]) # XORG_CHECK_MALLOC_ZERO
27031e00de39Smrg
270421ecb1efSmrg# XORG_WITH_LINT()
270521ecb1efSmrg# ----------------
270621ecb1efSmrg# Minimum version: 1.1.0
270721ecb1efSmrg#
2708604a4f4cSmrg# This macro enables the use of a tool that flags some suspicious and
2709604a4f4cSmrg# non-portable constructs (likely to be bugs) in C language source code.
2710604a4f4cSmrg# It will attempt to locate the tool and use appropriate options.
2711604a4f4cSmrg# There are various lint type tools on different platforms.
2712604a4f4cSmrg#
2713604a4f4cSmrg# Interface to module:
2714604a4f4cSmrg# LINT:		returns the path to the tool found on the platform
2715604a4f4cSmrg#		or the value set to LINT on the configure cmd line
2716604a4f4cSmrg#		also an Automake conditional
2717604a4f4cSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2718604a4f4cSmrg#
2719604a4f4cSmrg# --with-lint:	'yes' user instructs the module to use lint
2720604a4f4cSmrg#		'no' user instructs the module not to use lint (default)
2721604a4f4cSmrg#
2722604a4f4cSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2723604a4f4cSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
272421ecb1efSmrg#
272521ecb1efSmrgAC_DEFUN([XORG_WITH_LINT],[
272621ecb1efSmrg
2727604a4f4cSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2728604a4f4cSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
272921ecb1efSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
273021ecb1efSmrg		[Use a lint-style source code checker (default: disabled)])],
273121ecb1efSmrg		[use_lint=$withval], [use_lint=no])
2732604a4f4cSmrg
2733604a4f4cSmrg# Obtain platform specific info like program name and options
2734604a4f4cSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2735604a4f4cSmrgcase $host_os in
2736604a4f4cSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2737604a4f4cSmrg	lint_name=splint
2738604a4f4cSmrg	lint_options="-badflag"
2739604a4f4cSmrg	;;
2740604a4f4cSmrg  *freebsd* | *netbsd*)
2741604a4f4cSmrg	lint_name=lint
2742604a4f4cSmrg	lint_options="-u -b"
2743604a4f4cSmrg	;;
2744604a4f4cSmrg  *solaris*)
2745604a4f4cSmrg	lint_name=lint
2746604a4f4cSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2747604a4f4cSmrg	;;
2748604a4f4cSmrgesac
2749604a4f4cSmrg
2750604a4f4cSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2751604a4f4cSmrgif test "x$use_lint" = x"yes" ; then
2752604a4f4cSmrg   AC_PATH_PROG([LINT], [$lint_name])
2753604a4f4cSmrg   if test "x$LINT" = "x"; then
2754604a4f4cSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2755604a4f4cSmrg   fi
2756604a4f4cSmrgelif test "x$use_lint" = x"no" ; then
2757604a4f4cSmrg   if test "x$LINT" != "x"; then
2758604a4f4cSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2759604a4f4cSmrg   fi
276021ecb1efSmrgelse
2761604a4f4cSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
27621e00de39Smrgfi
2763604a4f4cSmrg
2764604a4f4cSmrg# User supplied flags override default flags
2765604a4f4cSmrgif test "x$LINT_FLAGS" != "x"; then
2766604a4f4cSmrg   lint_options=$LINT_FLAGS
27671e00de39Smrgfi
27681e00de39Smrg
2769604a4f4cSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2770604a4f4cSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
27711e00de39Smrg
277221ecb1efSmrg]) # XORG_WITH_LINT
27731e00de39Smrg
277421ecb1efSmrg# XORG_LINT_LIBRARY(LIBNAME)
277521ecb1efSmrg# --------------------------
277621ecb1efSmrg# Minimum version: 1.1.0
277721ecb1efSmrg#
277821ecb1efSmrg# Sets up flags for building lint libraries for checking programs that call
277921ecb1efSmrg# functions in the library.
278021ecb1efSmrg#
2781604a4f4cSmrg# Interface to module:
2782604a4f4cSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2783604a4f4cSmrg# MAKE_LINT_LIB		- Automake conditional
2784604a4f4cSmrg#
2785604a4f4cSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2786604a4f4cSmrg#			  - 'no' user instructs the module not to create a lint library (default)
27871e00de39Smrg
278821ecb1efSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
278921ecb1efSmrgAC_REQUIRE([XORG_WITH_LINT])
279021ecb1efSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
279121ecb1efSmrg	[Create lint library (default: disabled)])],
279221ecb1efSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2793604a4f4cSmrg
2794604a4f4cSmrgif test "x$make_lint_lib" = x"yes" ; then
2795604a4f4cSmrg   LINTLIB=llib-l$1.ln
2796604a4f4cSmrg   if test "x$LINT" = "x"; then
2797604a4f4cSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2798604a4f4cSmrg   fi
2799604a4f4cSmrgelif test "x$make_lint_lib" != x"no" ; then
2800604a4f4cSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
280121ecb1efSmrgfi
2802604a4f4cSmrg
280321ecb1efSmrgAC_SUBST(LINTLIB)
280421ecb1efSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
28051e00de39Smrg
280621ecb1efSmrg]) # XORG_LINT_LIBRARY
28071e00de39Smrg
2808b6f5cd12Smrg# XORG_COMPILER_BRAND
2809b6f5cd12Smrg# -------------------
2810b6f5cd12Smrg# Minimum version: 1.14.0
2811b6f5cd12Smrg#
2812b6f5cd12Smrg# Checks for various brands of compilers and sets flags as appropriate:
2813b6f5cd12Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2814b6f5cd12Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2815b6f5cd12Smrg#   clang compiler - sets CLANGCC to "yes"
2816b6f5cd12Smrg#   Intel compiler - sets INTELCC to "yes"
2817b6f5cd12Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2818b6f5cd12Smrg#
2819b6f5cd12SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2820b6f5cd12SmrgAC_LANG_CASE(
2821b6f5cd12Smrg	[C], [
2822b6f5cd12Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2823b6f5cd12Smrg	],
2824b6f5cd12Smrg	[C++], [
2825b6f5cd12Smrg		AC_REQUIRE([AC_PROG_CXX])
2826b6f5cd12Smrg	]
2827b6f5cd12Smrg)
2828b6f5cd12SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2829b6f5cd12SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2830b6f5cd12SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2831b6f5cd12Smrg]) # XORG_COMPILER_BRAND
2832b6f5cd12Smrg
2833b6f5cd12Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2834b6f5cd12Smrg# ---------------
2835b6f5cd12Smrg# Minimum version: 1.16.0
2836b6f5cd12Smrg#
2837b6f5cd12Smrg# Test if the compiler works when passed the given flag as a command line argument.
2838b6f5cd12Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2839b6f5cd12Smrg# next flag in the list until there are no more options.
2840b6f5cd12Smrg#
2841b6f5cd12Smrg# Note that this does not guarantee that the compiler supports the flag as some
2842b6f5cd12Smrg# compilers will simply ignore arguments that they do not understand, but we do
2843b6f5cd12Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2844b6f5cd12Smrg# -Werror=unused-command-line-argument
2845b6f5cd12Smrg#
2846b6f5cd12SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2847b6f5cd12Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2848b6f5cd12Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2849b6f5cd12Smrg
2850b6f5cd12SmrgAC_LANG_COMPILER_REQUIRE
2851b6f5cd12Smrg
2852b6f5cd12SmrgAC_LANG_CASE(
2853b6f5cd12Smrg	[C], [
2854b6f5cd12Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2855b6f5cd12Smrg		define([PREFIX], [C])
2856b6f5cd12Smrg		define([CACHE_PREFIX], [cc])
2857b6f5cd12Smrg		define([COMPILER], [$CC])
2858b6f5cd12Smrg	],
2859b6f5cd12Smrg	[C++], [
2860b6f5cd12Smrg		define([PREFIX], [CXX])
2861b6f5cd12Smrg		define([CACHE_PREFIX], [cxx])
2862b6f5cd12Smrg		define([COMPILER], [$CXX])
2863b6f5cd12Smrg	]
2864b6f5cd12Smrg)
2865b6f5cd12Smrg
2866b6f5cd12Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2867b6f5cd12Smrg
2868b6f5cd12Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2869b6f5cd12Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2870b6f5cd12Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2871b6f5cd12Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2872b6f5cd12Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2873b6f5cd12Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2874b6f5cd12Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2875b6f5cd12Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2876b6f5cd12Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2877b6f5cd12Smrgfi
2878b6f5cd12Smrg
2879b6f5cd12Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2880b6f5cd12Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2881b6f5cd12Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2882b6f5cd12Smrg	fi
2883b6f5cd12Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2884b6f5cd12Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2885b6f5cd12Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2886b6f5cd12Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2887b6f5cd12Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2888b6f5cd12Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2889b6f5cd12Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2890b6f5cd12Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2891b6f5cd12Smrgfi
2892b6f5cd12Smrg
2893b6f5cd12Smrgfound="no"
2894b6f5cd12Smrgm4_foreach([flag], m4_cdr($@), [
2895b6f5cd12Smrg	if test $found = "no" ; then
289679bbd9e8Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
2897b6f5cd12Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2898b6f5cd12Smrg		fi
2899b6f5cd12Smrg
290079bbd9e8Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
2901b6f5cd12Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2902b6f5cd12Smrg		fi
2903b6f5cd12Smrg
2904b6f5cd12Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2905b6f5cd12Smrg
2906b6f5cd12Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2907b6f5cd12Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2908b6f5cd12Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2909b6f5cd12Smrg		AC_CACHE_VAL($cacheid,
2910b6f5cd12Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2911b6f5cd12Smrg					     [eval $cacheid=yes],
2912b6f5cd12Smrg					     [eval $cacheid=no])])
2913b6f5cd12Smrg
2914b6f5cd12Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2915b6f5cd12Smrg
2916b6f5cd12Smrg		eval supported=\$$cacheid
2917b6f5cd12Smrg		AC_MSG_RESULT([$supported])
2918b6f5cd12Smrg		if test "$supported" = "yes" ; then
2919b6f5cd12Smrg			$1="$$1 ]flag["
2920b6f5cd12Smrg			found="yes"
2921b6f5cd12Smrg		fi
2922b6f5cd12Smrg	fi
2923b6f5cd12Smrg])
2924b6f5cd12Smrg]) # XORG_TESTSET_CFLAG
2925b6f5cd12Smrg
2926b6f5cd12Smrg# XORG_COMPILER_FLAGS
2927b6f5cd12Smrg# ---------------
2928b6f5cd12Smrg# Minimum version: 1.16.0
2929b6f5cd12Smrg#
2930b6f5cd12Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2931b6f5cd12Smrg# arguments supported by the selected compiler which do NOT alter the generated
2932b6f5cd12Smrg# code.  These arguments will cause the compiler to print various warnings
2933b6f5cd12Smrg# during compilation AND turn a conservative set of warnings into errors.
2934b6f5cd12Smrg#
2935b6f5cd12Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2936b6f5cd12Smrg# future versions of util-macros as options are added to new compilers.
2937b6f5cd12Smrg#
2938b6f5cd12SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2939b6f5cd12SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2940b6f5cd12Smrg
2941b6f5cd12SmrgAC_ARG_ENABLE(selective-werror,
2942b6f5cd12Smrg              AS_HELP_STRING([--disable-selective-werror],
2943b6f5cd12Smrg                             [Turn off selective compiler errors. (default: enabled)]),
2944b6f5cd12Smrg              [SELECTIVE_WERROR=$enableval],
2945b6f5cd12Smrg              [SELECTIVE_WERROR=yes])
2946b6f5cd12Smrg
2947b6f5cd12SmrgAC_LANG_CASE(
2948b6f5cd12Smrg        [C], [
2949b6f5cd12Smrg                define([PREFIX], [C])
2950b6f5cd12Smrg        ],
2951b6f5cd12Smrg        [C++], [
2952b6f5cd12Smrg                define([PREFIX], [CXX])
2953b6f5cd12Smrg        ]
2954b6f5cd12Smrg)
2955b6f5cd12Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2956b6f5cd12Smrgif test "x$SUNCC" = "xyes"; then
2957b6f5cd12Smrg    [BASE_]PREFIX[FLAGS]="-v"
2958b6f5cd12Smrgelse
2959b6f5cd12Smrg    [BASE_]PREFIX[FLAGS]=""
2960b6f5cd12Smrgfi
2961b6f5cd12Smrg
2962b6f5cd12Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2963b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2964b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2965b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2966b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2967b6f5cd12Smrg
2968b6f5cd12SmrgAC_LANG_CASE(
2969b6f5cd12Smrg	[C], [
2970b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2971b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2972b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2973b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
297479bbd9e8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
2975b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2976b6f5cd12Smrg	]
2977b6f5cd12Smrg)
2978b6f5cd12Smrg
2979b6f5cd12Smrg# This chunk adds additional warnings that could catch undesired effects.
2980b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2981b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2982b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2983b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2984b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2985b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
298679bbd9e8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2987b6f5cd12Smrg
2988b6f5cd12Smrg# These are currently disabled because they are noisy.  They will be enabled
2989b6f5cd12Smrg# in the future once the codebase is sufficiently modernized to silence
2990b6f5cd12Smrg# them.  For now, I don't want them to drown out the other warnings.
2991b6f5cd12Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2992b6f5cd12Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
299379bbd9e8Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2994b6f5cd12Smrg
2995b6f5cd12Smrg# Turn some warnings into errors, so we don't accidently get successful builds
2996b6f5cd12Smrg# when there are problems that should be fixed.
2997b6f5cd12Smrg
2998b6f5cd12Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2999b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3000b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3001b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3002b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3003b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3004b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3005b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3006b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3007b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3008b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3009b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3010b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3011b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3012b6f5cd12Smrgelse
3013b6f5cd12SmrgAC_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])
3014b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3015b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3016b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3017b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3018b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3019b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3020b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3021b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3022b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3023b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3024b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3025b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3026b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3027b6f5cd12Smrgfi
3028b6f5cd12Smrg
3029b6f5cd12SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3030b6f5cd12Smrg]) # XORG_COMPILER_FLAGS
3031b6f5cd12Smrg
303221ecb1efSmrg# XORG_CWARNFLAGS
303321ecb1efSmrg# ---------------
303421ecb1efSmrg# Minimum version: 1.2.0
3035b6f5cd12Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
303621ecb1efSmrg#
303721ecb1efSmrg# Defines CWARNFLAGS to enable C compiler warnings.
303821ecb1efSmrg#
3039b6f5cd12Smrg# This function is deprecated because it defines -fno-strict-aliasing
3040b6f5cd12Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3041b6f5cd12Smrg# is needed, then it should be added explicitly in the module when
3042b6f5cd12Smrg# it is updated to use BASE_CFLAGS.
3043b6f5cd12Smrg#
304421ecb1efSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3045b6f5cd12SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3046b6f5cd12SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3047b6f5cd12SmrgAC_LANG_CASE(
3048b6f5cd12Smrg	[C], [
3049b6f5cd12Smrg		CWARNFLAGS="$BASE_CFLAGS"
3050b6f5cd12Smrg		if  test "x$GCC" = xyes ; then
3051b6f5cd12Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3052b6f5cd12Smrg		fi
3053b6f5cd12Smrg		AC_SUBST(CWARNFLAGS)
3054b6f5cd12Smrg	]
3055b6f5cd12Smrg)
305621ecb1efSmrg]) # XORG_CWARNFLAGS
30571e00de39Smrg
305821ecb1efSmrg# XORG_STRICT_OPTION
305921ecb1efSmrg# -----------------------
306021ecb1efSmrg# Minimum version: 1.3.0
30611e00de39Smrg#
3062b6f5cd12Smrg# Add configure option to enable strict compilation flags, such as treating
3063b6f5cd12Smrg# warnings as fatal errors.
3064b6f5cd12Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3065b6f5cd12Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3066b6f5cd12Smrg#
3067b6f5cd12Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3068b6f5cd12Smrg# when strict compilation is unconditionally desired.
306921ecb1efSmrgAC_DEFUN([XORG_STRICT_OPTION], [
307021ecb1efSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3071b6f5cd12SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
307221ecb1efSmrg
307321ecb1efSmrgAC_ARG_ENABLE(strict-compilation,
307421ecb1efSmrg			  AS_HELP_STRING([--enable-strict-compilation],
307521ecb1efSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
307621ecb1efSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3077b6f5cd12Smrg
3078b6f5cd12SmrgAC_LANG_CASE(
3079b6f5cd12Smrg        [C], [
3080b6f5cd12Smrg                define([PREFIX], [C])
3081b6f5cd12Smrg        ],
3082b6f5cd12Smrg        [C++], [
3083b6f5cd12Smrg                define([PREFIX], [CXX])
3084b6f5cd12Smrg        ]
3085b6f5cd12Smrg)
3086b6f5cd12Smrg
3087b6f5cd12Smrg[STRICT_]PREFIX[FLAGS]=""
3088b6f5cd12SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3089b6f5cd12SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3090b6f5cd12Smrg
3091b6f5cd12Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3092b6f5cd12Smrg# activate it with -Werror, so we add it here explicitly.
3093b6f5cd12SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3094b6f5cd12Smrg
309521ecb1efSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3096b6f5cd12Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3097b6f5cd12Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
309821ecb1efSmrgfi
3099b6f5cd12SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3100b6f5cd12SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3101b6f5cd12SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
310221ecb1efSmrg]) # XORG_STRICT_OPTION
31031e00de39Smrg
310421ecb1efSmrg# XORG_DEFAULT_OPTIONS
310521ecb1efSmrg# --------------------
310621ecb1efSmrg# Minimum version: 1.3.0
31071e00de39Smrg#
310821ecb1efSmrg# Defines default options for X.Org modules.
310921ecb1efSmrg#
311021ecb1efSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3111604a4f4cSmrgAC_REQUIRE([AC_PROG_INSTALL])
3112b6f5cd12SmrgXORG_COMPILER_FLAGS
311321ecb1efSmrgXORG_CWARNFLAGS
311421ecb1efSmrgXORG_STRICT_OPTION
311521ecb1efSmrgXORG_RELEASE_VERSION
311621ecb1efSmrgXORG_CHANGELOG
3117604a4f4cSmrgXORG_INSTALL
311821ecb1efSmrgXORG_MANPAGE_SECTIONS
3119604a4f4cSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3120604a4f4cSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
312121ecb1efSmrg]) # XORG_DEFAULT_OPTIONS
3122604a4f4cSmrg
3123604a4f4cSmrg# XORG_INSTALL()
3124604a4f4cSmrg# ----------------
3125604a4f4cSmrg# Minimum version: 1.4.0
3126604a4f4cSmrg#
3127604a4f4cSmrg# Defines the variable INSTALL_CMD as the command to copy
3128604a4f4cSmrg# INSTALL from $prefix/share/util-macros.
3129604a4f4cSmrg#
3130604a4f4cSmrgAC_DEFUN([XORG_INSTALL], [
3131604a4f4cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3132604a4f4cSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3133604a4f4cSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3134604a4f4cSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3135604a4f4cSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3136604a4f4cSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3137604a4f4cSmrgAC_SUBST([INSTALL_CMD])
3138604a4f4cSmrg]) # XORG_INSTALL
313921ecb1efSmrgdnl Copyright 2005 Red Hat, Inc
314021ecb1efSmrgdnl
314121ecb1efSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
314221ecb1efSmrgdnl documentation for any purpose is hereby granted without fee, provided that
314321ecb1efSmrgdnl the above copyright notice appear in all copies and that both that
314421ecb1efSmrgdnl copyright notice and this permission notice appear in supporting
314521ecb1efSmrgdnl documentation.
314621ecb1efSmrgdnl
314721ecb1efSmrgdnl The above copyright notice and this permission notice shall be included
314821ecb1efSmrgdnl in all copies or substantial portions of the Software.
314921ecb1efSmrgdnl
315021ecb1efSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
315121ecb1efSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
315221ecb1efSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
315321ecb1efSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
315421ecb1efSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
315521ecb1efSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
315621ecb1efSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
315721ecb1efSmrgdnl
315821ecb1efSmrgdnl Except as contained in this notice, the name of the copyright holders shall
315921ecb1efSmrgdnl not be used in advertising or otherwise to promote the sale, use or
316021ecb1efSmrgdnl other dealings in this Software without prior written authorization
316121ecb1efSmrgdnl from the copyright holders.
316221ecb1efSmrgdnl
31631e00de39Smrg
316421ecb1efSmrg# XORG_RELEASE_VERSION
316521ecb1efSmrg# --------------------
3166604a4f4cSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
316779bbd9e8Smrg
316821ecb1efSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
316921ecb1efSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
317021ecb1efSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
317121ecb1efSmrg		[Major version of this package])
317221ecb1efSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
317321ecb1efSmrg	if test "x$PVM" = "x"; then
317421ecb1efSmrg		PVM="0"
317521ecb1efSmrg	fi
317621ecb1efSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
317721ecb1efSmrg		[$PVM],
317821ecb1efSmrg		[Minor version of this package])
317921ecb1efSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
318021ecb1efSmrg	if test "x$PVP" = "x"; then
318121ecb1efSmrg		PVP="0"
318221ecb1efSmrg	fi
318321ecb1efSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
318421ecb1efSmrg		[$PVP],
318521ecb1efSmrg		[Patch version of this package])
318621ecb1efSmrg])
31871e00de39Smrg
318821ecb1efSmrg# XORG_CHANGELOG()
318921ecb1efSmrg# ----------------
319021ecb1efSmrg# Minimum version: 1.2.0
319121ecb1efSmrg#
319221ecb1efSmrg# Defines the variable CHANGELOG_CMD as the command to generate
319321ecb1efSmrg# ChangeLog from git.
319421ecb1efSmrg#
319521ecb1efSmrg#
319621ecb1efSmrgAC_DEFUN([XORG_CHANGELOG], [
3197604a4f4cSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3198604a4f4cSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3199604a4f4cSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
320021ecb1efSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
320121ecb1efSmrgAC_SUBST([CHANGELOG_CMD])
320221ecb1efSmrg]) # XORG_CHANGELOG
32031e00de39Smrg
3204