aclocal.m4 revision 74a3f230
174a3f230Smrg# generated automatically by aclocal 1.14 -*- Autoconf -*-
274a3f230Smrg
374a3f230Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4b3307321Smrg
5b3307321Smrg# This file is free software; the Free Software Foundation
6b3307321Smrg# gives unlimited permission to copy and/or distribute it,
7b3307321Smrg# with or without modifications, as long as this notice is preserved.
8b3307321Smrg
9b3307321Smrg# This program is distributed in the hope that it will be useful,
10b3307321Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11b3307321Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12b3307321Smrg# PARTICULAR PURPOSE.
13b3307321Smrg
1474a3f230Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15afe13c8eSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16afe13c8eSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1729cb5710Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1829cb5710Smrg[m4_warning([this file was generated for autoconf 2.68.
19afe13c8eSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20afe13c8eSmrgIf you have problems, you may need to regenerate the build system entirely.
2174a3f230SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22b3307321Smrg
2374a3f230Smrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
24afe13c8eSmrg#
255e358ecaSmrg# This file is free software; the Free Software Foundation
265e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
275e358ecaSmrg# with or without modifications, as long as this notice is preserved.
28b3307321Smrg
295e358ecaSmrg# AM_AUTOMAKE_VERSION(VERSION)
305e358ecaSmrg# ----------------------------
315e358ecaSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
325e358ecaSmrg# generated from the m4 files accompanying Automake X.Y.
335e358ecaSmrg# (This private macro should not be called outside this file.)
345e358ecaSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3574a3f230Smrg[am__api_version='1.14'
365e358ecaSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
375e358ecaSmrgdnl require some minimum version.  Point them to the right macro.
3874a3f230Smrgm4_if([$1], [1.14], [],
395e358ecaSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
405e358ecaSmrg])
41b3307321Smrg
425e358ecaSmrg# _AM_AUTOCONF_VERSION(VERSION)
435e358ecaSmrg# -----------------------------
445e358ecaSmrg# aclocal traces this macro to find the Autoconf version.
455e358ecaSmrg# This is a private macro too.  Using m4_define simplifies
465e358ecaSmrg# the logic in aclocal, which can simply ignore this definition.
475e358ecaSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48b3307321Smrg
495e358ecaSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
505e358ecaSmrg# -------------------------------
515e358ecaSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
525e358ecaSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
535e358ecaSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5474a3f230Smrg[AM_AUTOMAKE_VERSION([1.14])dnl
555e358ecaSmrgm4_ifndef([AC_AUTOCONF_VERSION],
565e358ecaSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
575e358ecaSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58b3307321Smrg
595e358ecaSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60b3307321Smrg
6174a3f230Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
625e358ecaSmrg#
635e358ecaSmrg# This file is free software; the Free Software Foundation
645e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
655e358ecaSmrg# with or without modifications, as long as this notice is preserved.
66b3307321Smrg
675e358ecaSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6874a3f230Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6974a3f230Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70afe13c8eSmrg#
715e358ecaSmrg# Of course, Automake must honor this variable whenever it calls a
725e358ecaSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
735e358ecaSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
745e358ecaSmrg# depending on how configure is run.  This is pretty annoying, since
755e358ecaSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
765e358ecaSmrg# source directory, any form will work fine, but in subdirectories a
775e358ecaSmrg# relative path needs to be adjusted first.
78afe13c8eSmrg#
795e358ecaSmrg# $ac_aux_dir/missing
805e358ecaSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
815e358ecaSmrg# $top_srcdir/$ac_aux_dir/missing
825e358ecaSmrg#    fails if $ac_aux_dir is absolute,
835e358ecaSmrg#    fails when called from a subdirectory in a VPATH build with
845e358ecaSmrg#          a relative $ac_aux_dir
85afe13c8eSmrg#
865e358ecaSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
875e358ecaSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
8874a3f230Smrg# harmless because $srcdir is '.', but things will broke when you
895e358ecaSmrg# start a VPATH build or use an absolute $srcdir.
90afe13c8eSmrg#
915e358ecaSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
925e358ecaSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
935e358ecaSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
945e358ecaSmrg# and then we would define $MISSING as
955e358ecaSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
965e358ecaSmrg# This will work as long as MISSING is not called from configure, because
975e358ecaSmrg# unfortunately $(top_srcdir) has no meaning in configure.
985e358ecaSmrg# However there are other variables, like CC, which are often used in
995e358ecaSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1005e358ecaSmrg#
1015e358ecaSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1025e358ecaSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1035e358ecaSmrg# configured tree to be moved without reconfiguration.
104b3307321Smrg
1055e358ecaSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1065e358ecaSmrg[dnl Rely on autoconf to set up CDPATH properly.
1075e358ecaSmrgAC_PREREQ([2.50])dnl
1085e358ecaSmrg# expand $ac_aux_dir to an absolute path
1095e358ecaSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
1105e358ecaSmrg])
111b3307321Smrg
1125e358ecaSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
113b3307321Smrg
11474a3f230Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
1155e358ecaSmrg#
1165e358ecaSmrg# This file is free software; the Free Software Foundation
1175e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
1185e358ecaSmrg# with or without modifications, as long as this notice is preserved.
119b3307321Smrg
1205e358ecaSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1215e358ecaSmrg# -------------------------------------
1225e358ecaSmrg# Define a conditional.
1235e358ecaSmrgAC_DEFUN([AM_CONDITIONAL],
12474a3f230Smrg[AC_PREREQ([2.52])dnl
12574a3f230Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12674a3f230Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1275e358ecaSmrgAC_SUBST([$1_TRUE])dnl
1285e358ecaSmrgAC_SUBST([$1_FALSE])dnl
1295e358ecaSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1305e358ecaSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1315e358ecaSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1325e358ecaSmrgif $2; then
1335e358ecaSmrg  $1_TRUE=
1345e358ecaSmrg  $1_FALSE='#'
1355e358ecaSmrgelse
1365e358ecaSmrg  $1_TRUE='#'
1375e358ecaSmrg  $1_FALSE=
1385e358ecaSmrgfi
1395e358ecaSmrgAC_CONFIG_COMMANDS_PRE(
1405e358ecaSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1415e358ecaSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1425e358ecaSmrgUsually this means the macro was only invoked conditionally.]])
1435e358ecaSmrgfi])])
144b3307321Smrg
14574a3f230Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
1465e358ecaSmrg#
1475e358ecaSmrg# This file is free software; the Free Software Foundation
1485e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
1495e358ecaSmrg# with or without modifications, as long as this notice is preserved.
150b3307321Smrg
151b3307321Smrg
15274a3f230Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1535e358ecaSmrg# written in clear, in which case automake, when reading aclocal.m4,
1545e358ecaSmrg# will think it sees a *use*, and therefore will trigger all it's
1555e358ecaSmrg# C support machinery.  Also note that it means that autoscan, seeing
1565e358ecaSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
157b3307321Smrg
158b3307321Smrg
1595e358ecaSmrg# _AM_DEPENDENCIES(NAME)
1605e358ecaSmrg# ----------------------
1615e358ecaSmrg# See how the compiler implements dependency checking.
16274a3f230Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1635e358ecaSmrg# We try a few techniques and use that to set a single cache variable.
164afe13c8eSmrg#
1655e358ecaSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1665e358ecaSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1675e358ecaSmrg# dependency, and given that the user is not expected to run this macro,
1685e358ecaSmrg# just rely on AC_PROG_CC.
1695e358ecaSmrgAC_DEFUN([_AM_DEPENDENCIES],
1705e358ecaSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1715e358ecaSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1725e358ecaSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1735e358ecaSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
174b3307321Smrg
17574a3f230Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17674a3f230Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17774a3f230Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17874a3f230Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17974a3f230Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
18074a3f230Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18174a3f230Smrg                    [depcc="$$1"   am_compiler_list=])
182b3307321Smrg
1835e358ecaSmrgAC_CACHE_CHECK([dependency style of $depcc],
1845e358ecaSmrg               [am_cv_$1_dependencies_compiler_type],
1855e358ecaSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1865e358ecaSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1875e358ecaSmrg  # making bogus files that we don't know about and never remove.  For
1885e358ecaSmrg  # instance it was reported that on HP-UX the gcc test will end up
18974a3f230Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
19074a3f230Smrg  # in D".
19174a3f230Smrg  rm -rf conftest.dir
1925e358ecaSmrg  mkdir conftest.dir
1935e358ecaSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1945e358ecaSmrg  # using a relative directory.
1955e358ecaSmrg  cp "$am_depcomp" conftest.dir
1965e358ecaSmrg  cd conftest.dir
1975e358ecaSmrg  # We will build objects and dependencies in a subdirectory because
1985e358ecaSmrg  # it helps to detect inapplicable dependency modes.  For instance
1995e358ecaSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2005e358ecaSmrg  # side effect of compilation, but ICC will put the dependencies in
2015e358ecaSmrg  # the current directory while Tru64 will put them in the object
2025e358ecaSmrg  # directory.
2035e358ecaSmrg  mkdir sub
2045e358ecaSmrg
2055e358ecaSmrg  am_cv_$1_dependencies_compiler_type=none
2065e358ecaSmrg  if test "$am_compiler_list" = ""; then
2075e358ecaSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2085e358ecaSmrg  fi
2095e358ecaSmrg  am__universal=false
2105e358ecaSmrg  m4_case([$1], [CC],
2115e358ecaSmrg    [case " $depcc " in #(
2125e358ecaSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2135e358ecaSmrg     esac],
2145e358ecaSmrg    [CXX],
2155e358ecaSmrg    [case " $depcc " in #(
2165e358ecaSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2175e358ecaSmrg     esac])
2185e358ecaSmrg
2195e358ecaSmrg  for depmode in $am_compiler_list; do
2205e358ecaSmrg    # Setup a source with many dependencies, because some compilers
2215e358ecaSmrg    # like to wrap large dependency lists on column 80 (with \), and
2225e358ecaSmrg    # we should not choose a depcomp mode which is confused by this.
2235e358ecaSmrg    #
2245e358ecaSmrg    # We need to recreate these files for each test, as the compiler may
2255e358ecaSmrg    # overwrite some of them when testing with obscure command lines.
2265e358ecaSmrg    # This happens at least with the AIX C compiler.
2275e358ecaSmrg    : > sub/conftest.c
2285e358ecaSmrg    for i in 1 2 3 4 5 6; do
2295e358ecaSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
23074a3f230Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23174a3f230Smrg      # Solaris 10 /bin/sh.
23274a3f230Smrg      echo '/* dummy */' > sub/conftst$i.h
2335e358ecaSmrg    done
2345e358ecaSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2355e358ecaSmrg
23674a3f230Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2375e358ecaSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23874a3f230Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23974a3f230Smrg    # versions had trouble with output in subdirs.
2405e358ecaSmrg    am__obj=sub/conftest.${OBJEXT-o}
2415e358ecaSmrg    am__minus_obj="-o $am__obj"
2425e358ecaSmrg    case $depmode in
2435e358ecaSmrg    gcc)
2445e358ecaSmrg      # This depmode causes a compiler race in universal mode.
2455e358ecaSmrg      test "$am__universal" = false || continue
2465e358ecaSmrg      ;;
2475e358ecaSmrg    nosideeffect)
24874a3f230Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24974a3f230Smrg      # only be used when explicitly requested.
2505e358ecaSmrg      if test "x$enable_dependency_tracking" = xyes; then
2515e358ecaSmrg	continue
2525e358ecaSmrg      else
2535e358ecaSmrg	break
2545e358ecaSmrg      fi
2555e358ecaSmrg      ;;
25674a3f230Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25774a3f230Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2585e358ecaSmrg      # not run yet.  These depmodes are late enough in the game, and
2595e358ecaSmrg      # so weak that their functioning should not be impacted.
2605e358ecaSmrg      am__obj=conftest.${OBJEXT-o}
2615e358ecaSmrg      am__minus_obj=
2625e358ecaSmrg      ;;
2635e358ecaSmrg    none) break ;;
2645e358ecaSmrg    esac
2655e358ecaSmrg    if depmode=$depmode \
2665e358ecaSmrg       source=sub/conftest.c object=$am__obj \
2675e358ecaSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2685e358ecaSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2695e358ecaSmrg         >/dev/null 2>conftest.err &&
2705e358ecaSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2715e358ecaSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2725e358ecaSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2735e358ecaSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2745e358ecaSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2755e358ecaSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2765e358ecaSmrg      # that says an option was ignored or not supported.
2775e358ecaSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2785e358ecaSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2795e358ecaSmrg      # The diagnosis changed in icc 8.0:
2805e358ecaSmrg      #   icc: Command line remark: option '-MP' not supported
2815e358ecaSmrg      if (grep 'ignoring option' conftest.err ||
2825e358ecaSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2835e358ecaSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2845e358ecaSmrg        break
2855e358ecaSmrg      fi
2865e358ecaSmrg    fi
2875e358ecaSmrg  done
2885e358ecaSmrg
2895e358ecaSmrg  cd ..
2905e358ecaSmrg  rm -rf conftest.dir
291afe13c8eSmrgelse
2925e358ecaSmrg  am_cv_$1_dependencies_compiler_type=none
293afe13c8eSmrgfi
2945e358ecaSmrg])
2955e358ecaSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2965e358ecaSmrgAM_CONDITIONAL([am__fastdep$1], [
2975e358ecaSmrg  test "x$enable_dependency_tracking" != xno \
2985e358ecaSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2995e358ecaSmrg])
300b3307321Smrg
3015e358ecaSmrg
3025e358ecaSmrg# AM_SET_DEPDIR
3035e358ecaSmrg# -------------
3045e358ecaSmrg# Choose a directory name for dependency files.
30574a3f230Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3065e358ecaSmrgAC_DEFUN([AM_SET_DEPDIR],
3075e358ecaSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3085e358ecaSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3095e358ecaSmrg])
3105e358ecaSmrg
3115e358ecaSmrg
3125e358ecaSmrg# AM_DEP_TRACK
3135e358ecaSmrg# ------------
3145e358ecaSmrgAC_DEFUN([AM_DEP_TRACK],
31574a3f230Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31674a3f230SmrgAS_HELP_STRING(
31774a3f230Smrg  [--enable-dependency-tracking],
31874a3f230Smrg  [do not reject slow dependency extractors])
31974a3f230SmrgAS_HELP_STRING(
32074a3f230Smrg  [--disable-dependency-tracking],
32174a3f230Smrg  [speeds up one-time build])])
3225e358ecaSmrgif test "x$enable_dependency_tracking" != xno; then
3235e358ecaSmrg  am_depcomp="$ac_aux_dir/depcomp"
3245e358ecaSmrg  AMDEPBACKSLASH='\'
32574a3f230Smrg  am__nodep='_no'
326afe13c8eSmrgfi
3275e358ecaSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3285e358ecaSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3295e358ecaSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
33074a3f230SmrgAC_SUBST([am__nodep])dnl
33174a3f230Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3325e358ecaSmrg])
333b3307321Smrg
3345e358ecaSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3355e358ecaSmrg
33674a3f230Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
337b3307321Smrg#
3385e358ecaSmrg# This file is free software; the Free Software Foundation
3395e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
3405e358ecaSmrg# with or without modifications, as long as this notice is preserved.
341b3307321Smrg
342b3307321Smrg
3435e358ecaSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3445e358ecaSmrg# ------------------------------
3455e358ecaSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3465e358ecaSmrg[{
34774a3f230Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3485e358ecaSmrg  # are listed without --file.  Let's play safe and only enable the eval
3495e358ecaSmrg  # if we detect the quoting.
3505e358ecaSmrg  case $CONFIG_FILES in
3515e358ecaSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
3525e358ecaSmrg  *)   set x $CONFIG_FILES ;;
3535e358ecaSmrg  esac
3545e358ecaSmrg  shift
3555e358ecaSmrg  for mf
3565e358ecaSmrg  do
3575e358ecaSmrg    # Strip MF so we end up with the name of the file.
3585e358ecaSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3595e358ecaSmrg    # Check whether this is an Automake generated Makefile or not.
36074a3f230Smrg    # We used to match only the files named 'Makefile.in', but
3615e358ecaSmrg    # some people rename them; so instead we look at the file content.
3625e358ecaSmrg    # Grep'ing the first line is not enough: some people post-process
3635e358ecaSmrg    # each Makefile.in and add a new line on top of each file to say so.
3645e358ecaSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
3655e358ecaSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3665e358ecaSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3675e358ecaSmrg      dirpart=`AS_DIRNAME("$mf")`
3685e358ecaSmrg    else
3695e358ecaSmrg      continue
3705e358ecaSmrg    fi
3715e358ecaSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
37274a3f230Smrg    # from the Makefile without running 'make'.
3735e358ecaSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3745e358ecaSmrg    test -z "$DEPDIR" && continue
3755e358ecaSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
37674a3f230Smrg    test -z "$am__include" && continue
3775e358ecaSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3785e358ecaSmrg    # Find all dependency output files, they are included files with
3795e358ecaSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3805e358ecaSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3815e358ecaSmrg    # expansion.
3825e358ecaSmrg    for file in `sed -n "
3835e358ecaSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
38474a3f230Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
3855e358ecaSmrg      # Make sure the directory exists.
3865e358ecaSmrg      test -f "$dirpart/$file" && continue
3875e358ecaSmrg      fdir=`AS_DIRNAME(["$file"])`
3885e358ecaSmrg      AS_MKDIR_P([$dirpart/$fdir])
3895e358ecaSmrg      # echo "creating $dirpart/$file"
3905e358ecaSmrg      echo '# dummy' > "$dirpart/$file"
3915e358ecaSmrg    done
3925e358ecaSmrg  done
3935e358ecaSmrg}
3945e358ecaSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
395b3307321Smrg
396b3307321Smrg
3975e358ecaSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3985e358ecaSmrg# -----------------------------
3995e358ecaSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
4005e358ecaSmrg#
4015e358ecaSmrg# This code is only required when automatic dependency tracking
40274a3f230Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
4035e358ecaSmrg# need in order to bootstrap the dependency handling code.
4045e358ecaSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4055e358ecaSmrg[AC_CONFIG_COMMANDS([depfiles],
4065e358ecaSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4075e358ecaSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4085e358ecaSmrg])
409b3307321Smrg
4105e358ecaSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4115e358ecaSmrg
41274a3f230Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4135e358ecaSmrg#
4145e358ecaSmrg# This file is free software; the Free Software Foundation
4155e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
4165e358ecaSmrg# with or without modifications, as long as this notice is preserved.
4175e358ecaSmrg
4185e358ecaSmrg# This macro actually does too much.  Some checks are only needed if
4195e358ecaSmrg# your package does certain things.  But this isn't really a big deal.
4205e358ecaSmrg
42174a3f230Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
42274a3f230Smrgm4_define([AC_PROG_CC],
42374a3f230Smrgm4_defn([AC_PROG_CC])
42474a3f230Smrg[_AM_PROG_CC_C_O
42574a3f230Smrg])
42674a3f230Smrg
4275e358ecaSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4285e358ecaSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4295e358ecaSmrg# -----------------------------------------------
4305e358ecaSmrg# The call with PACKAGE and VERSION arguments is the old style
4315e358ecaSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4325e358ecaSmrg# and VERSION should now be passed to AC_INIT and removed from
4335e358ecaSmrg# the call to AM_INIT_AUTOMAKE.
4345e358ecaSmrg# We support both call styles for the transition.  After
4355e358ecaSmrg# the next Automake release, Autoconf can make the AC_INIT
4365e358ecaSmrg# arguments mandatory, and then we can depend on a new Autoconf
4375e358ecaSmrg# release and drop the old call support.
4385e358ecaSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43974a3f230Smrg[AC_PREREQ([2.65])dnl
4405e358ecaSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4415e358ecaSmrgdnl the ones we care about.
4425e358ecaSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4435e358ecaSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4445e358ecaSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4455e358ecaSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4465e358ecaSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4475e358ecaSmrg  # is not polluted with repeated "-I."
4485e358ecaSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4495e358ecaSmrg  # test to see if srcdir already configured
4505e358ecaSmrg  if test -f $srcdir/config.status; then
4515e358ecaSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4525e358ecaSmrg  fi
453afe13c8eSmrgfi
4545e358ecaSmrg
4555e358ecaSmrg# test whether we have cygpath
4565e358ecaSmrgif test -z "$CYGPATH_W"; then
4575e358ecaSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4585e358ecaSmrg    CYGPATH_W='cygpath -w'
4595e358ecaSmrg  else
4605e358ecaSmrg    CYGPATH_W=echo
4615e358ecaSmrg  fi
462b3307321Smrgfi
4635e358ecaSmrgAC_SUBST([CYGPATH_W])
464b3307321Smrg
4655e358ecaSmrg# Define the identity of the package.
4665e358ecaSmrgdnl Distinguish between old-style and new-style calls.
4675e358ecaSmrgm4_ifval([$2],
46874a3f230Smrg[AC_DIAGNOSE([obsolete],
46974a3f230Smrg             [$0: two- and three-arguments forms are deprecated.])
47074a3f230Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4715e358ecaSmrg AC_SUBST([PACKAGE], [$1])dnl
4725e358ecaSmrg AC_SUBST([VERSION], [$2])],
4735e358ecaSmrg[_AM_SET_OPTIONS([$1])dnl
4745e358ecaSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47574a3f230Smrgm4_if(
47674a3f230Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
47774a3f230Smrg  [ok:ok],,
4785e358ecaSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4795e358ecaSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4805e358ecaSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
481b3307321Smrg
4825e358ecaSmrg_AM_IF_OPTION([no-define],,
48374a3f230Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
48474a3f230Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
485b3307321Smrg
4865e358ecaSmrg# Some tools Automake needs.
4875e358ecaSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4885e358ecaSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48974a3f230SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
49074a3f230SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
49174a3f230SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
49274a3f230SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
49374a3f230SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4945e358ecaSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4955e358ecaSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49674a3f230SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49774a3f230Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49874a3f230Smrg# dies out for good.  For more background, see:
49974a3f230Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
50074a3f230Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
50174a3f230SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
5025e358ecaSmrg# We need awk for the "check" target.  The system "awk" is bad on
5035e358ecaSmrg# some platforms.
5045e358ecaSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5055e358ecaSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5065e358ecaSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5075e358ecaSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5085e358ecaSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5095e358ecaSmrg			     [_AM_PROG_TAR([v7])])])
5105e358ecaSmrg_AM_IF_OPTION([no-dependencies],,
5115e358ecaSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
51274a3f230Smrg		  [_AM_DEPENDENCIES([CC])],
51374a3f230Smrg		  [m4_define([AC_PROG_CC],
51474a3f230Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5155e358ecaSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51674a3f230Smrg		  [_AM_DEPENDENCIES([CXX])],
51774a3f230Smrg		  [m4_define([AC_PROG_CXX],
51874a3f230Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5195e358ecaSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
52074a3f230Smrg		  [_AM_DEPENDENCIES([OBJC])],
52174a3f230Smrg		  [m4_define([AC_PROG_OBJC],
52274a3f230Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
52374a3f230SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
52474a3f230Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52574a3f230Smrg		  [m4_define([AC_PROG_OBJCXX],
52674a3f230Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5275e358ecaSmrg])
52874a3f230SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
52974a3f230Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53074a3f230Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
53174a3f230Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5325e358ecaSmrgAC_CONFIG_COMMANDS_PRE(dnl
5335e358ecaSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5345e358ecaSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
535b3307321Smrg
53674a3f230Smrg# POSIX will say in a future version that running "rm -f" with no argument
53774a3f230Smrg# is OK; and we want to be able to make that assumption in our Makefile
53874a3f230Smrg# recipes.  So use an aggressive probe to check that the usage we want is
53974a3f230Smrg# actually supported "in the wild" to an acceptable degree.
54074a3f230Smrg# See automake bug#10828.
54174a3f230Smrg# To make any issue more visible, cause the running configure to be aborted
54274a3f230Smrg# by default if the 'rm' program in use doesn't match our expectations; the
54374a3f230Smrg# user can still override this though.
54474a3f230Smrgif rm -f && rm -fr && rm -rf; then : OK; else
54574a3f230Smrg  cat >&2 <<'END'
54674a3f230SmrgOops!
54774a3f230Smrg
54874a3f230SmrgYour 'rm' program seems unable to run without file operands specified
54974a3f230Smrgon the command line, even when the '-f' option is present.  This is contrary
55074a3f230Smrgto the behaviour of most rm programs out there, and not conforming with
55174a3f230Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
55274a3f230Smrg
55374a3f230SmrgPlease tell bug-automake@gnu.org about your system, including the value
55474a3f230Smrgof your $PATH and any error possibly output before this message.  This
55574a3f230Smrgcan help us improve future automake versions.
55674a3f230Smrg
55774a3f230SmrgEND
55874a3f230Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
55974a3f230Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56074a3f230Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
56174a3f230Smrg    echo >&2
56274a3f230Smrg  else
56374a3f230Smrg    cat >&2 <<'END'
56474a3f230SmrgAborting the configuration process, to ensure you take notice of the issue.
56574a3f230Smrg
56674a3f230SmrgYou can download and install GNU coreutils to get an 'rm' implementation
56774a3f230Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
56874a3f230Smrg
56974a3f230SmrgIf you want to complete the configuration process using your problematic
57074a3f230Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
57174a3f230Smrgto "yes", and re-run configure.
57274a3f230Smrg
57374a3f230SmrgEND
57474a3f230Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
57574a3f230Smrg  fi
57674a3f230Smrgfi])
57774a3f230Smrg
57874a3f230Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5795e358ecaSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5805e358ecaSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5815e358ecaSmrgm4_define([_AC_COMPILER_EXEEXT],
5825e358ecaSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
583b3307321Smrg
5845e358ecaSmrg# When config.status generates a header, we must update the stamp-h file.
5855e358ecaSmrg# This file resides in the same directory as the config header
5865e358ecaSmrg# that is generated.  The stamp files are numbered to have different names.
5875e358ecaSmrg
5885e358ecaSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5895e358ecaSmrg# loop where config.status creates the headers, so we can generate
5905e358ecaSmrg# our stamp files there.
5915e358ecaSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5925e358ecaSmrg[# Compute $1's index in $config_headers.
5935e358ecaSmrg_am_arg=$1
5945e358ecaSmrg_am_stamp_count=1
5955e358ecaSmrgfor _am_header in $config_headers :; do
5965e358ecaSmrg  case $_am_header in
5975e358ecaSmrg    $_am_arg | $_am_arg:* )
5985e358ecaSmrg      break ;;
5995e358ecaSmrg    * )
6005e358ecaSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6015e358ecaSmrg  esac
6025e358ecaSmrgdone
6035e358ecaSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6045e358ecaSmrg
60574a3f230Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6065e358ecaSmrg#
6075e358ecaSmrg# This file is free software; the Free Software Foundation
6085e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
6095e358ecaSmrg# with or without modifications, as long as this notice is preserved.
610b3307321Smrg
6115e358ecaSmrg# AM_PROG_INSTALL_SH
6125e358ecaSmrg# ------------------
6135e358ecaSmrg# Define $install_sh.
6145e358ecaSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6155e358ecaSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6165e358ecaSmrgif test x"${install_sh}" != xset; then
6175e358ecaSmrg  case $am_aux_dir in
6185e358ecaSmrg  *\ * | *\	*)
6195e358ecaSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6205e358ecaSmrg  *)
6215e358ecaSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6225e358ecaSmrg  esac
623afe13c8eSmrgfi
62474a3f230SmrgAC_SUBST([install_sh])])
625b3307321Smrg
62674a3f230Smrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
6275e358ecaSmrg#
6285e358ecaSmrg# This file is free software; the Free Software Foundation
6295e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
6305e358ecaSmrg# with or without modifications, as long as this notice is preserved.
631b3307321Smrg
6325e358ecaSmrg# Check whether the underlying file-system supports filenames
6335e358ecaSmrg# with a leading dot.  For instance MS-DOS doesn't.
6345e358ecaSmrgAC_DEFUN([AM_SET_LEADING_DOT],
6355e358ecaSmrg[rm -rf .tst 2>/dev/null
6365e358ecaSmrgmkdir .tst 2>/dev/null
6375e358ecaSmrgif test -d .tst; then
6385e358ecaSmrg  am__leading_dot=.
639b3307321Smrgelse
6405e358ecaSmrg  am__leading_dot=_
641b3307321Smrgfi
6425e358ecaSmrgrmdir .tst 2>/dev/null
6435e358ecaSmrgAC_SUBST([am__leading_dot])])
644b3307321Smrg
6455e358ecaSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
6465e358ecaSmrg# From Jim Meyering
647b3307321Smrg
64874a3f230Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
6495e358ecaSmrg#
6505e358ecaSmrg# This file is free software; the Free Software Foundation
6515e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
6525e358ecaSmrg# with or without modifications, as long as this notice is preserved.
653b3307321Smrg
6545e358ecaSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6555e358ecaSmrg# ----------------------------------
6565e358ecaSmrg# Control maintainer-specific portions of Makefiles.
65774a3f230Smrg# Default is to disable them, unless 'enable' is passed literally.
65874a3f230Smrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
6595e358ecaSmrg# can override the default with the --enable/--disable switch.
6605e358ecaSmrgAC_DEFUN([AM_MAINTAINER_MODE],
6615e358ecaSmrg[m4_case(m4_default([$1], [disable]),
6625e358ecaSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
6635e358ecaSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
6645e358ecaSmrg       [m4_define([am_maintainer_other], [enable])
6655e358ecaSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
66674a3f230SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
6675e358ecaSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6685e358ecaSmrg  AC_ARG_ENABLE([maintainer-mode],
66974a3f230Smrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
67074a3f230Smrg      am_maintainer_other[ make rules and dependencies not useful
67174a3f230Smrg      (and sometimes confusing) to the casual installer])],
67274a3f230Smrg    [USE_MAINTAINER_MODE=$enableval],
67374a3f230Smrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6745e358ecaSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6755e358ecaSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6765e358ecaSmrg  MAINT=$MAINTAINER_MODE_TRUE
6775e358ecaSmrg  AC_SUBST([MAINT])dnl
6785e358ecaSmrg]
6795e358ecaSmrg)
680b3307321Smrg
6815e358ecaSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
682afe13c8eSmrg
68374a3f230Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6845e358ecaSmrg#
6855e358ecaSmrg# This file is free software; the Free Software Foundation
6865e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
6875e358ecaSmrg# with or without modifications, as long as this notice is preserved.
688afe13c8eSmrg
6895e358ecaSmrg# AM_MAKE_INCLUDE()
6905e358ecaSmrg# -----------------
6915e358ecaSmrg# Check to see how make treats includes.
6925e358ecaSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6935e358ecaSmrg[am_make=${MAKE-make}
6945e358ecaSmrgcat > confinc << 'END'
6955e358ecaSmrgam__doit:
6965e358ecaSmrg	@echo this is the am__doit target
6975e358ecaSmrg.PHONY: am__doit
6985e358ecaSmrgEND
6995e358ecaSmrg# If we don't find an include directive, just comment out the code.
7005e358ecaSmrgAC_MSG_CHECKING([for style of include used by $am_make])
7015e358ecaSmrgam__include="#"
7025e358ecaSmrgam__quote=
7035e358ecaSmrg_am_result=none
7045e358ecaSmrg# First try GNU make style include.
7055e358ecaSmrgecho "include confinc" > confmf
70674a3f230Smrg# Ignore all kinds of additional output from 'make'.
7075e358ecaSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
7085e358ecaSmrg*the\ am__doit\ target*)
7095e358ecaSmrg  am__include=include
7105e358ecaSmrg  am__quote=
7115e358ecaSmrg  _am_result=GNU
7125e358ecaSmrg  ;;
7135e358ecaSmrgesac
7145e358ecaSmrg# Now try BSD make style include.
7155e358ecaSmrgif test "$am__include" = "#"; then
7165e358ecaSmrg   echo '.include "confinc"' > confmf
7175e358ecaSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
7185e358ecaSmrg   *the\ am__doit\ target*)
7195e358ecaSmrg     am__include=.include
7205e358ecaSmrg     am__quote="\""
7215e358ecaSmrg     _am_result=BSD
7225e358ecaSmrg     ;;
7235e358ecaSmrg   esac
724afe13c8eSmrgfi
7255e358ecaSmrgAC_SUBST([am__include])
7265e358ecaSmrgAC_SUBST([am__quote])
7275e358ecaSmrgAC_MSG_RESULT([$_am_result])
7285e358ecaSmrgrm -f confinc confmf
7295e358ecaSmrg])
730b3307321Smrg
7315e358ecaSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
732b3307321Smrg
73374a3f230Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
7345e358ecaSmrg#
7355e358ecaSmrg# This file is free software; the Free Software Foundation
7365e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
7375e358ecaSmrg# with or without modifications, as long as this notice is preserved.
738b3307321Smrg
7395e358ecaSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7405e358ecaSmrg# ------------------------------
7415e358ecaSmrgAC_DEFUN([AM_MISSING_PROG],
7425e358ecaSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7435e358ecaSmrg$1=${$1-"${am_missing_run}$2"}
7445e358ecaSmrgAC_SUBST($1)])
745b3307321Smrg
7465e358ecaSmrg# AM_MISSING_HAS_RUN
7475e358ecaSmrg# ------------------
74874a3f230Smrg# Define MISSING if not defined so far and test if it is modern enough.
74974a3f230Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7505e358ecaSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7515e358ecaSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7525e358ecaSmrgAC_REQUIRE_AUX_FILE([missing])dnl
7535e358ecaSmrgif test x"${MISSING+set}" != xset; then
7545e358ecaSmrg  case $am_aux_dir in
7555e358ecaSmrg  *\ * | *\	*)
7565e358ecaSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7575e358ecaSmrg  *)
7585e358ecaSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7595e358ecaSmrg  esac
760afe13c8eSmrgfi
7615e358ecaSmrg# Use eval to expand $SHELL
76274a3f230Smrgif eval "$MISSING --is-lightweight"; then
76374a3f230Smrg  am_missing_run="$MISSING "
764afe13c8eSmrgelse
7655e358ecaSmrg  am_missing_run=
76674a3f230Smrg  AC_MSG_WARN(['missing' script is too old or missing])
767afe13c8eSmrgfi
7685e358ecaSmrg])
769b3307321Smrg
7705e358ecaSmrg# Helper functions for option handling.                     -*- Autoconf -*-
771b3307321Smrg
77274a3f230Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
773afe13c8eSmrg#
7745e358ecaSmrg# This file is free software; the Free Software Foundation
7755e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
7765e358ecaSmrg# with or without modifications, as long as this notice is preserved.
777b3307321Smrg
7785e358ecaSmrg# _AM_MANGLE_OPTION(NAME)
7795e358ecaSmrg# -----------------------
7805e358ecaSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7815e358ecaSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
782b3307321Smrg
7835e358ecaSmrg# _AM_SET_OPTION(NAME)
78474a3f230Smrg# --------------------
7855e358ecaSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7865e358ecaSmrgAC_DEFUN([_AM_SET_OPTION],
78774a3f230Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
788b3307321Smrg
7895e358ecaSmrg# _AM_SET_OPTIONS(OPTIONS)
79074a3f230Smrg# ------------------------
7915e358ecaSmrg# OPTIONS is a space-separated list of Automake options.
7925e358ecaSmrgAC_DEFUN([_AM_SET_OPTIONS],
7935e358ecaSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
794b3307321Smrg
7955e358ecaSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7965e358ecaSmrg# -------------------------------------------
7975e358ecaSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7985e358ecaSmrgAC_DEFUN([_AM_IF_OPTION],
7995e358ecaSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
8005e358ecaSmrg
80174a3f230Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
80274a3f230Smrg#
80374a3f230Smrg# This file is free software; the Free Software Foundation
80474a3f230Smrg# gives unlimited permission to copy and/or distribute it,
80574a3f230Smrg# with or without modifications, as long as this notice is preserved.
8065e358ecaSmrg
80774a3f230Smrg# _AM_PROG_CC_C_O
80874a3f230Smrg# ---------------
80974a3f230Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
81074a3f230Smrg# to automatically call this.
81174a3f230SmrgAC_DEFUN([_AM_PROG_CC_C_O],
81274a3f230Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
81374a3f230SmrgAC_REQUIRE_AUX_FILE([compile])dnl
81474a3f230SmrgAC_LANG_PUSH([C])dnl
81574a3f230SmrgAC_CACHE_CHECK(
81674a3f230Smrg  [whether $CC understands -c and -o together],
81774a3f230Smrg  [am_cv_prog_cc_c_o],
81874a3f230Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
81974a3f230Smrg  # Make sure it works both with $CC and with simple cc.
82074a3f230Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
82174a3f230Smrg  # compilers refuse to overwrite an existing .o file with -o,
82274a3f230Smrg  # though they will create one.
82374a3f230Smrg  am_cv_prog_cc_c_o=yes
82474a3f230Smrg  for am_i in 1 2; do
82574a3f230Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
82674a3f230Smrg         && test -f conftest2.$ac_objext; then
82774a3f230Smrg      : OK
82874a3f230Smrg    else
82974a3f230Smrg      am_cv_prog_cc_c_o=no
83074a3f230Smrg      break
83174a3f230Smrg    fi
83274a3f230Smrg  done
83374a3f230Smrg  rm -f core conftest*
83474a3f230Smrg  unset am_i])
83574a3f230Smrgif test "$am_cv_prog_cc_c_o" != yes; then
83674a3f230Smrg   # Losing compiler, so override with the script.
83774a3f230Smrg   # FIXME: It is wrong to rewrite CC.
83874a3f230Smrg   # But if we don't then we get into trouble of one sort or another.
83974a3f230Smrg   # A longer-term fix would be to have automake use am__CC in this case,
84074a3f230Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
84174a3f230Smrg   CC="$am_aux_dir/compile $CC"
84274a3f230Smrgfi
84374a3f230SmrgAC_LANG_POP([C])])
84474a3f230Smrg
84574a3f230Smrg# For backward compatibility.
84674a3f230SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
84774a3f230Smrg
84874a3f230Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
849afe13c8eSmrg#
850afe13c8eSmrg# This file is free software; the Free Software Foundation
851afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
852afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
853b3307321Smrg
85474a3f230Smrg# AM_RUN_LOG(COMMAND)
85574a3f230Smrg# -------------------
85674a3f230Smrg# Run COMMAND, save the exit status in ac_status, and log it.
85774a3f230Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
85874a3f230SmrgAC_DEFUN([AM_RUN_LOG],
85974a3f230Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
86074a3f230Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
86174a3f230Smrg   ac_status=$?
86274a3f230Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
86374a3f230Smrg   (exit $ac_status); }])
86474a3f230Smrg
86574a3f230Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
86674a3f230Smrg
86774a3f230Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
86874a3f230Smrg#
86974a3f230Smrg# This file is free software; the Free Software Foundation
87074a3f230Smrg# gives unlimited permission to copy and/or distribute it,
87174a3f230Smrg# with or without modifications, as long as this notice is preserved.
872b3307321Smrg
8735e358ecaSmrg# AM_SANITY_CHECK
8745e358ecaSmrg# ---------------
8755e358ecaSmrgAC_DEFUN([AM_SANITY_CHECK],
8765e358ecaSmrg[AC_MSG_CHECKING([whether build environment is sane])
8775e358ecaSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8785e358ecaSmrg# name.  Accept space and tab only in the latter.
8795e358ecaSmrgam_lf='
8805e358ecaSmrg'
8815e358ecaSmrgcase `pwd` in
8825e358ecaSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8835e358ecaSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8845e358ecaSmrgesac
8855e358ecaSmrgcase $srcdir in
8865e358ecaSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
88774a3f230Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8885e358ecaSmrgesac
889b3307321Smrg
89074a3f230Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8915e358ecaSmrg# arguments.  Must try -L first in case configure is actually a
8925e358ecaSmrg# symlink; some systems play weird games with the mod time of symlinks
8935e358ecaSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8945e358ecaSmrg# directory).
8955e358ecaSmrgif (
89674a3f230Smrg   am_has_slept=no
89774a3f230Smrg   for am_try in 1 2; do
89874a3f230Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
89974a3f230Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
90074a3f230Smrg     if test "$[*]" = "X"; then
90174a3f230Smrg	# -L didn't work.
90274a3f230Smrg	set X `ls -t "$srcdir/configure" conftest.file`
90374a3f230Smrg     fi
90474a3f230Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
90574a3f230Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
90674a3f230Smrg
90774a3f230Smrg	# If neither matched, then we have a broken ls.  This can happen
90874a3f230Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
90974a3f230Smrg	# broken ls alias from the environment.  This has actually
91074a3f230Smrg	# happened.  Such a system could not be considered "sane".
91174a3f230Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
91274a3f230Smrg  alias in your environment])
91374a3f230Smrg     fi
91474a3f230Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
91574a3f230Smrg       break
91674a3f230Smrg     fi
91774a3f230Smrg     # Just in case.
91874a3f230Smrg     sleep 1
91974a3f230Smrg     am_has_slept=yes
92074a3f230Smrg   done
9215e358ecaSmrg   test "$[2]" = conftest.file
9225e358ecaSmrg   )
9235e358ecaSmrgthen
9245e358ecaSmrg   # Ok.
9255e358ecaSmrg   :
9265e358ecaSmrgelse
9275e358ecaSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
9285e358ecaSmrgCheck your system clock])
9295e358ecaSmrgfi
93074a3f230SmrgAC_MSG_RESULT([yes])
93174a3f230Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
93274a3f230Smrg# generated files are strictly newer.
93374a3f230Smrgam_sleep_pid=
93474a3f230Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
93574a3f230Smrg  ( sleep 1 ) &
93674a3f230Smrg  am_sleep_pid=$!
93774a3f230Smrgfi
93874a3f230SmrgAC_CONFIG_COMMANDS_PRE(
93974a3f230Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
94074a3f230Smrg   if test -n "$am_sleep_pid"; then
94174a3f230Smrg     # Hide warnings about reused PIDs.
94274a3f230Smrg     wait $am_sleep_pid 2>/dev/null
94374a3f230Smrg   fi
94474a3f230Smrg   AC_MSG_RESULT([done])])
94574a3f230Smrgrm -f conftest.file
94674a3f230Smrg])
9475e358ecaSmrg
94874a3f230Smrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
949afe13c8eSmrg#
950afe13c8eSmrg# This file is free software; the Free Software Foundation
951afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
952afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
953b3307321Smrg
9545e358ecaSmrg# AM_SILENT_RULES([DEFAULT])
9555e358ecaSmrg# --------------------------
9565e358ecaSmrg# Enable less verbose build rules; with the default set to DEFAULT
95774a3f230Smrg# ("yes" being less verbose, "no" or empty being verbose).
9585e358ecaSmrgAC_DEFUN([AM_SILENT_RULES],
95974a3f230Smrg[AC_ARG_ENABLE([silent-rules], [dnl
96074a3f230SmrgAS_HELP_STRING(
96174a3f230Smrg  [--enable-silent-rules],
96274a3f230Smrg  [less verbose build output (undo: "make V=1")])
96374a3f230SmrgAS_HELP_STRING(
96474a3f230Smrg  [--disable-silent-rules],
96574a3f230Smrg  [verbose build output (undo: "make V=0")])dnl
96674a3f230Smrg])
96774a3f230Smrgcase $enable_silent_rules in @%:@ (((
96874a3f230Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
96974a3f230Smrg   no) AM_DEFAULT_VERBOSITY=1;;
97074a3f230Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9715e358ecaSmrgesac
97274a3f230Smrgdnl
97374a3f230Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
97474a3f230Smrgdnl do not support nested variable expansions.
97574a3f230Smrgdnl See automake bug#9928 and bug#10237.
97674a3f230Smrgam_make=${MAKE-make}
97774a3f230SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
97874a3f230Smrg   [am_cv_make_support_nested_variables],
97974a3f230Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
98074a3f230SmrgBAR0=false
98174a3f230SmrgBAR1=true
98274a3f230SmrgV=1
98374a3f230Smrgam__doit:
98474a3f230Smrg	@$(TRUE)
98574a3f230Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
98674a3f230Smrg  am_cv_make_support_nested_variables=yes
98774a3f230Smrgelse
98874a3f230Smrg  am_cv_make_support_nested_variables=no
98974a3f230Smrgfi])
99074a3f230Smrgif test $am_cv_make_support_nested_variables = yes; then
99174a3f230Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
99274a3f230Smrg  AM_V='$(V)'
99374a3f230Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
99474a3f230Smrgelse
99574a3f230Smrg  AM_V=$AM_DEFAULT_VERBOSITY
99674a3f230Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
99774a3f230Smrgfi
99874a3f230SmrgAC_SUBST([AM_V])dnl
99974a3f230SmrgAM_SUBST_NOTMAKE([AM_V])dnl
100074a3f230SmrgAC_SUBST([AM_DEFAULT_V])dnl
100174a3f230SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
10025e358ecaSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
10035e358ecaSmrgAM_BACKSLASH='\'
10045e358ecaSmrgAC_SUBST([AM_BACKSLASH])dnl
10055e358ecaSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1006afe13c8eSmrg])
1007afe13c8eSmrg
100874a3f230Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
10095e358ecaSmrg#
10105e358ecaSmrg# This file is free software; the Free Software Foundation
10115e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
10125e358ecaSmrg# with or without modifications, as long as this notice is preserved.
10135e358ecaSmrg
10145e358ecaSmrg# AM_PROG_INSTALL_STRIP
10155e358ecaSmrg# ---------------------
101674a3f230Smrg# One issue with vendor 'install' (even GNU) is that you can't
10175e358ecaSmrg# specify the program used to strip binaries.  This is especially
10185e358ecaSmrg# annoying in cross-compiling environments, where the build's strip
10195e358ecaSmrg# is unlikely to handle the host's binaries.
10205e358ecaSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
102174a3f230Smrg# always use install-sh in "make install-strip", and initialize
10225e358ecaSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
10235e358ecaSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
10245e358ecaSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
102574a3f230Smrg# Installed binaries are usually stripped using 'strip' when the user
102674a3f230Smrg# run "make install-strip".  However 'strip' might not be the right
10275e358ecaSmrg# tool to use in cross-compilation environments, therefore Automake
102874a3f230Smrg# will honor the 'STRIP' environment variable to overrule this program.
102974a3f230Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
10305e358ecaSmrgif test "$cross_compiling" != no; then
10315e358ecaSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
10325e358ecaSmrgfi
10335e358ecaSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
10345e358ecaSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1035afe13c8eSmrg
103674a3f230Smrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
1037afe13c8eSmrg#
1038afe13c8eSmrg# This file is free software; the Free Software Foundation
1039afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1040afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1041afe13c8eSmrg
10425e358ecaSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10435e358ecaSmrg# ---------------------------
10445e358ecaSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10455e358ecaSmrg# This macro is traced by Automake.
10465e358ecaSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1047afe13c8eSmrg
10485e358ecaSmrg# AM_SUBST_NOTMAKE(VARIABLE)
104974a3f230Smrg# --------------------------
10505e358ecaSmrg# Public sister of _AM_SUBST_NOTMAKE.
10515e358ecaSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10525e358ecaSmrg
10535e358ecaSmrg# Check how to create a tarball.                            -*- Autoconf -*-
10545e358ecaSmrg
105574a3f230Smrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
1056afe13c8eSmrg#
1057afe13c8eSmrg# This file is free software; the Free Software Foundation
1058afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1059afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1060b3307321Smrg
10615e358ecaSmrg# _AM_PROG_TAR(FORMAT)
10625e358ecaSmrg# --------------------
10635e358ecaSmrg# Check how to create a tarball in format FORMAT.
106474a3f230Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1065b3307321Smrg#
10665e358ecaSmrg# Substitute a variable $(am__tar) that is a command
10675e358ecaSmrg# writing to stdout a FORMAT-tarball containing the directory
10685e358ecaSmrg# $tardir.
10695e358ecaSmrg#     tardir=directory && $(am__tar) > result.tar
10705e358ecaSmrg#
10715e358ecaSmrg# Substitute a variable $(am__untar) that extract such
10725e358ecaSmrg# a tarball read from stdin.
10735e358ecaSmrg#     $(am__untar) < result.tar
107474a3f230Smrg#
10755e358ecaSmrgAC_DEFUN([_AM_PROG_TAR],
107674a3f230Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
107774a3f230Smrg# in the wild :-(  We should find a proper way to deprecate it ...
107874a3f230SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
107974a3f230Smrg
108074a3f230Smrg# We'll loop over all known methods to create a tar archive until one works.
10815e358ecaSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1082b3307321Smrg
108374a3f230Smrgm4_if([$1], [v7],
108474a3f230Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
108574a3f230Smrg
108674a3f230Smrg  [m4_case([$1],
108774a3f230Smrg    [ustar],
108874a3f230Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
108974a3f230Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
109074a3f230Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
109174a3f230Smrg      # and bug#13588).
109274a3f230Smrg      am_max_uid=2097151 # 2^21 - 1
109374a3f230Smrg      am_max_gid=$am_max_uid
109474a3f230Smrg      # The $UID and $GID variables are not portable, so we need to resort
109574a3f230Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
109674a3f230Smrg      # below are definitely unexpected, so allow the users to see them
109774a3f230Smrg      # (that is, avoid stderr redirection).
109874a3f230Smrg      am_uid=`id -u || echo unknown`
109974a3f230Smrg      am_gid=`id -g || echo unknown`
110074a3f230Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
110174a3f230Smrg      if test $am_uid -le $am_max_uid; then
110274a3f230Smrg         AC_MSG_RESULT([yes])
110374a3f230Smrg      else
110474a3f230Smrg         AC_MSG_RESULT([no])
110574a3f230Smrg         _am_tools=none
110674a3f230Smrg      fi
110774a3f230Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
110874a3f230Smrg      if test $am_gid -le $am_max_gid; then
110974a3f230Smrg         AC_MSG_RESULT([yes])
111074a3f230Smrg      else
111174a3f230Smrg        AC_MSG_RESULT([no])
111274a3f230Smrg        _am_tools=none
111374a3f230Smrg      fi],
111474a3f230Smrg
111574a3f230Smrg  [pax],
111674a3f230Smrg    [],
111774a3f230Smrg
111874a3f230Smrg  [m4_fatal([Unknown tar format])])
111974a3f230Smrg
112074a3f230Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
112174a3f230Smrg
112274a3f230Smrg  # Go ahead even if we have the value already cached.  We do so because we
112374a3f230Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
112474a3f230Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
112574a3f230Smrg
112674a3f230Smrg  for _am_tool in $_am_tools; do
112774a3f230Smrg    case $_am_tool in
112874a3f230Smrg    gnutar)
112974a3f230Smrg      for _am_tar in tar gnutar gtar; do
113074a3f230Smrg        AM_RUN_LOG([$_am_tar --version]) && break
113174a3f230Smrg      done
113274a3f230Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
113374a3f230Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
113474a3f230Smrg      am__untar="$_am_tar -xf -"
113574a3f230Smrg      ;;
113674a3f230Smrg    plaintar)
113774a3f230Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
113874a3f230Smrg      # ustar tarball either.
113974a3f230Smrg      (tar --version) >/dev/null 2>&1 && continue
114074a3f230Smrg      am__tar='tar chf - "$$tardir"'
114174a3f230Smrg      am__tar_='tar chf - "$tardir"'
114274a3f230Smrg      am__untar='tar xf -'
114374a3f230Smrg      ;;
114474a3f230Smrg    pax)
114574a3f230Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
114674a3f230Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
114774a3f230Smrg      am__untar='pax -r'
114874a3f230Smrg      ;;
114974a3f230Smrg    cpio)
115074a3f230Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
115174a3f230Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
115274a3f230Smrg      am__untar='cpio -i -H $1 -d'
115374a3f230Smrg      ;;
115474a3f230Smrg    none)
115574a3f230Smrg      am__tar=false
115674a3f230Smrg      am__tar_=false
115774a3f230Smrg      am__untar=false
115874a3f230Smrg      ;;
115974a3f230Smrg    esac
1160b3307321Smrg
116174a3f230Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
116274a3f230Smrg    # and am__untar set.
116374a3f230Smrg    test -n "${am_cv_prog_tar_$1}" && break
116474a3f230Smrg
116574a3f230Smrg    # tar/untar a dummy directory, and stop if the command works.
116674a3f230Smrg    rm -rf conftest.dir
116774a3f230Smrg    mkdir conftest.dir
116874a3f230Smrg    echo GrepMe > conftest.dir/file
116974a3f230Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
117074a3f230Smrg    rm -rf conftest.dir
117174a3f230Smrg    if test -s conftest.tar; then
117274a3f230Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
117374a3f230Smrg      AM_RUN_LOG([cat conftest.dir/file])
117474a3f230Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
117574a3f230Smrg    fi
117674a3f230Smrg  done
11775e358ecaSmrg  rm -rf conftest.dir
1178b3307321Smrg
117974a3f230Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
118074a3f230Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
118174a3f230Smrg
11825e358ecaSmrgAC_SUBST([am__tar])
11835e358ecaSmrgAC_SUBST([am__untar])
11845e358ecaSmrg]) # _AM_PROG_TAR
1185b3307321Smrg
1186320e696bSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1187320e696bSmrg# 
1188320e696bSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1189320e696bSmrg#
1190320e696bSmrg# This program is free software; you can redistribute it and/or modify
1191320e696bSmrg# it under the terms of the GNU General Public License as published by
1192320e696bSmrg# the Free Software Foundation; either version 2 of the License, or
1193320e696bSmrg# (at your option) any later version.
1194320e696bSmrg#
1195320e696bSmrg# This program is distributed in the hope that it will be useful, but
1196320e696bSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1197320e696bSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1198320e696bSmrg# General Public License for more details.
1199320e696bSmrg#
1200320e696bSmrg# You should have received a copy of the GNU General Public License
1201320e696bSmrg# along with this program; if not, write to the Free Software
1202320e696bSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1203320e696bSmrg#
1204320e696bSmrg# As a special exception to the GNU General Public License, if you
1205320e696bSmrg# distribute this file as part of a program that contains a
1206320e696bSmrg# configuration script generated by Autoconf, you may include it under
1207320e696bSmrg# the same distribution terms that you use for the rest of that program.
1208320e696bSmrg
1209320e696bSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1210320e696bSmrg# ----------------------------------
1211320e696bSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1212320e696bSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1213320e696bSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1214320e696bSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1215320e696bSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1216320e696bSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1217320e696bSmrgfi
1218320e696bSmrgif test -n "$PKG_CONFIG"; then
1219320e696bSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1220320e696bSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1221320e696bSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1222320e696bSmrg		AC_MSG_RESULT([yes])
1223320e696bSmrg	else
1224320e696bSmrg		AC_MSG_RESULT([no])
1225320e696bSmrg		PKG_CONFIG=""
1226320e696bSmrg	fi
1227320e696bSmrg		
1228320e696bSmrgfi[]dnl
1229320e696bSmrg])# PKG_PROG_PKG_CONFIG
1230320e696bSmrg
1231320e696bSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232320e696bSmrg#
1233320e696bSmrg# Check to see whether a particular set of modules exists.  Similar
1234320e696bSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1235320e696bSmrg#
1236320e696bSmrg#
1237320e696bSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1238320e696bSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
1239320e696bSmrg# PKG_CHECK_EXISTS manually
1240320e696bSmrg# --------------------------------------------------------------
1241320e696bSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1242320e696bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1243320e696bSmrgif test -n "$PKG_CONFIG" && \
1244320e696bSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1245320e696bSmrg  m4_ifval([$2], [$2], [:])
1246320e696bSmrgm4_ifvaln([$3], [else
1247320e696bSmrg  $3])dnl
1248320e696bSmrgfi])
1249320e696bSmrg
1250320e696bSmrg
1251320e696bSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252320e696bSmrg# ---------------------------------------------
1253320e696bSmrgm4_define([_PKG_CONFIG],
1254320e696bSmrg[if test -n "$$1"; then
1255320e696bSmrg    pkg_cv_[]$1="$$1"
1256320e696bSmrg elif test -n "$PKG_CONFIG"; then
1257320e696bSmrg    PKG_CHECK_EXISTS([$3],
1258320e696bSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1259320e696bSmrg		     [pkg_failed=yes])
1260320e696bSmrg else
1261320e696bSmrg    pkg_failed=untried
1262320e696bSmrgfi[]dnl
1263320e696bSmrg])# _PKG_CONFIG
1264320e696bSmrg
1265320e696bSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1266320e696bSmrg# -----------------------------
1267320e696bSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1268320e696bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1269320e696bSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1270320e696bSmrg        _pkg_short_errors_supported=yes
1271320e696bSmrgelse
1272320e696bSmrg        _pkg_short_errors_supported=no
1273320e696bSmrgfi[]dnl
1274320e696bSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1275320e696bSmrg
1276320e696bSmrg
1277320e696bSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1278320e696bSmrg# [ACTION-IF-NOT-FOUND])
1279320e696bSmrg#
1280320e696bSmrg#
1281320e696bSmrg# Note that if there is a possibility the first call to
1282320e696bSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1283320e696bSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1284320e696bSmrg#
1285320e696bSmrg#
1286320e696bSmrg# --------------------------------------------------------------
1287320e696bSmrgAC_DEFUN([PKG_CHECK_MODULES],
1288320e696bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1289320e696bSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1290320e696bSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1291320e696bSmrg
1292320e696bSmrgpkg_failed=no
1293320e696bSmrgAC_MSG_CHECKING([for $1])
1294320e696bSmrg
1295320e696bSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1296320e696bSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1297320e696bSmrg
1298320e696bSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1299320e696bSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1300320e696bSmrgSee the pkg-config man page for more details.])
1301320e696bSmrg
1302320e696bSmrgif test $pkg_failed = yes; then
1303320e696bSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1304320e696bSmrg        if test $_pkg_short_errors_supported = yes; then
1305320e696bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1306320e696bSmrg        else 
1307320e696bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1308320e696bSmrg        fi
1309320e696bSmrg	# Put the nasty error message in config.log where it belongs
1310320e696bSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1311320e696bSmrg
1312320e696bSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1313320e696bSmrg[Package requirements ($2) were not met:
1314320e696bSmrg
1315320e696bSmrg$$1_PKG_ERRORS
1316320e696bSmrg
1317320e696bSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1318320e696bSmrginstalled software in a non-standard prefix.
1319320e696bSmrg
1320320e696bSmrg_PKG_TEXT
1321320e696bSmrg])],
1322320e696bSmrg		[AC_MSG_RESULT([no])
1323320e696bSmrg                $4])
1324320e696bSmrgelif test $pkg_failed = untried; then
1325320e696bSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1326320e696bSmrg[The pkg-config script could not be found or is too old.  Make sure it
1327320e696bSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1328320e696bSmrgpath to pkg-config.
1329320e696bSmrg
1330320e696bSmrg_PKG_TEXT
1331320e696bSmrg
1332320e696bSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1333320e696bSmrg		[$4])
1334320e696bSmrgelse
1335320e696bSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1336320e696bSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1337320e696bSmrg        AC_MSG_RESULT([yes])
1338320e696bSmrg	ifelse([$3], , :, [$3])
1339320e696bSmrgfi[]dnl
1340320e696bSmrg])# PKG_CHECK_MODULES
1341320e696bSmrg
13425e358ecaSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
13435e358ecaSmrgdnl
134429cb5710Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
13455e358ecaSmrgdnl 
13465e358ecaSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
134729cb5710Smrgdnl copy of this software and associated documentation files (the "Software"),
134829cb5710Smrgdnl to deal in the Software without restriction, including without limitation
134929cb5710Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
135029cb5710Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
135129cb5710Smrgdnl Software is furnished to do so, subject to the following conditions:
13525e358ecaSmrgdnl
135329cb5710Smrgdnl The above copyright notice and this permission notice (including the next
135429cb5710Smrgdnl paragraph) shall be included in all copies or substantial portions of the
135529cb5710Smrgdnl Software.
13565e358ecaSmrgdnl
135729cb5710Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
135829cb5710Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
135929cb5710Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
136029cb5710Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
136129cb5710Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
136229cb5710Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
136329cb5710Smrgdnl DEALINGS IN THE SOFTWARE.
1364b3307321Smrg
13655e358ecaSmrg# XORG_MACROS_VERSION(required-version)
13665e358ecaSmrg# -------------------------------------
13675e358ecaSmrg# Minimum version: 1.1.0
13685e358ecaSmrg#
13695e358ecaSmrg# If you're using a macro added in Version 1.1 or newer, include this in
13705e358ecaSmrg# your configure.ac with the minimum required version, such as:
13715e358ecaSmrg# XORG_MACROS_VERSION(1.1)
13725e358ecaSmrg#
13735e358ecaSmrg# To ensure that this macro is defined, also add:
13745e358ecaSmrg# m4_ifndef([XORG_MACROS_VERSION],
13755e358ecaSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
13765e358ecaSmrg#
13775e358ecaSmrg#
13785e358ecaSmrg# See the "minimum version" comment for each macro you use to see what 
13795e358ecaSmrg# version you require.
13805e358ecaSmrgm4_defun([XORG_MACROS_VERSION],[
138174a3f230Smrgm4_define([vers_have], [1.17])
13825e358ecaSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
13835e358ecaSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
13845e358ecaSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
13855e358ecaSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
13865e358ecaSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
13875e358ecaSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
13885e358ecaSmrgm4_undefine([vers_have])
13895e358ecaSmrgm4_undefine([maj_have])
13905e358ecaSmrgm4_undefine([maj_needed])
13915e358ecaSmrg]) # XORG_MACROS_VERSION
1392b3307321Smrg
13935e358ecaSmrg# XORG_PROG_RAWCPP()
13945e358ecaSmrg# ------------------
13955e358ecaSmrg# Minimum version: 1.0.0
13965e358ecaSmrg#
13975e358ecaSmrg# Find cpp program and necessary flags for use in pre-processing text files
13985e358ecaSmrg# such as man pages and config files
13995e358ecaSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14005e358ecaSmrgAC_REQUIRE([AC_PROG_CPP])
14015e358ecaSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
14025e358ecaSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1403b3307321Smrg
14045e358ecaSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14055e358ecaSmrg# which is not the best choice for supporting other OS'es, but covers most
14065e358ecaSmrg# of the ones we need for now.
14075e358ecaSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1408320e696bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14095e358ecaSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14105e358ecaSmrg	AC_MSG_RESULT([no])
14115e358ecaSmrgelse
14125e358ecaSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14135e358ecaSmrg		RAWCPPFLAGS=-undef
14145e358ecaSmrg		AC_MSG_RESULT([yes])
14155e358ecaSmrg	# under Cygwin unix is still defined even with -undef
14165e358ecaSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14175e358ecaSmrg		RAWCPPFLAGS="-undef -ansi"
14185e358ecaSmrg		AC_MSG_RESULT([yes, with -ansi])
14195e358ecaSmrg	else
14205e358ecaSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
14215e358ecaSmrg	fi
1422b3307321Smrgfi
14235e358ecaSmrgrm -f conftest.$ac_ext
1424b3307321Smrg
14255e358ecaSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1426320e696bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
14275e358ecaSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
14285e358ecaSmrg	AC_MSG_RESULT([no])
14295e358ecaSmrgelse
14305e358ecaSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
14315e358ecaSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
14325e358ecaSmrg		AC_MSG_RESULT([yes])
14335e358ecaSmrg	else
14345e358ecaSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
14355e358ecaSmrg	fi
14365e358ecaSmrgfi
14375e358ecaSmrgrm -f conftest.$ac_ext
14385e358ecaSmrgAC_SUBST(RAWCPPFLAGS)
14395e358ecaSmrg]) # XORG_PROG_RAWCPP
1440b3307321Smrg
14415e358ecaSmrg# XORG_MANPAGE_SECTIONS()
14425e358ecaSmrg# -----------------------
14435e358ecaSmrg# Minimum version: 1.0.0
1444afe13c8eSmrg#
14455e358ecaSmrg# Determine which sections man pages go in for the different man page types
14465e358ecaSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
14475e358ecaSmrg# Not sure if there's any better way than just hardcoding by OS name.
14485e358ecaSmrg# Override default settings by setting environment variables
144929cb5710Smrg# Added MAN_SUBSTS in version 1.8
145029cb5710Smrg# Added AC_PROG_SED in version 1.8
1451b3307321Smrg
14525e358ecaSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
14535e358ecaSmrgAC_REQUIRE([AC_CANONICAL_HOST])
145429cb5710SmrgAC_REQUIRE([AC_PROG_SED])
1455b3307321Smrg
14565e358ecaSmrgif test x$APP_MAN_SUFFIX = x    ; then
14575e358ecaSmrg    APP_MAN_SUFFIX=1
14585e358ecaSmrgfi
14595e358ecaSmrgif test x$APP_MAN_DIR = x    ; then
14605e358ecaSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
14615e358ecaSmrgfi
1462b3307321Smrg
14635e358ecaSmrgif test x$LIB_MAN_SUFFIX = x    ; then
14645e358ecaSmrg    LIB_MAN_SUFFIX=3
14655e358ecaSmrgfi
14665e358ecaSmrgif test x$LIB_MAN_DIR = x    ; then
14675e358ecaSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
14685e358ecaSmrgfi
1469b3307321Smrg
14705e358ecaSmrgif test x$FILE_MAN_SUFFIX = x    ; then
14715e358ecaSmrg    case $host_os in
14725e358ecaSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
14735e358ecaSmrg	*)		FILE_MAN_SUFFIX=5  ;;
14745e358ecaSmrg    esac
14755e358ecaSmrgfi
14765e358ecaSmrgif test x$FILE_MAN_DIR = x    ; then
14775e358ecaSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
14785e358ecaSmrgfi
1479b3307321Smrg
14805e358ecaSmrgif test x$MISC_MAN_SUFFIX = x    ; then
14815e358ecaSmrg    case $host_os in
14825e358ecaSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
14835e358ecaSmrg	*)		MISC_MAN_SUFFIX=7  ;;
14845e358ecaSmrg    esac
14855e358ecaSmrgfi
14865e358ecaSmrgif test x$MISC_MAN_DIR = x    ; then
14875e358ecaSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
14885e358ecaSmrgfi
1489b3307321Smrg
14905e358ecaSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
14915e358ecaSmrg    case $host_os in
14925e358ecaSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
14935e358ecaSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
14945e358ecaSmrg    esac
14955e358ecaSmrgfi
14965e358ecaSmrgif test x$DRIVER_MAN_DIR = x    ; then
14975e358ecaSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
14985e358ecaSmrgfi
1499b3307321Smrg
15005e358ecaSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15015e358ecaSmrg    case $host_os in
15025e358ecaSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
15035e358ecaSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
15045e358ecaSmrg    esac
15055e358ecaSmrgfi
15065e358ecaSmrgif test x$ADMIN_MAN_DIR = x    ; then
15075e358ecaSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
15085e358ecaSmrgfi
1509b3307321Smrg
1510b3307321Smrg
15115e358ecaSmrgAC_SUBST([APP_MAN_SUFFIX])
15125e358ecaSmrgAC_SUBST([LIB_MAN_SUFFIX])
15135e358ecaSmrgAC_SUBST([FILE_MAN_SUFFIX])
15145e358ecaSmrgAC_SUBST([MISC_MAN_SUFFIX])
15155e358ecaSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
15165e358ecaSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
15175e358ecaSmrgAC_SUBST([APP_MAN_DIR])
15185e358ecaSmrgAC_SUBST([LIB_MAN_DIR])
15195e358ecaSmrgAC_SUBST([FILE_MAN_DIR])
15205e358ecaSmrgAC_SUBST([MISC_MAN_DIR])
15215e358ecaSmrgAC_SUBST([DRIVER_MAN_DIR])
15225e358ecaSmrgAC_SUBST([ADMIN_MAN_DIR])
152329cb5710Smrg
152429cb5710SmrgXORG_MAN_PAGE="X Version 11"
152529cb5710SmrgAC_SUBST([XORG_MAN_PAGE])
152629cb5710SmrgMAN_SUBSTS="\
152729cb5710Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
152829cb5710Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
152929cb5710Smrg	-e 's|__xservername__|Xorg|g' \
153029cb5710Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
153129cb5710Smrg	-e 's|__projectroot__|\$(prefix)|g' \
153229cb5710Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
153329cb5710Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
153429cb5710Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
153529cb5710Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
153629cb5710Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
153729cb5710Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
153829cb5710Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
153929cb5710SmrgAC_SUBST([MAN_SUBSTS])
154029cb5710Smrg
15415e358ecaSmrg]) # XORG_MANPAGE_SECTIONS
15425e358ecaSmrg
154329cb5710Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
154429cb5710Smrg# ------------------------
154529cb5710Smrg# Minimum version: 1.7.0
154629cb5710Smrg#
154729cb5710Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
154829cb5710Smrg# provided by xorg-sgml-doctools, if installed.
154929cb5710SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
155029cb5710SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
155129cb5710SmrgXORG_SGML_PATH=
155229cb5710SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
155329cb5710Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
155429cb5710Smrg    [m4_ifval([$1],[:],
155529cb5710Smrg        [if test x"$cross_compiling" != x"yes" ; then
155629cb5710Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
155729cb5710Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
155829cb5710Smrg         fi])
155929cb5710Smrg    ])
156029cb5710Smrg
156129cb5710Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
156229cb5710Smrg# the path and the name of the doc stylesheet
156329cb5710Smrgif test "x$XORG_SGML_PATH" != "x" ; then
156429cb5710Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
156529cb5710Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
156629cb5710Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
156729cb5710Smrgelse
156829cb5710Smrg   AC_MSG_RESULT([no])
156929cb5710Smrgfi
157029cb5710Smrg
157129cb5710SmrgAC_SUBST(XORG_SGML_PATH)
157229cb5710SmrgAC_SUBST(STYLESHEET_SRCDIR)
157329cb5710SmrgAC_SUBST(XSL_STYLESHEET)
157429cb5710SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
157529cb5710Smrg]) # XORG_CHECK_SGML_DOCTOOLS
157629cb5710Smrg
15775e358ecaSmrg# XORG_CHECK_LINUXDOC
15785e358ecaSmrg# -------------------
15795e358ecaSmrg# Minimum version: 1.0.0
1580afe13c8eSmrg#
15815e358ecaSmrg# Defines the variable MAKE_TEXT if the necessary tools and
15825e358ecaSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
15835e358ecaSmrg# Whether or not the necessary tools and files are found can be checked
15845e358ecaSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
15855e358ecaSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
158629cb5710SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
158729cb5710SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1588afe13c8eSmrg
15895e358ecaSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1590afe13c8eSmrg
159129cb5710SmrgAC_MSG_CHECKING([whether to build documentation])
1592afe13c8eSmrg
159329cb5710Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
15945e358ecaSmrg   BUILDDOC=yes
15955e358ecaSmrgelse
15965e358ecaSmrg   BUILDDOC=no
1597afe13c8eSmrgfi
1598afe13c8eSmrg
15995e358ecaSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1600afe13c8eSmrg
16015e358ecaSmrgAC_MSG_RESULT([$BUILDDOC])
1602afe13c8eSmrg
160329cb5710SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1604afe13c8eSmrg
160529cb5710Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
16065e358ecaSmrg   BUILDPDFDOC=yes
16075e358ecaSmrgelse
16085e358ecaSmrg   BUILDPDFDOC=no
16095e358ecaSmrgfi
1610afe13c8eSmrg
16115e358ecaSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1612afe13c8eSmrg
16135e358ecaSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1614afe13c8eSmrg
161529cb5710SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
16165e358ecaSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
16175e358ecaSmrgMAKE_PDF="$PS2PDF"
16185e358ecaSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1619afe13c8eSmrg
16205e358ecaSmrgAC_SUBST(MAKE_TEXT)
16215e358ecaSmrgAC_SUBST(MAKE_PS)
16225e358ecaSmrgAC_SUBST(MAKE_PDF)
16235e358ecaSmrgAC_SUBST(MAKE_HTML)
16245e358ecaSmrg]) # XORG_CHECK_LINUXDOC
1625afe13c8eSmrg
16265e358ecaSmrg# XORG_CHECK_DOCBOOK
16275e358ecaSmrg# -------------------
16285e358ecaSmrg# Minimum version: 1.0.0
1629afe13c8eSmrg#
16305e358ecaSmrg# Checks for the ability to build output formats from SGML DocBook source.
16315e358ecaSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16325e358ecaSmrg# indicates whether the necessary tools and files are found and, if set,
16335e358ecaSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16345e358ecaSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
163529cb5710SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
163629cb5710Smrg
16375e358ecaSmrgBUILDTXTDOC=no
16385e358ecaSmrgBUILDPDFDOC=no
16395e358ecaSmrgBUILDPSDOC=no
16405e358ecaSmrgBUILDHTMLDOC=no
1641b3307321Smrg
16425e358ecaSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16435e358ecaSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16445e358ecaSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16455e358ecaSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1646afe13c8eSmrg
164729cb5710SmrgAC_MSG_CHECKING([whether to build text documentation])
164829cb5710Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16495e358ecaSmrg   test x$BUILD_TXTDOC != xno; then
16505e358ecaSmrg	BUILDTXTDOC=yes
16515e358ecaSmrgfi
16525e358ecaSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16535e358ecaSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1654afe13c8eSmrg
165529cb5710SmrgAC_MSG_CHECKING([whether to build PDF documentation])
165629cb5710Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16575e358ecaSmrg   test x$BUILD_PDFDOC != xno; then
16585e358ecaSmrg	BUILDPDFDOC=yes
16595e358ecaSmrgfi
16605e358ecaSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16615e358ecaSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1662afe13c8eSmrg
166329cb5710SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
166429cb5710Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
16655e358ecaSmrg   test x$BUILD_PSDOC != xno; then
16665e358ecaSmrg	BUILDPSDOC=yes
16675e358ecaSmrgfi
16685e358ecaSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
16695e358ecaSmrgAC_MSG_RESULT([$BUILDPSDOC])
1670afe13c8eSmrg
167129cb5710SmrgAC_MSG_CHECKING([whether to build HTML documentation])
167229cb5710Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
16735e358ecaSmrg   test x$BUILD_HTMLDOC != xno; then
16745e358ecaSmrg	BUILDHTMLDOC=yes
16755e358ecaSmrgfi
16765e358ecaSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
16775e358ecaSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1678afe13c8eSmrg
16795e358ecaSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
16805e358ecaSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
16815e358ecaSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
16825e358ecaSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1683afe13c8eSmrg
16845e358ecaSmrgAC_SUBST(MAKE_TEXT)
16855e358ecaSmrgAC_SUBST(MAKE_PS)
16865e358ecaSmrgAC_SUBST(MAKE_PDF)
16875e358ecaSmrgAC_SUBST(MAKE_HTML)
16885e358ecaSmrg]) # XORG_CHECK_DOCBOOK
1689afe13c8eSmrg
169029cb5710Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
169129cb5710Smrg# ----------------
169229cb5710Smrg# Minimum version: 1.5.0
169329cb5710Smrg# Minimum version for optional DEFAULT argument: 1.11.0
169429cb5710Smrg#
169529cb5710Smrg# Documentation tools are not always available on all platforms and sometimes
169629cb5710Smrg# not at the appropriate level. This macro enables a module to test for the
169729cb5710Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
169829cb5710Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
169929cb5710Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
170029cb5710Smrg# --with-xmlto assumes 'auto'.
170129cb5710Smrg#
170229cb5710Smrg# Interface to module:
170329cb5710Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
170429cb5710Smrg# XMLTO:	returns the path of the xmlto program found
170529cb5710Smrg#		returns the path set by the user in the environment
170629cb5710Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
170729cb5710Smrg#		'no' user instructs the module not to use xmlto
170829cb5710Smrg#
170929cb5710Smrg# Added in version 1.10.0
171029cb5710Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
171129cb5710Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
171229cb5710Smrg#
171329cb5710Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
171429cb5710Smrg#
171529cb5710SmrgAC_DEFUN([XORG_WITH_XMLTO],[
171629cb5710SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
171729cb5710Smrgm4_define([_defopt], m4_default([$2], [auto]))
171829cb5710SmrgAC_ARG_WITH(xmlto,
171929cb5710Smrg	AS_HELP_STRING([--with-xmlto],
172029cb5710Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
172129cb5710Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
172229cb5710Smrgm4_undefine([_defopt])
172329cb5710Smrg
172429cb5710Smrgif test "x$use_xmlto" = x"auto"; then
172529cb5710Smrg   AC_PATH_PROG([XMLTO], [xmlto])
172629cb5710Smrg   if test "x$XMLTO" = "x"; then
172729cb5710Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
172829cb5710Smrg	have_xmlto=no
172929cb5710Smrg   else
173029cb5710Smrg        have_xmlto=yes
173129cb5710Smrg   fi
173229cb5710Smrgelif test "x$use_xmlto" = x"yes" ; then
173329cb5710Smrg   AC_PATH_PROG([XMLTO], [xmlto])
173429cb5710Smrg   if test "x$XMLTO" = "x"; then
173529cb5710Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
173629cb5710Smrg   fi
173729cb5710Smrg   have_xmlto=yes
173829cb5710Smrgelif test "x$use_xmlto" = x"no" ; then
173929cb5710Smrg   if test "x$XMLTO" != "x"; then
174029cb5710Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
174129cb5710Smrg   fi
174229cb5710Smrg   have_xmlto=no
174329cb5710Smrgelse
174429cb5710Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
174529cb5710Smrgfi
174629cb5710Smrg
174729cb5710Smrg# Test for a minimum version of xmlto, if provided.
174829cb5710Smrgm4_ifval([$1],
174929cb5710Smrg[if test "$have_xmlto" = yes; then
175029cb5710Smrg    # scrape the xmlto version
175129cb5710Smrg    AC_MSG_CHECKING([the xmlto version])
175229cb5710Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
175329cb5710Smrg    AC_MSG_RESULT([$xmlto_version])
175429cb5710Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
175529cb5710Smrg        [if test "x$use_xmlto" = xauto; then
175629cb5710Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
175729cb5710Smrg            have_xmlto=no
175829cb5710Smrg        else
175929cb5710Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
176029cb5710Smrg        fi])
176129cb5710Smrgfi])
176229cb5710Smrg
176329cb5710Smrg# Test for the ability of xmlto to generate a text target
176429cb5710Smrghave_xmlto_text=no
176529cb5710Smrgcat > conftest.xml << "EOF"
176629cb5710SmrgEOF
176729cb5710SmrgAS_IF([test "$have_xmlto" = yes],
176829cb5710Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
176929cb5710Smrg             [have_xmlto_text=yes],
177029cb5710Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
177129cb5710Smrgrm -f conftest.xml
177229cb5710SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
177329cb5710SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
177429cb5710Smrg]) # XORG_WITH_XMLTO
177529cb5710Smrg
1776320e696bSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1777320e696bSmrg# --------------------------------------------
1778320e696bSmrg# Minimum version: 1.12.0
1779320e696bSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1780320e696bSmrg#
1781320e696bSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1782320e696bSmrg# XML-based language used for the transformation of XML documents.
1783320e696bSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1784320e696bSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1785320e696bSmrg# The XSLT processor is often used as a standalone tool for transformations.
1786320e696bSmrg# It should not be assumed that this tool is used only to work with documnetation.
1787320e696bSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1788320e696bSmrg#
1789320e696bSmrg# Interface to module:
1790320e696bSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1791320e696bSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1792320e696bSmrg#		 returns the path set by the user in the environment
1793320e696bSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1794320e696bSmrg#		  'no' user instructs the module not to use xsltproc
1795320e696bSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1796320e696bSmrg#
1797320e696bSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1798320e696bSmrg#
1799320e696bSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1800320e696bSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1801320e696bSmrg# Preserves the interface, should it be implemented later
1802320e696bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1803320e696bSmrgm4_define([_defopt], m4_default([$2], [auto]))
1804320e696bSmrgAC_ARG_WITH(xsltproc,
1805320e696bSmrg	AS_HELP_STRING([--with-xsltproc],
1806320e696bSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1807320e696bSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1808320e696bSmrgm4_undefine([_defopt])
1809320e696bSmrg
1810320e696bSmrgif test "x$use_xsltproc" = x"auto"; then
1811320e696bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1812320e696bSmrg   if test "x$XSLTPROC" = "x"; then
1813320e696bSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1814320e696bSmrg	have_xsltproc=no
1815320e696bSmrg   else
1816320e696bSmrg        have_xsltproc=yes
1817320e696bSmrg   fi
1818320e696bSmrgelif test "x$use_xsltproc" = x"yes" ; then
1819320e696bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1820320e696bSmrg   if test "x$XSLTPROC" = "x"; then
1821320e696bSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1822320e696bSmrg   fi
1823320e696bSmrg   have_xsltproc=yes
1824320e696bSmrgelif test "x$use_xsltproc" = x"no" ; then
1825320e696bSmrg   if test "x$XSLTPROC" != "x"; then
1826320e696bSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1827320e696bSmrg   fi
1828320e696bSmrg   have_xsltproc=no
1829320e696bSmrgelse
1830320e696bSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1831320e696bSmrgfi
1832320e696bSmrg
1833320e696bSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1834320e696bSmrg]) # XORG_WITH_XSLTPROC
1835320e696bSmrg
1836320e696bSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1837320e696bSmrg# ----------------------------------------
1838320e696bSmrg# Minimum version: 1.15.0
1839320e696bSmrg#
1840320e696bSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1841320e696bSmrg# scanning arbitrary text files, extracting information from those text files,
1842320e696bSmrg# and printing reports based on that information.
1843320e696bSmrg#
1844320e696bSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1845320e696bSmrg#
1846320e696bSmrg# Interface to module:
1847320e696bSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1848320e696bSmrg# PERL:	     returns the path of the perl program found
1849320e696bSmrg#	     returns the path set by the user in the environment
1850320e696bSmrg# --with-perl: 'yes' user instructs the module to use perl
1851320e696bSmrg#	       'no' user instructs the module not to use perl
1852320e696bSmrg# have_perl: returns yes if perl found in PATH or no
1853320e696bSmrg#
1854320e696bSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1855320e696bSmrg#
1856320e696bSmrgAC_DEFUN([XORG_WITH_PERL],[
1857320e696bSmrgAC_ARG_VAR([PERL], [Path to perl command])
1858320e696bSmrg# Preserves the interface, should it be implemented later
1859320e696bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1860320e696bSmrgm4_define([_defopt], m4_default([$2], [auto]))
1861320e696bSmrgAC_ARG_WITH(perl,
1862320e696bSmrg	AS_HELP_STRING([--with-perl],
1863320e696bSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1864320e696bSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1865320e696bSmrgm4_undefine([_defopt])
1866320e696bSmrg
1867320e696bSmrgif test "x$use_perl" = x"auto"; then
1868320e696bSmrg   AC_PATH_PROG([PERL], [perl])
1869320e696bSmrg   if test "x$PERL" = "x"; then
1870320e696bSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1871320e696bSmrg	have_perl=no
1872320e696bSmrg   else
1873320e696bSmrg        have_perl=yes
1874320e696bSmrg   fi
1875320e696bSmrgelif test "x$use_perl" = x"yes" ; then
1876320e696bSmrg   AC_PATH_PROG([PERL], [perl])
1877320e696bSmrg   if test "x$PERL" = "x"; then
1878320e696bSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1879320e696bSmrg   fi
1880320e696bSmrg   have_perl=yes
1881320e696bSmrgelif test "x$use_perl" = x"no" ; then
1882320e696bSmrg   if test "x$PERL" != "x"; then
1883320e696bSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1884320e696bSmrg   fi
1885320e696bSmrg   have_perl=no
1886320e696bSmrgelse
1887320e696bSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1888320e696bSmrgfi
1889320e696bSmrg
1890320e696bSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1891320e696bSmrg]) # XORG_WITH_PERL
1892320e696bSmrg
189329cb5710Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
189429cb5710Smrg# ----------------
189529cb5710Smrg# Minimum version: 1.5.0
189629cb5710Smrg# Minimum version for optional DEFAULT argument: 1.11.0
189729cb5710Smrg#
189829cb5710Smrg# Documentation tools are not always available on all platforms and sometimes
189929cb5710Smrg# not at the appropriate level. This macro enables a module to test for the
190029cb5710Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
190129cb5710Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
190229cb5710Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
190329cb5710Smrg# --with-asciidoc assumes 'auto'.
190429cb5710Smrg#
190529cb5710Smrg# Interface to module:
190629cb5710Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
190729cb5710Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
190829cb5710Smrg#		 returns the path set by the user in the environment
190929cb5710Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
191029cb5710Smrg#		  'no' user instructs the module not to use asciidoc
191129cb5710Smrg#
191229cb5710Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
191329cb5710Smrg#
191429cb5710SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
191529cb5710SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
191629cb5710Smrgm4_define([_defopt], m4_default([$2], [auto]))
191729cb5710SmrgAC_ARG_WITH(asciidoc,
191829cb5710Smrg	AS_HELP_STRING([--with-asciidoc],
191929cb5710Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
192029cb5710Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
192129cb5710Smrgm4_undefine([_defopt])
192229cb5710Smrg
192329cb5710Smrgif test "x$use_asciidoc" = x"auto"; then
192429cb5710Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
192529cb5710Smrg   if test "x$ASCIIDOC" = "x"; then
192629cb5710Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
192729cb5710Smrg	have_asciidoc=no
192829cb5710Smrg   else
192929cb5710Smrg        have_asciidoc=yes
193029cb5710Smrg   fi
193129cb5710Smrgelif test "x$use_asciidoc" = x"yes" ; then
193229cb5710Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
193329cb5710Smrg   if test "x$ASCIIDOC" = "x"; then
193429cb5710Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
193529cb5710Smrg   fi
193629cb5710Smrg   have_asciidoc=yes
193729cb5710Smrgelif test "x$use_asciidoc" = x"no" ; then
193829cb5710Smrg   if test "x$ASCIIDOC" != "x"; then
193929cb5710Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
194029cb5710Smrg   fi
194129cb5710Smrg   have_asciidoc=no
194229cb5710Smrgelse
194329cb5710Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
194429cb5710Smrgfi
194529cb5710Smrgm4_ifval([$1],
194629cb5710Smrg[if test "$have_asciidoc" = yes; then
194729cb5710Smrg    # scrape the asciidoc version
194829cb5710Smrg    AC_MSG_CHECKING([the asciidoc version])
194929cb5710Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
195029cb5710Smrg    AC_MSG_RESULT([$asciidoc_version])
195129cb5710Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
195229cb5710Smrg        [if test "x$use_asciidoc" = xauto; then
195329cb5710Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
195429cb5710Smrg            have_asciidoc=no
195529cb5710Smrg        else
195629cb5710Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
195729cb5710Smrg        fi])
195829cb5710Smrgfi])
195929cb5710SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
196029cb5710Smrg]) # XORG_WITH_ASCIIDOC
196129cb5710Smrg
196229cb5710Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
196329cb5710Smrg# --------------------------------
196429cb5710Smrg# Minimum version: 1.5.0
196529cb5710Smrg# Minimum version for optional DEFAULT argument: 1.11.0
196629cb5710Smrg#
196729cb5710Smrg# Documentation tools are not always available on all platforms and sometimes
196829cb5710Smrg# not at the appropriate level. This macro enables a module to test for the
196929cb5710Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
197029cb5710Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
197129cb5710Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
197229cb5710Smrg# --with-doxygen assumes 'auto'.
197329cb5710Smrg#
197429cb5710Smrg# Interface to module:
197529cb5710Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
197629cb5710Smrg# DOXYGEN:	 returns the path of the doxygen program found
197729cb5710Smrg#		 returns the path set by the user in the environment
197829cb5710Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
197929cb5710Smrg#		  'no' user instructs the module not to use doxygen
198029cb5710Smrg#
198129cb5710Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
198229cb5710Smrg#
198329cb5710SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
198429cb5710SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
198529cb5710Smrgm4_define([_defopt], m4_default([$2], [auto]))
198629cb5710SmrgAC_ARG_WITH(doxygen,
198729cb5710Smrg	AS_HELP_STRING([--with-doxygen],
198829cb5710Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
198929cb5710Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
199029cb5710Smrgm4_undefine([_defopt])
199129cb5710Smrg
199229cb5710Smrgif test "x$use_doxygen" = x"auto"; then
199329cb5710Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
199429cb5710Smrg   if test "x$DOXYGEN" = "x"; then
199529cb5710Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
199629cb5710Smrg	have_doxygen=no
199729cb5710Smrg   else
199829cb5710Smrg        have_doxygen=yes
199929cb5710Smrg   fi
200029cb5710Smrgelif test "x$use_doxygen" = x"yes" ; then
200129cb5710Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
200229cb5710Smrg   if test "x$DOXYGEN" = "x"; then
200329cb5710Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
200429cb5710Smrg   fi
200529cb5710Smrg   have_doxygen=yes
200629cb5710Smrgelif test "x$use_doxygen" = x"no" ; then
200729cb5710Smrg   if test "x$DOXYGEN" != "x"; then
200829cb5710Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
200929cb5710Smrg   fi
201029cb5710Smrg   have_doxygen=no
201129cb5710Smrgelse
201229cb5710Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
201329cb5710Smrgfi
201429cb5710Smrgm4_ifval([$1],
201529cb5710Smrg[if test "$have_doxygen" = yes; then
201629cb5710Smrg    # scrape the doxygen version
201729cb5710Smrg    AC_MSG_CHECKING([the doxygen version])
201829cb5710Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
201929cb5710Smrg    AC_MSG_RESULT([$doxygen_version])
202029cb5710Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
202129cb5710Smrg        [if test "x$use_doxygen" = xauto; then
202229cb5710Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
202329cb5710Smrg            have_doxygen=no
202429cb5710Smrg        else
202529cb5710Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
202629cb5710Smrg        fi])
202729cb5710Smrgfi])
202829cb5710SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
202929cb5710Smrg]) # XORG_WITH_DOXYGEN
203029cb5710Smrg
203129cb5710Smrg# XORG_WITH_GROFF([DEFAULT])
203229cb5710Smrg# ----------------
203329cb5710Smrg# Minimum version: 1.6.0
203429cb5710Smrg# Minimum version for optional DEFAULT argument: 1.11.0
203529cb5710Smrg#
203629cb5710Smrg# Documentation tools are not always available on all platforms and sometimes
203729cb5710Smrg# not at the appropriate level. This macro enables a module to test for the
203829cb5710Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
203929cb5710Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
204029cb5710Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
204129cb5710Smrg# --with-groff assumes 'auto'.
204229cb5710Smrg#
204329cb5710Smrg# Interface to module:
204429cb5710Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
204529cb5710Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
204629cb5710Smrg# HAVE_GROFF_MS: the -ms macros package
204729cb5710Smrg# GROFF:	 returns the path of the groff program found
204829cb5710Smrg#		 returns the path set by the user in the environment
204929cb5710Smrg# --with-groff:	 'yes' user instructs the module to use groff
205029cb5710Smrg#		 'no' user instructs the module not to use groff
205129cb5710Smrg#
205229cb5710Smrg# Added in version 1.9.0:
205329cb5710Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
205429cb5710Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
205529cb5710Smrg#		   psselect from the psutils package.
205629cb5710Smrg#		   the ghostcript package. Refer to the grohtml man pages
205729cb5710Smrg#
205829cb5710Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
205929cb5710Smrg#
206029cb5710Smrg# OS and distros often splits groff in a basic and full package, the former
206129cb5710Smrg# having the groff program and the later having devices, fonts and macros
206229cb5710Smrg# Checking for the groff executable is not enough.
206329cb5710Smrg#
206429cb5710Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
206529cb5710Smrg# unset HAVE_GROFF or GROFF env variables.
206629cb5710Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
206729cb5710Smrg#
206829cb5710SmrgAC_DEFUN([XORG_WITH_GROFF],[
206929cb5710SmrgAC_ARG_VAR([GROFF], [Path to groff command])
207029cb5710Smrgm4_define([_defopt], m4_default([$1], [auto]))
207129cb5710SmrgAC_ARG_WITH(groff,
207229cb5710Smrg	AS_HELP_STRING([--with-groff],
207329cb5710Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
207429cb5710Smrg	   [use_groff=$withval], [use_groff=]_defopt)
207529cb5710Smrgm4_undefine([_defopt])
207629cb5710Smrg
207729cb5710Smrgif test "x$use_groff" = x"auto"; then
207829cb5710Smrg   AC_PATH_PROG([GROFF], [groff])
207929cb5710Smrg   if test "x$GROFF" = "x"; then
208029cb5710Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
208129cb5710Smrg	have_groff=no
208229cb5710Smrg   else
208329cb5710Smrg        have_groff=yes
208429cb5710Smrg   fi
208529cb5710Smrgelif test "x$use_groff" = x"yes" ; then
208629cb5710Smrg   AC_PATH_PROG([GROFF], [groff])
208729cb5710Smrg   if test "x$GROFF" = "x"; then
208829cb5710Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
208929cb5710Smrg   fi
209029cb5710Smrg   have_groff=yes
209129cb5710Smrgelif test "x$use_groff" = x"no" ; then
209229cb5710Smrg   if test "x$GROFF" != "x"; then
209329cb5710Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
209429cb5710Smrg   fi
209529cb5710Smrg   have_groff=no
209629cb5710Smrgelse
209729cb5710Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
209829cb5710Smrgfi
209929cb5710Smrg
210029cb5710Smrg# We have groff, test for the presence of the macro packages
210129cb5710Smrgif test "x$have_groff" = x"yes"; then
210229cb5710Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
210329cb5710Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
210429cb5710Smrg        groff_ms_works=yes
210529cb5710Smrg    else
210629cb5710Smrg        groff_ms_works=no
210729cb5710Smrg    fi
210829cb5710Smrg    AC_MSG_RESULT([$groff_ms_works])
210929cb5710Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
211029cb5710Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
211129cb5710Smrg        groff_mm_works=yes
211229cb5710Smrg    else
211329cb5710Smrg        groff_mm_works=no
211429cb5710Smrg    fi
211529cb5710Smrg    AC_MSG_RESULT([$groff_mm_works])
211629cb5710Smrgfi
211729cb5710Smrg
211829cb5710Smrg# We have groff, test for HTML dependencies, one command per package
211929cb5710Smrgif test "x$have_groff" = x"yes"; then
212029cb5710Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
212129cb5710Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
212229cb5710Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
212329cb5710Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
212429cb5710Smrg      have_groff_html=yes
212529cb5710Smrg   else
212629cb5710Smrg      have_groff_html=no
212729cb5710Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
212829cb5710Smrg   fi
212929cb5710Smrgfi
213029cb5710Smrg
213129cb5710Smrg# Set Automake conditionals for Makefiles
213229cb5710SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
213329cb5710SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
213429cb5710SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
213529cb5710SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
213629cb5710Smrg]) # XORG_WITH_GROFF
213729cb5710Smrg
2138320e696bSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2139320e696bSmrg# ---------------------------------------
214029cb5710Smrg# Minimum version: 1.6.0
214129cb5710Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2142320e696bSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
214329cb5710Smrg#
214429cb5710Smrg# Documentation tools are not always available on all platforms and sometimes
214529cb5710Smrg# not at the appropriate level. This macro enables a module to test for the
214629cb5710Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
214729cb5710Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
214829cb5710Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
214929cb5710Smrg# --with-fop assumes 'auto'.
215029cb5710Smrg#
215129cb5710Smrg# Interface to module:
215229cb5710Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
215329cb5710Smrg# FOP:	 	returns the path of the fop program found
215429cb5710Smrg#		returns the path set by the user in the environment
215529cb5710Smrg# --with-fop: 	'yes' user instructs the module to use fop
215629cb5710Smrg#		'no' user instructs the module not to use fop
215729cb5710Smrg#
215829cb5710Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
215929cb5710Smrg#
216029cb5710SmrgAC_DEFUN([XORG_WITH_FOP],[
216129cb5710SmrgAC_ARG_VAR([FOP], [Path to fop command])
2162320e696bSmrgm4_define([_defopt], m4_default([$2], [auto]))
216329cb5710SmrgAC_ARG_WITH(fop,
216429cb5710Smrg	AS_HELP_STRING([--with-fop],
216529cb5710Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
216629cb5710Smrg	   [use_fop=$withval], [use_fop=]_defopt)
216729cb5710Smrgm4_undefine([_defopt])
216829cb5710Smrg
216929cb5710Smrgif test "x$use_fop" = x"auto"; then
217029cb5710Smrg   AC_PATH_PROG([FOP], [fop])
217129cb5710Smrg   if test "x$FOP" = "x"; then
217229cb5710Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
217329cb5710Smrg	have_fop=no
217429cb5710Smrg   else
217529cb5710Smrg        have_fop=yes
217629cb5710Smrg   fi
217729cb5710Smrgelif test "x$use_fop" = x"yes" ; then
217829cb5710Smrg   AC_PATH_PROG([FOP], [fop])
217929cb5710Smrg   if test "x$FOP" = "x"; then
218029cb5710Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
218129cb5710Smrg   fi
218229cb5710Smrg   have_fop=yes
218329cb5710Smrgelif test "x$use_fop" = x"no" ; then
218429cb5710Smrg   if test "x$FOP" != "x"; then
218529cb5710Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
218629cb5710Smrg   fi
218729cb5710Smrg   have_fop=no
218829cb5710Smrgelse
218929cb5710Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
219029cb5710Smrgfi
2191320e696bSmrg
2192320e696bSmrg# Test for a minimum version of fop, if provided.
2193320e696bSmrgm4_ifval([$1],
2194320e696bSmrg[if test "$have_fop" = yes; then
2195320e696bSmrg    # scrape the fop version
2196320e696bSmrg    AC_MSG_CHECKING([for fop minimum version])
2197320e696bSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2198320e696bSmrg    AC_MSG_RESULT([$fop_version])
2199320e696bSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2200320e696bSmrg        [if test "x$use_fop" = xauto; then
2201320e696bSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2202320e696bSmrg            have_fop=no
2203320e696bSmrg        else
2204320e696bSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2205320e696bSmrg        fi])
2206320e696bSmrgfi])
220729cb5710SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
220829cb5710Smrg]) # XORG_WITH_FOP
220929cb5710Smrg
221029cb5710Smrg# XORG_WITH_PS2PDF([DEFAULT])
221129cb5710Smrg# ----------------
221229cb5710Smrg# Minimum version: 1.6.0
221329cb5710Smrg# Minimum version for optional DEFAULT argument: 1.11.0
221429cb5710Smrg#
221529cb5710Smrg# Documentation tools are not always available on all platforms and sometimes
221629cb5710Smrg# not at the appropriate level. This macro enables a module to test for the
221729cb5710Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
221829cb5710Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
221929cb5710Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
222029cb5710Smrg# --with-ps2pdf assumes 'auto'.
222129cb5710Smrg#
222229cb5710Smrg# Interface to module:
222329cb5710Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
222429cb5710Smrg# PS2PDF:	returns the path of the ps2pdf program found
222529cb5710Smrg#		returns the path set by the user in the environment
222629cb5710Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
222729cb5710Smrg#		 'no' user instructs the module not to use ps2pdf
222829cb5710Smrg#
222929cb5710Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
223029cb5710Smrg#
223129cb5710SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
223229cb5710SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
223329cb5710Smrgm4_define([_defopt], m4_default([$1], [auto]))
223429cb5710SmrgAC_ARG_WITH(ps2pdf,
223529cb5710Smrg	AS_HELP_STRING([--with-ps2pdf],
223629cb5710Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
223729cb5710Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
223829cb5710Smrgm4_undefine([_defopt])
223929cb5710Smrg
224029cb5710Smrgif test "x$use_ps2pdf" = x"auto"; then
224129cb5710Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
224229cb5710Smrg   if test "x$PS2PDF" = "x"; then
224329cb5710Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
224429cb5710Smrg	have_ps2pdf=no
224529cb5710Smrg   else
224629cb5710Smrg        have_ps2pdf=yes
224729cb5710Smrg   fi
224829cb5710Smrgelif test "x$use_ps2pdf" = x"yes" ; then
224929cb5710Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
225029cb5710Smrg   if test "x$PS2PDF" = "x"; then
225129cb5710Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
225229cb5710Smrg   fi
225329cb5710Smrg   have_ps2pdf=yes
225429cb5710Smrgelif test "x$use_ps2pdf" = x"no" ; then
225529cb5710Smrg   if test "x$PS2PDF" != "x"; then
225629cb5710Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
225729cb5710Smrg   fi
225829cb5710Smrg   have_ps2pdf=no
225929cb5710Smrgelse
226029cb5710Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
226129cb5710Smrgfi
226229cb5710SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
226329cb5710Smrg]) # XORG_WITH_PS2PDF
226429cb5710Smrg
226529cb5710Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
226629cb5710Smrg# ----------------
226729cb5710Smrg# Minimum version: 1.6.0
226829cb5710Smrg#
226929cb5710Smrg# Documentation tools are not always available on all platforms and sometimes
227029cb5710Smrg# not at the appropriate level. This macro enables a builder to skip all
227129cb5710Smrg# documentation targets except traditional man pages.
227229cb5710Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
227329cb5710Smrg# maximum flexibilty in controlling documentation building.
227429cb5710Smrg# Refer to:
227529cb5710Smrg# XORG_WITH_XMLTO         --with-xmlto
227629cb5710Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
227729cb5710Smrg# XORG_WITH_DOXYGEN       --with-doxygen
227829cb5710Smrg# XORG_WITH_FOP           --with-fop
227929cb5710Smrg# XORG_WITH_GROFF         --with-groff
228029cb5710Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
228129cb5710Smrg#
228229cb5710Smrg# Interface to module:
228329cb5710Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
228429cb5710Smrg# --enable-docs: 'yes' user instructs the module to generate docs
228529cb5710Smrg#		 'no' user instructs the module not to generate docs
228629cb5710Smrg# parm1:	specify the default value, yes or no.
228729cb5710Smrg#
228829cb5710SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2289320e696bSmrgm4_define([docs_default], m4_default([$1], [yes]))
229029cb5710SmrgAC_ARG_ENABLE(docs,
229129cb5710Smrg	AS_HELP_STRING([--enable-docs],
2292320e696bSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2293320e696bSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2294320e696bSmrgm4_undefine([docs_default])
229529cb5710SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
229629cb5710SmrgAC_MSG_CHECKING([whether to build documentation])
229729cb5710SmrgAC_MSG_RESULT([$build_docs])
229829cb5710Smrg]) # XORG_ENABLE_DOCS
229929cb5710Smrg
230029cb5710Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
230129cb5710Smrg# ----------------
230229cb5710Smrg# Minimum version: 1.6.0
230329cb5710Smrg#
230429cb5710Smrg# This macro enables a builder to skip all developer documentation.
230529cb5710Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
230629cb5710Smrg# maximum flexibilty in controlling documentation building.
230729cb5710Smrg# Refer to:
230829cb5710Smrg# XORG_WITH_XMLTO         --with-xmlto
230929cb5710Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
231029cb5710Smrg# XORG_WITH_DOXYGEN       --with-doxygen
231129cb5710Smrg# XORG_WITH_FOP           --with-fop
231229cb5710Smrg# XORG_WITH_GROFF         --with-groff
231329cb5710Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
231429cb5710Smrg#
231529cb5710Smrg# Interface to module:
231629cb5710Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
231729cb5710Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
231829cb5710Smrg#			'no' user instructs the module not to generate developer docs
231929cb5710Smrg# parm1:		specify the default value, yes or no.
232029cb5710Smrg#
232129cb5710SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
232229cb5710Smrgm4_define([devel_default], m4_default([$1], [yes]))
232329cb5710SmrgAC_ARG_ENABLE(devel-docs,
232429cb5710Smrg	AS_HELP_STRING([--enable-devel-docs],
232529cb5710Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
232629cb5710Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
232729cb5710Smrgm4_undefine([devel_default])
232829cb5710SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
232929cb5710SmrgAC_MSG_CHECKING([whether to build developer documentation])
233029cb5710SmrgAC_MSG_RESULT([$build_devel_docs])
233129cb5710Smrg]) # XORG_ENABLE_DEVEL_DOCS
233229cb5710Smrg
233329cb5710Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
233429cb5710Smrg# ----------------
233529cb5710Smrg# Minimum version: 1.6.0
233629cb5710Smrg#
233729cb5710Smrg# This macro enables a builder to skip all functional specification targets.
233829cb5710Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
233929cb5710Smrg# maximum flexibilty in controlling documentation building.
234029cb5710Smrg# Refer to:
234129cb5710Smrg# XORG_WITH_XMLTO         --with-xmlto
234229cb5710Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
234329cb5710Smrg# XORG_WITH_DOXYGEN       --with-doxygen
234429cb5710Smrg# XORG_WITH_FOP           --with-fop
234529cb5710Smrg# XORG_WITH_GROFF         --with-groff
234629cb5710Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
234729cb5710Smrg#
234829cb5710Smrg# Interface to module:
234929cb5710Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
235029cb5710Smrg# --enable-specs:	'yes' user instructs the module to generate specs
235129cb5710Smrg#			'no' user instructs the module not to generate specs
235229cb5710Smrg# parm1:		specify the default value, yes or no.
235329cb5710Smrg#
235429cb5710SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
235529cb5710Smrgm4_define([spec_default], m4_default([$1], [yes]))
235629cb5710SmrgAC_ARG_ENABLE(specs,
235729cb5710Smrg	AS_HELP_STRING([--enable-specs],
235829cb5710Smrg	   [Enable building the specs (default: ]spec_default[)]),
235929cb5710Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
236029cb5710Smrgm4_undefine([spec_default])
236129cb5710SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
236229cb5710SmrgAC_MSG_CHECKING([whether to build functional specifications])
236329cb5710SmrgAC_MSG_RESULT([$build_specs])
236429cb5710Smrg]) # XORG_ENABLE_SPECS
236529cb5710Smrg
2366320e696bSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2367320e696bSmrg# ----------------------------------------------
2368320e696bSmrg# Minimum version: 1.13.0
2369320e696bSmrg#
2370320e696bSmrg# This macro enables a builder to enable/disable unit testing
2371320e696bSmrg# It makes no assumption about the test cases implementation
2372320e696bSmrg# Test cases may or may not use Automake "Support for test suites"
2373320e696bSmrg# They may or may not use the software utility library GLib
2374320e696bSmrg#
2375320e696bSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2376320e696bSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2377320e696bSmrg# The variable enable_unit_tests is used by other macros in this file.
2378320e696bSmrg#
2379320e696bSmrg# Interface to module:
2380320e696bSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2381320e696bSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2382320e696bSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2383320e696bSmrg#			'no' user instructs the module not to build tests
2384320e696bSmrg# parm1:		specify the default value, yes or no.
2385320e696bSmrg#
2386320e696bSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2387320e696bSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2388320e696bSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2389320e696bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2390320e696bSmrgm4_define([_defopt], m4_default([$1], [auto]))
2391320e696bSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2392320e696bSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2393320e696bSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2394320e696bSmrgm4_undefine([_defopt])
2395320e696bSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2396320e696bSmrgAC_MSG_CHECKING([whether to build unit test cases])
2397320e696bSmrgAC_MSG_RESULT([$enable_unit_tests])
2398320e696bSmrg]) # XORG_ENABLE_UNIT_TESTS
2399320e696bSmrg
240074a3f230Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
240174a3f230Smrg# ------------------------------------------------------
240274a3f230Smrg# Minimum version: 1.17.0
240374a3f230Smrg#
240474a3f230Smrg# This macro enables a builder to enable/disable integration testing
240574a3f230Smrg# It makes no assumption about the test cases' implementation
240674a3f230Smrg# Test cases may or may not use Automake "Support for test suites"
240774a3f230Smrg#
240874a3f230Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
240974a3f230Smrg# usually requires less dependencies and may be built and run under less
241074a3f230Smrg# stringent environments than integration tests.
241174a3f230Smrg#
241274a3f230Smrg# Interface to module:
241374a3f230Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
241474a3f230Smrg# enable_integration_tests:   used in configure.ac for additional configuration
241574a3f230Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
241674a3f230Smrg#                             'no' user instructs the module not to build tests
241774a3f230Smrg# parm1:                      specify the default value, yes or no.
241874a3f230Smrg#
241974a3f230SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
242074a3f230SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
242174a3f230Smrgm4_define([_defopt], m4_default([$1], [auto]))
242274a3f230SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
242374a3f230Smrg	[Enable building integration test cases (default: ]_defopt[)]),
242474a3f230Smrg	[enable_integration_tests=$enableval],
242574a3f230Smrg	[enable_integration_tests=]_defopt)
242674a3f230Smrgm4_undefine([_defopt])
242774a3f230SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
242874a3f230Smrg	[test "x$enable_integration_tests" != xno])
242974a3f230SmrgAC_MSG_CHECKING([whether to build unit test cases])
243074a3f230SmrgAC_MSG_RESULT([$enable_integration_tests])
243174a3f230Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
243274a3f230Smrg
2433320e696bSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2434320e696bSmrg# ----------------------------------------
2435320e696bSmrg# Minimum version: 1.13.0
2436320e696bSmrg#
2437320e696bSmrg# GLib is a library which provides advanced data structures and functions.
2438320e696bSmrg# This macro enables a module to test for the presence of Glib.
2439320e696bSmrg#
2440320e696bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2441320e696bSmrg# Otherwise the value of $enable_unit_tests is blank.
2442320e696bSmrg#
244374a3f230Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
244474a3f230Smrg# test support usually requires less dependencies and may be built and run under
244574a3f230Smrg# less stringent environments than integration tests.
244674a3f230Smrg#
2447320e696bSmrg# Interface to module:
2448320e696bSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2449320e696bSmrg# with_glib: used in configure.ac to know if GLib has been found
2450320e696bSmrg# --with-glib:	'yes' user instructs the module to use glib
2451320e696bSmrg#		'no' user instructs the module not to use glib
2452320e696bSmrg#
2453320e696bSmrgAC_DEFUN([XORG_WITH_GLIB],[
2454320e696bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2455320e696bSmrgm4_define([_defopt], m4_default([$2], [auto]))
2456320e696bSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2457320e696bSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2458320e696bSmrg	[with_glib=$withval], [with_glib=]_defopt)
2459320e696bSmrgm4_undefine([_defopt])
2460320e696bSmrg
2461320e696bSmrghave_glib=no
2462320e696bSmrg# Do not probe GLib if user explicitly disabled unit testing
2463320e696bSmrgif test "x$enable_unit_tests" != x"no"; then
2464320e696bSmrg  # Do not probe GLib if user explicitly disabled it
2465320e696bSmrg  if test "x$with_glib" != x"no"; then
2466320e696bSmrg    m4_ifval(
2467320e696bSmrg      [$1],
2468320e696bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2469320e696bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2470320e696bSmrg    )
2471320e696bSmrg  fi
2472320e696bSmrgfi
2473320e696bSmrg
2474320e696bSmrg# Not having GLib when unit testing has been explicitly requested is an error
2475320e696bSmrgif test "x$enable_unit_tests" = x"yes"; then
2476320e696bSmrg  if test "x$have_glib" = x"no"; then
2477320e696bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2478320e696bSmrg  fi
2479320e696bSmrgfi
2480320e696bSmrg
2481320e696bSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2482320e696bSmrgif test "x$enable_unit_tests" = x"no"; then
2483320e696bSmrg  if test "x$with_glib" = x"yes"; then
2484320e696bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2485320e696bSmrg  fi
2486320e696bSmrgfi
2487320e696bSmrg
2488320e696bSmrg# Not having GLib when it has been explicitly requested is an error
2489320e696bSmrgif test "x$with_glib" = x"yes"; then
2490320e696bSmrg  if test "x$have_glib" = x"no"; then
2491320e696bSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2492320e696bSmrg  fi
2493320e696bSmrgfi
2494320e696bSmrg
2495320e696bSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2496320e696bSmrg]) # XORG_WITH_GLIB
2497320e696bSmrg
2498320e696bSmrg# XORG_LD_WRAP([required|optional])
2499320e696bSmrg# ---------------------------------
2500320e696bSmrg# Minimum version: 1.13.0
2501320e696bSmrg#
2502320e696bSmrg# Check if linker supports -wrap, passed via compiler flags
2503320e696bSmrg#
2504320e696bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2505320e696bSmrg# Otherwise the value of $enable_unit_tests is blank.
2506320e696bSmrg#
2507320e696bSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2508320e696bSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2509320e696bSmrg# available, an argument of "optional" allows use when some unit tests require
2510320e696bSmrg# ld -wrap and others do not.
2511320e696bSmrg#
2512320e696bSmrgAC_DEFUN([XORG_LD_WRAP],[
2513320e696bSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2514320e696bSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2515320e696bSmrg                      void __wrap_exit(int status) { return; }],
2516320e696bSmrg                     [exit(0);])])
2517320e696bSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2518320e696bSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2519320e696bSmrg  if test "x$have_ld_wrap" = x"no"; then
2520320e696bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2521320e696bSmrg  fi
2522320e696bSmrgfi
2523320e696bSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2524320e696bSmrg#
2525320e696bSmrg]) # XORG_LD_WRAP
2526320e696bSmrg
2527320e696bSmrg# XORG_CHECK_LINKER_FLAGS
2528320e696bSmrg# -----------------------
2529320e696bSmrg# SYNOPSIS
2530320e696bSmrg#
2531320e696bSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2532320e696bSmrg#
2533320e696bSmrg# DESCRIPTION
2534320e696bSmrg#
2535320e696bSmrg#   Check whether the given linker FLAGS work with the current language's
2536320e696bSmrg#   linker, or whether they give an error.
2537320e696bSmrg#
2538320e696bSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2539320e696bSmrg#   success/failure.
2540320e696bSmrg#
2541320e696bSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2542320e696bSmrg#
2543320e696bSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2544320e696bSmrg#
2545320e696bSmrg# LICENSE
2546320e696bSmrg#
2547320e696bSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2548320e696bSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2549320e696bSmrg#   Copyright (c) 2009 Matteo Frigo
2550320e696bSmrg#
2551320e696bSmrg#   This program is free software: you can redistribute it and/or modify it
2552320e696bSmrg#   under the terms of the GNU General Public License as published by the
2553320e696bSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2554320e696bSmrg#   option) any later version.
2555320e696bSmrg#
2556320e696bSmrg#   This program is distributed in the hope that it will be useful, but
2557320e696bSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2558320e696bSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2559320e696bSmrg#   Public License for more details.
2560320e696bSmrg#
2561320e696bSmrg#   You should have received a copy of the GNU General Public License along
2562320e696bSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2563320e696bSmrg#
2564320e696bSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2565320e696bSmrg#   gives unlimited permission to copy, distribute and modify the configure
2566320e696bSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2567320e696bSmrg#   need not follow the terms of the GNU General Public License when using
2568320e696bSmrg#   or distributing such scripts, even though portions of the text of the
2569320e696bSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2570320e696bSmrg#   all other use of the material that constitutes the Autoconf Macro.
2571320e696bSmrg#
2572320e696bSmrg#   This special exception to the GPL applies to versions of the Autoconf
2573320e696bSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2574320e696bSmrg#   modified version of the Autoconf Macro, you may extend this special
2575320e696bSmrg#   exception to the GPL to apply to your modified version as well.#
2576320e696bSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2577320e696bSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2578320e696bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2579320e696bSmrgAS_LITERAL_IF([$1],
2580320e696bSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2581320e696bSmrg      ax_save_FLAGS=$LDFLAGS
2582320e696bSmrg      LDFLAGS="$1"
2583320e696bSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2584320e696bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2585320e696bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2586320e696bSmrg      LDFLAGS=$ax_save_FLAGS])],
2587320e696bSmrg  [ax_save_FLAGS=$LDFLAGS
2588320e696bSmrg   LDFLAGS="$1"
2589320e696bSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2590320e696bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2591320e696bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2592320e696bSmrg   LDFLAGS=$ax_save_FLAGS])
2593320e696bSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2594320e696bSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2595320e696bSmrgif test "x$xorg_check_linker_flags" = xyes; then
2596320e696bSmrg	m4_default([$2], :)
2597320e696bSmrgelse
2598320e696bSmrg	m4_default([$3], :)
2599320e696bSmrgfi
2600320e696bSmrg]) # XORG_CHECK_LINKER_FLAGS
2601320e696bSmrg
2602320e696bSmrg# XORG_MEMORY_CHECK_FLAGS
2603320e696bSmrg# -----------------------
2604320e696bSmrg# Minimum version: 1.16.0
2605320e696bSmrg#
2606320e696bSmrg# This macro attempts to find appropriate memory checking functionality
2607320e696bSmrg# for various platforms which unit testing code may use to catch various
2608320e696bSmrg# forms of memory allocation and access errors in testing.
2609320e696bSmrg#
2610320e696bSmrg# Interface to module:
2611320e696bSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2612320e696bSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2613320e696bSmrg#
2614320e696bSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2615320e696bSmrg#
2616320e696bSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2617320e696bSmrg
2618320e696bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2619320e696bSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2620320e696bSmrg           [Environment variables to enable memory checking in tests])
2621320e696bSmrg
2622320e696bSmrg# Check for different types of support on different platforms
2623320e696bSmrgcase $host_os in
2624320e696bSmrg    solaris*)
2625320e696bSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2626320e696bSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2627320e696bSmrg        ;;
2628320e696bSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2629320e696bSmrg        # both directly and inverted, so should not be 0 or 255.
2630320e696bSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2631320e696bSmrg        ;;
2632320e696bSmrg    darwin*)
2633320e696bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2634320e696bSmrg        ;;
2635320e696bSmrg    *bsd*)
2636320e696bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2637320e696bSmrg        ;;
2638320e696bSmrgesac
2639320e696bSmrg
2640320e696bSmrg# User supplied flags override default flags
2641320e696bSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2642320e696bSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2643320e696bSmrgfi
2644320e696bSmrg
2645320e696bSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2646320e696bSmrg]) # XORG_WITH_LINT
2647320e696bSmrg
26485e358ecaSmrg# XORG_CHECK_MALLOC_ZERO
26495e358ecaSmrg# ----------------------
26505e358ecaSmrg# Minimum version: 1.0.0
2651afe13c8eSmrg#
26525e358ecaSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
26535e358ecaSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
26545e358ecaSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
26555e358ecaSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
26565e358ecaSmrgAC_ARG_ENABLE(malloc0returnsnull,
26575e358ecaSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
26585e358ecaSmrg		       [malloc(0) returns NULL (default: auto)]),
26595e358ecaSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
26605e358ecaSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2661afe13c8eSmrg
26625e358ecaSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
26635e358ecaSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2664320e696bSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2665320e696bSmrg#include <stdlib.h>
2666320e696bSmrg],[
26675e358ecaSmrg    char *m0, *r0, *c0, *p;
26685e358ecaSmrg    m0 = malloc(0);
26695e358ecaSmrg    p = malloc(10);
26705e358ecaSmrg    r0 = realloc(p,0);
2671320e696bSmrg    c0 = calloc(0,10);
2672320e696bSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2673320e696bSmrg])],
26745e358ecaSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
267529cb5710Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
267629cb5710Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2677b3307321Smrgfi
26785e358ecaSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
26795e358ecaSmrg
26805e358ecaSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
26815e358ecaSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
26825e358ecaSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
26835e358ecaSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
26845e358ecaSmrgelse
26855e358ecaSmrg	MALLOC_ZERO_CFLAGS=""
26865e358ecaSmrg	XMALLOC_ZERO_CFLAGS=""
26875e358ecaSmrg	XTMALLOC_ZERO_CFLAGS=""
2688b3307321Smrgfi
2689b3307321Smrg
26905e358ecaSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
26915e358ecaSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
26925e358ecaSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
26935e358ecaSmrg]) # XORG_CHECK_MALLOC_ZERO
26945e358ecaSmrg
26955e358ecaSmrg# XORG_WITH_LINT()
26965e358ecaSmrg# ----------------
26975e358ecaSmrg# Minimum version: 1.1.0
26985e358ecaSmrg#
269929cb5710Smrg# This macro enables the use of a tool that flags some suspicious and
270029cb5710Smrg# non-portable constructs (likely to be bugs) in C language source code.
270129cb5710Smrg# It will attempt to locate the tool and use appropriate options.
270229cb5710Smrg# There are various lint type tools on different platforms.
270329cb5710Smrg#
270429cb5710Smrg# Interface to module:
270529cb5710Smrg# LINT:		returns the path to the tool found on the platform
270629cb5710Smrg#		or the value set to LINT on the configure cmd line
270729cb5710Smrg#		also an Automake conditional
270829cb5710Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
270929cb5710Smrg#
271029cb5710Smrg# --with-lint:	'yes' user instructs the module to use lint
271129cb5710Smrg#		'no' user instructs the module not to use lint (default)
271229cb5710Smrg#
271329cb5710Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
271429cb5710Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2715afe13c8eSmrg#
27165e358ecaSmrgAC_DEFUN([XORG_WITH_LINT],[
2717b3307321Smrg
271829cb5710SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
271929cb5710SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
27205e358ecaSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27215e358ecaSmrg		[Use a lint-style source code checker (default: disabled)])],
27225e358ecaSmrg		[use_lint=$withval], [use_lint=no])
272329cb5710Smrg
272429cb5710Smrg# Obtain platform specific info like program name and options
272529cb5710Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
272629cb5710Smrgcase $host_os in
272729cb5710Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
272829cb5710Smrg	lint_name=splint
272929cb5710Smrg	lint_options="-badflag"
273029cb5710Smrg	;;
273129cb5710Smrg  *freebsd* | *netbsd*)
273229cb5710Smrg	lint_name=lint
273329cb5710Smrg	lint_options="-u -b"
273429cb5710Smrg	;;
273529cb5710Smrg  *solaris*)
273629cb5710Smrg	lint_name=lint
273729cb5710Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
273829cb5710Smrg	;;
273929cb5710Smrgesac
274029cb5710Smrg
274129cb5710Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
274229cb5710Smrgif test "x$use_lint" = x"yes" ; then
274329cb5710Smrg   AC_PATH_PROG([LINT], [$lint_name])
274429cb5710Smrg   if test "x$LINT" = "x"; then
274529cb5710Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
274629cb5710Smrg   fi
274729cb5710Smrgelif test "x$use_lint" = x"no" ; then
274829cb5710Smrg   if test "x$LINT" != "x"; then
274929cb5710Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
275029cb5710Smrg   fi
27515e358ecaSmrgelse
275229cb5710Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
27535e358ecaSmrgfi
275429cb5710Smrg
275529cb5710Smrg# User supplied flags override default flags
275629cb5710Smrgif test "x$LINT_FLAGS" != "x"; then
275729cb5710Smrg   lint_options=$LINT_FLAGS
2758afe13c8eSmrgfi
2759b3307321Smrg
276029cb5710SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
276129cb5710SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2762b3307321Smrg
27635e358ecaSmrg]) # XORG_WITH_LINT
2764b3307321Smrg
27655e358ecaSmrg# XORG_LINT_LIBRARY(LIBNAME)
27665e358ecaSmrg# --------------------------
27675e358ecaSmrg# Minimum version: 1.1.0
27685e358ecaSmrg#
27695e358ecaSmrg# Sets up flags for building lint libraries for checking programs that call
27705e358ecaSmrg# functions in the library.
27715e358ecaSmrg#
277229cb5710Smrg# Interface to module:
277329cb5710Smrg# LINTLIB		- Automake variable with the name of lint library file to make
277429cb5710Smrg# MAKE_LINT_LIB		- Automake conditional
277529cb5710Smrg#
277629cb5710Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
277729cb5710Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2778b3307321Smrg
27795e358ecaSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
27805e358ecaSmrgAC_REQUIRE([XORG_WITH_LINT])
27815e358ecaSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
27825e358ecaSmrg	[Create lint library (default: disabled)])],
27835e358ecaSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
278429cb5710Smrg
278529cb5710Smrgif test "x$make_lint_lib" = x"yes" ; then
278629cb5710Smrg   LINTLIB=llib-l$1.ln
278729cb5710Smrg   if test "x$LINT" = "x"; then
278829cb5710Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
278929cb5710Smrg   fi
279029cb5710Smrgelif test "x$make_lint_lib" != x"no" ; then
279129cb5710Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
27925e358ecaSmrgfi
279329cb5710Smrg
27945e358ecaSmrgAC_SUBST(LINTLIB)
27955e358ecaSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2796afe13c8eSmrg
27975e358ecaSmrg]) # XORG_LINT_LIBRARY
2798b3307321Smrg
2799320e696bSmrg# XORG_COMPILER_BRAND
2800320e696bSmrg# -------------------
2801320e696bSmrg# Minimum version: 1.14.0
2802320e696bSmrg#
2803320e696bSmrg# Checks for various brands of compilers and sets flags as appropriate:
2804320e696bSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
280574a3f230Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2806320e696bSmrg#   clang compiler - sets CLANGCC to "yes"
2807320e696bSmrg#   Intel compiler - sets INTELCC to "yes"
2808320e696bSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2809320e696bSmrg#
2810320e696bSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
281174a3f230SmrgAC_LANG_CASE(
281274a3f230Smrg	[C], [
281374a3f230Smrg		AC_REQUIRE([AC_PROG_CC_C99])
281474a3f230Smrg	],
281574a3f230Smrg	[C++], [
281674a3f230Smrg		AC_REQUIRE([AC_PROG_CXX])
281774a3f230Smrg	]
281874a3f230Smrg)
2819320e696bSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2820320e696bSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2821320e696bSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2822320e696bSmrg]) # XORG_COMPILER_BRAND
2823320e696bSmrg
2824320e696bSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2825320e696bSmrg# ---------------
2826320e696bSmrg# Minimum version: 1.16.0
2827320e696bSmrg#
2828320e696bSmrg# Test if the compiler works when passed the given flag as a command line argument.
2829320e696bSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2830320e696bSmrg# next flag in the list until there are no more options.
2831320e696bSmrg#
2832320e696bSmrg# Note that this does not guarantee that the compiler supports the flag as some
2833320e696bSmrg# compilers will simply ignore arguments that they do not understand, but we do
2834320e696bSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2835320e696bSmrg# -Werror=unused-command-line-argument
2836320e696bSmrg#
2837320e696bSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2838320e696bSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2839320e696bSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2840320e696bSmrg
284174a3f230SmrgAC_LANG_COMPILER_REQUIRE
284274a3f230Smrg
284374a3f230SmrgAC_LANG_CASE(
284474a3f230Smrg	[C], [
284574a3f230Smrg		AC_REQUIRE([AC_PROG_CC_C99])
284674a3f230Smrg		define([PREFIX], [C])
284774a3f230Smrg		define([CACHE_PREFIX], [cc])
284874a3f230Smrg		define([COMPILER], [$CC])
284974a3f230Smrg	],
285074a3f230Smrg	[C++], [
285174a3f230Smrg		define([PREFIX], [CXX])
285274a3f230Smrg		define([CACHE_PREFIX], [cxx])
285374a3f230Smrg		define([COMPILER], [$CXX])
285474a3f230Smrg	]
285574a3f230Smrg)
285674a3f230Smrg
285774a3f230Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2858320e696bSmrg
285974a3f230Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
286074a3f230Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
286174a3f230Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
286274a3f230Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2863320e696bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
286474a3f230Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
286574a3f230Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
286674a3f230Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
286774a3f230Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2868320e696bSmrgfi
2869320e696bSmrg
287074a3f230Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
287174a3f230Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
287274a3f230Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2873320e696bSmrg	fi
287474a3f230Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
287574a3f230Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
287674a3f230Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2877320e696bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
287874a3f230Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
287974a3f230Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
288074a3f230Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
288174a3f230Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2882320e696bSmrgfi
2883320e696bSmrg
2884320e696bSmrgfound="no"
2885320e696bSmrgm4_foreach([flag], m4_cdr($@), [
2886320e696bSmrg	if test $found = "no" ; then
2887320e696bSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
288874a3f230Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2889320e696bSmrg		fi
2890320e696bSmrg
2891320e696bSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
289274a3f230Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2893320e696bSmrg		fi
2894320e696bSmrg
289574a3f230Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2896320e696bSmrg
2897320e696bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
289874a3f230Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
289974a3f230Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
290074a3f230Smrg		AC_CACHE_VAL($cacheid,
2901320e696bSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
290274a3f230Smrg					     [eval $cacheid=yes],
290374a3f230Smrg					     [eval $cacheid=no])])
2904320e696bSmrg
290574a3f230Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2906320e696bSmrg
290774a3f230Smrg		eval supported=\$$cacheid
2908320e696bSmrg		AC_MSG_RESULT([$supported])
2909320e696bSmrg		if test "$supported" = "yes" ; then
2910320e696bSmrg			$1="$$1 ]flag["
2911320e696bSmrg			found="yes"
2912320e696bSmrg		fi
2913320e696bSmrg	fi
2914320e696bSmrg])
2915320e696bSmrg]) # XORG_TESTSET_CFLAG
2916320e696bSmrg
2917320e696bSmrg# XORG_COMPILER_FLAGS
2918320e696bSmrg# ---------------
2919320e696bSmrg# Minimum version: 1.16.0
2920320e696bSmrg#
292174a3f230Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
292274a3f230Smrg# arguments supported by the selected compiler which do NOT alter the generated
292374a3f230Smrg# code.  These arguments will cause the compiler to print various warnings
292474a3f230Smrg# during compilation AND turn a conservative set of warnings into errors.
2925320e696bSmrg#
292674a3f230Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
292774a3f230Smrg# future versions of util-macros as options are added to new compilers.
2928320e696bSmrg#
2929320e696bSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2930320e696bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2931320e696bSmrg
2932320e696bSmrgAC_ARG_ENABLE(selective-werror,
2933320e696bSmrg              AS_HELP_STRING([--disable-selective-werror],
2934320e696bSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2935320e696bSmrg              [SELECTIVE_WERROR=$enableval],
2936320e696bSmrg              [SELECTIVE_WERROR=yes])
2937320e696bSmrg
293874a3f230SmrgAC_LANG_CASE(
293974a3f230Smrg        [C], [
294074a3f230Smrg                define([PREFIX], [C])
294174a3f230Smrg        ],
294274a3f230Smrg        [C++], [
294374a3f230Smrg                define([PREFIX], [CXX])
294474a3f230Smrg        ]
294574a3f230Smrg)
2946320e696bSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2947320e696bSmrgif test "x$SUNCC" = "xyes"; then
294874a3f230Smrg    [BASE_]PREFIX[FLAGS]="-v"
2949320e696bSmrgelse
295074a3f230Smrg    [BASE_]PREFIX[FLAGS]=""
2951320e696bSmrgfi
2952320e696bSmrg
2953320e696bSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
295474a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
295574a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
295674a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
295774a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
295874a3f230Smrg
295974a3f230SmrgAC_LANG_CASE(
296074a3f230Smrg	[C], [
296174a3f230Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
296274a3f230Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
296374a3f230Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
296474a3f230Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
296574a3f230Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
296674a3f230Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
296774a3f230Smrg	]
296874a3f230Smrg)
2969320e696bSmrg
2970320e696bSmrg# This chunk adds additional warnings that could catch undesired effects.
297174a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
297274a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
297374a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
297474a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
297574a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
297674a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
297774a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2978320e696bSmrg
2979320e696bSmrg# These are currently disabled because they are noisy.  They will be enabled
2980320e696bSmrg# in the future once the codebase is sufficiently modernized to silence
2981320e696bSmrg# them.  For now, I don't want them to drown out the other warnings.
298274a3f230Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
298374a3f230Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
298474a3f230Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2985320e696bSmrg
2986320e696bSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2987320e696bSmrg# when there are problems that should be fixed.
2988320e696bSmrg
2989320e696bSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
299074a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
299174a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
299274a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
299374a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
299474a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
299574a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
299674a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
299774a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
299874a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
299974a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
300074a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
300174a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
300274a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3003320e696bSmrgelse
3004320e696bSmrgAC_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])
300574a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
300674a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
300774a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
300874a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
300974a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
301074a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
301174a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
301274a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
301374a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
301474a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
301574a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
301674a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
301774a3f230SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
301874a3f230Smrgfi
301974a3f230Smrg
302074a3f230SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3021320e696bSmrg]) # XORG_COMPILER_FLAGS
3022320e696bSmrg
30235e358ecaSmrg# XORG_CWARNFLAGS
30245e358ecaSmrg# ---------------
30255e358ecaSmrg# Minimum version: 1.2.0
3026320e696bSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
30275e358ecaSmrg#
30285e358ecaSmrg# Defines CWARNFLAGS to enable C compiler warnings.
30295e358ecaSmrg#
3030320e696bSmrg# This function is deprecated because it defines -fno-strict-aliasing
3031320e696bSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3032320e696bSmrg# is needed, then it should be added explicitly in the module when
3033320e696bSmrg# it is updated to use BASE_CFLAGS.
3034320e696bSmrg#
30355e358ecaSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3036320e696bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3037320e696bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
303874a3f230SmrgAC_LANG_CASE(
303974a3f230Smrg	[C], [
304074a3f230Smrg		CWARNFLAGS="$BASE_CFLAGS"
304174a3f230Smrg		if  test "x$GCC" = xyes ; then
304274a3f230Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
304374a3f230Smrg		fi
304474a3f230Smrg		AC_SUBST(CWARNFLAGS)
304574a3f230Smrg	]
304674a3f230Smrg)
30475e358ecaSmrg]) # XORG_CWARNFLAGS
3048b3307321Smrg
30495e358ecaSmrg# XORG_STRICT_OPTION
30505e358ecaSmrg# -----------------------
30515e358ecaSmrg# Minimum version: 1.3.0
3052afe13c8eSmrg#
3053320e696bSmrg# Add configure option to enable strict compilation flags, such as treating
3054320e696bSmrg# warnings as fatal errors.
3055320e696bSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
305674a3f230Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3057320e696bSmrg#
3058320e696bSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3059320e696bSmrg# when strict compilation is unconditionally desired.
30605e358ecaSmrgAC_DEFUN([XORG_STRICT_OPTION], [
30615e358ecaSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3062320e696bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30635e358ecaSmrg
30645e358ecaSmrgAC_ARG_ENABLE(strict-compilation,
30655e358ecaSmrg			  AS_HELP_STRING([--enable-strict-compilation],
30665e358ecaSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
30675e358ecaSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3068320e696bSmrg
306974a3f230SmrgAC_LANG_CASE(
307074a3f230Smrg        [C], [
307174a3f230Smrg                define([PREFIX], [C])
307274a3f230Smrg        ],
307374a3f230Smrg        [C++], [
307474a3f230Smrg                define([PREFIX], [CXX])
307574a3f230Smrg        ]
307674a3f230Smrg)
307774a3f230Smrg
307874a3f230Smrg[STRICT_]PREFIX[FLAGS]=""
307974a3f230SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
308074a3f230SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3081320e696bSmrg
3082320e696bSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3083320e696bSmrg# activate it with -Werror, so we add it here explicitly.
308474a3f230SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3085320e696bSmrg
30865e358ecaSmrgif test "x$STRICT_COMPILE" = "xyes"; then
308774a3f230Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
308874a3f230Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
30895e358ecaSmrgfi
309074a3f230SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
309174a3f230SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
309274a3f230SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
30935e358ecaSmrg]) # XORG_STRICT_OPTION
3094b3307321Smrg
30955e358ecaSmrg# XORG_DEFAULT_OPTIONS
30965e358ecaSmrg# --------------------
30975e358ecaSmrg# Minimum version: 1.3.0
3098afe13c8eSmrg#
30995e358ecaSmrg# Defines default options for X.Org modules.
31005e358ecaSmrg#
31015e358ecaSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
310229cb5710SmrgAC_REQUIRE([AC_PROG_INSTALL])
3103320e696bSmrgXORG_COMPILER_FLAGS
31045e358ecaSmrgXORG_CWARNFLAGS
31055e358ecaSmrgXORG_STRICT_OPTION
31065e358ecaSmrgXORG_RELEASE_VERSION
31075e358ecaSmrgXORG_CHANGELOG
310829cb5710SmrgXORG_INSTALL
31095e358ecaSmrgXORG_MANPAGE_SECTIONS
311029cb5710Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
311129cb5710Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
31125e358ecaSmrg]) # XORG_DEFAULT_OPTIONS
311329cb5710Smrg
311429cb5710Smrg# XORG_INSTALL()
311529cb5710Smrg# ----------------
311629cb5710Smrg# Minimum version: 1.4.0
311729cb5710Smrg#
311829cb5710Smrg# Defines the variable INSTALL_CMD as the command to copy
311929cb5710Smrg# INSTALL from $prefix/share/util-macros.
312029cb5710Smrg#
312129cb5710SmrgAC_DEFUN([XORG_INSTALL], [
312229cb5710SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
312329cb5710Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
312429cb5710SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
312529cb5710Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
312629cb5710Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
312729cb5710Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
312829cb5710SmrgAC_SUBST([INSTALL_CMD])
312929cb5710Smrg]) # XORG_INSTALL
31305e358ecaSmrgdnl Copyright 2005 Red Hat, Inc
31315e358ecaSmrgdnl
31325e358ecaSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
31335e358ecaSmrgdnl documentation for any purpose is hereby granted without fee, provided that
31345e358ecaSmrgdnl the above copyright notice appear in all copies and that both that
31355e358ecaSmrgdnl copyright notice and this permission notice appear in supporting
31365e358ecaSmrgdnl documentation.
31375e358ecaSmrgdnl
31385e358ecaSmrgdnl The above copyright notice and this permission notice shall be included
31395e358ecaSmrgdnl in all copies or substantial portions of the Software.
31405e358ecaSmrgdnl
31415e358ecaSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31425e358ecaSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31435e358ecaSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31445e358ecaSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
31455e358ecaSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31465e358ecaSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31475e358ecaSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
31485e358ecaSmrgdnl
31495e358ecaSmrgdnl Except as contained in this notice, the name of the copyright holders shall
31505e358ecaSmrgdnl not be used in advertising or otherwise to promote the sale, use or
31515e358ecaSmrgdnl other dealings in this Software without prior written authorization
31525e358ecaSmrgdnl from the copyright holders.
31535e358ecaSmrgdnl
3154b3307321Smrg
31555e358ecaSmrg# XORG_RELEASE_VERSION
31565e358ecaSmrg# --------------------
315729cb5710Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
31585e358ecaSmrg 
31595e358ecaSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
31605e358ecaSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
31615e358ecaSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
31625e358ecaSmrg		[Major version of this package])
31635e358ecaSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
31645e358ecaSmrg	if test "x$PVM" = "x"; then
31655e358ecaSmrg		PVM="0"
31665e358ecaSmrg	fi
31675e358ecaSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
31685e358ecaSmrg		[$PVM],
31695e358ecaSmrg		[Minor version of this package])
31705e358ecaSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
31715e358ecaSmrg	if test "x$PVP" = "x"; then
31725e358ecaSmrg		PVP="0"
31735e358ecaSmrg	fi
31745e358ecaSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
31755e358ecaSmrg		[$PVP],
31765e358ecaSmrg		[Patch version of this package])
31775e358ecaSmrg])
3178b3307321Smrg
31795e358ecaSmrg# XORG_CHANGELOG()
31805e358ecaSmrg# ----------------
31815e358ecaSmrg# Minimum version: 1.2.0
31825e358ecaSmrg#
31835e358ecaSmrg# Defines the variable CHANGELOG_CMD as the command to generate
31845e358ecaSmrg# ChangeLog from git.
31855e358ecaSmrg#
31865e358ecaSmrg#
31875e358ecaSmrgAC_DEFUN([XORG_CHANGELOG], [
318829cb5710SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
318929cb5710Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
319029cb5710Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
31915e358ecaSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
31925e358ecaSmrgAC_SUBST([CHANGELOG_CMD])
31935e358ecaSmrg]) # XORG_CHANGELOG
3194b3307321Smrg
3195