aclocal.m4 revision fe567363
1af928962Smrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
273143b9aSmrg
373143b9aSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4b53e5eeaSmrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
573143b9aSmrg# This file is free software; the Free Software Foundation
673143b9aSmrg# gives unlimited permission to copy and/or distribute it,
773143b9aSmrg# with or without modifications, as long as this notice is preserved.
873143b9aSmrg
973143b9aSmrg# This program is distributed in the hope that it will be useful,
1073143b9aSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1173143b9aSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1273143b9aSmrg# PARTICULAR PURPOSE.
1373143b9aSmrg
14b53e5eeaSmrgm4_ifndef([AC_AUTOCONF_VERSION],
15b53e5eeaSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16af928962Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
17af928962Smrg[m4_warning([this file was generated for autoconf 2.68.
18b53e5eeaSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19b53e5eeaSmrgIf you have problems, you may need to regenerate the build system entirely.
20b53e5eeaSmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
2173143b9aSmrg
22b53e5eeaSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
2373143b9aSmrg#
2473143b9aSmrg# This file is free software; the Free Software Foundation
2573143b9aSmrg# gives unlimited permission to copy and/or distribute it,
2673143b9aSmrg# with or without modifications, as long as this notice is preserved.
2773143b9aSmrg
2873143b9aSmrg# AM_AUTOMAKE_VERSION(VERSION)
2973143b9aSmrg# ----------------------------
3073143b9aSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3173143b9aSmrg# generated from the m4 files accompanying Automake X.Y.
3273143b9aSmrg# (This private macro should not be called outside this file.)
3373143b9aSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
34b53e5eeaSmrg[am__api_version='1.11'
3573143b9aSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3673143b9aSmrgdnl require some minimum version.  Point them to the right macro.
37af928962Smrgm4_if([$1], [1.11.1], [],
3873143b9aSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
3973143b9aSmrg])
4073143b9aSmrg
4173143b9aSmrg# _AM_AUTOCONF_VERSION(VERSION)
4273143b9aSmrg# -----------------------------
4373143b9aSmrg# aclocal traces this macro to find the Autoconf version.
4473143b9aSmrg# This is a private macro too.  Using m4_define simplifies
4573143b9aSmrg# the logic in aclocal, which can simply ignore this definition.
4673143b9aSmrgm4_define([_AM_AUTOCONF_VERSION], [])
4773143b9aSmrg
4873143b9aSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
4973143b9aSmrg# -------------------------------
5073143b9aSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
51b53e5eeaSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5273143b9aSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
53af928962Smrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
54b53e5eeaSmrgm4_ifndef([AC_AUTOCONF_VERSION],
55b53e5eeaSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
56b53e5eeaSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5773143b9aSmrg
5873143b9aSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
5973143b9aSmrg
6073143b9aSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
6173143b9aSmrg#
6273143b9aSmrg# This file is free software; the Free Software Foundation
6373143b9aSmrg# gives unlimited permission to copy and/or distribute it,
6473143b9aSmrg# with or without modifications, as long as this notice is preserved.
6573143b9aSmrg
6673143b9aSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6773143b9aSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
6873143b9aSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
6973143b9aSmrg#
7073143b9aSmrg# Of course, Automake must honor this variable whenever it calls a
7173143b9aSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7273143b9aSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7373143b9aSmrg# depending on how configure is run.  This is pretty annoying, since
7473143b9aSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7573143b9aSmrg# source directory, any form will work fine, but in subdirectories a
7673143b9aSmrg# relative path needs to be adjusted first.
7773143b9aSmrg#
7873143b9aSmrg# $ac_aux_dir/missing
7973143b9aSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8073143b9aSmrg# $top_srcdir/$ac_aux_dir/missing
8173143b9aSmrg#    fails if $ac_aux_dir is absolute,
8273143b9aSmrg#    fails when called from a subdirectory in a VPATH build with
8373143b9aSmrg#          a relative $ac_aux_dir
8473143b9aSmrg#
8573143b9aSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8673143b9aSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
8773143b9aSmrg# harmless because $srcdir is `.', but things will broke when you
8873143b9aSmrg# start a VPATH build or use an absolute $srcdir.
8973143b9aSmrg#
9073143b9aSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9173143b9aSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9273143b9aSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9373143b9aSmrg# and then we would define $MISSING as
9473143b9aSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9573143b9aSmrg# This will work as long as MISSING is not called from configure, because
9673143b9aSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9773143b9aSmrg# However there are other variables, like CC, which are often used in
9873143b9aSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
9973143b9aSmrg#
10073143b9aSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10173143b9aSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10273143b9aSmrg# configured tree to be moved without reconfiguration.
10373143b9aSmrg
10473143b9aSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10573143b9aSmrg[dnl Rely on autoconf to set up CDPATH properly.
10673143b9aSmrgAC_PREREQ([2.50])dnl
10773143b9aSmrg# expand $ac_aux_dir to an absolute path
10873143b9aSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
10973143b9aSmrg])
11073143b9aSmrg
11173143b9aSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11273143b9aSmrg
113b53e5eeaSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
11473143b9aSmrg# Free Software Foundation, Inc.
11573143b9aSmrg#
11673143b9aSmrg# This file is free software; the Free Software Foundation
11773143b9aSmrg# gives unlimited permission to copy and/or distribute it,
11873143b9aSmrg# with or without modifications, as long as this notice is preserved.
11973143b9aSmrg
120b53e5eeaSmrg# serial 9
12173143b9aSmrg
12273143b9aSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12373143b9aSmrg# -------------------------------------
12473143b9aSmrg# Define a conditional.
12573143b9aSmrgAC_DEFUN([AM_CONDITIONAL],
12673143b9aSmrg[AC_PREREQ(2.52)dnl
12773143b9aSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12873143b9aSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12973143b9aSmrgAC_SUBST([$1_TRUE])dnl
13073143b9aSmrgAC_SUBST([$1_FALSE])dnl
13173143b9aSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
13273143b9aSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
133b53e5eeaSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13473143b9aSmrgif $2; then
13573143b9aSmrg  $1_TRUE=
13673143b9aSmrg  $1_FALSE='#'
13773143b9aSmrgelse
13873143b9aSmrg  $1_TRUE='#'
13973143b9aSmrg  $1_FALSE=
14073143b9aSmrgfi
14173143b9aSmrgAC_CONFIG_COMMANDS_PRE(
14273143b9aSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14373143b9aSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14473143b9aSmrgUsually this means the macro was only invoked conditionally.]])
14573143b9aSmrgfi])])
14673143b9aSmrg
147b53e5eeaSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
14873143b9aSmrg# Free Software Foundation, Inc.
14973143b9aSmrg#
15073143b9aSmrg# This file is free software; the Free Software Foundation
15173143b9aSmrg# gives unlimited permission to copy and/or distribute it,
15273143b9aSmrg# with or without modifications, as long as this notice is preserved.
15373143b9aSmrg
154b53e5eeaSmrg# serial 10
15573143b9aSmrg
15673143b9aSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
15773143b9aSmrg# written in clear, in which case automake, when reading aclocal.m4,
15873143b9aSmrg# will think it sees a *use*, and therefore will trigger all it's
15973143b9aSmrg# C support machinery.  Also note that it means that autoscan, seeing
16073143b9aSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
16173143b9aSmrg
16273143b9aSmrg
16373143b9aSmrg# _AM_DEPENDENCIES(NAME)
16473143b9aSmrg# ----------------------
16573143b9aSmrg# See how the compiler implements dependency checking.
16673143b9aSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
16773143b9aSmrg# We try a few techniques and use that to set a single cache variable.
16873143b9aSmrg#
16973143b9aSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
17073143b9aSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
17173143b9aSmrg# dependency, and given that the user is not expected to run this macro,
17273143b9aSmrg# just rely on AC_PROG_CC.
17373143b9aSmrgAC_DEFUN([_AM_DEPENDENCIES],
17473143b9aSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17573143b9aSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17673143b9aSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17773143b9aSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17873143b9aSmrg
17973143b9aSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
18073143b9aSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
18173143b9aSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
18273143b9aSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
18373143b9aSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18473143b9aSmrg                   [depcc="$$1"   am_compiler_list=])
18573143b9aSmrg
18673143b9aSmrgAC_CACHE_CHECK([dependency style of $depcc],
18773143b9aSmrg               [am_cv_$1_dependencies_compiler_type],
18873143b9aSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18973143b9aSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
19073143b9aSmrg  # making bogus files that we don't know about and never remove.  For
19173143b9aSmrg  # instance it was reported that on HP-UX the gcc test will end up
19273143b9aSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
19373143b9aSmrg  # in D'.
19473143b9aSmrg  mkdir conftest.dir
19573143b9aSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19673143b9aSmrg  # using a relative directory.
19773143b9aSmrg  cp "$am_depcomp" conftest.dir
19873143b9aSmrg  cd conftest.dir
19973143b9aSmrg  # We will build objects and dependencies in a subdirectory because
20073143b9aSmrg  # it helps to detect inapplicable dependency modes.  For instance
20173143b9aSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
20273143b9aSmrg  # side effect of compilation, but ICC will put the dependencies in
20373143b9aSmrg  # the current directory while Tru64 will put them in the object
20473143b9aSmrg  # directory.
20573143b9aSmrg  mkdir sub
20673143b9aSmrg
20773143b9aSmrg  am_cv_$1_dependencies_compiler_type=none
20873143b9aSmrg  if test "$am_compiler_list" = ""; then
20973143b9aSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
21073143b9aSmrg  fi
211b53e5eeaSmrg  am__universal=false
212b53e5eeaSmrg  m4_case([$1], [CC],
213b53e5eeaSmrg    [case " $depcc " in #(
214b53e5eeaSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
215b53e5eeaSmrg     esac],
216b53e5eeaSmrg    [CXX],
217b53e5eeaSmrg    [case " $depcc " in #(
218b53e5eeaSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
219b53e5eeaSmrg     esac])
220b53e5eeaSmrg
22173143b9aSmrg  for depmode in $am_compiler_list; do
22273143b9aSmrg    # Setup a source with many dependencies, because some compilers
22373143b9aSmrg    # like to wrap large dependency lists on column 80 (with \), and
22473143b9aSmrg    # we should not choose a depcomp mode which is confused by this.
22573143b9aSmrg    #
22673143b9aSmrg    # We need to recreate these files for each test, as the compiler may
22773143b9aSmrg    # overwrite some of them when testing with obscure command lines.
22873143b9aSmrg    # This happens at least with the AIX C compiler.
22973143b9aSmrg    : > sub/conftest.c
23073143b9aSmrg    for i in 1 2 3 4 5 6; do
23173143b9aSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
23273143b9aSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
23373143b9aSmrg      # Solaris 8's {/usr,}/bin/sh.
23473143b9aSmrg      touch sub/conftst$i.h
23573143b9aSmrg    done
23673143b9aSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23773143b9aSmrg
238b53e5eeaSmrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
239b53e5eeaSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
240b53e5eeaSmrg    # handle `-M -o', and we need to detect this.  Also, some Intel
241b53e5eeaSmrg    # versions had trouble with output in subdirs
242b53e5eeaSmrg    am__obj=sub/conftest.${OBJEXT-o}
243b53e5eeaSmrg    am__minus_obj="-o $am__obj"
24473143b9aSmrg    case $depmode in
245b53e5eeaSmrg    gcc)
246b53e5eeaSmrg      # This depmode causes a compiler race in universal mode.
247b53e5eeaSmrg      test "$am__universal" = false || continue
248b53e5eeaSmrg      ;;
24973143b9aSmrg    nosideeffect)
25073143b9aSmrg      # after this tag, mechanisms are not by side-effect, so they'll
25173143b9aSmrg      # only be used when explicitly requested
25273143b9aSmrg      if test "x$enable_dependency_tracking" = xyes; then
25373143b9aSmrg	continue
25473143b9aSmrg      else
25573143b9aSmrg	break
25673143b9aSmrg      fi
25773143b9aSmrg      ;;
258b53e5eeaSmrg    msvisualcpp | msvcmsys)
259b53e5eeaSmrg      # This compiler won't grok `-c -o', but also, the minuso test has
260b53e5eeaSmrg      # not run yet.  These depmodes are late enough in the game, and
261b53e5eeaSmrg      # so weak that their functioning should not be impacted.
262b53e5eeaSmrg      am__obj=conftest.${OBJEXT-o}
263b53e5eeaSmrg      am__minus_obj=
264b53e5eeaSmrg      ;;
26573143b9aSmrg    none) break ;;
26673143b9aSmrg    esac
26773143b9aSmrg    if depmode=$depmode \
268b53e5eeaSmrg       source=sub/conftest.c object=$am__obj \
26973143b9aSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
270b53e5eeaSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
27173143b9aSmrg         >/dev/null 2>conftest.err &&
27273143b9aSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27373143b9aSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
274b53e5eeaSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27573143b9aSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27673143b9aSmrg      # icc doesn't choke on unknown options, it will just issue warnings
27773143b9aSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
27873143b9aSmrg      # that says an option was ignored or not supported.
27973143b9aSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
28073143b9aSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
28173143b9aSmrg      # The diagnosis changed in icc 8.0:
28273143b9aSmrg      #   icc: Command line remark: option '-MP' not supported
28373143b9aSmrg      if (grep 'ignoring option' conftest.err ||
28473143b9aSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28573143b9aSmrg        am_cv_$1_dependencies_compiler_type=$depmode
28673143b9aSmrg        break
28773143b9aSmrg      fi
28873143b9aSmrg    fi
28973143b9aSmrg  done
29073143b9aSmrg
29173143b9aSmrg  cd ..
29273143b9aSmrg  rm -rf conftest.dir
29373143b9aSmrgelse
29473143b9aSmrg  am_cv_$1_dependencies_compiler_type=none
29573143b9aSmrgfi
29673143b9aSmrg])
29773143b9aSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29873143b9aSmrgAM_CONDITIONAL([am__fastdep$1], [
29973143b9aSmrg  test "x$enable_dependency_tracking" != xno \
30073143b9aSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
30173143b9aSmrg])
30273143b9aSmrg
30373143b9aSmrg
30473143b9aSmrg# AM_SET_DEPDIR
30573143b9aSmrg# -------------
30673143b9aSmrg# Choose a directory name for dependency files.
30773143b9aSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
30873143b9aSmrgAC_DEFUN([AM_SET_DEPDIR],
30973143b9aSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
31073143b9aSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
31173143b9aSmrg])
31273143b9aSmrg
31373143b9aSmrg
31473143b9aSmrg# AM_DEP_TRACK
31573143b9aSmrg# ------------
31673143b9aSmrgAC_DEFUN([AM_DEP_TRACK],
31773143b9aSmrg[AC_ARG_ENABLE(dependency-tracking,
31873143b9aSmrg[  --disable-dependency-tracking  speeds up one-time build
31973143b9aSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
32073143b9aSmrgif test "x$enable_dependency_tracking" != xno; then
32173143b9aSmrg  am_depcomp="$ac_aux_dir/depcomp"
32273143b9aSmrg  AMDEPBACKSLASH='\'
32373143b9aSmrgfi
32473143b9aSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32573143b9aSmrgAC_SUBST([AMDEPBACKSLASH])dnl
32673143b9aSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32773143b9aSmrg])
32873143b9aSmrg
32973143b9aSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33073143b9aSmrg
331b53e5eeaSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
33273143b9aSmrg# Free Software Foundation, Inc.
33373143b9aSmrg#
33473143b9aSmrg# This file is free software; the Free Software Foundation
33573143b9aSmrg# gives unlimited permission to copy and/or distribute it,
33673143b9aSmrg# with or without modifications, as long as this notice is preserved.
33773143b9aSmrg
338b53e5eeaSmrg#serial 5
33973143b9aSmrg
34073143b9aSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34173143b9aSmrg# ------------------------------
34273143b9aSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
343b53e5eeaSmrg[{
344b53e5eeaSmrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
345b53e5eeaSmrg  # are listed without --file.  Let's play safe and only enable the eval
346b53e5eeaSmrg  # if we detect the quoting.
347b53e5eeaSmrg  case $CONFIG_FILES in
348b53e5eeaSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
349b53e5eeaSmrg  *)   set x $CONFIG_FILES ;;
350b53e5eeaSmrg  esac
351b53e5eeaSmrg  shift
352b53e5eeaSmrg  for mf
353b53e5eeaSmrg  do
354b53e5eeaSmrg    # Strip MF so we end up with the name of the file.
355b53e5eeaSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
356b53e5eeaSmrg    # Check whether this is an Automake generated Makefile or not.
357b53e5eeaSmrg    # We used to match only the files named `Makefile.in', but
358b53e5eeaSmrg    # some people rename them; so instead we look at the file content.
359b53e5eeaSmrg    # Grep'ing the first line is not enough: some people post-process
360b53e5eeaSmrg    # each Makefile.in and add a new line on top of each file to say so.
361b53e5eeaSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
362b53e5eeaSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
363b53e5eeaSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
364b53e5eeaSmrg      dirpart=`AS_DIRNAME("$mf")`
365b53e5eeaSmrg    else
366b53e5eeaSmrg      continue
367b53e5eeaSmrg    fi
368b53e5eeaSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
369b53e5eeaSmrg    # from the Makefile without running `make'.
370b53e5eeaSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
371b53e5eeaSmrg    test -z "$DEPDIR" && continue
372b53e5eeaSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
373b53e5eeaSmrg    test -z "am__include" && continue
374b53e5eeaSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
375b53e5eeaSmrg    # When using ansi2knr, U may be empty or an underscore; expand it
376b53e5eeaSmrg    U=`sed -n 's/^U = //p' < "$mf"`
377b53e5eeaSmrg    # Find all dependency output files, they are included files with
378b53e5eeaSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379b53e5eeaSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380b53e5eeaSmrg    # expansion.
381b53e5eeaSmrg    for file in `sed -n "
382b53e5eeaSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383b53e5eeaSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
384b53e5eeaSmrg      # Make sure the directory exists.
385b53e5eeaSmrg      test -f "$dirpart/$file" && continue
386b53e5eeaSmrg      fdir=`AS_DIRNAME(["$file"])`
387b53e5eeaSmrg      AS_MKDIR_P([$dirpart/$fdir])
388b53e5eeaSmrg      # echo "creating $dirpart/$file"
389b53e5eeaSmrg      echo '# dummy' > "$dirpart/$file"
390b53e5eeaSmrg    done
39173143b9aSmrg  done
392b53e5eeaSmrg}
39373143b9aSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
39473143b9aSmrg
39573143b9aSmrg
39673143b9aSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39773143b9aSmrg# -----------------------------
39873143b9aSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
39973143b9aSmrg#
40073143b9aSmrg# This code is only required when automatic dependency tracking
40173143b9aSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
40273143b9aSmrg# need in order to bootstrap the dependency handling code.
40373143b9aSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
40473143b9aSmrg[AC_CONFIG_COMMANDS([depfiles],
40573143b9aSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
40673143b9aSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
40773143b9aSmrg])
40873143b9aSmrg
40973143b9aSmrg# Do all the work for Automake.                             -*- Autoconf -*-
41073143b9aSmrg
41173143b9aSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
412b53e5eeaSmrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
41373143b9aSmrg#
41473143b9aSmrg# This file is free software; the Free Software Foundation
41573143b9aSmrg# gives unlimited permission to copy and/or distribute it,
41673143b9aSmrg# with or without modifications, as long as this notice is preserved.
41773143b9aSmrg
418b53e5eeaSmrg# serial 16
41973143b9aSmrg
42073143b9aSmrg# This macro actually does too much.  Some checks are only needed if
42173143b9aSmrg# your package does certain things.  But this isn't really a big deal.
42273143b9aSmrg
42373143b9aSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
42473143b9aSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42573143b9aSmrg# -----------------------------------------------
42673143b9aSmrg# The call with PACKAGE and VERSION arguments is the old style
42773143b9aSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42873143b9aSmrg# and VERSION should now be passed to AC_INIT and removed from
42973143b9aSmrg# the call to AM_INIT_AUTOMAKE.
43073143b9aSmrg# We support both call styles for the transition.  After
43173143b9aSmrg# the next Automake release, Autoconf can make the AC_INIT
43273143b9aSmrg# arguments mandatory, and then we can depend on a new Autoconf
43373143b9aSmrg# release and drop the old call support.
43473143b9aSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
435b53e5eeaSmrg[AC_PREREQ([2.62])dnl
43673143b9aSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43773143b9aSmrgdnl the ones we care about.
43873143b9aSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43973143b9aSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
44073143b9aSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44173143b9aSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44273143b9aSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44373143b9aSmrg  # is not polluted with repeated "-I."
44473143b9aSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44573143b9aSmrg  # test to see if srcdir already configured
44673143b9aSmrg  if test -f $srcdir/config.status; then
44773143b9aSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44873143b9aSmrg  fi
44973143b9aSmrgfi
45073143b9aSmrg
45173143b9aSmrg# test whether we have cygpath
45273143b9aSmrgif test -z "$CYGPATH_W"; then
45373143b9aSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45473143b9aSmrg    CYGPATH_W='cygpath -w'
45573143b9aSmrg  else
45673143b9aSmrg    CYGPATH_W=echo
45773143b9aSmrg  fi
45873143b9aSmrgfi
45973143b9aSmrgAC_SUBST([CYGPATH_W])
46073143b9aSmrg
46173143b9aSmrg# Define the identity of the package.
46273143b9aSmrgdnl Distinguish between old-style and new-style calls.
46373143b9aSmrgm4_ifval([$2],
46473143b9aSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46573143b9aSmrg AC_SUBST([PACKAGE], [$1])dnl
46673143b9aSmrg AC_SUBST([VERSION], [$2])],
46773143b9aSmrg[_AM_SET_OPTIONS([$1])dnl
46873143b9aSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
46973143b9aSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
47073143b9aSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47173143b9aSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47273143b9aSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47373143b9aSmrg
47473143b9aSmrg_AM_IF_OPTION([no-define],,
47573143b9aSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
47673143b9aSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
47773143b9aSmrg
47873143b9aSmrg# Some tools Automake needs.
47973143b9aSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48073143b9aSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48173143b9aSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
48273143b9aSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
48373143b9aSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
48473143b9aSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
48573143b9aSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
486b53e5eeaSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
487b53e5eeaSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
48873143b9aSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
48973143b9aSmrg# We need awk for the "check" target.  The system "awk" is bad on
49073143b9aSmrg# some platforms.
49173143b9aSmrgAC_REQUIRE([AC_PROG_AWK])dnl
49273143b9aSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
49373143b9aSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
49473143b9aSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
495b53e5eeaSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
496b53e5eeaSmrg			     [_AM_PROG_TAR([v7])])])
49773143b9aSmrg_AM_IF_OPTION([no-dependencies],,
49873143b9aSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
499b53e5eeaSmrg		  [_AM_DEPENDENCIES(CC)],
500b53e5eeaSmrg		  [define([AC_PROG_CC],
501b53e5eeaSmrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
50273143b9aSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
503b53e5eeaSmrg		  [_AM_DEPENDENCIES(CXX)],
504b53e5eeaSmrg		  [define([AC_PROG_CXX],
505b53e5eeaSmrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
50673143b9aSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
507b53e5eeaSmrg		  [_AM_DEPENDENCIES(OBJC)],
508b53e5eeaSmrg		  [define([AC_PROG_OBJC],
509b53e5eeaSmrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
51073143b9aSmrg])
511b53e5eeaSmrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
512b53e5eeaSmrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
513b53e5eeaSmrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
514b53e5eeaSmrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
515b53e5eeaSmrgAC_CONFIG_COMMANDS_PRE(dnl
516b53e5eeaSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
517b53e5eeaSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
51873143b9aSmrg])
51973143b9aSmrg
520b53e5eeaSmrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
521b53e5eeaSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
522b53e5eeaSmrgdnl mangled by Autoconf and run in a shell conditional statement.
523b53e5eeaSmrgm4_define([_AC_COMPILER_EXEEXT],
524b53e5eeaSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
525b53e5eeaSmrg
52673143b9aSmrg
52773143b9aSmrg# When config.status generates a header, we must update the stamp-h file.
52873143b9aSmrg# This file resides in the same directory as the config header
52973143b9aSmrg# that is generated.  The stamp files are numbered to have different names.
53073143b9aSmrg
53173143b9aSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
53273143b9aSmrg# loop where config.status creates the headers, so we can generate
53373143b9aSmrg# our stamp files there.
53473143b9aSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
53573143b9aSmrg[# Compute $1's index in $config_headers.
536b53e5eeaSmrg_am_arg=$1
53773143b9aSmrg_am_stamp_count=1
53873143b9aSmrgfor _am_header in $config_headers :; do
53973143b9aSmrg  case $_am_header in
540b53e5eeaSmrg    $_am_arg | $_am_arg:* )
54173143b9aSmrg      break ;;
54273143b9aSmrg    * )
54373143b9aSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
54473143b9aSmrg  esac
54573143b9aSmrgdone
546b53e5eeaSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
54773143b9aSmrg
548b53e5eeaSmrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
54973143b9aSmrg#
55073143b9aSmrg# This file is free software; the Free Software Foundation
55173143b9aSmrg# gives unlimited permission to copy and/or distribute it,
55273143b9aSmrg# with or without modifications, as long as this notice is preserved.
55373143b9aSmrg
55473143b9aSmrg# AM_PROG_INSTALL_SH
55573143b9aSmrg# ------------------
55673143b9aSmrg# Define $install_sh.
55773143b9aSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
55873143b9aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
559b53e5eeaSmrgif test x"${install_sh}" != xset; then
560b53e5eeaSmrg  case $am_aux_dir in
561b53e5eeaSmrg  *\ * | *\	*)
562b53e5eeaSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
563b53e5eeaSmrg  *)
564b53e5eeaSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
565b53e5eeaSmrg  esac
566b53e5eeaSmrgfi
56773143b9aSmrgAC_SUBST(install_sh)])
56873143b9aSmrg
56973143b9aSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
57073143b9aSmrg#
57173143b9aSmrg# This file is free software; the Free Software Foundation
57273143b9aSmrg# gives unlimited permission to copy and/or distribute it,
57373143b9aSmrg# with or without modifications, as long as this notice is preserved.
57473143b9aSmrg
57573143b9aSmrg# serial 2
57673143b9aSmrg
57773143b9aSmrg# Check whether the underlying file-system supports filenames
57873143b9aSmrg# with a leading dot.  For instance MS-DOS doesn't.
57973143b9aSmrgAC_DEFUN([AM_SET_LEADING_DOT],
58073143b9aSmrg[rm -rf .tst 2>/dev/null
58173143b9aSmrgmkdir .tst 2>/dev/null
58273143b9aSmrgif test -d .tst; then
58373143b9aSmrg  am__leading_dot=.
58473143b9aSmrgelse
58573143b9aSmrg  am__leading_dot=_
58673143b9aSmrgfi
58773143b9aSmrgrmdir .tst 2>/dev/null
58873143b9aSmrgAC_SUBST([am__leading_dot])])
58973143b9aSmrg
59073143b9aSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
59173143b9aSmrg# From Jim Meyering
59273143b9aSmrg
593b53e5eeaSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
59473143b9aSmrg# Free Software Foundation, Inc.
59573143b9aSmrg#
59673143b9aSmrg# This file is free software; the Free Software Foundation
59773143b9aSmrg# gives unlimited permission to copy and/or distribute it,
59873143b9aSmrg# with or without modifications, as long as this notice is preserved.
59973143b9aSmrg
600b53e5eeaSmrg# serial 5
60173143b9aSmrg
602b53e5eeaSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
603b53e5eeaSmrg# ----------------------------------
604b53e5eeaSmrg# Control maintainer-specific portions of Makefiles.
605b53e5eeaSmrg# Default is to disable them, unless `enable' is passed literally.
606b53e5eeaSmrg# For symmetry, `disable' may be passed as well.  Anyway, the user
607b53e5eeaSmrg# can override the default with the --enable/--disable switch.
60873143b9aSmrgAC_DEFUN([AM_MAINTAINER_MODE],
609b53e5eeaSmrg[m4_case(m4_default([$1], [disable]),
610b53e5eeaSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
611b53e5eeaSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
612b53e5eeaSmrg       [m4_define([am_maintainer_other], [enable])
613b53e5eeaSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
614b53e5eeaSmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
615b53e5eeaSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
616b53e5eeaSmrg  AC_ARG_ENABLE([maintainer-mode],
617b53e5eeaSmrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
61873143b9aSmrg			  (and sometimes confusing) to the casual installer],
619b53e5eeaSmrg      [USE_MAINTAINER_MODE=$enableval],
620b53e5eeaSmrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
62173143b9aSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
622b53e5eeaSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
62373143b9aSmrg  MAINT=$MAINTAINER_MODE_TRUE
624b53e5eeaSmrg  AC_SUBST([MAINT])dnl
62573143b9aSmrg]
62673143b9aSmrg)
62773143b9aSmrg
62873143b9aSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
62973143b9aSmrg
63073143b9aSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
63173143b9aSmrg
632b53e5eeaSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
63373143b9aSmrg#
63473143b9aSmrg# This file is free software; the Free Software Foundation
63573143b9aSmrg# gives unlimited permission to copy and/or distribute it,
63673143b9aSmrg# with or without modifications, as long as this notice is preserved.
63773143b9aSmrg
638b53e5eeaSmrg# serial 4
63973143b9aSmrg
64073143b9aSmrg# AM_MAKE_INCLUDE()
64173143b9aSmrg# -----------------
64273143b9aSmrg# Check to see how make treats includes.
64373143b9aSmrgAC_DEFUN([AM_MAKE_INCLUDE],
64473143b9aSmrg[am_make=${MAKE-make}
64573143b9aSmrgcat > confinc << 'END'
64673143b9aSmrgam__doit:
647b53e5eeaSmrg	@echo this is the am__doit target
64873143b9aSmrg.PHONY: am__doit
64973143b9aSmrgEND
65073143b9aSmrg# If we don't find an include directive, just comment out the code.
65173143b9aSmrgAC_MSG_CHECKING([for style of include used by $am_make])
65273143b9aSmrgam__include="#"
65373143b9aSmrgam__quote=
65473143b9aSmrg_am_result=none
65573143b9aSmrg# First try GNU make style include.
65673143b9aSmrgecho "include confinc" > confmf
657b53e5eeaSmrg# Ignore all kinds of additional output from `make'.
658b53e5eeaSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
659b53e5eeaSmrg*the\ am__doit\ target*)
660b53e5eeaSmrg  am__include=include
661b53e5eeaSmrg  am__quote=
662b53e5eeaSmrg  _am_result=GNU
663b53e5eeaSmrg  ;;
664b53e5eeaSmrgesac
66573143b9aSmrg# Now try BSD make style include.
66673143b9aSmrgif test "$am__include" = "#"; then
66773143b9aSmrg   echo '.include "confinc"' > confmf
668b53e5eeaSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
669b53e5eeaSmrg   *the\ am__doit\ target*)
670b53e5eeaSmrg     am__include=.include
671b53e5eeaSmrg     am__quote="\""
672b53e5eeaSmrg     _am_result=BSD
673b53e5eeaSmrg     ;;
674b53e5eeaSmrg   esac
67573143b9aSmrgfi
67673143b9aSmrgAC_SUBST([am__include])
67773143b9aSmrgAC_SUBST([am__quote])
67873143b9aSmrgAC_MSG_RESULT([$_am_result])
67973143b9aSmrgrm -f confinc confmf
68073143b9aSmrg])
68173143b9aSmrg
68273143b9aSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
68373143b9aSmrg
684b53e5eeaSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
68573143b9aSmrg# Free Software Foundation, Inc.
68673143b9aSmrg#
68773143b9aSmrg# This file is free software; the Free Software Foundation
68873143b9aSmrg# gives unlimited permission to copy and/or distribute it,
68973143b9aSmrg# with or without modifications, as long as this notice is preserved.
69073143b9aSmrg
691b53e5eeaSmrg# serial 6
69273143b9aSmrg
69373143b9aSmrg# AM_MISSING_PROG(NAME, PROGRAM)
69473143b9aSmrg# ------------------------------
69573143b9aSmrgAC_DEFUN([AM_MISSING_PROG],
69673143b9aSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
69773143b9aSmrg$1=${$1-"${am_missing_run}$2"}
69873143b9aSmrgAC_SUBST($1)])
69973143b9aSmrg
70073143b9aSmrg
70173143b9aSmrg# AM_MISSING_HAS_RUN
70273143b9aSmrg# ------------------
70373143b9aSmrg# Define MISSING if not defined so far and test if it supports --run.
70473143b9aSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
70573143b9aSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
70673143b9aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
70773143b9aSmrgAC_REQUIRE_AUX_FILE([missing])dnl
708b53e5eeaSmrgif test x"${MISSING+set}" != xset; then
709b53e5eeaSmrg  case $am_aux_dir in
710b53e5eeaSmrg  *\ * | *\	*)
711b53e5eeaSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
712b53e5eeaSmrg  *)
713b53e5eeaSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
714b53e5eeaSmrg  esac
715b53e5eeaSmrgfi
71673143b9aSmrg# Use eval to expand $SHELL
71773143b9aSmrgif eval "$MISSING --run true"; then
71873143b9aSmrg  am_missing_run="$MISSING --run "
71973143b9aSmrgelse
72073143b9aSmrg  am_missing_run=
72173143b9aSmrg  AC_MSG_WARN([`missing' script is too old or missing])
72273143b9aSmrgfi
72373143b9aSmrg])
72473143b9aSmrg
72573143b9aSmrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
72673143b9aSmrg#
72773143b9aSmrg# This file is free software; the Free Software Foundation
72873143b9aSmrg# gives unlimited permission to copy and/or distribute it,
72973143b9aSmrg# with or without modifications, as long as this notice is preserved.
73073143b9aSmrg
73173143b9aSmrg# AM_PROG_MKDIR_P
73273143b9aSmrg# ---------------
73373143b9aSmrg# Check for `mkdir -p'.
73473143b9aSmrgAC_DEFUN([AM_PROG_MKDIR_P],
73573143b9aSmrg[AC_PREREQ([2.60])dnl
73673143b9aSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
73773143b9aSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
73873143b9aSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
73973143b9aSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
74073143b9aSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
74173143b9aSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
74273143b9aSmrgdnl adjustment using top_builddir (which is defined more often than
74373143b9aSmrgdnl MKDIR_P).
74473143b9aSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
74573143b9aSmrgcase $mkdir_p in
74673143b9aSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
74773143b9aSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
74873143b9aSmrgesac
74973143b9aSmrg])
75073143b9aSmrg
75173143b9aSmrg# Helper functions for option handling.                     -*- Autoconf -*-
75273143b9aSmrg
753b53e5eeaSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
75473143b9aSmrg#
75573143b9aSmrg# This file is free software; the Free Software Foundation
75673143b9aSmrg# gives unlimited permission to copy and/or distribute it,
75773143b9aSmrg# with or without modifications, as long as this notice is preserved.
75873143b9aSmrg
759b53e5eeaSmrg# serial 4
76073143b9aSmrg
76173143b9aSmrg# _AM_MANGLE_OPTION(NAME)
76273143b9aSmrg# -----------------------
76373143b9aSmrgAC_DEFUN([_AM_MANGLE_OPTION],
76473143b9aSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
76573143b9aSmrg
76673143b9aSmrg# _AM_SET_OPTION(NAME)
76773143b9aSmrg# ------------------------------
76873143b9aSmrg# Set option NAME.  Presently that only means defining a flag for this option.
76973143b9aSmrgAC_DEFUN([_AM_SET_OPTION],
77073143b9aSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
77173143b9aSmrg
77273143b9aSmrg# _AM_SET_OPTIONS(OPTIONS)
77373143b9aSmrg# ----------------------------------
77473143b9aSmrg# OPTIONS is a space-separated list of Automake options.
77573143b9aSmrgAC_DEFUN([_AM_SET_OPTIONS],
776b53e5eeaSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
77773143b9aSmrg
77873143b9aSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
77973143b9aSmrg# -------------------------------------------
78073143b9aSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
78173143b9aSmrgAC_DEFUN([_AM_IF_OPTION],
78273143b9aSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
78373143b9aSmrg
78473143b9aSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
78573143b9aSmrg
786b53e5eeaSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
78773143b9aSmrg# Free Software Foundation, Inc.
78873143b9aSmrg#
78973143b9aSmrg# This file is free software; the Free Software Foundation
79073143b9aSmrg# gives unlimited permission to copy and/or distribute it,
79173143b9aSmrg# with or without modifications, as long as this notice is preserved.
79273143b9aSmrg
793b53e5eeaSmrg# serial 5
79473143b9aSmrg
79573143b9aSmrg# AM_SANITY_CHECK
79673143b9aSmrg# ---------------
79773143b9aSmrgAC_DEFUN([AM_SANITY_CHECK],
79873143b9aSmrg[AC_MSG_CHECKING([whether build environment is sane])
79973143b9aSmrg# Just in case
80073143b9aSmrgsleep 1
80173143b9aSmrgecho timestamp > conftest.file
802b53e5eeaSmrg# Reject unsafe characters in $srcdir or the absolute working directory
803b53e5eeaSmrg# name.  Accept space and tab only in the latter.
804b53e5eeaSmrgam_lf='
805b53e5eeaSmrg'
806b53e5eeaSmrgcase `pwd` in
807b53e5eeaSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
808b53e5eeaSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
809b53e5eeaSmrgesac
810b53e5eeaSmrgcase $srcdir in
811b53e5eeaSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
812b53e5eeaSmrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
813b53e5eeaSmrgesac
814b53e5eeaSmrg
81573143b9aSmrg# Do `set' in a subshell so we don't clobber the current shell's
81673143b9aSmrg# arguments.  Must try -L first in case configure is actually a
81773143b9aSmrg# symlink; some systems play weird games with the mod time of symlinks
81873143b9aSmrg# (eg FreeBSD returns the mod time of the symlink's containing
81973143b9aSmrg# directory).
82073143b9aSmrgif (
821b53e5eeaSmrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
82273143b9aSmrg   if test "$[*]" = "X"; then
82373143b9aSmrg      # -L didn't work.
824b53e5eeaSmrg      set X `ls -t "$srcdir/configure" conftest.file`
82573143b9aSmrg   fi
82673143b9aSmrg   rm -f conftest.file
82773143b9aSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
82873143b9aSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
82973143b9aSmrg
83073143b9aSmrg      # If neither matched, then we have a broken ls.  This can happen
83173143b9aSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
83273143b9aSmrg      # broken ls alias from the environment.  This has actually
83373143b9aSmrg      # happened.  Such a system could not be considered "sane".
83473143b9aSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
83573143b9aSmrgalias in your environment])
83673143b9aSmrg   fi
83773143b9aSmrg
83873143b9aSmrg   test "$[2]" = conftest.file
83973143b9aSmrg   )
84073143b9aSmrgthen
84173143b9aSmrg   # Ok.
84273143b9aSmrg   :
84373143b9aSmrgelse
84473143b9aSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
84573143b9aSmrgCheck your system clock])
84673143b9aSmrgfi
84773143b9aSmrgAC_MSG_RESULT(yes)])
84873143b9aSmrg
849b53e5eeaSmrg# Copyright (C) 2009  Free Software Foundation, Inc.
850b53e5eeaSmrg#
851b53e5eeaSmrg# This file is free software; the Free Software Foundation
852b53e5eeaSmrg# gives unlimited permission to copy and/or distribute it,
853b53e5eeaSmrg# with or without modifications, as long as this notice is preserved.
854b53e5eeaSmrg
855b53e5eeaSmrg# serial 1
856b53e5eeaSmrg
857b53e5eeaSmrg# AM_SILENT_RULES([DEFAULT])
858b53e5eeaSmrg# --------------------------
859b53e5eeaSmrg# Enable less verbose build rules; with the default set to DEFAULT
860b53e5eeaSmrg# (`yes' being less verbose, `no' or empty being verbose).
861b53e5eeaSmrgAC_DEFUN([AM_SILENT_RULES],
862b53e5eeaSmrg[AC_ARG_ENABLE([silent-rules],
863b53e5eeaSmrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
864b53e5eeaSmrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
865b53e5eeaSmrgcase $enable_silent_rules in
866b53e5eeaSmrgyes) AM_DEFAULT_VERBOSITY=0;;
867b53e5eeaSmrgno)  AM_DEFAULT_VERBOSITY=1;;
868b53e5eeaSmrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
869b53e5eeaSmrgesac
870b53e5eeaSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
871b53e5eeaSmrgAM_BACKSLASH='\'
872b53e5eeaSmrgAC_SUBST([AM_BACKSLASH])dnl
873b53e5eeaSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
874b53e5eeaSmrg])
875b53e5eeaSmrg
87673143b9aSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
87773143b9aSmrg#
87873143b9aSmrg# This file is free software; the Free Software Foundation
87973143b9aSmrg# gives unlimited permission to copy and/or distribute it,
88073143b9aSmrg# with or without modifications, as long as this notice is preserved.
88173143b9aSmrg
88273143b9aSmrg# AM_PROG_INSTALL_STRIP
88373143b9aSmrg# ---------------------
88473143b9aSmrg# One issue with vendor `install' (even GNU) is that you can't
88573143b9aSmrg# specify the program used to strip binaries.  This is especially
88673143b9aSmrg# annoying in cross-compiling environments, where the build's strip
88773143b9aSmrg# is unlikely to handle the host's binaries.
88873143b9aSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
88973143b9aSmrg# always use install-sh in `make install-strip', and initialize
89073143b9aSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
89173143b9aSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
89273143b9aSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
89373143b9aSmrg# Installed binaries are usually stripped using `strip' when the user
89473143b9aSmrg# run `make install-strip'.  However `strip' might not be the right
89573143b9aSmrg# tool to use in cross-compilation environments, therefore Automake
89673143b9aSmrg# will honor the `STRIP' environment variable to overrule this program.
89773143b9aSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
89873143b9aSmrgif test "$cross_compiling" != no; then
89973143b9aSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
90073143b9aSmrgfi
90173143b9aSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
90273143b9aSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
90373143b9aSmrg
904b53e5eeaSmrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
90573143b9aSmrg#
90673143b9aSmrg# This file is free software; the Free Software Foundation
90773143b9aSmrg# gives unlimited permission to copy and/or distribute it,
90873143b9aSmrg# with or without modifications, as long as this notice is preserved.
90973143b9aSmrg
910b53e5eeaSmrg# serial 2
911b53e5eeaSmrg
91273143b9aSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
91373143b9aSmrg# ---------------------------
914b53e5eeaSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
91573143b9aSmrg# This macro is traced by Automake.
91673143b9aSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
91773143b9aSmrg
918b53e5eeaSmrg# AM_SUBST_NOTMAKE(VARIABLE)
919b53e5eeaSmrg# ---------------------------
920b53e5eeaSmrg# Public sister of _AM_SUBST_NOTMAKE.
921b53e5eeaSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
922b53e5eeaSmrg
92373143b9aSmrg# Check how to create a tarball.                            -*- Autoconf -*-
92473143b9aSmrg
92573143b9aSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
92673143b9aSmrg#
92773143b9aSmrg# This file is free software; the Free Software Foundation
92873143b9aSmrg# gives unlimited permission to copy and/or distribute it,
92973143b9aSmrg# with or without modifications, as long as this notice is preserved.
93073143b9aSmrg
93173143b9aSmrg# serial 2
93273143b9aSmrg
93373143b9aSmrg# _AM_PROG_TAR(FORMAT)
93473143b9aSmrg# --------------------
93573143b9aSmrg# Check how to create a tarball in format FORMAT.
93673143b9aSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
93773143b9aSmrg#
93873143b9aSmrg# Substitute a variable $(am__tar) that is a command
93973143b9aSmrg# writing to stdout a FORMAT-tarball containing the directory
94073143b9aSmrg# $tardir.
94173143b9aSmrg#     tardir=directory && $(am__tar) > result.tar
94273143b9aSmrg#
94373143b9aSmrg# Substitute a variable $(am__untar) that extract such
94473143b9aSmrg# a tarball read from stdin.
94573143b9aSmrg#     $(am__untar) < result.tar
94673143b9aSmrgAC_DEFUN([_AM_PROG_TAR],
94773143b9aSmrg[# Always define AMTAR for backward compatibility.
94873143b9aSmrgAM_MISSING_PROG([AMTAR], [tar])
94973143b9aSmrgm4_if([$1], [v7],
95073143b9aSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
95173143b9aSmrg     [m4_case([$1], [ustar],, [pax],,
95273143b9aSmrg              [m4_fatal([Unknown tar format])])
95373143b9aSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
95473143b9aSmrg# Loop over all known methods to create a tar archive until one works.
95573143b9aSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
95673143b9aSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
95773143b9aSmrg# Do not fold the above two line into one, because Tru64 sh and
95873143b9aSmrg# Solaris sh will not grok spaces in the rhs of `-'.
95973143b9aSmrgfor _am_tool in $_am_tools
96073143b9aSmrgdo
96173143b9aSmrg  case $_am_tool in
96273143b9aSmrg  gnutar)
96373143b9aSmrg    for _am_tar in tar gnutar gtar;
96473143b9aSmrg    do
96573143b9aSmrg      AM_RUN_LOG([$_am_tar --version]) && break
96673143b9aSmrg    done
96773143b9aSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
96873143b9aSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
96973143b9aSmrg    am__untar="$_am_tar -xf -"
97073143b9aSmrg    ;;
97173143b9aSmrg  plaintar)
97273143b9aSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
97373143b9aSmrg    # ustar tarball either.
97473143b9aSmrg    (tar --version) >/dev/null 2>&1 && continue
97573143b9aSmrg    am__tar='tar chf - "$$tardir"'
97673143b9aSmrg    am__tar_='tar chf - "$tardir"'
97773143b9aSmrg    am__untar='tar xf -'
97873143b9aSmrg    ;;
97973143b9aSmrg  pax)
98073143b9aSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
98173143b9aSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
98273143b9aSmrg    am__untar='pax -r'
98373143b9aSmrg    ;;
98473143b9aSmrg  cpio)
98573143b9aSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
98673143b9aSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
98773143b9aSmrg    am__untar='cpio -i -H $1 -d'
98873143b9aSmrg    ;;
98973143b9aSmrg  none)
99073143b9aSmrg    am__tar=false
99173143b9aSmrg    am__tar_=false
99273143b9aSmrg    am__untar=false
99373143b9aSmrg    ;;
99473143b9aSmrg  esac
99573143b9aSmrg
99673143b9aSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
99773143b9aSmrg  # and am__untar set.
99873143b9aSmrg  test -n "${am_cv_prog_tar_$1}" && break
99973143b9aSmrg
100073143b9aSmrg  # tar/untar a dummy directory, and stop if the command works
100173143b9aSmrg  rm -rf conftest.dir
100273143b9aSmrg  mkdir conftest.dir
100373143b9aSmrg  echo GrepMe > conftest.dir/file
100473143b9aSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
100573143b9aSmrg  rm -rf conftest.dir
100673143b9aSmrg  if test -s conftest.tar; then
100773143b9aSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
100873143b9aSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
100973143b9aSmrg  fi
101073143b9aSmrgdone
101173143b9aSmrgrm -rf conftest.dir
101273143b9aSmrg
101373143b9aSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
101473143b9aSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
101573143b9aSmrgAC_SUBST([am__tar])
101673143b9aSmrgAC_SUBST([am__untar])
101773143b9aSmrg]) # _AM_PROG_TAR
101873143b9aSmrg
1019fe567363Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1020fe567363Smrg# 
1021fe567363Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1022fe567363Smrg#
1023fe567363Smrg# This program is free software; you can redistribute it and/or modify
1024fe567363Smrg# it under the terms of the GNU General Public License as published by
1025fe567363Smrg# the Free Software Foundation; either version 2 of the License, or
1026fe567363Smrg# (at your option) any later version.
1027fe567363Smrg#
1028fe567363Smrg# This program is distributed in the hope that it will be useful, but
1029fe567363Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1030fe567363Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1031fe567363Smrg# General Public License for more details.
1032fe567363Smrg#
1033fe567363Smrg# You should have received a copy of the GNU General Public License
1034fe567363Smrg# along with this program; if not, write to the Free Software
1035fe567363Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1036fe567363Smrg#
1037fe567363Smrg# As a special exception to the GNU General Public License, if you
1038fe567363Smrg# distribute this file as part of a program that contains a
1039fe567363Smrg# configuration script generated by Autoconf, you may include it under
1040fe567363Smrg# the same distribution terms that you use for the rest of that program.
1041fe567363Smrg
1042fe567363Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1043fe567363Smrg# ----------------------------------
1044fe567363SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1045fe567363Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1046fe567363Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1047fe567363SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1048fe567363Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1049fe567363Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1050fe567363Smrgfi
1051fe567363Smrgif test -n "$PKG_CONFIG"; then
1052fe567363Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1053fe567363Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1054fe567363Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1055fe567363Smrg		AC_MSG_RESULT([yes])
1056fe567363Smrg	else
1057fe567363Smrg		AC_MSG_RESULT([no])
1058fe567363Smrg		PKG_CONFIG=""
1059fe567363Smrg	fi
1060fe567363Smrg		
1061fe567363Smrgfi[]dnl
1062fe567363Smrg])# PKG_PROG_PKG_CONFIG
1063fe567363Smrg
1064fe567363Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1065fe567363Smrg#
1066fe567363Smrg# Check to see whether a particular set of modules exists.  Similar
1067fe567363Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1068fe567363Smrg#
1069fe567363Smrg#
1070fe567363Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1071fe567363Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
1072fe567363Smrg# PKG_CHECK_EXISTS manually
1073fe567363Smrg# --------------------------------------------------------------
1074fe567363SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1075fe567363Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1076fe567363Smrgif test -n "$PKG_CONFIG" && \
1077fe567363Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1078fe567363Smrg  m4_ifval([$2], [$2], [:])
1079fe567363Smrgm4_ifvaln([$3], [else
1080fe567363Smrg  $3])dnl
1081fe567363Smrgfi])
1082fe567363Smrg
1083fe567363Smrg
1084fe567363Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1085fe567363Smrg# ---------------------------------------------
1086fe567363Smrgm4_define([_PKG_CONFIG],
1087fe567363Smrg[if test -n "$$1"; then
1088fe567363Smrg    pkg_cv_[]$1="$$1"
1089fe567363Smrg elif test -n "$PKG_CONFIG"; then
1090fe567363Smrg    PKG_CHECK_EXISTS([$3],
1091fe567363Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1092fe567363Smrg		     [pkg_failed=yes])
1093fe567363Smrg else
1094fe567363Smrg    pkg_failed=untried
1095fe567363Smrgfi[]dnl
1096fe567363Smrg])# _PKG_CONFIG
1097fe567363Smrg
1098fe567363Smrg# _PKG_SHORT_ERRORS_SUPPORTED
1099fe567363Smrg# -----------------------------
1100fe567363SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1101fe567363Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1102fe567363Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1103fe567363Smrg        _pkg_short_errors_supported=yes
1104fe567363Smrgelse
1105fe567363Smrg        _pkg_short_errors_supported=no
1106fe567363Smrgfi[]dnl
1107fe567363Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1108fe567363Smrg
1109fe567363Smrg
1110fe567363Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1111fe567363Smrg# [ACTION-IF-NOT-FOUND])
1112fe567363Smrg#
1113fe567363Smrg#
1114fe567363Smrg# Note that if there is a possibility the first call to
1115fe567363Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1116fe567363Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1117fe567363Smrg#
1118fe567363Smrg#
1119fe567363Smrg# --------------------------------------------------------------
1120fe567363SmrgAC_DEFUN([PKG_CHECK_MODULES],
1121fe567363Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1122fe567363SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1123fe567363SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1124fe567363Smrg
1125fe567363Smrgpkg_failed=no
1126fe567363SmrgAC_MSG_CHECKING([for $1])
1127fe567363Smrg
1128fe567363Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1129fe567363Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1130fe567363Smrg
1131fe567363Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1132fe567363Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1133fe567363SmrgSee the pkg-config man page for more details.])
1134fe567363Smrg
1135fe567363Smrgif test $pkg_failed = yes; then
1136fe567363Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1137fe567363Smrg        if test $_pkg_short_errors_supported = yes; then
1138fe567363Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1139fe567363Smrg        else 
1140fe567363Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1141fe567363Smrg        fi
1142fe567363Smrg	# Put the nasty error message in config.log where it belongs
1143fe567363Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1144fe567363Smrg
1145fe567363Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1146fe567363Smrg[Package requirements ($2) were not met:
1147fe567363Smrg
1148fe567363Smrg$$1_PKG_ERRORS
1149fe567363Smrg
1150fe567363SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1151fe567363Smrginstalled software in a non-standard prefix.
1152fe567363Smrg
1153fe567363Smrg_PKG_TEXT
1154fe567363Smrg])],
1155fe567363Smrg		[AC_MSG_RESULT([no])
1156fe567363Smrg                $4])
1157fe567363Smrgelif test $pkg_failed = untried; then
1158fe567363Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1159fe567363Smrg[The pkg-config script could not be found or is too old.  Make sure it
1160fe567363Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1161fe567363Smrgpath to pkg-config.
1162fe567363Smrg
1163fe567363Smrg_PKG_TEXT
1164fe567363Smrg
1165fe567363SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1166fe567363Smrg		[$4])
1167fe567363Smrgelse
1168fe567363Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1169fe567363Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1170fe567363Smrg        AC_MSG_RESULT([yes])
1171fe567363Smrg	ifelse([$3], , :, [$3])
1172fe567363Smrgfi[]dnl
1173fe567363Smrg])# PKG_CHECK_MODULES
1174fe567363Smrg
11758d4c0f7bSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
11768d4c0f7bSmrgdnl
1177af928962Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
11788d4c0f7bSmrgdnl 
11798d4c0f7bSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1180af928962Smrgdnl copy of this software and associated documentation files (the "Software"),
1181af928962Smrgdnl to deal in the Software without restriction, including without limitation
1182af928962Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1183af928962Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1184af928962Smrgdnl Software is furnished to do so, subject to the following conditions:
11858d4c0f7bSmrgdnl
1186af928962Smrgdnl The above copyright notice and this permission notice (including the next
1187af928962Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1188af928962Smrgdnl Software.
11898d4c0f7bSmrgdnl
1190af928962Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1191af928962Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1192af928962Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1193af928962Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1194af928962Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1195af928962Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1196af928962Smrgdnl DEALINGS IN THE SOFTWARE.
11978d4c0f7bSmrg
11988d4c0f7bSmrg# XORG_MACROS_VERSION(required-version)
11998d4c0f7bSmrg# -------------------------------------
12008d4c0f7bSmrg# Minimum version: 1.1.0
12018d4c0f7bSmrg#
12028d4c0f7bSmrg# If you're using a macro added in Version 1.1 or newer, include this in
12038d4c0f7bSmrg# your configure.ac with the minimum required version, such as:
12048d4c0f7bSmrg# XORG_MACROS_VERSION(1.1)
12058d4c0f7bSmrg#
1206e8a71cdfSmrg# To ensure that this macro is defined, also add:
1207e8a71cdfSmrg# m4_ifndef([XORG_MACROS_VERSION],
1208e8a71cdfSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
12098d4c0f7bSmrg#
12108d4c0f7bSmrg#
12118d4c0f7bSmrg# See the "minimum version" comment for each macro you use to see what 
12128d4c0f7bSmrg# version you require.
1213e8a71cdfSmrgm4_defun([XORG_MACROS_VERSION],[
1214fe567363Smrgm4_define([vers_have], [1.17])
1215e8a71cdfSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1216e8a71cdfSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1217e8a71cdfSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1218e8a71cdfSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1219e8a71cdfSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1220e8a71cdfSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1221e8a71cdfSmrgm4_undefine([vers_have])
1222e8a71cdfSmrgm4_undefine([maj_have])
1223e8a71cdfSmrgm4_undefine([maj_needed])
12248d4c0f7bSmrg]) # XORG_MACROS_VERSION
12258d4c0f7bSmrg
12268d4c0f7bSmrg# XORG_PROG_RAWCPP()
12278d4c0f7bSmrg# ------------------
12288d4c0f7bSmrg# Minimum version: 1.0.0
12298d4c0f7bSmrg#
12308d4c0f7bSmrg# Find cpp program and necessary flags for use in pre-processing text files
12318d4c0f7bSmrg# such as man pages and config files
12328d4c0f7bSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
12338d4c0f7bSmrgAC_REQUIRE([AC_PROG_CPP])
12348d4c0f7bSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
12358d4c0f7bSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
12368d4c0f7bSmrg
12378d4c0f7bSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
12388d4c0f7bSmrg# which is not the best choice for supporting other OS'es, but covers most
12398d4c0f7bSmrg# of the ones we need for now.
12408d4c0f7bSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1241fe567363SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
12428d4c0f7bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12438d4c0f7bSmrg	AC_MSG_RESULT([no])
12448d4c0f7bSmrgelse
12458d4c0f7bSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12468d4c0f7bSmrg		RAWCPPFLAGS=-undef
12478d4c0f7bSmrg		AC_MSG_RESULT([yes])
12488d4c0f7bSmrg	# under Cygwin unix is still defined even with -undef
12498d4c0f7bSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12508d4c0f7bSmrg		RAWCPPFLAGS="-undef -ansi"
12518d4c0f7bSmrg		AC_MSG_RESULT([yes, with -ansi])
12528d4c0f7bSmrg	else
12538d4c0f7bSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
12548d4c0f7bSmrg	fi
12558d4c0f7bSmrgfi
12568d4c0f7bSmrgrm -f conftest.$ac_ext
12578d4c0f7bSmrg
12588d4c0f7bSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1259fe567363SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
12608d4c0f7bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12618d4c0f7bSmrg	AC_MSG_RESULT([no])
12628d4c0f7bSmrgelse
12638d4c0f7bSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12648d4c0f7bSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
12658d4c0f7bSmrg		AC_MSG_RESULT([yes])
12668d4c0f7bSmrg	else
12678d4c0f7bSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
12688d4c0f7bSmrg	fi
12698d4c0f7bSmrgfi
12708d4c0f7bSmrgrm -f conftest.$ac_ext
12718d4c0f7bSmrgAC_SUBST(RAWCPPFLAGS)
12728d4c0f7bSmrg]) # XORG_PROG_RAWCPP
12738d4c0f7bSmrg
12748d4c0f7bSmrg# XORG_MANPAGE_SECTIONS()
12758d4c0f7bSmrg# -----------------------
12768d4c0f7bSmrg# Minimum version: 1.0.0
12778d4c0f7bSmrg#
12788d4c0f7bSmrg# Determine which sections man pages go in for the different man page types
12798d4c0f7bSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
12808d4c0f7bSmrg# Not sure if there's any better way than just hardcoding by OS name.
12818d4c0f7bSmrg# Override default settings by setting environment variables
1282af928962Smrg# Added MAN_SUBSTS in version 1.8
1283af928962Smrg# Added AC_PROG_SED in version 1.8
12848d4c0f7bSmrg
12858d4c0f7bSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
12868d4c0f7bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1287af928962SmrgAC_REQUIRE([AC_PROG_SED])
12888d4c0f7bSmrg
12898d4c0f7bSmrgif test x$APP_MAN_SUFFIX = x    ; then
12908d4c0f7bSmrg    APP_MAN_SUFFIX=1
12918d4c0f7bSmrgfi
12928d4c0f7bSmrgif test x$APP_MAN_DIR = x    ; then
12938d4c0f7bSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
12948d4c0f7bSmrgfi
12958d4c0f7bSmrg
12968d4c0f7bSmrgif test x$LIB_MAN_SUFFIX = x    ; then
12978d4c0f7bSmrg    LIB_MAN_SUFFIX=3
12988d4c0f7bSmrgfi
12998d4c0f7bSmrgif test x$LIB_MAN_DIR = x    ; then
13008d4c0f7bSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
13018d4c0f7bSmrgfi
13028d4c0f7bSmrg
13038d4c0f7bSmrgif test x$FILE_MAN_SUFFIX = x    ; then
13048d4c0f7bSmrg    case $host_os in
13058d4c0f7bSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
13068d4c0f7bSmrg	*)		FILE_MAN_SUFFIX=5  ;;
13078d4c0f7bSmrg    esac
13088d4c0f7bSmrgfi
13098d4c0f7bSmrgif test x$FILE_MAN_DIR = x    ; then
13108d4c0f7bSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
13118d4c0f7bSmrgfi
13128d4c0f7bSmrg
13138d4c0f7bSmrgif test x$MISC_MAN_SUFFIX = x    ; then
13148d4c0f7bSmrg    case $host_os in
13158d4c0f7bSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
13168d4c0f7bSmrg	*)		MISC_MAN_SUFFIX=7  ;;
13178d4c0f7bSmrg    esac
13188d4c0f7bSmrgfi
13198d4c0f7bSmrgif test x$MISC_MAN_DIR = x    ; then
13208d4c0f7bSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
13218d4c0f7bSmrgfi
13228d4c0f7bSmrg
13238d4c0f7bSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
13248d4c0f7bSmrg    case $host_os in
13258d4c0f7bSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
13268d4c0f7bSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
13278d4c0f7bSmrg    esac
13288d4c0f7bSmrgfi
13298d4c0f7bSmrgif test x$DRIVER_MAN_DIR = x    ; then
13308d4c0f7bSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
13318d4c0f7bSmrgfi
13328d4c0f7bSmrg
13338d4c0f7bSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
13348d4c0f7bSmrg    case $host_os in
13358d4c0f7bSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
13368d4c0f7bSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
13378d4c0f7bSmrg    esac
13388d4c0f7bSmrgfi
13398d4c0f7bSmrgif test x$ADMIN_MAN_DIR = x    ; then
13408d4c0f7bSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
13418d4c0f7bSmrgfi
13428d4c0f7bSmrg
13438d4c0f7bSmrg
13448d4c0f7bSmrgAC_SUBST([APP_MAN_SUFFIX])
13458d4c0f7bSmrgAC_SUBST([LIB_MAN_SUFFIX])
13468d4c0f7bSmrgAC_SUBST([FILE_MAN_SUFFIX])
13478d4c0f7bSmrgAC_SUBST([MISC_MAN_SUFFIX])
13488d4c0f7bSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
13498d4c0f7bSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
13508d4c0f7bSmrgAC_SUBST([APP_MAN_DIR])
13518d4c0f7bSmrgAC_SUBST([LIB_MAN_DIR])
13528d4c0f7bSmrgAC_SUBST([FILE_MAN_DIR])
13538d4c0f7bSmrgAC_SUBST([MISC_MAN_DIR])
13548d4c0f7bSmrgAC_SUBST([DRIVER_MAN_DIR])
13558d4c0f7bSmrgAC_SUBST([ADMIN_MAN_DIR])
1356af928962Smrg
1357af928962SmrgXORG_MAN_PAGE="X Version 11"
1358af928962SmrgAC_SUBST([XORG_MAN_PAGE])
1359af928962SmrgMAN_SUBSTS="\
1360af928962Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1361af928962Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1362af928962Smrg	-e 's|__xservername__|Xorg|g' \
1363af928962Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1364af928962Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1365af928962Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1366af928962Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1367af928962Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1368af928962Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1369af928962Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1370af928962Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1371af928962Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1372af928962SmrgAC_SUBST([MAN_SUBSTS])
1373af928962Smrg
13748d4c0f7bSmrg]) # XORG_MANPAGE_SECTIONS
13758d4c0f7bSmrg
1376af928962Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1377af928962Smrg# ------------------------
1378af928962Smrg# Minimum version: 1.7.0
1379af928962Smrg#
1380af928962Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1381af928962Smrg# provided by xorg-sgml-doctools, if installed.
1382af928962SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1383af928962SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1384af928962SmrgXORG_SGML_PATH=
1385af928962SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1386af928962Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1387af928962Smrg    [m4_ifval([$1],[:],
1388af928962Smrg        [if test x"$cross_compiling" != x"yes" ; then
1389af928962Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1390af928962Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1391af928962Smrg         fi])
1392af928962Smrg    ])
1393af928962Smrg
1394af928962Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1395af928962Smrg# the path and the name of the doc stylesheet
1396af928962Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1397af928962Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1398af928962Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1399af928962Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1400af928962Smrgelse
1401af928962Smrg   AC_MSG_RESULT([no])
1402af928962Smrgfi
1403af928962Smrg
1404af928962SmrgAC_SUBST(XORG_SGML_PATH)
1405af928962SmrgAC_SUBST(STYLESHEET_SRCDIR)
1406af928962SmrgAC_SUBST(XSL_STYLESHEET)
1407af928962SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1408af928962Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1409af928962Smrg
14108d4c0f7bSmrg# XORG_CHECK_LINUXDOC
14118d4c0f7bSmrg# -------------------
14128d4c0f7bSmrg# Minimum version: 1.0.0
14138d4c0f7bSmrg#
14148d4c0f7bSmrg# Defines the variable MAKE_TEXT if the necessary tools and
14158d4c0f7bSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
14168d4c0f7bSmrg# Whether or not the necessary tools and files are found can be checked
14178d4c0f7bSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
14188d4c0f7bSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1419af928962SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1420af928962SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
14218d4c0f7bSmrg
14228d4c0f7bSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
14238d4c0f7bSmrg
1424af928962SmrgAC_MSG_CHECKING([whether to build documentation])
14258d4c0f7bSmrg
1426af928962Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
14278d4c0f7bSmrg   BUILDDOC=yes
14288d4c0f7bSmrgelse
14298d4c0f7bSmrg   BUILDDOC=no
14308d4c0f7bSmrgfi
14318d4c0f7bSmrg
14328d4c0f7bSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
14338d4c0f7bSmrg
14348d4c0f7bSmrgAC_MSG_RESULT([$BUILDDOC])
14358d4c0f7bSmrg
1436af928962SmrgAC_MSG_CHECKING([whether to build pdf documentation])
14378d4c0f7bSmrg
1438af928962Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
14398d4c0f7bSmrg   BUILDPDFDOC=yes
14408d4c0f7bSmrgelse
14418d4c0f7bSmrg   BUILDPDFDOC=no
14428d4c0f7bSmrgfi
14438d4c0f7bSmrg
14448d4c0f7bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
14458d4c0f7bSmrg
14468d4c0f7bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
14478d4c0f7bSmrg
1448af928962SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
14498d4c0f7bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
14508d4c0f7bSmrgMAKE_PDF="$PS2PDF"
14518d4c0f7bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
14528d4c0f7bSmrg
14538d4c0f7bSmrgAC_SUBST(MAKE_TEXT)
14548d4c0f7bSmrgAC_SUBST(MAKE_PS)
14558d4c0f7bSmrgAC_SUBST(MAKE_PDF)
14568d4c0f7bSmrgAC_SUBST(MAKE_HTML)
14578d4c0f7bSmrg]) # XORG_CHECK_LINUXDOC
14588d4c0f7bSmrg
14598d4c0f7bSmrg# XORG_CHECK_DOCBOOK
14608d4c0f7bSmrg# -------------------
14618d4c0f7bSmrg# Minimum version: 1.0.0
14628d4c0f7bSmrg#
14638d4c0f7bSmrg# Checks for the ability to build output formats from SGML DocBook source.
14648d4c0f7bSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
14658d4c0f7bSmrg# indicates whether the necessary tools and files are found and, if set,
14668d4c0f7bSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
14678d4c0f7bSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1468af928962SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1469af928962Smrg
14708d4c0f7bSmrgBUILDTXTDOC=no
14718d4c0f7bSmrgBUILDPDFDOC=no
14728d4c0f7bSmrgBUILDPSDOC=no
14738d4c0f7bSmrgBUILDHTMLDOC=no
14748d4c0f7bSmrg
14758d4c0f7bSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
14768d4c0f7bSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
14778d4c0f7bSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
14788d4c0f7bSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
14798d4c0f7bSmrg
1480af928962SmrgAC_MSG_CHECKING([whether to build text documentation])
1481af928962Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
14828d4c0f7bSmrg   test x$BUILD_TXTDOC != xno; then
14838d4c0f7bSmrg	BUILDTXTDOC=yes
14848d4c0f7bSmrgfi
14858d4c0f7bSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
14868d4c0f7bSmrgAC_MSG_RESULT([$BUILDTXTDOC])
14878d4c0f7bSmrg
1488af928962SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1489af928962Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
14908d4c0f7bSmrg   test x$BUILD_PDFDOC != xno; then
14918d4c0f7bSmrg	BUILDPDFDOC=yes
14928d4c0f7bSmrgfi
14938d4c0f7bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
14948d4c0f7bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
14958d4c0f7bSmrg
1496af928962SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1497af928962Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
14988d4c0f7bSmrg   test x$BUILD_PSDOC != xno; then
14998d4c0f7bSmrg	BUILDPSDOC=yes
15008d4c0f7bSmrgfi
15018d4c0f7bSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
15028d4c0f7bSmrgAC_MSG_RESULT([$BUILDPSDOC])
15038d4c0f7bSmrg
1504af928962SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1505af928962Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
15068d4c0f7bSmrg   test x$BUILD_HTMLDOC != xno; then
15078d4c0f7bSmrg	BUILDHTMLDOC=yes
15088d4c0f7bSmrgfi
15098d4c0f7bSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
15108d4c0f7bSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
15118d4c0f7bSmrg
15128d4c0f7bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
15138d4c0f7bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
15148d4c0f7bSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
15158d4c0f7bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
15168d4c0f7bSmrg
15178d4c0f7bSmrgAC_SUBST(MAKE_TEXT)
15188d4c0f7bSmrgAC_SUBST(MAKE_PS)
15198d4c0f7bSmrgAC_SUBST(MAKE_PDF)
15208d4c0f7bSmrgAC_SUBST(MAKE_HTML)
15218d4c0f7bSmrg]) # XORG_CHECK_DOCBOOK
15228d4c0f7bSmrg
1523af928962Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1524af928962Smrg# ----------------
1525af928962Smrg# Minimum version: 1.5.0
1526af928962Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1527af928962Smrg#
1528af928962Smrg# Documentation tools are not always available on all platforms and sometimes
1529af928962Smrg# not at the appropriate level. This macro enables a module to test for the
1530af928962Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1531af928962Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1532af928962Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1533af928962Smrg# --with-xmlto assumes 'auto'.
1534af928962Smrg#
1535af928962Smrg# Interface to module:
1536af928962Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1537af928962Smrg# XMLTO:	returns the path of the xmlto program found
1538af928962Smrg#		returns the path set by the user in the environment
1539af928962Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1540af928962Smrg#		'no' user instructs the module not to use xmlto
1541af928962Smrg#
1542af928962Smrg# Added in version 1.10.0
1543af928962Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1544af928962Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1545af928962Smrg#
1546af928962Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1547af928962Smrg#
1548af928962SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1549af928962SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1550af928962Smrgm4_define([_defopt], m4_default([$2], [auto]))
1551af928962SmrgAC_ARG_WITH(xmlto,
1552af928962Smrg	AS_HELP_STRING([--with-xmlto],
1553af928962Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1554af928962Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1555af928962Smrgm4_undefine([_defopt])
1556af928962Smrg
1557af928962Smrgif test "x$use_xmlto" = x"auto"; then
1558af928962Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1559af928962Smrg   if test "x$XMLTO" = "x"; then
1560af928962Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1561af928962Smrg	have_xmlto=no
1562af928962Smrg   else
1563af928962Smrg        have_xmlto=yes
1564af928962Smrg   fi
1565af928962Smrgelif test "x$use_xmlto" = x"yes" ; then
1566af928962Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1567af928962Smrg   if test "x$XMLTO" = "x"; then
1568af928962Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1569af928962Smrg   fi
1570af928962Smrg   have_xmlto=yes
1571af928962Smrgelif test "x$use_xmlto" = x"no" ; then
1572af928962Smrg   if test "x$XMLTO" != "x"; then
1573af928962Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1574af928962Smrg   fi
1575af928962Smrg   have_xmlto=no
1576af928962Smrgelse
1577af928962Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1578af928962Smrgfi
1579af928962Smrg
1580af928962Smrg# Test for a minimum version of xmlto, if provided.
1581af928962Smrgm4_ifval([$1],
1582af928962Smrg[if test "$have_xmlto" = yes; then
1583af928962Smrg    # scrape the xmlto version
1584af928962Smrg    AC_MSG_CHECKING([the xmlto version])
1585af928962Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1586af928962Smrg    AC_MSG_RESULT([$xmlto_version])
1587af928962Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1588af928962Smrg        [if test "x$use_xmlto" = xauto; then
1589af928962Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1590af928962Smrg            have_xmlto=no
1591af928962Smrg        else
1592af928962Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1593af928962Smrg        fi])
1594af928962Smrgfi])
1595af928962Smrg
1596af928962Smrg# Test for the ability of xmlto to generate a text target
1597af928962Smrghave_xmlto_text=no
1598af928962Smrgcat > conftest.xml << "EOF"
1599af928962SmrgEOF
1600af928962SmrgAS_IF([test "$have_xmlto" = yes],
1601af928962Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1602af928962Smrg             [have_xmlto_text=yes],
1603af928962Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1604af928962Smrgrm -f conftest.xml
1605af928962SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1606af928962SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1607af928962Smrg]) # XORG_WITH_XMLTO
1608af928962Smrg
1609fe567363Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1610fe567363Smrg# --------------------------------------------
1611fe567363Smrg# Minimum version: 1.12.0
1612fe567363Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1613fe567363Smrg#
1614fe567363Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1615fe567363Smrg# XML-based language used for the transformation of XML documents.
1616fe567363Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1617fe567363Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1618fe567363Smrg# The XSLT processor is often used as a standalone tool for transformations.
1619fe567363Smrg# It should not be assumed that this tool is used only to work with documnetation.
1620fe567363Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1621fe567363Smrg#
1622fe567363Smrg# Interface to module:
1623fe567363Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1624fe567363Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1625fe567363Smrg#		 returns the path set by the user in the environment
1626fe567363Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1627fe567363Smrg#		  'no' user instructs the module not to use xsltproc
1628fe567363Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1629fe567363Smrg#
1630fe567363Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1631fe567363Smrg#
1632fe567363SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1633fe567363SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1634fe567363Smrg# Preserves the interface, should it be implemented later
1635fe567363Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1636fe567363Smrgm4_define([_defopt], m4_default([$2], [auto]))
1637fe567363SmrgAC_ARG_WITH(xsltproc,
1638fe567363Smrg	AS_HELP_STRING([--with-xsltproc],
1639fe567363Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1640fe567363Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1641fe567363Smrgm4_undefine([_defopt])
1642fe567363Smrg
1643fe567363Smrgif test "x$use_xsltproc" = x"auto"; then
1644fe567363Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1645fe567363Smrg   if test "x$XSLTPROC" = "x"; then
1646fe567363Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1647fe567363Smrg	have_xsltproc=no
1648fe567363Smrg   else
1649fe567363Smrg        have_xsltproc=yes
1650fe567363Smrg   fi
1651fe567363Smrgelif test "x$use_xsltproc" = x"yes" ; then
1652fe567363Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1653fe567363Smrg   if test "x$XSLTPROC" = "x"; then
1654fe567363Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1655fe567363Smrg   fi
1656fe567363Smrg   have_xsltproc=yes
1657fe567363Smrgelif test "x$use_xsltproc" = x"no" ; then
1658fe567363Smrg   if test "x$XSLTPROC" != "x"; then
1659fe567363Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1660fe567363Smrg   fi
1661fe567363Smrg   have_xsltproc=no
1662fe567363Smrgelse
1663fe567363Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1664fe567363Smrgfi
1665fe567363Smrg
1666fe567363SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1667fe567363Smrg]) # XORG_WITH_XSLTPROC
1668fe567363Smrg
1669fe567363Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1670fe567363Smrg# ----------------------------------------
1671fe567363Smrg# Minimum version: 1.15.0
1672fe567363Smrg#
1673fe567363Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1674fe567363Smrg# scanning arbitrary text files, extracting information from those text files,
1675fe567363Smrg# and printing reports based on that information.
1676fe567363Smrg#
1677fe567363Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1678fe567363Smrg#
1679fe567363Smrg# Interface to module:
1680fe567363Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1681fe567363Smrg# PERL:	     returns the path of the perl program found
1682fe567363Smrg#	     returns the path set by the user in the environment
1683fe567363Smrg# --with-perl: 'yes' user instructs the module to use perl
1684fe567363Smrg#	       'no' user instructs the module not to use perl
1685fe567363Smrg# have_perl: returns yes if perl found in PATH or no
1686fe567363Smrg#
1687fe567363Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1688fe567363Smrg#
1689fe567363SmrgAC_DEFUN([XORG_WITH_PERL],[
1690fe567363SmrgAC_ARG_VAR([PERL], [Path to perl command])
1691fe567363Smrg# Preserves the interface, should it be implemented later
1692fe567363Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1693fe567363Smrgm4_define([_defopt], m4_default([$2], [auto]))
1694fe567363SmrgAC_ARG_WITH(perl,
1695fe567363Smrg	AS_HELP_STRING([--with-perl],
1696fe567363Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1697fe567363Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1698fe567363Smrgm4_undefine([_defopt])
1699fe567363Smrg
1700fe567363Smrgif test "x$use_perl" = x"auto"; then
1701fe567363Smrg   AC_PATH_PROG([PERL], [perl])
1702fe567363Smrg   if test "x$PERL" = "x"; then
1703fe567363Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1704fe567363Smrg	have_perl=no
1705fe567363Smrg   else
1706fe567363Smrg        have_perl=yes
1707fe567363Smrg   fi
1708fe567363Smrgelif test "x$use_perl" = x"yes" ; then
1709fe567363Smrg   AC_PATH_PROG([PERL], [perl])
1710fe567363Smrg   if test "x$PERL" = "x"; then
1711fe567363Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1712fe567363Smrg   fi
1713fe567363Smrg   have_perl=yes
1714fe567363Smrgelif test "x$use_perl" = x"no" ; then
1715fe567363Smrg   if test "x$PERL" != "x"; then
1716fe567363Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1717fe567363Smrg   fi
1718fe567363Smrg   have_perl=no
1719fe567363Smrgelse
1720fe567363Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1721fe567363Smrgfi
1722fe567363Smrg
1723fe567363SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1724fe567363Smrg]) # XORG_WITH_PERL
1725fe567363Smrg
1726af928962Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1727af928962Smrg# ----------------
1728af928962Smrg# Minimum version: 1.5.0
1729af928962Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1730af928962Smrg#
1731af928962Smrg# Documentation tools are not always available on all platforms and sometimes
1732af928962Smrg# not at the appropriate level. This macro enables a module to test for the
1733af928962Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1734af928962Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1735af928962Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1736af928962Smrg# --with-asciidoc assumes 'auto'.
1737af928962Smrg#
1738af928962Smrg# Interface to module:
1739af928962Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1740af928962Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
1741af928962Smrg#		 returns the path set by the user in the environment
1742af928962Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1743af928962Smrg#		  'no' user instructs the module not to use asciidoc
1744af928962Smrg#
1745af928962Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1746af928962Smrg#
1747af928962SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1748af928962SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1749af928962Smrgm4_define([_defopt], m4_default([$2], [auto]))
1750af928962SmrgAC_ARG_WITH(asciidoc,
1751af928962Smrg	AS_HELP_STRING([--with-asciidoc],
1752af928962Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1753af928962Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1754af928962Smrgm4_undefine([_defopt])
1755af928962Smrg
1756af928962Smrgif test "x$use_asciidoc" = x"auto"; then
1757af928962Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1758af928962Smrg   if test "x$ASCIIDOC" = "x"; then
1759af928962Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1760af928962Smrg	have_asciidoc=no
1761af928962Smrg   else
1762af928962Smrg        have_asciidoc=yes
1763af928962Smrg   fi
1764af928962Smrgelif test "x$use_asciidoc" = x"yes" ; then
1765af928962Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1766af928962Smrg   if test "x$ASCIIDOC" = "x"; then
1767af928962Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1768af928962Smrg   fi
1769af928962Smrg   have_asciidoc=yes
1770af928962Smrgelif test "x$use_asciidoc" = x"no" ; then
1771af928962Smrg   if test "x$ASCIIDOC" != "x"; then
1772af928962Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1773af928962Smrg   fi
1774af928962Smrg   have_asciidoc=no
1775af928962Smrgelse
1776af928962Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1777af928962Smrgfi
1778af928962Smrgm4_ifval([$1],
1779af928962Smrg[if test "$have_asciidoc" = yes; then
1780af928962Smrg    # scrape the asciidoc version
1781af928962Smrg    AC_MSG_CHECKING([the asciidoc version])
1782af928962Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1783af928962Smrg    AC_MSG_RESULT([$asciidoc_version])
1784af928962Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1785af928962Smrg        [if test "x$use_asciidoc" = xauto; then
1786af928962Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1787af928962Smrg            have_asciidoc=no
1788af928962Smrg        else
1789af928962Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1790af928962Smrg        fi])
1791af928962Smrgfi])
1792af928962SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1793af928962Smrg]) # XORG_WITH_ASCIIDOC
1794af928962Smrg
1795af928962Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1796af928962Smrg# --------------------------------
1797af928962Smrg# Minimum version: 1.5.0
1798af928962Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1799af928962Smrg#
1800af928962Smrg# Documentation tools are not always available on all platforms and sometimes
1801af928962Smrg# not at the appropriate level. This macro enables a module to test for the
1802af928962Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1803af928962Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1804af928962Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1805af928962Smrg# --with-doxygen assumes 'auto'.
1806af928962Smrg#
1807af928962Smrg# Interface to module:
1808af928962Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1809af928962Smrg# DOXYGEN:	 returns the path of the doxygen program found
1810af928962Smrg#		 returns the path set by the user in the environment
1811af928962Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1812af928962Smrg#		  'no' user instructs the module not to use doxygen
1813af928962Smrg#
1814af928962Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1815af928962Smrg#
1816af928962SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1817af928962SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1818af928962Smrgm4_define([_defopt], m4_default([$2], [auto]))
1819af928962SmrgAC_ARG_WITH(doxygen,
1820af928962Smrg	AS_HELP_STRING([--with-doxygen],
1821af928962Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1822af928962Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1823af928962Smrgm4_undefine([_defopt])
1824af928962Smrg
1825af928962Smrgif test "x$use_doxygen" = x"auto"; then
1826af928962Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1827af928962Smrg   if test "x$DOXYGEN" = "x"; then
1828af928962Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1829af928962Smrg	have_doxygen=no
1830af928962Smrg   else
1831af928962Smrg        have_doxygen=yes
1832af928962Smrg   fi
1833af928962Smrgelif test "x$use_doxygen" = x"yes" ; then
1834af928962Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1835af928962Smrg   if test "x$DOXYGEN" = "x"; then
1836af928962Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1837af928962Smrg   fi
1838af928962Smrg   have_doxygen=yes
1839af928962Smrgelif test "x$use_doxygen" = x"no" ; then
1840af928962Smrg   if test "x$DOXYGEN" != "x"; then
1841af928962Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1842af928962Smrg   fi
1843af928962Smrg   have_doxygen=no
1844af928962Smrgelse
1845af928962Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1846af928962Smrgfi
1847af928962Smrgm4_ifval([$1],
1848af928962Smrg[if test "$have_doxygen" = yes; then
1849af928962Smrg    # scrape the doxygen version
1850af928962Smrg    AC_MSG_CHECKING([the doxygen version])
1851af928962Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1852af928962Smrg    AC_MSG_RESULT([$doxygen_version])
1853af928962Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1854af928962Smrg        [if test "x$use_doxygen" = xauto; then
1855af928962Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1856af928962Smrg            have_doxygen=no
1857af928962Smrg        else
1858af928962Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1859af928962Smrg        fi])
1860af928962Smrgfi])
1861af928962SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1862af928962Smrg]) # XORG_WITH_DOXYGEN
1863af928962Smrg
1864af928962Smrg# XORG_WITH_GROFF([DEFAULT])
1865af928962Smrg# ----------------
1866af928962Smrg# Minimum version: 1.6.0
1867af928962Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1868af928962Smrg#
1869af928962Smrg# Documentation tools are not always available on all platforms and sometimes
1870af928962Smrg# not at the appropriate level. This macro enables a module to test for the
1871af928962Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1872af928962Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
1873af928962Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
1874af928962Smrg# --with-groff assumes 'auto'.
1875af928962Smrg#
1876af928962Smrg# Interface to module:
1877af928962Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1878af928962Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1879af928962Smrg# HAVE_GROFF_MS: the -ms macros package
1880af928962Smrg# GROFF:	 returns the path of the groff program found
1881af928962Smrg#		 returns the path set by the user in the environment
1882af928962Smrg# --with-groff:	 'yes' user instructs the module to use groff
1883af928962Smrg#		 'no' user instructs the module not to use groff
1884af928962Smrg#
1885af928962Smrg# Added in version 1.9.0:
1886af928962Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1887af928962Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1888af928962Smrg#		   psselect from the psutils package.
1889af928962Smrg#		   the ghostcript package. Refer to the grohtml man pages
1890af928962Smrg#
1891af928962Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1892af928962Smrg#
1893af928962Smrg# OS and distros often splits groff in a basic and full package, the former
1894af928962Smrg# having the groff program and the later having devices, fonts and macros
1895af928962Smrg# Checking for the groff executable is not enough.
1896af928962Smrg#
1897af928962Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
1898af928962Smrg# unset HAVE_GROFF or GROFF env variables.
1899af928962Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1900af928962Smrg#
1901af928962SmrgAC_DEFUN([XORG_WITH_GROFF],[
1902af928962SmrgAC_ARG_VAR([GROFF], [Path to groff command])
1903af928962Smrgm4_define([_defopt], m4_default([$1], [auto]))
1904af928962SmrgAC_ARG_WITH(groff,
1905af928962Smrg	AS_HELP_STRING([--with-groff],
1906af928962Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1907af928962Smrg	   [use_groff=$withval], [use_groff=]_defopt)
1908af928962Smrgm4_undefine([_defopt])
1909af928962Smrg
1910af928962Smrgif test "x$use_groff" = x"auto"; then
1911af928962Smrg   AC_PATH_PROG([GROFF], [groff])
1912af928962Smrg   if test "x$GROFF" = "x"; then
1913af928962Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1914af928962Smrg	have_groff=no
1915af928962Smrg   else
1916af928962Smrg        have_groff=yes
1917af928962Smrg   fi
1918af928962Smrgelif test "x$use_groff" = x"yes" ; then
1919af928962Smrg   AC_PATH_PROG([GROFF], [groff])
1920af928962Smrg   if test "x$GROFF" = "x"; then
1921af928962Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1922af928962Smrg   fi
1923af928962Smrg   have_groff=yes
1924af928962Smrgelif test "x$use_groff" = x"no" ; then
1925af928962Smrg   if test "x$GROFF" != "x"; then
1926af928962Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1927af928962Smrg   fi
1928af928962Smrg   have_groff=no
1929af928962Smrgelse
1930af928962Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1931af928962Smrgfi
1932af928962Smrg
1933af928962Smrg# We have groff, test for the presence of the macro packages
1934af928962Smrgif test "x$have_groff" = x"yes"; then
1935af928962Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1936af928962Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1937af928962Smrg        groff_ms_works=yes
1938af928962Smrg    else
1939af928962Smrg        groff_ms_works=no
1940af928962Smrg    fi
1941af928962Smrg    AC_MSG_RESULT([$groff_ms_works])
1942af928962Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1943af928962Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1944af928962Smrg        groff_mm_works=yes
1945af928962Smrg    else
1946af928962Smrg        groff_mm_works=no
1947af928962Smrg    fi
1948af928962Smrg    AC_MSG_RESULT([$groff_mm_works])
1949af928962Smrgfi
1950af928962Smrg
1951af928962Smrg# We have groff, test for HTML dependencies, one command per package
1952af928962Smrgif test "x$have_groff" = x"yes"; then
1953af928962Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1954af928962Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1955af928962Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1956af928962Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1957af928962Smrg      have_groff_html=yes
1958af928962Smrg   else
1959af928962Smrg      have_groff_html=no
1960af928962Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1961af928962Smrg   fi
1962af928962Smrgfi
1963af928962Smrg
1964af928962Smrg# Set Automake conditionals for Makefiles
1965af928962SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1966af928962SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1967af928962SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1968af928962SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1969af928962Smrg]) # XORG_WITH_GROFF
1970af928962Smrg
1971fe567363Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1972fe567363Smrg# ---------------------------------------
1973af928962Smrg# Minimum version: 1.6.0
1974af928962Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1975fe567363Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1976af928962Smrg#
1977af928962Smrg# Documentation tools are not always available on all platforms and sometimes
1978af928962Smrg# not at the appropriate level. This macro enables a module to test for the
1979af928962Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1980af928962Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
1981af928962Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
1982af928962Smrg# --with-fop assumes 'auto'.
1983af928962Smrg#
1984af928962Smrg# Interface to module:
1985af928962Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1986af928962Smrg# FOP:	 	returns the path of the fop program found
1987af928962Smrg#		returns the path set by the user in the environment
1988af928962Smrg# --with-fop: 	'yes' user instructs the module to use fop
1989af928962Smrg#		'no' user instructs the module not to use fop
1990af928962Smrg#
1991af928962Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1992af928962Smrg#
1993af928962SmrgAC_DEFUN([XORG_WITH_FOP],[
1994af928962SmrgAC_ARG_VAR([FOP], [Path to fop command])
1995fe567363Smrgm4_define([_defopt], m4_default([$2], [auto]))
1996af928962SmrgAC_ARG_WITH(fop,
1997af928962Smrg	AS_HELP_STRING([--with-fop],
1998af928962Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1999af928962Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2000af928962Smrgm4_undefine([_defopt])
2001af928962Smrg
2002af928962Smrgif test "x$use_fop" = x"auto"; then
2003af928962Smrg   AC_PATH_PROG([FOP], [fop])
2004af928962Smrg   if test "x$FOP" = "x"; then
2005af928962Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2006af928962Smrg	have_fop=no
2007af928962Smrg   else
2008af928962Smrg        have_fop=yes
2009af928962Smrg   fi
2010af928962Smrgelif test "x$use_fop" = x"yes" ; then
2011af928962Smrg   AC_PATH_PROG([FOP], [fop])
2012af928962Smrg   if test "x$FOP" = "x"; then
2013af928962Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2014af928962Smrg   fi
2015af928962Smrg   have_fop=yes
2016af928962Smrgelif test "x$use_fop" = x"no" ; then
2017af928962Smrg   if test "x$FOP" != "x"; then
2018af928962Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2019af928962Smrg   fi
2020af928962Smrg   have_fop=no
2021af928962Smrgelse
2022af928962Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2023af928962Smrgfi
2024fe567363Smrg
2025fe567363Smrg# Test for a minimum version of fop, if provided.
2026fe567363Smrgm4_ifval([$1],
2027fe567363Smrg[if test "$have_fop" = yes; then
2028fe567363Smrg    # scrape the fop version
2029fe567363Smrg    AC_MSG_CHECKING([for fop minimum version])
2030fe567363Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2031fe567363Smrg    AC_MSG_RESULT([$fop_version])
2032fe567363Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2033fe567363Smrg        [if test "x$use_fop" = xauto; then
2034fe567363Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2035fe567363Smrg            have_fop=no
2036fe567363Smrg        else
2037fe567363Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2038fe567363Smrg        fi])
2039fe567363Smrgfi])
2040af928962SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2041af928962Smrg]) # XORG_WITH_FOP
2042af928962Smrg
2043af928962Smrg# XORG_WITH_PS2PDF([DEFAULT])
2044af928962Smrg# ----------------
2045af928962Smrg# Minimum version: 1.6.0
2046af928962Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2047af928962Smrg#
2048af928962Smrg# Documentation tools are not always available on all platforms and sometimes
2049af928962Smrg# not at the appropriate level. This macro enables a module to test for the
2050af928962Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2051af928962Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2052af928962Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2053af928962Smrg# --with-ps2pdf assumes 'auto'.
2054af928962Smrg#
2055af928962Smrg# Interface to module:
2056af928962Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2057af928962Smrg# PS2PDF:	returns the path of the ps2pdf program found
2058af928962Smrg#		returns the path set by the user in the environment
2059af928962Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2060af928962Smrg#		 'no' user instructs the module not to use ps2pdf
2061af928962Smrg#
2062af928962Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2063af928962Smrg#
2064af928962SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2065af928962SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2066af928962Smrgm4_define([_defopt], m4_default([$1], [auto]))
2067af928962SmrgAC_ARG_WITH(ps2pdf,
2068af928962Smrg	AS_HELP_STRING([--with-ps2pdf],
2069af928962Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2070af928962Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2071af928962Smrgm4_undefine([_defopt])
2072af928962Smrg
2073af928962Smrgif test "x$use_ps2pdf" = x"auto"; then
2074af928962Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2075af928962Smrg   if test "x$PS2PDF" = "x"; then
2076af928962Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2077af928962Smrg	have_ps2pdf=no
2078af928962Smrg   else
2079af928962Smrg        have_ps2pdf=yes
2080af928962Smrg   fi
2081af928962Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2082af928962Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2083af928962Smrg   if test "x$PS2PDF" = "x"; then
2084af928962Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2085af928962Smrg   fi
2086af928962Smrg   have_ps2pdf=yes
2087af928962Smrgelif test "x$use_ps2pdf" = x"no" ; then
2088af928962Smrg   if test "x$PS2PDF" != "x"; then
2089af928962Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2090af928962Smrg   fi
2091af928962Smrg   have_ps2pdf=no
2092af928962Smrgelse
2093af928962Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2094af928962Smrgfi
2095af928962SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2096af928962Smrg]) # XORG_WITH_PS2PDF
2097af928962Smrg
2098af928962Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2099af928962Smrg# ----------------
2100af928962Smrg# Minimum version: 1.6.0
2101af928962Smrg#
2102af928962Smrg# Documentation tools are not always available on all platforms and sometimes
2103af928962Smrg# not at the appropriate level. This macro enables a builder to skip all
2104af928962Smrg# documentation targets except traditional man pages.
2105af928962Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2106af928962Smrg# maximum flexibilty in controlling documentation building.
2107af928962Smrg# Refer to:
2108af928962Smrg# XORG_WITH_XMLTO         --with-xmlto
2109af928962Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2110af928962Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2111af928962Smrg# XORG_WITH_FOP           --with-fop
2112af928962Smrg# XORG_WITH_GROFF         --with-groff
2113af928962Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2114af928962Smrg#
2115af928962Smrg# Interface to module:
2116af928962Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2117af928962Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2118af928962Smrg#		 'no' user instructs the module not to generate docs
2119af928962Smrg# parm1:	specify the default value, yes or no.
2120af928962Smrg#
2121af928962SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2122fe567363Smrgm4_define([docs_default], m4_default([$1], [yes]))
2123af928962SmrgAC_ARG_ENABLE(docs,
2124af928962Smrg	AS_HELP_STRING([--enable-docs],
2125fe567363Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2126fe567363Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2127fe567363Smrgm4_undefine([docs_default])
2128af928962SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2129af928962SmrgAC_MSG_CHECKING([whether to build documentation])
2130af928962SmrgAC_MSG_RESULT([$build_docs])
2131af928962Smrg]) # XORG_ENABLE_DOCS
2132af928962Smrg
2133af928962Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2134af928962Smrg# ----------------
2135af928962Smrg# Minimum version: 1.6.0
2136af928962Smrg#
2137af928962Smrg# This macro enables a builder to skip all developer documentation.
2138af928962Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2139af928962Smrg# maximum flexibilty in controlling documentation building.
2140af928962Smrg# Refer to:
2141af928962Smrg# XORG_WITH_XMLTO         --with-xmlto
2142af928962Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2143af928962Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2144af928962Smrg# XORG_WITH_FOP           --with-fop
2145af928962Smrg# XORG_WITH_GROFF         --with-groff
2146af928962Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2147af928962Smrg#
2148af928962Smrg# Interface to module:
2149af928962Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2150af928962Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2151af928962Smrg#			'no' user instructs the module not to generate developer docs
2152af928962Smrg# parm1:		specify the default value, yes or no.
2153af928962Smrg#
2154af928962SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2155af928962Smrgm4_define([devel_default], m4_default([$1], [yes]))
2156af928962SmrgAC_ARG_ENABLE(devel-docs,
2157af928962Smrg	AS_HELP_STRING([--enable-devel-docs],
2158af928962Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2159af928962Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2160af928962Smrgm4_undefine([devel_default])
2161af928962SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2162af928962SmrgAC_MSG_CHECKING([whether to build developer documentation])
2163af928962SmrgAC_MSG_RESULT([$build_devel_docs])
2164af928962Smrg]) # XORG_ENABLE_DEVEL_DOCS
2165af928962Smrg
2166af928962Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2167af928962Smrg# ----------------
2168af928962Smrg# Minimum version: 1.6.0
2169af928962Smrg#
2170af928962Smrg# This macro enables a builder to skip all functional specification targets.
2171af928962Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2172af928962Smrg# maximum flexibilty in controlling documentation building.
2173af928962Smrg# Refer to:
2174af928962Smrg# XORG_WITH_XMLTO         --with-xmlto
2175af928962Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2176af928962Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2177af928962Smrg# XORG_WITH_FOP           --with-fop
2178af928962Smrg# XORG_WITH_GROFF         --with-groff
2179af928962Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2180af928962Smrg#
2181af928962Smrg# Interface to module:
2182af928962Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2183af928962Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2184af928962Smrg#			'no' user instructs the module not to generate specs
2185af928962Smrg# parm1:		specify the default value, yes or no.
2186af928962Smrg#
2187af928962SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2188af928962Smrgm4_define([spec_default], m4_default([$1], [yes]))
2189af928962SmrgAC_ARG_ENABLE(specs,
2190af928962Smrg	AS_HELP_STRING([--enable-specs],
2191af928962Smrg	   [Enable building the specs (default: ]spec_default[)]),
2192af928962Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2193af928962Smrgm4_undefine([spec_default])
2194af928962SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2195af928962SmrgAC_MSG_CHECKING([whether to build functional specifications])
2196af928962SmrgAC_MSG_RESULT([$build_specs])
2197af928962Smrg]) # XORG_ENABLE_SPECS
2198af928962Smrg
2199fe567363Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2200fe567363Smrg# ----------------------------------------------
2201fe567363Smrg# Minimum version: 1.13.0
2202fe567363Smrg#
2203fe567363Smrg# This macro enables a builder to enable/disable unit testing
2204fe567363Smrg# It makes no assumption about the test cases implementation
2205fe567363Smrg# Test cases may or may not use Automake "Support for test suites"
2206fe567363Smrg# They may or may not use the software utility library GLib
2207fe567363Smrg#
2208fe567363Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2209fe567363Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2210fe567363Smrg# The variable enable_unit_tests is used by other macros in this file.
2211fe567363Smrg#
2212fe567363Smrg# Interface to module:
2213fe567363Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2214fe567363Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2215fe567363Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2216fe567363Smrg#			'no' user instructs the module not to build tests
2217fe567363Smrg# parm1:		specify the default value, yes or no.
2218fe567363Smrg#
2219fe567363SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2220fe567363SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2221fe567363SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2222fe567363SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2223fe567363Smrgm4_define([_defopt], m4_default([$1], [auto]))
2224fe567363SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2225fe567363Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2226fe567363Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2227fe567363Smrgm4_undefine([_defopt])
2228fe567363SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2229fe567363SmrgAC_MSG_CHECKING([whether to build unit test cases])
2230fe567363SmrgAC_MSG_RESULT([$enable_unit_tests])
2231fe567363Smrg]) # XORG_ENABLE_UNIT_TESTS
2232fe567363Smrg
2233fe567363Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2234fe567363Smrg# ------------------------------------------------------
2235fe567363Smrg# Minimum version: 1.17.0
2236fe567363Smrg#
2237fe567363Smrg# This macro enables a builder to enable/disable integration testing
2238fe567363Smrg# It makes no assumption about the test cases' implementation
2239fe567363Smrg# Test cases may or may not use Automake "Support for test suites"
2240fe567363Smrg#
2241fe567363Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2242fe567363Smrg# usually requires less dependencies and may be built and run under less
2243fe567363Smrg# stringent environments than integration tests.
2244fe567363Smrg#
2245fe567363Smrg# Interface to module:
2246fe567363Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2247fe567363Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2248fe567363Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2249fe567363Smrg#                             'no' user instructs the module not to build tests
2250fe567363Smrg# parm1:                      specify the default value, yes or no.
2251fe567363Smrg#
2252fe567363SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2253fe567363SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2254fe567363Smrgm4_define([_defopt], m4_default([$1], [auto]))
2255fe567363SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2256fe567363Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2257fe567363Smrg	[enable_integration_tests=$enableval],
2258fe567363Smrg	[enable_integration_tests=]_defopt)
2259fe567363Smrgm4_undefine([_defopt])
2260fe567363SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2261fe567363Smrg	[test "x$enable_integration_tests" != xno])
2262fe567363SmrgAC_MSG_CHECKING([whether to build unit test cases])
2263fe567363SmrgAC_MSG_RESULT([$enable_integration_tests])
2264fe567363Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2265fe567363Smrg
2266fe567363Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2267fe567363Smrg# ----------------------------------------
2268fe567363Smrg# Minimum version: 1.13.0
2269fe567363Smrg#
2270fe567363Smrg# GLib is a library which provides advanced data structures and functions.
2271fe567363Smrg# This macro enables a module to test for the presence of Glib.
2272fe567363Smrg#
2273fe567363Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2274fe567363Smrg# Otherwise the value of $enable_unit_tests is blank.
2275fe567363Smrg#
2276fe567363Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2277fe567363Smrg# test support usually requires less dependencies and may be built and run under
2278fe567363Smrg# less stringent environments than integration tests.
2279fe567363Smrg#
2280fe567363Smrg# Interface to module:
2281fe567363Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2282fe567363Smrg# with_glib: used in configure.ac to know if GLib has been found
2283fe567363Smrg# --with-glib:	'yes' user instructs the module to use glib
2284fe567363Smrg#		'no' user instructs the module not to use glib
2285fe567363Smrg#
2286fe567363SmrgAC_DEFUN([XORG_WITH_GLIB],[
2287fe567363SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2288fe567363Smrgm4_define([_defopt], m4_default([$2], [auto]))
2289fe567363SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2290fe567363Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2291fe567363Smrg	[with_glib=$withval], [with_glib=]_defopt)
2292fe567363Smrgm4_undefine([_defopt])
2293fe567363Smrg
2294fe567363Smrghave_glib=no
2295fe567363Smrg# Do not probe GLib if user explicitly disabled unit testing
2296fe567363Smrgif test "x$enable_unit_tests" != x"no"; then
2297fe567363Smrg  # Do not probe GLib if user explicitly disabled it
2298fe567363Smrg  if test "x$with_glib" != x"no"; then
2299fe567363Smrg    m4_ifval(
2300fe567363Smrg      [$1],
2301fe567363Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2302fe567363Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2303fe567363Smrg    )
2304fe567363Smrg  fi
2305fe567363Smrgfi
2306fe567363Smrg
2307fe567363Smrg# Not having GLib when unit testing has been explicitly requested is an error
2308fe567363Smrgif test "x$enable_unit_tests" = x"yes"; then
2309fe567363Smrg  if test "x$have_glib" = x"no"; then
2310fe567363Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2311fe567363Smrg  fi
2312fe567363Smrgfi
2313fe567363Smrg
2314fe567363Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2315fe567363Smrgif test "x$enable_unit_tests" = x"no"; then
2316fe567363Smrg  if test "x$with_glib" = x"yes"; then
2317fe567363Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2318fe567363Smrg  fi
2319fe567363Smrgfi
2320fe567363Smrg
2321fe567363Smrg# Not having GLib when it has been explicitly requested is an error
2322fe567363Smrgif test "x$with_glib" = x"yes"; then
2323fe567363Smrg  if test "x$have_glib" = x"no"; then
2324fe567363Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2325fe567363Smrg  fi
2326fe567363Smrgfi
2327fe567363Smrg
2328fe567363SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2329fe567363Smrg]) # XORG_WITH_GLIB
2330fe567363Smrg
2331fe567363Smrg# XORG_LD_WRAP([required|optional])
2332fe567363Smrg# ---------------------------------
2333fe567363Smrg# Minimum version: 1.13.0
2334fe567363Smrg#
2335fe567363Smrg# Check if linker supports -wrap, passed via compiler flags
2336fe567363Smrg#
2337fe567363Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2338fe567363Smrg# Otherwise the value of $enable_unit_tests is blank.
2339fe567363Smrg#
2340fe567363Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2341fe567363Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2342fe567363Smrg# available, an argument of "optional" allows use when some unit tests require
2343fe567363Smrg# ld -wrap and others do not.
2344fe567363Smrg#
2345fe567363SmrgAC_DEFUN([XORG_LD_WRAP],[
2346fe567363SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2347fe567363Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2348fe567363Smrg                      void __wrap_exit(int status) { return; }],
2349fe567363Smrg                     [exit(0);])])
2350fe567363Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2351fe567363Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2352fe567363Smrg  if test "x$have_ld_wrap" = x"no"; then
2353fe567363Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2354fe567363Smrg  fi
2355fe567363Smrgfi
2356fe567363SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2357fe567363Smrg#
2358fe567363Smrg]) # XORG_LD_WRAP
2359fe567363Smrg
2360fe567363Smrg# XORG_CHECK_LINKER_FLAGS
2361fe567363Smrg# -----------------------
2362fe567363Smrg# SYNOPSIS
2363fe567363Smrg#
2364fe567363Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2365fe567363Smrg#
2366fe567363Smrg# DESCRIPTION
2367fe567363Smrg#
2368fe567363Smrg#   Check whether the given linker FLAGS work with the current language's
2369fe567363Smrg#   linker, or whether they give an error.
2370fe567363Smrg#
2371fe567363Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2372fe567363Smrg#   success/failure.
2373fe567363Smrg#
2374fe567363Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2375fe567363Smrg#
2376fe567363Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2377fe567363Smrg#
2378fe567363Smrg# LICENSE
2379fe567363Smrg#
2380fe567363Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2381fe567363Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2382fe567363Smrg#   Copyright (c) 2009 Matteo Frigo
2383fe567363Smrg#
2384fe567363Smrg#   This program is free software: you can redistribute it and/or modify it
2385fe567363Smrg#   under the terms of the GNU General Public License as published by the
2386fe567363Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2387fe567363Smrg#   option) any later version.
2388fe567363Smrg#
2389fe567363Smrg#   This program is distributed in the hope that it will be useful, but
2390fe567363Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2391fe567363Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2392fe567363Smrg#   Public License for more details.
2393fe567363Smrg#
2394fe567363Smrg#   You should have received a copy of the GNU General Public License along
2395fe567363Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2396fe567363Smrg#
2397fe567363Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2398fe567363Smrg#   gives unlimited permission to copy, distribute and modify the configure
2399fe567363Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2400fe567363Smrg#   need not follow the terms of the GNU General Public License when using
2401fe567363Smrg#   or distributing such scripts, even though portions of the text of the
2402fe567363Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2403fe567363Smrg#   all other use of the material that constitutes the Autoconf Macro.
2404fe567363Smrg#
2405fe567363Smrg#   This special exception to the GPL applies to versions of the Autoconf
2406fe567363Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2407fe567363Smrg#   modified version of the Autoconf Macro, you may extend this special
2408fe567363Smrg#   exception to the GPL to apply to your modified version as well.#
2409fe567363SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2410fe567363Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2411fe567363Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2412fe567363SmrgAS_LITERAL_IF([$1],
2413fe567363Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2414fe567363Smrg      ax_save_FLAGS=$LDFLAGS
2415fe567363Smrg      LDFLAGS="$1"
2416fe567363Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2417fe567363Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2418fe567363Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2419fe567363Smrg      LDFLAGS=$ax_save_FLAGS])],
2420fe567363Smrg  [ax_save_FLAGS=$LDFLAGS
2421fe567363Smrg   LDFLAGS="$1"
2422fe567363Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2423fe567363Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2424fe567363Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2425fe567363Smrg   LDFLAGS=$ax_save_FLAGS])
2426fe567363Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2427fe567363SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2428fe567363Smrgif test "x$xorg_check_linker_flags" = xyes; then
2429fe567363Smrg	m4_default([$2], :)
2430fe567363Smrgelse
2431fe567363Smrg	m4_default([$3], :)
2432fe567363Smrgfi
2433fe567363Smrg]) # XORG_CHECK_LINKER_FLAGS
2434fe567363Smrg
2435fe567363Smrg# XORG_MEMORY_CHECK_FLAGS
2436fe567363Smrg# -----------------------
2437fe567363Smrg# Minimum version: 1.16.0
2438fe567363Smrg#
2439fe567363Smrg# This macro attempts to find appropriate memory checking functionality
2440fe567363Smrg# for various platforms which unit testing code may use to catch various
2441fe567363Smrg# forms of memory allocation and access errors in testing.
2442fe567363Smrg#
2443fe567363Smrg# Interface to module:
2444fe567363Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2445fe567363Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2446fe567363Smrg#
2447fe567363Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2448fe567363Smrg#
2449fe567363SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2450fe567363Smrg
2451fe567363SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2452fe567363SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2453fe567363Smrg           [Environment variables to enable memory checking in tests])
2454fe567363Smrg
2455fe567363Smrg# Check for different types of support on different platforms
2456fe567363Smrgcase $host_os in
2457fe567363Smrg    solaris*)
2458fe567363Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2459fe567363Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2460fe567363Smrg        ;;
2461fe567363Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2462fe567363Smrg        # both directly and inverted, so should not be 0 or 255.
2463fe567363Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2464fe567363Smrg        ;;
2465fe567363Smrg    darwin*)
2466fe567363Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2467fe567363Smrg        ;;
2468fe567363Smrg    *bsd*)
2469fe567363Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2470fe567363Smrg        ;;
2471fe567363Smrgesac
2472fe567363Smrg
2473fe567363Smrg# User supplied flags override default flags
2474fe567363Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2475fe567363Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2476fe567363Smrgfi
2477fe567363Smrg
2478fe567363SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2479fe567363Smrg]) # XORG_WITH_LINT
2480fe567363Smrg
24818d4c0f7bSmrg# XORG_CHECK_MALLOC_ZERO
24828d4c0f7bSmrg# ----------------------
24838d4c0f7bSmrg# Minimum version: 1.0.0
24848d4c0f7bSmrg#
24858d4c0f7bSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
24868d4c0f7bSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
24878d4c0f7bSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
24888d4c0f7bSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
24898d4c0f7bSmrgAC_ARG_ENABLE(malloc0returnsnull,
2490b53e5eeaSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
24918d4c0f7bSmrg		       [malloc(0) returns NULL (default: auto)]),
24928d4c0f7bSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
24938d4c0f7bSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
24948d4c0f7bSmrg
24958d4c0f7bSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
24968d4c0f7bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2497fe567363Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2498fe567363Smrg#include <stdlib.h>
2499fe567363Smrg],[
25008d4c0f7bSmrg    char *m0, *r0, *c0, *p;
25018d4c0f7bSmrg    m0 = malloc(0);
25028d4c0f7bSmrg    p = malloc(10);
25038d4c0f7bSmrg    r0 = realloc(p,0);
2504fe567363Smrg    c0 = calloc(0,10);
2505fe567363Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2506fe567363Smrg])],
25078d4c0f7bSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2508af928962Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
2509af928962Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
25108d4c0f7bSmrgfi
25118d4c0f7bSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
25128d4c0f7bSmrg
25138d4c0f7bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
25148d4c0f7bSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
25158d4c0f7bSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
25168d4c0f7bSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
25178d4c0f7bSmrgelse
25188d4c0f7bSmrg	MALLOC_ZERO_CFLAGS=""
25198d4c0f7bSmrg	XMALLOC_ZERO_CFLAGS=""
25208d4c0f7bSmrg	XTMALLOC_ZERO_CFLAGS=""
25218d4c0f7bSmrgfi
25228d4c0f7bSmrg
25238d4c0f7bSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
25248d4c0f7bSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
25258d4c0f7bSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
25268d4c0f7bSmrg]) # XORG_CHECK_MALLOC_ZERO
25278d4c0f7bSmrg
25288d4c0f7bSmrg# XORG_WITH_LINT()
25298d4c0f7bSmrg# ----------------
25308d4c0f7bSmrg# Minimum version: 1.1.0
25318d4c0f7bSmrg#
2532af928962Smrg# This macro enables the use of a tool that flags some suspicious and
2533af928962Smrg# non-portable constructs (likely to be bugs) in C language source code.
2534af928962Smrg# It will attempt to locate the tool and use appropriate options.
2535af928962Smrg# There are various lint type tools on different platforms.
2536af928962Smrg#
2537af928962Smrg# Interface to module:
2538af928962Smrg# LINT:		returns the path to the tool found on the platform
2539af928962Smrg#		or the value set to LINT on the configure cmd line
2540af928962Smrg#		also an Automake conditional
2541af928962Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2542af928962Smrg#
2543af928962Smrg# --with-lint:	'yes' user instructs the module to use lint
2544af928962Smrg#		'no' user instructs the module not to use lint (default)
2545af928962Smrg#
2546af928962Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2547af928962Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
25488d4c0f7bSmrg#
25498d4c0f7bSmrgAC_DEFUN([XORG_WITH_LINT],[
25508d4c0f7bSmrg
2551af928962SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2552af928962SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2553b53e5eeaSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
25548d4c0f7bSmrg		[Use a lint-style source code checker (default: disabled)])],
25558d4c0f7bSmrg		[use_lint=$withval], [use_lint=no])
2556af928962Smrg
2557af928962Smrg# Obtain platform specific info like program name and options
2558af928962Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2559af928962Smrgcase $host_os in
2560af928962Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2561af928962Smrg	lint_name=splint
2562af928962Smrg	lint_options="-badflag"
2563af928962Smrg	;;
2564af928962Smrg  *freebsd* | *netbsd*)
2565af928962Smrg	lint_name=lint
2566af928962Smrg	lint_options="-u -b"
2567af928962Smrg	;;
2568af928962Smrg  *solaris*)
2569af928962Smrg	lint_name=lint
2570af928962Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2571af928962Smrg	;;
2572af928962Smrgesac
2573af928962Smrg
2574af928962Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2575af928962Smrgif test "x$use_lint" = x"yes" ; then
2576af928962Smrg   AC_PATH_PROG([LINT], [$lint_name])
2577af928962Smrg   if test "x$LINT" = "x"; then
2578af928962Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2579af928962Smrg   fi
2580af928962Smrgelif test "x$use_lint" = x"no" ; then
2581af928962Smrg   if test "x$LINT" != "x"; then
2582af928962Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2583af928962Smrg   fi
25848d4c0f7bSmrgelse
2585af928962Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
25868d4c0f7bSmrgfi
2587af928962Smrg
2588af928962Smrg# User supplied flags override default flags
2589af928962Smrgif test "x$LINT_FLAGS" != "x"; then
2590af928962Smrg   lint_options=$LINT_FLAGS
25918d4c0f7bSmrgfi
25928d4c0f7bSmrg
2593af928962SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2594af928962SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
25958d4c0f7bSmrg
25968d4c0f7bSmrg]) # XORG_WITH_LINT
25978d4c0f7bSmrg
25988d4c0f7bSmrg# XORG_LINT_LIBRARY(LIBNAME)
25998d4c0f7bSmrg# --------------------------
26008d4c0f7bSmrg# Minimum version: 1.1.0
26018d4c0f7bSmrg#
26028d4c0f7bSmrg# Sets up flags for building lint libraries for checking programs that call
26038d4c0f7bSmrg# functions in the library.
26048d4c0f7bSmrg#
2605af928962Smrg# Interface to module:
2606af928962Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2607af928962Smrg# MAKE_LINT_LIB		- Automake conditional
2608af928962Smrg#
2609af928962Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2610af928962Smrg#			  - 'no' user instructs the module not to create a lint library (default)
26118d4c0f7bSmrg
26128d4c0f7bSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
26138d4c0f7bSmrgAC_REQUIRE([XORG_WITH_LINT])
2614b53e5eeaSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
26158d4c0f7bSmrg	[Create lint library (default: disabled)])],
26168d4c0f7bSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2617af928962Smrg
2618af928962Smrgif test "x$make_lint_lib" = x"yes" ; then
2619af928962Smrg   LINTLIB=llib-l$1.ln
2620af928962Smrg   if test "x$LINT" = "x"; then
2621af928962Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2622af928962Smrg   fi
2623af928962Smrgelif test "x$make_lint_lib" != x"no" ; then
2624af928962Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
26258d4c0f7bSmrgfi
2626af928962Smrg
26278d4c0f7bSmrgAC_SUBST(LINTLIB)
26288d4c0f7bSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
26298d4c0f7bSmrg
26308d4c0f7bSmrg]) # XORG_LINT_LIBRARY
26318d4c0f7bSmrg
2632fe567363Smrg# XORG_COMPILER_BRAND
2633fe567363Smrg# -------------------
2634fe567363Smrg# Minimum version: 1.14.0
2635fe567363Smrg#
2636fe567363Smrg# Checks for various brands of compilers and sets flags as appropriate:
2637fe567363Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2638fe567363Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2639fe567363Smrg#   clang compiler - sets CLANGCC to "yes"
2640fe567363Smrg#   Intel compiler - sets INTELCC to "yes"
2641fe567363Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2642fe567363Smrg#
2643fe567363SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2644fe567363SmrgAC_LANG_CASE(
2645fe567363Smrg	[C], [
2646fe567363Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2647fe567363Smrg	],
2648fe567363Smrg	[C++], [
2649fe567363Smrg		AC_REQUIRE([AC_PROG_CXX])
2650fe567363Smrg	]
2651fe567363Smrg)
2652fe567363SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2653fe567363SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2654fe567363SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2655fe567363Smrg]) # XORG_COMPILER_BRAND
2656fe567363Smrg
2657fe567363Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2658fe567363Smrg# ---------------
2659fe567363Smrg# Minimum version: 1.16.0
2660fe567363Smrg#
2661fe567363Smrg# Test if the compiler works when passed the given flag as a command line argument.
2662fe567363Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2663fe567363Smrg# next flag in the list until there are no more options.
2664fe567363Smrg#
2665fe567363Smrg# Note that this does not guarantee that the compiler supports the flag as some
2666fe567363Smrg# compilers will simply ignore arguments that they do not understand, but we do
2667fe567363Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2668fe567363Smrg# -Werror=unused-command-line-argument
2669fe567363Smrg#
2670fe567363SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2671fe567363Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2672fe567363Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2673fe567363Smrg
2674fe567363SmrgAC_LANG_COMPILER_REQUIRE
2675fe567363Smrg
2676fe567363SmrgAC_LANG_CASE(
2677fe567363Smrg	[C], [
2678fe567363Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2679fe567363Smrg		define([PREFIX], [C])
2680fe567363Smrg		define([CACHE_PREFIX], [cc])
2681fe567363Smrg		define([COMPILER], [$CC])
2682fe567363Smrg	],
2683fe567363Smrg	[C++], [
2684fe567363Smrg		define([PREFIX], [CXX])
2685fe567363Smrg		define([CACHE_PREFIX], [cxx])
2686fe567363Smrg		define([COMPILER], [$CXX])
2687fe567363Smrg	]
2688fe567363Smrg)
2689fe567363Smrg
2690fe567363Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2691fe567363Smrg
2692fe567363Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2693fe567363Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2694fe567363Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2695fe567363Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2696fe567363Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2697fe567363Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2698fe567363Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2699fe567363Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2700fe567363Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2701fe567363Smrgfi
2702fe567363Smrg
2703fe567363Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2704fe567363Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2705fe567363Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2706fe567363Smrg	fi
2707fe567363Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2708fe567363Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2709fe567363Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2710fe567363Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2711fe567363Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2712fe567363Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2713fe567363Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2714fe567363Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2715fe567363Smrgfi
2716fe567363Smrg
2717fe567363Smrgfound="no"
2718fe567363Smrgm4_foreach([flag], m4_cdr($@), [
2719fe567363Smrg	if test $found = "no" ; then
2720fe567363Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2721fe567363Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2722fe567363Smrg		fi
2723fe567363Smrg
2724fe567363Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2725fe567363Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2726fe567363Smrg		fi
2727fe567363Smrg
2728fe567363Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2729fe567363Smrg
2730fe567363Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2731fe567363Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports]flag[])
2732fe567363Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2733fe567363Smrg		AC_CACHE_VAL($cacheid,
2734fe567363Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2735fe567363Smrg					     [eval $cacheid=yes],
2736fe567363Smrg					     [eval $cacheid=no])])
2737fe567363Smrg
2738fe567363Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2739fe567363Smrg
2740fe567363Smrg		eval supported=\$$cacheid
2741fe567363Smrg		AC_MSG_RESULT([$supported])
2742fe567363Smrg		if test "$supported" = "yes" ; then
2743fe567363Smrg			$1="$$1 ]flag["
2744fe567363Smrg			found="yes"
2745fe567363Smrg		fi
2746fe567363Smrg	fi
2747fe567363Smrg])
2748fe567363Smrg]) # XORG_TESTSET_CFLAG
2749fe567363Smrg
2750fe567363Smrg# XORG_COMPILER_FLAGS
2751fe567363Smrg# ---------------
2752fe567363Smrg# Minimum version: 1.16.0
2753fe567363Smrg#
2754fe567363Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2755fe567363Smrg# arguments supported by the selected compiler which do NOT alter the generated
2756fe567363Smrg# code.  These arguments will cause the compiler to print various warnings
2757fe567363Smrg# during compilation AND turn a conservative set of warnings into errors.
2758fe567363Smrg#
2759fe567363Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2760fe567363Smrg# future versions of util-macros as options are added to new compilers.
2761fe567363Smrg#
2762fe567363SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2763fe567363SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2764fe567363Smrg
2765fe567363SmrgAC_ARG_ENABLE(selective-werror,
2766fe567363Smrg              AS_HELP_STRING([--disable-selective-werror],
2767fe567363Smrg                             [Turn off selective compiler errors. (default: enabled)]),
2768fe567363Smrg              [SELECTIVE_WERROR=$enableval],
2769fe567363Smrg              [SELECTIVE_WERROR=yes])
2770fe567363Smrg
2771fe567363SmrgAC_LANG_CASE(
2772fe567363Smrg        [C], [
2773fe567363Smrg                define([PREFIX], [C])
2774fe567363Smrg        ],
2775fe567363Smrg        [C++], [
2776fe567363Smrg                define([PREFIX], [CXX])
2777fe567363Smrg        ]
2778fe567363Smrg)
2779fe567363Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2780fe567363Smrgif test "x$SUNCC" = "xyes"; then
2781fe567363Smrg    [BASE_]PREFIX[FLAGS]="-v"
2782fe567363Smrgelse
2783fe567363Smrg    [BASE_]PREFIX[FLAGS]=""
2784fe567363Smrgfi
2785fe567363Smrg
2786fe567363Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2787fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2788fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2789fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2790fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2791fe567363Smrg
2792fe567363SmrgAC_LANG_CASE(
2793fe567363Smrg	[C], [
2794fe567363Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2795fe567363Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2796fe567363Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2797fe567363Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2798fe567363Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2799fe567363Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2800fe567363Smrg	]
2801fe567363Smrg)
2802fe567363Smrg
2803fe567363Smrg# This chunk adds additional warnings that could catch undesired effects.
2804fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2805fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2806fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2807fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2808fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2809fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2810fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2811fe567363Smrg
2812fe567363Smrg# These are currently disabled because they are noisy.  They will be enabled
2813fe567363Smrg# in the future once the codebase is sufficiently modernized to silence
2814fe567363Smrg# them.  For now, I don't want them to drown out the other warnings.
2815fe567363Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2816fe567363Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2817fe567363Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2818fe567363Smrg
2819fe567363Smrg# Turn some warnings into errors, so we don't accidently get successful builds
2820fe567363Smrg# when there are problems that should be fixed.
2821fe567363Smrg
2822fe567363Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2823fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2824fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2825fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2826fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2827fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2828fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2829fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2830fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2831fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2832fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2833fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2834fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2835fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2836fe567363Smrgelse
2837fe567363SmrgAC_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])
2838fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2839fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2840fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2841fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2842fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2843fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2844fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2845fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2846fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2847fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2848fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2849fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2850fe567363SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2851fe567363Smrgfi
2852fe567363Smrg
2853fe567363SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2854fe567363Smrg]) # XORG_COMPILER_FLAGS
2855fe567363Smrg
28568d4c0f7bSmrg# XORG_CWARNFLAGS
28578d4c0f7bSmrg# ---------------
28588d4c0f7bSmrg# Minimum version: 1.2.0
2859fe567363Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
28608d4c0f7bSmrg#
28618d4c0f7bSmrg# Defines CWARNFLAGS to enable C compiler warnings.
28628d4c0f7bSmrg#
2863fe567363Smrg# This function is deprecated because it defines -fno-strict-aliasing
2864fe567363Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2865fe567363Smrg# is needed, then it should be added explicitly in the module when
2866fe567363Smrg# it is updated to use BASE_CFLAGS.
2867fe567363Smrg#
28688d4c0f7bSmrgAC_DEFUN([XORG_CWARNFLAGS], [
2869fe567363SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2870fe567363SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2871fe567363SmrgAC_LANG_CASE(
2872fe567363Smrg	[C], [
2873fe567363Smrg		CWARNFLAGS="$BASE_CFLAGS"
2874fe567363Smrg		if  test "x$GCC" = xyes ; then
2875fe567363Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2876fe567363Smrg		fi
2877fe567363Smrg		AC_SUBST(CWARNFLAGS)
2878fe567363Smrg	]
2879fe567363Smrg)
28808d4c0f7bSmrg]) # XORG_CWARNFLAGS
2881b53e5eeaSmrg
2882b53e5eeaSmrg# XORG_STRICT_OPTION
2883b53e5eeaSmrg# -----------------------
2884b53e5eeaSmrg# Minimum version: 1.3.0
2885b53e5eeaSmrg#
2886fe567363Smrg# Add configure option to enable strict compilation flags, such as treating
2887fe567363Smrg# warnings as fatal errors.
2888fe567363Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2889fe567363Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2890fe567363Smrg#
2891fe567363Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2892fe567363Smrg# when strict compilation is unconditionally desired.
2893b53e5eeaSmrgAC_DEFUN([XORG_STRICT_OPTION], [
2894b53e5eeaSmrgAC_REQUIRE([XORG_CWARNFLAGS])
2895fe567363SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2896b53e5eeaSmrg
2897b53e5eeaSmrgAC_ARG_ENABLE(strict-compilation,
2898b53e5eeaSmrg			  AS_HELP_STRING([--enable-strict-compilation],
2899b53e5eeaSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2900b53e5eeaSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2901fe567363Smrg
2902fe567363SmrgAC_LANG_CASE(
2903fe567363Smrg        [C], [
2904fe567363Smrg                define([PREFIX], [C])
2905fe567363Smrg        ],
2906fe567363Smrg        [C++], [
2907fe567363Smrg                define([PREFIX], [CXX])
2908fe567363Smrg        ]
2909fe567363Smrg)
2910fe567363Smrg
2911fe567363Smrg[STRICT_]PREFIX[FLAGS]=""
2912fe567363SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2913fe567363SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2914fe567363Smrg
2915fe567363Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2916fe567363Smrg# activate it with -Werror, so we add it here explicitly.
2917fe567363SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2918fe567363Smrg
2919b53e5eeaSmrgif test "x$STRICT_COMPILE" = "xyes"; then
2920fe567363Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2921fe567363Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2922b53e5eeaSmrgfi
2923fe567363SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2924fe567363SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2925fe567363SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2926b53e5eeaSmrg]) # XORG_STRICT_OPTION
2927b53e5eeaSmrg
2928b53e5eeaSmrg# XORG_DEFAULT_OPTIONS
2929b53e5eeaSmrg# --------------------
2930b53e5eeaSmrg# Minimum version: 1.3.0
2931b53e5eeaSmrg#
2932b53e5eeaSmrg# Defines default options for X.Org modules.
2933b53e5eeaSmrg#
2934b53e5eeaSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2935af928962SmrgAC_REQUIRE([AC_PROG_INSTALL])
2936fe567363SmrgXORG_COMPILER_FLAGS
2937b53e5eeaSmrgXORG_CWARNFLAGS
2938b53e5eeaSmrgXORG_STRICT_OPTION
2939b53e5eeaSmrgXORG_RELEASE_VERSION
2940b53e5eeaSmrgXORG_CHANGELOG
2941af928962SmrgXORG_INSTALL
2942b53e5eeaSmrgXORG_MANPAGE_SECTIONS
2943af928962Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2944af928962Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2945b53e5eeaSmrg]) # XORG_DEFAULT_OPTIONS
2946af928962Smrg
2947af928962Smrg# XORG_INSTALL()
2948af928962Smrg# ----------------
2949af928962Smrg# Minimum version: 1.4.0
2950af928962Smrg#
2951af928962Smrg# Defines the variable INSTALL_CMD as the command to copy
2952af928962Smrg# INSTALL from $prefix/share/util-macros.
2953af928962Smrg#
2954af928962SmrgAC_DEFUN([XORG_INSTALL], [
2955af928962SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2956af928962Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2957af928962SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2958af928962Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2959af928962Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2960af928962Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2961af928962SmrgAC_SUBST([INSTALL_CMD])
2962af928962Smrg]) # XORG_INSTALL
29638d4c0f7bSmrgdnl Copyright 2005 Red Hat, Inc
29648d4c0f7bSmrgdnl
29658d4c0f7bSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
29668d4c0f7bSmrgdnl documentation for any purpose is hereby granted without fee, provided that
29678d4c0f7bSmrgdnl the above copyright notice appear in all copies and that both that
29688d4c0f7bSmrgdnl copyright notice and this permission notice appear in supporting
29698d4c0f7bSmrgdnl documentation.
29708d4c0f7bSmrgdnl
29718d4c0f7bSmrgdnl The above copyright notice and this permission notice shall be included
29728d4c0f7bSmrgdnl in all copies or substantial portions of the Software.
29738d4c0f7bSmrgdnl
29748d4c0f7bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
29758d4c0f7bSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29768d4c0f7bSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
29778d4c0f7bSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
29788d4c0f7bSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
29798d4c0f7bSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29808d4c0f7bSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
29818d4c0f7bSmrgdnl
29828d4c0f7bSmrgdnl Except as contained in this notice, the name of the copyright holders shall
29838d4c0f7bSmrgdnl not be used in advertising or otherwise to promote the sale, use or
29848d4c0f7bSmrgdnl other dealings in this Software without prior written authorization
29858d4c0f7bSmrgdnl from the copyright holders.
29868d4c0f7bSmrgdnl
29878d4c0f7bSmrg
29888d4c0f7bSmrg# XORG_RELEASE_VERSION
29898d4c0f7bSmrg# --------------------
2990af928962Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
29918d4c0f7bSmrg 
29928d4c0f7bSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
29938d4c0f7bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
29948d4c0f7bSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
29958d4c0f7bSmrg		[Major version of this package])
29968d4c0f7bSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
29978d4c0f7bSmrg	if test "x$PVM" = "x"; then
29988d4c0f7bSmrg		PVM="0"
29998d4c0f7bSmrg	fi
30008d4c0f7bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
30018d4c0f7bSmrg		[$PVM],
30028d4c0f7bSmrg		[Minor version of this package])
30038d4c0f7bSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
30048d4c0f7bSmrg	if test "x$PVP" = "x"; then
30058d4c0f7bSmrg		PVP="0"
30068d4c0f7bSmrg	fi
30078d4c0f7bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
30088d4c0f7bSmrg		[$PVP],
30098d4c0f7bSmrg		[Patch version of this package])
30108d4c0f7bSmrg])
30118d4c0f7bSmrg
30128d4c0f7bSmrg# XORG_CHANGELOG()
30138d4c0f7bSmrg# ----------------
30148d4c0f7bSmrg# Minimum version: 1.2.0
30158d4c0f7bSmrg#
30168d4c0f7bSmrg# Defines the variable CHANGELOG_CMD as the command to generate
30178d4c0f7bSmrg# ChangeLog from git.
30188d4c0f7bSmrg#
30198d4c0f7bSmrg#
30208d4c0f7bSmrgAC_DEFUN([XORG_CHANGELOG], [
3021af928962SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3022af928962Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3023af928962Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
30248d4c0f7bSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
30258d4c0f7bSmrgAC_SUBST([CHANGELOG_CMD])
30268d4c0f7bSmrg]) # XORG_CHANGELOG
30278d4c0f7bSmrg
3028