aclocal.m4 revision 48f45e26
148f45e26Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
287aef7c3Smrg
348f45e26Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4ea6ae205Smrg
5ea6ae205Smrg# This file is free software; the Free Software Foundation
6ea6ae205Smrg# gives unlimited permission to copy and/or distribute it,
7ea6ae205Smrg# with or without modifications, as long as this notice is preserved.
8ea6ae205Smrg
9ea6ae205Smrg# This program is distributed in the hope that it will be useful,
10ea6ae205Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11ea6ae205Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12ea6ae205Smrg# PARTICULAR PURPOSE.
13ea6ae205Smrg
1487aef7c3Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15e83ac88aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16e83ac88aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1748f45e26Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1848f45e26Smrg[m4_warning([this file was generated for autoconf 2.69.
19e83ac88aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20e83ac88aSmrgIf you have problems, you may need to regenerate the build system entirely.
2187aef7c3SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22ea6ae205Smrg
2348f45e26Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
24ea6ae205Smrg#
257978d3cdSmrg# This file is free software; the Free Software Foundation
267978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
277978d3cdSmrg# with or without modifications, as long as this notice is preserved.
28ea6ae205Smrg
297978d3cdSmrg# AM_AUTOMAKE_VERSION(VERSION)
307978d3cdSmrg# ----------------------------
317978d3cdSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
327978d3cdSmrg# generated from the m4 files accompanying Automake X.Y.
337978d3cdSmrg# (This private macro should not be called outside this file.)
347978d3cdSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3548f45e26Smrg[am__api_version='1.15'
367978d3cdSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
377978d3cdSmrgdnl require some minimum version.  Point them to the right macro.
3848f45e26Smrgm4_if([$1], [1.15], [],
397978d3cdSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
407978d3cdSmrg])
41ea6ae205Smrg
427978d3cdSmrg# _AM_AUTOCONF_VERSION(VERSION)
437978d3cdSmrg# -----------------------------
447978d3cdSmrg# aclocal traces this macro to find the Autoconf version.
457978d3cdSmrg# This is a private macro too.  Using m4_define simplifies
467978d3cdSmrg# the logic in aclocal, which can simply ignore this definition.
477978d3cdSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48ea6ae205Smrg
497978d3cdSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
507978d3cdSmrg# -------------------------------
517978d3cdSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52e83ac88aSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
537978d3cdSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5448f45e26Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
55e83ac88aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56e83ac88aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57e83ac88aSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58ea6ae205Smrg
597978d3cdSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60ea6ae205Smrg
6148f45e26Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
627978d3cdSmrg#
637978d3cdSmrg# This file is free software; the Free Software Foundation
647978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
657978d3cdSmrg# with or without modifications, as long as this notice is preserved.
66ea6ae205Smrg
677978d3cdSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6887aef7c3Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6987aef7c3Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
707978d3cdSmrg#
717978d3cdSmrg# Of course, Automake must honor this variable whenever it calls a
727978d3cdSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
737978d3cdSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
747978d3cdSmrg# depending on how configure is run.  This is pretty annoying, since
757978d3cdSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
767978d3cdSmrg# source directory, any form will work fine, but in subdirectories a
777978d3cdSmrg# relative path needs to be adjusted first.
78ea6ae205Smrg#
797978d3cdSmrg# $ac_aux_dir/missing
807978d3cdSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
817978d3cdSmrg# $top_srcdir/$ac_aux_dir/missing
827978d3cdSmrg#    fails if $ac_aux_dir is absolute,
837978d3cdSmrg#    fails when called from a subdirectory in a VPATH build with
847978d3cdSmrg#          a relative $ac_aux_dir
85ea6ae205Smrg#
867978d3cdSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
877978d3cdSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
8887aef7c3Smrg# harmless because $srcdir is '.', but things will broke when you
897978d3cdSmrg# start a VPATH build or use an absolute $srcdir.
90ea6ae205Smrg#
917978d3cdSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
927978d3cdSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
937978d3cdSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
947978d3cdSmrg# and then we would define $MISSING as
957978d3cdSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
967978d3cdSmrg# This will work as long as MISSING is not called from configure, because
977978d3cdSmrg# unfortunately $(top_srcdir) has no meaning in configure.
987978d3cdSmrg# However there are other variables, like CC, which are often used in
997978d3cdSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100ea6ae205Smrg#
1017978d3cdSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1027978d3cdSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1037978d3cdSmrg# configured tree to be moved without reconfiguration.
104ea6ae205Smrg
1057978d3cdSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10648f45e26Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10748f45e26Smrg# Expand $ac_aux_dir to an absolute path.
10848f45e26Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1097978d3cdSmrg])
110ea6ae205Smrg
1117978d3cdSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112ea6ae205Smrg
11348f45e26Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
1147978d3cdSmrg#
1157978d3cdSmrg# This file is free software; the Free Software Foundation
1167978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
1177978d3cdSmrg# with or without modifications, as long as this notice is preserved.
118ea6ae205Smrg
1197978d3cdSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1207978d3cdSmrg# -------------------------------------
1217978d3cdSmrg# Define a conditional.
1227978d3cdSmrgAC_DEFUN([AM_CONDITIONAL],
12387aef7c3Smrg[AC_PREREQ([2.52])dnl
12487aef7c3Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12587aef7c3Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1267978d3cdSmrgAC_SUBST([$1_TRUE])dnl
1277978d3cdSmrgAC_SUBST([$1_FALSE])dnl
1287978d3cdSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1297978d3cdSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130e83ac88aSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1317978d3cdSmrgif $2; then
1327978d3cdSmrg  $1_TRUE=
1337978d3cdSmrg  $1_FALSE='#'
1347978d3cdSmrgelse
1357978d3cdSmrg  $1_TRUE='#'
1367978d3cdSmrg  $1_FALSE=
1377978d3cdSmrgfi
1387978d3cdSmrgAC_CONFIG_COMMANDS_PRE(
1397978d3cdSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1407978d3cdSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1417978d3cdSmrgUsually this means the macro was only invoked conditionally.]])
1427978d3cdSmrgfi])])
143ea6ae205Smrg
14448f45e26Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
1457978d3cdSmrg#
1467978d3cdSmrg# This file is free software; the Free Software Foundation
1477978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
1487978d3cdSmrg# with or without modifications, as long as this notice is preserved.
149ea6ae205Smrg
150ea6ae205Smrg
15187aef7c3Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1527978d3cdSmrg# written in clear, in which case automake, when reading aclocal.m4,
1537978d3cdSmrg# will think it sees a *use*, and therefore will trigger all it's
1547978d3cdSmrg# C support machinery.  Also note that it means that autoscan, seeing
1557978d3cdSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156ea6ae205Smrg
157ea6ae205Smrg
1587978d3cdSmrg# _AM_DEPENDENCIES(NAME)
1597978d3cdSmrg# ----------------------
1607978d3cdSmrg# See how the compiler implements dependency checking.
16187aef7c3Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1627978d3cdSmrg# We try a few techniques and use that to set a single cache variable.
1637978d3cdSmrg#
1647978d3cdSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1657978d3cdSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1667978d3cdSmrg# dependency, and given that the user is not expected to run this macro,
1677978d3cdSmrg# just rely on AC_PROG_CC.
1687978d3cdSmrgAC_DEFUN([_AM_DEPENDENCIES],
1697978d3cdSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1707978d3cdSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1717978d3cdSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1727978d3cdSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173ea6ae205Smrg
17487aef7c3Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17587aef7c3Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17687aef7c3Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17787aef7c3Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17887aef7c3Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17987aef7c3Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18087aef7c3Smrg                    [depcc="$$1"   am_compiler_list=])
181ea6ae205Smrg
1827978d3cdSmrgAC_CACHE_CHECK([dependency style of $depcc],
1837978d3cdSmrg               [am_cv_$1_dependencies_compiler_type],
1847978d3cdSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1857978d3cdSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1867978d3cdSmrg  # making bogus files that we don't know about and never remove.  For
1877978d3cdSmrg  # instance it was reported that on HP-UX the gcc test will end up
18887aef7c3Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18987aef7c3Smrg  # in D".
19087aef7c3Smrg  rm -rf conftest.dir
1917978d3cdSmrg  mkdir conftest.dir
1927978d3cdSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1937978d3cdSmrg  # using a relative directory.
1947978d3cdSmrg  cp "$am_depcomp" conftest.dir
1957978d3cdSmrg  cd conftest.dir
1967978d3cdSmrg  # We will build objects and dependencies in a subdirectory because
1977978d3cdSmrg  # it helps to detect inapplicable dependency modes.  For instance
1987978d3cdSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1997978d3cdSmrg  # side effect of compilation, but ICC will put the dependencies in
2007978d3cdSmrg  # the current directory while Tru64 will put them in the object
2017978d3cdSmrg  # directory.
2027978d3cdSmrg  mkdir sub
203ea6ae205Smrg
2047978d3cdSmrg  am_cv_$1_dependencies_compiler_type=none
2057978d3cdSmrg  if test "$am_compiler_list" = ""; then
2067978d3cdSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2077978d3cdSmrg  fi
208e83ac88aSmrg  am__universal=false
209e83ac88aSmrg  m4_case([$1], [CC],
210e83ac88aSmrg    [case " $depcc " in #(
211e83ac88aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212e83ac88aSmrg     esac],
213e83ac88aSmrg    [CXX],
214e83ac88aSmrg    [case " $depcc " in #(
215e83ac88aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216e83ac88aSmrg     esac])
217e83ac88aSmrg
2187978d3cdSmrg  for depmode in $am_compiler_list; do
2197978d3cdSmrg    # Setup a source with many dependencies, because some compilers
2207978d3cdSmrg    # like to wrap large dependency lists on column 80 (with \), and
2217978d3cdSmrg    # we should not choose a depcomp mode which is confused by this.
2227978d3cdSmrg    #
2237978d3cdSmrg    # We need to recreate these files for each test, as the compiler may
2247978d3cdSmrg    # overwrite some of them when testing with obscure command lines.
2257978d3cdSmrg    # This happens at least with the AIX C compiler.
2267978d3cdSmrg    : > sub/conftest.c
2277978d3cdSmrg    for i in 1 2 3 4 5 6; do
2287978d3cdSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22987aef7c3Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23087aef7c3Smrg      # Solaris 10 /bin/sh.
23187aef7c3Smrg      echo '/* dummy */' > sub/conftst$i.h
2327978d3cdSmrg    done
2337978d3cdSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234ea6ae205Smrg
23587aef7c3Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236e83ac88aSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23787aef7c3Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23887aef7c3Smrg    # versions had trouble with output in subdirs.
239e83ac88aSmrg    am__obj=sub/conftest.${OBJEXT-o}
240e83ac88aSmrg    am__minus_obj="-o $am__obj"
2417978d3cdSmrg    case $depmode in
242e83ac88aSmrg    gcc)
243e83ac88aSmrg      # This depmode causes a compiler race in universal mode.
244e83ac88aSmrg      test "$am__universal" = false || continue
245e83ac88aSmrg      ;;
2467978d3cdSmrg    nosideeffect)
24787aef7c3Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24887aef7c3Smrg      # only be used when explicitly requested.
2497978d3cdSmrg      if test "x$enable_dependency_tracking" = xyes; then
2507978d3cdSmrg	continue
2517978d3cdSmrg      else
2527978d3cdSmrg	break
2537978d3cdSmrg      fi
2547978d3cdSmrg      ;;
25587aef7c3Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25687aef7c3Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257e83ac88aSmrg      # not run yet.  These depmodes are late enough in the game, and
258e83ac88aSmrg      # so weak that their functioning should not be impacted.
259e83ac88aSmrg      am__obj=conftest.${OBJEXT-o}
260e83ac88aSmrg      am__minus_obj=
261e83ac88aSmrg      ;;
2627978d3cdSmrg    none) break ;;
263ea6ae205Smrg    esac
2647978d3cdSmrg    if depmode=$depmode \
265e83ac88aSmrg       source=sub/conftest.c object=$am__obj \
2667978d3cdSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267e83ac88aSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2687978d3cdSmrg         >/dev/null 2>conftest.err &&
2697978d3cdSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2707978d3cdSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271e83ac88aSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2727978d3cdSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2737978d3cdSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2747978d3cdSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2757978d3cdSmrg      # that says an option was ignored or not supported.
2767978d3cdSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2777978d3cdSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2787978d3cdSmrg      # The diagnosis changed in icc 8.0:
2797978d3cdSmrg      #   icc: Command line remark: option '-MP' not supported
2807978d3cdSmrg      if (grep 'ignoring option' conftest.err ||
2817978d3cdSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2827978d3cdSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2837978d3cdSmrg        break
2847978d3cdSmrg      fi
2857978d3cdSmrg    fi
2867978d3cdSmrg  done
287ea6ae205Smrg
2887978d3cdSmrg  cd ..
2897978d3cdSmrg  rm -rf conftest.dir
2907978d3cdSmrgelse
2917978d3cdSmrg  am_cv_$1_dependencies_compiler_type=none
292ea6ae205Smrgfi
2937978d3cdSmrg])
2947978d3cdSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2957978d3cdSmrgAM_CONDITIONAL([am__fastdep$1], [
2967978d3cdSmrg  test "x$enable_dependency_tracking" != xno \
2977978d3cdSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2987978d3cdSmrg])
299ea6ae205Smrg
300ea6ae205Smrg
3017978d3cdSmrg# AM_SET_DEPDIR
3027978d3cdSmrg# -------------
3037978d3cdSmrg# Choose a directory name for dependency files.
30487aef7c3Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3057978d3cdSmrgAC_DEFUN([AM_SET_DEPDIR],
3067978d3cdSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3077978d3cdSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3087978d3cdSmrg])
309ea6ae205Smrg
310ea6ae205Smrg
3117978d3cdSmrg# AM_DEP_TRACK
3127978d3cdSmrg# ------------
3137978d3cdSmrgAC_DEFUN([AM_DEP_TRACK],
31487aef7c3Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31587aef7c3SmrgAS_HELP_STRING(
31687aef7c3Smrg  [--enable-dependency-tracking],
31787aef7c3Smrg  [do not reject slow dependency extractors])
31887aef7c3SmrgAS_HELP_STRING(
31987aef7c3Smrg  [--disable-dependency-tracking],
32087aef7c3Smrg  [speeds up one-time build])])
3217978d3cdSmrgif test "x$enable_dependency_tracking" != xno; then
3227978d3cdSmrg  am_depcomp="$ac_aux_dir/depcomp"
3237978d3cdSmrg  AMDEPBACKSLASH='\'
32487aef7c3Smrg  am__nodep='_no'
325ea6ae205Smrgfi
3267978d3cdSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3277978d3cdSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3287978d3cdSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32987aef7c3SmrgAC_SUBST([am__nodep])dnl
33087aef7c3Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3317978d3cdSmrg])
332ea6ae205Smrg
3337978d3cdSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334ea6ae205Smrg
33548f45e26Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
3367978d3cdSmrg#
3377978d3cdSmrg# This file is free software; the Free Software Foundation
3387978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
3397978d3cdSmrg# with or without modifications, as long as this notice is preserved.
340ea6ae205Smrg
341ea6ae205Smrg
3427978d3cdSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3437978d3cdSmrg# ------------------------------
3447978d3cdSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
345e83ac88aSmrg[{
34687aef7c3Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
347e83ac88aSmrg  # are listed without --file.  Let's play safe and only enable the eval
348e83ac88aSmrg  # if we detect the quoting.
349e83ac88aSmrg  case $CONFIG_FILES in
350e83ac88aSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
351e83ac88aSmrg  *)   set x $CONFIG_FILES ;;
352e83ac88aSmrg  esac
353e83ac88aSmrg  shift
354e83ac88aSmrg  for mf
355e83ac88aSmrg  do
356e83ac88aSmrg    # Strip MF so we end up with the name of the file.
357e83ac88aSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
358e83ac88aSmrg    # Check whether this is an Automake generated Makefile or not.
35987aef7c3Smrg    # We used to match only the files named 'Makefile.in', but
360e83ac88aSmrg    # some people rename them; so instead we look at the file content.
361e83ac88aSmrg    # Grep'ing the first line is not enough: some people post-process
362e83ac88aSmrg    # each Makefile.in and add a new line on top of each file to say so.
363e83ac88aSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
364e83ac88aSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
365e83ac88aSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
366e83ac88aSmrg      dirpart=`AS_DIRNAME("$mf")`
367e83ac88aSmrg    else
368e83ac88aSmrg      continue
369e83ac88aSmrg    fi
370e83ac88aSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
37187aef7c3Smrg    # from the Makefile without running 'make'.
372e83ac88aSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
373e83ac88aSmrg    test -z "$DEPDIR" && continue
374e83ac88aSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
37587aef7c3Smrg    test -z "$am__include" && continue
376e83ac88aSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
377e83ac88aSmrg    # Find all dependency output files, they are included files with
378e83ac88aSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379e83ac88aSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380e83ac88aSmrg    # expansion.
381e83ac88aSmrg    for file in `sed -n "
382e83ac88aSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
38387aef7c3Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
384e83ac88aSmrg      # Make sure the directory exists.
385e83ac88aSmrg      test -f "$dirpart/$file" && continue
386e83ac88aSmrg      fdir=`AS_DIRNAME(["$file"])`
387e83ac88aSmrg      AS_MKDIR_P([$dirpart/$fdir])
388e83ac88aSmrg      # echo "creating $dirpart/$file"
389e83ac88aSmrg      echo '# dummy' > "$dirpart/$file"
390e83ac88aSmrg    done
3917978d3cdSmrg  done
392e83ac88aSmrg}
3937978d3cdSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394ea6ae205Smrg
395ea6ae205Smrg
3967978d3cdSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3977978d3cdSmrg# -----------------------------
3987978d3cdSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3997978d3cdSmrg#
4007978d3cdSmrg# This code is only required when automatic dependency tracking
40187aef7c3Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
4027978d3cdSmrg# need in order to bootstrap the dependency handling code.
4037978d3cdSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4047978d3cdSmrg[AC_CONFIG_COMMANDS([depfiles],
4057978d3cdSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4067978d3cdSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4077978d3cdSmrg])
408ea6ae205Smrg
4097978d3cdSmrg# Do all the work for Automake.                             -*- Autoconf -*-
410ea6ae205Smrg
41148f45e26Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
412ea6ae205Smrg#
4137978d3cdSmrg# This file is free software; the Free Software Foundation
4147978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
4157978d3cdSmrg# with or without modifications, as long as this notice is preserved.
416ea6ae205Smrg
4177978d3cdSmrg# This macro actually does too much.  Some checks are only needed if
4187978d3cdSmrg# your package does certain things.  But this isn't really a big deal.
419ea6ae205Smrg
42087aef7c3Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
42187aef7c3Smrgm4_define([AC_PROG_CC],
42287aef7c3Smrgm4_defn([AC_PROG_CC])
42387aef7c3Smrg[_AM_PROG_CC_C_O
42487aef7c3Smrg])
42587aef7c3Smrg
4267978d3cdSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4277978d3cdSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4287978d3cdSmrg# -----------------------------------------------
4297978d3cdSmrg# The call with PACKAGE and VERSION arguments is the old style
4307978d3cdSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4317978d3cdSmrg# and VERSION should now be passed to AC_INIT and removed from
4327978d3cdSmrg# the call to AM_INIT_AUTOMAKE.
4337978d3cdSmrg# We support both call styles for the transition.  After
4347978d3cdSmrg# the next Automake release, Autoconf can make the AC_INIT
4357978d3cdSmrg# arguments mandatory, and then we can depend on a new Autoconf
4367978d3cdSmrg# release and drop the old call support.
4377978d3cdSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43887aef7c3Smrg[AC_PREREQ([2.65])dnl
4397978d3cdSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4407978d3cdSmrgdnl the ones we care about.
4417978d3cdSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4427978d3cdSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4437978d3cdSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4447978d3cdSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4457978d3cdSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4467978d3cdSmrg  # is not polluted with repeated "-I."
4477978d3cdSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4487978d3cdSmrg  # test to see if srcdir already configured
4497978d3cdSmrg  if test -f $srcdir/config.status; then
4507978d3cdSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4517978d3cdSmrg  fi
452ea6ae205Smrgfi
453ea6ae205Smrg
4547978d3cdSmrg# test whether we have cygpath
4557978d3cdSmrgif test -z "$CYGPATH_W"; then
4567978d3cdSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4577978d3cdSmrg    CYGPATH_W='cygpath -w'
4587978d3cdSmrg  else
4597978d3cdSmrg    CYGPATH_W=echo
4607978d3cdSmrg  fi
461ea6ae205Smrgfi
4627978d3cdSmrgAC_SUBST([CYGPATH_W])
463ea6ae205Smrg
4647978d3cdSmrg# Define the identity of the package.
4657978d3cdSmrgdnl Distinguish between old-style and new-style calls.
4667978d3cdSmrgm4_ifval([$2],
46787aef7c3Smrg[AC_DIAGNOSE([obsolete],
46887aef7c3Smrg             [$0: two- and three-arguments forms are deprecated.])
46987aef7c3Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4707978d3cdSmrg AC_SUBST([PACKAGE], [$1])dnl
4717978d3cdSmrg AC_SUBST([VERSION], [$2])],
4727978d3cdSmrg[_AM_SET_OPTIONS([$1])dnl
4737978d3cdSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47487aef7c3Smrgm4_if(
47587aef7c3Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
47687aef7c3Smrg  [ok:ok],,
4777978d3cdSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4787978d3cdSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4797978d3cdSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
480ea6ae205Smrg
4817978d3cdSmrg_AM_IF_OPTION([no-define],,
48287aef7c3Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
48387aef7c3Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
484ea6ae205Smrg
4857978d3cdSmrg# Some tools Automake needs.
4867978d3cdSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4877978d3cdSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48887aef7c3SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48987aef7c3SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
49087aef7c3SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
49187aef7c3SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
49287aef7c3SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
493e83ac88aSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
494e83ac88aSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49587aef7c3SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49687aef7c3Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49787aef7c3Smrg# dies out for good.  For more background, see:
49887aef7c3Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49987aef7c3Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
50087aef7c3SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
50148f45e26Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
50248f45e26Smrg# system "awk" is bad on some platforms.
5037978d3cdSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5047978d3cdSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5057978d3cdSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5067978d3cdSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
507e83ac88aSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
508e83ac88aSmrg			     [_AM_PROG_TAR([v7])])])
5097978d3cdSmrg_AM_IF_OPTION([no-dependencies],,
5107978d3cdSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
51187aef7c3Smrg		  [_AM_DEPENDENCIES([CC])],
51287aef7c3Smrg		  [m4_define([AC_PROG_CC],
51387aef7c3Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5147978d3cdSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51587aef7c3Smrg		  [_AM_DEPENDENCIES([CXX])],
51687aef7c3Smrg		  [m4_define([AC_PROG_CXX],
51787aef7c3Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5187978d3cdSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51987aef7c3Smrg		  [_AM_DEPENDENCIES([OBJC])],
52087aef7c3Smrg		  [m4_define([AC_PROG_OBJC],
52187aef7c3Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
52287aef7c3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
52387aef7c3Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52487aef7c3Smrg		  [m4_define([AC_PROG_OBJCXX],
52587aef7c3Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5267978d3cdSmrg])
52787aef7c3SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
52887aef7c3Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
52987aef7c3Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
53087aef7c3Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
531e83ac88aSmrgAC_CONFIG_COMMANDS_PRE(dnl
532e83ac88aSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
533e83ac88aSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5347978d3cdSmrg
53587aef7c3Smrg# POSIX will say in a future version that running "rm -f" with no argument
53687aef7c3Smrg# is OK; and we want to be able to make that assumption in our Makefile
53787aef7c3Smrg# recipes.  So use an aggressive probe to check that the usage we want is
53887aef7c3Smrg# actually supported "in the wild" to an acceptable degree.
53987aef7c3Smrg# See automake bug#10828.
54087aef7c3Smrg# To make any issue more visible, cause the running configure to be aborted
54187aef7c3Smrg# by default if the 'rm' program in use doesn't match our expectations; the
54287aef7c3Smrg# user can still override this though.
54387aef7c3Smrgif rm -f && rm -fr && rm -rf; then : OK; else
54487aef7c3Smrg  cat >&2 <<'END'
54587aef7c3SmrgOops!
54687aef7c3Smrg
54787aef7c3SmrgYour 'rm' program seems unable to run without file operands specified
54887aef7c3Smrgon the command line, even when the '-f' option is present.  This is contrary
54987aef7c3Smrgto the behaviour of most rm programs out there, and not conforming with
55087aef7c3Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
55187aef7c3Smrg
55287aef7c3SmrgPlease tell bug-automake@gnu.org about your system, including the value
55387aef7c3Smrgof your $PATH and any error possibly output before this message.  This
55487aef7c3Smrgcan help us improve future automake versions.
55587aef7c3Smrg
55687aef7c3SmrgEND
55787aef7c3Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
55887aef7c3Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
55987aef7c3Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
56087aef7c3Smrg    echo >&2
56187aef7c3Smrg  else
56287aef7c3Smrg    cat >&2 <<'END'
56387aef7c3SmrgAborting the configuration process, to ensure you take notice of the issue.
56487aef7c3Smrg
56587aef7c3SmrgYou can download and install GNU coreutils to get an 'rm' implementation
56687aef7c3Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
56787aef7c3Smrg
56887aef7c3SmrgIf you want to complete the configuration process using your problematic
56987aef7c3Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
57087aef7c3Smrgto "yes", and re-run configure.
57187aef7c3Smrg
57287aef7c3SmrgEND
57387aef7c3Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
57487aef7c3Smrg  fi
57548f45e26Smrgfi
57648f45e26Smrgdnl The trailing newline in this macro's definition is deliberate, for
57748f45e26Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
57848f45e26Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
57948f45e26Smrg])
58087aef7c3Smrg
58187aef7c3Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
582e83ac88aSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
583e83ac88aSmrgdnl mangled by Autoconf and run in a shell conditional statement.
584e83ac88aSmrgm4_define([_AC_COMPILER_EXEEXT],
585e83ac88aSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
586e83ac88aSmrg
5877978d3cdSmrg# When config.status generates a header, we must update the stamp-h file.
5887978d3cdSmrg# This file resides in the same directory as the config header
5897978d3cdSmrg# that is generated.  The stamp files are numbered to have different names.
5907978d3cdSmrg
5917978d3cdSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5927978d3cdSmrg# loop where config.status creates the headers, so we can generate
5937978d3cdSmrg# our stamp files there.
5947978d3cdSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5957978d3cdSmrg[# Compute $1's index in $config_headers.
596e83ac88aSmrg_am_arg=$1
5977978d3cdSmrg_am_stamp_count=1
5987978d3cdSmrgfor _am_header in $config_headers :; do
5997978d3cdSmrg  case $_am_header in
600e83ac88aSmrg    $_am_arg | $_am_arg:* )
6017978d3cdSmrg      break ;;
6027978d3cdSmrg    * )
6037978d3cdSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6047978d3cdSmrg  esac
6057978d3cdSmrgdone
606e83ac88aSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6077978d3cdSmrg
60848f45e26Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6097978d3cdSmrg#
6107978d3cdSmrg# This file is free software; the Free Software Foundation
6117978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
6127978d3cdSmrg# with or without modifications, as long as this notice is preserved.
613ea6ae205Smrg
6147978d3cdSmrg# AM_PROG_INSTALL_SH
6157978d3cdSmrg# ------------------
6167978d3cdSmrg# Define $install_sh.
6177978d3cdSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6187978d3cdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
61948f45e26Smrgif test x"${install_sh+set}" != xset; then
620e83ac88aSmrg  case $am_aux_dir in
621e83ac88aSmrg  *\ * | *\	*)
622e83ac88aSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
623e83ac88aSmrg  *)
624e83ac88aSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
625e83ac88aSmrg  esac
626e83ac88aSmrgfi
62787aef7c3SmrgAC_SUBST([install_sh])])
628ea6ae205Smrg
62948f45e26Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
630ea6ae205Smrg#
6317978d3cdSmrg# This file is free software; the Free Software Foundation
6327978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
6337978d3cdSmrg# with or without modifications, as long as this notice is preserved.
634ea6ae205Smrg
6357978d3cdSmrg# Check whether the underlying file-system supports filenames
6367978d3cdSmrg# with a leading dot.  For instance MS-DOS doesn't.
6377978d3cdSmrgAC_DEFUN([AM_SET_LEADING_DOT],
6387978d3cdSmrg[rm -rf .tst 2>/dev/null
6397978d3cdSmrgmkdir .tst 2>/dev/null
6407978d3cdSmrgif test -d .tst; then
6417978d3cdSmrg  am__leading_dot=.
642ea6ae205Smrgelse
6437978d3cdSmrg  am__leading_dot=_
644ea6ae205Smrgfi
6457978d3cdSmrgrmdir .tst 2>/dev/null
6467978d3cdSmrgAC_SUBST([am__leading_dot])])
647ea6ae205Smrg
6487978d3cdSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
649ea6ae205Smrg
65048f45e26Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6517978d3cdSmrg#
6527978d3cdSmrg# This file is free software; the Free Software Foundation
6537978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
6547978d3cdSmrg# with or without modifications, as long as this notice is preserved.
655ea6ae205Smrg
6567978d3cdSmrg# AM_MAKE_INCLUDE()
6577978d3cdSmrg# -----------------
6587978d3cdSmrg# Check to see how make treats includes.
6597978d3cdSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6607978d3cdSmrg[am_make=${MAKE-make}
6617978d3cdSmrgcat > confinc << 'END'
6627978d3cdSmrgam__doit:
663e83ac88aSmrg	@echo this is the am__doit target
6647978d3cdSmrg.PHONY: am__doit
6657978d3cdSmrgEND
6667978d3cdSmrg# If we don't find an include directive, just comment out the code.
6677978d3cdSmrgAC_MSG_CHECKING([for style of include used by $am_make])
6687978d3cdSmrgam__include="#"
6697978d3cdSmrgam__quote=
6707978d3cdSmrg_am_result=none
6717978d3cdSmrg# First try GNU make style include.
6727978d3cdSmrgecho "include confinc" > confmf
67387aef7c3Smrg# Ignore all kinds of additional output from 'make'.
674e83ac88aSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
675e83ac88aSmrg*the\ am__doit\ target*)
676e83ac88aSmrg  am__include=include
677e83ac88aSmrg  am__quote=
678e83ac88aSmrg  _am_result=GNU
679e83ac88aSmrg  ;;
680e83ac88aSmrgesac
6817978d3cdSmrg# Now try BSD make style include.
6827978d3cdSmrgif test "$am__include" = "#"; then
6837978d3cdSmrg   echo '.include "confinc"' > confmf
684e83ac88aSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
685e83ac88aSmrg   *the\ am__doit\ target*)
686e83ac88aSmrg     am__include=.include
687e83ac88aSmrg     am__quote="\""
688e83ac88aSmrg     _am_result=BSD
689e83ac88aSmrg     ;;
690e83ac88aSmrg   esac
6917978d3cdSmrgfi
6927978d3cdSmrgAC_SUBST([am__include])
6937978d3cdSmrgAC_SUBST([am__quote])
6947978d3cdSmrgAC_MSG_RESULT([$_am_result])
6957978d3cdSmrgrm -f confinc confmf
696ea6ae205Smrg])
697ea6ae205Smrg
6987978d3cdSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6997978d3cdSmrg
70048f45e26Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
701ea6ae205Smrg#
702ea6ae205Smrg# This file is free software; the Free Software Foundation
703ea6ae205Smrg# gives unlimited permission to copy and/or distribute it,
704ea6ae205Smrg# with or without modifications, as long as this notice is preserved.
705ea6ae205Smrg
7067978d3cdSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7077978d3cdSmrg# ------------------------------
7087978d3cdSmrgAC_DEFUN([AM_MISSING_PROG],
7097978d3cdSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7107978d3cdSmrg$1=${$1-"${am_missing_run}$2"}
7117978d3cdSmrgAC_SUBST($1)])
712ea6ae205Smrg
7137978d3cdSmrg# AM_MISSING_HAS_RUN
7147978d3cdSmrg# ------------------
71587aef7c3Smrg# Define MISSING if not defined so far and test if it is modern enough.
71687aef7c3Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7177978d3cdSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7187978d3cdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7197978d3cdSmrgAC_REQUIRE_AUX_FILE([missing])dnl
720e83ac88aSmrgif test x"${MISSING+set}" != xset; then
721e83ac88aSmrg  case $am_aux_dir in
722e83ac88aSmrg  *\ * | *\	*)
723e83ac88aSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
724e83ac88aSmrg  *)
725e83ac88aSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
726e83ac88aSmrg  esac
727e83ac88aSmrgfi
7287978d3cdSmrg# Use eval to expand $SHELL
72987aef7c3Smrgif eval "$MISSING --is-lightweight"; then
73087aef7c3Smrg  am_missing_run="$MISSING "
7317978d3cdSmrgelse
7327978d3cdSmrg  am_missing_run=
73387aef7c3Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7347978d3cdSmrgfi
7357978d3cdSmrg])
736ea6ae205Smrg
7377978d3cdSmrg# Helper functions for option handling.                     -*- Autoconf -*-
738ea6ae205Smrg
73948f45e26Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
740ea6ae205Smrg#
741ea6ae205Smrg# This file is free software; the Free Software Foundation
742ea6ae205Smrg# gives unlimited permission to copy and/or distribute it,
743ea6ae205Smrg# with or without modifications, as long as this notice is preserved.
744ea6ae205Smrg
7457978d3cdSmrg# _AM_MANGLE_OPTION(NAME)
7467978d3cdSmrg# -----------------------
7477978d3cdSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7487978d3cdSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
749ea6ae205Smrg
7507978d3cdSmrg# _AM_SET_OPTION(NAME)
75187aef7c3Smrg# --------------------
7527978d3cdSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7537978d3cdSmrgAC_DEFUN([_AM_SET_OPTION],
75487aef7c3Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
755ea6ae205Smrg
7567978d3cdSmrg# _AM_SET_OPTIONS(OPTIONS)
75787aef7c3Smrg# ------------------------
7587978d3cdSmrg# OPTIONS is a space-separated list of Automake options.
7597978d3cdSmrgAC_DEFUN([_AM_SET_OPTIONS],
760e83ac88aSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
761ea6ae205Smrg
7627978d3cdSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7637978d3cdSmrg# -------------------------------------------
7647978d3cdSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7657978d3cdSmrgAC_DEFUN([_AM_IF_OPTION],
7667978d3cdSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
767ea6ae205Smrg
76848f45e26Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
76987aef7c3Smrg#
77087aef7c3Smrg# This file is free software; the Free Software Foundation
77187aef7c3Smrg# gives unlimited permission to copy and/or distribute it,
77287aef7c3Smrg# with or without modifications, as long as this notice is preserved.
773ea6ae205Smrg
77487aef7c3Smrg# _AM_PROG_CC_C_O
77587aef7c3Smrg# ---------------
77687aef7c3Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77787aef7c3Smrg# to automatically call this.
77887aef7c3SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77987aef7c3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
78087aef7c3SmrgAC_REQUIRE_AUX_FILE([compile])dnl
78187aef7c3SmrgAC_LANG_PUSH([C])dnl
78287aef7c3SmrgAC_CACHE_CHECK(
78387aef7c3Smrg  [whether $CC understands -c and -o together],
78487aef7c3Smrg  [am_cv_prog_cc_c_o],
78587aef7c3Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78687aef7c3Smrg  # Make sure it works both with $CC and with simple cc.
78787aef7c3Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78887aef7c3Smrg  # compilers refuse to overwrite an existing .o file with -o,
78987aef7c3Smrg  # though they will create one.
79087aef7c3Smrg  am_cv_prog_cc_c_o=yes
79187aef7c3Smrg  for am_i in 1 2; do
79287aef7c3Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79387aef7c3Smrg         && test -f conftest2.$ac_objext; then
79487aef7c3Smrg      : OK
79587aef7c3Smrg    else
79687aef7c3Smrg      am_cv_prog_cc_c_o=no
79787aef7c3Smrg      break
79887aef7c3Smrg    fi
79987aef7c3Smrg  done
80087aef7c3Smrg  rm -f core conftest*
80187aef7c3Smrg  unset am_i])
80287aef7c3Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80387aef7c3Smrg   # Losing compiler, so override with the script.
80487aef7c3Smrg   # FIXME: It is wrong to rewrite CC.
80587aef7c3Smrg   # But if we don't then we get into trouble of one sort or another.
80687aef7c3Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80787aef7c3Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80887aef7c3Smrg   CC="$am_aux_dir/compile $CC"
80987aef7c3Smrgfi
81087aef7c3SmrgAC_LANG_POP([C])])
81187aef7c3Smrg
81287aef7c3Smrg# For backward compatibility.
81387aef7c3SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
81487aef7c3Smrg
81548f45e26Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
816ea6ae205Smrg#
8177978d3cdSmrg# This file is free software; the Free Software Foundation
8187978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
8197978d3cdSmrg# with or without modifications, as long as this notice is preserved.
820ea6ae205Smrg
82187aef7c3Smrg# AM_RUN_LOG(COMMAND)
82287aef7c3Smrg# -------------------
82387aef7c3Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82487aef7c3Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82587aef7c3SmrgAC_DEFUN([AM_RUN_LOG],
82687aef7c3Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82787aef7c3Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82887aef7c3Smrg   ac_status=$?
82987aef7c3Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
83087aef7c3Smrg   (exit $ac_status); }])
83187aef7c3Smrg
83287aef7c3Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83387aef7c3Smrg
83448f45e26Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
83587aef7c3Smrg#
83687aef7c3Smrg# This file is free software; the Free Software Foundation
83787aef7c3Smrg# gives unlimited permission to copy and/or distribute it,
83887aef7c3Smrg# with or without modifications, as long as this notice is preserved.
839ea6ae205Smrg
8407978d3cdSmrg# AM_SANITY_CHECK
8417978d3cdSmrg# ---------------
8427978d3cdSmrgAC_DEFUN([AM_SANITY_CHECK],
8437978d3cdSmrg[AC_MSG_CHECKING([whether build environment is sane])
844e83ac88aSmrg# Reject unsafe characters in $srcdir or the absolute working directory
845e83ac88aSmrg# name.  Accept space and tab only in the latter.
846e83ac88aSmrgam_lf='
847e83ac88aSmrg'
848e83ac88aSmrgcase `pwd` in
849e83ac88aSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
850e83ac88aSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
851e83ac88aSmrgesac
852e83ac88aSmrgcase $srcdir in
853e83ac88aSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85487aef7c3Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
855e83ac88aSmrgesac
856e83ac88aSmrg
85787aef7c3Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8587978d3cdSmrg# arguments.  Must try -L first in case configure is actually a
8597978d3cdSmrg# symlink; some systems play weird games with the mod time of symlinks
8607978d3cdSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8617978d3cdSmrg# directory).
8627978d3cdSmrgif (
86387aef7c3Smrg   am_has_slept=no
86487aef7c3Smrg   for am_try in 1 2; do
86587aef7c3Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86687aef7c3Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86787aef7c3Smrg     if test "$[*]" = "X"; then
86887aef7c3Smrg	# -L didn't work.
86987aef7c3Smrg	set X `ls -t "$srcdir/configure" conftest.file`
87087aef7c3Smrg     fi
87187aef7c3Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87287aef7c3Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87387aef7c3Smrg
87487aef7c3Smrg	# If neither matched, then we have a broken ls.  This can happen
87587aef7c3Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87687aef7c3Smrg	# broken ls alias from the environment.  This has actually
87787aef7c3Smrg	# happened.  Such a system could not be considered "sane".
87887aef7c3Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87987aef7c3Smrg  alias in your environment])
88087aef7c3Smrg     fi
88187aef7c3Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88287aef7c3Smrg       break
88387aef7c3Smrg     fi
88487aef7c3Smrg     # Just in case.
88587aef7c3Smrg     sleep 1
88687aef7c3Smrg     am_has_slept=yes
88787aef7c3Smrg   done
8887978d3cdSmrg   test "$[2]" = conftest.file
8897978d3cdSmrg   )
8907978d3cdSmrgthen
8917978d3cdSmrg   # Ok.
8927978d3cdSmrg   :
893ea6ae205Smrgelse
8947978d3cdSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
8957978d3cdSmrgCheck your system clock])
896ea6ae205Smrgfi
89787aef7c3SmrgAC_MSG_RESULT([yes])
89887aef7c3Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89987aef7c3Smrg# generated files are strictly newer.
90087aef7c3Smrgam_sleep_pid=
90187aef7c3Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90287aef7c3Smrg  ( sleep 1 ) &
90387aef7c3Smrg  am_sleep_pid=$!
90487aef7c3Smrgfi
90587aef7c3SmrgAC_CONFIG_COMMANDS_PRE(
90687aef7c3Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90787aef7c3Smrg   if test -n "$am_sleep_pid"; then
90887aef7c3Smrg     # Hide warnings about reused PIDs.
90987aef7c3Smrg     wait $am_sleep_pid 2>/dev/null
91087aef7c3Smrg   fi
91187aef7c3Smrg   AC_MSG_RESULT([done])])
91287aef7c3Smrgrm -f conftest.file
91387aef7c3Smrg])
914ea6ae205Smrg
91548f45e26Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
916e83ac88aSmrg#
917e83ac88aSmrg# This file is free software; the Free Software Foundation
918e83ac88aSmrg# gives unlimited permission to copy and/or distribute it,
919e83ac88aSmrg# with or without modifications, as long as this notice is preserved.
920e83ac88aSmrg
921e83ac88aSmrg# AM_SILENT_RULES([DEFAULT])
922e83ac88aSmrg# --------------------------
923e83ac88aSmrg# Enable less verbose build rules; with the default set to DEFAULT
92487aef7c3Smrg# ("yes" being less verbose, "no" or empty being verbose).
925e83ac88aSmrgAC_DEFUN([AM_SILENT_RULES],
92687aef7c3Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92787aef7c3SmrgAS_HELP_STRING(
92887aef7c3Smrg  [--enable-silent-rules],
92987aef7c3Smrg  [less verbose build output (undo: "make V=1")])
93087aef7c3SmrgAS_HELP_STRING(
93187aef7c3Smrg  [--disable-silent-rules],
93287aef7c3Smrg  [verbose build output (undo: "make V=0")])dnl
93387aef7c3Smrg])
93487aef7c3Smrgcase $enable_silent_rules in @%:@ (((
93587aef7c3Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93687aef7c3Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93787aef7c3Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
938e83ac88aSmrgesac
93987aef7c3Smrgdnl
94087aef7c3Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
94187aef7c3Smrgdnl do not support nested variable expansions.
94287aef7c3Smrgdnl See automake bug#9928 and bug#10237.
94387aef7c3Smrgam_make=${MAKE-make}
94487aef7c3SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94587aef7c3Smrg   [am_cv_make_support_nested_variables],
94687aef7c3Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94787aef7c3SmrgBAR0=false
94887aef7c3SmrgBAR1=true
94987aef7c3SmrgV=1
95087aef7c3Smrgam__doit:
95187aef7c3Smrg	@$(TRUE)
95287aef7c3Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95387aef7c3Smrg  am_cv_make_support_nested_variables=yes
95487aef7c3Smrgelse
95587aef7c3Smrg  am_cv_make_support_nested_variables=no
95687aef7c3Smrgfi])
95787aef7c3Smrgif test $am_cv_make_support_nested_variables = yes; then
95887aef7c3Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95987aef7c3Smrg  AM_V='$(V)'
96087aef7c3Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
96187aef7c3Smrgelse
96287aef7c3Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96387aef7c3Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
96487aef7c3Smrgfi
96587aef7c3SmrgAC_SUBST([AM_V])dnl
96687aef7c3SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96787aef7c3SmrgAC_SUBST([AM_DEFAULT_V])dnl
96887aef7c3SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
969e83ac88aSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
970e83ac88aSmrgAM_BACKSLASH='\'
971e83ac88aSmrgAC_SUBST([AM_BACKSLASH])dnl
972e83ac88aSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
973e83ac88aSmrg])
974e83ac88aSmrg
97548f45e26Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
9767978d3cdSmrg#
9777978d3cdSmrg# This file is free software; the Free Software Foundation
9787978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
9797978d3cdSmrg# with or without modifications, as long as this notice is preserved.
980ea6ae205Smrg
9817978d3cdSmrg# AM_PROG_INSTALL_STRIP
9827978d3cdSmrg# ---------------------
98387aef7c3Smrg# One issue with vendor 'install' (even GNU) is that you can't
9847978d3cdSmrg# specify the program used to strip binaries.  This is especially
9857978d3cdSmrg# annoying in cross-compiling environments, where the build's strip
9867978d3cdSmrg# is unlikely to handle the host's binaries.
9877978d3cdSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98887aef7c3Smrg# always use install-sh in "make install-strip", and initialize
9897978d3cdSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
9907978d3cdSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9917978d3cdSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99287aef7c3Smrg# Installed binaries are usually stripped using 'strip' when the user
99387aef7c3Smrg# run "make install-strip".  However 'strip' might not be the right
9947978d3cdSmrg# tool to use in cross-compilation environments, therefore Automake
99587aef7c3Smrg# will honor the 'STRIP' environment variable to overrule this program.
99687aef7c3Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9977978d3cdSmrgif test "$cross_compiling" != no; then
9987978d3cdSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
9997978d3cdSmrgfi
10007978d3cdSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
10017978d3cdSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1002ea6ae205Smrg
100348f45e26Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
10047978d3cdSmrg#
10057978d3cdSmrg# This file is free software; the Free Software Foundation
10067978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
10077978d3cdSmrg# with or without modifications, as long as this notice is preserved.
1008ea6ae205Smrg
10097978d3cdSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10107978d3cdSmrg# ---------------------------
1011e83ac88aSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10127978d3cdSmrg# This macro is traced by Automake.
10137978d3cdSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1014ea6ae205Smrg
1015e83ac88aSmrg# AM_SUBST_NOTMAKE(VARIABLE)
101687aef7c3Smrg# --------------------------
1017e83ac88aSmrg# Public sister of _AM_SUBST_NOTMAKE.
1018e83ac88aSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1019e83ac88aSmrg
10207978d3cdSmrg# Check how to create a tarball.                            -*- Autoconf -*-
1021ea6ae205Smrg
102248f45e26Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
1023ea6ae205Smrg#
1024ea6ae205Smrg# This file is free software; the Free Software Foundation
1025ea6ae205Smrg# gives unlimited permission to copy and/or distribute it,
1026ea6ae205Smrg# with or without modifications, as long as this notice is preserved.
1027ea6ae205Smrg
10287978d3cdSmrg# _AM_PROG_TAR(FORMAT)
10297978d3cdSmrg# --------------------
10307978d3cdSmrg# Check how to create a tarball in format FORMAT.
103187aef7c3Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10327978d3cdSmrg#
10337978d3cdSmrg# Substitute a variable $(am__tar) that is a command
10347978d3cdSmrg# writing to stdout a FORMAT-tarball containing the directory
10357978d3cdSmrg# $tardir.
10367978d3cdSmrg#     tardir=directory && $(am__tar) > result.tar
10377978d3cdSmrg#
10387978d3cdSmrg# Substitute a variable $(am__untar) that extract such
10397978d3cdSmrg# a tarball read from stdin.
10407978d3cdSmrg#     $(am__untar) < result.tar
104187aef7c3Smrg#
10427978d3cdSmrgAC_DEFUN([_AM_PROG_TAR],
104387aef7c3Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104487aef7c3Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104587aef7c3SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
104687aef7c3Smrg
104787aef7c3Smrg# We'll loop over all known methods to create a tar archive until one works.
10487978d3cdSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10497978d3cdSmrg
105087aef7c3Smrgm4_if([$1], [v7],
105187aef7c3Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
105287aef7c3Smrg
105387aef7c3Smrg  [m4_case([$1],
105487aef7c3Smrg    [ustar],
105587aef7c3Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105687aef7c3Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105787aef7c3Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105887aef7c3Smrg      # and bug#13588).
105987aef7c3Smrg      am_max_uid=2097151 # 2^21 - 1
106087aef7c3Smrg      am_max_gid=$am_max_uid
106187aef7c3Smrg      # The $UID and $GID variables are not portable, so we need to resort
106287aef7c3Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106387aef7c3Smrg      # below are definitely unexpected, so allow the users to see them
106487aef7c3Smrg      # (that is, avoid stderr redirection).
106587aef7c3Smrg      am_uid=`id -u || echo unknown`
106687aef7c3Smrg      am_gid=`id -g || echo unknown`
106787aef7c3Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106887aef7c3Smrg      if test $am_uid -le $am_max_uid; then
106987aef7c3Smrg         AC_MSG_RESULT([yes])
107087aef7c3Smrg      else
107187aef7c3Smrg         AC_MSG_RESULT([no])
107287aef7c3Smrg         _am_tools=none
107387aef7c3Smrg      fi
107487aef7c3Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107587aef7c3Smrg      if test $am_gid -le $am_max_gid; then
107687aef7c3Smrg         AC_MSG_RESULT([yes])
107787aef7c3Smrg      else
107887aef7c3Smrg        AC_MSG_RESULT([no])
107987aef7c3Smrg        _am_tools=none
108087aef7c3Smrg      fi],
108187aef7c3Smrg
108287aef7c3Smrg  [pax],
108387aef7c3Smrg    [],
108487aef7c3Smrg
108587aef7c3Smrg  [m4_fatal([Unknown tar format])])
108687aef7c3Smrg
108787aef7c3Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108887aef7c3Smrg
108987aef7c3Smrg  # Go ahead even if we have the value already cached.  We do so because we
109087aef7c3Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
109187aef7c3Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
109287aef7c3Smrg
109387aef7c3Smrg  for _am_tool in $_am_tools; do
109487aef7c3Smrg    case $_am_tool in
109587aef7c3Smrg    gnutar)
109687aef7c3Smrg      for _am_tar in tar gnutar gtar; do
109787aef7c3Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109887aef7c3Smrg      done
109987aef7c3Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
110087aef7c3Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
110187aef7c3Smrg      am__untar="$_am_tar -xf -"
110287aef7c3Smrg      ;;
110387aef7c3Smrg    plaintar)
110487aef7c3Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110587aef7c3Smrg      # ustar tarball either.
110687aef7c3Smrg      (tar --version) >/dev/null 2>&1 && continue
110787aef7c3Smrg      am__tar='tar chf - "$$tardir"'
110887aef7c3Smrg      am__tar_='tar chf - "$tardir"'
110987aef7c3Smrg      am__untar='tar xf -'
111087aef7c3Smrg      ;;
111187aef7c3Smrg    pax)
111287aef7c3Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111387aef7c3Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111487aef7c3Smrg      am__untar='pax -r'
111587aef7c3Smrg      ;;
111687aef7c3Smrg    cpio)
111787aef7c3Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111887aef7c3Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111987aef7c3Smrg      am__untar='cpio -i -H $1 -d'
112087aef7c3Smrg      ;;
112187aef7c3Smrg    none)
112287aef7c3Smrg      am__tar=false
112387aef7c3Smrg      am__tar_=false
112487aef7c3Smrg      am__untar=false
112587aef7c3Smrg      ;;
112687aef7c3Smrg    esac
11277978d3cdSmrg
112887aef7c3Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112987aef7c3Smrg    # and am__untar set.
113087aef7c3Smrg    test -n "${am_cv_prog_tar_$1}" && break
113187aef7c3Smrg
113287aef7c3Smrg    # tar/untar a dummy directory, and stop if the command works.
113387aef7c3Smrg    rm -rf conftest.dir
113487aef7c3Smrg    mkdir conftest.dir
113587aef7c3Smrg    echo GrepMe > conftest.dir/file
113687aef7c3Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113787aef7c3Smrg    rm -rf conftest.dir
113887aef7c3Smrg    if test -s conftest.tar; then
113987aef7c3Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
114087aef7c3Smrg      AM_RUN_LOG([cat conftest.dir/file])
114187aef7c3Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114287aef7c3Smrg    fi
114387aef7c3Smrg  done
11447978d3cdSmrg  rm -rf conftest.dir
1145ea6ae205Smrg
114687aef7c3Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114787aef7c3Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
114887aef7c3Smrg
11497978d3cdSmrgAC_SUBST([am__tar])
11507978d3cdSmrgAC_SUBST([am__untar])
11517978d3cdSmrg]) # _AM_PROG_TAR
1152ea6ae205Smrg
1153663cdc11Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1154663cdc11Smrg# 
1155663cdc11Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1156663cdc11Smrg#
1157663cdc11Smrg# This program is free software; you can redistribute it and/or modify
1158663cdc11Smrg# it under the terms of the GNU General Public License as published by
1159663cdc11Smrg# the Free Software Foundation; either version 2 of the License, or
1160663cdc11Smrg# (at your option) any later version.
1161663cdc11Smrg#
1162663cdc11Smrg# This program is distributed in the hope that it will be useful, but
1163663cdc11Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1164663cdc11Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1165663cdc11Smrg# General Public License for more details.
1166663cdc11Smrg#
1167663cdc11Smrg# You should have received a copy of the GNU General Public License
1168663cdc11Smrg# along with this program; if not, write to the Free Software
1169663cdc11Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1170663cdc11Smrg#
1171663cdc11Smrg# As a special exception to the GNU General Public License, if you
1172663cdc11Smrg# distribute this file as part of a program that contains a
1173663cdc11Smrg# configuration script generated by Autoconf, you may include it under
1174663cdc11Smrg# the same distribution terms that you use for the rest of that program.
1175663cdc11Smrg
1176663cdc11Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1177663cdc11Smrg# ----------------------------------
1178663cdc11SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1179663cdc11Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1180663cdc11Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1181663cdc11SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1182663cdc11Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1183663cdc11Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1184663cdc11Smrgfi
1185663cdc11Smrgif test -n "$PKG_CONFIG"; then
1186663cdc11Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1187663cdc11Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1188663cdc11Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1189663cdc11Smrg		AC_MSG_RESULT([yes])
1190663cdc11Smrg	else
1191663cdc11Smrg		AC_MSG_RESULT([no])
1192663cdc11Smrg		PKG_CONFIG=""
1193663cdc11Smrg	fi
1194663cdc11Smrg		
1195663cdc11Smrgfi[]dnl
1196663cdc11Smrg])# PKG_PROG_PKG_CONFIG
1197663cdc11Smrg
1198663cdc11Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1199663cdc11Smrg#
1200663cdc11Smrg# Check to see whether a particular set of modules exists.  Similar
1201663cdc11Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1202663cdc11Smrg#
1203663cdc11Smrg#
1204663cdc11Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1205663cdc11Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
1206663cdc11Smrg# PKG_CHECK_EXISTS manually
1207663cdc11Smrg# --------------------------------------------------------------
1208663cdc11SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1209663cdc11Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1210663cdc11Smrgif test -n "$PKG_CONFIG" && \
1211663cdc11Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1212663cdc11Smrg  m4_ifval([$2], [$2], [:])
1213663cdc11Smrgm4_ifvaln([$3], [else
1214663cdc11Smrg  $3])dnl
1215663cdc11Smrgfi])
1216663cdc11Smrg
1217663cdc11Smrg
1218663cdc11Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1219663cdc11Smrg# ---------------------------------------------
1220663cdc11Smrgm4_define([_PKG_CONFIG],
1221663cdc11Smrg[if test -n "$$1"; then
1222663cdc11Smrg    pkg_cv_[]$1="$$1"
1223663cdc11Smrg elif test -n "$PKG_CONFIG"; then
1224663cdc11Smrg    PKG_CHECK_EXISTS([$3],
1225663cdc11Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1226663cdc11Smrg		     [pkg_failed=yes])
1227663cdc11Smrg else
1228663cdc11Smrg    pkg_failed=untried
1229663cdc11Smrgfi[]dnl
1230663cdc11Smrg])# _PKG_CONFIG
1231663cdc11Smrg
1232663cdc11Smrg# _PKG_SHORT_ERRORS_SUPPORTED
1233663cdc11Smrg# -----------------------------
1234663cdc11SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1235663cdc11Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1236663cdc11Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1237663cdc11Smrg        _pkg_short_errors_supported=yes
1238663cdc11Smrgelse
1239663cdc11Smrg        _pkg_short_errors_supported=no
1240663cdc11Smrgfi[]dnl
1241663cdc11Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1242663cdc11Smrg
1243663cdc11Smrg
1244663cdc11Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1245663cdc11Smrg# [ACTION-IF-NOT-FOUND])
1246663cdc11Smrg#
1247663cdc11Smrg#
1248663cdc11Smrg# Note that if there is a possibility the first call to
1249663cdc11Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1250663cdc11Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1251663cdc11Smrg#
1252663cdc11Smrg#
1253663cdc11Smrg# --------------------------------------------------------------
1254663cdc11SmrgAC_DEFUN([PKG_CHECK_MODULES],
1255663cdc11Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1256663cdc11SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1257663cdc11SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1258663cdc11Smrg
1259663cdc11Smrgpkg_failed=no
1260663cdc11SmrgAC_MSG_CHECKING([for $1])
1261663cdc11Smrg
1262663cdc11Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1263663cdc11Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1264663cdc11Smrg
1265663cdc11Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1266663cdc11Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1267663cdc11SmrgSee the pkg-config man page for more details.])
1268663cdc11Smrg
1269663cdc11Smrgif test $pkg_failed = yes; then
1270663cdc11Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1271663cdc11Smrg        if test $_pkg_short_errors_supported = yes; then
1272663cdc11Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1273663cdc11Smrg        else 
1274663cdc11Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1275663cdc11Smrg        fi
1276663cdc11Smrg	# Put the nasty error message in config.log where it belongs
1277663cdc11Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1278663cdc11Smrg
1279663cdc11Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1280663cdc11Smrg[Package requirements ($2) were not met:
1281663cdc11Smrg
1282663cdc11Smrg$$1_PKG_ERRORS
1283663cdc11Smrg
1284663cdc11SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1285663cdc11Smrginstalled software in a non-standard prefix.
1286663cdc11Smrg
1287663cdc11Smrg_PKG_TEXT
1288663cdc11Smrg])],
1289663cdc11Smrg		[AC_MSG_RESULT([no])
1290663cdc11Smrg                $4])
1291663cdc11Smrgelif test $pkg_failed = untried; then
1292663cdc11Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1293663cdc11Smrg[The pkg-config script could not be found or is too old.  Make sure it
1294663cdc11Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1295663cdc11Smrgpath to pkg-config.
1296663cdc11Smrg
1297663cdc11Smrg_PKG_TEXT
1298663cdc11Smrg
1299663cdc11SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1300663cdc11Smrg		[$4])
1301663cdc11Smrgelse
1302663cdc11Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1303663cdc11Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1304663cdc11Smrg        AC_MSG_RESULT([yes])
1305663cdc11Smrg	ifelse([$3], , :, [$3])
1306663cdc11Smrgfi[]dnl
1307663cdc11Smrg])# PKG_CHECK_MODULES
1308663cdc11Smrg
13097978d3cdSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
13107978d3cdSmrgdnl
1311b6f2c9ccSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
131248f45e26Smrgdnl
13137978d3cdSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1314b6f2c9ccSmrgdnl copy of this software and associated documentation files (the "Software"),
1315b6f2c9ccSmrgdnl to deal in the Software without restriction, including without limitation
1316b6f2c9ccSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1317b6f2c9ccSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1318b6f2c9ccSmrgdnl Software is furnished to do so, subject to the following conditions:
13197978d3cdSmrgdnl
1320b6f2c9ccSmrgdnl The above copyright notice and this permission notice (including the next
1321b6f2c9ccSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1322b6f2c9ccSmrgdnl Software.
13237978d3cdSmrgdnl
1324b6f2c9ccSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1325b6f2c9ccSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1326b6f2c9ccSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1327b6f2c9ccSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1328b6f2c9ccSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1329b6f2c9ccSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1330b6f2c9ccSmrgdnl DEALINGS IN THE SOFTWARE.
1331ea6ae205Smrg
13327978d3cdSmrg# XORG_MACROS_VERSION(required-version)
13337978d3cdSmrg# -------------------------------------
13347978d3cdSmrg# Minimum version: 1.1.0
1335ea6ae205Smrg#
13367978d3cdSmrg# If you're using a macro added in Version 1.1 or newer, include this in
13377978d3cdSmrg# your configure.ac with the minimum required version, such as:
13387978d3cdSmrg# XORG_MACROS_VERSION(1.1)
13397978d3cdSmrg#
1340e83ac88aSmrg# To ensure that this macro is defined, also add:
1341e83ac88aSmrg# m4_ifndef([XORG_MACROS_VERSION],
1342e83ac88aSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
13437978d3cdSmrg#
13447978d3cdSmrg#
134548f45e26Smrg# See the "minimum version" comment for each macro you use to see what
13467978d3cdSmrg# version you require.
1347e83ac88aSmrgm4_defun([XORG_MACROS_VERSION],[
134848f45e26Smrgm4_define([vers_have], [1.19.0])
1349e83ac88aSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1350e83ac88aSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1351e83ac88aSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1352e83ac88aSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1353e83ac88aSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1354e83ac88aSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1355e83ac88aSmrgm4_undefine([vers_have])
1356e83ac88aSmrgm4_undefine([maj_have])
1357e83ac88aSmrgm4_undefine([maj_needed])
13587978d3cdSmrg]) # XORG_MACROS_VERSION
1359ea6ae205Smrg
13607978d3cdSmrg# XORG_PROG_RAWCPP()
13617978d3cdSmrg# ------------------
13627978d3cdSmrg# Minimum version: 1.0.0
13637978d3cdSmrg#
13647978d3cdSmrg# Find cpp program and necessary flags for use in pre-processing text files
13657978d3cdSmrg# such as man pages and config files
13667978d3cdSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
13677978d3cdSmrgAC_REQUIRE([AC_PROG_CPP])
136848f45e26SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
13697978d3cdSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1370ea6ae205Smrg
13717978d3cdSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
13727978d3cdSmrg# which is not the best choice for supporting other OS'es, but covers most
13737978d3cdSmrg# of the ones we need for now.
13747978d3cdSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1375245f6787SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
13767978d3cdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13777978d3cdSmrg	AC_MSG_RESULT([no])
13787978d3cdSmrgelse
13797978d3cdSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13807978d3cdSmrg		RAWCPPFLAGS=-undef
13817978d3cdSmrg		AC_MSG_RESULT([yes])
13827978d3cdSmrg	# under Cygwin unix is still defined even with -undef
13837978d3cdSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13847978d3cdSmrg		RAWCPPFLAGS="-undef -ansi"
13857978d3cdSmrg		AC_MSG_RESULT([yes, with -ansi])
13867978d3cdSmrg	else
13877978d3cdSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
13887978d3cdSmrg	fi
13897978d3cdSmrgfi
13907978d3cdSmrgrm -f conftest.$ac_ext
1391ea6ae205Smrg
13927978d3cdSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1393245f6787SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
13947978d3cdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
13957978d3cdSmrg	AC_MSG_RESULT([no])
13967978d3cdSmrgelse
13977978d3cdSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
139848f45e26Smrg		TRADITIONALCPPFLAGS="-traditional"
13997978d3cdSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
14007978d3cdSmrg		AC_MSG_RESULT([yes])
14017978d3cdSmrg	else
14027978d3cdSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
14037978d3cdSmrg	fi
14047978d3cdSmrgfi
14057978d3cdSmrgrm -f conftest.$ac_ext
14067978d3cdSmrgAC_SUBST(RAWCPPFLAGS)
140748f45e26SmrgAC_SUBST(TRADITIONALCPPFLAGS)
14087978d3cdSmrg]) # XORG_PROG_RAWCPP
1409ea6ae205Smrg
14107978d3cdSmrg# XORG_MANPAGE_SECTIONS()
14117978d3cdSmrg# -----------------------
14127978d3cdSmrg# Minimum version: 1.0.0
1413ea6ae205Smrg#
14147978d3cdSmrg# Determine which sections man pages go in for the different man page types
14157978d3cdSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
14167978d3cdSmrg# Not sure if there's any better way than just hardcoding by OS name.
14177978d3cdSmrg# Override default settings by setting environment variables
1418b6f2c9ccSmrg# Added MAN_SUBSTS in version 1.8
1419b6f2c9ccSmrg# Added AC_PROG_SED in version 1.8
1420ea6ae205Smrg
14217978d3cdSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
14227978d3cdSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1423b6f2c9ccSmrgAC_REQUIRE([AC_PROG_SED])
1424ea6ae205Smrg
14257978d3cdSmrgif test x$APP_MAN_SUFFIX = x    ; then
14267978d3cdSmrg    APP_MAN_SUFFIX=1
14277978d3cdSmrgfi
14287978d3cdSmrgif test x$APP_MAN_DIR = x    ; then
14297978d3cdSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1430ea6ae205Smrgfi
1431ea6ae205Smrg
14327978d3cdSmrgif test x$LIB_MAN_SUFFIX = x    ; then
14337978d3cdSmrg    LIB_MAN_SUFFIX=3
14347978d3cdSmrgfi
14357978d3cdSmrgif test x$LIB_MAN_DIR = x    ; then
14367978d3cdSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1437ea6ae205Smrgfi
1438ea6ae205Smrg
14397978d3cdSmrgif test x$FILE_MAN_SUFFIX = x    ; then
14407978d3cdSmrg    case $host_os in
14417978d3cdSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
14427978d3cdSmrg	*)		FILE_MAN_SUFFIX=5  ;;
14437978d3cdSmrg    esac
14447978d3cdSmrgfi
14457978d3cdSmrgif test x$FILE_MAN_DIR = x    ; then
14467978d3cdSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
14477978d3cdSmrgfi
1448ea6ae205Smrg
14497978d3cdSmrgif test x$MISC_MAN_SUFFIX = x    ; then
14507978d3cdSmrg    case $host_os in
14517978d3cdSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
14527978d3cdSmrg	*)		MISC_MAN_SUFFIX=7  ;;
14537978d3cdSmrg    esac
14547978d3cdSmrgfi
14557978d3cdSmrgif test x$MISC_MAN_DIR = x    ; then
14567978d3cdSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
14577978d3cdSmrgfi
1458ea6ae205Smrg
14597978d3cdSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
14607978d3cdSmrg    case $host_os in
14617978d3cdSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
14627978d3cdSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
14637978d3cdSmrg    esac
14647978d3cdSmrgfi
14657978d3cdSmrgif test x$DRIVER_MAN_DIR = x    ; then
14667978d3cdSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
14677978d3cdSmrgfi
1468ea6ae205Smrg
14697978d3cdSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
14707978d3cdSmrg    case $host_os in
14717978d3cdSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
14727978d3cdSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
14737978d3cdSmrg    esac
14747978d3cdSmrgfi
14757978d3cdSmrgif test x$ADMIN_MAN_DIR = x    ; then
14767978d3cdSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
14777978d3cdSmrgfi
1478ea6ae205Smrg
1479ea6ae205Smrg
14807978d3cdSmrgAC_SUBST([APP_MAN_SUFFIX])
14817978d3cdSmrgAC_SUBST([LIB_MAN_SUFFIX])
14827978d3cdSmrgAC_SUBST([FILE_MAN_SUFFIX])
14837978d3cdSmrgAC_SUBST([MISC_MAN_SUFFIX])
14847978d3cdSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
14857978d3cdSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
14867978d3cdSmrgAC_SUBST([APP_MAN_DIR])
14877978d3cdSmrgAC_SUBST([LIB_MAN_DIR])
14887978d3cdSmrgAC_SUBST([FILE_MAN_DIR])
14897978d3cdSmrgAC_SUBST([MISC_MAN_DIR])
14907978d3cdSmrgAC_SUBST([DRIVER_MAN_DIR])
14917978d3cdSmrgAC_SUBST([ADMIN_MAN_DIR])
1492b6f2c9ccSmrg
1493b6f2c9ccSmrgXORG_MAN_PAGE="X Version 11"
1494b6f2c9ccSmrgAC_SUBST([XORG_MAN_PAGE])
1495b6f2c9ccSmrgMAN_SUBSTS="\
1496b6f2c9ccSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1497b6f2c9ccSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1498b6f2c9ccSmrg	-e 's|__xservername__|Xorg|g' \
1499b6f2c9ccSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1500b6f2c9ccSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1501b6f2c9ccSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1502b6f2c9ccSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1503b6f2c9ccSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1504b6f2c9ccSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1505b6f2c9ccSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1506b6f2c9ccSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1507b6f2c9ccSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1508b6f2c9ccSmrgAC_SUBST([MAN_SUBSTS])
1509b6f2c9ccSmrg
15107978d3cdSmrg]) # XORG_MANPAGE_SECTIONS
1511ea6ae205Smrg
1512b6f2c9ccSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1513b6f2c9ccSmrg# ------------------------
1514b6f2c9ccSmrg# Minimum version: 1.7.0
1515b6f2c9ccSmrg#
1516b6f2c9ccSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1517b6f2c9ccSmrg# provided by xorg-sgml-doctools, if installed.
1518b6f2c9ccSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1519b6f2c9ccSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1520b6f2c9ccSmrgXORG_SGML_PATH=
1521b6f2c9ccSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1522b6f2c9ccSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1523b6f2c9ccSmrg    [m4_ifval([$1],[:],
1524b6f2c9ccSmrg        [if test x"$cross_compiling" != x"yes" ; then
1525b6f2c9ccSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1526b6f2c9ccSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1527b6f2c9ccSmrg         fi])
1528b6f2c9ccSmrg    ])
1529b6f2c9ccSmrg
1530b6f2c9ccSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1531b6f2c9ccSmrg# the path and the name of the doc stylesheet
1532b6f2c9ccSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1533b6f2c9ccSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1534b6f2c9ccSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1535b6f2c9ccSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1536b6f2c9ccSmrgelse
1537b6f2c9ccSmrg   AC_MSG_RESULT([no])
1538b6f2c9ccSmrgfi
1539b6f2c9ccSmrg
1540b6f2c9ccSmrgAC_SUBST(XORG_SGML_PATH)
1541b6f2c9ccSmrgAC_SUBST(STYLESHEET_SRCDIR)
1542b6f2c9ccSmrgAC_SUBST(XSL_STYLESHEET)
1543b6f2c9ccSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1544b6f2c9ccSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1545b6f2c9ccSmrg
15467978d3cdSmrg# XORG_CHECK_LINUXDOC
15477978d3cdSmrg# -------------------
15487978d3cdSmrg# Minimum version: 1.0.0
1549ea6ae205Smrg#
15507978d3cdSmrg# Defines the variable MAKE_TEXT if the necessary tools and
15517978d3cdSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
15527978d3cdSmrg# Whether or not the necessary tools and files are found can be checked
15537978d3cdSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
15547978d3cdSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1555b6f2c9ccSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1556b6f2c9ccSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1557ea6ae205Smrg
15587978d3cdSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1559ea6ae205Smrg
1560b6f2c9ccSmrgAC_MSG_CHECKING([whether to build documentation])
1561ea6ae205Smrg
1562b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
15637978d3cdSmrg   BUILDDOC=yes
1564ea6ae205Smrgelse
15657978d3cdSmrg   BUILDDOC=no
1566ea6ae205Smrgfi
1567ea6ae205Smrg
15687978d3cdSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1569ea6ae205Smrg
15707978d3cdSmrgAC_MSG_RESULT([$BUILDDOC])
1571ea6ae205Smrg
1572b6f2c9ccSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1573ea6ae205Smrg
1574b6f2c9ccSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
15757978d3cdSmrg   BUILDPDFDOC=yes
15767978d3cdSmrgelse
15777978d3cdSmrg   BUILDPDFDOC=no
15787978d3cdSmrgfi
1579ea6ae205Smrg
15807978d3cdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1581ea6ae205Smrg
15827978d3cdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1583ea6ae205Smrg
1584b6f2c9ccSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
15857978d3cdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
15867978d3cdSmrgMAKE_PDF="$PS2PDF"
15877978d3cdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1588ea6ae205Smrg
15897978d3cdSmrgAC_SUBST(MAKE_TEXT)
15907978d3cdSmrgAC_SUBST(MAKE_PS)
15917978d3cdSmrgAC_SUBST(MAKE_PDF)
15927978d3cdSmrgAC_SUBST(MAKE_HTML)
15937978d3cdSmrg]) # XORG_CHECK_LINUXDOC
1594ea6ae205Smrg
15957978d3cdSmrg# XORG_CHECK_DOCBOOK
15967978d3cdSmrg# -------------------
15977978d3cdSmrg# Minimum version: 1.0.0
15987978d3cdSmrg#
15997978d3cdSmrg# Checks for the ability to build output formats from SGML DocBook source.
16007978d3cdSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16017978d3cdSmrg# indicates whether the necessary tools and files are found and, if set,
16027978d3cdSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16037978d3cdSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1604b6f2c9ccSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1605b6f2c9ccSmrg
16067978d3cdSmrgBUILDTXTDOC=no
16077978d3cdSmrgBUILDPDFDOC=no
16087978d3cdSmrgBUILDPSDOC=no
16097978d3cdSmrgBUILDHTMLDOC=no
1610ea6ae205Smrg
16117978d3cdSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16127978d3cdSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16137978d3cdSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16147978d3cdSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1615ea6ae205Smrg
1616b6f2c9ccSmrgAC_MSG_CHECKING([whether to build text documentation])
1617b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16187978d3cdSmrg   test x$BUILD_TXTDOC != xno; then
16197978d3cdSmrg	BUILDTXTDOC=yes
16207978d3cdSmrgfi
16217978d3cdSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16227978d3cdSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1623ea6ae205Smrg
1624b6f2c9ccSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1625b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16267978d3cdSmrg   test x$BUILD_PDFDOC != xno; then
16277978d3cdSmrg	BUILDPDFDOC=yes
16287978d3cdSmrgfi
16297978d3cdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16307978d3cdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1631ea6ae205Smrg
1632b6f2c9ccSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1633b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
16347978d3cdSmrg   test x$BUILD_PSDOC != xno; then
16357978d3cdSmrg	BUILDPSDOC=yes
16367978d3cdSmrgfi
16377978d3cdSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
16387978d3cdSmrgAC_MSG_RESULT([$BUILDPSDOC])
1639ea6ae205Smrg
1640b6f2c9ccSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1641b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
16427978d3cdSmrg   test x$BUILD_HTMLDOC != xno; then
16437978d3cdSmrg	BUILDHTMLDOC=yes
1644ea6ae205Smrgfi
16457978d3cdSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
16467978d3cdSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1647ea6ae205Smrg
16487978d3cdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
16497978d3cdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
16507978d3cdSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
16517978d3cdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1652ea6ae205Smrg
16537978d3cdSmrgAC_SUBST(MAKE_TEXT)
16547978d3cdSmrgAC_SUBST(MAKE_PS)
16557978d3cdSmrgAC_SUBST(MAKE_PDF)
16567978d3cdSmrgAC_SUBST(MAKE_HTML)
16577978d3cdSmrg]) # XORG_CHECK_DOCBOOK
1658ea6ae205Smrg
1659b6f2c9ccSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1660b6f2c9ccSmrg# ----------------
1661b6f2c9ccSmrg# Minimum version: 1.5.0
1662b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1663b6f2c9ccSmrg#
1664b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
1665b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
1666b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1667b6f2c9ccSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1668b6f2c9ccSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1669b6f2c9ccSmrg# --with-xmlto assumes 'auto'.
1670b6f2c9ccSmrg#
1671b6f2c9ccSmrg# Interface to module:
1672b6f2c9ccSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1673b6f2c9ccSmrg# XMLTO:	returns the path of the xmlto program found
1674b6f2c9ccSmrg#		returns the path set by the user in the environment
1675b6f2c9ccSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1676b6f2c9ccSmrg#		'no' user instructs the module not to use xmlto
1677b6f2c9ccSmrg#
1678b6f2c9ccSmrg# Added in version 1.10.0
1679b6f2c9ccSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1680b6f2c9ccSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1681b6f2c9ccSmrg#
1682b6f2c9ccSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1683b6f2c9ccSmrg#
1684b6f2c9ccSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1685b6f2c9ccSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1686b6f2c9ccSmrgm4_define([_defopt], m4_default([$2], [auto]))
1687b6f2c9ccSmrgAC_ARG_WITH(xmlto,
1688b6f2c9ccSmrg	AS_HELP_STRING([--with-xmlto],
1689b6f2c9ccSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1690b6f2c9ccSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1691b6f2c9ccSmrgm4_undefine([_defopt])
1692b6f2c9ccSmrg
1693b6f2c9ccSmrgif test "x$use_xmlto" = x"auto"; then
1694b6f2c9ccSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1695b6f2c9ccSmrg   if test "x$XMLTO" = "x"; then
1696b6f2c9ccSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1697b6f2c9ccSmrg	have_xmlto=no
1698b6f2c9ccSmrg   else
1699b6f2c9ccSmrg        have_xmlto=yes
1700b6f2c9ccSmrg   fi
1701b6f2c9ccSmrgelif test "x$use_xmlto" = x"yes" ; then
1702b6f2c9ccSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1703b6f2c9ccSmrg   if test "x$XMLTO" = "x"; then
1704b6f2c9ccSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1705b6f2c9ccSmrg   fi
1706b6f2c9ccSmrg   have_xmlto=yes
1707b6f2c9ccSmrgelif test "x$use_xmlto" = x"no" ; then
1708b6f2c9ccSmrg   if test "x$XMLTO" != "x"; then
1709b6f2c9ccSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1710b6f2c9ccSmrg   fi
1711b6f2c9ccSmrg   have_xmlto=no
1712b6f2c9ccSmrgelse
1713b6f2c9ccSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1714b6f2c9ccSmrgfi
1715b6f2c9ccSmrg
1716b6f2c9ccSmrg# Test for a minimum version of xmlto, if provided.
1717b6f2c9ccSmrgm4_ifval([$1],
1718b6f2c9ccSmrg[if test "$have_xmlto" = yes; then
1719b6f2c9ccSmrg    # scrape the xmlto version
1720b6f2c9ccSmrg    AC_MSG_CHECKING([the xmlto version])
1721b6f2c9ccSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1722b6f2c9ccSmrg    AC_MSG_RESULT([$xmlto_version])
1723b6f2c9ccSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1724b6f2c9ccSmrg        [if test "x$use_xmlto" = xauto; then
1725b6f2c9ccSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1726b6f2c9ccSmrg            have_xmlto=no
1727b6f2c9ccSmrg        else
1728b6f2c9ccSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1729b6f2c9ccSmrg        fi])
1730b6f2c9ccSmrgfi])
1731b6f2c9ccSmrg
1732b6f2c9ccSmrg# Test for the ability of xmlto to generate a text target
1733b6f2c9ccSmrghave_xmlto_text=no
1734b6f2c9ccSmrgcat > conftest.xml << "EOF"
1735b6f2c9ccSmrgEOF
1736b6f2c9ccSmrgAS_IF([test "$have_xmlto" = yes],
1737b6f2c9ccSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1738b6f2c9ccSmrg             [have_xmlto_text=yes],
1739b6f2c9ccSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1740b6f2c9ccSmrgrm -f conftest.xml
1741b6f2c9ccSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1742b6f2c9ccSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1743b6f2c9ccSmrg]) # XORG_WITH_XMLTO
1744b6f2c9ccSmrg
1745245f6787Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1746245f6787Smrg# --------------------------------------------
1747245f6787Smrg# Minimum version: 1.12.0
1748245f6787Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1749245f6787Smrg#
1750245f6787Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1751245f6787Smrg# XML-based language used for the transformation of XML documents.
1752245f6787Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1753245f6787Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1754245f6787Smrg# The XSLT processor is often used as a standalone tool for transformations.
1755245f6787Smrg# It should not be assumed that this tool is used only to work with documnetation.
1756245f6787Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1757245f6787Smrg#
1758245f6787Smrg# Interface to module:
1759245f6787Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1760245f6787Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1761245f6787Smrg#		 returns the path set by the user in the environment
1762245f6787Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1763245f6787Smrg#		  'no' user instructs the module not to use xsltproc
1764245f6787Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1765245f6787Smrg#
1766245f6787Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1767245f6787Smrg#
1768245f6787SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1769245f6787SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1770245f6787Smrg# Preserves the interface, should it be implemented later
1771245f6787Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1772245f6787Smrgm4_define([_defopt], m4_default([$2], [auto]))
1773245f6787SmrgAC_ARG_WITH(xsltproc,
1774245f6787Smrg	AS_HELP_STRING([--with-xsltproc],
1775245f6787Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1776245f6787Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1777245f6787Smrgm4_undefine([_defopt])
1778245f6787Smrg
1779245f6787Smrgif test "x$use_xsltproc" = x"auto"; then
1780245f6787Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1781245f6787Smrg   if test "x$XSLTPROC" = "x"; then
1782245f6787Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1783245f6787Smrg	have_xsltproc=no
1784245f6787Smrg   else
1785245f6787Smrg        have_xsltproc=yes
1786245f6787Smrg   fi
1787245f6787Smrgelif test "x$use_xsltproc" = x"yes" ; then
1788245f6787Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1789245f6787Smrg   if test "x$XSLTPROC" = "x"; then
1790245f6787Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1791245f6787Smrg   fi
1792245f6787Smrg   have_xsltproc=yes
1793245f6787Smrgelif test "x$use_xsltproc" = x"no" ; then
1794245f6787Smrg   if test "x$XSLTPROC" != "x"; then
1795245f6787Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1796245f6787Smrg   fi
1797245f6787Smrg   have_xsltproc=no
1798245f6787Smrgelse
1799245f6787Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1800245f6787Smrgfi
1801245f6787Smrg
1802245f6787SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1803245f6787Smrg]) # XORG_WITH_XSLTPROC
1804245f6787Smrg
1805245f6787Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1806245f6787Smrg# ----------------------------------------
1807245f6787Smrg# Minimum version: 1.15.0
1808245f6787Smrg#
1809245f6787Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1810245f6787Smrg# scanning arbitrary text files, extracting information from those text files,
1811245f6787Smrg# and printing reports based on that information.
1812245f6787Smrg#
1813245f6787Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1814245f6787Smrg#
1815245f6787Smrg# Interface to module:
1816245f6787Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1817245f6787Smrg# PERL:	     returns the path of the perl program found
1818245f6787Smrg#	     returns the path set by the user in the environment
1819245f6787Smrg# --with-perl: 'yes' user instructs the module to use perl
1820245f6787Smrg#	       'no' user instructs the module not to use perl
1821245f6787Smrg# have_perl: returns yes if perl found in PATH or no
1822245f6787Smrg#
1823245f6787Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1824245f6787Smrg#
1825245f6787SmrgAC_DEFUN([XORG_WITH_PERL],[
1826245f6787SmrgAC_ARG_VAR([PERL], [Path to perl command])
1827245f6787Smrg# Preserves the interface, should it be implemented later
1828245f6787Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1829245f6787Smrgm4_define([_defopt], m4_default([$2], [auto]))
1830245f6787SmrgAC_ARG_WITH(perl,
1831245f6787Smrg	AS_HELP_STRING([--with-perl],
1832245f6787Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1833245f6787Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1834245f6787Smrgm4_undefine([_defopt])
1835245f6787Smrg
1836245f6787Smrgif test "x$use_perl" = x"auto"; then
1837245f6787Smrg   AC_PATH_PROG([PERL], [perl])
1838245f6787Smrg   if test "x$PERL" = "x"; then
1839245f6787Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1840245f6787Smrg	have_perl=no
1841245f6787Smrg   else
1842245f6787Smrg        have_perl=yes
1843245f6787Smrg   fi
1844245f6787Smrgelif test "x$use_perl" = x"yes" ; then
1845245f6787Smrg   AC_PATH_PROG([PERL], [perl])
1846245f6787Smrg   if test "x$PERL" = "x"; then
1847245f6787Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1848245f6787Smrg   fi
1849245f6787Smrg   have_perl=yes
1850245f6787Smrgelif test "x$use_perl" = x"no" ; then
1851245f6787Smrg   if test "x$PERL" != "x"; then
1852245f6787Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1853245f6787Smrg   fi
1854245f6787Smrg   have_perl=no
1855245f6787Smrgelse
1856245f6787Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1857245f6787Smrgfi
1858245f6787Smrg
1859245f6787SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1860245f6787Smrg]) # XORG_WITH_PERL
1861245f6787Smrg
1862b6f2c9ccSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1863b6f2c9ccSmrg# ----------------
1864b6f2c9ccSmrg# Minimum version: 1.5.0
1865b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1866b6f2c9ccSmrg#
1867b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
1868b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
1869b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1870b6f2c9ccSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1871b6f2c9ccSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1872b6f2c9ccSmrg# --with-asciidoc assumes 'auto'.
1873b6f2c9ccSmrg#
1874b6f2c9ccSmrg# Interface to module:
1875b6f2c9ccSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1876b6f2c9ccSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1877b6f2c9ccSmrg#		 returns the path set by the user in the environment
1878b6f2c9ccSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1879b6f2c9ccSmrg#		  'no' user instructs the module not to use asciidoc
1880b6f2c9ccSmrg#
1881b6f2c9ccSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1882b6f2c9ccSmrg#
1883b6f2c9ccSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1884b6f2c9ccSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1885b6f2c9ccSmrgm4_define([_defopt], m4_default([$2], [auto]))
1886b6f2c9ccSmrgAC_ARG_WITH(asciidoc,
1887b6f2c9ccSmrg	AS_HELP_STRING([--with-asciidoc],
1888b6f2c9ccSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1889b6f2c9ccSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1890b6f2c9ccSmrgm4_undefine([_defopt])
1891b6f2c9ccSmrg
1892b6f2c9ccSmrgif test "x$use_asciidoc" = x"auto"; then
1893b6f2c9ccSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1894b6f2c9ccSmrg   if test "x$ASCIIDOC" = "x"; then
1895b6f2c9ccSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1896b6f2c9ccSmrg	have_asciidoc=no
1897b6f2c9ccSmrg   else
1898b6f2c9ccSmrg        have_asciidoc=yes
1899b6f2c9ccSmrg   fi
1900b6f2c9ccSmrgelif test "x$use_asciidoc" = x"yes" ; then
1901b6f2c9ccSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1902b6f2c9ccSmrg   if test "x$ASCIIDOC" = "x"; then
1903b6f2c9ccSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1904b6f2c9ccSmrg   fi
1905b6f2c9ccSmrg   have_asciidoc=yes
1906b6f2c9ccSmrgelif test "x$use_asciidoc" = x"no" ; then
1907b6f2c9ccSmrg   if test "x$ASCIIDOC" != "x"; then
1908b6f2c9ccSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1909b6f2c9ccSmrg   fi
1910b6f2c9ccSmrg   have_asciidoc=no
1911b6f2c9ccSmrgelse
1912b6f2c9ccSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1913b6f2c9ccSmrgfi
1914b6f2c9ccSmrgm4_ifval([$1],
1915b6f2c9ccSmrg[if test "$have_asciidoc" = yes; then
1916b6f2c9ccSmrg    # scrape the asciidoc version
1917b6f2c9ccSmrg    AC_MSG_CHECKING([the asciidoc version])
1918b6f2c9ccSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1919b6f2c9ccSmrg    AC_MSG_RESULT([$asciidoc_version])
1920b6f2c9ccSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1921b6f2c9ccSmrg        [if test "x$use_asciidoc" = xauto; then
1922b6f2c9ccSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1923b6f2c9ccSmrg            have_asciidoc=no
1924b6f2c9ccSmrg        else
1925b6f2c9ccSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1926b6f2c9ccSmrg        fi])
1927b6f2c9ccSmrgfi])
1928b6f2c9ccSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1929b6f2c9ccSmrg]) # XORG_WITH_ASCIIDOC
1930b6f2c9ccSmrg
1931b6f2c9ccSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
193248f45e26Smrg# -------------------------------------------
1933b6f2c9ccSmrg# Minimum version: 1.5.0
1934b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
193548f45e26Smrg# Minimum version for optional DOT checking: 1.18.0
1936b6f2c9ccSmrg#
1937b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
1938b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
1939b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1940b6f2c9ccSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1941b6f2c9ccSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1942b6f2c9ccSmrg# --with-doxygen assumes 'auto'.
1943b6f2c9ccSmrg#
1944b6f2c9ccSmrg# Interface to module:
1945b6f2c9ccSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1946b6f2c9ccSmrg# DOXYGEN:	 returns the path of the doxygen program found
1947b6f2c9ccSmrg#		 returns the path set by the user in the environment
1948b6f2c9ccSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1949b6f2c9ccSmrg#		  'no' user instructs the module not to use doxygen
1950b6f2c9ccSmrg#
1951b6f2c9ccSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1952b6f2c9ccSmrg#
1953b6f2c9ccSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1954b6f2c9ccSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
195548f45e26SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
1956b6f2c9ccSmrgm4_define([_defopt], m4_default([$2], [auto]))
1957b6f2c9ccSmrgAC_ARG_WITH(doxygen,
1958b6f2c9ccSmrg	AS_HELP_STRING([--with-doxygen],
1959b6f2c9ccSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1960b6f2c9ccSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1961b6f2c9ccSmrgm4_undefine([_defopt])
1962b6f2c9ccSmrg
1963b6f2c9ccSmrgif test "x$use_doxygen" = x"auto"; then
1964b6f2c9ccSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1965b6f2c9ccSmrg   if test "x$DOXYGEN" = "x"; then
1966b6f2c9ccSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1967b6f2c9ccSmrg	have_doxygen=no
1968b6f2c9ccSmrg   else
1969b6f2c9ccSmrg        have_doxygen=yes
1970b6f2c9ccSmrg   fi
1971b6f2c9ccSmrgelif test "x$use_doxygen" = x"yes" ; then
1972b6f2c9ccSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1973b6f2c9ccSmrg   if test "x$DOXYGEN" = "x"; then
1974b6f2c9ccSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1975b6f2c9ccSmrg   fi
1976b6f2c9ccSmrg   have_doxygen=yes
1977b6f2c9ccSmrgelif test "x$use_doxygen" = x"no" ; then
1978b6f2c9ccSmrg   if test "x$DOXYGEN" != "x"; then
1979b6f2c9ccSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1980b6f2c9ccSmrg   fi
1981b6f2c9ccSmrg   have_doxygen=no
1982b6f2c9ccSmrgelse
1983b6f2c9ccSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1984b6f2c9ccSmrgfi
1985b6f2c9ccSmrgm4_ifval([$1],
1986b6f2c9ccSmrg[if test "$have_doxygen" = yes; then
1987b6f2c9ccSmrg    # scrape the doxygen version
1988b6f2c9ccSmrg    AC_MSG_CHECKING([the doxygen version])
1989b6f2c9ccSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1990b6f2c9ccSmrg    AC_MSG_RESULT([$doxygen_version])
1991b6f2c9ccSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1992b6f2c9ccSmrg        [if test "x$use_doxygen" = xauto; then
1993b6f2c9ccSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1994b6f2c9ccSmrg            have_doxygen=no
1995b6f2c9ccSmrg        else
1996b6f2c9ccSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1997b6f2c9ccSmrg        fi])
1998b6f2c9ccSmrgfi])
199948f45e26Smrg
200048f45e26Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
200148f45e26Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
200248f45e26Smrgdnl 	HAVE_DOT = @HAVE_DOT@
200348f45e26SmrgHAVE_DOT=no
200448f45e26Smrgif test "x$have_doxygen" = "xyes"; then
200548f45e26Smrg  AC_PATH_PROG([DOT], [dot])
200648f45e26Smrg    if test "x$DOT" != "x"; then
200748f45e26Smrg      HAVE_DOT=yes
200848f45e26Smrg    fi
200948f45e26Smrgfi
201048f45e26Smrg
201148f45e26SmrgAC_SUBST([HAVE_DOT])
201248f45e26SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2013b6f2c9ccSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2014b6f2c9ccSmrg]) # XORG_WITH_DOXYGEN
2015b6f2c9ccSmrg
2016b6f2c9ccSmrg# XORG_WITH_GROFF([DEFAULT])
2017b6f2c9ccSmrg# ----------------
2018b6f2c9ccSmrg# Minimum version: 1.6.0
2019b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2020b6f2c9ccSmrg#
2021b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
2022b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
2023b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2024b6f2c9ccSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2025b6f2c9ccSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2026b6f2c9ccSmrg# --with-groff assumes 'auto'.
2027b6f2c9ccSmrg#
2028b6f2c9ccSmrg# Interface to module:
2029b6f2c9ccSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2030b6f2c9ccSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2031b6f2c9ccSmrg# HAVE_GROFF_MS: the -ms macros package
2032b6f2c9ccSmrg# GROFF:	 returns the path of the groff program found
2033b6f2c9ccSmrg#		 returns the path set by the user in the environment
2034b6f2c9ccSmrg# --with-groff:	 'yes' user instructs the module to use groff
2035b6f2c9ccSmrg#		 'no' user instructs the module not to use groff
2036b6f2c9ccSmrg#
2037b6f2c9ccSmrg# Added in version 1.9.0:
2038b6f2c9ccSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2039b6f2c9ccSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2040b6f2c9ccSmrg#		   psselect from the psutils package.
2041b6f2c9ccSmrg#		   the ghostcript package. Refer to the grohtml man pages
2042b6f2c9ccSmrg#
2043b6f2c9ccSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2044b6f2c9ccSmrg#
2045b6f2c9ccSmrg# OS and distros often splits groff in a basic and full package, the former
2046b6f2c9ccSmrg# having the groff program and the later having devices, fonts and macros
2047b6f2c9ccSmrg# Checking for the groff executable is not enough.
2048b6f2c9ccSmrg#
2049b6f2c9ccSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2050b6f2c9ccSmrg# unset HAVE_GROFF or GROFF env variables.
2051b6f2c9ccSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2052b6f2c9ccSmrg#
2053b6f2c9ccSmrgAC_DEFUN([XORG_WITH_GROFF],[
2054b6f2c9ccSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2055b6f2c9ccSmrgm4_define([_defopt], m4_default([$1], [auto]))
2056b6f2c9ccSmrgAC_ARG_WITH(groff,
2057b6f2c9ccSmrg	AS_HELP_STRING([--with-groff],
2058b6f2c9ccSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2059b6f2c9ccSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2060b6f2c9ccSmrgm4_undefine([_defopt])
2061b6f2c9ccSmrg
2062b6f2c9ccSmrgif test "x$use_groff" = x"auto"; then
2063b6f2c9ccSmrg   AC_PATH_PROG([GROFF], [groff])
2064b6f2c9ccSmrg   if test "x$GROFF" = "x"; then
2065b6f2c9ccSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2066b6f2c9ccSmrg	have_groff=no
2067b6f2c9ccSmrg   else
2068b6f2c9ccSmrg        have_groff=yes
2069b6f2c9ccSmrg   fi
2070b6f2c9ccSmrgelif test "x$use_groff" = x"yes" ; then
2071b6f2c9ccSmrg   AC_PATH_PROG([GROFF], [groff])
2072b6f2c9ccSmrg   if test "x$GROFF" = "x"; then
2073b6f2c9ccSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2074b6f2c9ccSmrg   fi
2075b6f2c9ccSmrg   have_groff=yes
2076b6f2c9ccSmrgelif test "x$use_groff" = x"no" ; then
2077b6f2c9ccSmrg   if test "x$GROFF" != "x"; then
2078b6f2c9ccSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2079b6f2c9ccSmrg   fi
2080b6f2c9ccSmrg   have_groff=no
2081b6f2c9ccSmrgelse
2082b6f2c9ccSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2083b6f2c9ccSmrgfi
2084b6f2c9ccSmrg
2085b6f2c9ccSmrg# We have groff, test for the presence of the macro packages
2086b6f2c9ccSmrgif test "x$have_groff" = x"yes"; then
2087b6f2c9ccSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2088b6f2c9ccSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2089b6f2c9ccSmrg        groff_ms_works=yes
2090b6f2c9ccSmrg    else
2091b6f2c9ccSmrg        groff_ms_works=no
2092b6f2c9ccSmrg    fi
2093b6f2c9ccSmrg    AC_MSG_RESULT([$groff_ms_works])
2094b6f2c9ccSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2095b6f2c9ccSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2096b6f2c9ccSmrg        groff_mm_works=yes
2097b6f2c9ccSmrg    else
2098b6f2c9ccSmrg        groff_mm_works=no
2099b6f2c9ccSmrg    fi
2100b6f2c9ccSmrg    AC_MSG_RESULT([$groff_mm_works])
2101b6f2c9ccSmrgfi
2102b6f2c9ccSmrg
2103b6f2c9ccSmrg# We have groff, test for HTML dependencies, one command per package
2104b6f2c9ccSmrgif test "x$have_groff" = x"yes"; then
2105b6f2c9ccSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2106b6f2c9ccSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2107b6f2c9ccSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2108b6f2c9ccSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2109b6f2c9ccSmrg      have_groff_html=yes
2110b6f2c9ccSmrg   else
2111b6f2c9ccSmrg      have_groff_html=no
2112b6f2c9ccSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2113b6f2c9ccSmrg   fi
2114b6f2c9ccSmrgfi
2115b6f2c9ccSmrg
2116b6f2c9ccSmrg# Set Automake conditionals for Makefiles
2117b6f2c9ccSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2118b6f2c9ccSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2119b6f2c9ccSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2120b6f2c9ccSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2121b6f2c9ccSmrg]) # XORG_WITH_GROFF
2122b6f2c9ccSmrg
2123245f6787Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2124245f6787Smrg# ---------------------------------------
2125b6f2c9ccSmrg# Minimum version: 1.6.0
2126b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2127245f6787Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2128b6f2c9ccSmrg#
2129b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
2130b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
2131b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2132b6f2c9ccSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2133b6f2c9ccSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2134b6f2c9ccSmrg# --with-fop assumes 'auto'.
2135b6f2c9ccSmrg#
2136b6f2c9ccSmrg# Interface to module:
2137b6f2c9ccSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2138b6f2c9ccSmrg# FOP:	 	returns the path of the fop program found
2139b6f2c9ccSmrg#		returns the path set by the user in the environment
2140b6f2c9ccSmrg# --with-fop: 	'yes' user instructs the module to use fop
2141b6f2c9ccSmrg#		'no' user instructs the module not to use fop
2142b6f2c9ccSmrg#
2143b6f2c9ccSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2144b6f2c9ccSmrg#
2145b6f2c9ccSmrgAC_DEFUN([XORG_WITH_FOP],[
2146b6f2c9ccSmrgAC_ARG_VAR([FOP], [Path to fop command])
2147245f6787Smrgm4_define([_defopt], m4_default([$2], [auto]))
2148b6f2c9ccSmrgAC_ARG_WITH(fop,
2149b6f2c9ccSmrg	AS_HELP_STRING([--with-fop],
2150b6f2c9ccSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2151b6f2c9ccSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2152b6f2c9ccSmrgm4_undefine([_defopt])
2153b6f2c9ccSmrg
2154b6f2c9ccSmrgif test "x$use_fop" = x"auto"; then
2155b6f2c9ccSmrg   AC_PATH_PROG([FOP], [fop])
2156b6f2c9ccSmrg   if test "x$FOP" = "x"; then
2157b6f2c9ccSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2158b6f2c9ccSmrg	have_fop=no
2159b6f2c9ccSmrg   else
2160b6f2c9ccSmrg        have_fop=yes
2161b6f2c9ccSmrg   fi
2162b6f2c9ccSmrgelif test "x$use_fop" = x"yes" ; then
2163b6f2c9ccSmrg   AC_PATH_PROG([FOP], [fop])
2164b6f2c9ccSmrg   if test "x$FOP" = "x"; then
2165b6f2c9ccSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2166b6f2c9ccSmrg   fi
2167b6f2c9ccSmrg   have_fop=yes
2168b6f2c9ccSmrgelif test "x$use_fop" = x"no" ; then
2169b6f2c9ccSmrg   if test "x$FOP" != "x"; then
2170b6f2c9ccSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2171b6f2c9ccSmrg   fi
2172b6f2c9ccSmrg   have_fop=no
2173b6f2c9ccSmrgelse
2174b6f2c9ccSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2175b6f2c9ccSmrgfi
2176245f6787Smrg
2177245f6787Smrg# Test for a minimum version of fop, if provided.
2178245f6787Smrgm4_ifval([$1],
2179245f6787Smrg[if test "$have_fop" = yes; then
2180245f6787Smrg    # scrape the fop version
2181245f6787Smrg    AC_MSG_CHECKING([for fop minimum version])
2182245f6787Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2183245f6787Smrg    AC_MSG_RESULT([$fop_version])
2184245f6787Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2185245f6787Smrg        [if test "x$use_fop" = xauto; then
2186245f6787Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2187245f6787Smrg            have_fop=no
2188245f6787Smrg        else
2189245f6787Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2190245f6787Smrg        fi])
2191245f6787Smrgfi])
2192b6f2c9ccSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2193b6f2c9ccSmrg]) # XORG_WITH_FOP
2194b6f2c9ccSmrg
219548f45e26Smrg# XORG_WITH_M4([MIN-VERSION])
219648f45e26Smrg# ---------------------------
219748f45e26Smrg# Minimum version: 1.19.0
219848f45e26Smrg#
219948f45e26Smrg# This macro attempts to locate an m4 macro processor which supports
220048f45e26Smrg# -I option and is only useful for modules relying on M4 in order to
220148f45e26Smrg# expand macros in source code files.
220248f45e26Smrg#
220348f45e26Smrg# Interface to module:
220448f45e26Smrg# M4:	 	returns the path of the m4 program found
220548f45e26Smrg#		returns the path set by the user in the environment
220648f45e26Smrg#
220748f45e26SmrgAC_DEFUN([XORG_WITH_M4], [
220848f45e26SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
220948f45e26Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
221048f45e26Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
221148f45e26Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
221248f45e26Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
221348f45e26Smrg   [$PATH:/usr/gnu/bin])])
221448f45e26Smrg
221548f45e26SmrgAC_SUBST([M4], [$ac_cv_path_M4])
221648f45e26Smrg]) # XORG_WITH_M4
221748f45e26Smrg
2218b6f2c9ccSmrg# XORG_WITH_PS2PDF([DEFAULT])
2219b6f2c9ccSmrg# ----------------
2220b6f2c9ccSmrg# Minimum version: 1.6.0
2221b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2222b6f2c9ccSmrg#
2223b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
2224b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
2225b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2226b6f2c9ccSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2227b6f2c9ccSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2228b6f2c9ccSmrg# --with-ps2pdf assumes 'auto'.
2229b6f2c9ccSmrg#
2230b6f2c9ccSmrg# Interface to module:
2231b6f2c9ccSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2232b6f2c9ccSmrg# PS2PDF:	returns the path of the ps2pdf program found
2233b6f2c9ccSmrg#		returns the path set by the user in the environment
2234b6f2c9ccSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2235b6f2c9ccSmrg#		 'no' user instructs the module not to use ps2pdf
2236b6f2c9ccSmrg#
2237b6f2c9ccSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2238b6f2c9ccSmrg#
2239b6f2c9ccSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2240b6f2c9ccSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2241b6f2c9ccSmrgm4_define([_defopt], m4_default([$1], [auto]))
2242b6f2c9ccSmrgAC_ARG_WITH(ps2pdf,
2243b6f2c9ccSmrg	AS_HELP_STRING([--with-ps2pdf],
2244b6f2c9ccSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2245b6f2c9ccSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2246b6f2c9ccSmrgm4_undefine([_defopt])
2247b6f2c9ccSmrg
2248b6f2c9ccSmrgif test "x$use_ps2pdf" = x"auto"; then
2249b6f2c9ccSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2250b6f2c9ccSmrg   if test "x$PS2PDF" = "x"; then
2251b6f2c9ccSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2252b6f2c9ccSmrg	have_ps2pdf=no
2253b6f2c9ccSmrg   else
2254b6f2c9ccSmrg        have_ps2pdf=yes
2255b6f2c9ccSmrg   fi
2256b6f2c9ccSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2257b6f2c9ccSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2258b6f2c9ccSmrg   if test "x$PS2PDF" = "x"; then
2259b6f2c9ccSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2260b6f2c9ccSmrg   fi
2261b6f2c9ccSmrg   have_ps2pdf=yes
2262b6f2c9ccSmrgelif test "x$use_ps2pdf" = x"no" ; then
2263b6f2c9ccSmrg   if test "x$PS2PDF" != "x"; then
2264b6f2c9ccSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2265b6f2c9ccSmrg   fi
2266b6f2c9ccSmrg   have_ps2pdf=no
2267b6f2c9ccSmrgelse
2268b6f2c9ccSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2269b6f2c9ccSmrgfi
2270b6f2c9ccSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2271b6f2c9ccSmrg]) # XORG_WITH_PS2PDF
2272b6f2c9ccSmrg
2273b6f2c9ccSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2274b6f2c9ccSmrg# ----------------
2275b6f2c9ccSmrg# Minimum version: 1.6.0
2276b6f2c9ccSmrg#
2277b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
2278b6f2c9ccSmrg# not at the appropriate level. This macro enables a builder to skip all
2279b6f2c9ccSmrg# documentation targets except traditional man pages.
2280b6f2c9ccSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2281b6f2c9ccSmrg# maximum flexibilty in controlling documentation building.
2282b6f2c9ccSmrg# Refer to:
2283b6f2c9ccSmrg# XORG_WITH_XMLTO         --with-xmlto
2284b6f2c9ccSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2285b6f2c9ccSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2286b6f2c9ccSmrg# XORG_WITH_FOP           --with-fop
2287b6f2c9ccSmrg# XORG_WITH_GROFF         --with-groff
2288b6f2c9ccSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2289b6f2c9ccSmrg#
2290b6f2c9ccSmrg# Interface to module:
2291b6f2c9ccSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2292b6f2c9ccSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2293b6f2c9ccSmrg#		 'no' user instructs the module not to generate docs
2294b6f2c9ccSmrg# parm1:	specify the default value, yes or no.
2295b6f2c9ccSmrg#
2296b6f2c9ccSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2297245f6787Smrgm4_define([docs_default], m4_default([$1], [yes]))
2298b6f2c9ccSmrgAC_ARG_ENABLE(docs,
2299b6f2c9ccSmrg	AS_HELP_STRING([--enable-docs],
2300245f6787Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2301245f6787Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2302245f6787Smrgm4_undefine([docs_default])
2303b6f2c9ccSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2304b6f2c9ccSmrgAC_MSG_CHECKING([whether to build documentation])
2305b6f2c9ccSmrgAC_MSG_RESULT([$build_docs])
2306b6f2c9ccSmrg]) # XORG_ENABLE_DOCS
2307b6f2c9ccSmrg
2308b6f2c9ccSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2309b6f2c9ccSmrg# ----------------
2310b6f2c9ccSmrg# Minimum version: 1.6.0
2311b6f2c9ccSmrg#
2312b6f2c9ccSmrg# This macro enables a builder to skip all developer documentation.
2313b6f2c9ccSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2314b6f2c9ccSmrg# maximum flexibilty in controlling documentation building.
2315b6f2c9ccSmrg# Refer to:
2316b6f2c9ccSmrg# XORG_WITH_XMLTO         --with-xmlto
2317b6f2c9ccSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2318b6f2c9ccSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2319b6f2c9ccSmrg# XORG_WITH_FOP           --with-fop
2320b6f2c9ccSmrg# XORG_WITH_GROFF         --with-groff
2321b6f2c9ccSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2322b6f2c9ccSmrg#
2323b6f2c9ccSmrg# Interface to module:
2324b6f2c9ccSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2325b6f2c9ccSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2326b6f2c9ccSmrg#			'no' user instructs the module not to generate developer docs
2327b6f2c9ccSmrg# parm1:		specify the default value, yes or no.
2328b6f2c9ccSmrg#
2329b6f2c9ccSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2330b6f2c9ccSmrgm4_define([devel_default], m4_default([$1], [yes]))
2331b6f2c9ccSmrgAC_ARG_ENABLE(devel-docs,
2332b6f2c9ccSmrg	AS_HELP_STRING([--enable-devel-docs],
2333b6f2c9ccSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2334b6f2c9ccSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2335b6f2c9ccSmrgm4_undefine([devel_default])
2336b6f2c9ccSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2337b6f2c9ccSmrgAC_MSG_CHECKING([whether to build developer documentation])
2338b6f2c9ccSmrgAC_MSG_RESULT([$build_devel_docs])
2339b6f2c9ccSmrg]) # XORG_ENABLE_DEVEL_DOCS
2340b6f2c9ccSmrg
2341b6f2c9ccSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2342b6f2c9ccSmrg# ----------------
2343b6f2c9ccSmrg# Minimum version: 1.6.0
2344b6f2c9ccSmrg#
2345b6f2c9ccSmrg# This macro enables a builder to skip all functional specification targets.
2346b6f2c9ccSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2347b6f2c9ccSmrg# maximum flexibilty in controlling documentation building.
2348b6f2c9ccSmrg# Refer to:
2349b6f2c9ccSmrg# XORG_WITH_XMLTO         --with-xmlto
2350b6f2c9ccSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2351b6f2c9ccSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2352b6f2c9ccSmrg# XORG_WITH_FOP           --with-fop
2353b6f2c9ccSmrg# XORG_WITH_GROFF         --with-groff
2354b6f2c9ccSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2355b6f2c9ccSmrg#
2356b6f2c9ccSmrg# Interface to module:
2357b6f2c9ccSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2358b6f2c9ccSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2359b6f2c9ccSmrg#			'no' user instructs the module not to generate specs
2360b6f2c9ccSmrg# parm1:		specify the default value, yes or no.
2361b6f2c9ccSmrg#
2362b6f2c9ccSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2363b6f2c9ccSmrgm4_define([spec_default], m4_default([$1], [yes]))
2364b6f2c9ccSmrgAC_ARG_ENABLE(specs,
2365b6f2c9ccSmrg	AS_HELP_STRING([--enable-specs],
2366b6f2c9ccSmrg	   [Enable building the specs (default: ]spec_default[)]),
2367b6f2c9ccSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2368b6f2c9ccSmrgm4_undefine([spec_default])
2369b6f2c9ccSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2370b6f2c9ccSmrgAC_MSG_CHECKING([whether to build functional specifications])
2371b6f2c9ccSmrgAC_MSG_RESULT([$build_specs])
2372b6f2c9ccSmrg]) # XORG_ENABLE_SPECS
2373b6f2c9ccSmrg
2374245f6787Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2375245f6787Smrg# ----------------------------------------------
2376245f6787Smrg# Minimum version: 1.13.0
2377245f6787Smrg#
2378245f6787Smrg# This macro enables a builder to enable/disable unit testing
2379245f6787Smrg# It makes no assumption about the test cases implementation
2380245f6787Smrg# Test cases may or may not use Automake "Support for test suites"
2381245f6787Smrg# They may or may not use the software utility library GLib
2382245f6787Smrg#
2383245f6787Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2384245f6787Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2385245f6787Smrg# The variable enable_unit_tests is used by other macros in this file.
2386245f6787Smrg#
2387245f6787Smrg# Interface to module:
2388245f6787Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2389245f6787Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2390245f6787Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2391245f6787Smrg#			'no' user instructs the module not to build tests
2392245f6787Smrg# parm1:		specify the default value, yes or no.
2393245f6787Smrg#
2394245f6787SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2395245f6787SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2396245f6787SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2397663cdc11SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2398245f6787Smrgm4_define([_defopt], m4_default([$1], [auto]))
2399245f6787SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2400245f6787Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2401245f6787Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2402245f6787Smrgm4_undefine([_defopt])
2403245f6787SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2404245f6787SmrgAC_MSG_CHECKING([whether to build unit test cases])
2405245f6787SmrgAC_MSG_RESULT([$enable_unit_tests])
2406245f6787Smrg]) # XORG_ENABLE_UNIT_TESTS
2407245f6787Smrg
240887aef7c3Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
240987aef7c3Smrg# ------------------------------------------------------
241087aef7c3Smrg# Minimum version: 1.17.0
241187aef7c3Smrg#
241287aef7c3Smrg# This macro enables a builder to enable/disable integration testing
241387aef7c3Smrg# It makes no assumption about the test cases' implementation
241487aef7c3Smrg# Test cases may or may not use Automake "Support for test suites"
241587aef7c3Smrg#
241687aef7c3Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
241787aef7c3Smrg# usually requires less dependencies and may be built and run under less
241887aef7c3Smrg# stringent environments than integration tests.
241987aef7c3Smrg#
242087aef7c3Smrg# Interface to module:
242187aef7c3Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
242287aef7c3Smrg# enable_integration_tests:   used in configure.ac for additional configuration
242387aef7c3Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
242487aef7c3Smrg#                             'no' user instructs the module not to build tests
242587aef7c3Smrg# parm1:                      specify the default value, yes or no.
242687aef7c3Smrg#
242787aef7c3SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
242887aef7c3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
242987aef7c3Smrgm4_define([_defopt], m4_default([$1], [auto]))
243087aef7c3SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
243187aef7c3Smrg	[Enable building integration test cases (default: ]_defopt[)]),
243287aef7c3Smrg	[enable_integration_tests=$enableval],
243387aef7c3Smrg	[enable_integration_tests=]_defopt)
243487aef7c3Smrgm4_undefine([_defopt])
243587aef7c3SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
243687aef7c3Smrg	[test "x$enable_integration_tests" != xno])
243787aef7c3SmrgAC_MSG_CHECKING([whether to build unit test cases])
243887aef7c3SmrgAC_MSG_RESULT([$enable_integration_tests])
243987aef7c3Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
244087aef7c3Smrg
2441245f6787Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2442245f6787Smrg# ----------------------------------------
2443245f6787Smrg# Minimum version: 1.13.0
2444245f6787Smrg#
2445245f6787Smrg# GLib is a library which provides advanced data structures and functions.
2446245f6787Smrg# This macro enables a module to test for the presence of Glib.
2447245f6787Smrg#
2448245f6787Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2449245f6787Smrg# Otherwise the value of $enable_unit_tests is blank.
2450245f6787Smrg#
245187aef7c3Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
245287aef7c3Smrg# test support usually requires less dependencies and may be built and run under
245387aef7c3Smrg# less stringent environments than integration tests.
245487aef7c3Smrg#
2455245f6787Smrg# Interface to module:
2456245f6787Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2457245f6787Smrg# with_glib: used in configure.ac to know if GLib has been found
2458245f6787Smrg# --with-glib:	'yes' user instructs the module to use glib
2459245f6787Smrg#		'no' user instructs the module not to use glib
2460245f6787Smrg#
2461245f6787SmrgAC_DEFUN([XORG_WITH_GLIB],[
2462245f6787SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2463245f6787Smrgm4_define([_defopt], m4_default([$2], [auto]))
2464245f6787SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2465245f6787Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2466245f6787Smrg	[with_glib=$withval], [with_glib=]_defopt)
2467245f6787Smrgm4_undefine([_defopt])
2468245f6787Smrg
2469245f6787Smrghave_glib=no
2470245f6787Smrg# Do not probe GLib if user explicitly disabled unit testing
2471245f6787Smrgif test "x$enable_unit_tests" != x"no"; then
2472245f6787Smrg  # Do not probe GLib if user explicitly disabled it
2473245f6787Smrg  if test "x$with_glib" != x"no"; then
2474245f6787Smrg    m4_ifval(
2475245f6787Smrg      [$1],
2476245f6787Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2477245f6787Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2478245f6787Smrg    )
2479245f6787Smrg  fi
2480245f6787Smrgfi
2481245f6787Smrg
2482245f6787Smrg# Not having GLib when unit testing has been explicitly requested is an error
2483245f6787Smrgif test "x$enable_unit_tests" = x"yes"; then
2484245f6787Smrg  if test "x$have_glib" = x"no"; then
2485245f6787Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2486245f6787Smrg  fi
2487245f6787Smrgfi
2488245f6787Smrg
2489245f6787Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2490245f6787Smrgif test "x$enable_unit_tests" = x"no"; then
2491245f6787Smrg  if test "x$with_glib" = x"yes"; then
2492245f6787Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2493245f6787Smrg  fi
2494245f6787Smrgfi
2495245f6787Smrg
2496245f6787Smrg# Not having GLib when it has been explicitly requested is an error
2497245f6787Smrgif test "x$with_glib" = x"yes"; then
2498245f6787Smrg  if test "x$have_glib" = x"no"; then
2499245f6787Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2500245f6787Smrg  fi
2501245f6787Smrgfi
2502245f6787Smrg
2503245f6787SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2504245f6787Smrg]) # XORG_WITH_GLIB
2505245f6787Smrg
2506663cdc11Smrg# XORG_LD_WRAP([required|optional])
2507663cdc11Smrg# ---------------------------------
2508245f6787Smrg# Minimum version: 1.13.0
2509245f6787Smrg#
2510245f6787Smrg# Check if linker supports -wrap, passed via compiler flags
2511245f6787Smrg#
2512245f6787Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2513245f6787Smrg# Otherwise the value of $enable_unit_tests is blank.
2514245f6787Smrg#
2515663cdc11Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2516663cdc11Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2517663cdc11Smrg# available, an argument of "optional" allows use when some unit tests require
2518663cdc11Smrg# ld -wrap and others do not.
2519663cdc11Smrg#
2520245f6787SmrgAC_DEFUN([XORG_LD_WRAP],[
2521663cdc11SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2522663cdc11Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2523663cdc11Smrg                      void __wrap_exit(int status) { return; }],
2524663cdc11Smrg                     [exit(0);])])
2525245f6787Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2526663cdc11Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2527245f6787Smrg  if test "x$have_ld_wrap" = x"no"; then
2528245f6787Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2529245f6787Smrg  fi
2530245f6787Smrgfi
2531245f6787SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2532245f6787Smrg#
2533245f6787Smrg]) # XORG_LD_WRAP
2534245f6787Smrg
2535245f6787Smrg# XORG_CHECK_LINKER_FLAGS
2536245f6787Smrg# -----------------------
2537245f6787Smrg# SYNOPSIS
2538245f6787Smrg#
2539663cdc11Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2540245f6787Smrg#
2541245f6787Smrg# DESCRIPTION
2542245f6787Smrg#
2543245f6787Smrg#   Check whether the given linker FLAGS work with the current language's
2544245f6787Smrg#   linker, or whether they give an error.
2545245f6787Smrg#
2546245f6787Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2547245f6787Smrg#   success/failure.
2548245f6787Smrg#
2549663cdc11Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2550663cdc11Smrg#
2551245f6787Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2552245f6787Smrg#
2553245f6787Smrg# LICENSE
2554245f6787Smrg#
2555245f6787Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2556245f6787Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2557245f6787Smrg#   Copyright (c) 2009 Matteo Frigo
2558245f6787Smrg#
2559245f6787Smrg#   This program is free software: you can redistribute it and/or modify it
2560245f6787Smrg#   under the terms of the GNU General Public License as published by the
2561245f6787Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2562245f6787Smrg#   option) any later version.
2563245f6787Smrg#
2564245f6787Smrg#   This program is distributed in the hope that it will be useful, but
2565245f6787Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2566245f6787Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2567245f6787Smrg#   Public License for more details.
2568245f6787Smrg#
2569245f6787Smrg#   You should have received a copy of the GNU General Public License along
2570245f6787Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2571245f6787Smrg#
2572245f6787Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2573245f6787Smrg#   gives unlimited permission to copy, distribute and modify the configure
2574245f6787Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2575245f6787Smrg#   need not follow the terms of the GNU General Public License when using
2576245f6787Smrg#   or distributing such scripts, even though portions of the text of the
2577245f6787Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2578245f6787Smrg#   all other use of the material that constitutes the Autoconf Macro.
2579245f6787Smrg#
2580245f6787Smrg#   This special exception to the GPL applies to versions of the Autoconf
2581245f6787Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2582245f6787Smrg#   modified version of the Autoconf Macro, you may extend this special
2583245f6787Smrg#   exception to the GPL to apply to your modified version as well.#
2584245f6787SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2585245f6787Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2586245f6787Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2587245f6787SmrgAS_LITERAL_IF([$1],
2588245f6787Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2589245f6787Smrg      ax_save_FLAGS=$LDFLAGS
2590245f6787Smrg      LDFLAGS="$1"
2591663cdc11Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2592245f6787Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2593245f6787Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2594245f6787Smrg      LDFLAGS=$ax_save_FLAGS])],
2595245f6787Smrg  [ax_save_FLAGS=$LDFLAGS
2596245f6787Smrg   LDFLAGS="$1"
2597245f6787Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2598245f6787Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2599245f6787Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2600245f6787Smrg   LDFLAGS=$ax_save_FLAGS])
2601245f6787Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2602245f6787SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2603245f6787Smrgif test "x$xorg_check_linker_flags" = xyes; then
2604245f6787Smrg	m4_default([$2], :)
2605245f6787Smrgelse
2606245f6787Smrg	m4_default([$3], :)
2607245f6787Smrgfi
2608245f6787Smrg]) # XORG_CHECK_LINKER_FLAGS
2609245f6787Smrg
2610663cdc11Smrg# XORG_MEMORY_CHECK_FLAGS
2611663cdc11Smrg# -----------------------
2612663cdc11Smrg# Minimum version: 1.16.0
2613663cdc11Smrg#
2614663cdc11Smrg# This macro attempts to find appropriate memory checking functionality
2615663cdc11Smrg# for various platforms which unit testing code may use to catch various
2616663cdc11Smrg# forms of memory allocation and access errors in testing.
2617663cdc11Smrg#
2618663cdc11Smrg# Interface to module:
2619663cdc11Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2620663cdc11Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2621663cdc11Smrg#
2622663cdc11Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2623663cdc11Smrg#
2624663cdc11SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2625663cdc11Smrg
2626663cdc11SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2627663cdc11SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2628663cdc11Smrg           [Environment variables to enable memory checking in tests])
2629663cdc11Smrg
2630663cdc11Smrg# Check for different types of support on different platforms
2631663cdc11Smrgcase $host_os in
2632663cdc11Smrg    solaris*)
2633663cdc11Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2634663cdc11Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2635663cdc11Smrg        ;;
2636663cdc11Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2637663cdc11Smrg        # both directly and inverted, so should not be 0 or 255.
2638663cdc11Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2639663cdc11Smrg        ;;
2640663cdc11Smrg    darwin*)
2641663cdc11Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2642663cdc11Smrg        ;;
2643663cdc11Smrg    *bsd*)
2644663cdc11Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2645663cdc11Smrg        ;;
2646663cdc11Smrgesac
2647663cdc11Smrg
2648663cdc11Smrg# User supplied flags override default flags
2649663cdc11Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2650663cdc11Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2651663cdc11Smrgfi
2652663cdc11Smrg
2653663cdc11SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2654663cdc11Smrg]) # XORG_WITH_LINT
2655663cdc11Smrg
26567978d3cdSmrg# XORG_CHECK_MALLOC_ZERO
26577978d3cdSmrg# ----------------------
26587978d3cdSmrg# Minimum version: 1.0.0
2659ea6ae205Smrg#
26607978d3cdSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
26617978d3cdSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
26627978d3cdSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
26637978d3cdSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
26647978d3cdSmrgAC_ARG_ENABLE(malloc0returnsnull,
2665e83ac88aSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
26667978d3cdSmrg		       [malloc(0) returns NULL (default: auto)]),
26677978d3cdSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
26687978d3cdSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2669ea6ae205Smrg
26707978d3cdSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
26717978d3cdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
267248f45e26SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
267348f45e26Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2674245f6787Smrg#include <stdlib.h>
2675245f6787Smrg],[
26767978d3cdSmrg    char *m0, *r0, *c0, *p;
26777978d3cdSmrg    m0 = malloc(0);
26787978d3cdSmrg    p = malloc(10);
26797978d3cdSmrg    r0 = realloc(p,0);
2680245f6787Smrg    c0 = calloc(0,10);
2681245f6787Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2682245f6787Smrg])],
268348f45e26Smrg		[xorg_cv_malloc0_returns_null=yes],
268448f45e26Smrg		[xorg_cv_malloc0_returns_null=no])])
268548f45e26SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
26867978d3cdSmrgfi
26877978d3cdSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2688ea6ae205Smrg
26897978d3cdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
26907978d3cdSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
26917978d3cdSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
26927978d3cdSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
26937978d3cdSmrgelse
26947978d3cdSmrg	MALLOC_ZERO_CFLAGS=""
26957978d3cdSmrg	XMALLOC_ZERO_CFLAGS=""
26967978d3cdSmrg	XTMALLOC_ZERO_CFLAGS=""
26977978d3cdSmrgfi
2698ea6ae205Smrg
26997978d3cdSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
27007978d3cdSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
27017978d3cdSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
27027978d3cdSmrg]) # XORG_CHECK_MALLOC_ZERO
2703ea6ae205Smrg
27047978d3cdSmrg# XORG_WITH_LINT()
27057978d3cdSmrg# ----------------
27067978d3cdSmrg# Minimum version: 1.1.0
27077978d3cdSmrg#
2708b6f2c9ccSmrg# This macro enables the use of a tool that flags some suspicious and
2709b6f2c9ccSmrg# non-portable constructs (likely to be bugs) in C language source code.
2710b6f2c9ccSmrg# It will attempt to locate the tool and use appropriate options.
2711b6f2c9ccSmrg# There are various lint type tools on different platforms.
2712b6f2c9ccSmrg#
2713b6f2c9ccSmrg# Interface to module:
2714b6f2c9ccSmrg# LINT:		returns the path to the tool found on the platform
2715b6f2c9ccSmrg#		or the value set to LINT on the configure cmd line
2716b6f2c9ccSmrg#		also an Automake conditional
2717b6f2c9ccSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2718b6f2c9ccSmrg#
2719b6f2c9ccSmrg# --with-lint:	'yes' user instructs the module to use lint
2720b6f2c9ccSmrg#		'no' user instructs the module not to use lint (default)
2721b6f2c9ccSmrg#
2722b6f2c9ccSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2723b6f2c9ccSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
27247978d3cdSmrg#
27257978d3cdSmrgAC_DEFUN([XORG_WITH_LINT],[
2726ea6ae205Smrg
2727b6f2c9ccSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2728b6f2c9ccSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2729e83ac88aSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27307978d3cdSmrg		[Use a lint-style source code checker (default: disabled)])],
27317978d3cdSmrg		[use_lint=$withval], [use_lint=no])
2732b6f2c9ccSmrg
2733b6f2c9ccSmrg# Obtain platform specific info like program name and options
2734b6f2c9ccSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2735b6f2c9ccSmrgcase $host_os in
2736b6f2c9ccSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2737b6f2c9ccSmrg	lint_name=splint
2738b6f2c9ccSmrg	lint_options="-badflag"
2739b6f2c9ccSmrg	;;
2740b6f2c9ccSmrg  *freebsd* | *netbsd*)
2741b6f2c9ccSmrg	lint_name=lint
2742b6f2c9ccSmrg	lint_options="-u -b"
2743b6f2c9ccSmrg	;;
2744b6f2c9ccSmrg  *solaris*)
2745b6f2c9ccSmrg	lint_name=lint
2746b6f2c9ccSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2747b6f2c9ccSmrg	;;
2748b6f2c9ccSmrgesac
2749b6f2c9ccSmrg
2750b6f2c9ccSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2751b6f2c9ccSmrgif test "x$use_lint" = x"yes" ; then
2752b6f2c9ccSmrg   AC_PATH_PROG([LINT], [$lint_name])
2753b6f2c9ccSmrg   if test "x$LINT" = "x"; then
2754b6f2c9ccSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2755b6f2c9ccSmrg   fi
2756b6f2c9ccSmrgelif test "x$use_lint" = x"no" ; then
2757b6f2c9ccSmrg   if test "x$LINT" != "x"; then
2758b6f2c9ccSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2759b6f2c9ccSmrg   fi
27607978d3cdSmrgelse
2761b6f2c9ccSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
27627978d3cdSmrgfi
2763b6f2c9ccSmrg
2764b6f2c9ccSmrg# User supplied flags override default flags
2765b6f2c9ccSmrgif test "x$LINT_FLAGS" != "x"; then
2766b6f2c9ccSmrg   lint_options=$LINT_FLAGS
27677978d3cdSmrgfi
2768ea6ae205Smrg
2769b6f2c9ccSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2770b6f2c9ccSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2771ea6ae205Smrg
27727978d3cdSmrg]) # XORG_WITH_LINT
27737978d3cdSmrg
27747978d3cdSmrg# XORG_LINT_LIBRARY(LIBNAME)
27757978d3cdSmrg# --------------------------
27767978d3cdSmrg# Minimum version: 1.1.0
27777978d3cdSmrg#
27787978d3cdSmrg# Sets up flags for building lint libraries for checking programs that call
27797978d3cdSmrg# functions in the library.
2780ea6ae205Smrg#
2781b6f2c9ccSmrg# Interface to module:
2782b6f2c9ccSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2783b6f2c9ccSmrg# MAKE_LINT_LIB		- Automake conditional
2784b6f2c9ccSmrg#
2785b6f2c9ccSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2786b6f2c9ccSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2787ea6ae205Smrg
27887978d3cdSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
27897978d3cdSmrgAC_REQUIRE([XORG_WITH_LINT])
2790e83ac88aSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
27917978d3cdSmrg	[Create lint library (default: disabled)])],
27927978d3cdSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2793b6f2c9ccSmrg
2794b6f2c9ccSmrgif test "x$make_lint_lib" = x"yes" ; then
2795b6f2c9ccSmrg   LINTLIB=llib-l$1.ln
2796b6f2c9ccSmrg   if test "x$LINT" = "x"; then
2797b6f2c9ccSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2798b6f2c9ccSmrg   fi
2799b6f2c9ccSmrgelif test "x$make_lint_lib" != x"no" ; then
2800b6f2c9ccSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
28017978d3cdSmrgfi
2802b6f2c9ccSmrg
28037978d3cdSmrgAC_SUBST(LINTLIB)
28047978d3cdSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2805ea6ae205Smrg
28067978d3cdSmrg]) # XORG_LINT_LIBRARY
28077978d3cdSmrg
2808245f6787Smrg# XORG_COMPILER_BRAND
2809245f6787Smrg# -------------------
2810245f6787Smrg# Minimum version: 1.14.0
2811245f6787Smrg#
2812245f6787Smrg# Checks for various brands of compilers and sets flags as appropriate:
2813245f6787Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
281487aef7c3Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2815245f6787Smrg#   clang compiler - sets CLANGCC to "yes"
2816245f6787Smrg#   Intel compiler - sets INTELCC to "yes"
2817245f6787Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2818245f6787Smrg#
2819245f6787SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
282087aef7c3SmrgAC_LANG_CASE(
282187aef7c3Smrg	[C], [
282287aef7c3Smrg		AC_REQUIRE([AC_PROG_CC_C99])
282387aef7c3Smrg	],
282487aef7c3Smrg	[C++], [
282587aef7c3Smrg		AC_REQUIRE([AC_PROG_CXX])
282687aef7c3Smrg	]
282787aef7c3Smrg)
2828245f6787SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2829245f6787SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2830245f6787SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2831245f6787Smrg]) # XORG_COMPILER_BRAND
2832245f6787Smrg
2833663cdc11Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2834663cdc11Smrg# ---------------
2835663cdc11Smrg# Minimum version: 1.16.0
2836663cdc11Smrg#
2837663cdc11Smrg# Test if the compiler works when passed the given flag as a command line argument.
2838663cdc11Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2839663cdc11Smrg# next flag in the list until there are no more options.
2840663cdc11Smrg#
2841663cdc11Smrg# Note that this does not guarantee that the compiler supports the flag as some
2842663cdc11Smrg# compilers will simply ignore arguments that they do not understand, but we do
2843663cdc11Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2844663cdc11Smrg# -Werror=unused-command-line-argument
2845663cdc11Smrg#
2846663cdc11SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2847663cdc11Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2848663cdc11Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2849663cdc11Smrg
285087aef7c3SmrgAC_LANG_COMPILER_REQUIRE
285187aef7c3Smrg
285287aef7c3SmrgAC_LANG_CASE(
285387aef7c3Smrg	[C], [
285487aef7c3Smrg		AC_REQUIRE([AC_PROG_CC_C99])
285587aef7c3Smrg		define([PREFIX], [C])
285687aef7c3Smrg		define([CACHE_PREFIX], [cc])
285787aef7c3Smrg		define([COMPILER], [$CC])
285887aef7c3Smrg	],
285987aef7c3Smrg	[C++], [
286087aef7c3Smrg		define([PREFIX], [CXX])
286187aef7c3Smrg		define([CACHE_PREFIX], [cxx])
286287aef7c3Smrg		define([COMPILER], [$CXX])
286387aef7c3Smrg	]
286487aef7c3Smrg)
286587aef7c3Smrg
286687aef7c3Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2867663cdc11Smrg
286887aef7c3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
286987aef7c3Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
287087aef7c3Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
287187aef7c3Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2872663cdc11Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
287387aef7c3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
287487aef7c3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
287587aef7c3Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
287687aef7c3Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2877663cdc11Smrgfi
2878663cdc11Smrg
287987aef7c3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
288087aef7c3Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
288187aef7c3Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2882663cdc11Smrg	fi
288387aef7c3Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
288487aef7c3Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
288587aef7c3Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2886663cdc11Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
288787aef7c3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
288887aef7c3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
288987aef7c3Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
289087aef7c3Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2891663cdc11Smrgfi
2892663cdc11Smrg
2893663cdc11Smrgfound="no"
2894663cdc11Smrgm4_foreach([flag], m4_cdr($@), [
2895663cdc11Smrg	if test $found = "no" ; then
289648f45e26Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
289787aef7c3Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2898663cdc11Smrg		fi
2899663cdc11Smrg
290048f45e26Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
290187aef7c3Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2902663cdc11Smrg		fi
2903663cdc11Smrg
290487aef7c3Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2905663cdc11Smrg
2906663cdc11Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
290787aef7c3Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
290887aef7c3Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
290987aef7c3Smrg		AC_CACHE_VAL($cacheid,
2910663cdc11Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
291187aef7c3Smrg					     [eval $cacheid=yes],
291287aef7c3Smrg					     [eval $cacheid=no])])
2913663cdc11Smrg
291487aef7c3Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2915663cdc11Smrg
291687aef7c3Smrg		eval supported=\$$cacheid
2917663cdc11Smrg		AC_MSG_RESULT([$supported])
2918663cdc11Smrg		if test "$supported" = "yes" ; then
2919663cdc11Smrg			$1="$$1 ]flag["
2920663cdc11Smrg			found="yes"
2921663cdc11Smrg		fi
2922663cdc11Smrg	fi
2923663cdc11Smrg])
2924663cdc11Smrg]) # XORG_TESTSET_CFLAG
2925663cdc11Smrg
2926663cdc11Smrg# XORG_COMPILER_FLAGS
2927663cdc11Smrg# ---------------
2928663cdc11Smrg# Minimum version: 1.16.0
2929663cdc11Smrg#
293087aef7c3Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
293187aef7c3Smrg# arguments supported by the selected compiler which do NOT alter the generated
293287aef7c3Smrg# code.  These arguments will cause the compiler to print various warnings
293387aef7c3Smrg# during compilation AND turn a conservative set of warnings into errors.
2934663cdc11Smrg#
293587aef7c3Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
293687aef7c3Smrg# future versions of util-macros as options are added to new compilers.
2937663cdc11Smrg#
2938663cdc11SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2939663cdc11SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2940663cdc11Smrg
2941663cdc11SmrgAC_ARG_ENABLE(selective-werror,
2942663cdc11Smrg              AS_HELP_STRING([--disable-selective-werror],
2943663cdc11Smrg                             [Turn off selective compiler errors. (default: enabled)]),
2944663cdc11Smrg              [SELECTIVE_WERROR=$enableval],
2945663cdc11Smrg              [SELECTIVE_WERROR=yes])
2946663cdc11Smrg
294787aef7c3SmrgAC_LANG_CASE(
294887aef7c3Smrg        [C], [
294987aef7c3Smrg                define([PREFIX], [C])
295087aef7c3Smrg        ],
295187aef7c3Smrg        [C++], [
295287aef7c3Smrg                define([PREFIX], [CXX])
295387aef7c3Smrg        ]
295487aef7c3Smrg)
2955663cdc11Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2956663cdc11Smrgif test "x$SUNCC" = "xyes"; then
295787aef7c3Smrg    [BASE_]PREFIX[FLAGS]="-v"
2958663cdc11Smrgelse
295987aef7c3Smrg    [BASE_]PREFIX[FLAGS]=""
2960663cdc11Smrgfi
2961663cdc11Smrg
2962663cdc11Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
296387aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
296487aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
296587aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
296687aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
296787aef7c3Smrg
296887aef7c3SmrgAC_LANG_CASE(
296987aef7c3Smrg	[C], [
297087aef7c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
297187aef7c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
297287aef7c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
297387aef7c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
297448f45e26Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
297587aef7c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
297687aef7c3Smrg	]
297787aef7c3Smrg)
2978663cdc11Smrg
2979663cdc11Smrg# This chunk adds additional warnings that could catch undesired effects.
298087aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
298187aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
298287aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
298387aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
298487aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
298587aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
298648f45e26SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2987663cdc11Smrg
2988663cdc11Smrg# These are currently disabled because they are noisy.  They will be enabled
2989663cdc11Smrg# in the future once the codebase is sufficiently modernized to silence
2990663cdc11Smrg# them.  For now, I don't want them to drown out the other warnings.
299187aef7c3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
299287aef7c3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
299348f45e26Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2994663cdc11Smrg
2995663cdc11Smrg# Turn some warnings into errors, so we don't accidently get successful builds
2996663cdc11Smrg# when there are problems that should be fixed.
2997663cdc11Smrg
2998663cdc11Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
299987aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
300087aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
300187aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
300287aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
300387aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
300487aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
300587aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
300687aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
300787aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
300887aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
300987aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
301087aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
301187aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3012663cdc11Smrgelse
3013663cdc11SmrgAC_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])
301487aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
301587aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
301687aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
301787aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
301887aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
301987aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
302087aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
302187aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
302287aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
302387aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
302487aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
302587aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
302687aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
302787aef7c3Smrgfi
302887aef7c3Smrg
302987aef7c3SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3030663cdc11Smrg]) # XORG_COMPILER_FLAGS
3031663cdc11Smrg
30327978d3cdSmrg# XORG_CWARNFLAGS
3033ea6ae205Smrg# ---------------
30347978d3cdSmrg# Minimum version: 1.2.0
3035663cdc11Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
30367978d3cdSmrg#
30377978d3cdSmrg# Defines CWARNFLAGS to enable C compiler warnings.
30387978d3cdSmrg#
3039663cdc11Smrg# This function is deprecated because it defines -fno-strict-aliasing
3040663cdc11Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3041663cdc11Smrg# is needed, then it should be added explicitly in the module when
3042663cdc11Smrg# it is updated to use BASE_CFLAGS.
3043663cdc11Smrg#
30447978d3cdSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3045663cdc11SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3046245f6787SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
304787aef7c3SmrgAC_LANG_CASE(
304887aef7c3Smrg	[C], [
304987aef7c3Smrg		CWARNFLAGS="$BASE_CFLAGS"
305087aef7c3Smrg		if  test "x$GCC" = xyes ; then
305187aef7c3Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
305287aef7c3Smrg		fi
305387aef7c3Smrg		AC_SUBST(CWARNFLAGS)
305487aef7c3Smrg	]
305587aef7c3Smrg)
30567978d3cdSmrg]) # XORG_CWARNFLAGS
3057e83ac88aSmrg
3058e83ac88aSmrg# XORG_STRICT_OPTION
3059e83ac88aSmrg# -----------------------
3060e83ac88aSmrg# Minimum version: 1.3.0
3061e83ac88aSmrg#
3062245f6787Smrg# Add configure option to enable strict compilation flags, such as treating
3063245f6787Smrg# warnings as fatal errors.
3064245f6787Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
306587aef7c3Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3066245f6787Smrg#
3067245f6787Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3068245f6787Smrg# when strict compilation is unconditionally desired.
3069e83ac88aSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3070e83ac88aSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3071663cdc11SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3072e83ac88aSmrg
3073e83ac88aSmrgAC_ARG_ENABLE(strict-compilation,
3074e83ac88aSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3075e83ac88aSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3076e83ac88aSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3077663cdc11Smrg
307887aef7c3SmrgAC_LANG_CASE(
307987aef7c3Smrg        [C], [
308087aef7c3Smrg                define([PREFIX], [C])
308187aef7c3Smrg        ],
308287aef7c3Smrg        [C++], [
308387aef7c3Smrg                define([PREFIX], [CXX])
308487aef7c3Smrg        ]
308587aef7c3Smrg)
308687aef7c3Smrg
308787aef7c3Smrg[STRICT_]PREFIX[FLAGS]=""
308887aef7c3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
308987aef7c3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3090663cdc11Smrg
3091663cdc11Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3092663cdc11Smrg# activate it with -Werror, so we add it here explicitly.
309387aef7c3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3094663cdc11Smrg
3095e83ac88aSmrgif test "x$STRICT_COMPILE" = "xyes"; then
309687aef7c3Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
309787aef7c3Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3098e83ac88aSmrgfi
309987aef7c3SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
310087aef7c3SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
310187aef7c3SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3102e83ac88aSmrg]) # XORG_STRICT_OPTION
3103e83ac88aSmrg
3104e83ac88aSmrg# XORG_DEFAULT_OPTIONS
3105e83ac88aSmrg# --------------------
3106e83ac88aSmrg# Minimum version: 1.3.0
3107e83ac88aSmrg#
3108e83ac88aSmrg# Defines default options for X.Org modules.
3109e83ac88aSmrg#
3110e83ac88aSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3111b6f2c9ccSmrgAC_REQUIRE([AC_PROG_INSTALL])
3112663cdc11SmrgXORG_COMPILER_FLAGS
3113e83ac88aSmrgXORG_CWARNFLAGS
3114e83ac88aSmrgXORG_STRICT_OPTION
3115e83ac88aSmrgXORG_RELEASE_VERSION
3116e83ac88aSmrgXORG_CHANGELOG
3117b6f2c9ccSmrgXORG_INSTALL
3118e83ac88aSmrgXORG_MANPAGE_SECTIONS
3119b6f2c9ccSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3120b6f2c9ccSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3121e83ac88aSmrg]) # XORG_DEFAULT_OPTIONS
3122b6f2c9ccSmrg
3123b6f2c9ccSmrg# XORG_INSTALL()
3124b6f2c9ccSmrg# ----------------
3125b6f2c9ccSmrg# Minimum version: 1.4.0
3126b6f2c9ccSmrg#
3127b6f2c9ccSmrg# Defines the variable INSTALL_CMD as the command to copy
3128b6f2c9ccSmrg# INSTALL from $prefix/share/util-macros.
3129b6f2c9ccSmrg#
3130b6f2c9ccSmrgAC_DEFUN([XORG_INSTALL], [
3131b6f2c9ccSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3132b6f2c9ccSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3133b6f2c9ccSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3134b6f2c9ccSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3135b6f2c9ccSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3136b6f2c9ccSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3137b6f2c9ccSmrgAC_SUBST([INSTALL_CMD])
3138b6f2c9ccSmrg]) # XORG_INSTALL
31397978d3cdSmrgdnl Copyright 2005 Red Hat, Inc
31407978d3cdSmrgdnl
31417978d3cdSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
31427978d3cdSmrgdnl documentation for any purpose is hereby granted without fee, provided that
31437978d3cdSmrgdnl the above copyright notice appear in all copies and that both that
31447978d3cdSmrgdnl copyright notice and this permission notice appear in supporting
31457978d3cdSmrgdnl documentation.
31467978d3cdSmrgdnl
31477978d3cdSmrgdnl The above copyright notice and this permission notice shall be included
31487978d3cdSmrgdnl in all copies or substantial portions of the Software.
31497978d3cdSmrgdnl
31507978d3cdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31517978d3cdSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31527978d3cdSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31537978d3cdSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
31547978d3cdSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31557978d3cdSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31567978d3cdSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
31577978d3cdSmrgdnl
31587978d3cdSmrgdnl Except as contained in this notice, the name of the copyright holders shall
31597978d3cdSmrgdnl not be used in advertising or otherwise to promote the sale, use or
31607978d3cdSmrgdnl other dealings in this Software without prior written authorization
31617978d3cdSmrgdnl from the copyright holders.
31627978d3cdSmrgdnl
3163ea6ae205Smrg
31647978d3cdSmrg# XORG_RELEASE_VERSION
31657978d3cdSmrg# --------------------
3166b6f2c9ccSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
316748f45e26Smrg
31687978d3cdSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
31697978d3cdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
31707978d3cdSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
31717978d3cdSmrg		[Major version of this package])
31727978d3cdSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
31737978d3cdSmrg	if test "x$PVM" = "x"; then
31747978d3cdSmrg		PVM="0"
31757978d3cdSmrg	fi
31767978d3cdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
31777978d3cdSmrg		[$PVM],
31787978d3cdSmrg		[Minor version of this package])
31797978d3cdSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
31807978d3cdSmrg	if test "x$PVP" = "x"; then
31817978d3cdSmrg		PVP="0"
31827978d3cdSmrg	fi
31837978d3cdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
31847978d3cdSmrg		[$PVP],
31857978d3cdSmrg		[Patch version of this package])
31867978d3cdSmrg])
3187ea6ae205Smrg
31887978d3cdSmrg# XORG_CHANGELOG()
31897978d3cdSmrg# ----------------
31907978d3cdSmrg# Minimum version: 1.2.0
31917978d3cdSmrg#
31927978d3cdSmrg# Defines the variable CHANGELOG_CMD as the command to generate
31937978d3cdSmrg# ChangeLog from git.
31947978d3cdSmrg#
31957978d3cdSmrg#
31967978d3cdSmrgAC_DEFUN([XORG_CHANGELOG], [
3197b6f2c9ccSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3198b6f2c9ccSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3199b6f2c9ccSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
32007978d3cdSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
32017978d3cdSmrgAC_SUBST([CHANGELOG_CMD])
32027978d3cdSmrg]) # XORG_CHANGELOG
3203ea6ae205Smrg
3204