aclocal.m4 revision 87aef7c3
187aef7c3Smrg# generated automatically by aclocal 1.14 -*- Autoconf -*-
287aef7c3Smrg
387aef7c3Smrg# Copyright (C) 1996-2013 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
17b6f2c9ccSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
18b6f2c9ccSmrg[m4_warning([this file was generated for autoconf 2.68.
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
2387aef7c3Smrg# Copyright (C) 2002-2013 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],
3587aef7c3Smrg[am__api_version='1.14'
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.
3887aef7c3Smrgm4_if([$1], [1.14], [],
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],
5487aef7c3Smrg[AM_AUTOMAKE_VERSION([1.14])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
6187aef7c3Smrg# Copyright (C) 2001-2013 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],
1067978d3cdSmrg[dnl Rely on autoconf to set up CDPATH properly.
1077978d3cdSmrgAC_PREREQ([2.50])dnl
1087978d3cdSmrg# expand $ac_aux_dir to an absolute path
1097978d3cdSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
1107978d3cdSmrg])
111ea6ae205Smrg
1127978d3cdSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
113ea6ae205Smrg
11487aef7c3Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
1157978d3cdSmrg#
1167978d3cdSmrg# This file is free software; the Free Software Foundation
1177978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
1187978d3cdSmrg# with or without modifications, as long as this notice is preserved.
119ea6ae205Smrg
1207978d3cdSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1217978d3cdSmrg# -------------------------------------
1227978d3cdSmrg# Define a conditional.
1237978d3cdSmrgAC_DEFUN([AM_CONDITIONAL],
12487aef7c3Smrg[AC_PREREQ([2.52])dnl
12587aef7c3Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12687aef7c3Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1277978d3cdSmrgAC_SUBST([$1_TRUE])dnl
1287978d3cdSmrgAC_SUBST([$1_FALSE])dnl
1297978d3cdSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1307978d3cdSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
131e83ac88aSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1327978d3cdSmrgif $2; then
1337978d3cdSmrg  $1_TRUE=
1347978d3cdSmrg  $1_FALSE='#'
1357978d3cdSmrgelse
1367978d3cdSmrg  $1_TRUE='#'
1377978d3cdSmrg  $1_FALSE=
1387978d3cdSmrgfi
1397978d3cdSmrgAC_CONFIG_COMMANDS_PRE(
1407978d3cdSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1417978d3cdSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1427978d3cdSmrgUsually this means the macro was only invoked conditionally.]])
1437978d3cdSmrgfi])])
144ea6ae205Smrg
14587aef7c3Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
1467978d3cdSmrg#
1477978d3cdSmrg# This file is free software; the Free Software Foundation
1487978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
1497978d3cdSmrg# with or without modifications, as long as this notice is preserved.
150ea6ae205Smrg
151ea6ae205Smrg
15287aef7c3Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1537978d3cdSmrg# written in clear, in which case automake, when reading aclocal.m4,
1547978d3cdSmrg# will think it sees a *use*, and therefore will trigger all it's
1557978d3cdSmrg# C support machinery.  Also note that it means that autoscan, seeing
1567978d3cdSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
157ea6ae205Smrg
158ea6ae205Smrg
1597978d3cdSmrg# _AM_DEPENDENCIES(NAME)
1607978d3cdSmrg# ----------------------
1617978d3cdSmrg# See how the compiler implements dependency checking.
16287aef7c3Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1637978d3cdSmrg# We try a few techniques and use that to set a single cache variable.
1647978d3cdSmrg#
1657978d3cdSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1667978d3cdSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1677978d3cdSmrg# dependency, and given that the user is not expected to run this macro,
1687978d3cdSmrg# just rely on AC_PROG_CC.
1697978d3cdSmrgAC_DEFUN([_AM_DEPENDENCIES],
1707978d3cdSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1717978d3cdSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1727978d3cdSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1737978d3cdSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
174ea6ae205Smrg
17587aef7c3Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17687aef7c3Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17787aef7c3Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17887aef7c3Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17987aef7c3Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
18087aef7c3Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18187aef7c3Smrg                    [depcc="$$1"   am_compiler_list=])
182ea6ae205Smrg
1837978d3cdSmrgAC_CACHE_CHECK([dependency style of $depcc],
1847978d3cdSmrg               [am_cv_$1_dependencies_compiler_type],
1857978d3cdSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1867978d3cdSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1877978d3cdSmrg  # making bogus files that we don't know about and never remove.  For
1887978d3cdSmrg  # instance it was reported that on HP-UX the gcc test will end up
18987aef7c3Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
19087aef7c3Smrg  # in D".
19187aef7c3Smrg  rm -rf conftest.dir
1927978d3cdSmrg  mkdir conftest.dir
1937978d3cdSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1947978d3cdSmrg  # using a relative directory.
1957978d3cdSmrg  cp "$am_depcomp" conftest.dir
1967978d3cdSmrg  cd conftest.dir
1977978d3cdSmrg  # We will build objects and dependencies in a subdirectory because
1987978d3cdSmrg  # it helps to detect inapplicable dependency modes.  For instance
1997978d3cdSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2007978d3cdSmrg  # side effect of compilation, but ICC will put the dependencies in
2017978d3cdSmrg  # the current directory while Tru64 will put them in the object
2027978d3cdSmrg  # directory.
2037978d3cdSmrg  mkdir sub
204ea6ae205Smrg
2057978d3cdSmrg  am_cv_$1_dependencies_compiler_type=none
2067978d3cdSmrg  if test "$am_compiler_list" = ""; then
2077978d3cdSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2087978d3cdSmrg  fi
209e83ac88aSmrg  am__universal=false
210e83ac88aSmrg  m4_case([$1], [CC],
211e83ac88aSmrg    [case " $depcc " in #(
212e83ac88aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
213e83ac88aSmrg     esac],
214e83ac88aSmrg    [CXX],
215e83ac88aSmrg    [case " $depcc " in #(
216e83ac88aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
217e83ac88aSmrg     esac])
218e83ac88aSmrg
2197978d3cdSmrg  for depmode in $am_compiler_list; do
2207978d3cdSmrg    # Setup a source with many dependencies, because some compilers
2217978d3cdSmrg    # like to wrap large dependency lists on column 80 (with \), and
2227978d3cdSmrg    # we should not choose a depcomp mode which is confused by this.
2237978d3cdSmrg    #
2247978d3cdSmrg    # We need to recreate these files for each test, as the compiler may
2257978d3cdSmrg    # overwrite some of them when testing with obscure command lines.
2267978d3cdSmrg    # This happens at least with the AIX C compiler.
2277978d3cdSmrg    : > sub/conftest.c
2287978d3cdSmrg    for i in 1 2 3 4 5 6; do
2297978d3cdSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
23087aef7c3Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23187aef7c3Smrg      # Solaris 10 /bin/sh.
23287aef7c3Smrg      echo '/* dummy */' > sub/conftst$i.h
2337978d3cdSmrg    done
2347978d3cdSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
235ea6ae205Smrg
23687aef7c3Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
237e83ac88aSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23887aef7c3Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23987aef7c3Smrg    # versions had trouble with output in subdirs.
240e83ac88aSmrg    am__obj=sub/conftest.${OBJEXT-o}
241e83ac88aSmrg    am__minus_obj="-o $am__obj"
2427978d3cdSmrg    case $depmode in
243e83ac88aSmrg    gcc)
244e83ac88aSmrg      # This depmode causes a compiler race in universal mode.
245e83ac88aSmrg      test "$am__universal" = false || continue
246e83ac88aSmrg      ;;
2477978d3cdSmrg    nosideeffect)
24887aef7c3Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24987aef7c3Smrg      # only be used when explicitly requested.
2507978d3cdSmrg      if test "x$enable_dependency_tracking" = xyes; then
2517978d3cdSmrg	continue
2527978d3cdSmrg      else
2537978d3cdSmrg	break
2547978d3cdSmrg      fi
2557978d3cdSmrg      ;;
25687aef7c3Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25787aef7c3Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
258e83ac88aSmrg      # not run yet.  These depmodes are late enough in the game, and
259e83ac88aSmrg      # so weak that their functioning should not be impacted.
260e83ac88aSmrg      am__obj=conftest.${OBJEXT-o}
261e83ac88aSmrg      am__minus_obj=
262e83ac88aSmrg      ;;
2637978d3cdSmrg    none) break ;;
264ea6ae205Smrg    esac
2657978d3cdSmrg    if depmode=$depmode \
266e83ac88aSmrg       source=sub/conftest.c object=$am__obj \
2677978d3cdSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
268e83ac88aSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2697978d3cdSmrg         >/dev/null 2>conftest.err &&
2707978d3cdSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2717978d3cdSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
272e83ac88aSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2737978d3cdSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2747978d3cdSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2757978d3cdSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2767978d3cdSmrg      # that says an option was ignored or not supported.
2777978d3cdSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2787978d3cdSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2797978d3cdSmrg      # The diagnosis changed in icc 8.0:
2807978d3cdSmrg      #   icc: Command line remark: option '-MP' not supported
2817978d3cdSmrg      if (grep 'ignoring option' conftest.err ||
2827978d3cdSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2837978d3cdSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2847978d3cdSmrg        break
2857978d3cdSmrg      fi
2867978d3cdSmrg    fi
2877978d3cdSmrg  done
288ea6ae205Smrg
2897978d3cdSmrg  cd ..
2907978d3cdSmrg  rm -rf conftest.dir
2917978d3cdSmrgelse
2927978d3cdSmrg  am_cv_$1_dependencies_compiler_type=none
293ea6ae205Smrgfi
2947978d3cdSmrg])
2957978d3cdSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2967978d3cdSmrgAM_CONDITIONAL([am__fastdep$1], [
2977978d3cdSmrg  test "x$enable_dependency_tracking" != xno \
2987978d3cdSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2997978d3cdSmrg])
300ea6ae205Smrg
301ea6ae205Smrg
3027978d3cdSmrg# AM_SET_DEPDIR
3037978d3cdSmrg# -------------
3047978d3cdSmrg# Choose a directory name for dependency files.
30587aef7c3Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3067978d3cdSmrgAC_DEFUN([AM_SET_DEPDIR],
3077978d3cdSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3087978d3cdSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3097978d3cdSmrg])
310ea6ae205Smrg
311ea6ae205Smrg
3127978d3cdSmrg# AM_DEP_TRACK
3137978d3cdSmrg# ------------
3147978d3cdSmrgAC_DEFUN([AM_DEP_TRACK],
31587aef7c3Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31687aef7c3SmrgAS_HELP_STRING(
31787aef7c3Smrg  [--enable-dependency-tracking],
31887aef7c3Smrg  [do not reject slow dependency extractors])
31987aef7c3SmrgAS_HELP_STRING(
32087aef7c3Smrg  [--disable-dependency-tracking],
32187aef7c3Smrg  [speeds up one-time build])])
3227978d3cdSmrgif test "x$enable_dependency_tracking" != xno; then
3237978d3cdSmrg  am_depcomp="$ac_aux_dir/depcomp"
3247978d3cdSmrg  AMDEPBACKSLASH='\'
32587aef7c3Smrg  am__nodep='_no'
326ea6ae205Smrgfi
3277978d3cdSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3287978d3cdSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3297978d3cdSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
33087aef7c3SmrgAC_SUBST([am__nodep])dnl
33187aef7c3Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3327978d3cdSmrg])
333ea6ae205Smrg
3347978d3cdSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
335ea6ae205Smrg
33687aef7c3Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
3377978d3cdSmrg#
3387978d3cdSmrg# This file is free software; the Free Software Foundation
3397978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
3407978d3cdSmrg# with or without modifications, as long as this notice is preserved.
341ea6ae205Smrg
342ea6ae205Smrg
3437978d3cdSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3447978d3cdSmrg# ------------------------------
3457978d3cdSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
346e83ac88aSmrg[{
34787aef7c3Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
348e83ac88aSmrg  # are listed without --file.  Let's play safe and only enable the eval
349e83ac88aSmrg  # if we detect the quoting.
350e83ac88aSmrg  case $CONFIG_FILES in
351e83ac88aSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
352e83ac88aSmrg  *)   set x $CONFIG_FILES ;;
353e83ac88aSmrg  esac
354e83ac88aSmrg  shift
355e83ac88aSmrg  for mf
356e83ac88aSmrg  do
357e83ac88aSmrg    # Strip MF so we end up with the name of the file.
358e83ac88aSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
359e83ac88aSmrg    # Check whether this is an Automake generated Makefile or not.
36087aef7c3Smrg    # We used to match only the files named 'Makefile.in', but
361e83ac88aSmrg    # some people rename them; so instead we look at the file content.
362e83ac88aSmrg    # Grep'ing the first line is not enough: some people post-process
363e83ac88aSmrg    # each Makefile.in and add a new line on top of each file to say so.
364e83ac88aSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
365e83ac88aSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
366e83ac88aSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
367e83ac88aSmrg      dirpart=`AS_DIRNAME("$mf")`
368e83ac88aSmrg    else
369e83ac88aSmrg      continue
370e83ac88aSmrg    fi
371e83ac88aSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
37287aef7c3Smrg    # from the Makefile without running 'make'.
373e83ac88aSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
374e83ac88aSmrg    test -z "$DEPDIR" && continue
375e83ac88aSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
37687aef7c3Smrg    test -z "$am__include" && continue
377e83ac88aSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
378e83ac88aSmrg    # Find all dependency output files, they are included files with
379e83ac88aSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
380e83ac88aSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
381e83ac88aSmrg    # expansion.
382e83ac88aSmrg    for file in `sed -n "
383e83ac88aSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
38487aef7c3Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
385e83ac88aSmrg      # Make sure the directory exists.
386e83ac88aSmrg      test -f "$dirpart/$file" && continue
387e83ac88aSmrg      fdir=`AS_DIRNAME(["$file"])`
388e83ac88aSmrg      AS_MKDIR_P([$dirpart/$fdir])
389e83ac88aSmrg      # echo "creating $dirpart/$file"
390e83ac88aSmrg      echo '# dummy' > "$dirpart/$file"
391e83ac88aSmrg    done
3927978d3cdSmrg  done
393e83ac88aSmrg}
3947978d3cdSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
395ea6ae205Smrg
396ea6ae205Smrg
3977978d3cdSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3987978d3cdSmrg# -----------------------------
3997978d3cdSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
4007978d3cdSmrg#
4017978d3cdSmrg# This code is only required when automatic dependency tracking
40287aef7c3Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
4037978d3cdSmrg# need in order to bootstrap the dependency handling code.
4047978d3cdSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4057978d3cdSmrg[AC_CONFIG_COMMANDS([depfiles],
4067978d3cdSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4077978d3cdSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4087978d3cdSmrg])
409ea6ae205Smrg
4107978d3cdSmrg# Do all the work for Automake.                             -*- Autoconf -*-
411ea6ae205Smrg
41287aef7c3Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
413ea6ae205Smrg#
4147978d3cdSmrg# This file is free software; the Free Software Foundation
4157978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
4167978d3cdSmrg# with or without modifications, as long as this notice is preserved.
417ea6ae205Smrg
4187978d3cdSmrg# This macro actually does too much.  Some checks are only needed if
4197978d3cdSmrg# your package does certain things.  But this isn't really a big deal.
420ea6ae205Smrg
42187aef7c3Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
42287aef7c3Smrgm4_define([AC_PROG_CC],
42387aef7c3Smrgm4_defn([AC_PROG_CC])
42487aef7c3Smrg[_AM_PROG_CC_C_O
42587aef7c3Smrg])
42687aef7c3Smrg
4277978d3cdSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4287978d3cdSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4297978d3cdSmrg# -----------------------------------------------
4307978d3cdSmrg# The call with PACKAGE and VERSION arguments is the old style
4317978d3cdSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4327978d3cdSmrg# and VERSION should now be passed to AC_INIT and removed from
4337978d3cdSmrg# the call to AM_INIT_AUTOMAKE.
4347978d3cdSmrg# We support both call styles for the transition.  After
4357978d3cdSmrg# the next Automake release, Autoconf can make the AC_INIT
4367978d3cdSmrg# arguments mandatory, and then we can depend on a new Autoconf
4377978d3cdSmrg# release and drop the old call support.
4387978d3cdSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43987aef7c3Smrg[AC_PREREQ([2.65])dnl
4407978d3cdSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4417978d3cdSmrgdnl the ones we care about.
4427978d3cdSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4437978d3cdSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4447978d3cdSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4457978d3cdSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4467978d3cdSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4477978d3cdSmrg  # is not polluted with repeated "-I."
4487978d3cdSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4497978d3cdSmrg  # test to see if srcdir already configured
4507978d3cdSmrg  if test -f $srcdir/config.status; then
4517978d3cdSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4527978d3cdSmrg  fi
453ea6ae205Smrgfi
454ea6ae205Smrg
4557978d3cdSmrg# test whether we have cygpath
4567978d3cdSmrgif test -z "$CYGPATH_W"; then
4577978d3cdSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4587978d3cdSmrg    CYGPATH_W='cygpath -w'
4597978d3cdSmrg  else
4607978d3cdSmrg    CYGPATH_W=echo
4617978d3cdSmrg  fi
462ea6ae205Smrgfi
4637978d3cdSmrgAC_SUBST([CYGPATH_W])
464ea6ae205Smrg
4657978d3cdSmrg# Define the identity of the package.
4667978d3cdSmrgdnl Distinguish between old-style and new-style calls.
4677978d3cdSmrgm4_ifval([$2],
46887aef7c3Smrg[AC_DIAGNOSE([obsolete],
46987aef7c3Smrg             [$0: two- and three-arguments forms are deprecated.])
47087aef7c3Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4717978d3cdSmrg AC_SUBST([PACKAGE], [$1])dnl
4727978d3cdSmrg AC_SUBST([VERSION], [$2])],
4737978d3cdSmrg[_AM_SET_OPTIONS([$1])dnl
4747978d3cdSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47587aef7c3Smrgm4_if(
47687aef7c3Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
47787aef7c3Smrg  [ok:ok],,
4787978d3cdSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4797978d3cdSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4807978d3cdSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
481ea6ae205Smrg
4827978d3cdSmrg_AM_IF_OPTION([no-define],,
48387aef7c3Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
48487aef7c3Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
485ea6ae205Smrg
4867978d3cdSmrg# Some tools Automake needs.
4877978d3cdSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4887978d3cdSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48987aef7c3SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
49087aef7c3SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
49187aef7c3SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
49287aef7c3SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
49387aef7c3SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
494e83ac88aSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
495e83ac88aSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49687aef7c3SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49787aef7c3Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49887aef7c3Smrg# dies out for good.  For more background, see:
49987aef7c3Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
50087aef7c3Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
50187aef7c3SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
5027978d3cdSmrg# We need awk for the "check" target.  The system "awk" is bad on
5037978d3cdSmrg# some platforms.
5047978d3cdSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5057978d3cdSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5067978d3cdSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5077978d3cdSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
508e83ac88aSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
509e83ac88aSmrg			     [_AM_PROG_TAR([v7])])])
5107978d3cdSmrg_AM_IF_OPTION([no-dependencies],,
5117978d3cdSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
51287aef7c3Smrg		  [_AM_DEPENDENCIES([CC])],
51387aef7c3Smrg		  [m4_define([AC_PROG_CC],
51487aef7c3Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5157978d3cdSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51687aef7c3Smrg		  [_AM_DEPENDENCIES([CXX])],
51787aef7c3Smrg		  [m4_define([AC_PROG_CXX],
51887aef7c3Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5197978d3cdSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
52087aef7c3Smrg		  [_AM_DEPENDENCIES([OBJC])],
52187aef7c3Smrg		  [m4_define([AC_PROG_OBJC],
52287aef7c3Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
52387aef7c3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
52487aef7c3Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52587aef7c3Smrg		  [m4_define([AC_PROG_OBJCXX],
52687aef7c3Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5277978d3cdSmrg])
52887aef7c3SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
52987aef7c3Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53087aef7c3Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
53187aef7c3Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
532e83ac88aSmrgAC_CONFIG_COMMANDS_PRE(dnl
533e83ac88aSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
534e83ac88aSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5357978d3cdSmrg
53687aef7c3Smrg# POSIX will say in a future version that running "rm -f" with no argument
53787aef7c3Smrg# is OK; and we want to be able to make that assumption in our Makefile
53887aef7c3Smrg# recipes.  So use an aggressive probe to check that the usage we want is
53987aef7c3Smrg# actually supported "in the wild" to an acceptable degree.
54087aef7c3Smrg# See automake bug#10828.
54187aef7c3Smrg# To make any issue more visible, cause the running configure to be aborted
54287aef7c3Smrg# by default if the 'rm' program in use doesn't match our expectations; the
54387aef7c3Smrg# user can still override this though.
54487aef7c3Smrgif rm -f && rm -fr && rm -rf; then : OK; else
54587aef7c3Smrg  cat >&2 <<'END'
54687aef7c3SmrgOops!
54787aef7c3Smrg
54887aef7c3SmrgYour 'rm' program seems unable to run without file operands specified
54987aef7c3Smrgon the command line, even when the '-f' option is present.  This is contrary
55087aef7c3Smrgto the behaviour of most rm programs out there, and not conforming with
55187aef7c3Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
55287aef7c3Smrg
55387aef7c3SmrgPlease tell bug-automake@gnu.org about your system, including the value
55487aef7c3Smrgof your $PATH and any error possibly output before this message.  This
55587aef7c3Smrgcan help us improve future automake versions.
55687aef7c3Smrg
55787aef7c3SmrgEND
55887aef7c3Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
55987aef7c3Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56087aef7c3Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
56187aef7c3Smrg    echo >&2
56287aef7c3Smrg  else
56387aef7c3Smrg    cat >&2 <<'END'
56487aef7c3SmrgAborting the configuration process, to ensure you take notice of the issue.
56587aef7c3Smrg
56687aef7c3SmrgYou can download and install GNU coreutils to get an 'rm' implementation
56787aef7c3Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
56887aef7c3Smrg
56987aef7c3SmrgIf you want to complete the configuration process using your problematic
57087aef7c3Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
57187aef7c3Smrgto "yes", and re-run configure.
57287aef7c3Smrg
57387aef7c3SmrgEND
57487aef7c3Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
57587aef7c3Smrg  fi
57687aef7c3Smrgfi])
57787aef7c3Smrg
57887aef7c3Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
579e83ac88aSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
580e83ac88aSmrgdnl mangled by Autoconf and run in a shell conditional statement.
581e83ac88aSmrgm4_define([_AC_COMPILER_EXEEXT],
582e83ac88aSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
583e83ac88aSmrg
5847978d3cdSmrg# When config.status generates a header, we must update the stamp-h file.
5857978d3cdSmrg# This file resides in the same directory as the config header
5867978d3cdSmrg# that is generated.  The stamp files are numbered to have different names.
5877978d3cdSmrg
5887978d3cdSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5897978d3cdSmrg# loop where config.status creates the headers, so we can generate
5907978d3cdSmrg# our stamp files there.
5917978d3cdSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5927978d3cdSmrg[# Compute $1's index in $config_headers.
593e83ac88aSmrg_am_arg=$1
5947978d3cdSmrg_am_stamp_count=1
5957978d3cdSmrgfor _am_header in $config_headers :; do
5967978d3cdSmrg  case $_am_header in
597e83ac88aSmrg    $_am_arg | $_am_arg:* )
5987978d3cdSmrg      break ;;
5997978d3cdSmrg    * )
6007978d3cdSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6017978d3cdSmrg  esac
6027978d3cdSmrgdone
603e83ac88aSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6047978d3cdSmrg
60587aef7c3Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6067978d3cdSmrg#
6077978d3cdSmrg# This file is free software; the Free Software Foundation
6087978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
6097978d3cdSmrg# with or without modifications, as long as this notice is preserved.
610ea6ae205Smrg
6117978d3cdSmrg# AM_PROG_INSTALL_SH
6127978d3cdSmrg# ------------------
6137978d3cdSmrg# Define $install_sh.
6147978d3cdSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6157978d3cdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
616e83ac88aSmrgif test x"${install_sh}" != xset; then
617e83ac88aSmrg  case $am_aux_dir in
618e83ac88aSmrg  *\ * | *\	*)
619e83ac88aSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
620e83ac88aSmrg  *)
621e83ac88aSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
622e83ac88aSmrg  esac
623e83ac88aSmrgfi
62487aef7c3SmrgAC_SUBST([install_sh])])
625ea6ae205Smrg
62687aef7c3Smrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
627ea6ae205Smrg#
6287978d3cdSmrg# This file is free software; the Free Software Foundation
6297978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
6307978d3cdSmrg# with or without modifications, as long as this notice is preserved.
631ea6ae205Smrg
6327978d3cdSmrg# Check whether the underlying file-system supports filenames
6337978d3cdSmrg# with a leading dot.  For instance MS-DOS doesn't.
6347978d3cdSmrgAC_DEFUN([AM_SET_LEADING_DOT],
6357978d3cdSmrg[rm -rf .tst 2>/dev/null
6367978d3cdSmrgmkdir .tst 2>/dev/null
6377978d3cdSmrgif test -d .tst; then
6387978d3cdSmrg  am__leading_dot=.
639ea6ae205Smrgelse
6407978d3cdSmrg  am__leading_dot=_
641ea6ae205Smrgfi
6427978d3cdSmrgrmdir .tst 2>/dev/null
6437978d3cdSmrgAC_SUBST([am__leading_dot])])
644ea6ae205Smrg
6457978d3cdSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
6467978d3cdSmrg# From Jim Meyering
647ea6ae205Smrg
64887aef7c3Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
649ea6ae205Smrg#
6507978d3cdSmrg# This file is free software; the Free Software Foundation
6517978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
6527978d3cdSmrg# with or without modifications, as long as this notice is preserved.
653ea6ae205Smrg
654e83ac88aSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
655e83ac88aSmrg# ----------------------------------
656e83ac88aSmrg# Control maintainer-specific portions of Makefiles.
65787aef7c3Smrg# Default is to disable them, unless 'enable' is passed literally.
65887aef7c3Smrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
659e83ac88aSmrg# can override the default with the --enable/--disable switch.
6607978d3cdSmrgAC_DEFUN([AM_MAINTAINER_MODE],
661e83ac88aSmrg[m4_case(m4_default([$1], [disable]),
662e83ac88aSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
663e83ac88aSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
664e83ac88aSmrg       [m4_define([am_maintainer_other], [enable])
665e83ac88aSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
66687aef7c3SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
667e83ac88aSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
668e83ac88aSmrg  AC_ARG_ENABLE([maintainer-mode],
66987aef7c3Smrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
67087aef7c3Smrg      am_maintainer_other[ make rules and dependencies not useful
67187aef7c3Smrg      (and sometimes confusing) to the casual installer])],
67287aef7c3Smrg    [USE_MAINTAINER_MODE=$enableval],
67387aef7c3Smrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6747978d3cdSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
675e83ac88aSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6767978d3cdSmrg  MAINT=$MAINTAINER_MODE_TRUE
677e83ac88aSmrg  AC_SUBST([MAINT])dnl
6787978d3cdSmrg]
6797978d3cdSmrg)
680ea6ae205Smrg
6817978d3cdSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
682ea6ae205Smrg
68387aef7c3Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6847978d3cdSmrg#
6857978d3cdSmrg# This file is free software; the Free Software Foundation
6867978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
6877978d3cdSmrg# with or without modifications, as long as this notice is preserved.
688ea6ae205Smrg
6897978d3cdSmrg# AM_MAKE_INCLUDE()
6907978d3cdSmrg# -----------------
6917978d3cdSmrg# Check to see how make treats includes.
6927978d3cdSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6937978d3cdSmrg[am_make=${MAKE-make}
6947978d3cdSmrgcat > confinc << 'END'
6957978d3cdSmrgam__doit:
696e83ac88aSmrg	@echo this is the am__doit target
6977978d3cdSmrg.PHONY: am__doit
6987978d3cdSmrgEND
6997978d3cdSmrg# If we don't find an include directive, just comment out the code.
7007978d3cdSmrgAC_MSG_CHECKING([for style of include used by $am_make])
7017978d3cdSmrgam__include="#"
7027978d3cdSmrgam__quote=
7037978d3cdSmrg_am_result=none
7047978d3cdSmrg# First try GNU make style include.
7057978d3cdSmrgecho "include confinc" > confmf
70687aef7c3Smrg# Ignore all kinds of additional output from 'make'.
707e83ac88aSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
708e83ac88aSmrg*the\ am__doit\ target*)
709e83ac88aSmrg  am__include=include
710e83ac88aSmrg  am__quote=
711e83ac88aSmrg  _am_result=GNU
712e83ac88aSmrg  ;;
713e83ac88aSmrgesac
7147978d3cdSmrg# Now try BSD make style include.
7157978d3cdSmrgif test "$am__include" = "#"; then
7167978d3cdSmrg   echo '.include "confinc"' > confmf
717e83ac88aSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
718e83ac88aSmrg   *the\ am__doit\ target*)
719e83ac88aSmrg     am__include=.include
720e83ac88aSmrg     am__quote="\""
721e83ac88aSmrg     _am_result=BSD
722e83ac88aSmrg     ;;
723e83ac88aSmrg   esac
7247978d3cdSmrgfi
7257978d3cdSmrgAC_SUBST([am__include])
7267978d3cdSmrgAC_SUBST([am__quote])
7277978d3cdSmrgAC_MSG_RESULT([$_am_result])
7287978d3cdSmrgrm -f confinc confmf
729ea6ae205Smrg])
730ea6ae205Smrg
7317978d3cdSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7327978d3cdSmrg
73387aef7c3Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
734ea6ae205Smrg#
735ea6ae205Smrg# This file is free software; the Free Software Foundation
736ea6ae205Smrg# gives unlimited permission to copy and/or distribute it,
737ea6ae205Smrg# with or without modifications, as long as this notice is preserved.
738ea6ae205Smrg
7397978d3cdSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7407978d3cdSmrg# ------------------------------
7417978d3cdSmrgAC_DEFUN([AM_MISSING_PROG],
7427978d3cdSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7437978d3cdSmrg$1=${$1-"${am_missing_run}$2"}
7447978d3cdSmrgAC_SUBST($1)])
745ea6ae205Smrg
7467978d3cdSmrg# AM_MISSING_HAS_RUN
7477978d3cdSmrg# ------------------
74887aef7c3Smrg# Define MISSING if not defined so far and test if it is modern enough.
74987aef7c3Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7507978d3cdSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7517978d3cdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7527978d3cdSmrgAC_REQUIRE_AUX_FILE([missing])dnl
753e83ac88aSmrgif test x"${MISSING+set}" != xset; then
754e83ac88aSmrg  case $am_aux_dir in
755e83ac88aSmrg  *\ * | *\	*)
756e83ac88aSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
757e83ac88aSmrg  *)
758e83ac88aSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
759e83ac88aSmrg  esac
760e83ac88aSmrgfi
7617978d3cdSmrg# Use eval to expand $SHELL
76287aef7c3Smrgif eval "$MISSING --is-lightweight"; then
76387aef7c3Smrg  am_missing_run="$MISSING "
7647978d3cdSmrgelse
7657978d3cdSmrg  am_missing_run=
76687aef7c3Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7677978d3cdSmrgfi
7687978d3cdSmrg])
769ea6ae205Smrg
7707978d3cdSmrg# Helper functions for option handling.                     -*- Autoconf -*-
771ea6ae205Smrg
77287aef7c3Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
773ea6ae205Smrg#
774ea6ae205Smrg# This file is free software; the Free Software Foundation
775ea6ae205Smrg# gives unlimited permission to copy and/or distribute it,
776ea6ae205Smrg# with or without modifications, as long as this notice is preserved.
777ea6ae205Smrg
7787978d3cdSmrg# _AM_MANGLE_OPTION(NAME)
7797978d3cdSmrg# -----------------------
7807978d3cdSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7817978d3cdSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
782ea6ae205Smrg
7837978d3cdSmrg# _AM_SET_OPTION(NAME)
78487aef7c3Smrg# --------------------
7857978d3cdSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7867978d3cdSmrgAC_DEFUN([_AM_SET_OPTION],
78787aef7c3Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
788ea6ae205Smrg
7897978d3cdSmrg# _AM_SET_OPTIONS(OPTIONS)
79087aef7c3Smrg# ------------------------
7917978d3cdSmrg# OPTIONS is a space-separated list of Automake options.
7927978d3cdSmrgAC_DEFUN([_AM_SET_OPTIONS],
793e83ac88aSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
794ea6ae205Smrg
7957978d3cdSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7967978d3cdSmrg# -------------------------------------------
7977978d3cdSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7987978d3cdSmrgAC_DEFUN([_AM_IF_OPTION],
7997978d3cdSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
800ea6ae205Smrg
80187aef7c3Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
80287aef7c3Smrg#
80387aef7c3Smrg# This file is free software; the Free Software Foundation
80487aef7c3Smrg# gives unlimited permission to copy and/or distribute it,
80587aef7c3Smrg# with or without modifications, as long as this notice is preserved.
806ea6ae205Smrg
80787aef7c3Smrg# _AM_PROG_CC_C_O
80887aef7c3Smrg# ---------------
80987aef7c3Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
81087aef7c3Smrg# to automatically call this.
81187aef7c3SmrgAC_DEFUN([_AM_PROG_CC_C_O],
81287aef7c3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
81387aef7c3SmrgAC_REQUIRE_AUX_FILE([compile])dnl
81487aef7c3SmrgAC_LANG_PUSH([C])dnl
81587aef7c3SmrgAC_CACHE_CHECK(
81687aef7c3Smrg  [whether $CC understands -c and -o together],
81787aef7c3Smrg  [am_cv_prog_cc_c_o],
81887aef7c3Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
81987aef7c3Smrg  # Make sure it works both with $CC and with simple cc.
82087aef7c3Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
82187aef7c3Smrg  # compilers refuse to overwrite an existing .o file with -o,
82287aef7c3Smrg  # though they will create one.
82387aef7c3Smrg  am_cv_prog_cc_c_o=yes
82487aef7c3Smrg  for am_i in 1 2; do
82587aef7c3Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
82687aef7c3Smrg         && test -f conftest2.$ac_objext; then
82787aef7c3Smrg      : OK
82887aef7c3Smrg    else
82987aef7c3Smrg      am_cv_prog_cc_c_o=no
83087aef7c3Smrg      break
83187aef7c3Smrg    fi
83287aef7c3Smrg  done
83387aef7c3Smrg  rm -f core conftest*
83487aef7c3Smrg  unset am_i])
83587aef7c3Smrgif test "$am_cv_prog_cc_c_o" != yes; then
83687aef7c3Smrg   # Losing compiler, so override with the script.
83787aef7c3Smrg   # FIXME: It is wrong to rewrite CC.
83887aef7c3Smrg   # But if we don't then we get into trouble of one sort or another.
83987aef7c3Smrg   # A longer-term fix would be to have automake use am__CC in this case,
84087aef7c3Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
84187aef7c3Smrg   CC="$am_aux_dir/compile $CC"
84287aef7c3Smrgfi
84387aef7c3SmrgAC_LANG_POP([C])])
84487aef7c3Smrg
84587aef7c3Smrg# For backward compatibility.
84687aef7c3SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
84787aef7c3Smrg
84887aef7c3Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
849ea6ae205Smrg#
8507978d3cdSmrg# This file is free software; the Free Software Foundation
8517978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
8527978d3cdSmrg# with or without modifications, as long as this notice is preserved.
853ea6ae205Smrg
85487aef7c3Smrg# AM_RUN_LOG(COMMAND)
85587aef7c3Smrg# -------------------
85687aef7c3Smrg# Run COMMAND, save the exit status in ac_status, and log it.
85787aef7c3Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
85887aef7c3SmrgAC_DEFUN([AM_RUN_LOG],
85987aef7c3Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
86087aef7c3Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
86187aef7c3Smrg   ac_status=$?
86287aef7c3Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
86387aef7c3Smrg   (exit $ac_status); }])
86487aef7c3Smrg
86587aef7c3Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
86687aef7c3Smrg
86787aef7c3Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
86887aef7c3Smrg#
86987aef7c3Smrg# This file is free software; the Free Software Foundation
87087aef7c3Smrg# gives unlimited permission to copy and/or distribute it,
87187aef7c3Smrg# with or without modifications, as long as this notice is preserved.
872ea6ae205Smrg
8737978d3cdSmrg# AM_SANITY_CHECK
8747978d3cdSmrg# ---------------
8757978d3cdSmrgAC_DEFUN([AM_SANITY_CHECK],
8767978d3cdSmrg[AC_MSG_CHECKING([whether build environment is sane])
877e83ac88aSmrg# Reject unsafe characters in $srcdir or the absolute working directory
878e83ac88aSmrg# name.  Accept space and tab only in the latter.
879e83ac88aSmrgam_lf='
880e83ac88aSmrg'
881e83ac88aSmrgcase `pwd` in
882e83ac88aSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
883e83ac88aSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
884e83ac88aSmrgesac
885e83ac88aSmrgcase $srcdir in
886e83ac88aSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
88787aef7c3Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
888e83ac88aSmrgesac
889e83ac88aSmrg
89087aef7c3Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8917978d3cdSmrg# arguments.  Must try -L first in case configure is actually a
8927978d3cdSmrg# symlink; some systems play weird games with the mod time of symlinks
8937978d3cdSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8947978d3cdSmrg# directory).
8957978d3cdSmrgif (
89687aef7c3Smrg   am_has_slept=no
89787aef7c3Smrg   for am_try in 1 2; do
89887aef7c3Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
89987aef7c3Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
90087aef7c3Smrg     if test "$[*]" = "X"; then
90187aef7c3Smrg	# -L didn't work.
90287aef7c3Smrg	set X `ls -t "$srcdir/configure" conftest.file`
90387aef7c3Smrg     fi
90487aef7c3Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
90587aef7c3Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
90687aef7c3Smrg
90787aef7c3Smrg	# If neither matched, then we have a broken ls.  This can happen
90887aef7c3Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
90987aef7c3Smrg	# broken ls alias from the environment.  This has actually
91087aef7c3Smrg	# happened.  Such a system could not be considered "sane".
91187aef7c3Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
91287aef7c3Smrg  alias in your environment])
91387aef7c3Smrg     fi
91487aef7c3Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
91587aef7c3Smrg       break
91687aef7c3Smrg     fi
91787aef7c3Smrg     # Just in case.
91887aef7c3Smrg     sleep 1
91987aef7c3Smrg     am_has_slept=yes
92087aef7c3Smrg   done
9217978d3cdSmrg   test "$[2]" = conftest.file
9227978d3cdSmrg   )
9237978d3cdSmrgthen
9247978d3cdSmrg   # Ok.
9257978d3cdSmrg   :
926ea6ae205Smrgelse
9277978d3cdSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
9287978d3cdSmrgCheck your system clock])
929ea6ae205Smrgfi
93087aef7c3SmrgAC_MSG_RESULT([yes])
93187aef7c3Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
93287aef7c3Smrg# generated files are strictly newer.
93387aef7c3Smrgam_sleep_pid=
93487aef7c3Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
93587aef7c3Smrg  ( sleep 1 ) &
93687aef7c3Smrg  am_sleep_pid=$!
93787aef7c3Smrgfi
93887aef7c3SmrgAC_CONFIG_COMMANDS_PRE(
93987aef7c3Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
94087aef7c3Smrg   if test -n "$am_sleep_pid"; then
94187aef7c3Smrg     # Hide warnings about reused PIDs.
94287aef7c3Smrg     wait $am_sleep_pid 2>/dev/null
94387aef7c3Smrg   fi
94487aef7c3Smrg   AC_MSG_RESULT([done])])
94587aef7c3Smrgrm -f conftest.file
94687aef7c3Smrg])
947ea6ae205Smrg
94887aef7c3Smrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
949e83ac88aSmrg#
950e83ac88aSmrg# This file is free software; the Free Software Foundation
951e83ac88aSmrg# gives unlimited permission to copy and/or distribute it,
952e83ac88aSmrg# with or without modifications, as long as this notice is preserved.
953e83ac88aSmrg
954e83ac88aSmrg# AM_SILENT_RULES([DEFAULT])
955e83ac88aSmrg# --------------------------
956e83ac88aSmrg# Enable less verbose build rules; with the default set to DEFAULT
95787aef7c3Smrg# ("yes" being less verbose, "no" or empty being verbose).
958e83ac88aSmrgAC_DEFUN([AM_SILENT_RULES],
95987aef7c3Smrg[AC_ARG_ENABLE([silent-rules], [dnl
96087aef7c3SmrgAS_HELP_STRING(
96187aef7c3Smrg  [--enable-silent-rules],
96287aef7c3Smrg  [less verbose build output (undo: "make V=1")])
96387aef7c3SmrgAS_HELP_STRING(
96487aef7c3Smrg  [--disable-silent-rules],
96587aef7c3Smrg  [verbose build output (undo: "make V=0")])dnl
96687aef7c3Smrg])
96787aef7c3Smrgcase $enable_silent_rules in @%:@ (((
96887aef7c3Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
96987aef7c3Smrg   no) AM_DEFAULT_VERBOSITY=1;;
97087aef7c3Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
971e83ac88aSmrgesac
97287aef7c3Smrgdnl
97387aef7c3Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
97487aef7c3Smrgdnl do not support nested variable expansions.
97587aef7c3Smrgdnl See automake bug#9928 and bug#10237.
97687aef7c3Smrgam_make=${MAKE-make}
97787aef7c3SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
97887aef7c3Smrg   [am_cv_make_support_nested_variables],
97987aef7c3Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
98087aef7c3SmrgBAR0=false
98187aef7c3SmrgBAR1=true
98287aef7c3SmrgV=1
98387aef7c3Smrgam__doit:
98487aef7c3Smrg	@$(TRUE)
98587aef7c3Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
98687aef7c3Smrg  am_cv_make_support_nested_variables=yes
98787aef7c3Smrgelse
98887aef7c3Smrg  am_cv_make_support_nested_variables=no
98987aef7c3Smrgfi])
99087aef7c3Smrgif test $am_cv_make_support_nested_variables = yes; then
99187aef7c3Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
99287aef7c3Smrg  AM_V='$(V)'
99387aef7c3Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
99487aef7c3Smrgelse
99587aef7c3Smrg  AM_V=$AM_DEFAULT_VERBOSITY
99687aef7c3Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
99787aef7c3Smrgfi
99887aef7c3SmrgAC_SUBST([AM_V])dnl
99987aef7c3SmrgAM_SUBST_NOTMAKE([AM_V])dnl
100087aef7c3SmrgAC_SUBST([AM_DEFAULT_V])dnl
100187aef7c3SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1002e83ac88aSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1003e83ac88aSmrgAM_BACKSLASH='\'
1004e83ac88aSmrgAC_SUBST([AM_BACKSLASH])dnl
1005e83ac88aSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1006e83ac88aSmrg])
1007e83ac88aSmrg
100887aef7c3Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
10097978d3cdSmrg#
10107978d3cdSmrg# This file is free software; the Free Software Foundation
10117978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
10127978d3cdSmrg# with or without modifications, as long as this notice is preserved.
1013ea6ae205Smrg
10147978d3cdSmrg# AM_PROG_INSTALL_STRIP
10157978d3cdSmrg# ---------------------
101687aef7c3Smrg# One issue with vendor 'install' (even GNU) is that you can't
10177978d3cdSmrg# specify the program used to strip binaries.  This is especially
10187978d3cdSmrg# annoying in cross-compiling environments, where the build's strip
10197978d3cdSmrg# is unlikely to handle the host's binaries.
10207978d3cdSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
102187aef7c3Smrg# always use install-sh in "make install-strip", and initialize
10227978d3cdSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
10237978d3cdSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
10247978d3cdSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
102587aef7c3Smrg# Installed binaries are usually stripped using 'strip' when the user
102687aef7c3Smrg# run "make install-strip".  However 'strip' might not be the right
10277978d3cdSmrg# tool to use in cross-compilation environments, therefore Automake
102887aef7c3Smrg# will honor the 'STRIP' environment variable to overrule this program.
102987aef7c3Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
10307978d3cdSmrgif test "$cross_compiling" != no; then
10317978d3cdSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
10327978d3cdSmrgfi
10337978d3cdSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
10347978d3cdSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1035ea6ae205Smrg
103687aef7c3Smrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
10377978d3cdSmrg#
10387978d3cdSmrg# This file is free software; the Free Software Foundation
10397978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
10407978d3cdSmrg# with or without modifications, as long as this notice is preserved.
1041ea6ae205Smrg
10427978d3cdSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10437978d3cdSmrg# ---------------------------
1044e83ac88aSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10457978d3cdSmrg# This macro is traced by Automake.
10467978d3cdSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1047ea6ae205Smrg
1048e83ac88aSmrg# AM_SUBST_NOTMAKE(VARIABLE)
104987aef7c3Smrg# --------------------------
1050e83ac88aSmrg# Public sister of _AM_SUBST_NOTMAKE.
1051e83ac88aSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1052e83ac88aSmrg
10537978d3cdSmrg# Check how to create a tarball.                            -*- Autoconf -*-
1054ea6ae205Smrg
105587aef7c3Smrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
1056ea6ae205Smrg#
1057ea6ae205Smrg# This file is free software; the Free Software Foundation
1058ea6ae205Smrg# gives unlimited permission to copy and/or distribute it,
1059ea6ae205Smrg# with or without modifications, as long as this notice is preserved.
1060ea6ae205Smrg
10617978d3cdSmrg# _AM_PROG_TAR(FORMAT)
10627978d3cdSmrg# --------------------
10637978d3cdSmrg# Check how to create a tarball in format FORMAT.
106487aef7c3Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10657978d3cdSmrg#
10667978d3cdSmrg# Substitute a variable $(am__tar) that is a command
10677978d3cdSmrg# writing to stdout a FORMAT-tarball containing the directory
10687978d3cdSmrg# $tardir.
10697978d3cdSmrg#     tardir=directory && $(am__tar) > result.tar
10707978d3cdSmrg#
10717978d3cdSmrg# Substitute a variable $(am__untar) that extract such
10727978d3cdSmrg# a tarball read from stdin.
10737978d3cdSmrg#     $(am__untar) < result.tar
107487aef7c3Smrg#
10757978d3cdSmrgAC_DEFUN([_AM_PROG_TAR],
107687aef7c3Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
107787aef7c3Smrg# in the wild :-(  We should find a proper way to deprecate it ...
107887aef7c3SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
107987aef7c3Smrg
108087aef7c3Smrg# We'll loop over all known methods to create a tar archive until one works.
10817978d3cdSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10827978d3cdSmrg
108387aef7c3Smrgm4_if([$1], [v7],
108487aef7c3Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
108587aef7c3Smrg
108687aef7c3Smrg  [m4_case([$1],
108787aef7c3Smrg    [ustar],
108887aef7c3Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
108987aef7c3Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
109087aef7c3Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
109187aef7c3Smrg      # and bug#13588).
109287aef7c3Smrg      am_max_uid=2097151 # 2^21 - 1
109387aef7c3Smrg      am_max_gid=$am_max_uid
109487aef7c3Smrg      # The $UID and $GID variables are not portable, so we need to resort
109587aef7c3Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
109687aef7c3Smrg      # below are definitely unexpected, so allow the users to see them
109787aef7c3Smrg      # (that is, avoid stderr redirection).
109887aef7c3Smrg      am_uid=`id -u || echo unknown`
109987aef7c3Smrg      am_gid=`id -g || echo unknown`
110087aef7c3Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
110187aef7c3Smrg      if test $am_uid -le $am_max_uid; then
110287aef7c3Smrg         AC_MSG_RESULT([yes])
110387aef7c3Smrg      else
110487aef7c3Smrg         AC_MSG_RESULT([no])
110587aef7c3Smrg         _am_tools=none
110687aef7c3Smrg      fi
110787aef7c3Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
110887aef7c3Smrg      if test $am_gid -le $am_max_gid; then
110987aef7c3Smrg         AC_MSG_RESULT([yes])
111087aef7c3Smrg      else
111187aef7c3Smrg        AC_MSG_RESULT([no])
111287aef7c3Smrg        _am_tools=none
111387aef7c3Smrg      fi],
111487aef7c3Smrg
111587aef7c3Smrg  [pax],
111687aef7c3Smrg    [],
111787aef7c3Smrg
111887aef7c3Smrg  [m4_fatal([Unknown tar format])])
111987aef7c3Smrg
112087aef7c3Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
112187aef7c3Smrg
112287aef7c3Smrg  # Go ahead even if we have the value already cached.  We do so because we
112387aef7c3Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
112487aef7c3Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
112587aef7c3Smrg
112687aef7c3Smrg  for _am_tool in $_am_tools; do
112787aef7c3Smrg    case $_am_tool in
112887aef7c3Smrg    gnutar)
112987aef7c3Smrg      for _am_tar in tar gnutar gtar; do
113087aef7c3Smrg        AM_RUN_LOG([$_am_tar --version]) && break
113187aef7c3Smrg      done
113287aef7c3Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
113387aef7c3Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
113487aef7c3Smrg      am__untar="$_am_tar -xf -"
113587aef7c3Smrg      ;;
113687aef7c3Smrg    plaintar)
113787aef7c3Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
113887aef7c3Smrg      # ustar tarball either.
113987aef7c3Smrg      (tar --version) >/dev/null 2>&1 && continue
114087aef7c3Smrg      am__tar='tar chf - "$$tardir"'
114187aef7c3Smrg      am__tar_='tar chf - "$tardir"'
114287aef7c3Smrg      am__untar='tar xf -'
114387aef7c3Smrg      ;;
114487aef7c3Smrg    pax)
114587aef7c3Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
114687aef7c3Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
114787aef7c3Smrg      am__untar='pax -r'
114887aef7c3Smrg      ;;
114987aef7c3Smrg    cpio)
115087aef7c3Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
115187aef7c3Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
115287aef7c3Smrg      am__untar='cpio -i -H $1 -d'
115387aef7c3Smrg      ;;
115487aef7c3Smrg    none)
115587aef7c3Smrg      am__tar=false
115687aef7c3Smrg      am__tar_=false
115787aef7c3Smrg      am__untar=false
115887aef7c3Smrg      ;;
115987aef7c3Smrg    esac
11607978d3cdSmrg
116187aef7c3Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
116287aef7c3Smrg    # and am__untar set.
116387aef7c3Smrg    test -n "${am_cv_prog_tar_$1}" && break
116487aef7c3Smrg
116587aef7c3Smrg    # tar/untar a dummy directory, and stop if the command works.
116687aef7c3Smrg    rm -rf conftest.dir
116787aef7c3Smrg    mkdir conftest.dir
116887aef7c3Smrg    echo GrepMe > conftest.dir/file
116987aef7c3Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
117087aef7c3Smrg    rm -rf conftest.dir
117187aef7c3Smrg    if test -s conftest.tar; then
117287aef7c3Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
117387aef7c3Smrg      AM_RUN_LOG([cat conftest.dir/file])
117487aef7c3Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
117587aef7c3Smrg    fi
117687aef7c3Smrg  done
11777978d3cdSmrg  rm -rf conftest.dir
1178ea6ae205Smrg
117987aef7c3Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
118087aef7c3Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
118187aef7c3Smrg
11827978d3cdSmrgAC_SUBST([am__tar])
11837978d3cdSmrgAC_SUBST([am__untar])
11847978d3cdSmrg]) # _AM_PROG_TAR
1185ea6ae205Smrg
1186663cdc11Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1187663cdc11Smrg# 
1188663cdc11Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1189663cdc11Smrg#
1190663cdc11Smrg# This program is free software; you can redistribute it and/or modify
1191663cdc11Smrg# it under the terms of the GNU General Public License as published by
1192663cdc11Smrg# the Free Software Foundation; either version 2 of the License, or
1193663cdc11Smrg# (at your option) any later version.
1194663cdc11Smrg#
1195663cdc11Smrg# This program is distributed in the hope that it will be useful, but
1196663cdc11Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1197663cdc11Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1198663cdc11Smrg# General Public License for more details.
1199663cdc11Smrg#
1200663cdc11Smrg# You should have received a copy of the GNU General Public License
1201663cdc11Smrg# along with this program; if not, write to the Free Software
1202663cdc11Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1203663cdc11Smrg#
1204663cdc11Smrg# As a special exception to the GNU General Public License, if you
1205663cdc11Smrg# distribute this file as part of a program that contains a
1206663cdc11Smrg# configuration script generated by Autoconf, you may include it under
1207663cdc11Smrg# the same distribution terms that you use for the rest of that program.
1208663cdc11Smrg
1209663cdc11Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1210663cdc11Smrg# ----------------------------------
1211663cdc11SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1212663cdc11Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1213663cdc11Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1214663cdc11SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1215663cdc11Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1216663cdc11Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1217663cdc11Smrgfi
1218663cdc11Smrgif test -n "$PKG_CONFIG"; then
1219663cdc11Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1220663cdc11Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1221663cdc11Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1222663cdc11Smrg		AC_MSG_RESULT([yes])
1223663cdc11Smrg	else
1224663cdc11Smrg		AC_MSG_RESULT([no])
1225663cdc11Smrg		PKG_CONFIG=""
1226663cdc11Smrg	fi
1227663cdc11Smrg		
1228663cdc11Smrgfi[]dnl
1229663cdc11Smrg])# PKG_PROG_PKG_CONFIG
1230663cdc11Smrg
1231663cdc11Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232663cdc11Smrg#
1233663cdc11Smrg# Check to see whether a particular set of modules exists.  Similar
1234663cdc11Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1235663cdc11Smrg#
1236663cdc11Smrg#
1237663cdc11Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1238663cdc11Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
1239663cdc11Smrg# PKG_CHECK_EXISTS manually
1240663cdc11Smrg# --------------------------------------------------------------
1241663cdc11SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1242663cdc11Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1243663cdc11Smrgif test -n "$PKG_CONFIG" && \
1244663cdc11Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1245663cdc11Smrg  m4_ifval([$2], [$2], [:])
1246663cdc11Smrgm4_ifvaln([$3], [else
1247663cdc11Smrg  $3])dnl
1248663cdc11Smrgfi])
1249663cdc11Smrg
1250663cdc11Smrg
1251663cdc11Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252663cdc11Smrg# ---------------------------------------------
1253663cdc11Smrgm4_define([_PKG_CONFIG],
1254663cdc11Smrg[if test -n "$$1"; then
1255663cdc11Smrg    pkg_cv_[]$1="$$1"
1256663cdc11Smrg elif test -n "$PKG_CONFIG"; then
1257663cdc11Smrg    PKG_CHECK_EXISTS([$3],
1258663cdc11Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1259663cdc11Smrg		     [pkg_failed=yes])
1260663cdc11Smrg else
1261663cdc11Smrg    pkg_failed=untried
1262663cdc11Smrgfi[]dnl
1263663cdc11Smrg])# _PKG_CONFIG
1264663cdc11Smrg
1265663cdc11Smrg# _PKG_SHORT_ERRORS_SUPPORTED
1266663cdc11Smrg# -----------------------------
1267663cdc11SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1268663cdc11Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1269663cdc11Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1270663cdc11Smrg        _pkg_short_errors_supported=yes
1271663cdc11Smrgelse
1272663cdc11Smrg        _pkg_short_errors_supported=no
1273663cdc11Smrgfi[]dnl
1274663cdc11Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1275663cdc11Smrg
1276663cdc11Smrg
1277663cdc11Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1278663cdc11Smrg# [ACTION-IF-NOT-FOUND])
1279663cdc11Smrg#
1280663cdc11Smrg#
1281663cdc11Smrg# Note that if there is a possibility the first call to
1282663cdc11Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1283663cdc11Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1284663cdc11Smrg#
1285663cdc11Smrg#
1286663cdc11Smrg# --------------------------------------------------------------
1287663cdc11SmrgAC_DEFUN([PKG_CHECK_MODULES],
1288663cdc11Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1289663cdc11SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1290663cdc11SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1291663cdc11Smrg
1292663cdc11Smrgpkg_failed=no
1293663cdc11SmrgAC_MSG_CHECKING([for $1])
1294663cdc11Smrg
1295663cdc11Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1296663cdc11Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1297663cdc11Smrg
1298663cdc11Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1299663cdc11Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1300663cdc11SmrgSee the pkg-config man page for more details.])
1301663cdc11Smrg
1302663cdc11Smrgif test $pkg_failed = yes; then
1303663cdc11Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1304663cdc11Smrg        if test $_pkg_short_errors_supported = yes; then
1305663cdc11Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1306663cdc11Smrg        else 
1307663cdc11Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1308663cdc11Smrg        fi
1309663cdc11Smrg	# Put the nasty error message in config.log where it belongs
1310663cdc11Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1311663cdc11Smrg
1312663cdc11Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1313663cdc11Smrg[Package requirements ($2) were not met:
1314663cdc11Smrg
1315663cdc11Smrg$$1_PKG_ERRORS
1316663cdc11Smrg
1317663cdc11SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1318663cdc11Smrginstalled software in a non-standard prefix.
1319663cdc11Smrg
1320663cdc11Smrg_PKG_TEXT
1321663cdc11Smrg])],
1322663cdc11Smrg		[AC_MSG_RESULT([no])
1323663cdc11Smrg                $4])
1324663cdc11Smrgelif test $pkg_failed = untried; then
1325663cdc11Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1326663cdc11Smrg[The pkg-config script could not be found or is too old.  Make sure it
1327663cdc11Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1328663cdc11Smrgpath to pkg-config.
1329663cdc11Smrg
1330663cdc11Smrg_PKG_TEXT
1331663cdc11Smrg
1332663cdc11SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1333663cdc11Smrg		[$4])
1334663cdc11Smrgelse
1335663cdc11Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1336663cdc11Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1337663cdc11Smrg        AC_MSG_RESULT([yes])
1338663cdc11Smrg	ifelse([$3], , :, [$3])
1339663cdc11Smrgfi[]dnl
1340663cdc11Smrg])# PKG_CHECK_MODULES
1341663cdc11Smrg
13427978d3cdSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
13437978d3cdSmrgdnl
1344b6f2c9ccSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
13457978d3cdSmrgdnl 
13467978d3cdSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1347b6f2c9ccSmrgdnl copy of this software and associated documentation files (the "Software"),
1348b6f2c9ccSmrgdnl to deal in the Software without restriction, including without limitation
1349b6f2c9ccSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1350b6f2c9ccSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1351b6f2c9ccSmrgdnl Software is furnished to do so, subject to the following conditions:
13527978d3cdSmrgdnl
1353b6f2c9ccSmrgdnl The above copyright notice and this permission notice (including the next
1354b6f2c9ccSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1355b6f2c9ccSmrgdnl Software.
13567978d3cdSmrgdnl
1357b6f2c9ccSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1358b6f2c9ccSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1359b6f2c9ccSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1360b6f2c9ccSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1361b6f2c9ccSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1362b6f2c9ccSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1363b6f2c9ccSmrgdnl DEALINGS IN THE SOFTWARE.
1364ea6ae205Smrg
13657978d3cdSmrg# XORG_MACROS_VERSION(required-version)
13667978d3cdSmrg# -------------------------------------
13677978d3cdSmrg# Minimum version: 1.1.0
1368ea6ae205Smrg#
13697978d3cdSmrg# If you're using a macro added in Version 1.1 or newer, include this in
13707978d3cdSmrg# your configure.ac with the minimum required version, such as:
13717978d3cdSmrg# XORG_MACROS_VERSION(1.1)
13727978d3cdSmrg#
1373e83ac88aSmrg# To ensure that this macro is defined, also add:
1374e83ac88aSmrg# m4_ifndef([XORG_MACROS_VERSION],
1375e83ac88aSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
13767978d3cdSmrg#
13777978d3cdSmrg#
13787978d3cdSmrg# See the "minimum version" comment for each macro you use to see what 
13797978d3cdSmrg# version you require.
1380e83ac88aSmrgm4_defun([XORG_MACROS_VERSION],[
138187aef7c3Smrgm4_define([vers_have], [1.17])
1382e83ac88aSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1383e83ac88aSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1384e83ac88aSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1385e83ac88aSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1386e83ac88aSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1387e83ac88aSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1388e83ac88aSmrgm4_undefine([vers_have])
1389e83ac88aSmrgm4_undefine([maj_have])
1390e83ac88aSmrgm4_undefine([maj_needed])
13917978d3cdSmrg]) # XORG_MACROS_VERSION
1392ea6ae205Smrg
13937978d3cdSmrg# XORG_PROG_RAWCPP()
13947978d3cdSmrg# ------------------
13957978d3cdSmrg# Minimum version: 1.0.0
13967978d3cdSmrg#
13977978d3cdSmrg# Find cpp program and necessary flags for use in pre-processing text files
13987978d3cdSmrg# such as man pages and config files
13997978d3cdSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14007978d3cdSmrgAC_REQUIRE([AC_PROG_CPP])
14017978d3cdSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
14027978d3cdSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1403ea6ae205Smrg
14047978d3cdSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14057978d3cdSmrg# which is not the best choice for supporting other OS'es, but covers most
14067978d3cdSmrg# of the ones we need for now.
14077978d3cdSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1408245f6787SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14097978d3cdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14107978d3cdSmrg	AC_MSG_RESULT([no])
14117978d3cdSmrgelse
14127978d3cdSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14137978d3cdSmrg		RAWCPPFLAGS=-undef
14147978d3cdSmrg		AC_MSG_RESULT([yes])
14157978d3cdSmrg	# under Cygwin unix is still defined even with -undef
14167978d3cdSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14177978d3cdSmrg		RAWCPPFLAGS="-undef -ansi"
14187978d3cdSmrg		AC_MSG_RESULT([yes, with -ansi])
14197978d3cdSmrg	else
14207978d3cdSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
14217978d3cdSmrg	fi
14227978d3cdSmrgfi
14237978d3cdSmrgrm -f conftest.$ac_ext
1424ea6ae205Smrg
14257978d3cdSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1426245f6787SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
14277978d3cdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
14287978d3cdSmrg	AC_MSG_RESULT([no])
14297978d3cdSmrgelse
14307978d3cdSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
14317978d3cdSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
14327978d3cdSmrg		AC_MSG_RESULT([yes])
14337978d3cdSmrg	else
14347978d3cdSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
14357978d3cdSmrg	fi
14367978d3cdSmrgfi
14377978d3cdSmrgrm -f conftest.$ac_ext
14387978d3cdSmrgAC_SUBST(RAWCPPFLAGS)
14397978d3cdSmrg]) # XORG_PROG_RAWCPP
1440ea6ae205Smrg
14417978d3cdSmrg# XORG_MANPAGE_SECTIONS()
14427978d3cdSmrg# -----------------------
14437978d3cdSmrg# Minimum version: 1.0.0
1444ea6ae205Smrg#
14457978d3cdSmrg# Determine which sections man pages go in for the different man page types
14467978d3cdSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
14477978d3cdSmrg# Not sure if there's any better way than just hardcoding by OS name.
14487978d3cdSmrg# Override default settings by setting environment variables
1449b6f2c9ccSmrg# Added MAN_SUBSTS in version 1.8
1450b6f2c9ccSmrg# Added AC_PROG_SED in version 1.8
1451ea6ae205Smrg
14527978d3cdSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
14537978d3cdSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1454b6f2c9ccSmrgAC_REQUIRE([AC_PROG_SED])
1455ea6ae205Smrg
14567978d3cdSmrgif test x$APP_MAN_SUFFIX = x    ; then
14577978d3cdSmrg    APP_MAN_SUFFIX=1
14587978d3cdSmrgfi
14597978d3cdSmrgif test x$APP_MAN_DIR = x    ; then
14607978d3cdSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1461ea6ae205Smrgfi
1462ea6ae205Smrg
14637978d3cdSmrgif test x$LIB_MAN_SUFFIX = x    ; then
14647978d3cdSmrg    LIB_MAN_SUFFIX=3
14657978d3cdSmrgfi
14667978d3cdSmrgif test x$LIB_MAN_DIR = x    ; then
14677978d3cdSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1468ea6ae205Smrgfi
1469ea6ae205Smrg
14707978d3cdSmrgif test x$FILE_MAN_SUFFIX = x    ; then
14717978d3cdSmrg    case $host_os in
14727978d3cdSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
14737978d3cdSmrg	*)		FILE_MAN_SUFFIX=5  ;;
14747978d3cdSmrg    esac
14757978d3cdSmrgfi
14767978d3cdSmrgif test x$FILE_MAN_DIR = x    ; then
14777978d3cdSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
14787978d3cdSmrgfi
1479ea6ae205Smrg
14807978d3cdSmrgif test x$MISC_MAN_SUFFIX = x    ; then
14817978d3cdSmrg    case $host_os in
14827978d3cdSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
14837978d3cdSmrg	*)		MISC_MAN_SUFFIX=7  ;;
14847978d3cdSmrg    esac
14857978d3cdSmrgfi
14867978d3cdSmrgif test x$MISC_MAN_DIR = x    ; then
14877978d3cdSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
14887978d3cdSmrgfi
1489ea6ae205Smrg
14907978d3cdSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
14917978d3cdSmrg    case $host_os in
14927978d3cdSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
14937978d3cdSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
14947978d3cdSmrg    esac
14957978d3cdSmrgfi
14967978d3cdSmrgif test x$DRIVER_MAN_DIR = x    ; then
14977978d3cdSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
14987978d3cdSmrgfi
1499ea6ae205Smrg
15007978d3cdSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15017978d3cdSmrg    case $host_os in
15027978d3cdSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
15037978d3cdSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
15047978d3cdSmrg    esac
15057978d3cdSmrgfi
15067978d3cdSmrgif test x$ADMIN_MAN_DIR = x    ; then
15077978d3cdSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
15087978d3cdSmrgfi
1509ea6ae205Smrg
1510ea6ae205Smrg
15117978d3cdSmrgAC_SUBST([APP_MAN_SUFFIX])
15127978d3cdSmrgAC_SUBST([LIB_MAN_SUFFIX])
15137978d3cdSmrgAC_SUBST([FILE_MAN_SUFFIX])
15147978d3cdSmrgAC_SUBST([MISC_MAN_SUFFIX])
15157978d3cdSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
15167978d3cdSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
15177978d3cdSmrgAC_SUBST([APP_MAN_DIR])
15187978d3cdSmrgAC_SUBST([LIB_MAN_DIR])
15197978d3cdSmrgAC_SUBST([FILE_MAN_DIR])
15207978d3cdSmrgAC_SUBST([MISC_MAN_DIR])
15217978d3cdSmrgAC_SUBST([DRIVER_MAN_DIR])
15227978d3cdSmrgAC_SUBST([ADMIN_MAN_DIR])
1523b6f2c9ccSmrg
1524b6f2c9ccSmrgXORG_MAN_PAGE="X Version 11"
1525b6f2c9ccSmrgAC_SUBST([XORG_MAN_PAGE])
1526b6f2c9ccSmrgMAN_SUBSTS="\
1527b6f2c9ccSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1528b6f2c9ccSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1529b6f2c9ccSmrg	-e 's|__xservername__|Xorg|g' \
1530b6f2c9ccSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1531b6f2c9ccSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1532b6f2c9ccSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1533b6f2c9ccSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1534b6f2c9ccSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1535b6f2c9ccSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1536b6f2c9ccSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1537b6f2c9ccSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1538b6f2c9ccSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1539b6f2c9ccSmrgAC_SUBST([MAN_SUBSTS])
1540b6f2c9ccSmrg
15417978d3cdSmrg]) # XORG_MANPAGE_SECTIONS
1542ea6ae205Smrg
1543b6f2c9ccSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1544b6f2c9ccSmrg# ------------------------
1545b6f2c9ccSmrg# Minimum version: 1.7.0
1546b6f2c9ccSmrg#
1547b6f2c9ccSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1548b6f2c9ccSmrg# provided by xorg-sgml-doctools, if installed.
1549b6f2c9ccSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1550b6f2c9ccSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1551b6f2c9ccSmrgXORG_SGML_PATH=
1552b6f2c9ccSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1553b6f2c9ccSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1554b6f2c9ccSmrg    [m4_ifval([$1],[:],
1555b6f2c9ccSmrg        [if test x"$cross_compiling" != x"yes" ; then
1556b6f2c9ccSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1557b6f2c9ccSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1558b6f2c9ccSmrg         fi])
1559b6f2c9ccSmrg    ])
1560b6f2c9ccSmrg
1561b6f2c9ccSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1562b6f2c9ccSmrg# the path and the name of the doc stylesheet
1563b6f2c9ccSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1564b6f2c9ccSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1565b6f2c9ccSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1566b6f2c9ccSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1567b6f2c9ccSmrgelse
1568b6f2c9ccSmrg   AC_MSG_RESULT([no])
1569b6f2c9ccSmrgfi
1570b6f2c9ccSmrg
1571b6f2c9ccSmrgAC_SUBST(XORG_SGML_PATH)
1572b6f2c9ccSmrgAC_SUBST(STYLESHEET_SRCDIR)
1573b6f2c9ccSmrgAC_SUBST(XSL_STYLESHEET)
1574b6f2c9ccSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1575b6f2c9ccSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1576b6f2c9ccSmrg
15777978d3cdSmrg# XORG_CHECK_LINUXDOC
15787978d3cdSmrg# -------------------
15797978d3cdSmrg# Minimum version: 1.0.0
1580ea6ae205Smrg#
15817978d3cdSmrg# Defines the variable MAKE_TEXT if the necessary tools and
15827978d3cdSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
15837978d3cdSmrg# Whether or not the necessary tools and files are found can be checked
15847978d3cdSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
15857978d3cdSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1586b6f2c9ccSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1587b6f2c9ccSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1588ea6ae205Smrg
15897978d3cdSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1590ea6ae205Smrg
1591b6f2c9ccSmrgAC_MSG_CHECKING([whether to build documentation])
1592ea6ae205Smrg
1593b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
15947978d3cdSmrg   BUILDDOC=yes
1595ea6ae205Smrgelse
15967978d3cdSmrg   BUILDDOC=no
1597ea6ae205Smrgfi
1598ea6ae205Smrg
15997978d3cdSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1600ea6ae205Smrg
16017978d3cdSmrgAC_MSG_RESULT([$BUILDDOC])
1602ea6ae205Smrg
1603b6f2c9ccSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1604ea6ae205Smrg
1605b6f2c9ccSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
16067978d3cdSmrg   BUILDPDFDOC=yes
16077978d3cdSmrgelse
16087978d3cdSmrg   BUILDPDFDOC=no
16097978d3cdSmrgfi
1610ea6ae205Smrg
16117978d3cdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1612ea6ae205Smrg
16137978d3cdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1614ea6ae205Smrg
1615b6f2c9ccSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
16167978d3cdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
16177978d3cdSmrgMAKE_PDF="$PS2PDF"
16187978d3cdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1619ea6ae205Smrg
16207978d3cdSmrgAC_SUBST(MAKE_TEXT)
16217978d3cdSmrgAC_SUBST(MAKE_PS)
16227978d3cdSmrgAC_SUBST(MAKE_PDF)
16237978d3cdSmrgAC_SUBST(MAKE_HTML)
16247978d3cdSmrg]) # XORG_CHECK_LINUXDOC
1625ea6ae205Smrg
16267978d3cdSmrg# XORG_CHECK_DOCBOOK
16277978d3cdSmrg# -------------------
16287978d3cdSmrg# Minimum version: 1.0.0
16297978d3cdSmrg#
16307978d3cdSmrg# Checks for the ability to build output formats from SGML DocBook source.
16317978d3cdSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16327978d3cdSmrg# indicates whether the necessary tools and files are found and, if set,
16337978d3cdSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16347978d3cdSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1635b6f2c9ccSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1636b6f2c9ccSmrg
16377978d3cdSmrgBUILDTXTDOC=no
16387978d3cdSmrgBUILDPDFDOC=no
16397978d3cdSmrgBUILDPSDOC=no
16407978d3cdSmrgBUILDHTMLDOC=no
1641ea6ae205Smrg
16427978d3cdSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16437978d3cdSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16447978d3cdSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16457978d3cdSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1646ea6ae205Smrg
1647b6f2c9ccSmrgAC_MSG_CHECKING([whether to build text documentation])
1648b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16497978d3cdSmrg   test x$BUILD_TXTDOC != xno; then
16507978d3cdSmrg	BUILDTXTDOC=yes
16517978d3cdSmrgfi
16527978d3cdSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16537978d3cdSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1654ea6ae205Smrg
1655b6f2c9ccSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1656b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16577978d3cdSmrg   test x$BUILD_PDFDOC != xno; then
16587978d3cdSmrg	BUILDPDFDOC=yes
16597978d3cdSmrgfi
16607978d3cdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16617978d3cdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1662ea6ae205Smrg
1663b6f2c9ccSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1664b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
16657978d3cdSmrg   test x$BUILD_PSDOC != xno; then
16667978d3cdSmrg	BUILDPSDOC=yes
16677978d3cdSmrgfi
16687978d3cdSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
16697978d3cdSmrgAC_MSG_RESULT([$BUILDPSDOC])
1670ea6ae205Smrg
1671b6f2c9ccSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1672b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
16737978d3cdSmrg   test x$BUILD_HTMLDOC != xno; then
16747978d3cdSmrg	BUILDHTMLDOC=yes
1675ea6ae205Smrgfi
16767978d3cdSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
16777978d3cdSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1678ea6ae205Smrg
16797978d3cdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
16807978d3cdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
16817978d3cdSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
16827978d3cdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1683ea6ae205Smrg
16847978d3cdSmrgAC_SUBST(MAKE_TEXT)
16857978d3cdSmrgAC_SUBST(MAKE_PS)
16867978d3cdSmrgAC_SUBST(MAKE_PDF)
16877978d3cdSmrgAC_SUBST(MAKE_HTML)
16887978d3cdSmrg]) # XORG_CHECK_DOCBOOK
1689ea6ae205Smrg
1690b6f2c9ccSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1691b6f2c9ccSmrg# ----------------
1692b6f2c9ccSmrg# Minimum version: 1.5.0
1693b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1694b6f2c9ccSmrg#
1695b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
1696b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
1697b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1698b6f2c9ccSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1699b6f2c9ccSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1700b6f2c9ccSmrg# --with-xmlto assumes 'auto'.
1701b6f2c9ccSmrg#
1702b6f2c9ccSmrg# Interface to module:
1703b6f2c9ccSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1704b6f2c9ccSmrg# XMLTO:	returns the path of the xmlto program found
1705b6f2c9ccSmrg#		returns the path set by the user in the environment
1706b6f2c9ccSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1707b6f2c9ccSmrg#		'no' user instructs the module not to use xmlto
1708b6f2c9ccSmrg#
1709b6f2c9ccSmrg# Added in version 1.10.0
1710b6f2c9ccSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1711b6f2c9ccSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1712b6f2c9ccSmrg#
1713b6f2c9ccSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1714b6f2c9ccSmrg#
1715b6f2c9ccSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1716b6f2c9ccSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1717b6f2c9ccSmrgm4_define([_defopt], m4_default([$2], [auto]))
1718b6f2c9ccSmrgAC_ARG_WITH(xmlto,
1719b6f2c9ccSmrg	AS_HELP_STRING([--with-xmlto],
1720b6f2c9ccSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1721b6f2c9ccSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1722b6f2c9ccSmrgm4_undefine([_defopt])
1723b6f2c9ccSmrg
1724b6f2c9ccSmrgif test "x$use_xmlto" = x"auto"; then
1725b6f2c9ccSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1726b6f2c9ccSmrg   if test "x$XMLTO" = "x"; then
1727b6f2c9ccSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1728b6f2c9ccSmrg	have_xmlto=no
1729b6f2c9ccSmrg   else
1730b6f2c9ccSmrg        have_xmlto=yes
1731b6f2c9ccSmrg   fi
1732b6f2c9ccSmrgelif test "x$use_xmlto" = x"yes" ; then
1733b6f2c9ccSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1734b6f2c9ccSmrg   if test "x$XMLTO" = "x"; then
1735b6f2c9ccSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1736b6f2c9ccSmrg   fi
1737b6f2c9ccSmrg   have_xmlto=yes
1738b6f2c9ccSmrgelif test "x$use_xmlto" = x"no" ; then
1739b6f2c9ccSmrg   if test "x$XMLTO" != "x"; then
1740b6f2c9ccSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1741b6f2c9ccSmrg   fi
1742b6f2c9ccSmrg   have_xmlto=no
1743b6f2c9ccSmrgelse
1744b6f2c9ccSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1745b6f2c9ccSmrgfi
1746b6f2c9ccSmrg
1747b6f2c9ccSmrg# Test for a minimum version of xmlto, if provided.
1748b6f2c9ccSmrgm4_ifval([$1],
1749b6f2c9ccSmrg[if test "$have_xmlto" = yes; then
1750b6f2c9ccSmrg    # scrape the xmlto version
1751b6f2c9ccSmrg    AC_MSG_CHECKING([the xmlto version])
1752b6f2c9ccSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1753b6f2c9ccSmrg    AC_MSG_RESULT([$xmlto_version])
1754b6f2c9ccSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1755b6f2c9ccSmrg        [if test "x$use_xmlto" = xauto; then
1756b6f2c9ccSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1757b6f2c9ccSmrg            have_xmlto=no
1758b6f2c9ccSmrg        else
1759b6f2c9ccSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1760b6f2c9ccSmrg        fi])
1761b6f2c9ccSmrgfi])
1762b6f2c9ccSmrg
1763b6f2c9ccSmrg# Test for the ability of xmlto to generate a text target
1764b6f2c9ccSmrghave_xmlto_text=no
1765b6f2c9ccSmrgcat > conftest.xml << "EOF"
1766b6f2c9ccSmrgEOF
1767b6f2c9ccSmrgAS_IF([test "$have_xmlto" = yes],
1768b6f2c9ccSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1769b6f2c9ccSmrg             [have_xmlto_text=yes],
1770b6f2c9ccSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1771b6f2c9ccSmrgrm -f conftest.xml
1772b6f2c9ccSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1773b6f2c9ccSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1774b6f2c9ccSmrg]) # XORG_WITH_XMLTO
1775b6f2c9ccSmrg
1776245f6787Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1777245f6787Smrg# --------------------------------------------
1778245f6787Smrg# Minimum version: 1.12.0
1779245f6787Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1780245f6787Smrg#
1781245f6787Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1782245f6787Smrg# XML-based language used for the transformation of XML documents.
1783245f6787Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1784245f6787Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1785245f6787Smrg# The XSLT processor is often used as a standalone tool for transformations.
1786245f6787Smrg# It should not be assumed that this tool is used only to work with documnetation.
1787245f6787Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1788245f6787Smrg#
1789245f6787Smrg# Interface to module:
1790245f6787Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1791245f6787Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1792245f6787Smrg#		 returns the path set by the user in the environment
1793245f6787Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1794245f6787Smrg#		  'no' user instructs the module not to use xsltproc
1795245f6787Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1796245f6787Smrg#
1797245f6787Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1798245f6787Smrg#
1799245f6787SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1800245f6787SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1801245f6787Smrg# Preserves the interface, should it be implemented later
1802245f6787Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1803245f6787Smrgm4_define([_defopt], m4_default([$2], [auto]))
1804245f6787SmrgAC_ARG_WITH(xsltproc,
1805245f6787Smrg	AS_HELP_STRING([--with-xsltproc],
1806245f6787Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1807245f6787Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1808245f6787Smrgm4_undefine([_defopt])
1809245f6787Smrg
1810245f6787Smrgif test "x$use_xsltproc" = x"auto"; then
1811245f6787Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1812245f6787Smrg   if test "x$XSLTPROC" = "x"; then
1813245f6787Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1814245f6787Smrg	have_xsltproc=no
1815245f6787Smrg   else
1816245f6787Smrg        have_xsltproc=yes
1817245f6787Smrg   fi
1818245f6787Smrgelif test "x$use_xsltproc" = x"yes" ; then
1819245f6787Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1820245f6787Smrg   if test "x$XSLTPROC" = "x"; then
1821245f6787Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1822245f6787Smrg   fi
1823245f6787Smrg   have_xsltproc=yes
1824245f6787Smrgelif test "x$use_xsltproc" = x"no" ; then
1825245f6787Smrg   if test "x$XSLTPROC" != "x"; then
1826245f6787Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1827245f6787Smrg   fi
1828245f6787Smrg   have_xsltproc=no
1829245f6787Smrgelse
1830245f6787Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1831245f6787Smrgfi
1832245f6787Smrg
1833245f6787SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1834245f6787Smrg]) # XORG_WITH_XSLTPROC
1835245f6787Smrg
1836245f6787Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1837245f6787Smrg# ----------------------------------------
1838245f6787Smrg# Minimum version: 1.15.0
1839245f6787Smrg#
1840245f6787Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1841245f6787Smrg# scanning arbitrary text files, extracting information from those text files,
1842245f6787Smrg# and printing reports based on that information.
1843245f6787Smrg#
1844245f6787Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1845245f6787Smrg#
1846245f6787Smrg# Interface to module:
1847245f6787Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1848245f6787Smrg# PERL:	     returns the path of the perl program found
1849245f6787Smrg#	     returns the path set by the user in the environment
1850245f6787Smrg# --with-perl: 'yes' user instructs the module to use perl
1851245f6787Smrg#	       'no' user instructs the module not to use perl
1852245f6787Smrg# have_perl: returns yes if perl found in PATH or no
1853245f6787Smrg#
1854245f6787Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1855245f6787Smrg#
1856245f6787SmrgAC_DEFUN([XORG_WITH_PERL],[
1857245f6787SmrgAC_ARG_VAR([PERL], [Path to perl command])
1858245f6787Smrg# Preserves the interface, should it be implemented later
1859245f6787Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1860245f6787Smrgm4_define([_defopt], m4_default([$2], [auto]))
1861245f6787SmrgAC_ARG_WITH(perl,
1862245f6787Smrg	AS_HELP_STRING([--with-perl],
1863245f6787Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1864245f6787Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1865245f6787Smrgm4_undefine([_defopt])
1866245f6787Smrg
1867245f6787Smrgif test "x$use_perl" = x"auto"; then
1868245f6787Smrg   AC_PATH_PROG([PERL], [perl])
1869245f6787Smrg   if test "x$PERL" = "x"; then
1870245f6787Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1871245f6787Smrg	have_perl=no
1872245f6787Smrg   else
1873245f6787Smrg        have_perl=yes
1874245f6787Smrg   fi
1875245f6787Smrgelif test "x$use_perl" = x"yes" ; then
1876245f6787Smrg   AC_PATH_PROG([PERL], [perl])
1877245f6787Smrg   if test "x$PERL" = "x"; then
1878245f6787Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1879245f6787Smrg   fi
1880245f6787Smrg   have_perl=yes
1881245f6787Smrgelif test "x$use_perl" = x"no" ; then
1882245f6787Smrg   if test "x$PERL" != "x"; then
1883245f6787Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1884245f6787Smrg   fi
1885245f6787Smrg   have_perl=no
1886245f6787Smrgelse
1887245f6787Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1888245f6787Smrgfi
1889245f6787Smrg
1890245f6787SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1891245f6787Smrg]) # XORG_WITH_PERL
1892245f6787Smrg
1893b6f2c9ccSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1894b6f2c9ccSmrg# ----------------
1895b6f2c9ccSmrg# Minimum version: 1.5.0
1896b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1897b6f2c9ccSmrg#
1898b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
1899b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
1900b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1901b6f2c9ccSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1902b6f2c9ccSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1903b6f2c9ccSmrg# --with-asciidoc assumes 'auto'.
1904b6f2c9ccSmrg#
1905b6f2c9ccSmrg# Interface to module:
1906b6f2c9ccSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1907b6f2c9ccSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1908b6f2c9ccSmrg#		 returns the path set by the user in the environment
1909b6f2c9ccSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1910b6f2c9ccSmrg#		  'no' user instructs the module not to use asciidoc
1911b6f2c9ccSmrg#
1912b6f2c9ccSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1913b6f2c9ccSmrg#
1914b6f2c9ccSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1915b6f2c9ccSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1916b6f2c9ccSmrgm4_define([_defopt], m4_default([$2], [auto]))
1917b6f2c9ccSmrgAC_ARG_WITH(asciidoc,
1918b6f2c9ccSmrg	AS_HELP_STRING([--with-asciidoc],
1919b6f2c9ccSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1920b6f2c9ccSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1921b6f2c9ccSmrgm4_undefine([_defopt])
1922b6f2c9ccSmrg
1923b6f2c9ccSmrgif test "x$use_asciidoc" = x"auto"; then
1924b6f2c9ccSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1925b6f2c9ccSmrg   if test "x$ASCIIDOC" = "x"; then
1926b6f2c9ccSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1927b6f2c9ccSmrg	have_asciidoc=no
1928b6f2c9ccSmrg   else
1929b6f2c9ccSmrg        have_asciidoc=yes
1930b6f2c9ccSmrg   fi
1931b6f2c9ccSmrgelif test "x$use_asciidoc" = x"yes" ; then
1932b6f2c9ccSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1933b6f2c9ccSmrg   if test "x$ASCIIDOC" = "x"; then
1934b6f2c9ccSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1935b6f2c9ccSmrg   fi
1936b6f2c9ccSmrg   have_asciidoc=yes
1937b6f2c9ccSmrgelif test "x$use_asciidoc" = x"no" ; then
1938b6f2c9ccSmrg   if test "x$ASCIIDOC" != "x"; then
1939b6f2c9ccSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1940b6f2c9ccSmrg   fi
1941b6f2c9ccSmrg   have_asciidoc=no
1942b6f2c9ccSmrgelse
1943b6f2c9ccSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1944b6f2c9ccSmrgfi
1945b6f2c9ccSmrgm4_ifval([$1],
1946b6f2c9ccSmrg[if test "$have_asciidoc" = yes; then
1947b6f2c9ccSmrg    # scrape the asciidoc version
1948b6f2c9ccSmrg    AC_MSG_CHECKING([the asciidoc version])
1949b6f2c9ccSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1950b6f2c9ccSmrg    AC_MSG_RESULT([$asciidoc_version])
1951b6f2c9ccSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1952b6f2c9ccSmrg        [if test "x$use_asciidoc" = xauto; then
1953b6f2c9ccSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1954b6f2c9ccSmrg            have_asciidoc=no
1955b6f2c9ccSmrg        else
1956b6f2c9ccSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1957b6f2c9ccSmrg        fi])
1958b6f2c9ccSmrgfi])
1959b6f2c9ccSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1960b6f2c9ccSmrg]) # XORG_WITH_ASCIIDOC
1961b6f2c9ccSmrg
1962b6f2c9ccSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1963b6f2c9ccSmrg# --------------------------------
1964b6f2c9ccSmrg# Minimum version: 1.5.0
1965b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1966b6f2c9ccSmrg#
1967b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
1968b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
1969b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1970b6f2c9ccSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1971b6f2c9ccSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1972b6f2c9ccSmrg# --with-doxygen assumes 'auto'.
1973b6f2c9ccSmrg#
1974b6f2c9ccSmrg# Interface to module:
1975b6f2c9ccSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1976b6f2c9ccSmrg# DOXYGEN:	 returns the path of the doxygen program found
1977b6f2c9ccSmrg#		 returns the path set by the user in the environment
1978b6f2c9ccSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1979b6f2c9ccSmrg#		  'no' user instructs the module not to use doxygen
1980b6f2c9ccSmrg#
1981b6f2c9ccSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1982b6f2c9ccSmrg#
1983b6f2c9ccSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1984b6f2c9ccSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1985b6f2c9ccSmrgm4_define([_defopt], m4_default([$2], [auto]))
1986b6f2c9ccSmrgAC_ARG_WITH(doxygen,
1987b6f2c9ccSmrg	AS_HELP_STRING([--with-doxygen],
1988b6f2c9ccSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1989b6f2c9ccSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1990b6f2c9ccSmrgm4_undefine([_defopt])
1991b6f2c9ccSmrg
1992b6f2c9ccSmrgif test "x$use_doxygen" = x"auto"; then
1993b6f2c9ccSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1994b6f2c9ccSmrg   if test "x$DOXYGEN" = "x"; then
1995b6f2c9ccSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1996b6f2c9ccSmrg	have_doxygen=no
1997b6f2c9ccSmrg   else
1998b6f2c9ccSmrg        have_doxygen=yes
1999b6f2c9ccSmrg   fi
2000b6f2c9ccSmrgelif test "x$use_doxygen" = x"yes" ; then
2001b6f2c9ccSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2002b6f2c9ccSmrg   if test "x$DOXYGEN" = "x"; then
2003b6f2c9ccSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2004b6f2c9ccSmrg   fi
2005b6f2c9ccSmrg   have_doxygen=yes
2006b6f2c9ccSmrgelif test "x$use_doxygen" = x"no" ; then
2007b6f2c9ccSmrg   if test "x$DOXYGEN" != "x"; then
2008b6f2c9ccSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2009b6f2c9ccSmrg   fi
2010b6f2c9ccSmrg   have_doxygen=no
2011b6f2c9ccSmrgelse
2012b6f2c9ccSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2013b6f2c9ccSmrgfi
2014b6f2c9ccSmrgm4_ifval([$1],
2015b6f2c9ccSmrg[if test "$have_doxygen" = yes; then
2016b6f2c9ccSmrg    # scrape the doxygen version
2017b6f2c9ccSmrg    AC_MSG_CHECKING([the doxygen version])
2018b6f2c9ccSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2019b6f2c9ccSmrg    AC_MSG_RESULT([$doxygen_version])
2020b6f2c9ccSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2021b6f2c9ccSmrg        [if test "x$use_doxygen" = xauto; then
2022b6f2c9ccSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2023b6f2c9ccSmrg            have_doxygen=no
2024b6f2c9ccSmrg        else
2025b6f2c9ccSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2026b6f2c9ccSmrg        fi])
2027b6f2c9ccSmrgfi])
2028b6f2c9ccSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2029b6f2c9ccSmrg]) # XORG_WITH_DOXYGEN
2030b6f2c9ccSmrg
2031b6f2c9ccSmrg# XORG_WITH_GROFF([DEFAULT])
2032b6f2c9ccSmrg# ----------------
2033b6f2c9ccSmrg# Minimum version: 1.6.0
2034b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2035b6f2c9ccSmrg#
2036b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
2037b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
2038b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2039b6f2c9ccSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2040b6f2c9ccSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2041b6f2c9ccSmrg# --with-groff assumes 'auto'.
2042b6f2c9ccSmrg#
2043b6f2c9ccSmrg# Interface to module:
2044b6f2c9ccSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2045b6f2c9ccSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2046b6f2c9ccSmrg# HAVE_GROFF_MS: the -ms macros package
2047b6f2c9ccSmrg# GROFF:	 returns the path of the groff program found
2048b6f2c9ccSmrg#		 returns the path set by the user in the environment
2049b6f2c9ccSmrg# --with-groff:	 'yes' user instructs the module to use groff
2050b6f2c9ccSmrg#		 'no' user instructs the module not to use groff
2051b6f2c9ccSmrg#
2052b6f2c9ccSmrg# Added in version 1.9.0:
2053b6f2c9ccSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2054b6f2c9ccSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2055b6f2c9ccSmrg#		   psselect from the psutils package.
2056b6f2c9ccSmrg#		   the ghostcript package. Refer to the grohtml man pages
2057b6f2c9ccSmrg#
2058b6f2c9ccSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2059b6f2c9ccSmrg#
2060b6f2c9ccSmrg# OS and distros often splits groff in a basic and full package, the former
2061b6f2c9ccSmrg# having the groff program and the later having devices, fonts and macros
2062b6f2c9ccSmrg# Checking for the groff executable is not enough.
2063b6f2c9ccSmrg#
2064b6f2c9ccSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2065b6f2c9ccSmrg# unset HAVE_GROFF or GROFF env variables.
2066b6f2c9ccSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2067b6f2c9ccSmrg#
2068b6f2c9ccSmrgAC_DEFUN([XORG_WITH_GROFF],[
2069b6f2c9ccSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2070b6f2c9ccSmrgm4_define([_defopt], m4_default([$1], [auto]))
2071b6f2c9ccSmrgAC_ARG_WITH(groff,
2072b6f2c9ccSmrg	AS_HELP_STRING([--with-groff],
2073b6f2c9ccSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2074b6f2c9ccSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2075b6f2c9ccSmrgm4_undefine([_defopt])
2076b6f2c9ccSmrg
2077b6f2c9ccSmrgif test "x$use_groff" = x"auto"; then
2078b6f2c9ccSmrg   AC_PATH_PROG([GROFF], [groff])
2079b6f2c9ccSmrg   if test "x$GROFF" = "x"; then
2080b6f2c9ccSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2081b6f2c9ccSmrg	have_groff=no
2082b6f2c9ccSmrg   else
2083b6f2c9ccSmrg        have_groff=yes
2084b6f2c9ccSmrg   fi
2085b6f2c9ccSmrgelif test "x$use_groff" = x"yes" ; then
2086b6f2c9ccSmrg   AC_PATH_PROG([GROFF], [groff])
2087b6f2c9ccSmrg   if test "x$GROFF" = "x"; then
2088b6f2c9ccSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2089b6f2c9ccSmrg   fi
2090b6f2c9ccSmrg   have_groff=yes
2091b6f2c9ccSmrgelif test "x$use_groff" = x"no" ; then
2092b6f2c9ccSmrg   if test "x$GROFF" != "x"; then
2093b6f2c9ccSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2094b6f2c9ccSmrg   fi
2095b6f2c9ccSmrg   have_groff=no
2096b6f2c9ccSmrgelse
2097b6f2c9ccSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2098b6f2c9ccSmrgfi
2099b6f2c9ccSmrg
2100b6f2c9ccSmrg# We have groff, test for the presence of the macro packages
2101b6f2c9ccSmrgif test "x$have_groff" = x"yes"; then
2102b6f2c9ccSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2103b6f2c9ccSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2104b6f2c9ccSmrg        groff_ms_works=yes
2105b6f2c9ccSmrg    else
2106b6f2c9ccSmrg        groff_ms_works=no
2107b6f2c9ccSmrg    fi
2108b6f2c9ccSmrg    AC_MSG_RESULT([$groff_ms_works])
2109b6f2c9ccSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2110b6f2c9ccSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2111b6f2c9ccSmrg        groff_mm_works=yes
2112b6f2c9ccSmrg    else
2113b6f2c9ccSmrg        groff_mm_works=no
2114b6f2c9ccSmrg    fi
2115b6f2c9ccSmrg    AC_MSG_RESULT([$groff_mm_works])
2116b6f2c9ccSmrgfi
2117b6f2c9ccSmrg
2118b6f2c9ccSmrg# We have groff, test for HTML dependencies, one command per package
2119b6f2c9ccSmrgif test "x$have_groff" = x"yes"; then
2120b6f2c9ccSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2121b6f2c9ccSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2122b6f2c9ccSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2123b6f2c9ccSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2124b6f2c9ccSmrg      have_groff_html=yes
2125b6f2c9ccSmrg   else
2126b6f2c9ccSmrg      have_groff_html=no
2127b6f2c9ccSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2128b6f2c9ccSmrg   fi
2129b6f2c9ccSmrgfi
2130b6f2c9ccSmrg
2131b6f2c9ccSmrg# Set Automake conditionals for Makefiles
2132b6f2c9ccSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2133b6f2c9ccSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2134b6f2c9ccSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2135b6f2c9ccSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2136b6f2c9ccSmrg]) # XORG_WITH_GROFF
2137b6f2c9ccSmrg
2138245f6787Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2139245f6787Smrg# ---------------------------------------
2140b6f2c9ccSmrg# Minimum version: 1.6.0
2141b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2142245f6787Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2143b6f2c9ccSmrg#
2144b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
2145b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
2146b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2147b6f2c9ccSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2148b6f2c9ccSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2149b6f2c9ccSmrg# --with-fop assumes 'auto'.
2150b6f2c9ccSmrg#
2151b6f2c9ccSmrg# Interface to module:
2152b6f2c9ccSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2153b6f2c9ccSmrg# FOP:	 	returns the path of the fop program found
2154b6f2c9ccSmrg#		returns the path set by the user in the environment
2155b6f2c9ccSmrg# --with-fop: 	'yes' user instructs the module to use fop
2156b6f2c9ccSmrg#		'no' user instructs the module not to use fop
2157b6f2c9ccSmrg#
2158b6f2c9ccSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2159b6f2c9ccSmrg#
2160b6f2c9ccSmrgAC_DEFUN([XORG_WITH_FOP],[
2161b6f2c9ccSmrgAC_ARG_VAR([FOP], [Path to fop command])
2162245f6787Smrgm4_define([_defopt], m4_default([$2], [auto]))
2163b6f2c9ccSmrgAC_ARG_WITH(fop,
2164b6f2c9ccSmrg	AS_HELP_STRING([--with-fop],
2165b6f2c9ccSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2166b6f2c9ccSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2167b6f2c9ccSmrgm4_undefine([_defopt])
2168b6f2c9ccSmrg
2169b6f2c9ccSmrgif test "x$use_fop" = x"auto"; then
2170b6f2c9ccSmrg   AC_PATH_PROG([FOP], [fop])
2171b6f2c9ccSmrg   if test "x$FOP" = "x"; then
2172b6f2c9ccSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2173b6f2c9ccSmrg	have_fop=no
2174b6f2c9ccSmrg   else
2175b6f2c9ccSmrg        have_fop=yes
2176b6f2c9ccSmrg   fi
2177b6f2c9ccSmrgelif test "x$use_fop" = x"yes" ; then
2178b6f2c9ccSmrg   AC_PATH_PROG([FOP], [fop])
2179b6f2c9ccSmrg   if test "x$FOP" = "x"; then
2180b6f2c9ccSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2181b6f2c9ccSmrg   fi
2182b6f2c9ccSmrg   have_fop=yes
2183b6f2c9ccSmrgelif test "x$use_fop" = x"no" ; then
2184b6f2c9ccSmrg   if test "x$FOP" != "x"; then
2185b6f2c9ccSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2186b6f2c9ccSmrg   fi
2187b6f2c9ccSmrg   have_fop=no
2188b6f2c9ccSmrgelse
2189b6f2c9ccSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2190b6f2c9ccSmrgfi
2191245f6787Smrg
2192245f6787Smrg# Test for a minimum version of fop, if provided.
2193245f6787Smrgm4_ifval([$1],
2194245f6787Smrg[if test "$have_fop" = yes; then
2195245f6787Smrg    # scrape the fop version
2196245f6787Smrg    AC_MSG_CHECKING([for fop minimum version])
2197245f6787Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2198245f6787Smrg    AC_MSG_RESULT([$fop_version])
2199245f6787Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2200245f6787Smrg        [if test "x$use_fop" = xauto; then
2201245f6787Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2202245f6787Smrg            have_fop=no
2203245f6787Smrg        else
2204245f6787Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2205245f6787Smrg        fi])
2206245f6787Smrgfi])
2207b6f2c9ccSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2208b6f2c9ccSmrg]) # XORG_WITH_FOP
2209b6f2c9ccSmrg
2210b6f2c9ccSmrg# XORG_WITH_PS2PDF([DEFAULT])
2211b6f2c9ccSmrg# ----------------
2212b6f2c9ccSmrg# Minimum version: 1.6.0
2213b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2214b6f2c9ccSmrg#
2215b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
2216b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
2217b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2218b6f2c9ccSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2219b6f2c9ccSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2220b6f2c9ccSmrg# --with-ps2pdf assumes 'auto'.
2221b6f2c9ccSmrg#
2222b6f2c9ccSmrg# Interface to module:
2223b6f2c9ccSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2224b6f2c9ccSmrg# PS2PDF:	returns the path of the ps2pdf program found
2225b6f2c9ccSmrg#		returns the path set by the user in the environment
2226b6f2c9ccSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2227b6f2c9ccSmrg#		 'no' user instructs the module not to use ps2pdf
2228b6f2c9ccSmrg#
2229b6f2c9ccSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2230b6f2c9ccSmrg#
2231b6f2c9ccSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2232b6f2c9ccSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2233b6f2c9ccSmrgm4_define([_defopt], m4_default([$1], [auto]))
2234b6f2c9ccSmrgAC_ARG_WITH(ps2pdf,
2235b6f2c9ccSmrg	AS_HELP_STRING([--with-ps2pdf],
2236b6f2c9ccSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2237b6f2c9ccSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2238b6f2c9ccSmrgm4_undefine([_defopt])
2239b6f2c9ccSmrg
2240b6f2c9ccSmrgif test "x$use_ps2pdf" = x"auto"; then
2241b6f2c9ccSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2242b6f2c9ccSmrg   if test "x$PS2PDF" = "x"; then
2243b6f2c9ccSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2244b6f2c9ccSmrg	have_ps2pdf=no
2245b6f2c9ccSmrg   else
2246b6f2c9ccSmrg        have_ps2pdf=yes
2247b6f2c9ccSmrg   fi
2248b6f2c9ccSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2249b6f2c9ccSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2250b6f2c9ccSmrg   if test "x$PS2PDF" = "x"; then
2251b6f2c9ccSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2252b6f2c9ccSmrg   fi
2253b6f2c9ccSmrg   have_ps2pdf=yes
2254b6f2c9ccSmrgelif test "x$use_ps2pdf" = x"no" ; then
2255b6f2c9ccSmrg   if test "x$PS2PDF" != "x"; then
2256b6f2c9ccSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2257b6f2c9ccSmrg   fi
2258b6f2c9ccSmrg   have_ps2pdf=no
2259b6f2c9ccSmrgelse
2260b6f2c9ccSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2261b6f2c9ccSmrgfi
2262b6f2c9ccSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2263b6f2c9ccSmrg]) # XORG_WITH_PS2PDF
2264b6f2c9ccSmrg
2265b6f2c9ccSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2266b6f2c9ccSmrg# ----------------
2267b6f2c9ccSmrg# Minimum version: 1.6.0
2268b6f2c9ccSmrg#
2269b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
2270b6f2c9ccSmrg# not at the appropriate level. This macro enables a builder to skip all
2271b6f2c9ccSmrg# documentation targets except traditional man pages.
2272b6f2c9ccSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2273b6f2c9ccSmrg# maximum flexibilty in controlling documentation building.
2274b6f2c9ccSmrg# Refer to:
2275b6f2c9ccSmrg# XORG_WITH_XMLTO         --with-xmlto
2276b6f2c9ccSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2277b6f2c9ccSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2278b6f2c9ccSmrg# XORG_WITH_FOP           --with-fop
2279b6f2c9ccSmrg# XORG_WITH_GROFF         --with-groff
2280b6f2c9ccSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2281b6f2c9ccSmrg#
2282b6f2c9ccSmrg# Interface to module:
2283b6f2c9ccSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2284b6f2c9ccSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2285b6f2c9ccSmrg#		 'no' user instructs the module not to generate docs
2286b6f2c9ccSmrg# parm1:	specify the default value, yes or no.
2287b6f2c9ccSmrg#
2288b6f2c9ccSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2289245f6787Smrgm4_define([docs_default], m4_default([$1], [yes]))
2290b6f2c9ccSmrgAC_ARG_ENABLE(docs,
2291b6f2c9ccSmrg	AS_HELP_STRING([--enable-docs],
2292245f6787Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2293245f6787Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2294245f6787Smrgm4_undefine([docs_default])
2295b6f2c9ccSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2296b6f2c9ccSmrgAC_MSG_CHECKING([whether to build documentation])
2297b6f2c9ccSmrgAC_MSG_RESULT([$build_docs])
2298b6f2c9ccSmrg]) # XORG_ENABLE_DOCS
2299b6f2c9ccSmrg
2300b6f2c9ccSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2301b6f2c9ccSmrg# ----------------
2302b6f2c9ccSmrg# Minimum version: 1.6.0
2303b6f2c9ccSmrg#
2304b6f2c9ccSmrg# This macro enables a builder to skip all developer documentation.
2305b6f2c9ccSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2306b6f2c9ccSmrg# maximum flexibilty in controlling documentation building.
2307b6f2c9ccSmrg# Refer to:
2308b6f2c9ccSmrg# XORG_WITH_XMLTO         --with-xmlto
2309b6f2c9ccSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2310b6f2c9ccSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2311b6f2c9ccSmrg# XORG_WITH_FOP           --with-fop
2312b6f2c9ccSmrg# XORG_WITH_GROFF         --with-groff
2313b6f2c9ccSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2314b6f2c9ccSmrg#
2315b6f2c9ccSmrg# Interface to module:
2316b6f2c9ccSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2317b6f2c9ccSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2318b6f2c9ccSmrg#			'no' user instructs the module not to generate developer docs
2319b6f2c9ccSmrg# parm1:		specify the default value, yes or no.
2320b6f2c9ccSmrg#
2321b6f2c9ccSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2322b6f2c9ccSmrgm4_define([devel_default], m4_default([$1], [yes]))
2323b6f2c9ccSmrgAC_ARG_ENABLE(devel-docs,
2324b6f2c9ccSmrg	AS_HELP_STRING([--enable-devel-docs],
2325b6f2c9ccSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2326b6f2c9ccSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2327b6f2c9ccSmrgm4_undefine([devel_default])
2328b6f2c9ccSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2329b6f2c9ccSmrgAC_MSG_CHECKING([whether to build developer documentation])
2330b6f2c9ccSmrgAC_MSG_RESULT([$build_devel_docs])
2331b6f2c9ccSmrg]) # XORG_ENABLE_DEVEL_DOCS
2332b6f2c9ccSmrg
2333b6f2c9ccSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2334b6f2c9ccSmrg# ----------------
2335b6f2c9ccSmrg# Minimum version: 1.6.0
2336b6f2c9ccSmrg#
2337b6f2c9ccSmrg# This macro enables a builder to skip all functional specification targets.
2338b6f2c9ccSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2339b6f2c9ccSmrg# maximum flexibilty in controlling documentation building.
2340b6f2c9ccSmrg# Refer to:
2341b6f2c9ccSmrg# XORG_WITH_XMLTO         --with-xmlto
2342b6f2c9ccSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2343b6f2c9ccSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2344b6f2c9ccSmrg# XORG_WITH_FOP           --with-fop
2345b6f2c9ccSmrg# XORG_WITH_GROFF         --with-groff
2346b6f2c9ccSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2347b6f2c9ccSmrg#
2348b6f2c9ccSmrg# Interface to module:
2349b6f2c9ccSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2350b6f2c9ccSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2351b6f2c9ccSmrg#			'no' user instructs the module not to generate specs
2352b6f2c9ccSmrg# parm1:		specify the default value, yes or no.
2353b6f2c9ccSmrg#
2354b6f2c9ccSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2355b6f2c9ccSmrgm4_define([spec_default], m4_default([$1], [yes]))
2356b6f2c9ccSmrgAC_ARG_ENABLE(specs,
2357b6f2c9ccSmrg	AS_HELP_STRING([--enable-specs],
2358b6f2c9ccSmrg	   [Enable building the specs (default: ]spec_default[)]),
2359b6f2c9ccSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2360b6f2c9ccSmrgm4_undefine([spec_default])
2361b6f2c9ccSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2362b6f2c9ccSmrgAC_MSG_CHECKING([whether to build functional specifications])
2363b6f2c9ccSmrgAC_MSG_RESULT([$build_specs])
2364b6f2c9ccSmrg]) # XORG_ENABLE_SPECS
2365b6f2c9ccSmrg
2366245f6787Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2367245f6787Smrg# ----------------------------------------------
2368245f6787Smrg# Minimum version: 1.13.0
2369245f6787Smrg#
2370245f6787Smrg# This macro enables a builder to enable/disable unit testing
2371245f6787Smrg# It makes no assumption about the test cases implementation
2372245f6787Smrg# Test cases may or may not use Automake "Support for test suites"
2373245f6787Smrg# They may or may not use the software utility library GLib
2374245f6787Smrg#
2375245f6787Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2376245f6787Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2377245f6787Smrg# The variable enable_unit_tests is used by other macros in this file.
2378245f6787Smrg#
2379245f6787Smrg# Interface to module:
2380245f6787Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2381245f6787Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2382245f6787Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2383245f6787Smrg#			'no' user instructs the module not to build tests
2384245f6787Smrg# parm1:		specify the default value, yes or no.
2385245f6787Smrg#
2386245f6787SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2387245f6787SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2388245f6787SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2389663cdc11SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2390245f6787Smrgm4_define([_defopt], m4_default([$1], [auto]))
2391245f6787SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2392245f6787Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2393245f6787Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2394245f6787Smrgm4_undefine([_defopt])
2395245f6787SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2396245f6787SmrgAC_MSG_CHECKING([whether to build unit test cases])
2397245f6787SmrgAC_MSG_RESULT([$enable_unit_tests])
2398245f6787Smrg]) # XORG_ENABLE_UNIT_TESTS
2399245f6787Smrg
240087aef7c3Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
240187aef7c3Smrg# ------------------------------------------------------
240287aef7c3Smrg# Minimum version: 1.17.0
240387aef7c3Smrg#
240487aef7c3Smrg# This macro enables a builder to enable/disable integration testing
240587aef7c3Smrg# It makes no assumption about the test cases' implementation
240687aef7c3Smrg# Test cases may or may not use Automake "Support for test suites"
240787aef7c3Smrg#
240887aef7c3Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
240987aef7c3Smrg# usually requires less dependencies and may be built and run under less
241087aef7c3Smrg# stringent environments than integration tests.
241187aef7c3Smrg#
241287aef7c3Smrg# Interface to module:
241387aef7c3Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
241487aef7c3Smrg# enable_integration_tests:   used in configure.ac for additional configuration
241587aef7c3Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
241687aef7c3Smrg#                             'no' user instructs the module not to build tests
241787aef7c3Smrg# parm1:                      specify the default value, yes or no.
241887aef7c3Smrg#
241987aef7c3SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
242087aef7c3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
242187aef7c3Smrgm4_define([_defopt], m4_default([$1], [auto]))
242287aef7c3SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
242387aef7c3Smrg	[Enable building integration test cases (default: ]_defopt[)]),
242487aef7c3Smrg	[enable_integration_tests=$enableval],
242587aef7c3Smrg	[enable_integration_tests=]_defopt)
242687aef7c3Smrgm4_undefine([_defopt])
242787aef7c3SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
242887aef7c3Smrg	[test "x$enable_integration_tests" != xno])
242987aef7c3SmrgAC_MSG_CHECKING([whether to build unit test cases])
243087aef7c3SmrgAC_MSG_RESULT([$enable_integration_tests])
243187aef7c3Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
243287aef7c3Smrg
2433245f6787Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2434245f6787Smrg# ----------------------------------------
2435245f6787Smrg# Minimum version: 1.13.0
2436245f6787Smrg#
2437245f6787Smrg# GLib is a library which provides advanced data structures and functions.
2438245f6787Smrg# This macro enables a module to test for the presence of Glib.
2439245f6787Smrg#
2440245f6787Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2441245f6787Smrg# Otherwise the value of $enable_unit_tests is blank.
2442245f6787Smrg#
244387aef7c3Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
244487aef7c3Smrg# test support usually requires less dependencies and may be built and run under
244587aef7c3Smrg# less stringent environments than integration tests.
244687aef7c3Smrg#
2447245f6787Smrg# Interface to module:
2448245f6787Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2449245f6787Smrg# with_glib: used in configure.ac to know if GLib has been found
2450245f6787Smrg# --with-glib:	'yes' user instructs the module to use glib
2451245f6787Smrg#		'no' user instructs the module not to use glib
2452245f6787Smrg#
2453245f6787SmrgAC_DEFUN([XORG_WITH_GLIB],[
2454245f6787SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2455245f6787Smrgm4_define([_defopt], m4_default([$2], [auto]))
2456245f6787SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2457245f6787Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2458245f6787Smrg	[with_glib=$withval], [with_glib=]_defopt)
2459245f6787Smrgm4_undefine([_defopt])
2460245f6787Smrg
2461245f6787Smrghave_glib=no
2462245f6787Smrg# Do not probe GLib if user explicitly disabled unit testing
2463245f6787Smrgif test "x$enable_unit_tests" != x"no"; then
2464245f6787Smrg  # Do not probe GLib if user explicitly disabled it
2465245f6787Smrg  if test "x$with_glib" != x"no"; then
2466245f6787Smrg    m4_ifval(
2467245f6787Smrg      [$1],
2468245f6787Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2469245f6787Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2470245f6787Smrg    )
2471245f6787Smrg  fi
2472245f6787Smrgfi
2473245f6787Smrg
2474245f6787Smrg# Not having GLib when unit testing has been explicitly requested is an error
2475245f6787Smrgif test "x$enable_unit_tests" = x"yes"; then
2476245f6787Smrg  if test "x$have_glib" = x"no"; then
2477245f6787Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2478245f6787Smrg  fi
2479245f6787Smrgfi
2480245f6787Smrg
2481245f6787Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2482245f6787Smrgif test "x$enable_unit_tests" = x"no"; then
2483245f6787Smrg  if test "x$with_glib" = x"yes"; then
2484245f6787Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2485245f6787Smrg  fi
2486245f6787Smrgfi
2487245f6787Smrg
2488245f6787Smrg# Not having GLib when it has been explicitly requested is an error
2489245f6787Smrgif test "x$with_glib" = x"yes"; then
2490245f6787Smrg  if test "x$have_glib" = x"no"; then
2491245f6787Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2492245f6787Smrg  fi
2493245f6787Smrgfi
2494245f6787Smrg
2495245f6787SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2496245f6787Smrg]) # XORG_WITH_GLIB
2497245f6787Smrg
2498663cdc11Smrg# XORG_LD_WRAP([required|optional])
2499663cdc11Smrg# ---------------------------------
2500245f6787Smrg# Minimum version: 1.13.0
2501245f6787Smrg#
2502245f6787Smrg# Check if linker supports -wrap, passed via compiler flags
2503245f6787Smrg#
2504245f6787Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2505245f6787Smrg# Otherwise the value of $enable_unit_tests is blank.
2506245f6787Smrg#
2507663cdc11Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2508663cdc11Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2509663cdc11Smrg# available, an argument of "optional" allows use when some unit tests require
2510663cdc11Smrg# ld -wrap and others do not.
2511663cdc11Smrg#
2512245f6787SmrgAC_DEFUN([XORG_LD_WRAP],[
2513663cdc11SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2514663cdc11Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2515663cdc11Smrg                      void __wrap_exit(int status) { return; }],
2516663cdc11Smrg                     [exit(0);])])
2517245f6787Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2518663cdc11Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2519245f6787Smrg  if test "x$have_ld_wrap" = x"no"; then
2520245f6787Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2521245f6787Smrg  fi
2522245f6787Smrgfi
2523245f6787SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2524245f6787Smrg#
2525245f6787Smrg]) # XORG_LD_WRAP
2526245f6787Smrg
2527245f6787Smrg# XORG_CHECK_LINKER_FLAGS
2528245f6787Smrg# -----------------------
2529245f6787Smrg# SYNOPSIS
2530245f6787Smrg#
2531663cdc11Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2532245f6787Smrg#
2533245f6787Smrg# DESCRIPTION
2534245f6787Smrg#
2535245f6787Smrg#   Check whether the given linker FLAGS work with the current language's
2536245f6787Smrg#   linker, or whether they give an error.
2537245f6787Smrg#
2538245f6787Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2539245f6787Smrg#   success/failure.
2540245f6787Smrg#
2541663cdc11Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2542663cdc11Smrg#
2543245f6787Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2544245f6787Smrg#
2545245f6787Smrg# LICENSE
2546245f6787Smrg#
2547245f6787Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2548245f6787Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2549245f6787Smrg#   Copyright (c) 2009 Matteo Frigo
2550245f6787Smrg#
2551245f6787Smrg#   This program is free software: you can redistribute it and/or modify it
2552245f6787Smrg#   under the terms of the GNU General Public License as published by the
2553245f6787Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2554245f6787Smrg#   option) any later version.
2555245f6787Smrg#
2556245f6787Smrg#   This program is distributed in the hope that it will be useful, but
2557245f6787Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2558245f6787Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2559245f6787Smrg#   Public License for more details.
2560245f6787Smrg#
2561245f6787Smrg#   You should have received a copy of the GNU General Public License along
2562245f6787Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2563245f6787Smrg#
2564245f6787Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2565245f6787Smrg#   gives unlimited permission to copy, distribute and modify the configure
2566245f6787Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2567245f6787Smrg#   need not follow the terms of the GNU General Public License when using
2568245f6787Smrg#   or distributing such scripts, even though portions of the text of the
2569245f6787Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2570245f6787Smrg#   all other use of the material that constitutes the Autoconf Macro.
2571245f6787Smrg#
2572245f6787Smrg#   This special exception to the GPL applies to versions of the Autoconf
2573245f6787Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2574245f6787Smrg#   modified version of the Autoconf Macro, you may extend this special
2575245f6787Smrg#   exception to the GPL to apply to your modified version as well.#
2576245f6787SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2577245f6787Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2578245f6787Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2579245f6787SmrgAS_LITERAL_IF([$1],
2580245f6787Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2581245f6787Smrg      ax_save_FLAGS=$LDFLAGS
2582245f6787Smrg      LDFLAGS="$1"
2583663cdc11Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2584245f6787Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2585245f6787Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2586245f6787Smrg      LDFLAGS=$ax_save_FLAGS])],
2587245f6787Smrg  [ax_save_FLAGS=$LDFLAGS
2588245f6787Smrg   LDFLAGS="$1"
2589245f6787Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2590245f6787Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2591245f6787Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2592245f6787Smrg   LDFLAGS=$ax_save_FLAGS])
2593245f6787Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2594245f6787SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2595245f6787Smrgif test "x$xorg_check_linker_flags" = xyes; then
2596245f6787Smrg	m4_default([$2], :)
2597245f6787Smrgelse
2598245f6787Smrg	m4_default([$3], :)
2599245f6787Smrgfi
2600245f6787Smrg]) # XORG_CHECK_LINKER_FLAGS
2601245f6787Smrg
2602663cdc11Smrg# XORG_MEMORY_CHECK_FLAGS
2603663cdc11Smrg# -----------------------
2604663cdc11Smrg# Minimum version: 1.16.0
2605663cdc11Smrg#
2606663cdc11Smrg# This macro attempts to find appropriate memory checking functionality
2607663cdc11Smrg# for various platforms which unit testing code may use to catch various
2608663cdc11Smrg# forms of memory allocation and access errors in testing.
2609663cdc11Smrg#
2610663cdc11Smrg# Interface to module:
2611663cdc11Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2612663cdc11Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2613663cdc11Smrg#
2614663cdc11Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2615663cdc11Smrg#
2616663cdc11SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2617663cdc11Smrg
2618663cdc11SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2619663cdc11SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2620663cdc11Smrg           [Environment variables to enable memory checking in tests])
2621663cdc11Smrg
2622663cdc11Smrg# Check for different types of support on different platforms
2623663cdc11Smrgcase $host_os in
2624663cdc11Smrg    solaris*)
2625663cdc11Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2626663cdc11Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2627663cdc11Smrg        ;;
2628663cdc11Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2629663cdc11Smrg        # both directly and inverted, so should not be 0 or 255.
2630663cdc11Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2631663cdc11Smrg        ;;
2632663cdc11Smrg    darwin*)
2633663cdc11Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2634663cdc11Smrg        ;;
2635663cdc11Smrg    *bsd*)
2636663cdc11Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2637663cdc11Smrg        ;;
2638663cdc11Smrgesac
2639663cdc11Smrg
2640663cdc11Smrg# User supplied flags override default flags
2641663cdc11Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2642663cdc11Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2643663cdc11Smrgfi
2644663cdc11Smrg
2645663cdc11SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2646663cdc11Smrg]) # XORG_WITH_LINT
2647663cdc11Smrg
26487978d3cdSmrg# XORG_CHECK_MALLOC_ZERO
26497978d3cdSmrg# ----------------------
26507978d3cdSmrg# Minimum version: 1.0.0
2651ea6ae205Smrg#
26527978d3cdSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
26537978d3cdSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
26547978d3cdSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
26557978d3cdSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
26567978d3cdSmrgAC_ARG_ENABLE(malloc0returnsnull,
2657e83ac88aSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
26587978d3cdSmrg		       [malloc(0) returns NULL (default: auto)]),
26597978d3cdSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
26607978d3cdSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2661ea6ae205Smrg
26627978d3cdSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
26637978d3cdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2664245f6787Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2665245f6787Smrg#include <stdlib.h>
2666245f6787Smrg],[
26677978d3cdSmrg    char *m0, *r0, *c0, *p;
26687978d3cdSmrg    m0 = malloc(0);
26697978d3cdSmrg    p = malloc(10);
26707978d3cdSmrg    r0 = realloc(p,0);
2671245f6787Smrg    c0 = calloc(0,10);
2672245f6787Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2673245f6787Smrg])],
26747978d3cdSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2675b6f2c9ccSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
2676b6f2c9ccSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
26777978d3cdSmrgfi
26787978d3cdSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2679ea6ae205Smrg
26807978d3cdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
26817978d3cdSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
26827978d3cdSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
26837978d3cdSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
26847978d3cdSmrgelse
26857978d3cdSmrg	MALLOC_ZERO_CFLAGS=""
26867978d3cdSmrg	XMALLOC_ZERO_CFLAGS=""
26877978d3cdSmrg	XTMALLOC_ZERO_CFLAGS=""
26887978d3cdSmrgfi
2689ea6ae205Smrg
26907978d3cdSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
26917978d3cdSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
26927978d3cdSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
26937978d3cdSmrg]) # XORG_CHECK_MALLOC_ZERO
2694ea6ae205Smrg
26957978d3cdSmrg# XORG_WITH_LINT()
26967978d3cdSmrg# ----------------
26977978d3cdSmrg# Minimum version: 1.1.0
26987978d3cdSmrg#
2699b6f2c9ccSmrg# This macro enables the use of a tool that flags some suspicious and
2700b6f2c9ccSmrg# non-portable constructs (likely to be bugs) in C language source code.
2701b6f2c9ccSmrg# It will attempt to locate the tool and use appropriate options.
2702b6f2c9ccSmrg# There are various lint type tools on different platforms.
2703b6f2c9ccSmrg#
2704b6f2c9ccSmrg# Interface to module:
2705b6f2c9ccSmrg# LINT:		returns the path to the tool found on the platform
2706b6f2c9ccSmrg#		or the value set to LINT on the configure cmd line
2707b6f2c9ccSmrg#		also an Automake conditional
2708b6f2c9ccSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2709b6f2c9ccSmrg#
2710b6f2c9ccSmrg# --with-lint:	'yes' user instructs the module to use lint
2711b6f2c9ccSmrg#		'no' user instructs the module not to use lint (default)
2712b6f2c9ccSmrg#
2713b6f2c9ccSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2714b6f2c9ccSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
27157978d3cdSmrg#
27167978d3cdSmrgAC_DEFUN([XORG_WITH_LINT],[
2717ea6ae205Smrg
2718b6f2c9ccSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2719b6f2c9ccSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2720e83ac88aSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27217978d3cdSmrg		[Use a lint-style source code checker (default: disabled)])],
27227978d3cdSmrg		[use_lint=$withval], [use_lint=no])
2723b6f2c9ccSmrg
2724b6f2c9ccSmrg# Obtain platform specific info like program name and options
2725b6f2c9ccSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2726b6f2c9ccSmrgcase $host_os in
2727b6f2c9ccSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2728b6f2c9ccSmrg	lint_name=splint
2729b6f2c9ccSmrg	lint_options="-badflag"
2730b6f2c9ccSmrg	;;
2731b6f2c9ccSmrg  *freebsd* | *netbsd*)
2732b6f2c9ccSmrg	lint_name=lint
2733b6f2c9ccSmrg	lint_options="-u -b"
2734b6f2c9ccSmrg	;;
2735b6f2c9ccSmrg  *solaris*)
2736b6f2c9ccSmrg	lint_name=lint
2737b6f2c9ccSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2738b6f2c9ccSmrg	;;
2739b6f2c9ccSmrgesac
2740b6f2c9ccSmrg
2741b6f2c9ccSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2742b6f2c9ccSmrgif test "x$use_lint" = x"yes" ; then
2743b6f2c9ccSmrg   AC_PATH_PROG([LINT], [$lint_name])
2744b6f2c9ccSmrg   if test "x$LINT" = "x"; then
2745b6f2c9ccSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2746b6f2c9ccSmrg   fi
2747b6f2c9ccSmrgelif test "x$use_lint" = x"no" ; then
2748b6f2c9ccSmrg   if test "x$LINT" != "x"; then
2749b6f2c9ccSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2750b6f2c9ccSmrg   fi
27517978d3cdSmrgelse
2752b6f2c9ccSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
27537978d3cdSmrgfi
2754b6f2c9ccSmrg
2755b6f2c9ccSmrg# User supplied flags override default flags
2756b6f2c9ccSmrgif test "x$LINT_FLAGS" != "x"; then
2757b6f2c9ccSmrg   lint_options=$LINT_FLAGS
27587978d3cdSmrgfi
2759ea6ae205Smrg
2760b6f2c9ccSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2761b6f2c9ccSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2762ea6ae205Smrg
27637978d3cdSmrg]) # XORG_WITH_LINT
27647978d3cdSmrg
27657978d3cdSmrg# XORG_LINT_LIBRARY(LIBNAME)
27667978d3cdSmrg# --------------------------
27677978d3cdSmrg# Minimum version: 1.1.0
27687978d3cdSmrg#
27697978d3cdSmrg# Sets up flags for building lint libraries for checking programs that call
27707978d3cdSmrg# functions in the library.
2771ea6ae205Smrg#
2772b6f2c9ccSmrg# Interface to module:
2773b6f2c9ccSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2774b6f2c9ccSmrg# MAKE_LINT_LIB		- Automake conditional
2775b6f2c9ccSmrg#
2776b6f2c9ccSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2777b6f2c9ccSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2778ea6ae205Smrg
27797978d3cdSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
27807978d3cdSmrgAC_REQUIRE([XORG_WITH_LINT])
2781e83ac88aSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
27827978d3cdSmrg	[Create lint library (default: disabled)])],
27837978d3cdSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2784b6f2c9ccSmrg
2785b6f2c9ccSmrgif test "x$make_lint_lib" = x"yes" ; then
2786b6f2c9ccSmrg   LINTLIB=llib-l$1.ln
2787b6f2c9ccSmrg   if test "x$LINT" = "x"; then
2788b6f2c9ccSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2789b6f2c9ccSmrg   fi
2790b6f2c9ccSmrgelif test "x$make_lint_lib" != x"no" ; then
2791b6f2c9ccSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
27927978d3cdSmrgfi
2793b6f2c9ccSmrg
27947978d3cdSmrgAC_SUBST(LINTLIB)
27957978d3cdSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2796ea6ae205Smrg
27977978d3cdSmrg]) # XORG_LINT_LIBRARY
27987978d3cdSmrg
2799245f6787Smrg# XORG_COMPILER_BRAND
2800245f6787Smrg# -------------------
2801245f6787Smrg# Minimum version: 1.14.0
2802245f6787Smrg#
2803245f6787Smrg# Checks for various brands of compilers and sets flags as appropriate:
2804245f6787Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
280587aef7c3Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2806245f6787Smrg#   clang compiler - sets CLANGCC to "yes"
2807245f6787Smrg#   Intel compiler - sets INTELCC to "yes"
2808245f6787Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2809245f6787Smrg#
2810245f6787SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
281187aef7c3SmrgAC_LANG_CASE(
281287aef7c3Smrg	[C], [
281387aef7c3Smrg		AC_REQUIRE([AC_PROG_CC_C99])
281487aef7c3Smrg	],
281587aef7c3Smrg	[C++], [
281687aef7c3Smrg		AC_REQUIRE([AC_PROG_CXX])
281787aef7c3Smrg	]
281887aef7c3Smrg)
2819245f6787SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2820245f6787SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2821245f6787SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2822245f6787Smrg]) # XORG_COMPILER_BRAND
2823245f6787Smrg
2824663cdc11Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2825663cdc11Smrg# ---------------
2826663cdc11Smrg# Minimum version: 1.16.0
2827663cdc11Smrg#
2828663cdc11Smrg# Test if the compiler works when passed the given flag as a command line argument.
2829663cdc11Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2830663cdc11Smrg# next flag in the list until there are no more options.
2831663cdc11Smrg#
2832663cdc11Smrg# Note that this does not guarantee that the compiler supports the flag as some
2833663cdc11Smrg# compilers will simply ignore arguments that they do not understand, but we do
2834663cdc11Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2835663cdc11Smrg# -Werror=unused-command-line-argument
2836663cdc11Smrg#
2837663cdc11SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2838663cdc11Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2839663cdc11Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2840663cdc11Smrg
284187aef7c3SmrgAC_LANG_COMPILER_REQUIRE
284287aef7c3Smrg
284387aef7c3SmrgAC_LANG_CASE(
284487aef7c3Smrg	[C], [
284587aef7c3Smrg		AC_REQUIRE([AC_PROG_CC_C99])
284687aef7c3Smrg		define([PREFIX], [C])
284787aef7c3Smrg		define([CACHE_PREFIX], [cc])
284887aef7c3Smrg		define([COMPILER], [$CC])
284987aef7c3Smrg	],
285087aef7c3Smrg	[C++], [
285187aef7c3Smrg		define([PREFIX], [CXX])
285287aef7c3Smrg		define([CACHE_PREFIX], [cxx])
285387aef7c3Smrg		define([COMPILER], [$CXX])
285487aef7c3Smrg	]
285587aef7c3Smrg)
285687aef7c3Smrg
285787aef7c3Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2858663cdc11Smrg
285987aef7c3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
286087aef7c3Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
286187aef7c3Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
286287aef7c3Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2863663cdc11Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
286487aef7c3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
286587aef7c3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
286687aef7c3Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
286787aef7c3Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2868663cdc11Smrgfi
2869663cdc11Smrg
287087aef7c3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
287187aef7c3Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
287287aef7c3Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2873663cdc11Smrg	fi
287487aef7c3Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
287587aef7c3Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
287687aef7c3Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2877663cdc11Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
287887aef7c3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
287987aef7c3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
288087aef7c3Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
288187aef7c3Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2882663cdc11Smrgfi
2883663cdc11Smrg
2884663cdc11Smrgfound="no"
2885663cdc11Smrgm4_foreach([flag], m4_cdr($@), [
2886663cdc11Smrg	if test $found = "no" ; then
2887663cdc11Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
288887aef7c3Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2889663cdc11Smrg		fi
2890663cdc11Smrg
2891663cdc11Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
289287aef7c3Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2893663cdc11Smrg		fi
2894663cdc11Smrg
289587aef7c3Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2896663cdc11Smrg
2897663cdc11Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
289887aef7c3Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
289987aef7c3Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
290087aef7c3Smrg		AC_CACHE_VAL($cacheid,
2901663cdc11Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
290287aef7c3Smrg					     [eval $cacheid=yes],
290387aef7c3Smrg					     [eval $cacheid=no])])
2904663cdc11Smrg
290587aef7c3Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2906663cdc11Smrg
290787aef7c3Smrg		eval supported=\$$cacheid
2908663cdc11Smrg		AC_MSG_RESULT([$supported])
2909663cdc11Smrg		if test "$supported" = "yes" ; then
2910663cdc11Smrg			$1="$$1 ]flag["
2911663cdc11Smrg			found="yes"
2912663cdc11Smrg		fi
2913663cdc11Smrg	fi
2914663cdc11Smrg])
2915663cdc11Smrg]) # XORG_TESTSET_CFLAG
2916663cdc11Smrg
2917663cdc11Smrg# XORG_COMPILER_FLAGS
2918663cdc11Smrg# ---------------
2919663cdc11Smrg# Minimum version: 1.16.0
2920663cdc11Smrg#
292187aef7c3Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
292287aef7c3Smrg# arguments supported by the selected compiler which do NOT alter the generated
292387aef7c3Smrg# code.  These arguments will cause the compiler to print various warnings
292487aef7c3Smrg# during compilation AND turn a conservative set of warnings into errors.
2925663cdc11Smrg#
292687aef7c3Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
292787aef7c3Smrg# future versions of util-macros as options are added to new compilers.
2928663cdc11Smrg#
2929663cdc11SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2930663cdc11SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2931663cdc11Smrg
2932663cdc11SmrgAC_ARG_ENABLE(selective-werror,
2933663cdc11Smrg              AS_HELP_STRING([--disable-selective-werror],
2934663cdc11Smrg                             [Turn off selective compiler errors. (default: enabled)]),
2935663cdc11Smrg              [SELECTIVE_WERROR=$enableval],
2936663cdc11Smrg              [SELECTIVE_WERROR=yes])
2937663cdc11Smrg
293887aef7c3SmrgAC_LANG_CASE(
293987aef7c3Smrg        [C], [
294087aef7c3Smrg                define([PREFIX], [C])
294187aef7c3Smrg        ],
294287aef7c3Smrg        [C++], [
294387aef7c3Smrg                define([PREFIX], [CXX])
294487aef7c3Smrg        ]
294587aef7c3Smrg)
2946663cdc11Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2947663cdc11Smrgif test "x$SUNCC" = "xyes"; then
294887aef7c3Smrg    [BASE_]PREFIX[FLAGS]="-v"
2949663cdc11Smrgelse
295087aef7c3Smrg    [BASE_]PREFIX[FLAGS]=""
2951663cdc11Smrgfi
2952663cdc11Smrg
2953663cdc11Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
295487aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
295587aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
295687aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
295787aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
295887aef7c3Smrg
295987aef7c3SmrgAC_LANG_CASE(
296087aef7c3Smrg	[C], [
296187aef7c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
296287aef7c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
296387aef7c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
296487aef7c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
296587aef7c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
296687aef7c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
296787aef7c3Smrg	]
296887aef7c3Smrg)
2969663cdc11Smrg
2970663cdc11Smrg# This chunk adds additional warnings that could catch undesired effects.
297187aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
297287aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
297387aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
297487aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
297587aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
297687aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
297787aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2978663cdc11Smrg
2979663cdc11Smrg# These are currently disabled because they are noisy.  They will be enabled
2980663cdc11Smrg# in the future once the codebase is sufficiently modernized to silence
2981663cdc11Smrg# them.  For now, I don't want them to drown out the other warnings.
298287aef7c3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
298387aef7c3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
298487aef7c3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2985663cdc11Smrg
2986663cdc11Smrg# Turn some warnings into errors, so we don't accidently get successful builds
2987663cdc11Smrg# when there are problems that should be fixed.
2988663cdc11Smrg
2989663cdc11Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
299087aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
299187aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
299287aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
299387aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
299487aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
299587aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
299687aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
299787aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
299887aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
299987aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
300087aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
300187aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
300287aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3003663cdc11Smrgelse
3004663cdc11SmrgAC_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])
300587aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
300687aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
300787aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
300887aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
300987aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
301087aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
301187aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
301287aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
301387aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
301487aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
301587aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
301687aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
301787aef7c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
301887aef7c3Smrgfi
301987aef7c3Smrg
302087aef7c3SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3021663cdc11Smrg]) # XORG_COMPILER_FLAGS
3022663cdc11Smrg
30237978d3cdSmrg# XORG_CWARNFLAGS
3024ea6ae205Smrg# ---------------
30257978d3cdSmrg# Minimum version: 1.2.0
3026663cdc11Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
30277978d3cdSmrg#
30287978d3cdSmrg# Defines CWARNFLAGS to enable C compiler warnings.
30297978d3cdSmrg#
3030663cdc11Smrg# This function is deprecated because it defines -fno-strict-aliasing
3031663cdc11Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3032663cdc11Smrg# is needed, then it should be added explicitly in the module when
3033663cdc11Smrg# it is updated to use BASE_CFLAGS.
3034663cdc11Smrg#
30357978d3cdSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3036663cdc11SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3037245f6787SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
303887aef7c3SmrgAC_LANG_CASE(
303987aef7c3Smrg	[C], [
304087aef7c3Smrg		CWARNFLAGS="$BASE_CFLAGS"
304187aef7c3Smrg		if  test "x$GCC" = xyes ; then
304287aef7c3Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
304387aef7c3Smrg		fi
304487aef7c3Smrg		AC_SUBST(CWARNFLAGS)
304587aef7c3Smrg	]
304687aef7c3Smrg)
30477978d3cdSmrg]) # XORG_CWARNFLAGS
3048e83ac88aSmrg
3049e83ac88aSmrg# XORG_STRICT_OPTION
3050e83ac88aSmrg# -----------------------
3051e83ac88aSmrg# Minimum version: 1.3.0
3052e83ac88aSmrg#
3053245f6787Smrg# Add configure option to enable strict compilation flags, such as treating
3054245f6787Smrg# warnings as fatal errors.
3055245f6787Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
305687aef7c3Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3057245f6787Smrg#
3058245f6787Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3059245f6787Smrg# when strict compilation is unconditionally desired.
3060e83ac88aSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3061e83ac88aSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3062663cdc11SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3063e83ac88aSmrg
3064e83ac88aSmrgAC_ARG_ENABLE(strict-compilation,
3065e83ac88aSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3066e83ac88aSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3067e83ac88aSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3068663cdc11Smrg
306987aef7c3SmrgAC_LANG_CASE(
307087aef7c3Smrg        [C], [
307187aef7c3Smrg                define([PREFIX], [C])
307287aef7c3Smrg        ],
307387aef7c3Smrg        [C++], [
307487aef7c3Smrg                define([PREFIX], [CXX])
307587aef7c3Smrg        ]
307687aef7c3Smrg)
307787aef7c3Smrg
307887aef7c3Smrg[STRICT_]PREFIX[FLAGS]=""
307987aef7c3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
308087aef7c3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3081663cdc11Smrg
3082663cdc11Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3083663cdc11Smrg# activate it with -Werror, so we add it here explicitly.
308487aef7c3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3085663cdc11Smrg
3086e83ac88aSmrgif test "x$STRICT_COMPILE" = "xyes"; then
308787aef7c3Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
308887aef7c3Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3089e83ac88aSmrgfi
309087aef7c3SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
309187aef7c3SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
309287aef7c3SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3093e83ac88aSmrg]) # XORG_STRICT_OPTION
3094e83ac88aSmrg
3095e83ac88aSmrg# XORG_DEFAULT_OPTIONS
3096e83ac88aSmrg# --------------------
3097e83ac88aSmrg# Minimum version: 1.3.0
3098e83ac88aSmrg#
3099e83ac88aSmrg# Defines default options for X.Org modules.
3100e83ac88aSmrg#
3101e83ac88aSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3102b6f2c9ccSmrgAC_REQUIRE([AC_PROG_INSTALL])
3103663cdc11SmrgXORG_COMPILER_FLAGS
3104e83ac88aSmrgXORG_CWARNFLAGS
3105e83ac88aSmrgXORG_STRICT_OPTION
3106e83ac88aSmrgXORG_RELEASE_VERSION
3107e83ac88aSmrgXORG_CHANGELOG
3108b6f2c9ccSmrgXORG_INSTALL
3109e83ac88aSmrgXORG_MANPAGE_SECTIONS
3110b6f2c9ccSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3111b6f2c9ccSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3112e83ac88aSmrg]) # XORG_DEFAULT_OPTIONS
3113b6f2c9ccSmrg
3114b6f2c9ccSmrg# XORG_INSTALL()
3115b6f2c9ccSmrg# ----------------
3116b6f2c9ccSmrg# Minimum version: 1.4.0
3117b6f2c9ccSmrg#
3118b6f2c9ccSmrg# Defines the variable INSTALL_CMD as the command to copy
3119b6f2c9ccSmrg# INSTALL from $prefix/share/util-macros.
3120b6f2c9ccSmrg#
3121b6f2c9ccSmrgAC_DEFUN([XORG_INSTALL], [
3122b6f2c9ccSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3123b6f2c9ccSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3124b6f2c9ccSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3125b6f2c9ccSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3126b6f2c9ccSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3127b6f2c9ccSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3128b6f2c9ccSmrgAC_SUBST([INSTALL_CMD])
3129b6f2c9ccSmrg]) # XORG_INSTALL
31307978d3cdSmrgdnl Copyright 2005 Red Hat, Inc
31317978d3cdSmrgdnl
31327978d3cdSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
31337978d3cdSmrgdnl documentation for any purpose is hereby granted without fee, provided that
31347978d3cdSmrgdnl the above copyright notice appear in all copies and that both that
31357978d3cdSmrgdnl copyright notice and this permission notice appear in supporting
31367978d3cdSmrgdnl documentation.
31377978d3cdSmrgdnl
31387978d3cdSmrgdnl The above copyright notice and this permission notice shall be included
31397978d3cdSmrgdnl in all copies or substantial portions of the Software.
31407978d3cdSmrgdnl
31417978d3cdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31427978d3cdSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31437978d3cdSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31447978d3cdSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
31457978d3cdSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31467978d3cdSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31477978d3cdSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
31487978d3cdSmrgdnl
31497978d3cdSmrgdnl Except as contained in this notice, the name of the copyright holders shall
31507978d3cdSmrgdnl not be used in advertising or otherwise to promote the sale, use or
31517978d3cdSmrgdnl other dealings in this Software without prior written authorization
31527978d3cdSmrgdnl from the copyright holders.
31537978d3cdSmrgdnl
3154ea6ae205Smrg
31557978d3cdSmrg# XORG_RELEASE_VERSION
31567978d3cdSmrg# --------------------
3157b6f2c9ccSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
31587978d3cdSmrg 
31597978d3cdSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
31607978d3cdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
31617978d3cdSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
31627978d3cdSmrg		[Major version of this package])
31637978d3cdSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
31647978d3cdSmrg	if test "x$PVM" = "x"; then
31657978d3cdSmrg		PVM="0"
31667978d3cdSmrg	fi
31677978d3cdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
31687978d3cdSmrg		[$PVM],
31697978d3cdSmrg		[Minor version of this package])
31707978d3cdSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
31717978d3cdSmrg	if test "x$PVP" = "x"; then
31727978d3cdSmrg		PVP="0"
31737978d3cdSmrg	fi
31747978d3cdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
31757978d3cdSmrg		[$PVP],
31767978d3cdSmrg		[Patch version of this package])
31777978d3cdSmrg])
3178ea6ae205Smrg
31797978d3cdSmrg# XORG_CHANGELOG()
31807978d3cdSmrg# ----------------
31817978d3cdSmrg# Minimum version: 1.2.0
31827978d3cdSmrg#
31837978d3cdSmrg# Defines the variable CHANGELOG_CMD as the command to generate
31847978d3cdSmrg# ChangeLog from git.
31857978d3cdSmrg#
31867978d3cdSmrg#
31877978d3cdSmrgAC_DEFUN([XORG_CHANGELOG], [
3188b6f2c9ccSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3189b6f2c9ccSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3190b6f2c9ccSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
31917978d3cdSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
31927978d3cdSmrgAC_SUBST([CHANGELOG_CMD])
31937978d3cdSmrg]) # XORG_CHANGELOG
3194ea6ae205Smrg
3195