aclocal.m4 revision b6f5cd12
1b6f5cd12Smrg# generated automatically by aclocal 1.13.2 -*- Autoconf -*-
2b6f5cd12Smrg
3b6f5cd12Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
41e00de39Smrg
51e00de39Smrg# This file is free software; the Free Software Foundation
61e00de39Smrg# gives unlimited permission to copy and/or distribute it,
71e00de39Smrg# with or without modifications, as long as this notice is preserved.
81e00de39Smrg
91e00de39Smrg# This program is distributed in the hope that it will be useful,
101e00de39Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
111e00de39Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
121e00de39Smrg# PARTICULAR PURPOSE.
131e00de39Smrg
14b6f5cd12Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
151e00de39Smrgm4_ifndef([AC_AUTOCONF_VERSION],
161e00de39Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17604a4f4cSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
18604a4f4cSmrg[m4_warning([this file was generated for autoconf 2.68.
191e00de39SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
201e00de39SmrgIf you have problems, you may need to regenerate the build system entirely.
21b6f5cd12SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
221e00de39Smrg
23b6f5cd12Smrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
241e00de39Smrg#
2521ecb1efSmrg# This file is free software; the Free Software Foundation
2621ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
2721ecb1efSmrg# with or without modifications, as long as this notice is preserved.
281e00de39Smrg
2921ecb1efSmrg# AM_AUTOMAKE_VERSION(VERSION)
3021ecb1efSmrg# ----------------------------
3121ecb1efSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3221ecb1efSmrg# generated from the m4 files accompanying Automake X.Y.
3321ecb1efSmrg# (This private macro should not be called outside this file.)
3421ecb1efSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35b6f5cd12Smrg[am__api_version='1.13'
3621ecb1efSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3721ecb1efSmrgdnl require some minimum version.  Point them to the right macro.
38b6f5cd12Smrgm4_if([$1], [1.13.2], [],
3921ecb1efSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4021ecb1efSmrg])
411e00de39Smrg
4221ecb1efSmrg# _AM_AUTOCONF_VERSION(VERSION)
4321ecb1efSmrg# -----------------------------
4421ecb1efSmrg# aclocal traces this macro to find the Autoconf version.
4521ecb1efSmrg# This is a private macro too.  Using m4_define simplifies
4621ecb1efSmrg# the logic in aclocal, which can simply ignore this definition.
4721ecb1efSmrgm4_define([_AM_AUTOCONF_VERSION], [])
481e00de39Smrg
4921ecb1efSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5021ecb1efSmrg# -------------------------------
5121ecb1efSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5221ecb1efSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5321ecb1efSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54b6f5cd12Smrg[AM_AUTOMAKE_VERSION([1.13.2])dnl
5521ecb1efSmrgm4_ifndef([AC_AUTOCONF_VERSION],
5621ecb1efSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5721ecb1efSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
581e00de39Smrg
5921ecb1efSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
601e00de39Smrg
61b6f5cd12Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6221ecb1efSmrg#
6321ecb1efSmrg# This file is free software; the Free Software Foundation
6421ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
6521ecb1efSmrg# with or without modifications, as long as this notice is preserved.
661e00de39Smrg
6721ecb1efSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68b6f5cd12Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69b6f5cd12Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
701e00de39Smrg#
7121ecb1efSmrg# Of course, Automake must honor this variable whenever it calls a
7221ecb1efSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7321ecb1efSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7421ecb1efSmrg# depending on how configure is run.  This is pretty annoying, since
7521ecb1efSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7621ecb1efSmrg# source directory, any form will work fine, but in subdirectories a
7721ecb1efSmrg# relative path needs to be adjusted first.
781e00de39Smrg#
7921ecb1efSmrg# $ac_aux_dir/missing
8021ecb1efSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8121ecb1efSmrg# $top_srcdir/$ac_aux_dir/missing
8221ecb1efSmrg#    fails if $ac_aux_dir is absolute,
8321ecb1efSmrg#    fails when called from a subdirectory in a VPATH build with
8421ecb1efSmrg#          a relative $ac_aux_dir
851e00de39Smrg#
8621ecb1efSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8721ecb1efSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
88b6f5cd12Smrg# harmless because $srcdir is '.', but things will broke when you
8921ecb1efSmrg# start a VPATH build or use an absolute $srcdir.
901e00de39Smrg#
9121ecb1efSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9221ecb1efSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9321ecb1efSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9421ecb1efSmrg# and then we would define $MISSING as
9521ecb1efSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9621ecb1efSmrg# This will work as long as MISSING is not called from configure, because
9721ecb1efSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9821ecb1efSmrg# However there are other variables, like CC, which are often used in
9921ecb1efSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10021ecb1efSmrg#
10121ecb1efSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10221ecb1efSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10321ecb1efSmrg# configured tree to be moved without reconfiguration.
1041e00de39Smrg
10521ecb1efSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10621ecb1efSmrg[dnl Rely on autoconf to set up CDPATH properly.
10721ecb1efSmrgAC_PREREQ([2.50])dnl
10821ecb1efSmrg# expand $ac_aux_dir to an absolute path
10921ecb1efSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
11021ecb1efSmrg])
1111e00de39Smrg
11221ecb1efSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1131e00de39Smrg
114b6f5cd12Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
11521ecb1efSmrg#
11621ecb1efSmrg# This file is free software; the Free Software Foundation
11721ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
11821ecb1efSmrg# with or without modifications, as long as this notice is preserved.
1191e00de39Smrg
12021ecb1efSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12121ecb1efSmrg# -------------------------------------
12221ecb1efSmrg# Define a conditional.
12321ecb1efSmrgAC_DEFUN([AM_CONDITIONAL],
124b6f5cd12Smrg[AC_PREREQ([2.52])dnl
125b6f5cd12Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
126b6f5cd12Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12721ecb1efSmrgAC_SUBST([$1_TRUE])dnl
12821ecb1efSmrgAC_SUBST([$1_FALSE])dnl
12921ecb1efSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
13021ecb1efSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13121ecb1efSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13221ecb1efSmrgif $2; then
13321ecb1efSmrg  $1_TRUE=
13421ecb1efSmrg  $1_FALSE='#'
13521ecb1efSmrgelse
13621ecb1efSmrg  $1_TRUE='#'
13721ecb1efSmrg  $1_FALSE=
13821ecb1efSmrgfi
13921ecb1efSmrgAC_CONFIG_COMMANDS_PRE(
14021ecb1efSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14121ecb1efSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14221ecb1efSmrgUsually this means the macro was only invoked conditionally.]])
14321ecb1efSmrgfi])])
1441e00de39Smrg
145b6f5cd12Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
14621ecb1efSmrg#
14721ecb1efSmrg# This file is free software; the Free Software Foundation
14821ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
14921ecb1efSmrg# with or without modifications, as long as this notice is preserved.
1501e00de39Smrg
1511e00de39Smrg
152b6f5cd12Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15321ecb1efSmrg# written in clear, in which case automake, when reading aclocal.m4,
15421ecb1efSmrg# will think it sees a *use*, and therefore will trigger all it's
15521ecb1efSmrg# C support machinery.  Also note that it means that autoscan, seeing
15621ecb1efSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1571e00de39Smrg
1581e00de39Smrg
15921ecb1efSmrg# _AM_DEPENDENCIES(NAME)
16021ecb1efSmrg# ----------------------
16121ecb1efSmrg# See how the compiler implements dependency checking.
162b6f5cd12Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16321ecb1efSmrg# We try a few techniques and use that to set a single cache variable.
1641e00de39Smrg#
16521ecb1efSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16621ecb1efSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16721ecb1efSmrg# dependency, and given that the user is not expected to run this macro,
16821ecb1efSmrg# just rely on AC_PROG_CC.
16921ecb1efSmrgAC_DEFUN([_AM_DEPENDENCIES],
17021ecb1efSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17121ecb1efSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17221ecb1efSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17321ecb1efSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1741e00de39Smrg
175b6f5cd12Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
176b6f5cd12Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
177b6f5cd12Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
178b6f5cd12Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
179b6f5cd12Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
180b6f5cd12Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
181b6f5cd12Smrg                    [depcc="$$1"   am_compiler_list=])
1821e00de39Smrg
18321ecb1efSmrgAC_CACHE_CHECK([dependency style of $depcc],
18421ecb1efSmrg               [am_cv_$1_dependencies_compiler_type],
18521ecb1efSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18621ecb1efSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
18721ecb1efSmrg  # making bogus files that we don't know about and never remove.  For
18821ecb1efSmrg  # instance it was reported that on HP-UX the gcc test will end up
189b6f5cd12Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
190b6f5cd12Smrg  # in D".
191b6f5cd12Smrg  rm -rf conftest.dir
19221ecb1efSmrg  mkdir conftest.dir
19321ecb1efSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19421ecb1efSmrg  # using a relative directory.
19521ecb1efSmrg  cp "$am_depcomp" conftest.dir
19621ecb1efSmrg  cd conftest.dir
19721ecb1efSmrg  # We will build objects and dependencies in a subdirectory because
19821ecb1efSmrg  # it helps to detect inapplicable dependency modes.  For instance
19921ecb1efSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
20021ecb1efSmrg  # side effect of compilation, but ICC will put the dependencies in
20121ecb1efSmrg  # the current directory while Tru64 will put them in the object
20221ecb1efSmrg  # directory.
20321ecb1efSmrg  mkdir sub
20421ecb1efSmrg
20521ecb1efSmrg  am_cv_$1_dependencies_compiler_type=none
20621ecb1efSmrg  if test "$am_compiler_list" = ""; then
20721ecb1efSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20821ecb1efSmrg  fi
20921ecb1efSmrg  am__universal=false
21021ecb1efSmrg  m4_case([$1], [CC],
21121ecb1efSmrg    [case " $depcc " in #(
21221ecb1efSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21321ecb1efSmrg     esac],
21421ecb1efSmrg    [CXX],
21521ecb1efSmrg    [case " $depcc " in #(
21621ecb1efSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21721ecb1efSmrg     esac])
21821ecb1efSmrg
21921ecb1efSmrg  for depmode in $am_compiler_list; do
22021ecb1efSmrg    # Setup a source with many dependencies, because some compilers
22121ecb1efSmrg    # like to wrap large dependency lists on column 80 (with \), and
22221ecb1efSmrg    # we should not choose a depcomp mode which is confused by this.
22321ecb1efSmrg    #
22421ecb1efSmrg    # We need to recreate these files for each test, as the compiler may
22521ecb1efSmrg    # overwrite some of them when testing with obscure command lines.
22621ecb1efSmrg    # This happens at least with the AIX C compiler.
22721ecb1efSmrg    : > sub/conftest.c
22821ecb1efSmrg    for i in 1 2 3 4 5 6; do
22921ecb1efSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
230b6f5cd12Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
231b6f5cd12Smrg      # Solaris 10 /bin/sh.
232b6f5cd12Smrg      echo '/* dummy */' > sub/conftst$i.h
23321ecb1efSmrg    done
23421ecb1efSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23521ecb1efSmrg
236b6f5cd12Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23721ecb1efSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
238b6f5cd12Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
239b6f5cd12Smrg    # versions had trouble with output in subdirs.
24021ecb1efSmrg    am__obj=sub/conftest.${OBJEXT-o}
24121ecb1efSmrg    am__minus_obj="-o $am__obj"
24221ecb1efSmrg    case $depmode in
24321ecb1efSmrg    gcc)
24421ecb1efSmrg      # This depmode causes a compiler race in universal mode.
24521ecb1efSmrg      test "$am__universal" = false || continue
24621ecb1efSmrg      ;;
24721ecb1efSmrg    nosideeffect)
248b6f5cd12Smrg      # After this tag, mechanisms are not by side-effect, so they'll
249b6f5cd12Smrg      # only be used when explicitly requested.
25021ecb1efSmrg      if test "x$enable_dependency_tracking" = xyes; then
25121ecb1efSmrg	continue
25221ecb1efSmrg      else
25321ecb1efSmrg	break
25421ecb1efSmrg      fi
25521ecb1efSmrg      ;;
256b6f5cd12Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
257b6f5cd12Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25821ecb1efSmrg      # not run yet.  These depmodes are late enough in the game, and
25921ecb1efSmrg      # so weak that their functioning should not be impacted.
26021ecb1efSmrg      am__obj=conftest.${OBJEXT-o}
26121ecb1efSmrg      am__minus_obj=
26221ecb1efSmrg      ;;
26321ecb1efSmrg    none) break ;;
26421ecb1efSmrg    esac
26521ecb1efSmrg    if depmode=$depmode \
26621ecb1efSmrg       source=sub/conftest.c object=$am__obj \
26721ecb1efSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26821ecb1efSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26921ecb1efSmrg         >/dev/null 2>conftest.err &&
27021ecb1efSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27121ecb1efSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27221ecb1efSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27321ecb1efSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27421ecb1efSmrg      # icc doesn't choke on unknown options, it will just issue warnings
27521ecb1efSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
27621ecb1efSmrg      # that says an option was ignored or not supported.
27721ecb1efSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27821ecb1efSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27921ecb1efSmrg      # The diagnosis changed in icc 8.0:
28021ecb1efSmrg      #   icc: Command line remark: option '-MP' not supported
28121ecb1efSmrg      if (grep 'ignoring option' conftest.err ||
28221ecb1efSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28321ecb1efSmrg        am_cv_$1_dependencies_compiler_type=$depmode
28421ecb1efSmrg        break
28521ecb1efSmrg      fi
28621ecb1efSmrg    fi
28721ecb1efSmrg  done
28821ecb1efSmrg
28921ecb1efSmrg  cd ..
29021ecb1efSmrg  rm -rf conftest.dir
2911e00de39Smrgelse
29221ecb1efSmrg  am_cv_$1_dependencies_compiler_type=none
2931e00de39Smrgfi
29421ecb1efSmrg])
29521ecb1efSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29621ecb1efSmrgAM_CONDITIONAL([am__fastdep$1], [
29721ecb1efSmrg  test "x$enable_dependency_tracking" != xno \
29821ecb1efSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29921ecb1efSmrg])
3001e00de39Smrg
30121ecb1efSmrg
30221ecb1efSmrg# AM_SET_DEPDIR
30321ecb1efSmrg# -------------
30421ecb1efSmrg# Choose a directory name for dependency files.
305b6f5cd12Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30621ecb1efSmrgAC_DEFUN([AM_SET_DEPDIR],
30721ecb1efSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30821ecb1efSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30921ecb1efSmrg])
31021ecb1efSmrg
31121ecb1efSmrg
31221ecb1efSmrg# AM_DEP_TRACK
31321ecb1efSmrg# ------------
31421ecb1efSmrgAC_DEFUN([AM_DEP_TRACK],
315b6f5cd12Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
316b6f5cd12SmrgAS_HELP_STRING(
317b6f5cd12Smrg  [--enable-dependency-tracking],
318b6f5cd12Smrg  [do not reject slow dependency extractors])
319b6f5cd12SmrgAS_HELP_STRING(
320b6f5cd12Smrg  [--disable-dependency-tracking],
321b6f5cd12Smrg  [speeds up one-time build])])
32221ecb1efSmrgif test "x$enable_dependency_tracking" != xno; then
32321ecb1efSmrg  am_depcomp="$ac_aux_dir/depcomp"
32421ecb1efSmrg  AMDEPBACKSLASH='\'
325b6f5cd12Smrg  am__nodep='_no'
3261e00de39Smrgfi
32721ecb1efSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32821ecb1efSmrgAC_SUBST([AMDEPBACKSLASH])dnl
32921ecb1efSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
330b6f5cd12SmrgAC_SUBST([am__nodep])dnl
331b6f5cd12Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33221ecb1efSmrg])
3331e00de39Smrg
33421ecb1efSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33521ecb1efSmrg
336b6f5cd12Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
3371e00de39Smrg#
33821ecb1efSmrg# This file is free software; the Free Software Foundation
33921ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
34021ecb1efSmrg# with or without modifications, as long as this notice is preserved.
3411e00de39Smrg
3421e00de39Smrg
34321ecb1efSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34421ecb1efSmrg# ------------------------------
34521ecb1efSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34621ecb1efSmrg[{
347b6f5cd12Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34821ecb1efSmrg  # are listed without --file.  Let's play safe and only enable the eval
34921ecb1efSmrg  # if we detect the quoting.
35021ecb1efSmrg  case $CONFIG_FILES in
35121ecb1efSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
35221ecb1efSmrg  *)   set x $CONFIG_FILES ;;
35321ecb1efSmrg  esac
35421ecb1efSmrg  shift
35521ecb1efSmrg  for mf
35621ecb1efSmrg  do
35721ecb1efSmrg    # Strip MF so we end up with the name of the file.
35821ecb1efSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
35921ecb1efSmrg    # Check whether this is an Automake generated Makefile or not.
360b6f5cd12Smrg    # We used to match only the files named 'Makefile.in', but
36121ecb1efSmrg    # some people rename them; so instead we look at the file content.
36221ecb1efSmrg    # Grep'ing the first line is not enough: some people post-process
36321ecb1efSmrg    # each Makefile.in and add a new line on top of each file to say so.
36421ecb1efSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
36521ecb1efSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
36621ecb1efSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
36721ecb1efSmrg      dirpart=`AS_DIRNAME("$mf")`
36821ecb1efSmrg    else
36921ecb1efSmrg      continue
37021ecb1efSmrg    fi
37121ecb1efSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
372b6f5cd12Smrg    # from the Makefile without running 'make'.
37321ecb1efSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
37421ecb1efSmrg    test -z "$DEPDIR" && continue
37521ecb1efSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
376b6f5cd12Smrg    test -z "$am__include" && continue
37721ecb1efSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
37821ecb1efSmrg    # Find all dependency output files, they are included files with
37921ecb1efSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
38021ecb1efSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
38121ecb1efSmrg    # expansion.
38221ecb1efSmrg    for file in `sed -n "
38321ecb1efSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
384b6f5cd12Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
38521ecb1efSmrg      # Make sure the directory exists.
38621ecb1efSmrg      test -f "$dirpart/$file" && continue
38721ecb1efSmrg      fdir=`AS_DIRNAME(["$file"])`
38821ecb1efSmrg      AS_MKDIR_P([$dirpart/$fdir])
38921ecb1efSmrg      # echo "creating $dirpart/$file"
39021ecb1efSmrg      echo '# dummy' > "$dirpart/$file"
39121ecb1efSmrg    done
39221ecb1efSmrg  done
39321ecb1efSmrg}
39421ecb1efSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3951e00de39Smrg
3961e00de39Smrg
39721ecb1efSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39821ecb1efSmrg# -----------------------------
39921ecb1efSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
40021ecb1efSmrg#
40121ecb1efSmrg# This code is only required when automatic dependency tracking
402b6f5cd12Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
40321ecb1efSmrg# need in order to bootstrap the dependency handling code.
40421ecb1efSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
40521ecb1efSmrg[AC_CONFIG_COMMANDS([depfiles],
40621ecb1efSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
40721ecb1efSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
40821ecb1efSmrg])
4091e00de39Smrg
41021ecb1efSmrg# Do all the work for Automake.                             -*- Autoconf -*-
41121ecb1efSmrg
412b6f5cd12Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
41321ecb1efSmrg#
41421ecb1efSmrg# This file is free software; the Free Software Foundation
41521ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
41621ecb1efSmrg# with or without modifications, as long as this notice is preserved.
41721ecb1efSmrg
41821ecb1efSmrg# This macro actually does too much.  Some checks are only needed if
41921ecb1efSmrg# your package does certain things.  But this isn't really a big deal.
42021ecb1efSmrg
42121ecb1efSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
42221ecb1efSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42321ecb1efSmrg# -----------------------------------------------
42421ecb1efSmrg# The call with PACKAGE and VERSION arguments is the old style
42521ecb1efSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42621ecb1efSmrg# and VERSION should now be passed to AC_INIT and removed from
42721ecb1efSmrg# the call to AM_INIT_AUTOMAKE.
42821ecb1efSmrg# We support both call styles for the transition.  After
42921ecb1efSmrg# the next Automake release, Autoconf can make the AC_INIT
43021ecb1efSmrg# arguments mandatory, and then we can depend on a new Autoconf
43121ecb1efSmrg# release and drop the old call support.
43221ecb1efSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
433b6f5cd12Smrg[AC_PREREQ([2.65])dnl
43421ecb1efSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43521ecb1efSmrgdnl the ones we care about.
43621ecb1efSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43721ecb1efSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43821ecb1efSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
43921ecb1efSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44021ecb1efSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44121ecb1efSmrg  # is not polluted with repeated "-I."
44221ecb1efSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44321ecb1efSmrg  # test to see if srcdir already configured
44421ecb1efSmrg  if test -f $srcdir/config.status; then
44521ecb1efSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44621ecb1efSmrg  fi
4471e00de39Smrgfi
44821ecb1efSmrg
44921ecb1efSmrg# test whether we have cygpath
45021ecb1efSmrgif test -z "$CYGPATH_W"; then
45121ecb1efSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45221ecb1efSmrg    CYGPATH_W='cygpath -w'
45321ecb1efSmrg  else
45421ecb1efSmrg    CYGPATH_W=echo
45521ecb1efSmrg  fi
4561e00de39Smrgfi
45721ecb1efSmrgAC_SUBST([CYGPATH_W])
4581e00de39Smrg
45921ecb1efSmrg# Define the identity of the package.
46021ecb1efSmrgdnl Distinguish between old-style and new-style calls.
46121ecb1efSmrgm4_ifval([$2],
462b6f5cd12Smrg[AC_DIAGNOSE([obsolete],
463b6f5cd12Smrg             [$0: two- and three-arguments forms are deprecated.])
464b6f5cd12Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46521ecb1efSmrg AC_SUBST([PACKAGE], [$1])dnl
46621ecb1efSmrg AC_SUBST([VERSION], [$2])],
46721ecb1efSmrg[_AM_SET_OPTIONS([$1])dnl
46821ecb1efSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
469b6f5cd12Smrgm4_if(
470b6f5cd12Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
471b6f5cd12Smrg  [ok:ok],,
47221ecb1efSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47321ecb1efSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47421ecb1efSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4751e00de39Smrg
47621ecb1efSmrg_AM_IF_OPTION([no-define],,
477b6f5cd12Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
478b6f5cd12Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4791e00de39Smrg
48021ecb1efSmrg# Some tools Automake needs.
48121ecb1efSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48221ecb1efSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
483b6f5cd12SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
484b6f5cd12SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
485b6f5cd12SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
486b6f5cd12SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
487b6f5cd12SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48821ecb1efSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
48921ecb1efSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
490b6f5cd12SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
491b6f5cd12Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
492b6f5cd12Smrg# dies out for good.  For more background, see:
493b6f5cd12Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
494b6f5cd12Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
495b6f5cd12SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49621ecb1efSmrg# We need awk for the "check" target.  The system "awk" is bad on
49721ecb1efSmrg# some platforms.
49821ecb1efSmrgAC_REQUIRE([AC_PROG_AWK])dnl
49921ecb1efSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50021ecb1efSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50121ecb1efSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50221ecb1efSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50321ecb1efSmrg			     [_AM_PROG_TAR([v7])])])
50421ecb1efSmrg_AM_IF_OPTION([no-dependencies],,
50521ecb1efSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
506b6f5cd12Smrg		  [_AM_DEPENDENCIES([CC])],
507b6f5cd12Smrg		  [m4_define([AC_PROG_CC],
508b6f5cd12Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
50921ecb1efSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
510b6f5cd12Smrg		  [_AM_DEPENDENCIES([CXX])],
511b6f5cd12Smrg		  [m4_define([AC_PROG_CXX],
512b6f5cd12Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51321ecb1efSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
514b6f5cd12Smrg		  [_AM_DEPENDENCIES([OBJC])],
515b6f5cd12Smrg		  [m4_define([AC_PROG_OBJC],
516b6f5cd12Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
517b6f5cd12SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
518b6f5cd12Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
519b6f5cd12Smrg		  [m4_define([AC_PROG_OBJCXX],
520b6f5cd12Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52121ecb1efSmrg])
522b6f5cd12SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
523b6f5cd12Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
524b6f5cd12Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
525b6f5cd12Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
52621ecb1efSmrgAC_CONFIG_COMMANDS_PRE(dnl
52721ecb1efSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
52821ecb1efSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
52921ecb1efSmrg])
5301e00de39Smrg
531b6f5cd12Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
53221ecb1efSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
53321ecb1efSmrgdnl mangled by Autoconf and run in a shell conditional statement.
53421ecb1efSmrgm4_define([_AC_COMPILER_EXEEXT],
53521ecb1efSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5361e00de39Smrg
5371e00de39Smrg
53821ecb1efSmrg# When config.status generates a header, we must update the stamp-h file.
53921ecb1efSmrg# This file resides in the same directory as the config header
54021ecb1efSmrg# that is generated.  The stamp files are numbered to have different names.
54121ecb1efSmrg
54221ecb1efSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
54321ecb1efSmrg# loop where config.status creates the headers, so we can generate
54421ecb1efSmrg# our stamp files there.
54521ecb1efSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
54621ecb1efSmrg[# Compute $1's index in $config_headers.
54721ecb1efSmrg_am_arg=$1
54821ecb1efSmrg_am_stamp_count=1
54921ecb1efSmrgfor _am_header in $config_headers :; do
55021ecb1efSmrg  case $_am_header in
55121ecb1efSmrg    $_am_arg | $_am_arg:* )
55221ecb1efSmrg      break ;;
55321ecb1efSmrg    * )
55421ecb1efSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
55521ecb1efSmrg  esac
55621ecb1efSmrgdone
55721ecb1efSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
55821ecb1efSmrg
559b6f5cd12Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
56021ecb1efSmrg#
56121ecb1efSmrg# This file is free software; the Free Software Foundation
56221ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
56321ecb1efSmrg# with or without modifications, as long as this notice is preserved.
5641e00de39Smrg
56521ecb1efSmrg# AM_PROG_INSTALL_SH
56621ecb1efSmrg# ------------------
56721ecb1efSmrg# Define $install_sh.
56821ecb1efSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
56921ecb1efSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
57021ecb1efSmrgif test x"${install_sh}" != xset; then
57121ecb1efSmrg  case $am_aux_dir in
57221ecb1efSmrg  *\ * | *\	*)
57321ecb1efSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
57421ecb1efSmrg  *)
57521ecb1efSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
57621ecb1efSmrg  esac
5771e00de39Smrgfi
578b6f5cd12SmrgAC_SUBST([install_sh])])
5791e00de39Smrg
580b6f5cd12Smrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
58121ecb1efSmrg#
58221ecb1efSmrg# This file is free software; the Free Software Foundation
58321ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
58421ecb1efSmrg# with or without modifications, as long as this notice is preserved.
5851e00de39Smrg
58621ecb1efSmrg# Check whether the underlying file-system supports filenames
58721ecb1efSmrg# with a leading dot.  For instance MS-DOS doesn't.
58821ecb1efSmrgAC_DEFUN([AM_SET_LEADING_DOT],
58921ecb1efSmrg[rm -rf .tst 2>/dev/null
59021ecb1efSmrgmkdir .tst 2>/dev/null
59121ecb1efSmrgif test -d .tst; then
59221ecb1efSmrg  am__leading_dot=.
5931e00de39Smrgelse
59421ecb1efSmrg  am__leading_dot=_
5951e00de39Smrgfi
59621ecb1efSmrgrmdir .tst 2>/dev/null
59721ecb1efSmrgAC_SUBST([am__leading_dot])])
5981e00de39Smrg
59921ecb1efSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
60021ecb1efSmrg# From Jim Meyering
6011e00de39Smrg
602b6f5cd12Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
60321ecb1efSmrg#
60421ecb1efSmrg# This file is free software; the Free Software Foundation
60521ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
60621ecb1efSmrg# with or without modifications, as long as this notice is preserved.
6071e00de39Smrg
60821ecb1efSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
60921ecb1efSmrg# ----------------------------------
61021ecb1efSmrg# Control maintainer-specific portions of Makefiles.
611b6f5cd12Smrg# Default is to disable them, unless 'enable' is passed literally.
612b6f5cd12Smrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
61321ecb1efSmrg# can override the default with the --enable/--disable switch.
61421ecb1efSmrgAC_DEFUN([AM_MAINTAINER_MODE],
61521ecb1efSmrg[m4_case(m4_default([$1], [disable]),
61621ecb1efSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
61721ecb1efSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
61821ecb1efSmrg       [m4_define([am_maintainer_other], [enable])
61921ecb1efSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
620b6f5cd12SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
62121ecb1efSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
62221ecb1efSmrg  AC_ARG_ENABLE([maintainer-mode],
623b6f5cd12Smrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
624b6f5cd12Smrg      am_maintainer_other[ make rules and dependencies not useful
625b6f5cd12Smrg      (and sometimes confusing) to the casual installer])],
626b6f5cd12Smrg    [USE_MAINTAINER_MODE=$enableval],
627b6f5cd12Smrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
62821ecb1efSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
62921ecb1efSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
63021ecb1efSmrg  MAINT=$MAINTAINER_MODE_TRUE
63121ecb1efSmrg  AC_SUBST([MAINT])dnl
63221ecb1efSmrg]
63321ecb1efSmrg)
6341e00de39Smrg
63521ecb1efSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6361e00de39Smrg
637b6f5cd12Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
63821ecb1efSmrg#
63921ecb1efSmrg# This file is free software; the Free Software Foundation
64021ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
64121ecb1efSmrg# with or without modifications, as long as this notice is preserved.
6421e00de39Smrg
64321ecb1efSmrg# AM_MAKE_INCLUDE()
64421ecb1efSmrg# -----------------
64521ecb1efSmrg# Check to see how make treats includes.
64621ecb1efSmrgAC_DEFUN([AM_MAKE_INCLUDE],
64721ecb1efSmrg[am_make=${MAKE-make}
64821ecb1efSmrgcat > confinc << 'END'
64921ecb1efSmrgam__doit:
65021ecb1efSmrg	@echo this is the am__doit target
65121ecb1efSmrg.PHONY: am__doit
65221ecb1efSmrgEND
65321ecb1efSmrg# If we don't find an include directive, just comment out the code.
65421ecb1efSmrgAC_MSG_CHECKING([for style of include used by $am_make])
65521ecb1efSmrgam__include="#"
65621ecb1efSmrgam__quote=
65721ecb1efSmrg_am_result=none
65821ecb1efSmrg# First try GNU make style include.
65921ecb1efSmrgecho "include confinc" > confmf
660b6f5cd12Smrg# Ignore all kinds of additional output from 'make'.
66121ecb1efSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
66221ecb1efSmrg*the\ am__doit\ target*)
66321ecb1efSmrg  am__include=include
66421ecb1efSmrg  am__quote=
66521ecb1efSmrg  _am_result=GNU
66621ecb1efSmrg  ;;
66721ecb1efSmrgesac
66821ecb1efSmrg# Now try BSD make style include.
66921ecb1efSmrgif test "$am__include" = "#"; then
67021ecb1efSmrg   echo '.include "confinc"' > confmf
67121ecb1efSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
67221ecb1efSmrg   *the\ am__doit\ target*)
67321ecb1efSmrg     am__include=.include
67421ecb1efSmrg     am__quote="\""
67521ecb1efSmrg     _am_result=BSD
67621ecb1efSmrg     ;;
67721ecb1efSmrg   esac
6781e00de39Smrgfi
67921ecb1efSmrgAC_SUBST([am__include])
68021ecb1efSmrgAC_SUBST([am__quote])
68121ecb1efSmrgAC_MSG_RESULT([$_am_result])
68221ecb1efSmrgrm -f confinc confmf
68321ecb1efSmrg])
6841e00de39Smrg
68521ecb1efSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6861e00de39Smrg
687b6f5cd12Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
68821ecb1efSmrg#
68921ecb1efSmrg# This file is free software; the Free Software Foundation
69021ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
69121ecb1efSmrg# with or without modifications, as long as this notice is preserved.
6921e00de39Smrg
69321ecb1efSmrg# AM_MISSING_PROG(NAME, PROGRAM)
69421ecb1efSmrg# ------------------------------
69521ecb1efSmrgAC_DEFUN([AM_MISSING_PROG],
69621ecb1efSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
69721ecb1efSmrg$1=${$1-"${am_missing_run}$2"}
69821ecb1efSmrgAC_SUBST($1)])
6991e00de39Smrg
70021ecb1efSmrg# AM_MISSING_HAS_RUN
70121ecb1efSmrg# ------------------
702b6f5cd12Smrg# Define MISSING if not defined so far and test if it is modern enough.
703b6f5cd12Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
70421ecb1efSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
70521ecb1efSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
70621ecb1efSmrgAC_REQUIRE_AUX_FILE([missing])dnl
70721ecb1efSmrgif test x"${MISSING+set}" != xset; then
70821ecb1efSmrg  case $am_aux_dir in
70921ecb1efSmrg  *\ * | *\	*)
71021ecb1efSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
71121ecb1efSmrg  *)
71221ecb1efSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
71321ecb1efSmrg  esac
7141e00de39Smrgfi
71521ecb1efSmrg# Use eval to expand $SHELL
716b6f5cd12Smrgif eval "$MISSING --is-lightweight"; then
717b6f5cd12Smrg  am_missing_run="$MISSING "
7181e00de39Smrgelse
71921ecb1efSmrg  am_missing_run=
720b6f5cd12Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7211e00de39Smrgfi
72221ecb1efSmrg])
7231e00de39Smrg
72421ecb1efSmrg# Helper functions for option handling.                     -*- Autoconf -*-
7251e00de39Smrg
726b6f5cd12Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
7271e00de39Smrg#
72821ecb1efSmrg# This file is free software; the Free Software Foundation
72921ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
73021ecb1efSmrg# with or without modifications, as long as this notice is preserved.
7311e00de39Smrg
73221ecb1efSmrg# _AM_MANGLE_OPTION(NAME)
73321ecb1efSmrg# -----------------------
73421ecb1efSmrgAC_DEFUN([_AM_MANGLE_OPTION],
73521ecb1efSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7361e00de39Smrg
73721ecb1efSmrg# _AM_SET_OPTION(NAME)
738b6f5cd12Smrg# --------------------
73921ecb1efSmrg# Set option NAME.  Presently that only means defining a flag for this option.
74021ecb1efSmrgAC_DEFUN([_AM_SET_OPTION],
741b6f5cd12Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7421e00de39Smrg
74321ecb1efSmrg# _AM_SET_OPTIONS(OPTIONS)
744b6f5cd12Smrg# ------------------------
74521ecb1efSmrg# OPTIONS is a space-separated list of Automake options.
74621ecb1efSmrgAC_DEFUN([_AM_SET_OPTIONS],
74721ecb1efSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
74821ecb1efSmrg
74921ecb1efSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
75021ecb1efSmrg# -------------------------------------------
75121ecb1efSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
75221ecb1efSmrgAC_DEFUN([_AM_IF_OPTION],
75321ecb1efSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
75421ecb1efSmrg
75521ecb1efSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
7561e00de39Smrg
757b6f5cd12Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
7581e00de39Smrg#
7591e00de39Smrg# This file is free software; the Free Software Foundation
7601e00de39Smrg# gives unlimited permission to copy and/or distribute it,
7611e00de39Smrg# with or without modifications, as long as this notice is preserved.
7621e00de39Smrg
76321ecb1efSmrg# AM_SANITY_CHECK
76421ecb1efSmrg# ---------------
76521ecb1efSmrgAC_DEFUN([AM_SANITY_CHECK],
76621ecb1efSmrg[AC_MSG_CHECKING([whether build environment is sane])
76721ecb1efSmrg# Reject unsafe characters in $srcdir or the absolute working directory
76821ecb1efSmrg# name.  Accept space and tab only in the latter.
76921ecb1efSmrgam_lf='
77021ecb1efSmrg'
77121ecb1efSmrgcase `pwd` in
77221ecb1efSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
77321ecb1efSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
77421ecb1efSmrgesac
77521ecb1efSmrgcase $srcdir in
77621ecb1efSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
777b6f5cd12Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
77821ecb1efSmrgesac
7791e00de39Smrg
780b6f5cd12Smrg# Do 'set' in a subshell so we don't clobber the current shell's
78121ecb1efSmrg# arguments.  Must try -L first in case configure is actually a
78221ecb1efSmrg# symlink; some systems play weird games with the mod time of symlinks
78321ecb1efSmrg# (eg FreeBSD returns the mod time of the symlink's containing
78421ecb1efSmrg# directory).
78521ecb1efSmrgif (
786b6f5cd12Smrg   am_has_slept=no
787b6f5cd12Smrg   for am_try in 1 2; do
788b6f5cd12Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
789b6f5cd12Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
790b6f5cd12Smrg     if test "$[*]" = "X"; then
791b6f5cd12Smrg	# -L didn't work.
792b6f5cd12Smrg	set X `ls -t "$srcdir/configure" conftest.file`
793b6f5cd12Smrg     fi
794b6f5cd12Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
795b6f5cd12Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
796b6f5cd12Smrg
797b6f5cd12Smrg	# If neither matched, then we have a broken ls.  This can happen
798b6f5cd12Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
799b6f5cd12Smrg	# broken ls alias from the environment.  This has actually
800b6f5cd12Smrg	# happened.  Such a system could not be considered "sane".
801b6f5cd12Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
802b6f5cd12Smrg  alias in your environment])
803b6f5cd12Smrg     fi
804b6f5cd12Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
805b6f5cd12Smrg       break
806b6f5cd12Smrg     fi
807b6f5cd12Smrg     # Just in case.
808b6f5cd12Smrg     sleep 1
809b6f5cd12Smrg     am_has_slept=yes
810b6f5cd12Smrg   done
81121ecb1efSmrg   test "$[2]" = conftest.file
81221ecb1efSmrg   )
81321ecb1efSmrgthen
81421ecb1efSmrg   # Ok.
81521ecb1efSmrg   :
81621ecb1efSmrgelse
81721ecb1efSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
81821ecb1efSmrgCheck your system clock])
81921ecb1efSmrgfi
820b6f5cd12SmrgAC_MSG_RESULT([yes])
821b6f5cd12Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
822b6f5cd12Smrg# generated files are strictly newer.
823b6f5cd12Smrgam_sleep_pid=
824b6f5cd12Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
825b6f5cd12Smrg  ( sleep 1 ) &
826b6f5cd12Smrg  am_sleep_pid=$!
827b6f5cd12Smrgfi
828b6f5cd12SmrgAC_CONFIG_COMMANDS_PRE(
829b6f5cd12Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
830b6f5cd12Smrg   if test -n "$am_sleep_pid"; then
831b6f5cd12Smrg     # Hide warnings about reused PIDs.
832b6f5cd12Smrg     wait $am_sleep_pid 2>/dev/null
833b6f5cd12Smrg   fi
834b6f5cd12Smrg   AC_MSG_RESULT([done])])
835b6f5cd12Smrgrm -f conftest.file
836b6f5cd12Smrg])
83721ecb1efSmrg
838b6f5cd12Smrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
8391e00de39Smrg#
8401e00de39Smrg# This file is free software; the Free Software Foundation
8411e00de39Smrg# gives unlimited permission to copy and/or distribute it,
8421e00de39Smrg# with or without modifications, as long as this notice is preserved.
8431e00de39Smrg
84421ecb1efSmrg# AM_SILENT_RULES([DEFAULT])
84521ecb1efSmrg# --------------------------
84621ecb1efSmrg# Enable less verbose build rules; with the default set to DEFAULT
847b6f5cd12Smrg# ("yes" being less verbose, "no" or empty being verbose).
84821ecb1efSmrgAC_DEFUN([AM_SILENT_RULES],
849b6f5cd12Smrg[AC_ARG_ENABLE([silent-rules], [dnl
850b6f5cd12SmrgAS_HELP_STRING(
851b6f5cd12Smrg  [--enable-silent-rules],
852b6f5cd12Smrg  [less verbose build output (undo: "make V=1")])
853b6f5cd12SmrgAS_HELP_STRING(
854b6f5cd12Smrg  [--disable-silent-rules],
855b6f5cd12Smrg  [verbose build output (undo: "make V=0")])dnl
856b6f5cd12Smrg])
857b6f5cd12Smrgcase $enable_silent_rules in @%:@ (((
858b6f5cd12Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
859b6f5cd12Smrg   no) AM_DEFAULT_VERBOSITY=1;;
860b6f5cd12Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
86121ecb1efSmrgesac
862b6f5cd12Smrgdnl
863b6f5cd12Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
864b6f5cd12Smrgdnl do not support nested variable expansions.
865b6f5cd12Smrgdnl See automake bug#9928 and bug#10237.
866b6f5cd12Smrgam_make=${MAKE-make}
867b6f5cd12SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
868b6f5cd12Smrg   [am_cv_make_support_nested_variables],
869b6f5cd12Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
870b6f5cd12SmrgBAR0=false
871b6f5cd12SmrgBAR1=true
872b6f5cd12SmrgV=1
873b6f5cd12Smrgam__doit:
874b6f5cd12Smrg	@$(TRUE)
875b6f5cd12Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
876b6f5cd12Smrg  am_cv_make_support_nested_variables=yes
877b6f5cd12Smrgelse
878b6f5cd12Smrg  am_cv_make_support_nested_variables=no
879b6f5cd12Smrgfi])
880b6f5cd12Smrgif test $am_cv_make_support_nested_variables = yes; then
881b6f5cd12Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
882b6f5cd12Smrg  AM_V='$(V)'
883b6f5cd12Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
884b6f5cd12Smrgelse
885b6f5cd12Smrg  AM_V=$AM_DEFAULT_VERBOSITY
886b6f5cd12Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
887b6f5cd12Smrgfi
888b6f5cd12SmrgAC_SUBST([AM_V])dnl
889b6f5cd12SmrgAM_SUBST_NOTMAKE([AM_V])dnl
890b6f5cd12SmrgAC_SUBST([AM_DEFAULT_V])dnl
891b6f5cd12SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
89221ecb1efSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
89321ecb1efSmrgAM_BACKSLASH='\'
89421ecb1efSmrgAC_SUBST([AM_BACKSLASH])dnl
89521ecb1efSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
8961e00de39Smrg])
8971e00de39Smrg
898b6f5cd12Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
89921ecb1efSmrg#
90021ecb1efSmrg# This file is free software; the Free Software Foundation
90121ecb1efSmrg# gives unlimited permission to copy and/or distribute it,
90221ecb1efSmrg# with or without modifications, as long as this notice is preserved.
90321ecb1efSmrg
90421ecb1efSmrg# AM_PROG_INSTALL_STRIP
90521ecb1efSmrg# ---------------------
906b6f5cd12Smrg# One issue with vendor 'install' (even GNU) is that you can't
90721ecb1efSmrg# specify the program used to strip binaries.  This is especially
90821ecb1efSmrg# annoying in cross-compiling environments, where the build's strip
90921ecb1efSmrg# is unlikely to handle the host's binaries.
91021ecb1efSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
911b6f5cd12Smrg# always use install-sh in "make install-strip", and initialize
91221ecb1efSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
91321ecb1efSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
91421ecb1efSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
915b6f5cd12Smrg# Installed binaries are usually stripped using 'strip' when the user
916b6f5cd12Smrg# run "make install-strip".  However 'strip' might not be the right
91721ecb1efSmrg# tool to use in cross-compilation environments, therefore Automake
918b6f5cd12Smrg# will honor the 'STRIP' environment variable to overrule this program.
919b6f5cd12Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
92021ecb1efSmrgif test "$cross_compiling" != no; then
92121ecb1efSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
92221ecb1efSmrgfi
92321ecb1efSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
92421ecb1efSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
9251e00de39Smrg
926b6f5cd12Smrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
9271e00de39Smrg#
9281e00de39Smrg# This file is free software; the Free Software Foundation
9291e00de39Smrg# gives unlimited permission to copy and/or distribute it,
9301e00de39Smrg# with or without modifications, as long as this notice is preserved.
9311e00de39Smrg
93221ecb1efSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
93321ecb1efSmrg# ---------------------------
93421ecb1efSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
93521ecb1efSmrg# This macro is traced by Automake.
93621ecb1efSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
9371e00de39Smrg
93821ecb1efSmrg# AM_SUBST_NOTMAKE(VARIABLE)
939b6f5cd12Smrg# --------------------------
94021ecb1efSmrg# Public sister of _AM_SUBST_NOTMAKE.
94121ecb1efSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
94221ecb1efSmrg
94321ecb1efSmrg# Check how to create a tarball.                            -*- Autoconf -*-
94421ecb1efSmrg
945b6f5cd12Smrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
9461e00de39Smrg#
9471e00de39Smrg# This file is free software; the Free Software Foundation
9481e00de39Smrg# gives unlimited permission to copy and/or distribute it,
9491e00de39Smrg# with or without modifications, as long as this notice is preserved.
9501e00de39Smrg
95121ecb1efSmrg# _AM_PROG_TAR(FORMAT)
95221ecb1efSmrg# --------------------
95321ecb1efSmrg# Check how to create a tarball in format FORMAT.
954b6f5cd12Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
9551e00de39Smrg#
95621ecb1efSmrg# Substitute a variable $(am__tar) that is a command
95721ecb1efSmrg# writing to stdout a FORMAT-tarball containing the directory
95821ecb1efSmrg# $tardir.
95921ecb1efSmrg#     tardir=directory && $(am__tar) > result.tar
96021ecb1efSmrg#
96121ecb1efSmrg# Substitute a variable $(am__untar) that extract such
96221ecb1efSmrg# a tarball read from stdin.
96321ecb1efSmrg#     $(am__untar) < result.tar
964b6f5cd12Smrg#
96521ecb1efSmrgAC_DEFUN([_AM_PROG_TAR],
966b6f5cd12Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
967b6f5cd12Smrg# in the wild :-(  We should find a proper way to deprecate it ...
968b6f5cd12SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
969b6f5cd12Smrg
970b6f5cd12Smrg# We'll loop over all known methods to create a tar archive until one works.
97121ecb1efSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
9721e00de39Smrg
973b6f5cd12Smrgm4_if([$1], [v7],
974b6f5cd12Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
975b6f5cd12Smrg
976b6f5cd12Smrg  [m4_case([$1],
977b6f5cd12Smrg    [ustar],
978b6f5cd12Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
979b6f5cd12Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
980b6f5cd12Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
981b6f5cd12Smrg      # and bug#13588).
982b6f5cd12Smrg      am_max_uid=2097151 # 2^21 - 1
983b6f5cd12Smrg      am_max_gid=$am_max_uid
984b6f5cd12Smrg      # The $UID and $GID variables are not portable, so we need to resort
985b6f5cd12Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
986b6f5cd12Smrg      # below are definitely unexpected, so allow the users to see them
987b6f5cd12Smrg      # (that is, avoid stderr redirection).
988b6f5cd12Smrg      am_uid=`id -u || echo unknown`
989b6f5cd12Smrg      am_gid=`id -g || echo unknown`
990b6f5cd12Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
991b6f5cd12Smrg      if test $am_uid -le $am_max_uid; then
992b6f5cd12Smrg         AC_MSG_RESULT([yes])
993b6f5cd12Smrg      else
994b6f5cd12Smrg         AC_MSG_RESULT([no])
995b6f5cd12Smrg         _am_tools=none
996b6f5cd12Smrg      fi
997b6f5cd12Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
998b6f5cd12Smrg      if test $am_gid -le $am_max_gid; then
999b6f5cd12Smrg         AC_MSG_RESULT([yes])
1000b6f5cd12Smrg      else
1001b6f5cd12Smrg        AC_MSG_RESULT([no])
1002b6f5cd12Smrg        _am_tools=none
1003b6f5cd12Smrg      fi],
1004b6f5cd12Smrg
1005b6f5cd12Smrg  [pax],
1006b6f5cd12Smrg    [],
1007b6f5cd12Smrg
1008b6f5cd12Smrg  [m4_fatal([Unknown tar format])])
1009b6f5cd12Smrg
1010b6f5cd12Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1011b6f5cd12Smrg
1012b6f5cd12Smrg  # Go ahead even if we have the value already cached.  We do so because we
1013b6f5cd12Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1014b6f5cd12Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1015b6f5cd12Smrg
1016b6f5cd12Smrg  for _am_tool in $_am_tools; do
1017b6f5cd12Smrg    case $_am_tool in
1018b6f5cd12Smrg    gnutar)
1019b6f5cd12Smrg      for _am_tar in tar gnutar gtar; do
1020b6f5cd12Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1021b6f5cd12Smrg      done
1022b6f5cd12Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1023b6f5cd12Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1024b6f5cd12Smrg      am__untar="$_am_tar -xf -"
1025b6f5cd12Smrg      ;;
1026b6f5cd12Smrg    plaintar)
1027b6f5cd12Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1028b6f5cd12Smrg      # ustar tarball either.
1029b6f5cd12Smrg      (tar --version) >/dev/null 2>&1 && continue
1030b6f5cd12Smrg      am__tar='tar chf - "$$tardir"'
1031b6f5cd12Smrg      am__tar_='tar chf - "$tardir"'
1032b6f5cd12Smrg      am__untar='tar xf -'
1033b6f5cd12Smrg      ;;
1034b6f5cd12Smrg    pax)
1035b6f5cd12Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1036b6f5cd12Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1037b6f5cd12Smrg      am__untar='pax -r'
1038b6f5cd12Smrg      ;;
1039b6f5cd12Smrg    cpio)
1040b6f5cd12Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1041b6f5cd12Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1042b6f5cd12Smrg      am__untar='cpio -i -H $1 -d'
1043b6f5cd12Smrg      ;;
1044b6f5cd12Smrg    none)
1045b6f5cd12Smrg      am__tar=false
1046b6f5cd12Smrg      am__tar_=false
1047b6f5cd12Smrg      am__untar=false
1048b6f5cd12Smrg      ;;
1049b6f5cd12Smrg    esac
10501e00de39Smrg
1051b6f5cd12Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1052b6f5cd12Smrg    # and am__untar set.
1053b6f5cd12Smrg    test -n "${am_cv_prog_tar_$1}" && break
1054b6f5cd12Smrg
1055b6f5cd12Smrg    # tar/untar a dummy directory, and stop if the command works.
1056b6f5cd12Smrg    rm -rf conftest.dir
1057b6f5cd12Smrg    mkdir conftest.dir
1058b6f5cd12Smrg    echo GrepMe > conftest.dir/file
1059b6f5cd12Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1060b6f5cd12Smrg    rm -rf conftest.dir
1061b6f5cd12Smrg    if test -s conftest.tar; then
1062b6f5cd12Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1063b6f5cd12Smrg      AM_RUN_LOG([cat conftest.dir/file])
1064b6f5cd12Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1065b6f5cd12Smrg    fi
1066b6f5cd12Smrg  done
106721ecb1efSmrg  rm -rf conftest.dir
106821ecb1efSmrg
1069b6f5cd12Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1070b6f5cd12Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1071b6f5cd12Smrg
107221ecb1efSmrgAC_SUBST([am__tar])
107321ecb1efSmrgAC_SUBST([am__untar])
107421ecb1efSmrg]) # _AM_PROG_TAR
107521ecb1efSmrg
1076b6f5cd12Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1077b6f5cd12Smrg# 
1078b6f5cd12Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1079b6f5cd12Smrg#
1080b6f5cd12Smrg# This program is free software; you can redistribute it and/or modify
1081b6f5cd12Smrg# it under the terms of the GNU General Public License as published by
1082b6f5cd12Smrg# the Free Software Foundation; either version 2 of the License, or
1083b6f5cd12Smrg# (at your option) any later version.
1084b6f5cd12Smrg#
1085b6f5cd12Smrg# This program is distributed in the hope that it will be useful, but
1086b6f5cd12Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1087b6f5cd12Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1088b6f5cd12Smrg# General Public License for more details.
1089b6f5cd12Smrg#
1090b6f5cd12Smrg# You should have received a copy of the GNU General Public License
1091b6f5cd12Smrg# along with this program; if not, write to the Free Software
1092b6f5cd12Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1093b6f5cd12Smrg#
1094b6f5cd12Smrg# As a special exception to the GNU General Public License, if you
1095b6f5cd12Smrg# distribute this file as part of a program that contains a
1096b6f5cd12Smrg# configuration script generated by Autoconf, you may include it under
1097b6f5cd12Smrg# the same distribution terms that you use for the rest of that program.
1098b6f5cd12Smrg
1099b6f5cd12Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1100b6f5cd12Smrg# ----------------------------------
1101b6f5cd12SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1102b6f5cd12Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1103b6f5cd12Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1104b6f5cd12SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1105b6f5cd12Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1106b6f5cd12Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1107b6f5cd12Smrgfi
1108b6f5cd12Smrgif test -n "$PKG_CONFIG"; then
1109b6f5cd12Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1110b6f5cd12Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1111b6f5cd12Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1112b6f5cd12Smrg		AC_MSG_RESULT([yes])
1113b6f5cd12Smrg	else
1114b6f5cd12Smrg		AC_MSG_RESULT([no])
1115b6f5cd12Smrg		PKG_CONFIG=""
1116b6f5cd12Smrg	fi
1117b6f5cd12Smrg		
1118b6f5cd12Smrgfi[]dnl
1119b6f5cd12Smrg])# PKG_PROG_PKG_CONFIG
1120b6f5cd12Smrg
1121b6f5cd12Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1122b6f5cd12Smrg#
1123b6f5cd12Smrg# Check to see whether a particular set of modules exists.  Similar
1124b6f5cd12Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1125b6f5cd12Smrg#
1126b6f5cd12Smrg#
1127b6f5cd12Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1128b6f5cd12Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
1129b6f5cd12Smrg# PKG_CHECK_EXISTS manually
1130b6f5cd12Smrg# --------------------------------------------------------------
1131b6f5cd12SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1132b6f5cd12Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1133b6f5cd12Smrgif test -n "$PKG_CONFIG" && \
1134b6f5cd12Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1135b6f5cd12Smrg  m4_ifval([$2], [$2], [:])
1136b6f5cd12Smrgm4_ifvaln([$3], [else
1137b6f5cd12Smrg  $3])dnl
1138b6f5cd12Smrgfi])
1139b6f5cd12Smrg
1140b6f5cd12Smrg
1141b6f5cd12Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1142b6f5cd12Smrg# ---------------------------------------------
1143b6f5cd12Smrgm4_define([_PKG_CONFIG],
1144b6f5cd12Smrg[if test -n "$$1"; then
1145b6f5cd12Smrg    pkg_cv_[]$1="$$1"
1146b6f5cd12Smrg elif test -n "$PKG_CONFIG"; then
1147b6f5cd12Smrg    PKG_CHECK_EXISTS([$3],
1148b6f5cd12Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1149b6f5cd12Smrg		     [pkg_failed=yes])
1150b6f5cd12Smrg else
1151b6f5cd12Smrg    pkg_failed=untried
1152b6f5cd12Smrgfi[]dnl
1153b6f5cd12Smrg])# _PKG_CONFIG
1154b6f5cd12Smrg
1155b6f5cd12Smrg# _PKG_SHORT_ERRORS_SUPPORTED
1156b6f5cd12Smrg# -----------------------------
1157b6f5cd12SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1158b6f5cd12Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1159b6f5cd12Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1160b6f5cd12Smrg        _pkg_short_errors_supported=yes
1161b6f5cd12Smrgelse
1162b6f5cd12Smrg        _pkg_short_errors_supported=no
1163b6f5cd12Smrgfi[]dnl
1164b6f5cd12Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1165b6f5cd12Smrg
1166b6f5cd12Smrg
1167b6f5cd12Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1168b6f5cd12Smrg# [ACTION-IF-NOT-FOUND])
1169b6f5cd12Smrg#
1170b6f5cd12Smrg#
1171b6f5cd12Smrg# Note that if there is a possibility the first call to
1172b6f5cd12Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1173b6f5cd12Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1174b6f5cd12Smrg#
1175b6f5cd12Smrg#
1176b6f5cd12Smrg# --------------------------------------------------------------
1177b6f5cd12SmrgAC_DEFUN([PKG_CHECK_MODULES],
1178b6f5cd12Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1179b6f5cd12SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1180b6f5cd12SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1181b6f5cd12Smrg
1182b6f5cd12Smrgpkg_failed=no
1183b6f5cd12SmrgAC_MSG_CHECKING([for $1])
1184b6f5cd12Smrg
1185b6f5cd12Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1186b6f5cd12Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1187b6f5cd12Smrg
1188b6f5cd12Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1189b6f5cd12Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1190b6f5cd12SmrgSee the pkg-config man page for more details.])
1191b6f5cd12Smrg
1192b6f5cd12Smrgif test $pkg_failed = yes; then
1193b6f5cd12Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1194b6f5cd12Smrg        if test $_pkg_short_errors_supported = yes; then
1195b6f5cd12Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1196b6f5cd12Smrg        else 
1197b6f5cd12Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1198b6f5cd12Smrg        fi
1199b6f5cd12Smrg	# Put the nasty error message in config.log where it belongs
1200b6f5cd12Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1201b6f5cd12Smrg
1202b6f5cd12Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1203b6f5cd12Smrg[Package requirements ($2) were not met:
1204b6f5cd12Smrg
1205b6f5cd12Smrg$$1_PKG_ERRORS
1206b6f5cd12Smrg
1207b6f5cd12SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1208b6f5cd12Smrginstalled software in a non-standard prefix.
1209b6f5cd12Smrg
1210b6f5cd12Smrg_PKG_TEXT
1211b6f5cd12Smrg])],
1212b6f5cd12Smrg		[AC_MSG_RESULT([no])
1213b6f5cd12Smrg                $4])
1214b6f5cd12Smrgelif test $pkg_failed = untried; then
1215b6f5cd12Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1216b6f5cd12Smrg[The pkg-config script could not be found or is too old.  Make sure it
1217b6f5cd12Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1218b6f5cd12Smrgpath to pkg-config.
1219b6f5cd12Smrg
1220b6f5cd12Smrg_PKG_TEXT
1221b6f5cd12Smrg
1222b6f5cd12SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1223b6f5cd12Smrg		[$4])
1224b6f5cd12Smrgelse
1225b6f5cd12Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1226b6f5cd12Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1227b6f5cd12Smrg        AC_MSG_RESULT([yes])
1228b6f5cd12Smrg	ifelse([$3], , :, [$3])
1229b6f5cd12Smrgfi[]dnl
1230b6f5cd12Smrg])# PKG_CHECK_MODULES
1231b6f5cd12Smrg
123221ecb1efSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
123321ecb1efSmrgdnl
1234604a4f4cSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
123521ecb1efSmrgdnl 
123621ecb1efSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1237604a4f4cSmrgdnl copy of this software and associated documentation files (the "Software"),
1238604a4f4cSmrgdnl to deal in the Software without restriction, including without limitation
1239604a4f4cSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1240604a4f4cSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1241604a4f4cSmrgdnl Software is furnished to do so, subject to the following conditions:
124221ecb1efSmrgdnl
1243604a4f4cSmrgdnl The above copyright notice and this permission notice (including the next
1244604a4f4cSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1245604a4f4cSmrgdnl Software.
124621ecb1efSmrgdnl
1247604a4f4cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1248604a4f4cSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1249604a4f4cSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1250604a4f4cSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1251604a4f4cSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1252604a4f4cSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1253604a4f4cSmrgdnl DEALINGS IN THE SOFTWARE.
125421ecb1efSmrg
125521ecb1efSmrg# XORG_MACROS_VERSION(required-version)
125621ecb1efSmrg# -------------------------------------
125721ecb1efSmrg# Minimum version: 1.1.0
125821ecb1efSmrg#
125921ecb1efSmrg# If you're using a macro added in Version 1.1 or newer, include this in
126021ecb1efSmrg# your configure.ac with the minimum required version, such as:
126121ecb1efSmrg# XORG_MACROS_VERSION(1.1)
126221ecb1efSmrg#
126321ecb1efSmrg# To ensure that this macro is defined, also add:
126421ecb1efSmrg# m4_ifndef([XORG_MACROS_VERSION],
126521ecb1efSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
126621ecb1efSmrg#
126721ecb1efSmrg#
126821ecb1efSmrg# See the "minimum version" comment for each macro you use to see what 
126921ecb1efSmrg# version you require.
127021ecb1efSmrgm4_defun([XORG_MACROS_VERSION],[
1271b6f5cd12Smrgm4_define([vers_have], [1.17])
127221ecb1efSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
127321ecb1efSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
127421ecb1efSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
127521ecb1efSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
127621ecb1efSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
127721ecb1efSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
127821ecb1efSmrgm4_undefine([vers_have])
127921ecb1efSmrgm4_undefine([maj_have])
128021ecb1efSmrgm4_undefine([maj_needed])
128121ecb1efSmrg]) # XORG_MACROS_VERSION
128221ecb1efSmrg
128321ecb1efSmrg# XORG_PROG_RAWCPP()
128421ecb1efSmrg# ------------------
128521ecb1efSmrg# Minimum version: 1.0.0
128621ecb1efSmrg#
128721ecb1efSmrg# Find cpp program and necessary flags for use in pre-processing text files
128821ecb1efSmrg# such as man pages and config files
128921ecb1efSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
129021ecb1efSmrgAC_REQUIRE([AC_PROG_CPP])
129121ecb1efSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
129221ecb1efSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
12931e00de39Smrg
129421ecb1efSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
129521ecb1efSmrg# which is not the best choice for supporting other OS'es, but covers most
129621ecb1efSmrg# of the ones we need for now.
129721ecb1efSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1298b6f5cd12SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
129921ecb1efSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
130021ecb1efSmrg	AC_MSG_RESULT([no])
130121ecb1efSmrgelse
130221ecb1efSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
130321ecb1efSmrg		RAWCPPFLAGS=-undef
130421ecb1efSmrg		AC_MSG_RESULT([yes])
130521ecb1efSmrg	# under Cygwin unix is still defined even with -undef
130621ecb1efSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
130721ecb1efSmrg		RAWCPPFLAGS="-undef -ansi"
130821ecb1efSmrg		AC_MSG_RESULT([yes, with -ansi])
130921ecb1efSmrg	else
131021ecb1efSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
131121ecb1efSmrg	fi
131221ecb1efSmrgfi
131321ecb1efSmrgrm -f conftest.$ac_ext
13141e00de39Smrg
131521ecb1efSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1316b6f5cd12SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
131721ecb1efSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
131821ecb1efSmrg	AC_MSG_RESULT([no])
13191e00de39Smrgelse
132021ecb1efSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
132121ecb1efSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
132221ecb1efSmrg		AC_MSG_RESULT([yes])
132321ecb1efSmrg	else
132421ecb1efSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
132521ecb1efSmrg	fi
13261e00de39Smrgfi
132721ecb1efSmrgrm -f conftest.$ac_ext
132821ecb1efSmrgAC_SUBST(RAWCPPFLAGS)
132921ecb1efSmrg]) # XORG_PROG_RAWCPP
13301e00de39Smrg
133121ecb1efSmrg# XORG_MANPAGE_SECTIONS()
133221ecb1efSmrg# -----------------------
133321ecb1efSmrg# Minimum version: 1.0.0
133421ecb1efSmrg#
133521ecb1efSmrg# Determine which sections man pages go in for the different man page types
133621ecb1efSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
133721ecb1efSmrg# Not sure if there's any better way than just hardcoding by OS name.
133821ecb1efSmrg# Override default settings by setting environment variables
1339604a4f4cSmrg# Added MAN_SUBSTS in version 1.8
1340604a4f4cSmrg# Added AC_PROG_SED in version 1.8
13411e00de39Smrg
134221ecb1efSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
134321ecb1efSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1344604a4f4cSmrgAC_REQUIRE([AC_PROG_SED])
13451e00de39Smrg
134621ecb1efSmrgif test x$APP_MAN_SUFFIX = x    ; then
134721ecb1efSmrg    APP_MAN_SUFFIX=1
134821ecb1efSmrgfi
134921ecb1efSmrgif test x$APP_MAN_DIR = x    ; then
135021ecb1efSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
135121ecb1efSmrgfi
13521e00de39Smrg
135321ecb1efSmrgif test x$LIB_MAN_SUFFIX = x    ; then
135421ecb1efSmrg    LIB_MAN_SUFFIX=3
135521ecb1efSmrgfi
135621ecb1efSmrgif test x$LIB_MAN_DIR = x    ; then
135721ecb1efSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
13581e00de39Smrgfi
13591e00de39Smrg
136021ecb1efSmrgif test x$FILE_MAN_SUFFIX = x    ; then
136121ecb1efSmrg    case $host_os in
136221ecb1efSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
136321ecb1efSmrg	*)		FILE_MAN_SUFFIX=5  ;;
136421ecb1efSmrg    esac
136521ecb1efSmrgfi
136621ecb1efSmrgif test x$FILE_MAN_DIR = x    ; then
136721ecb1efSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
136821ecb1efSmrgfi
13691e00de39Smrg
137021ecb1efSmrgif test x$MISC_MAN_SUFFIX = x    ; then
137121ecb1efSmrg    case $host_os in
137221ecb1efSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
137321ecb1efSmrg	*)		MISC_MAN_SUFFIX=7  ;;
137421ecb1efSmrg    esac
137521ecb1efSmrgfi
137621ecb1efSmrgif test x$MISC_MAN_DIR = x    ; then
137721ecb1efSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
137821ecb1efSmrgfi
13791e00de39Smrg
138021ecb1efSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
138121ecb1efSmrg    case $host_os in
138221ecb1efSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
138321ecb1efSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
138421ecb1efSmrg    esac
138521ecb1efSmrgfi
138621ecb1efSmrgif test x$DRIVER_MAN_DIR = x    ; then
138721ecb1efSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
138821ecb1efSmrgfi
13891e00de39Smrg
139021ecb1efSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
139121ecb1efSmrg    case $host_os in
139221ecb1efSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
139321ecb1efSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
139421ecb1efSmrg    esac
139521ecb1efSmrgfi
139621ecb1efSmrgif test x$ADMIN_MAN_DIR = x    ; then
139721ecb1efSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
139821ecb1efSmrgfi
13991e00de39Smrg
14001e00de39Smrg
140121ecb1efSmrgAC_SUBST([APP_MAN_SUFFIX])
140221ecb1efSmrgAC_SUBST([LIB_MAN_SUFFIX])
140321ecb1efSmrgAC_SUBST([FILE_MAN_SUFFIX])
140421ecb1efSmrgAC_SUBST([MISC_MAN_SUFFIX])
140521ecb1efSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
140621ecb1efSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
140721ecb1efSmrgAC_SUBST([APP_MAN_DIR])
140821ecb1efSmrgAC_SUBST([LIB_MAN_DIR])
140921ecb1efSmrgAC_SUBST([FILE_MAN_DIR])
141021ecb1efSmrgAC_SUBST([MISC_MAN_DIR])
141121ecb1efSmrgAC_SUBST([DRIVER_MAN_DIR])
141221ecb1efSmrgAC_SUBST([ADMIN_MAN_DIR])
1413604a4f4cSmrg
1414604a4f4cSmrgXORG_MAN_PAGE="X Version 11"
1415604a4f4cSmrgAC_SUBST([XORG_MAN_PAGE])
1416604a4f4cSmrgMAN_SUBSTS="\
1417604a4f4cSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1418604a4f4cSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1419604a4f4cSmrg	-e 's|__xservername__|Xorg|g' \
1420604a4f4cSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1421604a4f4cSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1422604a4f4cSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1423604a4f4cSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1424604a4f4cSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1425604a4f4cSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1426604a4f4cSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1427604a4f4cSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1428604a4f4cSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1429604a4f4cSmrgAC_SUBST([MAN_SUBSTS])
1430604a4f4cSmrg
143121ecb1efSmrg]) # XORG_MANPAGE_SECTIONS
14321e00de39Smrg
1433604a4f4cSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1434604a4f4cSmrg# ------------------------
1435604a4f4cSmrg# Minimum version: 1.7.0
1436604a4f4cSmrg#
1437604a4f4cSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1438604a4f4cSmrg# provided by xorg-sgml-doctools, if installed.
1439604a4f4cSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1440604a4f4cSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1441604a4f4cSmrgXORG_SGML_PATH=
1442604a4f4cSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1443604a4f4cSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1444604a4f4cSmrg    [m4_ifval([$1],[:],
1445604a4f4cSmrg        [if test x"$cross_compiling" != x"yes" ; then
1446604a4f4cSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1447604a4f4cSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1448604a4f4cSmrg         fi])
1449604a4f4cSmrg    ])
1450604a4f4cSmrg
1451604a4f4cSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1452604a4f4cSmrg# the path and the name of the doc stylesheet
1453604a4f4cSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1454604a4f4cSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1455604a4f4cSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1456604a4f4cSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1457604a4f4cSmrgelse
1458604a4f4cSmrg   AC_MSG_RESULT([no])
1459604a4f4cSmrgfi
1460604a4f4cSmrg
1461604a4f4cSmrgAC_SUBST(XORG_SGML_PATH)
1462604a4f4cSmrgAC_SUBST(STYLESHEET_SRCDIR)
1463604a4f4cSmrgAC_SUBST(XSL_STYLESHEET)
1464604a4f4cSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1465604a4f4cSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1466604a4f4cSmrg
146721ecb1efSmrg# XORG_CHECK_LINUXDOC
146821ecb1efSmrg# -------------------
146921ecb1efSmrg# Minimum version: 1.0.0
14701e00de39Smrg#
147121ecb1efSmrg# Defines the variable MAKE_TEXT if the necessary tools and
147221ecb1efSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
147321ecb1efSmrg# Whether or not the necessary tools and files are found can be checked
147421ecb1efSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
147521ecb1efSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1476604a4f4cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1477604a4f4cSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
14781e00de39Smrg
147921ecb1efSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
14801e00de39Smrg
1481604a4f4cSmrgAC_MSG_CHECKING([whether to build documentation])
14821e00de39Smrg
1483604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
148421ecb1efSmrg   BUILDDOC=yes
148521ecb1efSmrgelse
148621ecb1efSmrg   BUILDDOC=no
14871e00de39Smrgfi
14881e00de39Smrg
148921ecb1efSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
14901e00de39Smrg
149121ecb1efSmrgAC_MSG_RESULT([$BUILDDOC])
14921e00de39Smrg
1493604a4f4cSmrgAC_MSG_CHECKING([whether to build pdf documentation])
14941e00de39Smrg
1495604a4f4cSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
149621ecb1efSmrg   BUILDPDFDOC=yes
149721ecb1efSmrgelse
149821ecb1efSmrg   BUILDPDFDOC=no
149921ecb1efSmrgfi
15001e00de39Smrg
150121ecb1efSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
15021e00de39Smrg
150321ecb1efSmrgAC_MSG_RESULT([$BUILDPDFDOC])
15041e00de39Smrg
1505604a4f4cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
150621ecb1efSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
150721ecb1efSmrgMAKE_PDF="$PS2PDF"
150821ecb1efSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
15091e00de39Smrg
151021ecb1efSmrgAC_SUBST(MAKE_TEXT)
151121ecb1efSmrgAC_SUBST(MAKE_PS)
151221ecb1efSmrgAC_SUBST(MAKE_PDF)
151321ecb1efSmrgAC_SUBST(MAKE_HTML)
151421ecb1efSmrg]) # XORG_CHECK_LINUXDOC
151521ecb1efSmrg
151621ecb1efSmrg# XORG_CHECK_DOCBOOK
151721ecb1efSmrg# -------------------
151821ecb1efSmrg# Minimum version: 1.0.0
15191e00de39Smrg#
152021ecb1efSmrg# Checks for the ability to build output formats from SGML DocBook source.
152121ecb1efSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
152221ecb1efSmrg# indicates whether the necessary tools and files are found and, if set,
152321ecb1efSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
152421ecb1efSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1525604a4f4cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1526604a4f4cSmrg
152721ecb1efSmrgBUILDTXTDOC=no
152821ecb1efSmrgBUILDPDFDOC=no
152921ecb1efSmrgBUILDPSDOC=no
153021ecb1efSmrgBUILDHTMLDOC=no
15311e00de39Smrg
153221ecb1efSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
153321ecb1efSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
153421ecb1efSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
153521ecb1efSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
15361e00de39Smrg
1537604a4f4cSmrgAC_MSG_CHECKING([whether to build text documentation])
1538604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
153921ecb1efSmrg   test x$BUILD_TXTDOC != xno; then
154021ecb1efSmrg	BUILDTXTDOC=yes
154121ecb1efSmrgfi
154221ecb1efSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
154321ecb1efSmrgAC_MSG_RESULT([$BUILDTXTDOC])
15441e00de39Smrg
1545604a4f4cSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1546604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
154721ecb1efSmrg   test x$BUILD_PDFDOC != xno; then
154821ecb1efSmrg	BUILDPDFDOC=yes
15491e00de39Smrgfi
155021ecb1efSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
155121ecb1efSmrgAC_MSG_RESULT([$BUILDPDFDOC])
15521e00de39Smrg
1553604a4f4cSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1554604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
155521ecb1efSmrg   test x$BUILD_PSDOC != xno; then
155621ecb1efSmrg	BUILDPSDOC=yes
155721ecb1efSmrgfi
155821ecb1efSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
155921ecb1efSmrgAC_MSG_RESULT([$BUILDPSDOC])
15601e00de39Smrg
1561604a4f4cSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1562604a4f4cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
156321ecb1efSmrg   test x$BUILD_HTMLDOC != xno; then
156421ecb1efSmrg	BUILDHTMLDOC=yes
156521ecb1efSmrgfi
156621ecb1efSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
156721ecb1efSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
15681e00de39Smrg
156921ecb1efSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
157021ecb1efSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
157121ecb1efSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
157221ecb1efSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
15731e00de39Smrg
157421ecb1efSmrgAC_SUBST(MAKE_TEXT)
157521ecb1efSmrgAC_SUBST(MAKE_PS)
157621ecb1efSmrgAC_SUBST(MAKE_PDF)
157721ecb1efSmrgAC_SUBST(MAKE_HTML)
157821ecb1efSmrg]) # XORG_CHECK_DOCBOOK
15791e00de39Smrg
1580b6f5cd12Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1581604a4f4cSmrg# ----------------
1582604a4f4cSmrg# Minimum version: 1.5.0
1583b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1584604a4f4cSmrg#
1585604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
1586604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
1587604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1588604a4f4cSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1589b6f5cd12Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1590b6f5cd12Smrg# --with-xmlto assumes 'auto'.
1591604a4f4cSmrg#
1592604a4f4cSmrg# Interface to module:
1593604a4f4cSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1594604a4f4cSmrg# XMLTO:	returns the path of the xmlto program found
1595604a4f4cSmrg#		returns the path set by the user in the environment
1596604a4f4cSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1597604a4f4cSmrg#		'no' user instructs the module not to use xmlto
1598604a4f4cSmrg#
1599604a4f4cSmrg# Added in version 1.10.0
1600604a4f4cSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1601604a4f4cSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1602604a4f4cSmrg#
1603604a4f4cSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1604604a4f4cSmrg#
1605604a4f4cSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1606604a4f4cSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1607b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
1608604a4f4cSmrgAC_ARG_WITH(xmlto,
1609604a4f4cSmrg	AS_HELP_STRING([--with-xmlto],
1610b6f5cd12Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1611b6f5cd12Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1612b6f5cd12Smrgm4_undefine([_defopt])
1613604a4f4cSmrg
1614604a4f4cSmrgif test "x$use_xmlto" = x"auto"; then
1615604a4f4cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1616604a4f4cSmrg   if test "x$XMLTO" = "x"; then
1617604a4f4cSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1618604a4f4cSmrg	have_xmlto=no
1619604a4f4cSmrg   else
1620604a4f4cSmrg        have_xmlto=yes
1621604a4f4cSmrg   fi
1622604a4f4cSmrgelif test "x$use_xmlto" = x"yes" ; then
1623604a4f4cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1624604a4f4cSmrg   if test "x$XMLTO" = "x"; then
1625604a4f4cSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1626604a4f4cSmrg   fi
1627604a4f4cSmrg   have_xmlto=yes
1628604a4f4cSmrgelif test "x$use_xmlto" = x"no" ; then
1629604a4f4cSmrg   if test "x$XMLTO" != "x"; then
1630604a4f4cSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1631604a4f4cSmrg   fi
1632604a4f4cSmrg   have_xmlto=no
1633604a4f4cSmrgelse
1634604a4f4cSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1635604a4f4cSmrgfi
1636604a4f4cSmrg
1637604a4f4cSmrg# Test for a minimum version of xmlto, if provided.
1638604a4f4cSmrgm4_ifval([$1],
1639604a4f4cSmrg[if test "$have_xmlto" = yes; then
1640604a4f4cSmrg    # scrape the xmlto version
1641604a4f4cSmrg    AC_MSG_CHECKING([the xmlto version])
1642604a4f4cSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1643604a4f4cSmrg    AC_MSG_RESULT([$xmlto_version])
1644604a4f4cSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1645604a4f4cSmrg        [if test "x$use_xmlto" = xauto; then
1646604a4f4cSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1647604a4f4cSmrg            have_xmlto=no
1648604a4f4cSmrg        else
1649604a4f4cSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1650604a4f4cSmrg        fi])
1651604a4f4cSmrgfi])
1652604a4f4cSmrg
1653604a4f4cSmrg# Test for the ability of xmlto to generate a text target
1654604a4f4cSmrghave_xmlto_text=no
1655604a4f4cSmrgcat > conftest.xml << "EOF"
1656604a4f4cSmrgEOF
1657604a4f4cSmrgAS_IF([test "$have_xmlto" = yes],
1658604a4f4cSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1659604a4f4cSmrg             [have_xmlto_text=yes],
1660604a4f4cSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1661604a4f4cSmrgrm -f conftest.xml
1662604a4f4cSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1663604a4f4cSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1664604a4f4cSmrg]) # XORG_WITH_XMLTO
1665604a4f4cSmrg
1666b6f5cd12Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1667b6f5cd12Smrg# --------------------------------------------
1668b6f5cd12Smrg# Minimum version: 1.12.0
1669b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1670b6f5cd12Smrg#
1671b6f5cd12Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1672b6f5cd12Smrg# XML-based language used for the transformation of XML documents.
1673b6f5cd12Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1674b6f5cd12Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1675b6f5cd12Smrg# The XSLT processor is often used as a standalone tool for transformations.
1676b6f5cd12Smrg# It should not be assumed that this tool is used only to work with documnetation.
1677b6f5cd12Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1678b6f5cd12Smrg#
1679b6f5cd12Smrg# Interface to module:
1680b6f5cd12Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1681b6f5cd12Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1682b6f5cd12Smrg#		 returns the path set by the user in the environment
1683b6f5cd12Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1684b6f5cd12Smrg#		  'no' user instructs the module not to use xsltproc
1685b6f5cd12Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1686b6f5cd12Smrg#
1687b6f5cd12Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1688b6f5cd12Smrg#
1689b6f5cd12SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1690b6f5cd12SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1691b6f5cd12Smrg# Preserves the interface, should it be implemented later
1692b6f5cd12Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1693b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
1694b6f5cd12SmrgAC_ARG_WITH(xsltproc,
1695b6f5cd12Smrg	AS_HELP_STRING([--with-xsltproc],
1696b6f5cd12Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1697b6f5cd12Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1698b6f5cd12Smrgm4_undefine([_defopt])
1699b6f5cd12Smrg
1700b6f5cd12Smrgif test "x$use_xsltproc" = x"auto"; then
1701b6f5cd12Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1702b6f5cd12Smrg   if test "x$XSLTPROC" = "x"; then
1703b6f5cd12Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1704b6f5cd12Smrg	have_xsltproc=no
1705b6f5cd12Smrg   else
1706b6f5cd12Smrg        have_xsltproc=yes
1707b6f5cd12Smrg   fi
1708b6f5cd12Smrgelif test "x$use_xsltproc" = x"yes" ; then
1709b6f5cd12Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1710b6f5cd12Smrg   if test "x$XSLTPROC" = "x"; then
1711b6f5cd12Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1712b6f5cd12Smrg   fi
1713b6f5cd12Smrg   have_xsltproc=yes
1714b6f5cd12Smrgelif test "x$use_xsltproc" = x"no" ; then
1715b6f5cd12Smrg   if test "x$XSLTPROC" != "x"; then
1716b6f5cd12Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1717b6f5cd12Smrg   fi
1718b6f5cd12Smrg   have_xsltproc=no
1719b6f5cd12Smrgelse
1720b6f5cd12Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1721b6f5cd12Smrgfi
1722b6f5cd12Smrg
1723b6f5cd12SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1724b6f5cd12Smrg]) # XORG_WITH_XSLTPROC
1725b6f5cd12Smrg
1726b6f5cd12Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1727b6f5cd12Smrg# ----------------------------------------
1728b6f5cd12Smrg# Minimum version: 1.15.0
1729b6f5cd12Smrg#
1730b6f5cd12Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1731b6f5cd12Smrg# scanning arbitrary text files, extracting information from those text files,
1732b6f5cd12Smrg# and printing reports based on that information.
1733b6f5cd12Smrg#
1734b6f5cd12Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1735b6f5cd12Smrg#
1736b6f5cd12Smrg# Interface to module:
1737b6f5cd12Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1738b6f5cd12Smrg# PERL:	     returns the path of the perl program found
1739b6f5cd12Smrg#	     returns the path set by the user in the environment
1740b6f5cd12Smrg# --with-perl: 'yes' user instructs the module to use perl
1741b6f5cd12Smrg#	       'no' user instructs the module not to use perl
1742b6f5cd12Smrg# have_perl: returns yes if perl found in PATH or no
1743b6f5cd12Smrg#
1744b6f5cd12Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1745b6f5cd12Smrg#
1746b6f5cd12SmrgAC_DEFUN([XORG_WITH_PERL],[
1747b6f5cd12SmrgAC_ARG_VAR([PERL], [Path to perl command])
1748b6f5cd12Smrg# Preserves the interface, should it be implemented later
1749b6f5cd12Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1750b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
1751b6f5cd12SmrgAC_ARG_WITH(perl,
1752b6f5cd12Smrg	AS_HELP_STRING([--with-perl],
1753b6f5cd12Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1754b6f5cd12Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1755b6f5cd12Smrgm4_undefine([_defopt])
1756b6f5cd12Smrg
1757b6f5cd12Smrgif test "x$use_perl" = x"auto"; then
1758b6f5cd12Smrg   AC_PATH_PROG([PERL], [perl])
1759b6f5cd12Smrg   if test "x$PERL" = "x"; then
1760b6f5cd12Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1761b6f5cd12Smrg	have_perl=no
1762b6f5cd12Smrg   else
1763b6f5cd12Smrg        have_perl=yes
1764b6f5cd12Smrg   fi
1765b6f5cd12Smrgelif test "x$use_perl" = x"yes" ; then
1766b6f5cd12Smrg   AC_PATH_PROG([PERL], [perl])
1767b6f5cd12Smrg   if test "x$PERL" = "x"; then
1768b6f5cd12Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1769b6f5cd12Smrg   fi
1770b6f5cd12Smrg   have_perl=yes
1771b6f5cd12Smrgelif test "x$use_perl" = x"no" ; then
1772b6f5cd12Smrg   if test "x$PERL" != "x"; then
1773b6f5cd12Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1774b6f5cd12Smrg   fi
1775b6f5cd12Smrg   have_perl=no
1776b6f5cd12Smrgelse
1777b6f5cd12Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1778b6f5cd12Smrgfi
1779b6f5cd12Smrg
1780b6f5cd12SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1781b6f5cd12Smrg]) # XORG_WITH_PERL
1782b6f5cd12Smrg
1783b6f5cd12Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1784604a4f4cSmrg# ----------------
1785604a4f4cSmrg# Minimum version: 1.5.0
1786b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1787604a4f4cSmrg#
1788604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
1789604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
1790604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1791604a4f4cSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1792b6f5cd12Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1793b6f5cd12Smrg# --with-asciidoc assumes 'auto'.
1794604a4f4cSmrg#
1795604a4f4cSmrg# Interface to module:
1796604a4f4cSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1797604a4f4cSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1798604a4f4cSmrg#		 returns the path set by the user in the environment
1799604a4f4cSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1800604a4f4cSmrg#		  'no' user instructs the module not to use asciidoc
1801604a4f4cSmrg#
1802604a4f4cSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1803604a4f4cSmrg#
1804604a4f4cSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1805604a4f4cSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1806b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
1807604a4f4cSmrgAC_ARG_WITH(asciidoc,
1808604a4f4cSmrg	AS_HELP_STRING([--with-asciidoc],
1809b6f5cd12Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1810b6f5cd12Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1811b6f5cd12Smrgm4_undefine([_defopt])
1812604a4f4cSmrg
1813604a4f4cSmrgif test "x$use_asciidoc" = x"auto"; then
1814604a4f4cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1815604a4f4cSmrg   if test "x$ASCIIDOC" = "x"; then
1816604a4f4cSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1817604a4f4cSmrg	have_asciidoc=no
1818604a4f4cSmrg   else
1819604a4f4cSmrg        have_asciidoc=yes
1820604a4f4cSmrg   fi
1821604a4f4cSmrgelif test "x$use_asciidoc" = x"yes" ; then
1822604a4f4cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1823604a4f4cSmrg   if test "x$ASCIIDOC" = "x"; then
1824604a4f4cSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1825604a4f4cSmrg   fi
1826604a4f4cSmrg   have_asciidoc=yes
1827604a4f4cSmrgelif test "x$use_asciidoc" = x"no" ; then
1828604a4f4cSmrg   if test "x$ASCIIDOC" != "x"; then
1829604a4f4cSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1830604a4f4cSmrg   fi
1831604a4f4cSmrg   have_asciidoc=no
1832604a4f4cSmrgelse
1833604a4f4cSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1834604a4f4cSmrgfi
1835604a4f4cSmrgm4_ifval([$1],
1836604a4f4cSmrg[if test "$have_asciidoc" = yes; then
1837604a4f4cSmrg    # scrape the asciidoc version
1838604a4f4cSmrg    AC_MSG_CHECKING([the asciidoc version])
1839604a4f4cSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1840604a4f4cSmrg    AC_MSG_RESULT([$asciidoc_version])
1841604a4f4cSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1842604a4f4cSmrg        [if test "x$use_asciidoc" = xauto; then
1843604a4f4cSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1844604a4f4cSmrg            have_asciidoc=no
1845604a4f4cSmrg        else
1846604a4f4cSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1847604a4f4cSmrg        fi])
1848604a4f4cSmrgfi])
1849604a4f4cSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1850604a4f4cSmrg]) # XORG_WITH_ASCIIDOC
1851604a4f4cSmrg
1852b6f5cd12Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1853604a4f4cSmrg# --------------------------------
1854604a4f4cSmrg# Minimum version: 1.5.0
1855b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1856604a4f4cSmrg#
1857604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
1858604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
1859604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1860604a4f4cSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1861b6f5cd12Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1862b6f5cd12Smrg# --with-doxygen assumes 'auto'.
1863604a4f4cSmrg#
1864604a4f4cSmrg# Interface to module:
1865604a4f4cSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1866604a4f4cSmrg# DOXYGEN:	 returns the path of the doxygen program found
1867604a4f4cSmrg#		 returns the path set by the user in the environment
1868604a4f4cSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1869604a4f4cSmrg#		  'no' user instructs the module not to use doxygen
1870604a4f4cSmrg#
1871604a4f4cSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1872604a4f4cSmrg#
1873604a4f4cSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1874604a4f4cSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1875b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
1876604a4f4cSmrgAC_ARG_WITH(doxygen,
1877604a4f4cSmrg	AS_HELP_STRING([--with-doxygen],
1878b6f5cd12Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1879b6f5cd12Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1880b6f5cd12Smrgm4_undefine([_defopt])
1881604a4f4cSmrg
1882604a4f4cSmrgif test "x$use_doxygen" = x"auto"; then
1883604a4f4cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1884604a4f4cSmrg   if test "x$DOXYGEN" = "x"; then
1885604a4f4cSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1886604a4f4cSmrg	have_doxygen=no
1887604a4f4cSmrg   else
1888604a4f4cSmrg        have_doxygen=yes
1889604a4f4cSmrg   fi
1890604a4f4cSmrgelif test "x$use_doxygen" = x"yes" ; then
1891604a4f4cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1892604a4f4cSmrg   if test "x$DOXYGEN" = "x"; then
1893604a4f4cSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1894604a4f4cSmrg   fi
1895604a4f4cSmrg   have_doxygen=yes
1896604a4f4cSmrgelif test "x$use_doxygen" = x"no" ; then
1897604a4f4cSmrg   if test "x$DOXYGEN" != "x"; then
1898604a4f4cSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1899604a4f4cSmrg   fi
1900604a4f4cSmrg   have_doxygen=no
1901604a4f4cSmrgelse
1902604a4f4cSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1903604a4f4cSmrgfi
1904604a4f4cSmrgm4_ifval([$1],
1905604a4f4cSmrg[if test "$have_doxygen" = yes; then
1906604a4f4cSmrg    # scrape the doxygen version
1907604a4f4cSmrg    AC_MSG_CHECKING([the doxygen version])
1908604a4f4cSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1909604a4f4cSmrg    AC_MSG_RESULT([$doxygen_version])
1910604a4f4cSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1911604a4f4cSmrg        [if test "x$use_doxygen" = xauto; then
1912604a4f4cSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1913604a4f4cSmrg            have_doxygen=no
1914604a4f4cSmrg        else
1915604a4f4cSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1916604a4f4cSmrg        fi])
1917604a4f4cSmrgfi])
1918604a4f4cSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1919604a4f4cSmrg]) # XORG_WITH_DOXYGEN
1920604a4f4cSmrg
1921b6f5cd12Smrg# XORG_WITH_GROFF([DEFAULT])
1922604a4f4cSmrg# ----------------
1923604a4f4cSmrg# Minimum version: 1.6.0
1924b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1925604a4f4cSmrg#
1926604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
1927604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
1928604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1929604a4f4cSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
1930b6f5cd12Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
1931b6f5cd12Smrg# --with-groff assumes 'auto'.
1932604a4f4cSmrg#
1933604a4f4cSmrg# Interface to module:
1934604a4f4cSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1935604a4f4cSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1936604a4f4cSmrg# HAVE_GROFF_MS: the -ms macros package
1937604a4f4cSmrg# GROFF:	 returns the path of the groff program found
1938604a4f4cSmrg#		 returns the path set by the user in the environment
1939604a4f4cSmrg# --with-groff:	 'yes' user instructs the module to use groff
1940604a4f4cSmrg#		 'no' user instructs the module not to use groff
1941604a4f4cSmrg#
1942604a4f4cSmrg# Added in version 1.9.0:
1943604a4f4cSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1944604a4f4cSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1945604a4f4cSmrg#		   psselect from the psutils package.
1946604a4f4cSmrg#		   the ghostcript package. Refer to the grohtml man pages
1947604a4f4cSmrg#
1948604a4f4cSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1949604a4f4cSmrg#
1950604a4f4cSmrg# OS and distros often splits groff in a basic and full package, the former
1951604a4f4cSmrg# having the groff program and the later having devices, fonts and macros
1952604a4f4cSmrg# Checking for the groff executable is not enough.
1953604a4f4cSmrg#
1954604a4f4cSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
1955604a4f4cSmrg# unset HAVE_GROFF or GROFF env variables.
1956604a4f4cSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1957604a4f4cSmrg#
1958604a4f4cSmrgAC_DEFUN([XORG_WITH_GROFF],[
1959604a4f4cSmrgAC_ARG_VAR([GROFF], [Path to groff command])
1960b6f5cd12Smrgm4_define([_defopt], m4_default([$1], [auto]))
1961604a4f4cSmrgAC_ARG_WITH(groff,
1962604a4f4cSmrg	AS_HELP_STRING([--with-groff],
1963b6f5cd12Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1964b6f5cd12Smrg	   [use_groff=$withval], [use_groff=]_defopt)
1965b6f5cd12Smrgm4_undefine([_defopt])
1966604a4f4cSmrg
1967604a4f4cSmrgif test "x$use_groff" = x"auto"; then
1968604a4f4cSmrg   AC_PATH_PROG([GROFF], [groff])
1969604a4f4cSmrg   if test "x$GROFF" = "x"; then
1970604a4f4cSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1971604a4f4cSmrg	have_groff=no
1972604a4f4cSmrg   else
1973604a4f4cSmrg        have_groff=yes
1974604a4f4cSmrg   fi
1975604a4f4cSmrgelif test "x$use_groff" = x"yes" ; then
1976604a4f4cSmrg   AC_PATH_PROG([GROFF], [groff])
1977604a4f4cSmrg   if test "x$GROFF" = "x"; then
1978604a4f4cSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1979604a4f4cSmrg   fi
1980604a4f4cSmrg   have_groff=yes
1981604a4f4cSmrgelif test "x$use_groff" = x"no" ; then
1982604a4f4cSmrg   if test "x$GROFF" != "x"; then
1983604a4f4cSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1984604a4f4cSmrg   fi
1985604a4f4cSmrg   have_groff=no
1986604a4f4cSmrgelse
1987604a4f4cSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1988604a4f4cSmrgfi
1989604a4f4cSmrg
1990604a4f4cSmrg# We have groff, test for the presence of the macro packages
1991604a4f4cSmrgif test "x$have_groff" = x"yes"; then
1992604a4f4cSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1993604a4f4cSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1994604a4f4cSmrg        groff_ms_works=yes
1995604a4f4cSmrg    else
1996604a4f4cSmrg        groff_ms_works=no
1997604a4f4cSmrg    fi
1998604a4f4cSmrg    AC_MSG_RESULT([$groff_ms_works])
1999604a4f4cSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2000604a4f4cSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2001604a4f4cSmrg        groff_mm_works=yes
2002604a4f4cSmrg    else
2003604a4f4cSmrg        groff_mm_works=no
2004604a4f4cSmrg    fi
2005604a4f4cSmrg    AC_MSG_RESULT([$groff_mm_works])
2006604a4f4cSmrgfi
2007604a4f4cSmrg
2008604a4f4cSmrg# We have groff, test for HTML dependencies, one command per package
2009604a4f4cSmrgif test "x$have_groff" = x"yes"; then
2010604a4f4cSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2011604a4f4cSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2012604a4f4cSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2013604a4f4cSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2014604a4f4cSmrg      have_groff_html=yes
2015604a4f4cSmrg   else
2016604a4f4cSmrg      have_groff_html=no
2017604a4f4cSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2018604a4f4cSmrg   fi
2019604a4f4cSmrgfi
2020604a4f4cSmrg
2021604a4f4cSmrg# Set Automake conditionals for Makefiles
2022604a4f4cSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2023604a4f4cSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2024604a4f4cSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2025604a4f4cSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2026604a4f4cSmrg]) # XORG_WITH_GROFF
2027604a4f4cSmrg
2028b6f5cd12Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2029b6f5cd12Smrg# ---------------------------------------
2030604a4f4cSmrg# Minimum version: 1.6.0
2031b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2032b6f5cd12Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2033604a4f4cSmrg#
2034604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
2035604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
2036604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2037604a4f4cSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2038b6f5cd12Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2039b6f5cd12Smrg# --with-fop assumes 'auto'.
2040604a4f4cSmrg#
2041604a4f4cSmrg# Interface to module:
2042604a4f4cSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2043604a4f4cSmrg# FOP:	 	returns the path of the fop program found
2044604a4f4cSmrg#		returns the path set by the user in the environment
2045604a4f4cSmrg# --with-fop: 	'yes' user instructs the module to use fop
2046604a4f4cSmrg#		'no' user instructs the module not to use fop
2047604a4f4cSmrg#
2048604a4f4cSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2049604a4f4cSmrg#
2050604a4f4cSmrgAC_DEFUN([XORG_WITH_FOP],[
2051604a4f4cSmrgAC_ARG_VAR([FOP], [Path to fop command])
2052b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
2053604a4f4cSmrgAC_ARG_WITH(fop,
2054604a4f4cSmrg	AS_HELP_STRING([--with-fop],
2055b6f5cd12Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2056b6f5cd12Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2057b6f5cd12Smrgm4_undefine([_defopt])
2058604a4f4cSmrg
2059604a4f4cSmrgif test "x$use_fop" = x"auto"; then
2060604a4f4cSmrg   AC_PATH_PROG([FOP], [fop])
2061604a4f4cSmrg   if test "x$FOP" = "x"; then
2062604a4f4cSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2063604a4f4cSmrg	have_fop=no
2064604a4f4cSmrg   else
2065604a4f4cSmrg        have_fop=yes
2066604a4f4cSmrg   fi
2067604a4f4cSmrgelif test "x$use_fop" = x"yes" ; then
2068604a4f4cSmrg   AC_PATH_PROG([FOP], [fop])
2069604a4f4cSmrg   if test "x$FOP" = "x"; then
2070604a4f4cSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2071604a4f4cSmrg   fi
2072604a4f4cSmrg   have_fop=yes
2073604a4f4cSmrgelif test "x$use_fop" = x"no" ; then
2074604a4f4cSmrg   if test "x$FOP" != "x"; then
2075604a4f4cSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2076604a4f4cSmrg   fi
2077604a4f4cSmrg   have_fop=no
2078604a4f4cSmrgelse
2079604a4f4cSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2080604a4f4cSmrgfi
2081b6f5cd12Smrg
2082b6f5cd12Smrg# Test for a minimum version of fop, if provided.
2083b6f5cd12Smrgm4_ifval([$1],
2084b6f5cd12Smrg[if test "$have_fop" = yes; then
2085b6f5cd12Smrg    # scrape the fop version
2086b6f5cd12Smrg    AC_MSG_CHECKING([for fop minimum version])
2087b6f5cd12Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2088b6f5cd12Smrg    AC_MSG_RESULT([$fop_version])
2089b6f5cd12Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2090b6f5cd12Smrg        [if test "x$use_fop" = xauto; then
2091b6f5cd12Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2092b6f5cd12Smrg            have_fop=no
2093b6f5cd12Smrg        else
2094b6f5cd12Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2095b6f5cd12Smrg        fi])
2096b6f5cd12Smrgfi])
2097604a4f4cSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2098604a4f4cSmrg]) # XORG_WITH_FOP
2099604a4f4cSmrg
2100b6f5cd12Smrg# XORG_WITH_PS2PDF([DEFAULT])
2101604a4f4cSmrg# ----------------
2102604a4f4cSmrg# Minimum version: 1.6.0
2103b6f5cd12Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2104604a4f4cSmrg#
2105604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
2106604a4f4cSmrg# not at the appropriate level. This macro enables a module to test for the
2107604a4f4cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2108604a4f4cSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2109b6f5cd12Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2110b6f5cd12Smrg# --with-ps2pdf assumes 'auto'.
2111604a4f4cSmrg#
2112604a4f4cSmrg# Interface to module:
2113604a4f4cSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2114604a4f4cSmrg# PS2PDF:	returns the path of the ps2pdf program found
2115604a4f4cSmrg#		returns the path set by the user in the environment
2116604a4f4cSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2117604a4f4cSmrg#		 'no' user instructs the module not to use ps2pdf
2118604a4f4cSmrg#
2119604a4f4cSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2120604a4f4cSmrg#
2121604a4f4cSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2122604a4f4cSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2123b6f5cd12Smrgm4_define([_defopt], m4_default([$1], [auto]))
2124604a4f4cSmrgAC_ARG_WITH(ps2pdf,
2125604a4f4cSmrg	AS_HELP_STRING([--with-ps2pdf],
2126b6f5cd12Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2127b6f5cd12Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2128b6f5cd12Smrgm4_undefine([_defopt])
2129604a4f4cSmrg
2130604a4f4cSmrgif test "x$use_ps2pdf" = x"auto"; then
2131604a4f4cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2132604a4f4cSmrg   if test "x$PS2PDF" = "x"; then
2133604a4f4cSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2134604a4f4cSmrg	have_ps2pdf=no
2135604a4f4cSmrg   else
2136604a4f4cSmrg        have_ps2pdf=yes
2137604a4f4cSmrg   fi
2138604a4f4cSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2139604a4f4cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2140604a4f4cSmrg   if test "x$PS2PDF" = "x"; then
2141604a4f4cSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2142604a4f4cSmrg   fi
2143604a4f4cSmrg   have_ps2pdf=yes
2144604a4f4cSmrgelif test "x$use_ps2pdf" = x"no" ; then
2145604a4f4cSmrg   if test "x$PS2PDF" != "x"; then
2146604a4f4cSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2147604a4f4cSmrg   fi
2148604a4f4cSmrg   have_ps2pdf=no
2149604a4f4cSmrgelse
2150604a4f4cSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2151604a4f4cSmrgfi
2152604a4f4cSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2153604a4f4cSmrg]) # XORG_WITH_PS2PDF
2154604a4f4cSmrg
2155604a4f4cSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2156604a4f4cSmrg# ----------------
2157604a4f4cSmrg# Minimum version: 1.6.0
2158604a4f4cSmrg#
2159604a4f4cSmrg# Documentation tools are not always available on all platforms and sometimes
2160604a4f4cSmrg# not at the appropriate level. This macro enables a builder to skip all
2161604a4f4cSmrg# documentation targets except traditional man pages.
2162604a4f4cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2163604a4f4cSmrg# maximum flexibilty in controlling documentation building.
2164604a4f4cSmrg# Refer to:
2165604a4f4cSmrg# XORG_WITH_XMLTO         --with-xmlto
2166604a4f4cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2167604a4f4cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2168604a4f4cSmrg# XORG_WITH_FOP           --with-fop
2169604a4f4cSmrg# XORG_WITH_GROFF         --with-groff
2170604a4f4cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2171604a4f4cSmrg#
2172604a4f4cSmrg# Interface to module:
2173604a4f4cSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2174604a4f4cSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2175604a4f4cSmrg#		 'no' user instructs the module not to generate docs
2176604a4f4cSmrg# parm1:	specify the default value, yes or no.
2177604a4f4cSmrg#
2178604a4f4cSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2179b6f5cd12Smrgm4_define([docs_default], m4_default([$1], [yes]))
2180604a4f4cSmrgAC_ARG_ENABLE(docs,
2181604a4f4cSmrg	AS_HELP_STRING([--enable-docs],
2182b6f5cd12Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2183b6f5cd12Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2184b6f5cd12Smrgm4_undefine([docs_default])
2185604a4f4cSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2186604a4f4cSmrgAC_MSG_CHECKING([whether to build documentation])
2187604a4f4cSmrgAC_MSG_RESULT([$build_docs])
2188604a4f4cSmrg]) # XORG_ENABLE_DOCS
2189604a4f4cSmrg
2190604a4f4cSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2191604a4f4cSmrg# ----------------
2192604a4f4cSmrg# Minimum version: 1.6.0
2193604a4f4cSmrg#
2194604a4f4cSmrg# This macro enables a builder to skip all developer documentation.
2195604a4f4cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2196604a4f4cSmrg# maximum flexibilty in controlling documentation building.
2197604a4f4cSmrg# Refer to:
2198604a4f4cSmrg# XORG_WITH_XMLTO         --with-xmlto
2199604a4f4cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2200604a4f4cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2201604a4f4cSmrg# XORG_WITH_FOP           --with-fop
2202604a4f4cSmrg# XORG_WITH_GROFF         --with-groff
2203604a4f4cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2204604a4f4cSmrg#
2205604a4f4cSmrg# Interface to module:
2206604a4f4cSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2207604a4f4cSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2208604a4f4cSmrg#			'no' user instructs the module not to generate developer docs
2209604a4f4cSmrg# parm1:		specify the default value, yes or no.
2210604a4f4cSmrg#
2211604a4f4cSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2212b6f5cd12Smrgm4_define([devel_default], m4_default([$1], [yes]))
2213604a4f4cSmrgAC_ARG_ENABLE(devel-docs,
2214604a4f4cSmrg	AS_HELP_STRING([--enable-devel-docs],
2215b6f5cd12Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2216b6f5cd12Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2217b6f5cd12Smrgm4_undefine([devel_default])
2218604a4f4cSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2219604a4f4cSmrgAC_MSG_CHECKING([whether to build developer documentation])
2220604a4f4cSmrgAC_MSG_RESULT([$build_devel_docs])
2221604a4f4cSmrg]) # XORG_ENABLE_DEVEL_DOCS
2222604a4f4cSmrg
2223604a4f4cSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2224604a4f4cSmrg# ----------------
2225604a4f4cSmrg# Minimum version: 1.6.0
2226604a4f4cSmrg#
2227604a4f4cSmrg# This macro enables a builder to skip all functional specification targets.
2228604a4f4cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2229604a4f4cSmrg# maximum flexibilty in controlling documentation building.
2230604a4f4cSmrg# Refer to:
2231604a4f4cSmrg# XORG_WITH_XMLTO         --with-xmlto
2232604a4f4cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2233604a4f4cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2234604a4f4cSmrg# XORG_WITH_FOP           --with-fop
2235604a4f4cSmrg# XORG_WITH_GROFF         --with-groff
2236604a4f4cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2237604a4f4cSmrg#
2238604a4f4cSmrg# Interface to module:
2239604a4f4cSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2240604a4f4cSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2241604a4f4cSmrg#			'no' user instructs the module not to generate specs
2242604a4f4cSmrg# parm1:		specify the default value, yes or no.
2243604a4f4cSmrg#
2244604a4f4cSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2245b6f5cd12Smrgm4_define([spec_default], m4_default([$1], [yes]))
2246604a4f4cSmrgAC_ARG_ENABLE(specs,
2247604a4f4cSmrg	AS_HELP_STRING([--enable-specs],
2248b6f5cd12Smrg	   [Enable building the specs (default: ]spec_default[)]),
2249b6f5cd12Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2250b6f5cd12Smrgm4_undefine([spec_default])
2251604a4f4cSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2252604a4f4cSmrgAC_MSG_CHECKING([whether to build functional specifications])
2253604a4f4cSmrgAC_MSG_RESULT([$build_specs])
2254604a4f4cSmrg]) # XORG_ENABLE_SPECS
2255604a4f4cSmrg
2256b6f5cd12Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2257b6f5cd12Smrg# ----------------------------------------------
2258b6f5cd12Smrg# Minimum version: 1.13.0
2259b6f5cd12Smrg#
2260b6f5cd12Smrg# This macro enables a builder to enable/disable unit testing
2261b6f5cd12Smrg# It makes no assumption about the test cases implementation
2262b6f5cd12Smrg# Test cases may or may not use Automake "Support for test suites"
2263b6f5cd12Smrg# They may or may not use the software utility library GLib
2264b6f5cd12Smrg#
2265b6f5cd12Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2266b6f5cd12Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2267b6f5cd12Smrg# The variable enable_unit_tests is used by other macros in this file.
2268b6f5cd12Smrg#
2269b6f5cd12Smrg# Interface to module:
2270b6f5cd12Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2271b6f5cd12Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2272b6f5cd12Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2273b6f5cd12Smrg#			'no' user instructs the module not to build tests
2274b6f5cd12Smrg# parm1:		specify the default value, yes or no.
2275b6f5cd12Smrg#
2276b6f5cd12SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2277b6f5cd12SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2278b6f5cd12SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2279b6f5cd12SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2280b6f5cd12Smrgm4_define([_defopt], m4_default([$1], [auto]))
2281b6f5cd12SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2282b6f5cd12Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2283b6f5cd12Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2284b6f5cd12Smrgm4_undefine([_defopt])
2285b6f5cd12SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2286b6f5cd12SmrgAC_MSG_CHECKING([whether to build unit test cases])
2287b6f5cd12SmrgAC_MSG_RESULT([$enable_unit_tests])
2288b6f5cd12Smrg]) # XORG_ENABLE_UNIT_TESTS
2289b6f5cd12Smrg
2290b6f5cd12Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2291b6f5cd12Smrg# ------------------------------------------------------
2292b6f5cd12Smrg# Minimum version: 1.17.0
2293b6f5cd12Smrg#
2294b6f5cd12Smrg# This macro enables a builder to enable/disable integration testing
2295b6f5cd12Smrg# It makes no assumption about the test cases' implementation
2296b6f5cd12Smrg# Test cases may or may not use Automake "Support for test suites"
2297b6f5cd12Smrg#
2298b6f5cd12Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2299b6f5cd12Smrg# usually requires less dependencies and may be built and run under less
2300b6f5cd12Smrg# stringent environments than integration tests.
2301b6f5cd12Smrg#
2302b6f5cd12Smrg# Interface to module:
2303b6f5cd12Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2304b6f5cd12Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2305b6f5cd12Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2306b6f5cd12Smrg#                             'no' user instructs the module not to build tests
2307b6f5cd12Smrg# parm1:                      specify the default value, yes or no.
2308b6f5cd12Smrg#
2309b6f5cd12SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2310b6f5cd12SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2311b6f5cd12Smrgm4_define([_defopt], m4_default([$1], [auto]))
2312b6f5cd12SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2313b6f5cd12Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2314b6f5cd12Smrg	[enable_integration_tests=$enableval],
2315b6f5cd12Smrg	[enable_integration_tests=]_defopt)
2316b6f5cd12Smrgm4_undefine([_defopt])
2317b6f5cd12SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2318b6f5cd12Smrg	[test "x$enable_integration_tests" != xno])
2319b6f5cd12SmrgAC_MSG_CHECKING([whether to build unit test cases])
2320b6f5cd12SmrgAC_MSG_RESULT([$enable_integration_tests])
2321b6f5cd12Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2322b6f5cd12Smrg
2323b6f5cd12Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2324b6f5cd12Smrg# ----------------------------------------
2325b6f5cd12Smrg# Minimum version: 1.13.0
2326b6f5cd12Smrg#
2327b6f5cd12Smrg# GLib is a library which provides advanced data structures and functions.
2328b6f5cd12Smrg# This macro enables a module to test for the presence of Glib.
2329b6f5cd12Smrg#
2330b6f5cd12Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2331b6f5cd12Smrg# Otherwise the value of $enable_unit_tests is blank.
2332b6f5cd12Smrg#
2333b6f5cd12Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2334b6f5cd12Smrg# test support usually requires less dependencies and may be built and run under
2335b6f5cd12Smrg# less stringent environments than integration tests.
2336b6f5cd12Smrg#
2337b6f5cd12Smrg# Interface to module:
2338b6f5cd12Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2339b6f5cd12Smrg# with_glib: used in configure.ac to know if GLib has been found
2340b6f5cd12Smrg# --with-glib:	'yes' user instructs the module to use glib
2341b6f5cd12Smrg#		'no' user instructs the module not to use glib
2342b6f5cd12Smrg#
2343b6f5cd12SmrgAC_DEFUN([XORG_WITH_GLIB],[
2344b6f5cd12SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2345b6f5cd12Smrgm4_define([_defopt], m4_default([$2], [auto]))
2346b6f5cd12SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2347b6f5cd12Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2348b6f5cd12Smrg	[with_glib=$withval], [with_glib=]_defopt)
2349b6f5cd12Smrgm4_undefine([_defopt])
2350b6f5cd12Smrg
2351b6f5cd12Smrghave_glib=no
2352b6f5cd12Smrg# Do not probe GLib if user explicitly disabled unit testing
2353b6f5cd12Smrgif test "x$enable_unit_tests" != x"no"; then
2354b6f5cd12Smrg  # Do not probe GLib if user explicitly disabled it
2355b6f5cd12Smrg  if test "x$with_glib" != x"no"; then
2356b6f5cd12Smrg    m4_ifval(
2357b6f5cd12Smrg      [$1],
2358b6f5cd12Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2359b6f5cd12Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2360b6f5cd12Smrg    )
2361b6f5cd12Smrg  fi
2362b6f5cd12Smrgfi
2363b6f5cd12Smrg
2364b6f5cd12Smrg# Not having GLib when unit testing has been explicitly requested is an error
2365b6f5cd12Smrgif test "x$enable_unit_tests" = x"yes"; then
2366b6f5cd12Smrg  if test "x$have_glib" = x"no"; then
2367b6f5cd12Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2368b6f5cd12Smrg  fi
2369b6f5cd12Smrgfi
2370b6f5cd12Smrg
2371b6f5cd12Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2372b6f5cd12Smrgif test "x$enable_unit_tests" = x"no"; then
2373b6f5cd12Smrg  if test "x$with_glib" = x"yes"; then
2374b6f5cd12Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2375b6f5cd12Smrg  fi
2376b6f5cd12Smrgfi
2377b6f5cd12Smrg
2378b6f5cd12Smrg# Not having GLib when it has been explicitly requested is an error
2379b6f5cd12Smrgif test "x$with_glib" = x"yes"; then
2380b6f5cd12Smrg  if test "x$have_glib" = x"no"; then
2381b6f5cd12Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2382b6f5cd12Smrg  fi
2383b6f5cd12Smrgfi
2384b6f5cd12Smrg
2385b6f5cd12SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2386b6f5cd12Smrg]) # XORG_WITH_GLIB
2387b6f5cd12Smrg
2388b6f5cd12Smrg# XORG_LD_WRAP([required|optional])
2389b6f5cd12Smrg# ---------------------------------
2390b6f5cd12Smrg# Minimum version: 1.13.0
2391b6f5cd12Smrg#
2392b6f5cd12Smrg# Check if linker supports -wrap, passed via compiler flags
2393b6f5cd12Smrg#
2394b6f5cd12Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2395b6f5cd12Smrg# Otherwise the value of $enable_unit_tests is blank.
2396b6f5cd12Smrg#
2397b6f5cd12Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2398b6f5cd12Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2399b6f5cd12Smrg# available, an argument of "optional" allows use when some unit tests require
2400b6f5cd12Smrg# ld -wrap and others do not.
2401b6f5cd12Smrg#
2402b6f5cd12SmrgAC_DEFUN([XORG_LD_WRAP],[
2403b6f5cd12SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2404b6f5cd12Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2405b6f5cd12Smrg                      void __wrap_exit(int status) { return; }],
2406b6f5cd12Smrg                     [exit(0);])])
2407b6f5cd12Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2408b6f5cd12Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2409b6f5cd12Smrg  if test "x$have_ld_wrap" = x"no"; then
2410b6f5cd12Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2411b6f5cd12Smrg  fi
2412b6f5cd12Smrgfi
2413b6f5cd12SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2414b6f5cd12Smrg#
2415b6f5cd12Smrg]) # XORG_LD_WRAP
2416b6f5cd12Smrg
2417b6f5cd12Smrg# XORG_CHECK_LINKER_FLAGS
2418b6f5cd12Smrg# -----------------------
2419b6f5cd12Smrg# SYNOPSIS
2420b6f5cd12Smrg#
2421b6f5cd12Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2422b6f5cd12Smrg#
2423b6f5cd12Smrg# DESCRIPTION
2424b6f5cd12Smrg#
2425b6f5cd12Smrg#   Check whether the given linker FLAGS work with the current language's
2426b6f5cd12Smrg#   linker, or whether they give an error.
2427b6f5cd12Smrg#
2428b6f5cd12Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2429b6f5cd12Smrg#   success/failure.
2430b6f5cd12Smrg#
2431b6f5cd12Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2432b6f5cd12Smrg#
2433b6f5cd12Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2434b6f5cd12Smrg#
2435b6f5cd12Smrg# LICENSE
2436b6f5cd12Smrg#
2437b6f5cd12Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2438b6f5cd12Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2439b6f5cd12Smrg#   Copyright (c) 2009 Matteo Frigo
2440b6f5cd12Smrg#
2441b6f5cd12Smrg#   This program is free software: you can redistribute it and/or modify it
2442b6f5cd12Smrg#   under the terms of the GNU General Public License as published by the
2443b6f5cd12Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2444b6f5cd12Smrg#   option) any later version.
2445b6f5cd12Smrg#
2446b6f5cd12Smrg#   This program is distributed in the hope that it will be useful, but
2447b6f5cd12Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2448b6f5cd12Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2449b6f5cd12Smrg#   Public License for more details.
2450b6f5cd12Smrg#
2451b6f5cd12Smrg#   You should have received a copy of the GNU General Public License along
2452b6f5cd12Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2453b6f5cd12Smrg#
2454b6f5cd12Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2455b6f5cd12Smrg#   gives unlimited permission to copy, distribute and modify the configure
2456b6f5cd12Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2457b6f5cd12Smrg#   need not follow the terms of the GNU General Public License when using
2458b6f5cd12Smrg#   or distributing such scripts, even though portions of the text of the
2459b6f5cd12Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2460b6f5cd12Smrg#   all other use of the material that constitutes the Autoconf Macro.
2461b6f5cd12Smrg#
2462b6f5cd12Smrg#   This special exception to the GPL applies to versions of the Autoconf
2463b6f5cd12Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2464b6f5cd12Smrg#   modified version of the Autoconf Macro, you may extend this special
2465b6f5cd12Smrg#   exception to the GPL to apply to your modified version as well.#
2466b6f5cd12SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2467b6f5cd12Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2468b6f5cd12Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2469b6f5cd12SmrgAS_LITERAL_IF([$1],
2470b6f5cd12Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2471b6f5cd12Smrg      ax_save_FLAGS=$LDFLAGS
2472b6f5cd12Smrg      LDFLAGS="$1"
2473b6f5cd12Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2474b6f5cd12Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2475b6f5cd12Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2476b6f5cd12Smrg      LDFLAGS=$ax_save_FLAGS])],
2477b6f5cd12Smrg  [ax_save_FLAGS=$LDFLAGS
2478b6f5cd12Smrg   LDFLAGS="$1"
2479b6f5cd12Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2480b6f5cd12Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2481b6f5cd12Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2482b6f5cd12Smrg   LDFLAGS=$ax_save_FLAGS])
2483b6f5cd12Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2484b6f5cd12SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2485b6f5cd12Smrgif test "x$xorg_check_linker_flags" = xyes; then
2486b6f5cd12Smrg	m4_default([$2], :)
2487b6f5cd12Smrgelse
2488b6f5cd12Smrg	m4_default([$3], :)
2489b6f5cd12Smrgfi
2490b6f5cd12Smrg]) # XORG_CHECK_LINKER_FLAGS
2491b6f5cd12Smrg
2492b6f5cd12Smrg# XORG_MEMORY_CHECK_FLAGS
2493b6f5cd12Smrg# -----------------------
2494b6f5cd12Smrg# Minimum version: 1.16.0
2495b6f5cd12Smrg#
2496b6f5cd12Smrg# This macro attempts to find appropriate memory checking functionality
2497b6f5cd12Smrg# for various platforms which unit testing code may use to catch various
2498b6f5cd12Smrg# forms of memory allocation and access errors in testing.
2499b6f5cd12Smrg#
2500b6f5cd12Smrg# Interface to module:
2501b6f5cd12Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2502b6f5cd12Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2503b6f5cd12Smrg#
2504b6f5cd12Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2505b6f5cd12Smrg#
2506b6f5cd12SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2507b6f5cd12Smrg
2508b6f5cd12SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2509b6f5cd12SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2510b6f5cd12Smrg           [Environment variables to enable memory checking in tests])
2511b6f5cd12Smrg
2512b6f5cd12Smrg# Check for different types of support on different platforms
2513b6f5cd12Smrgcase $host_os in
2514b6f5cd12Smrg    solaris*)
2515b6f5cd12Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2516b6f5cd12Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2517b6f5cd12Smrg        ;;
2518b6f5cd12Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2519b6f5cd12Smrg        # both directly and inverted, so should not be 0 or 255.
2520b6f5cd12Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2521b6f5cd12Smrg        ;;
2522b6f5cd12Smrg    darwin*)
2523b6f5cd12Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2524b6f5cd12Smrg        ;;
2525b6f5cd12Smrg    *bsd*)
2526b6f5cd12Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2527b6f5cd12Smrg        ;;
2528b6f5cd12Smrgesac
2529b6f5cd12Smrg
2530b6f5cd12Smrg# User supplied flags override default flags
2531b6f5cd12Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2532b6f5cd12Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2533b6f5cd12Smrgfi
2534b6f5cd12Smrg
2535b6f5cd12SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2536b6f5cd12Smrg]) # XORG_WITH_LINT
2537b6f5cd12Smrg
253821ecb1efSmrg# XORG_CHECK_MALLOC_ZERO
253921ecb1efSmrg# ----------------------
254021ecb1efSmrg# Minimum version: 1.0.0
254121ecb1efSmrg#
254221ecb1efSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
254321ecb1efSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
254421ecb1efSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
254521ecb1efSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
254621ecb1efSmrgAC_ARG_ENABLE(malloc0returnsnull,
254721ecb1efSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
254821ecb1efSmrg		       [malloc(0) returns NULL (default: auto)]),
254921ecb1efSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
255021ecb1efSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
25511e00de39Smrg
255221ecb1efSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
255321ecb1efSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2554b6f5cd12Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2555b6f5cd12Smrg#include <stdlib.h>
2556b6f5cd12Smrg],[
255721ecb1efSmrg    char *m0, *r0, *c0, *p;
255821ecb1efSmrg    m0 = malloc(0);
255921ecb1efSmrg    p = malloc(10);
256021ecb1efSmrg    r0 = realloc(p,0);
2561b6f5cd12Smrg    c0 = calloc(0,10);
2562b6f5cd12Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2563b6f5cd12Smrg])],
256421ecb1efSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2565604a4f4cSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
2566604a4f4cSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
256721ecb1efSmrgfi
256821ecb1efSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
25691e00de39Smrg
257021ecb1efSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
257121ecb1efSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
257221ecb1efSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
257321ecb1efSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
257421ecb1efSmrgelse
257521ecb1efSmrg	MALLOC_ZERO_CFLAGS=""
257621ecb1efSmrg	XMALLOC_ZERO_CFLAGS=""
257721ecb1efSmrg	XTMALLOC_ZERO_CFLAGS=""
257821ecb1efSmrgfi
25791e00de39Smrg
258021ecb1efSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
258121ecb1efSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
258221ecb1efSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
258321ecb1efSmrg]) # XORG_CHECK_MALLOC_ZERO
25841e00de39Smrg
258521ecb1efSmrg# XORG_WITH_LINT()
258621ecb1efSmrg# ----------------
258721ecb1efSmrg# Minimum version: 1.1.0
258821ecb1efSmrg#
2589604a4f4cSmrg# This macro enables the use of a tool that flags some suspicious and
2590604a4f4cSmrg# non-portable constructs (likely to be bugs) in C language source code.
2591604a4f4cSmrg# It will attempt to locate the tool and use appropriate options.
2592604a4f4cSmrg# There are various lint type tools on different platforms.
2593604a4f4cSmrg#
2594604a4f4cSmrg# Interface to module:
2595604a4f4cSmrg# LINT:		returns the path to the tool found on the platform
2596604a4f4cSmrg#		or the value set to LINT on the configure cmd line
2597604a4f4cSmrg#		also an Automake conditional
2598604a4f4cSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2599604a4f4cSmrg#
2600604a4f4cSmrg# --with-lint:	'yes' user instructs the module to use lint
2601604a4f4cSmrg#		'no' user instructs the module not to use lint (default)
2602604a4f4cSmrg#
2603604a4f4cSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2604604a4f4cSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
260521ecb1efSmrg#
260621ecb1efSmrgAC_DEFUN([XORG_WITH_LINT],[
260721ecb1efSmrg
2608604a4f4cSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2609604a4f4cSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
261021ecb1efSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
261121ecb1efSmrg		[Use a lint-style source code checker (default: disabled)])],
261221ecb1efSmrg		[use_lint=$withval], [use_lint=no])
2613604a4f4cSmrg
2614604a4f4cSmrg# Obtain platform specific info like program name and options
2615604a4f4cSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2616604a4f4cSmrgcase $host_os in
2617604a4f4cSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2618604a4f4cSmrg	lint_name=splint
2619604a4f4cSmrg	lint_options="-badflag"
2620604a4f4cSmrg	;;
2621604a4f4cSmrg  *freebsd* | *netbsd*)
2622604a4f4cSmrg	lint_name=lint
2623604a4f4cSmrg	lint_options="-u -b"
2624604a4f4cSmrg	;;
2625604a4f4cSmrg  *solaris*)
2626604a4f4cSmrg	lint_name=lint
2627604a4f4cSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2628604a4f4cSmrg	;;
2629604a4f4cSmrgesac
2630604a4f4cSmrg
2631604a4f4cSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2632604a4f4cSmrgif test "x$use_lint" = x"yes" ; then
2633604a4f4cSmrg   AC_PATH_PROG([LINT], [$lint_name])
2634604a4f4cSmrg   if test "x$LINT" = "x"; then
2635604a4f4cSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2636604a4f4cSmrg   fi
2637604a4f4cSmrgelif test "x$use_lint" = x"no" ; then
2638604a4f4cSmrg   if test "x$LINT" != "x"; then
2639604a4f4cSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2640604a4f4cSmrg   fi
264121ecb1efSmrgelse
2642604a4f4cSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
26431e00de39Smrgfi
2644604a4f4cSmrg
2645604a4f4cSmrg# User supplied flags override default flags
2646604a4f4cSmrgif test "x$LINT_FLAGS" != "x"; then
2647604a4f4cSmrg   lint_options=$LINT_FLAGS
26481e00de39Smrgfi
26491e00de39Smrg
2650604a4f4cSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2651604a4f4cSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
26521e00de39Smrg
265321ecb1efSmrg]) # XORG_WITH_LINT
26541e00de39Smrg
265521ecb1efSmrg# XORG_LINT_LIBRARY(LIBNAME)
265621ecb1efSmrg# --------------------------
265721ecb1efSmrg# Minimum version: 1.1.0
265821ecb1efSmrg#
265921ecb1efSmrg# Sets up flags for building lint libraries for checking programs that call
266021ecb1efSmrg# functions in the library.
266121ecb1efSmrg#
2662604a4f4cSmrg# Interface to module:
2663604a4f4cSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2664604a4f4cSmrg# MAKE_LINT_LIB		- Automake conditional
2665604a4f4cSmrg#
2666604a4f4cSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2667604a4f4cSmrg#			  - 'no' user instructs the module not to create a lint library (default)
26681e00de39Smrg
266921ecb1efSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
267021ecb1efSmrgAC_REQUIRE([XORG_WITH_LINT])
267121ecb1efSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
267221ecb1efSmrg	[Create lint library (default: disabled)])],
267321ecb1efSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2674604a4f4cSmrg
2675604a4f4cSmrgif test "x$make_lint_lib" = x"yes" ; then
2676604a4f4cSmrg   LINTLIB=llib-l$1.ln
2677604a4f4cSmrg   if test "x$LINT" = "x"; then
2678604a4f4cSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2679604a4f4cSmrg   fi
2680604a4f4cSmrgelif test "x$make_lint_lib" != x"no" ; then
2681604a4f4cSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
268221ecb1efSmrgfi
2683604a4f4cSmrg
268421ecb1efSmrgAC_SUBST(LINTLIB)
268521ecb1efSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
26861e00de39Smrg
268721ecb1efSmrg]) # XORG_LINT_LIBRARY
26881e00de39Smrg
2689b6f5cd12Smrg# XORG_COMPILER_BRAND
2690b6f5cd12Smrg# -------------------
2691b6f5cd12Smrg# Minimum version: 1.14.0
2692b6f5cd12Smrg#
2693b6f5cd12Smrg# Checks for various brands of compilers and sets flags as appropriate:
2694b6f5cd12Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2695b6f5cd12Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2696b6f5cd12Smrg#   clang compiler - sets CLANGCC to "yes"
2697b6f5cd12Smrg#   Intel compiler - sets INTELCC to "yes"
2698b6f5cd12Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2699b6f5cd12Smrg#
2700b6f5cd12SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2701b6f5cd12SmrgAC_LANG_CASE(
2702b6f5cd12Smrg	[C], [
2703b6f5cd12Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2704b6f5cd12Smrg	],
2705b6f5cd12Smrg	[C++], [
2706b6f5cd12Smrg		AC_REQUIRE([AC_PROG_CXX])
2707b6f5cd12Smrg	]
2708b6f5cd12Smrg)
2709b6f5cd12SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2710b6f5cd12SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2711b6f5cd12SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2712b6f5cd12Smrg]) # XORG_COMPILER_BRAND
2713b6f5cd12Smrg
2714b6f5cd12Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2715b6f5cd12Smrg# ---------------
2716b6f5cd12Smrg# Minimum version: 1.16.0
2717b6f5cd12Smrg#
2718b6f5cd12Smrg# Test if the compiler works when passed the given flag as a command line argument.
2719b6f5cd12Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2720b6f5cd12Smrg# next flag in the list until there are no more options.
2721b6f5cd12Smrg#
2722b6f5cd12Smrg# Note that this does not guarantee that the compiler supports the flag as some
2723b6f5cd12Smrg# compilers will simply ignore arguments that they do not understand, but we do
2724b6f5cd12Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2725b6f5cd12Smrg# -Werror=unused-command-line-argument
2726b6f5cd12Smrg#
2727b6f5cd12SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2728b6f5cd12Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2729b6f5cd12Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2730b6f5cd12Smrg
2731b6f5cd12SmrgAC_LANG_COMPILER_REQUIRE
2732b6f5cd12Smrg
2733b6f5cd12SmrgAC_LANG_CASE(
2734b6f5cd12Smrg	[C], [
2735b6f5cd12Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2736b6f5cd12Smrg		define([PREFIX], [C])
2737b6f5cd12Smrg		define([CACHE_PREFIX], [cc])
2738b6f5cd12Smrg		define([COMPILER], [$CC])
2739b6f5cd12Smrg	],
2740b6f5cd12Smrg	[C++], [
2741b6f5cd12Smrg		define([PREFIX], [CXX])
2742b6f5cd12Smrg		define([CACHE_PREFIX], [cxx])
2743b6f5cd12Smrg		define([COMPILER], [$CXX])
2744b6f5cd12Smrg	]
2745b6f5cd12Smrg)
2746b6f5cd12Smrg
2747b6f5cd12Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2748b6f5cd12Smrg
2749b6f5cd12Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2750b6f5cd12Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2751b6f5cd12Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2752b6f5cd12Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2753b6f5cd12Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2754b6f5cd12Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2755b6f5cd12Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2756b6f5cd12Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2757b6f5cd12Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2758b6f5cd12Smrgfi
2759b6f5cd12Smrg
2760b6f5cd12Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2761b6f5cd12Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2762b6f5cd12Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2763b6f5cd12Smrg	fi
2764b6f5cd12Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2765b6f5cd12Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2766b6f5cd12Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2767b6f5cd12Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2768b6f5cd12Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2769b6f5cd12Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2770b6f5cd12Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2771b6f5cd12Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2772b6f5cd12Smrgfi
2773b6f5cd12Smrg
2774b6f5cd12Smrgfound="no"
2775b6f5cd12Smrgm4_foreach([flag], m4_cdr($@), [
2776b6f5cd12Smrg	if test $found = "no" ; then
2777b6f5cd12Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2778b6f5cd12Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2779b6f5cd12Smrg		fi
2780b6f5cd12Smrg
2781b6f5cd12Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2782b6f5cd12Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2783b6f5cd12Smrg		fi
2784b6f5cd12Smrg
2785b6f5cd12Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2786b6f5cd12Smrg
2787b6f5cd12Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2788b6f5cd12Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2789b6f5cd12Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2790b6f5cd12Smrg		AC_CACHE_VAL($cacheid,
2791b6f5cd12Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2792b6f5cd12Smrg					     [eval $cacheid=yes],
2793b6f5cd12Smrg					     [eval $cacheid=no])])
2794b6f5cd12Smrg
2795b6f5cd12Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2796b6f5cd12Smrg
2797b6f5cd12Smrg		eval supported=\$$cacheid
2798b6f5cd12Smrg		AC_MSG_RESULT([$supported])
2799b6f5cd12Smrg		if test "$supported" = "yes" ; then
2800b6f5cd12Smrg			$1="$$1 ]flag["
2801b6f5cd12Smrg			found="yes"
2802b6f5cd12Smrg		fi
2803b6f5cd12Smrg	fi
2804b6f5cd12Smrg])
2805b6f5cd12Smrg]) # XORG_TESTSET_CFLAG
2806b6f5cd12Smrg
2807b6f5cd12Smrg# XORG_COMPILER_FLAGS
2808b6f5cd12Smrg# ---------------
2809b6f5cd12Smrg# Minimum version: 1.16.0
2810b6f5cd12Smrg#
2811b6f5cd12Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2812b6f5cd12Smrg# arguments supported by the selected compiler which do NOT alter the generated
2813b6f5cd12Smrg# code.  These arguments will cause the compiler to print various warnings
2814b6f5cd12Smrg# during compilation AND turn a conservative set of warnings into errors.
2815b6f5cd12Smrg#
2816b6f5cd12Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2817b6f5cd12Smrg# future versions of util-macros as options are added to new compilers.
2818b6f5cd12Smrg#
2819b6f5cd12SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2820b6f5cd12SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2821b6f5cd12Smrg
2822b6f5cd12SmrgAC_ARG_ENABLE(selective-werror,
2823b6f5cd12Smrg              AS_HELP_STRING([--disable-selective-werror],
2824b6f5cd12Smrg                             [Turn off selective compiler errors. (default: enabled)]),
2825b6f5cd12Smrg              [SELECTIVE_WERROR=$enableval],
2826b6f5cd12Smrg              [SELECTIVE_WERROR=yes])
2827b6f5cd12Smrg
2828b6f5cd12SmrgAC_LANG_CASE(
2829b6f5cd12Smrg        [C], [
2830b6f5cd12Smrg                define([PREFIX], [C])
2831b6f5cd12Smrg        ],
2832b6f5cd12Smrg        [C++], [
2833b6f5cd12Smrg                define([PREFIX], [CXX])
2834b6f5cd12Smrg        ]
2835b6f5cd12Smrg)
2836b6f5cd12Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2837b6f5cd12Smrgif test "x$SUNCC" = "xyes"; then
2838b6f5cd12Smrg    [BASE_]PREFIX[FLAGS]="-v"
2839b6f5cd12Smrgelse
2840b6f5cd12Smrg    [BASE_]PREFIX[FLAGS]=""
2841b6f5cd12Smrgfi
2842b6f5cd12Smrg
2843b6f5cd12Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2844b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2845b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2846b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2847b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2848b6f5cd12Smrg
2849b6f5cd12SmrgAC_LANG_CASE(
2850b6f5cd12Smrg	[C], [
2851b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2852b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2853b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2854b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2855b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2856b6f5cd12Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2857b6f5cd12Smrg	]
2858b6f5cd12Smrg)
2859b6f5cd12Smrg
2860b6f5cd12Smrg# This chunk adds additional warnings that could catch undesired effects.
2861b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2862b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2863b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2864b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2865b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2866b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2867b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2868b6f5cd12Smrg
2869b6f5cd12Smrg# These are currently disabled because they are noisy.  They will be enabled
2870b6f5cd12Smrg# in the future once the codebase is sufficiently modernized to silence
2871b6f5cd12Smrg# them.  For now, I don't want them to drown out the other warnings.
2872b6f5cd12Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2873b6f5cd12Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2874b6f5cd12Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2875b6f5cd12Smrg
2876b6f5cd12Smrg# Turn some warnings into errors, so we don't accidently get successful builds
2877b6f5cd12Smrg# when there are problems that should be fixed.
2878b6f5cd12Smrg
2879b6f5cd12Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2880b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2881b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2882b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2883b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2884b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2885b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2886b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2887b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2888b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2889b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2890b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2891b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2892b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2893b6f5cd12Smrgelse
2894b6f5cd12SmrgAC_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])
2895b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2896b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2897b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2898b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2899b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2900b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2901b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2902b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2903b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2904b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2905b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2906b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2907b6f5cd12SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2908b6f5cd12Smrgfi
2909b6f5cd12Smrg
2910b6f5cd12SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2911b6f5cd12Smrg]) # XORG_COMPILER_FLAGS
2912b6f5cd12Smrg
291321ecb1efSmrg# XORG_CWARNFLAGS
291421ecb1efSmrg# ---------------
291521ecb1efSmrg# Minimum version: 1.2.0
2916b6f5cd12Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
291721ecb1efSmrg#
291821ecb1efSmrg# Defines CWARNFLAGS to enable C compiler warnings.
291921ecb1efSmrg#
2920b6f5cd12Smrg# This function is deprecated because it defines -fno-strict-aliasing
2921b6f5cd12Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2922b6f5cd12Smrg# is needed, then it should be added explicitly in the module when
2923b6f5cd12Smrg# it is updated to use BASE_CFLAGS.
2924b6f5cd12Smrg#
292521ecb1efSmrgAC_DEFUN([XORG_CWARNFLAGS], [
2926b6f5cd12SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2927b6f5cd12SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2928b6f5cd12SmrgAC_LANG_CASE(
2929b6f5cd12Smrg	[C], [
2930b6f5cd12Smrg		CWARNFLAGS="$BASE_CFLAGS"
2931b6f5cd12Smrg		if  test "x$GCC" = xyes ; then
2932b6f5cd12Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2933b6f5cd12Smrg		fi
2934b6f5cd12Smrg		AC_SUBST(CWARNFLAGS)
2935b6f5cd12Smrg	]
2936b6f5cd12Smrg)
293721ecb1efSmrg]) # XORG_CWARNFLAGS
29381e00de39Smrg
293921ecb1efSmrg# XORG_STRICT_OPTION
294021ecb1efSmrg# -----------------------
294121ecb1efSmrg# Minimum version: 1.3.0
29421e00de39Smrg#
2943b6f5cd12Smrg# Add configure option to enable strict compilation flags, such as treating
2944b6f5cd12Smrg# warnings as fatal errors.
2945b6f5cd12Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2946b6f5cd12Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2947b6f5cd12Smrg#
2948b6f5cd12Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2949b6f5cd12Smrg# when strict compilation is unconditionally desired.
295021ecb1efSmrgAC_DEFUN([XORG_STRICT_OPTION], [
295121ecb1efSmrgAC_REQUIRE([XORG_CWARNFLAGS])
2952b6f5cd12SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
295321ecb1efSmrg
295421ecb1efSmrgAC_ARG_ENABLE(strict-compilation,
295521ecb1efSmrg			  AS_HELP_STRING([--enable-strict-compilation],
295621ecb1efSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
295721ecb1efSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2958b6f5cd12Smrg
2959b6f5cd12SmrgAC_LANG_CASE(
2960b6f5cd12Smrg        [C], [
2961b6f5cd12Smrg                define([PREFIX], [C])
2962b6f5cd12Smrg        ],
2963b6f5cd12Smrg        [C++], [
2964b6f5cd12Smrg                define([PREFIX], [CXX])
2965b6f5cd12Smrg        ]
2966b6f5cd12Smrg)
2967b6f5cd12Smrg
2968b6f5cd12Smrg[STRICT_]PREFIX[FLAGS]=""
2969b6f5cd12SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2970b6f5cd12SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2971b6f5cd12Smrg
2972b6f5cd12Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2973b6f5cd12Smrg# activate it with -Werror, so we add it here explicitly.
2974b6f5cd12SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2975b6f5cd12Smrg
297621ecb1efSmrgif test "x$STRICT_COMPILE" = "xyes"; then
2977b6f5cd12Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2978b6f5cd12Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
297921ecb1efSmrgfi
2980b6f5cd12SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2981b6f5cd12SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2982b6f5cd12SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
298321ecb1efSmrg]) # XORG_STRICT_OPTION
29841e00de39Smrg
298521ecb1efSmrg# XORG_DEFAULT_OPTIONS
298621ecb1efSmrg# --------------------
298721ecb1efSmrg# Minimum version: 1.3.0
29881e00de39Smrg#
298921ecb1efSmrg# Defines default options for X.Org modules.
299021ecb1efSmrg#
299121ecb1efSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2992604a4f4cSmrgAC_REQUIRE([AC_PROG_INSTALL])
2993b6f5cd12SmrgXORG_COMPILER_FLAGS
299421ecb1efSmrgXORG_CWARNFLAGS
299521ecb1efSmrgXORG_STRICT_OPTION
299621ecb1efSmrgXORG_RELEASE_VERSION
299721ecb1efSmrgXORG_CHANGELOG
2998604a4f4cSmrgXORG_INSTALL
299921ecb1efSmrgXORG_MANPAGE_SECTIONS
3000604a4f4cSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3001604a4f4cSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
300221ecb1efSmrg]) # XORG_DEFAULT_OPTIONS
3003604a4f4cSmrg
3004604a4f4cSmrg# XORG_INSTALL()
3005604a4f4cSmrg# ----------------
3006604a4f4cSmrg# Minimum version: 1.4.0
3007604a4f4cSmrg#
3008604a4f4cSmrg# Defines the variable INSTALL_CMD as the command to copy
3009604a4f4cSmrg# INSTALL from $prefix/share/util-macros.
3010604a4f4cSmrg#
3011604a4f4cSmrgAC_DEFUN([XORG_INSTALL], [
3012604a4f4cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3013604a4f4cSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3014604a4f4cSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3015604a4f4cSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3016604a4f4cSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3017604a4f4cSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3018604a4f4cSmrgAC_SUBST([INSTALL_CMD])
3019604a4f4cSmrg]) # XORG_INSTALL
302021ecb1efSmrgdnl Copyright 2005 Red Hat, Inc
302121ecb1efSmrgdnl
302221ecb1efSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
302321ecb1efSmrgdnl documentation for any purpose is hereby granted without fee, provided that
302421ecb1efSmrgdnl the above copyright notice appear in all copies and that both that
302521ecb1efSmrgdnl copyright notice and this permission notice appear in supporting
302621ecb1efSmrgdnl documentation.
302721ecb1efSmrgdnl
302821ecb1efSmrgdnl The above copyright notice and this permission notice shall be included
302921ecb1efSmrgdnl in all copies or substantial portions of the Software.
303021ecb1efSmrgdnl
303121ecb1efSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
303221ecb1efSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
303321ecb1efSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
303421ecb1efSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
303521ecb1efSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
303621ecb1efSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
303721ecb1efSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
303821ecb1efSmrgdnl
303921ecb1efSmrgdnl Except as contained in this notice, the name of the copyright holders shall
304021ecb1efSmrgdnl not be used in advertising or otherwise to promote the sale, use or
304121ecb1efSmrgdnl other dealings in this Software without prior written authorization
304221ecb1efSmrgdnl from the copyright holders.
304321ecb1efSmrgdnl
30441e00de39Smrg
304521ecb1efSmrg# XORG_RELEASE_VERSION
304621ecb1efSmrg# --------------------
3047604a4f4cSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
304821ecb1efSmrg 
304921ecb1efSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
305021ecb1efSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
305121ecb1efSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
305221ecb1efSmrg		[Major version of this package])
305321ecb1efSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
305421ecb1efSmrg	if test "x$PVM" = "x"; then
305521ecb1efSmrg		PVM="0"
305621ecb1efSmrg	fi
305721ecb1efSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
305821ecb1efSmrg		[$PVM],
305921ecb1efSmrg		[Minor version of this package])
306021ecb1efSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
306121ecb1efSmrg	if test "x$PVP" = "x"; then
306221ecb1efSmrg		PVP="0"
306321ecb1efSmrg	fi
306421ecb1efSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
306521ecb1efSmrg		[$PVP],
306621ecb1efSmrg		[Patch version of this package])
306721ecb1efSmrg])
30681e00de39Smrg
306921ecb1efSmrg# XORG_CHANGELOG()
307021ecb1efSmrg# ----------------
307121ecb1efSmrg# Minimum version: 1.2.0
307221ecb1efSmrg#
307321ecb1efSmrg# Defines the variable CHANGELOG_CMD as the command to generate
307421ecb1efSmrg# ChangeLog from git.
307521ecb1efSmrg#
307621ecb1efSmrg#
307721ecb1efSmrgAC_DEFUN([XORG_CHANGELOG], [
3078604a4f4cSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3079604a4f4cSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3080604a4f4cSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
308121ecb1efSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
308221ecb1efSmrgAC_SUBST([CHANGELOG_CMD])
308321ecb1efSmrg]) # XORG_CHANGELOG
30841e00de39Smrg
3085