1cf2f63c2Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2cf2f63c2Smrg
3cf2f63c2Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
45c10afb9Smrg
55c10afb9Smrg# This file is free software; the Free Software Foundation
65c10afb9Smrg# gives unlimited permission to copy and/or distribute it,
75c10afb9Smrg# with or without modifications, as long as this notice is preserved.
85c10afb9Smrg
95c10afb9Smrg# This program is distributed in the hope that it will be useful,
105c10afb9Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
115c10afb9Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
125c10afb9Smrg# PARTICULAR PURPOSE.
135c10afb9Smrg
14cf2f63c2Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15b3078addSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16b3078addSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17cf2f63c2Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18cf2f63c2Smrg[m4_warning([this file was generated for autoconf 2.69.
19b3078addSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20b3078addSmrgIf you have problems, you may need to regenerate the build system entirely.
21cf2f63c2SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
225c10afb9Smrg
23cf2f63c2Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
24b3078addSmrg#
25b3078addSmrg# This file is free software; the Free Software Foundation
26b3078addSmrg# gives unlimited permission to copy and/or distribute it,
27b3078addSmrg# with or without modifications, as long as this notice is preserved.
285c10afb9Smrg
295c10afb9Smrg# AM_AUTOMAKE_VERSION(VERSION)
305c10afb9Smrg# ----------------------------
315c10afb9Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
325c10afb9Smrg# generated from the m4 files accompanying Automake X.Y.
33b3078addSmrg# (This private macro should not be called outside this file.)
34b3078addSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35cf2f63c2Smrg[am__api_version='1.15'
36b3078addSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37b3078addSmrgdnl require some minimum version.  Point them to the right macro.
38cf2f63c2Smrgm4_if([$1], [1.15], [],
39b3078addSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40b3078addSmrg])
41b3078addSmrg
42b3078addSmrg# _AM_AUTOCONF_VERSION(VERSION)
43b3078addSmrg# -----------------------------
44b3078addSmrg# aclocal traces this macro to find the Autoconf version.
45b3078addSmrg# This is a private macro too.  Using m4_define simplifies
46b3078addSmrg# the logic in aclocal, which can simply ignore this definition.
47b3078addSmrgm4_define([_AM_AUTOCONF_VERSION], [])
485c10afb9Smrg
495c10afb9Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
505c10afb9Smrg# -------------------------------
51b3078addSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52b3078addSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
535c10afb9SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54cf2f63c2Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
55b3078addSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56b3078addSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57b3078addSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
585c10afb9Smrg
59b3078addSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
605c10afb9Smrg
61cf2f63c2Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
625c10afb9Smrg#
63b3078addSmrg# This file is free software; the Free Software Foundation
64b3078addSmrg# gives unlimited permission to copy and/or distribute it,
65b3078addSmrg# with or without modifications, as long as this notice is preserved.
665c10afb9Smrg
675c10afb9Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68cf2f63c2Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69cf2f63c2Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
705c10afb9Smrg#
715c10afb9Smrg# Of course, Automake must honor this variable whenever it calls a
725c10afb9Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
735c10afb9Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
745c10afb9Smrg# depending on how configure is run.  This is pretty annoying, since
755c10afb9Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
765c10afb9Smrg# source directory, any form will work fine, but in subdirectories a
775c10afb9Smrg# relative path needs to be adjusted first.
785c10afb9Smrg#
795c10afb9Smrg# $ac_aux_dir/missing
805c10afb9Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
815c10afb9Smrg# $top_srcdir/$ac_aux_dir/missing
825c10afb9Smrg#    fails if $ac_aux_dir is absolute,
835c10afb9Smrg#    fails when called from a subdirectory in a VPATH build with
845c10afb9Smrg#          a relative $ac_aux_dir
855c10afb9Smrg#
865c10afb9Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
875c10afb9Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88cf2f63c2Smrg# harmless because $srcdir is '.', but things will broke when you
895c10afb9Smrg# start a VPATH build or use an absolute $srcdir.
905c10afb9Smrg#
915c10afb9Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
925c10afb9Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
935c10afb9Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
945c10afb9Smrg# and then we would define $MISSING as
955c10afb9Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
965c10afb9Smrg# This will work as long as MISSING is not called from configure, because
975c10afb9Smrg# unfortunately $(top_srcdir) has no meaning in configure.
985c10afb9Smrg# However there are other variables, like CC, which are often used in
995c10afb9Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1005c10afb9Smrg#
1015c10afb9Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1025c10afb9Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1035c10afb9Smrg# configured tree to be moved without reconfiguration.
1045c10afb9Smrg
105b3078addSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106cf2f63c2Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107cf2f63c2Smrg# Expand $ac_aux_dir to an absolute path.
108cf2f63c2Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1095c10afb9Smrg])
1105c10afb9Smrg
111b3078addSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1125c10afb9Smrg
113cf2f63c2Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
114b3078addSmrg#
115b3078addSmrg# This file is free software; the Free Software Foundation
116b3078addSmrg# gives unlimited permission to copy and/or distribute it,
117b3078addSmrg# with or without modifications, as long as this notice is preserved.
1185c10afb9Smrg
119b3078addSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120b3078addSmrg# -------------------------------------
121b3078addSmrg# Define a conditional.
122b3078addSmrgAC_DEFUN([AM_CONDITIONAL],
123cf2f63c2Smrg[AC_PREREQ([2.52])dnl
124cf2f63c2Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125cf2f63c2Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126b3078addSmrgAC_SUBST([$1_TRUE])dnl
127b3078addSmrgAC_SUBST([$1_FALSE])dnl
128b3078addSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129b3078addSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130b3078addSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131b3078addSmrgif $2; then
132b3078addSmrg  $1_TRUE=
133b3078addSmrg  $1_FALSE='#'
1345c10afb9Smrgelse
135b3078addSmrg  $1_TRUE='#'
136b3078addSmrg  $1_FALSE=
1375c10afb9Smrgfi
138b3078addSmrgAC_CONFIG_COMMANDS_PRE(
139b3078addSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140b3078addSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141b3078addSmrgUsually this means the macro was only invoked conditionally.]])
142b3078addSmrgfi])])
1435c10afb9Smrg
144cf2f63c2Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
145b3078addSmrg#
146b3078addSmrg# This file is free software; the Free Software Foundation
147b3078addSmrg# gives unlimited permission to copy and/or distribute it,
148b3078addSmrg# with or without modifications, as long as this notice is preserved.
1495c10afb9Smrg
1505c10afb9Smrg
151cf2f63c2Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1525c10afb9Smrg# written in clear, in which case automake, when reading aclocal.m4,
1535c10afb9Smrg# will think it sees a *use*, and therefore will trigger all it's
1545c10afb9Smrg# C support machinery.  Also note that it means that autoscan, seeing
1555c10afb9Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1565c10afb9Smrg
1575c10afb9Smrg
1585c10afb9Smrg# _AM_DEPENDENCIES(NAME)
1595c10afb9Smrg# ----------------------
1605c10afb9Smrg# See how the compiler implements dependency checking.
161cf2f63c2Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1625c10afb9Smrg# We try a few techniques and use that to set a single cache variable.
1635c10afb9Smrg#
1645c10afb9Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1655c10afb9Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1665c10afb9Smrg# dependency, and given that the user is not expected to run this macro,
1675c10afb9Smrg# just rely on AC_PROG_CC.
1685c10afb9SmrgAC_DEFUN([_AM_DEPENDENCIES],
1695c10afb9Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1705c10afb9SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1715c10afb9SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1725c10afb9SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1735c10afb9Smrg
174cf2f63c2Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175cf2f63c2Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176cf2f63c2Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177cf2f63c2Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178cf2f63c2Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179cf2f63c2Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180cf2f63c2Smrg                    [depcc="$$1"   am_compiler_list=])
1815c10afb9Smrg
1825c10afb9SmrgAC_CACHE_CHECK([dependency style of $depcc],
1835c10afb9Smrg               [am_cv_$1_dependencies_compiler_type],
1845c10afb9Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1855c10afb9Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1865c10afb9Smrg  # making bogus files that we don't know about and never remove.  For
1875c10afb9Smrg  # instance it was reported that on HP-UX the gcc test will end up
188cf2f63c2Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189cf2f63c2Smrg  # in D".
190cf2f63c2Smrg  rm -rf conftest.dir
1915c10afb9Smrg  mkdir conftest.dir
1925c10afb9Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1935c10afb9Smrg  # using a relative directory.
1945c10afb9Smrg  cp "$am_depcomp" conftest.dir
1955c10afb9Smrg  cd conftest.dir
1965c10afb9Smrg  # We will build objects and dependencies in a subdirectory because
1975c10afb9Smrg  # it helps to detect inapplicable dependency modes.  For instance
1985c10afb9Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1995c10afb9Smrg  # side effect of compilation, but ICC will put the dependencies in
2005c10afb9Smrg  # the current directory while Tru64 will put them in the object
2015c10afb9Smrg  # directory.
2025c10afb9Smrg  mkdir sub
2035c10afb9Smrg
2045c10afb9Smrg  am_cv_$1_dependencies_compiler_type=none
2055c10afb9Smrg  if test "$am_compiler_list" = ""; then
2065c10afb9Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2075c10afb9Smrg  fi
208b3078addSmrg  am__universal=false
209b3078addSmrg  m4_case([$1], [CC],
210b3078addSmrg    [case " $depcc " in #(
211b3078addSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212b3078addSmrg     esac],
213b3078addSmrg    [CXX],
214b3078addSmrg    [case " $depcc " in #(
215b3078addSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216b3078addSmrg     esac])
217b3078addSmrg
2185c10afb9Smrg  for depmode in $am_compiler_list; do
2195c10afb9Smrg    # Setup a source with many dependencies, because some compilers
2205c10afb9Smrg    # like to wrap large dependency lists on column 80 (with \), and
2215c10afb9Smrg    # we should not choose a depcomp mode which is confused by this.
2225c10afb9Smrg    #
2235c10afb9Smrg    # We need to recreate these files for each test, as the compiler may
2245c10afb9Smrg    # overwrite some of them when testing with obscure command lines.
2255c10afb9Smrg    # This happens at least with the AIX C compiler.
2265c10afb9Smrg    : > sub/conftest.c
2275c10afb9Smrg    for i in 1 2 3 4 5 6; do
2285c10afb9Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229cf2f63c2Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230cf2f63c2Smrg      # Solaris 10 /bin/sh.
231cf2f63c2Smrg      echo '/* dummy */' > sub/conftst$i.h
2325c10afb9Smrg    done
2335c10afb9Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2345c10afb9Smrg
235cf2f63c2Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236b3078addSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237cf2f63c2Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238cf2f63c2Smrg    # versions had trouble with output in subdirs.
239b3078addSmrg    am__obj=sub/conftest.${OBJEXT-o}
240b3078addSmrg    am__minus_obj="-o $am__obj"
2415c10afb9Smrg    case $depmode in
242b3078addSmrg    gcc)
243b3078addSmrg      # This depmode causes a compiler race in universal mode.
244b3078addSmrg      test "$am__universal" = false || continue
245b3078addSmrg      ;;
2465c10afb9Smrg    nosideeffect)
247cf2f63c2Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248cf2f63c2Smrg      # only be used when explicitly requested.
2495c10afb9Smrg      if test "x$enable_dependency_tracking" = xyes; then
2505c10afb9Smrg	continue
2515c10afb9Smrg      else
2525c10afb9Smrg	break
2535c10afb9Smrg      fi
2545c10afb9Smrg      ;;
255cf2f63c2Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256cf2f63c2Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257b3078addSmrg      # not run yet.  These depmodes are late enough in the game, and
258b3078addSmrg      # so weak that their functioning should not be impacted.
259b3078addSmrg      am__obj=conftest.${OBJEXT-o}
260b3078addSmrg      am__minus_obj=
261b3078addSmrg      ;;
2625c10afb9Smrg    none) break ;;
2635c10afb9Smrg    esac
2645c10afb9Smrg    if depmode=$depmode \
265b3078addSmrg       source=sub/conftest.c object=$am__obj \
2665c10afb9Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267b3078addSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2685c10afb9Smrg         >/dev/null 2>conftest.err &&
269b3078addSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2705c10afb9Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271b3078addSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2725c10afb9Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2735c10afb9Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274b3078addSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
275b3078addSmrg      # that says an option was ignored or not supported.
276b3078addSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277b3078addSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278b3078addSmrg      # The diagnosis changed in icc 8.0:
279b3078addSmrg      #   icc: Command line remark: option '-MP' not supported
280b3078addSmrg      if (grep 'ignoring option' conftest.err ||
281b3078addSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2825c10afb9Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2835c10afb9Smrg        break
2845c10afb9Smrg      fi
2855c10afb9Smrg    fi
2865c10afb9Smrg  done
2875c10afb9Smrg
2885c10afb9Smrg  cd ..
2895c10afb9Smrg  rm -rf conftest.dir
2905c10afb9Smrgelse
2915c10afb9Smrg  am_cv_$1_dependencies_compiler_type=none
2925c10afb9Smrgfi
2935c10afb9Smrg])
2945c10afb9SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2955c10afb9SmrgAM_CONDITIONAL([am__fastdep$1], [
2965c10afb9Smrg  test "x$enable_dependency_tracking" != xno \
2975c10afb9Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2985c10afb9Smrg])
2995c10afb9Smrg
3005c10afb9Smrg
3015c10afb9Smrg# AM_SET_DEPDIR
3025c10afb9Smrg# -------------
3035c10afb9Smrg# Choose a directory name for dependency files.
304cf2f63c2Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3055c10afb9SmrgAC_DEFUN([AM_SET_DEPDIR],
3065c10afb9Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3075c10afb9SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3085c10afb9Smrg])
3095c10afb9Smrg
3105c10afb9Smrg
3115c10afb9Smrg# AM_DEP_TRACK
3125c10afb9Smrg# ------------
3135c10afb9SmrgAC_DEFUN([AM_DEP_TRACK],
314cf2f63c2Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315cf2f63c2SmrgAS_HELP_STRING(
316cf2f63c2Smrg  [--enable-dependency-tracking],
317cf2f63c2Smrg  [do not reject slow dependency extractors])
318cf2f63c2SmrgAS_HELP_STRING(
319cf2f63c2Smrg  [--disable-dependency-tracking],
320cf2f63c2Smrg  [speeds up one-time build])])
3215c10afb9Smrgif test "x$enable_dependency_tracking" != xno; then
3225c10afb9Smrg  am_depcomp="$ac_aux_dir/depcomp"
3235c10afb9Smrg  AMDEPBACKSLASH='\'
324cf2f63c2Smrg  am__nodep='_no'
3255c10afb9Smrgfi
3265c10afb9SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327b3078addSmrgAC_SUBST([AMDEPBACKSLASH])dnl
328b3078addSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329cf2f63c2SmrgAC_SUBST([am__nodep])dnl
330cf2f63c2Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3315c10afb9Smrg])
3325c10afb9Smrg
333b3078addSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3345c10afb9Smrg
335cf2f63c2Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
336b3078addSmrg#
337b3078addSmrg# This file is free software; the Free Software Foundation
338b3078addSmrg# gives unlimited permission to copy and/or distribute it,
339b3078addSmrg# with or without modifications, as long as this notice is preserved.
3405c10afb9Smrg
3415c10afb9Smrg
3425c10afb9Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3435c10afb9Smrg# ------------------------------
3445c10afb9SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
345b3078addSmrg[{
346cf2f63c2Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
347b3078addSmrg  # are listed without --file.  Let's play safe and only enable the eval
348b3078addSmrg  # if we detect the quoting.
349b3078addSmrg  case $CONFIG_FILES in
350b3078addSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
351b3078addSmrg  *)   set x $CONFIG_FILES ;;
352b3078addSmrg  esac
353b3078addSmrg  shift
354b3078addSmrg  for mf
355b3078addSmrg  do
356b3078addSmrg    # Strip MF so we end up with the name of the file.
357b3078addSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
358b3078addSmrg    # Check whether this is an Automake generated Makefile or not.
359cf2f63c2Smrg    # We used to match only the files named 'Makefile.in', but
360b3078addSmrg    # some people rename them; so instead we look at the file content.
361b3078addSmrg    # Grep'ing the first line is not enough: some people post-process
362b3078addSmrg    # each Makefile.in and add a new line on top of each file to say so.
363b3078addSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
364b3078addSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
365b3078addSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
366b3078addSmrg      dirpart=`AS_DIRNAME("$mf")`
367b3078addSmrg    else
368b3078addSmrg      continue
369b3078addSmrg    fi
370b3078addSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
371cf2f63c2Smrg    # from the Makefile without running 'make'.
372b3078addSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
373b3078addSmrg    test -z "$DEPDIR" && continue
374b3078addSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
375cf2f63c2Smrg    test -z "$am__include" && continue
376b3078addSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
377b3078addSmrg    # Find all dependency output files, they are included files with
378b3078addSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379b3078addSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380b3078addSmrg    # expansion.
381b3078addSmrg    for file in `sed -n "
382b3078addSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383cf2f63c2Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
384b3078addSmrg      # Make sure the directory exists.
385b3078addSmrg      test -f "$dirpart/$file" && continue
386b3078addSmrg      fdir=`AS_DIRNAME(["$file"])`
387b3078addSmrg      AS_MKDIR_P([$dirpart/$fdir])
388b3078addSmrg      # echo "creating $dirpart/$file"
389b3078addSmrg      echo '# dummy' > "$dirpart/$file"
390b3078addSmrg    done
3915c10afb9Smrg  done
392b3078addSmrg}
3935c10afb9Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3945c10afb9Smrg
3955c10afb9Smrg
3965c10afb9Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3975c10afb9Smrg# -----------------------------
3985c10afb9Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3995c10afb9Smrg#
4005c10afb9Smrg# This code is only required when automatic dependency tracking
401cf2f63c2Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
4025c10afb9Smrg# need in order to bootstrap the dependency handling code.
4035c10afb9SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4045c10afb9Smrg[AC_CONFIG_COMMANDS([depfiles],
4055c10afb9Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4065c10afb9Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4075c10afb9Smrg])
4085c10afb9Smrg
409b3078addSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4105c10afb9Smrg
411cf2f63c2Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
412b3078addSmrg#
413b3078addSmrg# This file is free software; the Free Software Foundation
414b3078addSmrg# gives unlimited permission to copy and/or distribute it,
415b3078addSmrg# with or without modifications, as long as this notice is preserved.
4165c10afb9Smrg
417b3078addSmrg# This macro actually does too much.  Some checks are only needed if
418b3078addSmrg# your package does certain things.  But this isn't really a big deal.
419b3078addSmrg
420cf2f63c2Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
421cf2f63c2Smrgm4_define([AC_PROG_CC],
422cf2f63c2Smrgm4_defn([AC_PROG_CC])
423cf2f63c2Smrg[_AM_PROG_CC_C_O
424cf2f63c2Smrg])
425cf2f63c2Smrg
426b3078addSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
427b3078addSmrg# AM_INIT_AUTOMAKE([OPTIONS])
428b3078addSmrg# -----------------------------------------------
429b3078addSmrg# The call with PACKAGE and VERSION arguments is the old style
430b3078addSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
431b3078addSmrg# and VERSION should now be passed to AC_INIT and removed from
432b3078addSmrg# the call to AM_INIT_AUTOMAKE.
433b3078addSmrg# We support both call styles for the transition.  After
434b3078addSmrg# the next Automake release, Autoconf can make the AC_INIT
435b3078addSmrg# arguments mandatory, and then we can depend on a new Autoconf
436b3078addSmrg# release and drop the old call support.
437b3078addSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
438cf2f63c2Smrg[AC_PREREQ([2.65])dnl
439b3078addSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
440b3078addSmrgdnl the ones we care about.
441b3078addSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
442b3078addSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
443b3078addSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
444b3078addSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
445b3078addSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
446b3078addSmrg  # is not polluted with repeated "-I."
447b3078addSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
448b3078addSmrg  # test to see if srcdir already configured
449b3078addSmrg  if test -f $srcdir/config.status; then
450b3078addSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
451b3078addSmrg  fi
4525c10afb9Smrgfi
453b3078addSmrg
454b3078addSmrg# test whether we have cygpath
455b3078addSmrgif test -z "$CYGPATH_W"; then
456b3078addSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
457b3078addSmrg    CYGPATH_W='cygpath -w'
458b3078addSmrg  else
459b3078addSmrg    CYGPATH_W=echo
460b3078addSmrg  fi
4615c10afb9Smrgfi
462b3078addSmrgAC_SUBST([CYGPATH_W])
4635c10afb9Smrg
464b3078addSmrg# Define the identity of the package.
465b3078addSmrgdnl Distinguish between old-style and new-style calls.
466b3078addSmrgm4_ifval([$2],
467cf2f63c2Smrg[AC_DIAGNOSE([obsolete],
468cf2f63c2Smrg             [$0: two- and three-arguments forms are deprecated.])
469cf2f63c2Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
470b3078addSmrg AC_SUBST([PACKAGE], [$1])dnl
471b3078addSmrg AC_SUBST([VERSION], [$2])],
472b3078addSmrg[_AM_SET_OPTIONS([$1])dnl
473b3078addSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
474cf2f63c2Smrgm4_if(
475cf2f63c2Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
476cf2f63c2Smrg  [ok:ok],,
477b3078addSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
478b3078addSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
479b3078addSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4805c10afb9Smrg
481b3078addSmrg_AM_IF_OPTION([no-define],,
482cf2f63c2Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
483cf2f63c2Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4845c10afb9Smrg
485b3078addSmrg# Some tools Automake needs.
486b3078addSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
487b3078addSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
488cf2f63c2SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
489cf2f63c2SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
490cf2f63c2SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
491cf2f63c2SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
492cf2f63c2SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
493b3078addSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
494b3078addSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
495cf2f63c2SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
496cf2f63c2Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
497cf2f63c2Smrg# dies out for good.  For more background, see:
498cf2f63c2Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
499cf2f63c2Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
500cf2f63c2SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
501cf2f63c2Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
502cf2f63c2Smrg# system "awk" is bad on some platforms.
503b3078addSmrgAC_REQUIRE([AC_PROG_AWK])dnl
504b3078addSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
505b3078addSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
506b3078addSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
507b3078addSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
508b3078addSmrg			     [_AM_PROG_TAR([v7])])])
509b3078addSmrg_AM_IF_OPTION([no-dependencies],,
510b3078addSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
511cf2f63c2Smrg		  [_AM_DEPENDENCIES([CC])],
512cf2f63c2Smrg		  [m4_define([AC_PROG_CC],
513cf2f63c2Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
514b3078addSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
515cf2f63c2Smrg		  [_AM_DEPENDENCIES([CXX])],
516cf2f63c2Smrg		  [m4_define([AC_PROG_CXX],
517cf2f63c2Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
518b3078addSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
519cf2f63c2Smrg		  [_AM_DEPENDENCIES([OBJC])],
520cf2f63c2Smrg		  [m4_define([AC_PROG_OBJC],
521cf2f63c2Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
522cf2f63c2SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
523cf2f63c2Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
524cf2f63c2Smrg		  [m4_define([AC_PROG_OBJCXX],
525cf2f63c2Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
526b3078addSmrg])
527cf2f63c2SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
528cf2f63c2Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
529cf2f63c2Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
530cf2f63c2Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
531b3078addSmrgAC_CONFIG_COMMANDS_PRE(dnl
532b3078addSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
533b3078addSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
534cf2f63c2Smrg
535cf2f63c2Smrg# POSIX will say in a future version that running "rm -f" with no argument
536cf2f63c2Smrg# is OK; and we want to be able to make that assumption in our Makefile
537cf2f63c2Smrg# recipes.  So use an aggressive probe to check that the usage we want is
538cf2f63c2Smrg# actually supported "in the wild" to an acceptable degree.
539cf2f63c2Smrg# See automake bug#10828.
540cf2f63c2Smrg# To make any issue more visible, cause the running configure to be aborted
541cf2f63c2Smrg# by default if the 'rm' program in use doesn't match our expectations; the
542cf2f63c2Smrg# user can still override this though.
543cf2f63c2Smrgif rm -f && rm -fr && rm -rf; then : OK; else
544cf2f63c2Smrg  cat >&2 <<'END'
545cf2f63c2SmrgOops!
546cf2f63c2Smrg
547cf2f63c2SmrgYour 'rm' program seems unable to run without file operands specified
548cf2f63c2Smrgon the command line, even when the '-f' option is present.  This is contrary
549cf2f63c2Smrgto the behaviour of most rm programs out there, and not conforming with
550cf2f63c2Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
551cf2f63c2Smrg
552cf2f63c2SmrgPlease tell bug-automake@gnu.org about your system, including the value
553cf2f63c2Smrgof your $PATH and any error possibly output before this message.  This
554cf2f63c2Smrgcan help us improve future automake versions.
555cf2f63c2Smrg
556cf2f63c2SmrgEND
557cf2f63c2Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
558cf2f63c2Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
559cf2f63c2Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
560cf2f63c2Smrg    echo >&2
561cf2f63c2Smrg  else
562cf2f63c2Smrg    cat >&2 <<'END'
563cf2f63c2SmrgAborting the configuration process, to ensure you take notice of the issue.
564cf2f63c2Smrg
565cf2f63c2SmrgYou can download and install GNU coreutils to get an 'rm' implementation
566cf2f63c2Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
567cf2f63c2Smrg
568cf2f63c2SmrgIf you want to complete the configuration process using your problematic
569cf2f63c2Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
570cf2f63c2Smrgto "yes", and re-run configure.
571cf2f63c2Smrg
572cf2f63c2SmrgEND
573cf2f63c2Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
574cf2f63c2Smrg  fi
575cf2f63c2Smrgfi
576cf2f63c2Smrgdnl The trailing newline in this macro's definition is deliberate, for
577cf2f63c2Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
578cf2f63c2Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
579b3078addSmrg])
5805c10afb9Smrg
581cf2f63c2Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
582b3078addSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
583b3078addSmrgdnl mangled by Autoconf and run in a shell conditional statement.
584b3078addSmrgm4_define([_AC_COMPILER_EXEEXT],
585b3078addSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5865c10afb9Smrg
587b3078addSmrg# When config.status generates a header, we must update the stamp-h file.
588b3078addSmrg# This file resides in the same directory as the config header
589b3078addSmrg# that is generated.  The stamp files are numbered to have different names.
590b3078addSmrg
591b3078addSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
592b3078addSmrg# loop where config.status creates the headers, so we can generate
593b3078addSmrg# our stamp files there.
594b3078addSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
595b3078addSmrg[# Compute $1's index in $config_headers.
596b3078addSmrg_am_arg=$1
597b3078addSmrg_am_stamp_count=1
598b3078addSmrgfor _am_header in $config_headers :; do
599b3078addSmrg  case $_am_header in
600b3078addSmrg    $_am_arg | $_am_arg:* )
601b3078addSmrg      break ;;
602b3078addSmrg    * )
603b3078addSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
604b3078addSmrg  esac
605b3078addSmrgdone
606b3078addSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6075c10afb9Smrg
608cf2f63c2Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
609b3078addSmrg#
610b3078addSmrg# This file is free software; the Free Software Foundation
611b3078addSmrg# gives unlimited permission to copy and/or distribute it,
612b3078addSmrg# with or without modifications, as long as this notice is preserved.
6135c10afb9Smrg
614b3078addSmrg# AM_PROG_INSTALL_SH
615b3078addSmrg# ------------------
616b3078addSmrg# Define $install_sh.
617b3078addSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
618b3078addSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
619cf2f63c2Smrgif test x"${install_sh+set}" != xset; then
620b3078addSmrg  case $am_aux_dir in
621b3078addSmrg  *\ * | *\	*)
622b3078addSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
623b3078addSmrg  *)
624b3078addSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
625b3078addSmrg  esac
6265c10afb9Smrgfi
627cf2f63c2SmrgAC_SUBST([install_sh])])
6285c10afb9Smrg
629cf2f63c2Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
630b3078addSmrg#
631b3078addSmrg# This file is free software; the Free Software Foundation
632b3078addSmrg# gives unlimited permission to copy and/or distribute it,
633b3078addSmrg# with or without modifications, as long as this notice is preserved.
6345c10afb9Smrg
635b3078addSmrg# Check whether the underlying file-system supports filenames
636b3078addSmrg# with a leading dot.  For instance MS-DOS doesn't.
637b3078addSmrgAC_DEFUN([AM_SET_LEADING_DOT],
638b3078addSmrg[rm -rf .tst 2>/dev/null
639b3078addSmrgmkdir .tst 2>/dev/null
640b3078addSmrgif test -d .tst; then
641b3078addSmrg  am__leading_dot=.
642b3078addSmrgelse
643b3078addSmrg  am__leading_dot=_
644b3078addSmrgfi
645b3078addSmrgrmdir .tst 2>/dev/null
646b3078addSmrgAC_SUBST([am__leading_dot])])
6475c10afb9Smrg
648b3078addSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6495c10afb9Smrg
650cf2f63c2Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
651b3078addSmrg#
652b3078addSmrg# This file is free software; the Free Software Foundation
653b3078addSmrg# gives unlimited permission to copy and/or distribute it,
654b3078addSmrg# with or without modifications, as long as this notice is preserved.
6555c10afb9Smrg
656b3078addSmrg# AM_MAKE_INCLUDE()
657b3078addSmrg# -----------------
658b3078addSmrg# Check to see how make treats includes.
659b3078addSmrgAC_DEFUN([AM_MAKE_INCLUDE],
660b3078addSmrg[am_make=${MAKE-make}
661b3078addSmrgcat > confinc << 'END'
662b3078addSmrgam__doit:
663b3078addSmrg	@echo this is the am__doit target
664b3078addSmrg.PHONY: am__doit
665b3078addSmrgEND
666b3078addSmrg# If we don't find an include directive, just comment out the code.
667b3078addSmrgAC_MSG_CHECKING([for style of include used by $am_make])
668b3078addSmrgam__include="#"
669b3078addSmrgam__quote=
670b3078addSmrg_am_result=none
671b3078addSmrg# First try GNU make style include.
672b3078addSmrgecho "include confinc" > confmf
673cf2f63c2Smrg# Ignore all kinds of additional output from 'make'.
674b3078addSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
675b3078addSmrg*the\ am__doit\ target*)
676b3078addSmrg  am__include=include
677b3078addSmrg  am__quote=
678b3078addSmrg  _am_result=GNU
679b3078addSmrg  ;;
680b3078addSmrgesac
681b3078addSmrg# Now try BSD make style include.
682b3078addSmrgif test "$am__include" = "#"; then
683b3078addSmrg   echo '.include "confinc"' > confmf
684b3078addSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
685b3078addSmrg   *the\ am__doit\ target*)
686b3078addSmrg     am__include=.include
687b3078addSmrg     am__quote="\""
688b3078addSmrg     _am_result=BSD
689b3078addSmrg     ;;
690b3078addSmrg   esac
691b3078addSmrgfi
692b3078addSmrgAC_SUBST([am__include])
693b3078addSmrgAC_SUBST([am__quote])
694b3078addSmrgAC_MSG_RESULT([$_am_result])
695b3078addSmrgrm -f confinc confmf
696b3078addSmrg])
6975c10afb9Smrg
698b3078addSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6995c10afb9Smrg
700cf2f63c2Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
701b3078addSmrg#
702b3078addSmrg# This file is free software; the Free Software Foundation
703b3078addSmrg# gives unlimited permission to copy and/or distribute it,
704b3078addSmrg# with or without modifications, as long as this notice is preserved.
7055c10afb9Smrg
706b3078addSmrg# AM_MISSING_PROG(NAME, PROGRAM)
707b3078addSmrg# ------------------------------
708b3078addSmrgAC_DEFUN([AM_MISSING_PROG],
709b3078addSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
710b3078addSmrg$1=${$1-"${am_missing_run}$2"}
711b3078addSmrgAC_SUBST($1)])
7125c10afb9Smrg
713b3078addSmrg# AM_MISSING_HAS_RUN
714b3078addSmrg# ------------------
715cf2f63c2Smrg# Define MISSING if not defined so far and test if it is modern enough.
716cf2f63c2Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
717b3078addSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
718b3078addSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
719b3078addSmrgAC_REQUIRE_AUX_FILE([missing])dnl
720b3078addSmrgif test x"${MISSING+set}" != xset; then
721b3078addSmrg  case $am_aux_dir in
722b3078addSmrg  *\ * | *\	*)
723b3078addSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
724b3078addSmrg  *)
725b3078addSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
726b3078addSmrg  esac
7275c10afb9Smrgfi
728b3078addSmrg# Use eval to expand $SHELL
729cf2f63c2Smrgif eval "$MISSING --is-lightweight"; then
730cf2f63c2Smrg  am_missing_run="$MISSING "
731b3078addSmrgelse
732b3078addSmrg  am_missing_run=
733cf2f63c2Smrg  AC_MSG_WARN(['missing' script is too old or missing])
734b3078addSmrgfi
735b3078addSmrg])
7365c10afb9Smrg
737b3078addSmrg# Helper functions for option handling.                     -*- Autoconf -*-
7385c10afb9Smrg
739cf2f63c2Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
7405c10afb9Smrg#
741b3078addSmrg# This file is free software; the Free Software Foundation
742b3078addSmrg# gives unlimited permission to copy and/or distribute it,
743b3078addSmrg# with or without modifications, as long as this notice is preserved.
7445c10afb9Smrg
745b3078addSmrg# _AM_MANGLE_OPTION(NAME)
746b3078addSmrg# -----------------------
747b3078addSmrgAC_DEFUN([_AM_MANGLE_OPTION],
748b3078addSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7495c10afb9Smrg
750b3078addSmrg# _AM_SET_OPTION(NAME)
751cf2f63c2Smrg# --------------------
752b3078addSmrg# Set option NAME.  Presently that only means defining a flag for this option.
753b3078addSmrgAC_DEFUN([_AM_SET_OPTION],
754cf2f63c2Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7555c10afb9Smrg
756b3078addSmrg# _AM_SET_OPTIONS(OPTIONS)
757cf2f63c2Smrg# ------------------------
758b3078addSmrg# OPTIONS is a space-separated list of Automake options.
759b3078addSmrgAC_DEFUN([_AM_SET_OPTIONS],
760b3078addSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7615c10afb9Smrg
762b3078addSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
763b3078addSmrg# -------------------------------------------
764b3078addSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
765b3078addSmrgAC_DEFUN([_AM_IF_OPTION],
766b3078addSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7675c10afb9Smrg
768cf2f63c2Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
769cf2f63c2Smrg#
770cf2f63c2Smrg# This file is free software; the Free Software Foundation
771cf2f63c2Smrg# gives unlimited permission to copy and/or distribute it,
772cf2f63c2Smrg# with or without modifications, as long as this notice is preserved.
773cf2f63c2Smrg
774cf2f63c2Smrg# _AM_PROG_CC_C_O
775cf2f63c2Smrg# ---------------
776cf2f63c2Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
777cf2f63c2Smrg# to automatically call this.
778cf2f63c2SmrgAC_DEFUN([_AM_PROG_CC_C_O],
779cf2f63c2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
780cf2f63c2SmrgAC_REQUIRE_AUX_FILE([compile])dnl
781cf2f63c2SmrgAC_LANG_PUSH([C])dnl
782cf2f63c2SmrgAC_CACHE_CHECK(
783cf2f63c2Smrg  [whether $CC understands -c and -o together],
784cf2f63c2Smrg  [am_cv_prog_cc_c_o],
785cf2f63c2Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
786cf2f63c2Smrg  # Make sure it works both with $CC and with simple cc.
787cf2f63c2Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
788cf2f63c2Smrg  # compilers refuse to overwrite an existing .o file with -o,
789cf2f63c2Smrg  # though they will create one.
790cf2f63c2Smrg  am_cv_prog_cc_c_o=yes
791cf2f63c2Smrg  for am_i in 1 2; do
792cf2f63c2Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
793cf2f63c2Smrg         && test -f conftest2.$ac_objext; then
794cf2f63c2Smrg      : OK
795cf2f63c2Smrg    else
796cf2f63c2Smrg      am_cv_prog_cc_c_o=no
797cf2f63c2Smrg      break
798cf2f63c2Smrg    fi
799cf2f63c2Smrg  done
800cf2f63c2Smrg  rm -f core conftest*
801cf2f63c2Smrg  unset am_i])
802cf2f63c2Smrgif test "$am_cv_prog_cc_c_o" != yes; then
803cf2f63c2Smrg   # Losing compiler, so override with the script.
804cf2f63c2Smrg   # FIXME: It is wrong to rewrite CC.
805cf2f63c2Smrg   # But if we don't then we get into trouble of one sort or another.
806cf2f63c2Smrg   # A longer-term fix would be to have automake use am__CC in this case,
807cf2f63c2Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
808cf2f63c2Smrg   CC="$am_aux_dir/compile $CC"
809cf2f63c2Smrgfi
810cf2f63c2SmrgAC_LANG_POP([C])])
811cf2f63c2Smrg
812cf2f63c2Smrg# For backward compatibility.
813cf2f63c2SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8145c10afb9Smrg
815cf2f63c2Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
816b3078addSmrg#
817b3078addSmrg# This file is free software; the Free Software Foundation
818b3078addSmrg# gives unlimited permission to copy and/or distribute it,
819b3078addSmrg# with or without modifications, as long as this notice is preserved.
8205c10afb9Smrg
821cf2f63c2Smrg# AM_RUN_LOG(COMMAND)
822cf2f63c2Smrg# -------------------
823cf2f63c2Smrg# Run COMMAND, save the exit status in ac_status, and log it.
824cf2f63c2Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
825cf2f63c2SmrgAC_DEFUN([AM_RUN_LOG],
826cf2f63c2Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
827cf2f63c2Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
828cf2f63c2Smrg   ac_status=$?
829cf2f63c2Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
830cf2f63c2Smrg   (exit $ac_status); }])
831cf2f63c2Smrg
832cf2f63c2Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
833cf2f63c2Smrg
834cf2f63c2Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
835cf2f63c2Smrg#
836cf2f63c2Smrg# This file is free software; the Free Software Foundation
837cf2f63c2Smrg# gives unlimited permission to copy and/or distribute it,
838cf2f63c2Smrg# with or without modifications, as long as this notice is preserved.
8395c10afb9Smrg
840b3078addSmrg# AM_SANITY_CHECK
841b3078addSmrg# ---------------
842b3078addSmrgAC_DEFUN([AM_SANITY_CHECK],
843b3078addSmrg[AC_MSG_CHECKING([whether build environment is sane])
844b3078addSmrg# Reject unsafe characters in $srcdir or the absolute working directory
845b3078addSmrg# name.  Accept space and tab only in the latter.
846b3078addSmrgam_lf='
847b3078addSmrg'
848b3078addSmrgcase `pwd` in
849b3078addSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
850b3078addSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
851b3078addSmrgesac
852b3078addSmrgcase $srcdir in
853b3078addSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
854cf2f63c2Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
855b3078addSmrgesac
8565c10afb9Smrg
857cf2f63c2Smrg# Do 'set' in a subshell so we don't clobber the current shell's
858b3078addSmrg# arguments.  Must try -L first in case configure is actually a
859b3078addSmrg# symlink; some systems play weird games with the mod time of symlinks
860b3078addSmrg# (eg FreeBSD returns the mod time of the symlink's containing
861b3078addSmrg# directory).
862b3078addSmrgif (
863cf2f63c2Smrg   am_has_slept=no
864cf2f63c2Smrg   for am_try in 1 2; do
865cf2f63c2Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
866cf2f63c2Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
867cf2f63c2Smrg     if test "$[*]" = "X"; then
868cf2f63c2Smrg	# -L didn't work.
869cf2f63c2Smrg	set X `ls -t "$srcdir/configure" conftest.file`
870cf2f63c2Smrg     fi
871cf2f63c2Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
872cf2f63c2Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
873cf2f63c2Smrg
874cf2f63c2Smrg	# If neither matched, then we have a broken ls.  This can happen
875cf2f63c2Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
876cf2f63c2Smrg	# broken ls alias from the environment.  This has actually
877cf2f63c2Smrg	# happened.  Such a system could not be considered "sane".
878cf2f63c2Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
879cf2f63c2Smrg  alias in your environment])
880cf2f63c2Smrg     fi
881cf2f63c2Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
882cf2f63c2Smrg       break
883cf2f63c2Smrg     fi
884cf2f63c2Smrg     # Just in case.
885cf2f63c2Smrg     sleep 1
886cf2f63c2Smrg     am_has_slept=yes
887cf2f63c2Smrg   done
888b3078addSmrg   test "$[2]" = conftest.file
889b3078addSmrg   )
890b3078addSmrgthen
891b3078addSmrg   # Ok.
892b3078addSmrg   :
893b3078addSmrgelse
894b3078addSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
895b3078addSmrgCheck your system clock])
896b3078addSmrgfi
897cf2f63c2SmrgAC_MSG_RESULT([yes])
898cf2f63c2Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
899cf2f63c2Smrg# generated files are strictly newer.
900cf2f63c2Smrgam_sleep_pid=
901cf2f63c2Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
902cf2f63c2Smrg  ( sleep 1 ) &
903cf2f63c2Smrg  am_sleep_pid=$!
904cf2f63c2Smrgfi
905cf2f63c2SmrgAC_CONFIG_COMMANDS_PRE(
906cf2f63c2Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
907cf2f63c2Smrg   if test -n "$am_sleep_pid"; then
908cf2f63c2Smrg     # Hide warnings about reused PIDs.
909cf2f63c2Smrg     wait $am_sleep_pid 2>/dev/null
910cf2f63c2Smrg   fi
911cf2f63c2Smrg   AC_MSG_RESULT([done])])
912cf2f63c2Smrgrm -f conftest.file
913cf2f63c2Smrg])
9145c10afb9Smrg
915cf2f63c2Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
916b3078addSmrg#
917b3078addSmrg# This file is free software; the Free Software Foundation
918b3078addSmrg# gives unlimited permission to copy and/or distribute it,
919b3078addSmrg# with or without modifications, as long as this notice is preserved.
9205c10afb9Smrg
921b3078addSmrg# AM_SILENT_RULES([DEFAULT])
922b3078addSmrg# --------------------------
923b3078addSmrg# Enable less verbose build rules; with the default set to DEFAULT
924cf2f63c2Smrg# ("yes" being less verbose, "no" or empty being verbose).
925b3078addSmrgAC_DEFUN([AM_SILENT_RULES],
926cf2f63c2Smrg[AC_ARG_ENABLE([silent-rules], [dnl
927cf2f63c2SmrgAS_HELP_STRING(
928cf2f63c2Smrg  [--enable-silent-rules],
929cf2f63c2Smrg  [less verbose build output (undo: "make V=1")])
930cf2f63c2SmrgAS_HELP_STRING(
931cf2f63c2Smrg  [--disable-silent-rules],
932cf2f63c2Smrg  [verbose build output (undo: "make V=0")])dnl
933cf2f63c2Smrg])
934cf2f63c2Smrgcase $enable_silent_rules in @%:@ (((
935cf2f63c2Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
936cf2f63c2Smrg   no) AM_DEFAULT_VERBOSITY=1;;
937cf2f63c2Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
938b3078addSmrgesac
939cf2f63c2Smrgdnl
940cf2f63c2Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
941cf2f63c2Smrgdnl do not support nested variable expansions.
942cf2f63c2Smrgdnl See automake bug#9928 and bug#10237.
943cf2f63c2Smrgam_make=${MAKE-make}
944cf2f63c2SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
945cf2f63c2Smrg   [am_cv_make_support_nested_variables],
946cf2f63c2Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
947cf2f63c2SmrgBAR0=false
948cf2f63c2SmrgBAR1=true
949cf2f63c2SmrgV=1
950cf2f63c2Smrgam__doit:
951cf2f63c2Smrg	@$(TRUE)
952cf2f63c2Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
953cf2f63c2Smrg  am_cv_make_support_nested_variables=yes
954cf2f63c2Smrgelse
955cf2f63c2Smrg  am_cv_make_support_nested_variables=no
956cf2f63c2Smrgfi])
957cf2f63c2Smrgif test $am_cv_make_support_nested_variables = yes; then
958cf2f63c2Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
959cf2f63c2Smrg  AM_V='$(V)'
960cf2f63c2Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
961cf2f63c2Smrgelse
962cf2f63c2Smrg  AM_V=$AM_DEFAULT_VERBOSITY
963cf2f63c2Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
964cf2f63c2Smrgfi
965cf2f63c2SmrgAC_SUBST([AM_V])dnl
966cf2f63c2SmrgAM_SUBST_NOTMAKE([AM_V])dnl
967cf2f63c2SmrgAC_SUBST([AM_DEFAULT_V])dnl
968cf2f63c2SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
969b3078addSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
970b3078addSmrgAM_BACKSLASH='\'
971b3078addSmrgAC_SUBST([AM_BACKSLASH])dnl
972b3078addSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
973b3078addSmrg])
9745c10afb9Smrg
975cf2f63c2Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
976b3078addSmrg#
977b3078addSmrg# This file is free software; the Free Software Foundation
978b3078addSmrg# gives unlimited permission to copy and/or distribute it,
979b3078addSmrg# with or without modifications, as long as this notice is preserved.
9805c10afb9Smrg
981b3078addSmrg# AM_PROG_INSTALL_STRIP
982b3078addSmrg# ---------------------
983cf2f63c2Smrg# One issue with vendor 'install' (even GNU) is that you can't
984b3078addSmrg# specify the program used to strip binaries.  This is especially
985b3078addSmrg# annoying in cross-compiling environments, where the build's strip
986b3078addSmrg# is unlikely to handle the host's binaries.
987b3078addSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
988cf2f63c2Smrg# always use install-sh in "make install-strip", and initialize
989b3078addSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
990b3078addSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
991b3078addSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
992cf2f63c2Smrg# Installed binaries are usually stripped using 'strip' when the user
993cf2f63c2Smrg# run "make install-strip".  However 'strip' might not be the right
994b3078addSmrg# tool to use in cross-compilation environments, therefore Automake
995cf2f63c2Smrg# will honor the 'STRIP' environment variable to overrule this program.
996cf2f63c2Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
997b3078addSmrgif test "$cross_compiling" != no; then
998b3078addSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
999b3078addSmrgfi
1000b3078addSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1001b3078addSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10025c10afb9Smrg
1003cf2f63c2Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
1004b3078addSmrg#
1005b3078addSmrg# This file is free software; the Free Software Foundation
1006b3078addSmrg# gives unlimited permission to copy and/or distribute it,
1007b3078addSmrg# with or without modifications, as long as this notice is preserved.
1008b3078addSmrg
1009b3078addSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
1010b3078addSmrg# ---------------------------
1011b3078addSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1012b3078addSmrg# This macro is traced by Automake.
1013b3078addSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1014b3078addSmrg
1015b3078addSmrg# AM_SUBST_NOTMAKE(VARIABLE)
1016cf2f63c2Smrg# --------------------------
1017b3078addSmrg# Public sister of _AM_SUBST_NOTMAKE.
1018b3078addSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1019b3078addSmrg
1020b3078addSmrg# Check how to create a tarball.                            -*- Autoconf -*-
1021b3078addSmrg
1022cf2f63c2Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
1023b3078addSmrg#
1024b3078addSmrg# This file is free software; the Free Software Foundation
1025b3078addSmrg# gives unlimited permission to copy and/or distribute it,
1026b3078addSmrg# with or without modifications, as long as this notice is preserved.
1027b3078addSmrg
1028b3078addSmrg# _AM_PROG_TAR(FORMAT)
1029b3078addSmrg# --------------------
1030b3078addSmrg# Check how to create a tarball in format FORMAT.
1031cf2f63c2Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1032b3078addSmrg#
1033b3078addSmrg# Substitute a variable $(am__tar) that is a command
1034b3078addSmrg# writing to stdout a FORMAT-tarball containing the directory
1035b3078addSmrg# $tardir.
1036b3078addSmrg#     tardir=directory && $(am__tar) > result.tar
1037b3078addSmrg#
1038b3078addSmrg# Substitute a variable $(am__untar) that extract such
1039b3078addSmrg# a tarball read from stdin.
1040b3078addSmrg#     $(am__untar) < result.tar
1041cf2f63c2Smrg#
1042b3078addSmrgAC_DEFUN([_AM_PROG_TAR],
1043cf2f63c2Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1044cf2f63c2Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1045cf2f63c2SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1046cf2f63c2Smrg
1047cf2f63c2Smrg# We'll loop over all known methods to create a tar archive until one works.
1048b3078addSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1049b3078addSmrg
1050cf2f63c2Smrgm4_if([$1], [v7],
1051cf2f63c2Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1052cf2f63c2Smrg
1053cf2f63c2Smrg  [m4_case([$1],
1054cf2f63c2Smrg    [ustar],
1055cf2f63c2Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1056cf2f63c2Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1057cf2f63c2Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1058cf2f63c2Smrg      # and bug#13588).
1059cf2f63c2Smrg      am_max_uid=2097151 # 2^21 - 1
1060cf2f63c2Smrg      am_max_gid=$am_max_uid
1061cf2f63c2Smrg      # The $UID and $GID variables are not portable, so we need to resort
1062cf2f63c2Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1063cf2f63c2Smrg      # below are definitely unexpected, so allow the users to see them
1064cf2f63c2Smrg      # (that is, avoid stderr redirection).
1065cf2f63c2Smrg      am_uid=`id -u || echo unknown`
1066cf2f63c2Smrg      am_gid=`id -g || echo unknown`
1067cf2f63c2Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1068cf2f63c2Smrg      if test $am_uid -le $am_max_uid; then
1069cf2f63c2Smrg         AC_MSG_RESULT([yes])
1070cf2f63c2Smrg      else
1071cf2f63c2Smrg         AC_MSG_RESULT([no])
1072cf2f63c2Smrg         _am_tools=none
1073cf2f63c2Smrg      fi
1074cf2f63c2Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1075cf2f63c2Smrg      if test $am_gid -le $am_max_gid; then
1076cf2f63c2Smrg         AC_MSG_RESULT([yes])
1077cf2f63c2Smrg      else
1078cf2f63c2Smrg        AC_MSG_RESULT([no])
1079cf2f63c2Smrg        _am_tools=none
1080cf2f63c2Smrg      fi],
1081cf2f63c2Smrg
1082cf2f63c2Smrg  [pax],
1083cf2f63c2Smrg    [],
1084cf2f63c2Smrg
1085cf2f63c2Smrg  [m4_fatal([Unknown tar format])])
1086cf2f63c2Smrg
1087cf2f63c2Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1088cf2f63c2Smrg
1089cf2f63c2Smrg  # Go ahead even if we have the value already cached.  We do so because we
1090cf2f63c2Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1091cf2f63c2Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1092cf2f63c2Smrg
1093cf2f63c2Smrg  for _am_tool in $_am_tools; do
1094cf2f63c2Smrg    case $_am_tool in
1095cf2f63c2Smrg    gnutar)
1096cf2f63c2Smrg      for _am_tar in tar gnutar gtar; do
1097cf2f63c2Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1098cf2f63c2Smrg      done
1099cf2f63c2Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1100cf2f63c2Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1101cf2f63c2Smrg      am__untar="$_am_tar -xf -"
1102cf2f63c2Smrg      ;;
1103cf2f63c2Smrg    plaintar)
1104cf2f63c2Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1105cf2f63c2Smrg      # ustar tarball either.
1106cf2f63c2Smrg      (tar --version) >/dev/null 2>&1 && continue
1107cf2f63c2Smrg      am__tar='tar chf - "$$tardir"'
1108cf2f63c2Smrg      am__tar_='tar chf - "$tardir"'
1109cf2f63c2Smrg      am__untar='tar xf -'
1110cf2f63c2Smrg      ;;
1111cf2f63c2Smrg    pax)
1112cf2f63c2Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1113cf2f63c2Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1114cf2f63c2Smrg      am__untar='pax -r'
1115cf2f63c2Smrg      ;;
1116cf2f63c2Smrg    cpio)
1117cf2f63c2Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1118cf2f63c2Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1119cf2f63c2Smrg      am__untar='cpio -i -H $1 -d'
1120cf2f63c2Smrg      ;;
1121cf2f63c2Smrg    none)
1122cf2f63c2Smrg      am__tar=false
1123cf2f63c2Smrg      am__tar_=false
1124cf2f63c2Smrg      am__untar=false
1125cf2f63c2Smrg      ;;
1126cf2f63c2Smrg    esac
1127b3078addSmrg
1128cf2f63c2Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1129cf2f63c2Smrg    # and am__untar set.
1130cf2f63c2Smrg    test -n "${am_cv_prog_tar_$1}" && break
1131cf2f63c2Smrg
1132cf2f63c2Smrg    # tar/untar a dummy directory, and stop if the command works.
1133cf2f63c2Smrg    rm -rf conftest.dir
1134cf2f63c2Smrg    mkdir conftest.dir
1135cf2f63c2Smrg    echo GrepMe > conftest.dir/file
1136cf2f63c2Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1137cf2f63c2Smrg    rm -rf conftest.dir
1138cf2f63c2Smrg    if test -s conftest.tar; then
1139cf2f63c2Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1140cf2f63c2Smrg      AM_RUN_LOG([cat conftest.dir/file])
1141cf2f63c2Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1142cf2f63c2Smrg    fi
1143cf2f63c2Smrg  done
1144b3078addSmrg  rm -rf conftest.dir
11455c10afb9Smrg
1146cf2f63c2Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1147cf2f63c2Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1148cf2f63c2Smrg
1149b3078addSmrgAC_SUBST([am__tar])
1150b3078addSmrgAC_SUBST([am__untar])
1151b3078addSmrg]) # _AM_PROG_TAR
11525c10afb9Smrg
1153cf2f63c2Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1154cf2f63c2Smrg# 
1155cf2f63c2Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1156b3078addSmrg#
1157cf2f63c2Smrg# This program is free software; you can redistribute it and/or modify
1158cf2f63c2Smrg# it under the terms of the GNU General Public License as published by
1159cf2f63c2Smrg# the Free Software Foundation; either version 2 of the License, or
1160cf2f63c2Smrg# (at your option) any later version.
1161b3078addSmrg#
1162cf2f63c2Smrg# This program is distributed in the hope that it will be useful, but
1163cf2f63c2Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1164cf2f63c2Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1165cf2f63c2Smrg# General Public License for more details.
1166b3078addSmrg#
1167cf2f63c2Smrg# You should have received a copy of the GNU General Public License
1168cf2f63c2Smrg# along with this program; if not, write to the Free Software
1169cf2f63c2Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1170b3078addSmrg#
1171cf2f63c2Smrg# As a special exception to the GNU General Public License, if you
1172cf2f63c2Smrg# distribute this file as part of a program that contains a
1173cf2f63c2Smrg# configuration script generated by Autoconf, you may include it under
1174cf2f63c2Smrg# the same distribution terms that you use for the rest of that program.
11755c10afb9Smrg
1176cf2f63c2Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1177cf2f63c2Smrg# ----------------------------------
1178cf2f63c2SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1179cf2f63c2Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1180cf2f63c2Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1181cf2f63c2SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1182cf2f63c2Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1183cf2f63c2Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
11845c10afb9Smrgfi
1185cf2f63c2Smrgif test -n "$PKG_CONFIG"; then
1186cf2f63c2Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1187cf2f63c2Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1188cf2f63c2Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
11895c10afb9Smrg		AC_MSG_RESULT([yes])
11905c10afb9Smrg	else
1191cf2f63c2Smrg		AC_MSG_RESULT([no])
1192cf2f63c2Smrg		PKG_CONFIG=""
11935c10afb9Smrg	fi
1194cf2f63c2Smrg		
1195cf2f63c2Smrgfi[]dnl
1196cf2f63c2Smrg])# PKG_PROG_PKG_CONFIG
11975c10afb9Smrg
1198cf2f63c2Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1199b3078addSmrg#
1200cf2f63c2Smrg# Check to see whether a particular set of modules exists.  Similar
1201cf2f63c2Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1202cf2f63c2Smrg#
1203cf2f63c2Smrg#
1204cf2f63c2Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1205cf2f63c2Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
1206cf2f63c2Smrg# PKG_CHECK_EXISTS manually
1207cf2f63c2Smrg# --------------------------------------------------------------
1208cf2f63c2SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1209cf2f63c2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1210cf2f63c2Smrgif test -n "$PKG_CONFIG" && \
1211cf2f63c2Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1212cf2f63c2Smrg  m4_ifval([$2], [$2], [:])
1213cf2f63c2Smrgm4_ifvaln([$3], [else
1214cf2f63c2Smrg  $3])dnl
1215cf2f63c2Smrgfi])
1216cf2f63c2Smrg
1217cf2f63c2Smrg
1218cf2f63c2Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1219cf2f63c2Smrg# ---------------------------------------------
1220cf2f63c2Smrgm4_define([_PKG_CONFIG],
1221cf2f63c2Smrg[if test -n "$$1"; then
1222cf2f63c2Smrg    pkg_cv_[]$1="$$1"
1223cf2f63c2Smrg elif test -n "$PKG_CONFIG"; then
1224cf2f63c2Smrg    PKG_CHECK_EXISTS([$3],
1225cf2f63c2Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1226cf2f63c2Smrg		     [pkg_failed=yes])
1227cf2f63c2Smrg else
1228cf2f63c2Smrg    pkg_failed=untried
1229cf2f63c2Smrgfi[]dnl
1230cf2f63c2Smrg])# _PKG_CONFIG
1231cf2f63c2Smrg
1232cf2f63c2Smrg# _PKG_SHORT_ERRORS_SUPPORTED
1233cf2f63c2Smrg# -----------------------------
1234cf2f63c2SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1235cf2f63c2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1236cf2f63c2Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1237cf2f63c2Smrg        _pkg_short_errors_supported=yes
1238cf2f63c2Smrgelse
1239cf2f63c2Smrg        _pkg_short_errors_supported=no
1240cf2f63c2Smrgfi[]dnl
1241cf2f63c2Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1242cf2f63c2Smrg
1243cf2f63c2Smrg
1244cf2f63c2Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1245cf2f63c2Smrg# [ACTION-IF-NOT-FOUND])
1246cf2f63c2Smrg#
1247cf2f63c2Smrg#
1248cf2f63c2Smrg# Note that if there is a possibility the first call to
1249cf2f63c2Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1250cf2f63c2Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1251cf2f63c2Smrg#
1252cf2f63c2Smrg#
1253cf2f63c2Smrg# --------------------------------------------------------------
1254cf2f63c2SmrgAC_DEFUN([PKG_CHECK_MODULES],
1255cf2f63c2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1256cf2f63c2SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1257cf2f63c2SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1258cf2f63c2Smrg
1259cf2f63c2Smrgpkg_failed=no
1260cf2f63c2SmrgAC_MSG_CHECKING([for $1])
1261cf2f63c2Smrg
1262cf2f63c2Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1263cf2f63c2Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1264cf2f63c2Smrg
1265cf2f63c2Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1266cf2f63c2Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1267cf2f63c2SmrgSee the pkg-config man page for more details.])
1268cf2f63c2Smrg
1269cf2f63c2Smrgif test $pkg_failed = yes; then
1270cf2f63c2Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1271cf2f63c2Smrg        if test $_pkg_short_errors_supported = yes; then
1272cf2f63c2Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1273cf2f63c2Smrg        else 
1274cf2f63c2Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1275cf2f63c2Smrg        fi
1276cf2f63c2Smrg	# Put the nasty error message in config.log where it belongs
1277cf2f63c2Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1278cf2f63c2Smrg
1279cf2f63c2Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1280cf2f63c2Smrg[Package requirements ($2) were not met:
1281cf2f63c2Smrg
1282cf2f63c2Smrg$$1_PKG_ERRORS
1283cf2f63c2Smrg
1284cf2f63c2SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1285cf2f63c2Smrginstalled software in a non-standard prefix.
1286cf2f63c2Smrg
1287cf2f63c2Smrg_PKG_TEXT
1288cf2f63c2Smrg])],
1289cf2f63c2Smrg		[AC_MSG_RESULT([no])
1290cf2f63c2Smrg                $4])
1291cf2f63c2Smrgelif test $pkg_failed = untried; then
1292cf2f63c2Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1293cf2f63c2Smrg[The pkg-config script could not be found or is too old.  Make sure it
1294cf2f63c2Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1295cf2f63c2Smrgpath to pkg-config.
1296cf2f63c2Smrg
1297cf2f63c2Smrg_PKG_TEXT
1298cf2f63c2Smrg
1299cf2f63c2SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1300cf2f63c2Smrg		[$4])
1301cf2f63c2Smrgelse
1302cf2f63c2Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1303cf2f63c2Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1304cf2f63c2Smrg        AC_MSG_RESULT([yes])
1305cf2f63c2Smrg	ifelse([$3], , :, [$3])
1306cf2f63c2Smrgfi[]dnl
1307cf2f63c2Smrg])# PKG_CHECK_MODULES
1308cf2f63c2Smrg
1309cf2f63c2Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1310cf2f63c2Smrgdnl
1311cf2f63c2Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1312cf2f63c2Smrgdnl
1313cf2f63c2Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1314cf2f63c2Smrgdnl copy of this software and associated documentation files (the "Software"),
1315cf2f63c2Smrgdnl to deal in the Software without restriction, including without limitation
1316cf2f63c2Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1317cf2f63c2Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1318cf2f63c2Smrgdnl Software is furnished to do so, subject to the following conditions:
1319cf2f63c2Smrgdnl
1320cf2f63c2Smrgdnl The above copyright notice and this permission notice (including the next
1321cf2f63c2Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1322cf2f63c2Smrgdnl Software.
1323cf2f63c2Smrgdnl
1324cf2f63c2Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1325cf2f63c2Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1326cf2f63c2Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1327cf2f63c2Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1328cf2f63c2Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1329cf2f63c2Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1330cf2f63c2Smrgdnl DEALINGS IN THE SOFTWARE.
1331cf2f63c2Smrg
1332cf2f63c2Smrg# XORG_MACROS_VERSION(required-version)
1333cf2f63c2Smrg# -------------------------------------
1334cf2f63c2Smrg# Minimum version: 1.1.0
1335cf2f63c2Smrg#
1336cf2f63c2Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1337cf2f63c2Smrg# your configure.ac with the minimum required version, such as:
1338cf2f63c2Smrg# XORG_MACROS_VERSION(1.1)
1339cf2f63c2Smrg#
1340cf2f63c2Smrg# To ensure that this macro is defined, also add:
1341cf2f63c2Smrg# m4_ifndef([XORG_MACROS_VERSION],
1342cf2f63c2Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1343cf2f63c2Smrg#
1344cf2f63c2Smrg#
1345cf2f63c2Smrg# See the "minimum version" comment for each macro you use to see what
1346cf2f63c2Smrg# version you require.
1347cf2f63c2Smrgm4_defun([XORG_MACROS_VERSION],[
1348cf2f63c2Smrgm4_define([vers_have], [1.19.0])
1349cf2f63c2Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1350cf2f63c2Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1351cf2f63c2Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1352cf2f63c2Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1353cf2f63c2Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1354cf2f63c2Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1355cf2f63c2Smrgm4_undefine([vers_have])
1356cf2f63c2Smrgm4_undefine([maj_have])
1357cf2f63c2Smrgm4_undefine([maj_needed])
1358cf2f63c2Smrg]) # XORG_MACROS_VERSION
1359cf2f63c2Smrg
1360cf2f63c2Smrg# XORG_PROG_RAWCPP()
1361cf2f63c2Smrg# ------------------
1362cf2f63c2Smrg# Minimum version: 1.0.0
1363cf2f63c2Smrg#
1364cf2f63c2Smrg# Find cpp program and necessary flags for use in pre-processing text files
1365cf2f63c2Smrg# such as man pages and config files
1366cf2f63c2SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1367cf2f63c2SmrgAC_REQUIRE([AC_PROG_CPP])
1368cf2f63c2SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
1369cf2f63c2Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1370cf2f63c2Smrg
1371cf2f63c2Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1372cf2f63c2Smrg# which is not the best choice for supporting other OS'es, but covers most
1373cf2f63c2Smrg# of the ones we need for now.
1374cf2f63c2SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1375cf2f63c2SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1376cf2f63c2Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1377cf2f63c2Smrg	AC_MSG_RESULT([no])
1378cf2f63c2Smrgelse
1379cf2f63c2Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1380cf2f63c2Smrg		RAWCPPFLAGS=-undef
1381cf2f63c2Smrg		AC_MSG_RESULT([yes])
1382cf2f63c2Smrg	# under Cygwin unix is still defined even with -undef
1383cf2f63c2Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1384cf2f63c2Smrg		RAWCPPFLAGS="-undef -ansi"
1385cf2f63c2Smrg		AC_MSG_RESULT([yes, with -ansi])
1386cf2f63c2Smrg	else
1387cf2f63c2Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1388cf2f63c2Smrg	fi
1389cf2f63c2Smrgfi
1390cf2f63c2Smrgrm -f conftest.$ac_ext
1391cf2f63c2Smrg
1392cf2f63c2SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1393cf2f63c2SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1394cf2f63c2Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1395cf2f63c2Smrg	AC_MSG_RESULT([no])
1396cf2f63c2Smrgelse
1397cf2f63c2Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1398cf2f63c2Smrg		TRADITIONALCPPFLAGS="-traditional"
1399cf2f63c2Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1400cf2f63c2Smrg		AC_MSG_RESULT([yes])
1401cf2f63c2Smrg	else
1402cf2f63c2Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1403cf2f63c2Smrg	fi
1404cf2f63c2Smrgfi
1405cf2f63c2Smrgrm -f conftest.$ac_ext
1406cf2f63c2SmrgAC_SUBST(RAWCPPFLAGS)
1407cf2f63c2SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1408cf2f63c2Smrg]) # XORG_PROG_RAWCPP
1409cf2f63c2Smrg
1410cf2f63c2Smrg# XORG_MANPAGE_SECTIONS()
1411cf2f63c2Smrg# -----------------------
1412cf2f63c2Smrg# Minimum version: 1.0.0
1413cf2f63c2Smrg#
1414cf2f63c2Smrg# Determine which sections man pages go in for the different man page types
1415cf2f63c2Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1416cf2f63c2Smrg# Not sure if there's any better way than just hardcoding by OS name.
1417cf2f63c2Smrg# Override default settings by setting environment variables
1418cf2f63c2Smrg# Added MAN_SUBSTS in version 1.8
1419cf2f63c2Smrg# Added AC_PROG_SED in version 1.8
1420cf2f63c2Smrg
1421cf2f63c2SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1422cf2f63c2SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1423cf2f63c2SmrgAC_REQUIRE([AC_PROG_SED])
1424cf2f63c2Smrg
1425cf2f63c2Smrgif test x$APP_MAN_SUFFIX = x    ; then
1426cf2f63c2Smrg    APP_MAN_SUFFIX=1
1427cf2f63c2Smrgfi
1428cf2f63c2Smrgif test x$APP_MAN_DIR = x    ; then
1429cf2f63c2Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1430cf2f63c2Smrgfi
14315c10afb9Smrg
14325c10afb9Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1433b3078addSmrg    LIB_MAN_SUFFIX=3
14345c10afb9Smrgfi
14355c10afb9Smrgif test x$LIB_MAN_DIR = x    ; then
1436b3078addSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
14375c10afb9Smrgfi
14385c10afb9Smrg
14395c10afb9Smrgif test x$FILE_MAN_SUFFIX = x    ; then
14405c10afb9Smrg    case $host_os in
14415c10afb9Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
14425c10afb9Smrg	*)		FILE_MAN_SUFFIX=5  ;;
14435c10afb9Smrg    esac
14445c10afb9Smrgfi
14455c10afb9Smrgif test x$FILE_MAN_DIR = x    ; then
1446b3078addSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
14475c10afb9Smrgfi
14485c10afb9Smrg
14495c10afb9Smrgif test x$MISC_MAN_SUFFIX = x    ; then
14505c10afb9Smrg    case $host_os in
14515c10afb9Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
14525c10afb9Smrg	*)		MISC_MAN_SUFFIX=7  ;;
14535c10afb9Smrg    esac
14545c10afb9Smrgfi
14555c10afb9Smrgif test x$MISC_MAN_DIR = x    ; then
1456b3078addSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
14575c10afb9Smrgfi
14585c10afb9Smrg
14595c10afb9Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
14605c10afb9Smrg    case $host_os in
14615c10afb9Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
14625c10afb9Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
14635c10afb9Smrg    esac
14645c10afb9Smrgfi
14655c10afb9Smrgif test x$DRIVER_MAN_DIR = x    ; then
1466b3078addSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
14675c10afb9Smrgfi
14685c10afb9Smrg
14695c10afb9Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
14705c10afb9Smrg    case $host_os in
14715c10afb9Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
14725c10afb9Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
14735c10afb9Smrg    esac
14745c10afb9Smrgfi
14755c10afb9Smrgif test x$ADMIN_MAN_DIR = x    ; then
14765c10afb9Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
14775c10afb9Smrgfi
14785c10afb9Smrg
14795c10afb9Smrg
14805c10afb9SmrgAC_SUBST([APP_MAN_SUFFIX])
14815c10afb9SmrgAC_SUBST([LIB_MAN_SUFFIX])
14825c10afb9SmrgAC_SUBST([FILE_MAN_SUFFIX])
14835c10afb9SmrgAC_SUBST([MISC_MAN_SUFFIX])
14845c10afb9SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
14855c10afb9SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
14865c10afb9SmrgAC_SUBST([APP_MAN_DIR])
14875c10afb9SmrgAC_SUBST([LIB_MAN_DIR])
14885c10afb9SmrgAC_SUBST([FILE_MAN_DIR])
14895c10afb9SmrgAC_SUBST([MISC_MAN_DIR])
14905c10afb9SmrgAC_SUBST([DRIVER_MAN_DIR])
14915c10afb9SmrgAC_SUBST([ADMIN_MAN_DIR])
1492b3078addSmrg
1493b3078addSmrgXORG_MAN_PAGE="X Version 11"
1494b3078addSmrgAC_SUBST([XORG_MAN_PAGE])
1495b3078addSmrgMAN_SUBSTS="\
1496b3078addSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1497b3078addSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1498b3078addSmrg	-e 's|__xservername__|Xorg|g' \
1499b3078addSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1500b3078addSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1501b3078addSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1502b3078addSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1503b3078addSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1504b3078addSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1505b3078addSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1506b3078addSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1507b3078addSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1508b3078addSmrgAC_SUBST([MAN_SUBSTS])
1509b3078addSmrg
15105c10afb9Smrg]) # XORG_MANPAGE_SECTIONS
15115c10afb9Smrg
1512b3078addSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1513b3078addSmrg# ------------------------
1514b3078addSmrg# Minimum version: 1.7.0
1515b3078addSmrg#
1516b3078addSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1517b3078addSmrg# provided by xorg-sgml-doctools, if installed.
1518b3078addSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1519b3078addSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1520b3078addSmrgXORG_SGML_PATH=
1521b3078addSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1522b3078addSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1523b3078addSmrg    [m4_ifval([$1],[:],
1524b3078addSmrg        [if test x"$cross_compiling" != x"yes" ; then
1525b3078addSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1526b3078addSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1527b3078addSmrg         fi])
1528b3078addSmrg    ])
1529b3078addSmrg
1530b3078addSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1531b3078addSmrg# the path and the name of the doc stylesheet
1532b3078addSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1533b3078addSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1534b3078addSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1535b3078addSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1536b3078addSmrgelse
1537b3078addSmrg   AC_MSG_RESULT([no])
1538b3078addSmrgfi
1539b3078addSmrg
1540b3078addSmrgAC_SUBST(XORG_SGML_PATH)
1541b3078addSmrgAC_SUBST(STYLESHEET_SRCDIR)
1542b3078addSmrgAC_SUBST(XSL_STYLESHEET)
1543b3078addSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1544b3078addSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1545b3078addSmrg
15465c10afb9Smrg# XORG_CHECK_LINUXDOC
15475c10afb9Smrg# -------------------
1548b3078addSmrg# Minimum version: 1.0.0
1549b3078addSmrg#
15505c10afb9Smrg# Defines the variable MAKE_TEXT if the necessary tools and
15515c10afb9Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
15525c10afb9Smrg# Whether or not the necessary tools and files are found can be checked
15535c10afb9Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
15545c10afb9SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1555b3078addSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1556b3078addSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
15575c10afb9Smrg
15585c10afb9SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
15595c10afb9Smrg
1560b3078addSmrgAC_MSG_CHECKING([whether to build documentation])
15615c10afb9Smrg
1562b3078addSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
15635c10afb9Smrg   BUILDDOC=yes
15645c10afb9Smrgelse
15655c10afb9Smrg   BUILDDOC=no
15665c10afb9Smrgfi
15675c10afb9Smrg
15685c10afb9SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
15695c10afb9Smrg
15705c10afb9SmrgAC_MSG_RESULT([$BUILDDOC])
15715c10afb9Smrg
1572b3078addSmrgAC_MSG_CHECKING([whether to build pdf documentation])
15735c10afb9Smrg
1574b3078addSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
15755c10afb9Smrg   BUILDPDFDOC=yes
15765c10afb9Smrgelse
15775c10afb9Smrg   BUILDPDFDOC=no
15785c10afb9Smrgfi
15795c10afb9Smrg
15805c10afb9SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
15815c10afb9Smrg
15825c10afb9SmrgAC_MSG_RESULT([$BUILDPDFDOC])
15835c10afb9Smrg
1584b3078addSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1585b3078addSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
15865c10afb9SmrgMAKE_PDF="$PS2PDF"
1587b3078addSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
15885c10afb9Smrg
15895c10afb9SmrgAC_SUBST(MAKE_TEXT)
15905c10afb9SmrgAC_SUBST(MAKE_PS)
15915c10afb9SmrgAC_SUBST(MAKE_PDF)
15925c10afb9SmrgAC_SUBST(MAKE_HTML)
15935c10afb9Smrg]) # XORG_CHECK_LINUXDOC
15945c10afb9Smrg
1595b3078addSmrg# XORG_CHECK_DOCBOOK
1596b3078addSmrg# -------------------
1597b3078addSmrg# Minimum version: 1.0.0
1598b3078addSmrg#
1599b3078addSmrg# Checks for the ability to build output formats from SGML DocBook source.
1600b3078addSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1601b3078addSmrg# indicates whether the necessary tools and files are found and, if set,
1602b3078addSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1603b3078addSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1604b3078addSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1605b3078addSmrg
1606b3078addSmrgBUILDTXTDOC=no
1607b3078addSmrgBUILDPDFDOC=no
1608b3078addSmrgBUILDPSDOC=no
1609b3078addSmrgBUILDHTMLDOC=no
1610b3078addSmrg
1611b3078addSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1612b3078addSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1613b3078addSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1614b3078addSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1615b3078addSmrg
1616b3078addSmrgAC_MSG_CHECKING([whether to build text documentation])
1617b3078addSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1618b3078addSmrg   test x$BUILD_TXTDOC != xno; then
1619b3078addSmrg	BUILDTXTDOC=yes
1620b3078addSmrgfi
1621b3078addSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1622b3078addSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1623b3078addSmrg
1624b3078addSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1625b3078addSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1626b3078addSmrg   test x$BUILD_PDFDOC != xno; then
1627b3078addSmrg	BUILDPDFDOC=yes
1628b3078addSmrgfi
1629b3078addSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1630b3078addSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1631b3078addSmrg
1632b3078addSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1633b3078addSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1634b3078addSmrg   test x$BUILD_PSDOC != xno; then
1635b3078addSmrg	BUILDPSDOC=yes
1636b3078addSmrgfi
1637b3078addSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1638b3078addSmrgAC_MSG_RESULT([$BUILDPSDOC])
1639b3078addSmrg
1640b3078addSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1641b3078addSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1642b3078addSmrg   test x$BUILD_HTMLDOC != xno; then
1643b3078addSmrg	BUILDHTMLDOC=yes
1644b3078addSmrgfi
1645b3078addSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1646b3078addSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1647b3078addSmrg
1648b3078addSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1649b3078addSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1650b3078addSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1651b3078addSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1652b3078addSmrg
1653b3078addSmrgAC_SUBST(MAKE_TEXT)
1654b3078addSmrgAC_SUBST(MAKE_PS)
1655b3078addSmrgAC_SUBST(MAKE_PDF)
1656b3078addSmrgAC_SUBST(MAKE_HTML)
1657b3078addSmrg]) # XORG_CHECK_DOCBOOK
1658b3078addSmrg
1659b3078addSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1660b3078addSmrg# ----------------
1661b3078addSmrg# Minimum version: 1.5.0
1662b3078addSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1663b3078addSmrg#
1664b3078addSmrg# Documentation tools are not always available on all platforms and sometimes
1665b3078addSmrg# not at the appropriate level. This macro enables a module to test for the
1666b3078addSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1667b3078addSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1668b3078addSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1669b3078addSmrg# --with-xmlto assumes 'auto'.
1670b3078addSmrg#
1671b3078addSmrg# Interface to module:
1672b3078addSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1673b3078addSmrg# XMLTO:	returns the path of the xmlto program found
1674b3078addSmrg#		returns the path set by the user in the environment
1675b3078addSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1676b3078addSmrg#		'no' user instructs the module not to use xmlto
1677b3078addSmrg#
1678b3078addSmrg# Added in version 1.10.0
1679b3078addSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1680b3078addSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1681b3078addSmrg#
1682b3078addSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1683b3078addSmrg#
1684b3078addSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1685b3078addSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1686b3078addSmrgm4_define([_defopt], m4_default([$2], [auto]))
1687b3078addSmrgAC_ARG_WITH(xmlto,
1688b3078addSmrg	AS_HELP_STRING([--with-xmlto],
1689b3078addSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1690b3078addSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1691b3078addSmrgm4_undefine([_defopt])
1692b3078addSmrg
1693b3078addSmrgif test "x$use_xmlto" = x"auto"; then
1694b3078addSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1695b3078addSmrg   if test "x$XMLTO" = "x"; then
1696b3078addSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1697b3078addSmrg	have_xmlto=no
1698b3078addSmrg   else
1699b3078addSmrg        have_xmlto=yes
1700b3078addSmrg   fi
1701b3078addSmrgelif test "x$use_xmlto" = x"yes" ; then
1702b3078addSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1703b3078addSmrg   if test "x$XMLTO" = "x"; then
1704b3078addSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1705b3078addSmrg   fi
1706b3078addSmrg   have_xmlto=yes
1707b3078addSmrgelif test "x$use_xmlto" = x"no" ; then
1708b3078addSmrg   if test "x$XMLTO" != "x"; then
1709b3078addSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1710b3078addSmrg   fi
1711b3078addSmrg   have_xmlto=no
1712b3078addSmrgelse
1713b3078addSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1714b3078addSmrgfi
1715b3078addSmrg
1716b3078addSmrg# Test for a minimum version of xmlto, if provided.
1717b3078addSmrgm4_ifval([$1],
1718b3078addSmrg[if test "$have_xmlto" = yes; then
1719b3078addSmrg    # scrape the xmlto version
1720b3078addSmrg    AC_MSG_CHECKING([the xmlto version])
1721b3078addSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1722b3078addSmrg    AC_MSG_RESULT([$xmlto_version])
1723b3078addSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1724b3078addSmrg        [if test "x$use_xmlto" = xauto; then
1725b3078addSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1726b3078addSmrg            have_xmlto=no
1727b3078addSmrg        else
1728b3078addSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1729b3078addSmrg        fi])
1730b3078addSmrgfi])
1731b3078addSmrg
1732b3078addSmrg# Test for the ability of xmlto to generate a text target
1733b3078addSmrghave_xmlto_text=no
1734b3078addSmrgcat > conftest.xml << "EOF"
1735b3078addSmrgEOF
1736b3078addSmrgAS_IF([test "$have_xmlto" = yes],
1737b3078addSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1738b3078addSmrg             [have_xmlto_text=yes],
1739b3078addSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1740b3078addSmrgrm -f conftest.xml
1741b3078addSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1742b3078addSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1743b3078addSmrg]) # XORG_WITH_XMLTO
1744b3078addSmrg
1745cf2f63c2Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1746cf2f63c2Smrg# --------------------------------------------
1747cf2f63c2Smrg# Minimum version: 1.12.0
1748cf2f63c2Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1749cf2f63c2Smrg#
1750cf2f63c2Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1751cf2f63c2Smrg# XML-based language used for the transformation of XML documents.
1752cf2f63c2Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1753cf2f63c2Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1754cf2f63c2Smrg# The XSLT processor is often used as a standalone tool for transformations.
1755cf2f63c2Smrg# It should not be assumed that this tool is used only to work with documnetation.
1756cf2f63c2Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1757cf2f63c2Smrg#
1758cf2f63c2Smrg# Interface to module:
1759cf2f63c2Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1760cf2f63c2Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1761cf2f63c2Smrg#		 returns the path set by the user in the environment
1762cf2f63c2Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1763cf2f63c2Smrg#		  'no' user instructs the module not to use xsltproc
1764cf2f63c2Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1765cf2f63c2Smrg#
1766cf2f63c2Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1767cf2f63c2Smrg#
1768cf2f63c2SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1769cf2f63c2SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1770cf2f63c2Smrg# Preserves the interface, should it be implemented later
1771cf2f63c2Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1772cf2f63c2Smrgm4_define([_defopt], m4_default([$2], [auto]))
1773cf2f63c2SmrgAC_ARG_WITH(xsltproc,
1774cf2f63c2Smrg	AS_HELP_STRING([--with-xsltproc],
1775cf2f63c2Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1776cf2f63c2Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1777cf2f63c2Smrgm4_undefine([_defopt])
1778cf2f63c2Smrg
1779cf2f63c2Smrgif test "x$use_xsltproc" = x"auto"; then
1780cf2f63c2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1781cf2f63c2Smrg   if test "x$XSLTPROC" = "x"; then
1782cf2f63c2Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1783cf2f63c2Smrg	have_xsltproc=no
1784cf2f63c2Smrg   else
1785cf2f63c2Smrg        have_xsltproc=yes
1786cf2f63c2Smrg   fi
1787cf2f63c2Smrgelif test "x$use_xsltproc" = x"yes" ; then
1788cf2f63c2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1789cf2f63c2Smrg   if test "x$XSLTPROC" = "x"; then
1790cf2f63c2Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1791cf2f63c2Smrg   fi
1792cf2f63c2Smrg   have_xsltproc=yes
1793cf2f63c2Smrgelif test "x$use_xsltproc" = x"no" ; then
1794cf2f63c2Smrg   if test "x$XSLTPROC" != "x"; then
1795cf2f63c2Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1796cf2f63c2Smrg   fi
1797cf2f63c2Smrg   have_xsltproc=no
1798cf2f63c2Smrgelse
1799cf2f63c2Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1800cf2f63c2Smrgfi
1801cf2f63c2Smrg
1802cf2f63c2SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1803cf2f63c2Smrg]) # XORG_WITH_XSLTPROC
1804cf2f63c2Smrg
1805cf2f63c2Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1806cf2f63c2Smrg# ----------------------------------------
1807cf2f63c2Smrg# Minimum version: 1.15.0
1808cf2f63c2Smrg#
1809cf2f63c2Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1810cf2f63c2Smrg# scanning arbitrary text files, extracting information from those text files,
1811cf2f63c2Smrg# and printing reports based on that information.
1812cf2f63c2Smrg#
1813cf2f63c2Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1814cf2f63c2Smrg#
1815cf2f63c2Smrg# Interface to module:
1816cf2f63c2Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1817cf2f63c2Smrg# PERL:	     returns the path of the perl program found
1818cf2f63c2Smrg#	     returns the path set by the user in the environment
1819cf2f63c2Smrg# --with-perl: 'yes' user instructs the module to use perl
1820cf2f63c2Smrg#	       'no' user instructs the module not to use perl
1821cf2f63c2Smrg# have_perl: returns yes if perl found in PATH or no
1822cf2f63c2Smrg#
1823cf2f63c2Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1824cf2f63c2Smrg#
1825cf2f63c2SmrgAC_DEFUN([XORG_WITH_PERL],[
1826cf2f63c2SmrgAC_ARG_VAR([PERL], [Path to perl command])
1827cf2f63c2Smrg# Preserves the interface, should it be implemented later
1828cf2f63c2Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1829cf2f63c2Smrgm4_define([_defopt], m4_default([$2], [auto]))
1830cf2f63c2SmrgAC_ARG_WITH(perl,
1831cf2f63c2Smrg	AS_HELP_STRING([--with-perl],
1832cf2f63c2Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1833cf2f63c2Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1834cf2f63c2Smrgm4_undefine([_defopt])
1835cf2f63c2Smrg
1836cf2f63c2Smrgif test "x$use_perl" = x"auto"; then
1837cf2f63c2Smrg   AC_PATH_PROG([PERL], [perl])
1838cf2f63c2Smrg   if test "x$PERL" = "x"; then
1839cf2f63c2Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1840cf2f63c2Smrg	have_perl=no
1841cf2f63c2Smrg   else
1842cf2f63c2Smrg        have_perl=yes
1843cf2f63c2Smrg   fi
1844cf2f63c2Smrgelif test "x$use_perl" = x"yes" ; then
1845cf2f63c2Smrg   AC_PATH_PROG([PERL], [perl])
1846cf2f63c2Smrg   if test "x$PERL" = "x"; then
1847cf2f63c2Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1848cf2f63c2Smrg   fi
1849cf2f63c2Smrg   have_perl=yes
1850cf2f63c2Smrgelif test "x$use_perl" = x"no" ; then
1851cf2f63c2Smrg   if test "x$PERL" != "x"; then
1852cf2f63c2Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1853cf2f63c2Smrg   fi
1854cf2f63c2Smrg   have_perl=no
1855cf2f63c2Smrgelse
1856cf2f63c2Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1857cf2f63c2Smrgfi
1858cf2f63c2Smrg
1859cf2f63c2SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1860cf2f63c2Smrg]) # XORG_WITH_PERL
1861cf2f63c2Smrg
1862b3078addSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1863b3078addSmrg# ----------------
1864b3078addSmrg# Minimum version: 1.5.0
1865b3078addSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1866b3078addSmrg#
1867b3078addSmrg# Documentation tools are not always available on all platforms and sometimes
1868b3078addSmrg# not at the appropriate level. This macro enables a module to test for the
1869b3078addSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1870b3078addSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1871b3078addSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1872b3078addSmrg# --with-asciidoc assumes 'auto'.
1873b3078addSmrg#
1874b3078addSmrg# Interface to module:
1875b3078addSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1876b3078addSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1877b3078addSmrg#		 returns the path set by the user in the environment
1878b3078addSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1879b3078addSmrg#		  'no' user instructs the module not to use asciidoc
1880b3078addSmrg#
1881b3078addSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1882b3078addSmrg#
1883b3078addSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1884b3078addSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1885b3078addSmrgm4_define([_defopt], m4_default([$2], [auto]))
1886b3078addSmrgAC_ARG_WITH(asciidoc,
1887b3078addSmrg	AS_HELP_STRING([--with-asciidoc],
1888b3078addSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1889b3078addSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1890b3078addSmrgm4_undefine([_defopt])
1891b3078addSmrg
1892b3078addSmrgif test "x$use_asciidoc" = x"auto"; then
1893b3078addSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1894b3078addSmrg   if test "x$ASCIIDOC" = "x"; then
1895b3078addSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1896b3078addSmrg	have_asciidoc=no
1897b3078addSmrg   else
1898b3078addSmrg        have_asciidoc=yes
1899b3078addSmrg   fi
1900b3078addSmrgelif test "x$use_asciidoc" = x"yes" ; then
1901b3078addSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1902b3078addSmrg   if test "x$ASCIIDOC" = "x"; then
1903b3078addSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1904b3078addSmrg   fi
1905b3078addSmrg   have_asciidoc=yes
1906b3078addSmrgelif test "x$use_asciidoc" = x"no" ; then
1907b3078addSmrg   if test "x$ASCIIDOC" != "x"; then
1908b3078addSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1909b3078addSmrg   fi
1910b3078addSmrg   have_asciidoc=no
1911b3078addSmrgelse
1912b3078addSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1913b3078addSmrgfi
1914b3078addSmrgm4_ifval([$1],
1915b3078addSmrg[if test "$have_asciidoc" = yes; then
1916b3078addSmrg    # scrape the asciidoc version
1917b3078addSmrg    AC_MSG_CHECKING([the asciidoc version])
1918b3078addSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1919b3078addSmrg    AC_MSG_RESULT([$asciidoc_version])
1920b3078addSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1921b3078addSmrg        [if test "x$use_asciidoc" = xauto; then
1922b3078addSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1923b3078addSmrg            have_asciidoc=no
1924b3078addSmrg        else
1925b3078addSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1926b3078addSmrg        fi])
1927b3078addSmrgfi])
1928b3078addSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1929b3078addSmrg]) # XORG_WITH_ASCIIDOC
1930b3078addSmrg
1931b3078addSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1932cf2f63c2Smrg# -------------------------------------------
1933b3078addSmrg# Minimum version: 1.5.0
1934b3078addSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1935cf2f63c2Smrg# Minimum version for optional DOT checking: 1.18.0
1936b3078addSmrg#
1937b3078addSmrg# Documentation tools are not always available on all platforms and sometimes
1938b3078addSmrg# not at the appropriate level. This macro enables a module to test for the
1939b3078addSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1940b3078addSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1941b3078addSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1942b3078addSmrg# --with-doxygen assumes 'auto'.
1943b3078addSmrg#
1944b3078addSmrg# Interface to module:
1945b3078addSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1946b3078addSmrg# DOXYGEN:	 returns the path of the doxygen program found
1947b3078addSmrg#		 returns the path set by the user in the environment
1948b3078addSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1949b3078addSmrg#		  'no' user instructs the module not to use doxygen
1950b3078addSmrg#
1951b3078addSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1952b3078addSmrg#
1953b3078addSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1954b3078addSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1955cf2f63c2SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
1956b3078addSmrgm4_define([_defopt], m4_default([$2], [auto]))
1957b3078addSmrgAC_ARG_WITH(doxygen,
1958b3078addSmrg	AS_HELP_STRING([--with-doxygen],
1959b3078addSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1960b3078addSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1961b3078addSmrgm4_undefine([_defopt])
1962b3078addSmrg
1963b3078addSmrgif test "x$use_doxygen" = x"auto"; then
1964b3078addSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1965b3078addSmrg   if test "x$DOXYGEN" = "x"; then
1966b3078addSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1967b3078addSmrg	have_doxygen=no
1968b3078addSmrg   else
1969b3078addSmrg        have_doxygen=yes
1970b3078addSmrg   fi
1971b3078addSmrgelif test "x$use_doxygen" = x"yes" ; then
1972b3078addSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1973b3078addSmrg   if test "x$DOXYGEN" = "x"; then
1974b3078addSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1975b3078addSmrg   fi
1976b3078addSmrg   have_doxygen=yes
1977b3078addSmrgelif test "x$use_doxygen" = x"no" ; then
1978b3078addSmrg   if test "x$DOXYGEN" != "x"; then
1979b3078addSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1980b3078addSmrg   fi
1981b3078addSmrg   have_doxygen=no
1982b3078addSmrgelse
1983b3078addSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1984b3078addSmrgfi
1985b3078addSmrgm4_ifval([$1],
1986b3078addSmrg[if test "$have_doxygen" = yes; then
1987b3078addSmrg    # scrape the doxygen version
1988b3078addSmrg    AC_MSG_CHECKING([the doxygen version])
1989b3078addSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1990b3078addSmrg    AC_MSG_RESULT([$doxygen_version])
1991b3078addSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1992b3078addSmrg        [if test "x$use_doxygen" = xauto; then
1993b3078addSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1994b3078addSmrg            have_doxygen=no
1995b3078addSmrg        else
1996b3078addSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1997b3078addSmrg        fi])
1998b3078addSmrgfi])
1999cf2f63c2Smrg
2000cf2f63c2Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2001cf2f63c2Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2002cf2f63c2Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2003cf2f63c2SmrgHAVE_DOT=no
2004cf2f63c2Smrgif test "x$have_doxygen" = "xyes"; then
2005cf2f63c2Smrg  AC_PATH_PROG([DOT], [dot])
2006cf2f63c2Smrg    if test "x$DOT" != "x"; then
2007cf2f63c2Smrg      HAVE_DOT=yes
2008cf2f63c2Smrg    fi
2009cf2f63c2Smrgfi
2010cf2f63c2Smrg
2011cf2f63c2SmrgAC_SUBST([HAVE_DOT])
2012cf2f63c2SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2013b3078addSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2014b3078addSmrg]) # XORG_WITH_DOXYGEN
2015b3078addSmrg
2016b3078addSmrg# XORG_WITH_GROFF([DEFAULT])
2017b3078addSmrg# ----------------
2018b3078addSmrg# Minimum version: 1.6.0
2019b3078addSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2020b3078addSmrg#
2021b3078addSmrg# Documentation tools are not always available on all platforms and sometimes
2022b3078addSmrg# not at the appropriate level. This macro enables a module to test for the
2023b3078addSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2024b3078addSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2025b3078addSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2026b3078addSmrg# --with-groff assumes 'auto'.
2027b3078addSmrg#
2028b3078addSmrg# Interface to module:
2029b3078addSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2030b3078addSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2031b3078addSmrg# HAVE_GROFF_MS: the -ms macros package
2032b3078addSmrg# GROFF:	 returns the path of the groff program found
2033b3078addSmrg#		 returns the path set by the user in the environment
2034b3078addSmrg# --with-groff:	 'yes' user instructs the module to use groff
2035b3078addSmrg#		 'no' user instructs the module not to use groff
2036b3078addSmrg#
2037b3078addSmrg# Added in version 1.9.0:
2038b3078addSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2039b3078addSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2040b3078addSmrg#		   psselect from the psutils package.
2041b3078addSmrg#		   the ghostcript package. Refer to the grohtml man pages
2042b3078addSmrg#
2043b3078addSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2044b3078addSmrg#
2045b3078addSmrg# OS and distros often splits groff in a basic and full package, the former
2046b3078addSmrg# having the groff program and the later having devices, fonts and macros
2047b3078addSmrg# Checking for the groff executable is not enough.
2048b3078addSmrg#
2049b3078addSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2050b3078addSmrg# unset HAVE_GROFF or GROFF env variables.
2051b3078addSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2052b3078addSmrg#
2053b3078addSmrgAC_DEFUN([XORG_WITH_GROFF],[
2054b3078addSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2055b3078addSmrgm4_define([_defopt], m4_default([$1], [auto]))
2056b3078addSmrgAC_ARG_WITH(groff,
2057b3078addSmrg	AS_HELP_STRING([--with-groff],
2058b3078addSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2059b3078addSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2060b3078addSmrgm4_undefine([_defopt])
2061b3078addSmrg
2062b3078addSmrgif test "x$use_groff" = x"auto"; then
2063b3078addSmrg   AC_PATH_PROG([GROFF], [groff])
2064b3078addSmrg   if test "x$GROFF" = "x"; then
2065b3078addSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2066b3078addSmrg	have_groff=no
2067b3078addSmrg   else
2068b3078addSmrg        have_groff=yes
2069b3078addSmrg   fi
2070b3078addSmrgelif test "x$use_groff" = x"yes" ; then
2071b3078addSmrg   AC_PATH_PROG([GROFF], [groff])
2072b3078addSmrg   if test "x$GROFF" = "x"; then
2073b3078addSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2074b3078addSmrg   fi
2075b3078addSmrg   have_groff=yes
2076b3078addSmrgelif test "x$use_groff" = x"no" ; then
2077b3078addSmrg   if test "x$GROFF" != "x"; then
2078b3078addSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2079b3078addSmrg   fi
2080b3078addSmrg   have_groff=no
2081b3078addSmrgelse
2082b3078addSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2083b3078addSmrgfi
2084b3078addSmrg
2085b3078addSmrg# We have groff, test for the presence of the macro packages
2086b3078addSmrgif test "x$have_groff" = x"yes"; then
2087b3078addSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2088b3078addSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2089b3078addSmrg        groff_ms_works=yes
2090b3078addSmrg    else
2091b3078addSmrg        groff_ms_works=no
2092b3078addSmrg    fi
2093b3078addSmrg    AC_MSG_RESULT([$groff_ms_works])
2094b3078addSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2095b3078addSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2096b3078addSmrg        groff_mm_works=yes
2097b3078addSmrg    else
2098b3078addSmrg        groff_mm_works=no
2099b3078addSmrg    fi
2100b3078addSmrg    AC_MSG_RESULT([$groff_mm_works])
2101b3078addSmrgfi
2102b3078addSmrg
2103b3078addSmrg# We have groff, test for HTML dependencies, one command per package
2104b3078addSmrgif test "x$have_groff" = x"yes"; then
2105b3078addSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2106b3078addSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2107b3078addSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2108b3078addSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2109b3078addSmrg      have_groff_html=yes
2110b3078addSmrg   else
2111b3078addSmrg      have_groff_html=no
2112b3078addSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2113b3078addSmrg   fi
2114b3078addSmrgfi
2115b3078addSmrg
2116b3078addSmrg# Set Automake conditionals for Makefiles
2117b3078addSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2118b3078addSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2119b3078addSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2120b3078addSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2121b3078addSmrg]) # XORG_WITH_GROFF
2122b3078addSmrg
2123cf2f63c2Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2124cf2f63c2Smrg# ---------------------------------------
2125b3078addSmrg# Minimum version: 1.6.0
2126b3078addSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2127cf2f63c2Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2128b3078addSmrg#
2129b3078addSmrg# Documentation tools are not always available on all platforms and sometimes
2130b3078addSmrg# not at the appropriate level. This macro enables a module to test for the
2131b3078addSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2132b3078addSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2133b3078addSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2134b3078addSmrg# --with-fop assumes 'auto'.
2135b3078addSmrg#
2136b3078addSmrg# Interface to module:
2137b3078addSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2138b3078addSmrg# FOP:	 	returns the path of the fop program found
2139b3078addSmrg#		returns the path set by the user in the environment
2140b3078addSmrg# --with-fop: 	'yes' user instructs the module to use fop
2141b3078addSmrg#		'no' user instructs the module not to use fop
2142b3078addSmrg#
2143b3078addSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2144b3078addSmrg#
2145b3078addSmrgAC_DEFUN([XORG_WITH_FOP],[
2146b3078addSmrgAC_ARG_VAR([FOP], [Path to fop command])
2147cf2f63c2Smrgm4_define([_defopt], m4_default([$2], [auto]))
2148b3078addSmrgAC_ARG_WITH(fop,
2149b3078addSmrg	AS_HELP_STRING([--with-fop],
2150b3078addSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2151b3078addSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2152b3078addSmrgm4_undefine([_defopt])
2153b3078addSmrg
2154b3078addSmrgif test "x$use_fop" = x"auto"; then
2155b3078addSmrg   AC_PATH_PROG([FOP], [fop])
2156b3078addSmrg   if test "x$FOP" = "x"; then
2157b3078addSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2158b3078addSmrg	have_fop=no
2159b3078addSmrg   else
2160b3078addSmrg        have_fop=yes
2161b3078addSmrg   fi
2162b3078addSmrgelif test "x$use_fop" = x"yes" ; then
2163b3078addSmrg   AC_PATH_PROG([FOP], [fop])
2164b3078addSmrg   if test "x$FOP" = "x"; then
2165b3078addSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2166b3078addSmrg   fi
2167b3078addSmrg   have_fop=yes
2168b3078addSmrgelif test "x$use_fop" = x"no" ; then
2169b3078addSmrg   if test "x$FOP" != "x"; then
2170b3078addSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2171b3078addSmrg   fi
2172b3078addSmrg   have_fop=no
2173b3078addSmrgelse
2174b3078addSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2175b3078addSmrgfi
2176cf2f63c2Smrg
2177cf2f63c2Smrg# Test for a minimum version of fop, if provided.
2178cf2f63c2Smrgm4_ifval([$1],
2179cf2f63c2Smrg[if test "$have_fop" = yes; then
2180cf2f63c2Smrg    # scrape the fop version
2181cf2f63c2Smrg    AC_MSG_CHECKING([for fop minimum version])
2182cf2f63c2Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2183cf2f63c2Smrg    AC_MSG_RESULT([$fop_version])
2184cf2f63c2Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2185cf2f63c2Smrg        [if test "x$use_fop" = xauto; then
2186cf2f63c2Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2187cf2f63c2Smrg            have_fop=no
2188cf2f63c2Smrg        else
2189cf2f63c2Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2190cf2f63c2Smrg        fi])
2191cf2f63c2Smrgfi])
2192b3078addSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2193b3078addSmrg]) # XORG_WITH_FOP
2194b3078addSmrg
2195cf2f63c2Smrg# XORG_WITH_M4([MIN-VERSION])
2196cf2f63c2Smrg# ---------------------------
2197cf2f63c2Smrg# Minimum version: 1.19.0
2198cf2f63c2Smrg#
2199cf2f63c2Smrg# This macro attempts to locate an m4 macro processor which supports
2200cf2f63c2Smrg# -I option and is only useful for modules relying on M4 in order to
2201cf2f63c2Smrg# expand macros in source code files.
2202cf2f63c2Smrg#
2203cf2f63c2Smrg# Interface to module:
2204cf2f63c2Smrg# M4:	 	returns the path of the m4 program found
2205cf2f63c2Smrg#		returns the path set by the user in the environment
2206cf2f63c2Smrg#
2207cf2f63c2SmrgAC_DEFUN([XORG_WITH_M4], [
2208cf2f63c2SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2209cf2f63c2Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2210cf2f63c2Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2211cf2f63c2Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2212cf2f63c2Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2213cf2f63c2Smrg   [$PATH:/usr/gnu/bin])])
2214cf2f63c2Smrg
2215cf2f63c2SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2216cf2f63c2Smrg]) # XORG_WITH_M4
2217cf2f63c2Smrg
2218b3078addSmrg# XORG_WITH_PS2PDF([DEFAULT])
2219b3078addSmrg# ----------------
2220b3078addSmrg# Minimum version: 1.6.0
2221b3078addSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2222b3078addSmrg#
2223b3078addSmrg# Documentation tools are not always available on all platforms and sometimes
2224b3078addSmrg# not at the appropriate level. This macro enables a module to test for the
2225b3078addSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2226b3078addSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2227b3078addSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2228b3078addSmrg# --with-ps2pdf assumes 'auto'.
2229b3078addSmrg#
2230b3078addSmrg# Interface to module:
2231b3078addSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2232b3078addSmrg# PS2PDF:	returns the path of the ps2pdf program found
2233b3078addSmrg#		returns the path set by the user in the environment
2234b3078addSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2235b3078addSmrg#		 'no' user instructs the module not to use ps2pdf
2236b3078addSmrg#
2237b3078addSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2238b3078addSmrg#
2239b3078addSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2240b3078addSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2241b3078addSmrgm4_define([_defopt], m4_default([$1], [auto]))
2242b3078addSmrgAC_ARG_WITH(ps2pdf,
2243b3078addSmrg	AS_HELP_STRING([--with-ps2pdf],
2244b3078addSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2245b3078addSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2246b3078addSmrgm4_undefine([_defopt])
2247b3078addSmrg
2248b3078addSmrgif test "x$use_ps2pdf" = x"auto"; then
2249b3078addSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2250b3078addSmrg   if test "x$PS2PDF" = "x"; then
2251b3078addSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2252b3078addSmrg	have_ps2pdf=no
2253b3078addSmrg   else
2254b3078addSmrg        have_ps2pdf=yes
2255b3078addSmrg   fi
2256b3078addSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2257b3078addSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2258b3078addSmrg   if test "x$PS2PDF" = "x"; then
2259b3078addSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2260b3078addSmrg   fi
2261b3078addSmrg   have_ps2pdf=yes
2262b3078addSmrgelif test "x$use_ps2pdf" = x"no" ; then
2263b3078addSmrg   if test "x$PS2PDF" != "x"; then
2264b3078addSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2265b3078addSmrg   fi
2266b3078addSmrg   have_ps2pdf=no
2267b3078addSmrgelse
2268b3078addSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2269b3078addSmrgfi
2270b3078addSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2271b3078addSmrg]) # XORG_WITH_PS2PDF
2272b3078addSmrg
2273b3078addSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2274b3078addSmrg# ----------------
2275b3078addSmrg# Minimum version: 1.6.0
2276b3078addSmrg#
2277b3078addSmrg# Documentation tools are not always available on all platforms and sometimes
2278b3078addSmrg# not at the appropriate level. This macro enables a builder to skip all
2279b3078addSmrg# documentation targets except traditional man pages.
2280b3078addSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2281b3078addSmrg# maximum flexibilty in controlling documentation building.
2282b3078addSmrg# Refer to:
2283b3078addSmrg# XORG_WITH_XMLTO         --with-xmlto
2284b3078addSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2285b3078addSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2286b3078addSmrg# XORG_WITH_FOP           --with-fop
2287b3078addSmrg# XORG_WITH_GROFF         --with-groff
2288b3078addSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2289b3078addSmrg#
2290b3078addSmrg# Interface to module:
2291b3078addSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2292b3078addSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2293b3078addSmrg#		 'no' user instructs the module not to generate docs
2294b3078addSmrg# parm1:	specify the default value, yes or no.
2295b3078addSmrg#
2296b3078addSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2297cf2f63c2Smrgm4_define([docs_default], m4_default([$1], [yes]))
2298b3078addSmrgAC_ARG_ENABLE(docs,
2299b3078addSmrg	AS_HELP_STRING([--enable-docs],
2300cf2f63c2Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2301cf2f63c2Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2302cf2f63c2Smrgm4_undefine([docs_default])
2303b3078addSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2304b3078addSmrgAC_MSG_CHECKING([whether to build documentation])
2305b3078addSmrgAC_MSG_RESULT([$build_docs])
2306b3078addSmrg]) # XORG_ENABLE_DOCS
2307b3078addSmrg
2308b3078addSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2309b3078addSmrg# ----------------
2310b3078addSmrg# Minimum version: 1.6.0
2311b3078addSmrg#
2312b3078addSmrg# This macro enables a builder to skip all developer documentation.
2313b3078addSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2314b3078addSmrg# maximum flexibilty in controlling documentation building.
2315b3078addSmrg# Refer to:
2316b3078addSmrg# XORG_WITH_XMLTO         --with-xmlto
2317b3078addSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2318b3078addSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2319b3078addSmrg# XORG_WITH_FOP           --with-fop
2320b3078addSmrg# XORG_WITH_GROFF         --with-groff
2321b3078addSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2322b3078addSmrg#
2323b3078addSmrg# Interface to module:
2324b3078addSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2325b3078addSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2326b3078addSmrg#			'no' user instructs the module not to generate developer docs
2327b3078addSmrg# parm1:		specify the default value, yes or no.
2328b3078addSmrg#
2329b3078addSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2330b3078addSmrgm4_define([devel_default], m4_default([$1], [yes]))
2331b3078addSmrgAC_ARG_ENABLE(devel-docs,
2332b3078addSmrg	AS_HELP_STRING([--enable-devel-docs],
2333b3078addSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2334b3078addSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2335b3078addSmrgm4_undefine([devel_default])
2336b3078addSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2337b3078addSmrgAC_MSG_CHECKING([whether to build developer documentation])
2338b3078addSmrgAC_MSG_RESULT([$build_devel_docs])
2339b3078addSmrg]) # XORG_ENABLE_DEVEL_DOCS
2340b3078addSmrg
2341cf2f63c2Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2342cf2f63c2Smrg# ----------------
2343cf2f63c2Smrg# Minimum version: 1.6.0
2344cf2f63c2Smrg#
2345cf2f63c2Smrg# This macro enables a builder to skip all functional specification targets.
2346cf2f63c2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2347cf2f63c2Smrg# maximum flexibilty in controlling documentation building.
2348cf2f63c2Smrg# Refer to:
2349cf2f63c2Smrg# XORG_WITH_XMLTO         --with-xmlto
2350cf2f63c2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2351cf2f63c2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2352cf2f63c2Smrg# XORG_WITH_FOP           --with-fop
2353cf2f63c2Smrg# XORG_WITH_GROFF         --with-groff
2354cf2f63c2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2355cf2f63c2Smrg#
2356cf2f63c2Smrg# Interface to module:
2357cf2f63c2Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2358cf2f63c2Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2359cf2f63c2Smrg#			'no' user instructs the module not to generate specs
2360cf2f63c2Smrg# parm1:		specify the default value, yes or no.
2361cf2f63c2Smrg#
2362cf2f63c2SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2363cf2f63c2Smrgm4_define([spec_default], m4_default([$1], [yes]))
2364cf2f63c2SmrgAC_ARG_ENABLE(specs,
2365cf2f63c2Smrg	AS_HELP_STRING([--enable-specs],
2366cf2f63c2Smrg	   [Enable building the specs (default: ]spec_default[)]),
2367cf2f63c2Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2368cf2f63c2Smrgm4_undefine([spec_default])
2369cf2f63c2SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2370cf2f63c2SmrgAC_MSG_CHECKING([whether to build functional specifications])
2371cf2f63c2SmrgAC_MSG_RESULT([$build_specs])
2372cf2f63c2Smrg]) # XORG_ENABLE_SPECS
2373cf2f63c2Smrg
2374cf2f63c2Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2375cf2f63c2Smrg# ----------------------------------------------
2376cf2f63c2Smrg# Minimum version: 1.13.0
2377cf2f63c2Smrg#
2378cf2f63c2Smrg# This macro enables a builder to enable/disable unit testing
2379cf2f63c2Smrg# It makes no assumption about the test cases implementation
2380cf2f63c2Smrg# Test cases may or may not use Automake "Support for test suites"
2381cf2f63c2Smrg# They may or may not use the software utility library GLib
2382cf2f63c2Smrg#
2383cf2f63c2Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2384cf2f63c2Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2385cf2f63c2Smrg# The variable enable_unit_tests is used by other macros in this file.
2386cf2f63c2Smrg#
2387cf2f63c2Smrg# Interface to module:
2388cf2f63c2Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2389cf2f63c2Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2390cf2f63c2Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2391cf2f63c2Smrg#			'no' user instructs the module not to build tests
2392cf2f63c2Smrg# parm1:		specify the default value, yes or no.
2393cf2f63c2Smrg#
2394cf2f63c2SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2395cf2f63c2SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2396cf2f63c2SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2397cf2f63c2SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2398cf2f63c2Smrgm4_define([_defopt], m4_default([$1], [auto]))
2399cf2f63c2SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2400cf2f63c2Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2401cf2f63c2Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2402cf2f63c2Smrgm4_undefine([_defopt])
2403cf2f63c2SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2404cf2f63c2SmrgAC_MSG_CHECKING([whether to build unit test cases])
2405cf2f63c2SmrgAC_MSG_RESULT([$enable_unit_tests])
2406cf2f63c2Smrg]) # XORG_ENABLE_UNIT_TESTS
2407cf2f63c2Smrg
2408cf2f63c2Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2409cf2f63c2Smrg# ------------------------------------------------------
2410cf2f63c2Smrg# Minimum version: 1.17.0
2411cf2f63c2Smrg#
2412cf2f63c2Smrg# This macro enables a builder to enable/disable integration testing
2413cf2f63c2Smrg# It makes no assumption about the test cases' implementation
2414cf2f63c2Smrg# Test cases may or may not use Automake "Support for test suites"
2415cf2f63c2Smrg#
2416cf2f63c2Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2417cf2f63c2Smrg# usually requires less dependencies and may be built and run under less
2418cf2f63c2Smrg# stringent environments than integration tests.
2419cf2f63c2Smrg#
2420cf2f63c2Smrg# Interface to module:
2421cf2f63c2Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2422cf2f63c2Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2423cf2f63c2Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2424cf2f63c2Smrg#                             'no' user instructs the module not to build tests
2425cf2f63c2Smrg# parm1:                      specify the default value, yes or no.
2426cf2f63c2Smrg#
2427cf2f63c2SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2428cf2f63c2SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2429cf2f63c2Smrgm4_define([_defopt], m4_default([$1], [auto]))
2430cf2f63c2SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2431cf2f63c2Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2432cf2f63c2Smrg	[enable_integration_tests=$enableval],
2433cf2f63c2Smrg	[enable_integration_tests=]_defopt)
2434cf2f63c2Smrgm4_undefine([_defopt])
2435cf2f63c2SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2436cf2f63c2Smrg	[test "x$enable_integration_tests" != xno])
2437cf2f63c2SmrgAC_MSG_CHECKING([whether to build unit test cases])
2438cf2f63c2SmrgAC_MSG_RESULT([$enable_integration_tests])
2439cf2f63c2Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2440cf2f63c2Smrg
2441cf2f63c2Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2442cf2f63c2Smrg# ----------------------------------------
2443cf2f63c2Smrg# Minimum version: 1.13.0
2444cf2f63c2Smrg#
2445cf2f63c2Smrg# GLib is a library which provides advanced data structures and functions.
2446cf2f63c2Smrg# This macro enables a module to test for the presence of Glib.
2447cf2f63c2Smrg#
2448cf2f63c2Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2449cf2f63c2Smrg# Otherwise the value of $enable_unit_tests is blank.
2450cf2f63c2Smrg#
2451cf2f63c2Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2452cf2f63c2Smrg# test support usually requires less dependencies and may be built and run under
2453cf2f63c2Smrg# less stringent environments than integration tests.
2454cf2f63c2Smrg#
2455cf2f63c2Smrg# Interface to module:
2456cf2f63c2Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2457cf2f63c2Smrg# with_glib: used in configure.ac to know if GLib has been found
2458cf2f63c2Smrg# --with-glib:	'yes' user instructs the module to use glib
2459cf2f63c2Smrg#		'no' user instructs the module not to use glib
2460cf2f63c2Smrg#
2461cf2f63c2SmrgAC_DEFUN([XORG_WITH_GLIB],[
2462cf2f63c2SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2463cf2f63c2Smrgm4_define([_defopt], m4_default([$2], [auto]))
2464cf2f63c2SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2465cf2f63c2Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2466cf2f63c2Smrg	[with_glib=$withval], [with_glib=]_defopt)
2467cf2f63c2Smrgm4_undefine([_defopt])
2468cf2f63c2Smrg
2469cf2f63c2Smrghave_glib=no
2470cf2f63c2Smrg# Do not probe GLib if user explicitly disabled unit testing
2471cf2f63c2Smrgif test "x$enable_unit_tests" != x"no"; then
2472cf2f63c2Smrg  # Do not probe GLib if user explicitly disabled it
2473cf2f63c2Smrg  if test "x$with_glib" != x"no"; then
2474cf2f63c2Smrg    m4_ifval(
2475cf2f63c2Smrg      [$1],
2476cf2f63c2Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2477cf2f63c2Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2478cf2f63c2Smrg    )
2479cf2f63c2Smrg  fi
2480cf2f63c2Smrgfi
2481cf2f63c2Smrg
2482cf2f63c2Smrg# Not having GLib when unit testing has been explicitly requested is an error
2483cf2f63c2Smrgif test "x$enable_unit_tests" = x"yes"; then
2484cf2f63c2Smrg  if test "x$have_glib" = x"no"; then
2485cf2f63c2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2486cf2f63c2Smrg  fi
2487cf2f63c2Smrgfi
2488cf2f63c2Smrg
2489cf2f63c2Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2490cf2f63c2Smrgif test "x$enable_unit_tests" = x"no"; then
2491cf2f63c2Smrg  if test "x$with_glib" = x"yes"; then
2492cf2f63c2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2493cf2f63c2Smrg  fi
2494cf2f63c2Smrgfi
2495cf2f63c2Smrg
2496cf2f63c2Smrg# Not having GLib when it has been explicitly requested is an error
2497cf2f63c2Smrgif test "x$with_glib" = x"yes"; then
2498cf2f63c2Smrg  if test "x$have_glib" = x"no"; then
2499cf2f63c2Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2500cf2f63c2Smrg  fi
2501cf2f63c2Smrgfi
2502cf2f63c2Smrg
2503cf2f63c2SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2504cf2f63c2Smrg]) # XORG_WITH_GLIB
2505cf2f63c2Smrg
2506cf2f63c2Smrg# XORG_LD_WRAP([required|optional])
2507cf2f63c2Smrg# ---------------------------------
2508cf2f63c2Smrg# Minimum version: 1.13.0
2509cf2f63c2Smrg#
2510cf2f63c2Smrg# Check if linker supports -wrap, passed via compiler flags
2511cf2f63c2Smrg#
2512cf2f63c2Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2513cf2f63c2Smrg# Otherwise the value of $enable_unit_tests is blank.
2514cf2f63c2Smrg#
2515cf2f63c2Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2516cf2f63c2Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2517cf2f63c2Smrg# available, an argument of "optional" allows use when some unit tests require
2518cf2f63c2Smrg# ld -wrap and others do not.
2519cf2f63c2Smrg#
2520cf2f63c2SmrgAC_DEFUN([XORG_LD_WRAP],[
2521cf2f63c2SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2522cf2f63c2Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2523cf2f63c2Smrg                      void __wrap_exit(int status) { return; }],
2524cf2f63c2Smrg                     [exit(0);])])
2525cf2f63c2Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2526cf2f63c2Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2527cf2f63c2Smrg  if test "x$have_ld_wrap" = x"no"; then
2528cf2f63c2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2529cf2f63c2Smrg  fi
2530cf2f63c2Smrgfi
2531cf2f63c2SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2532cf2f63c2Smrg#
2533cf2f63c2Smrg]) # XORG_LD_WRAP
2534cf2f63c2Smrg
2535cf2f63c2Smrg# XORG_CHECK_LINKER_FLAGS
2536cf2f63c2Smrg# -----------------------
2537cf2f63c2Smrg# SYNOPSIS
2538cf2f63c2Smrg#
2539cf2f63c2Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2540cf2f63c2Smrg#
2541cf2f63c2Smrg# DESCRIPTION
2542cf2f63c2Smrg#
2543cf2f63c2Smrg#   Check whether the given linker FLAGS work with the current language's
2544cf2f63c2Smrg#   linker, or whether they give an error.
2545cf2f63c2Smrg#
2546cf2f63c2Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2547cf2f63c2Smrg#   success/failure.
2548cf2f63c2Smrg#
2549cf2f63c2Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2550cf2f63c2Smrg#
2551cf2f63c2Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2552cf2f63c2Smrg#
2553cf2f63c2Smrg# LICENSE
2554cf2f63c2Smrg#
2555cf2f63c2Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2556cf2f63c2Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2557cf2f63c2Smrg#   Copyright (c) 2009 Matteo Frigo
2558cf2f63c2Smrg#
2559cf2f63c2Smrg#   This program is free software: you can redistribute it and/or modify it
2560cf2f63c2Smrg#   under the terms of the GNU General Public License as published by the
2561cf2f63c2Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2562cf2f63c2Smrg#   option) any later version.
2563cf2f63c2Smrg#
2564cf2f63c2Smrg#   This program is distributed in the hope that it will be useful, but
2565cf2f63c2Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2566cf2f63c2Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2567cf2f63c2Smrg#   Public License for more details.
2568cf2f63c2Smrg#
2569cf2f63c2Smrg#   You should have received a copy of the GNU General Public License along
2570cf2f63c2Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2571cf2f63c2Smrg#
2572cf2f63c2Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2573cf2f63c2Smrg#   gives unlimited permission to copy, distribute and modify the configure
2574cf2f63c2Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2575cf2f63c2Smrg#   need not follow the terms of the GNU General Public License when using
2576cf2f63c2Smrg#   or distributing such scripts, even though portions of the text of the
2577cf2f63c2Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2578cf2f63c2Smrg#   all other use of the material that constitutes the Autoconf Macro.
2579cf2f63c2Smrg#
2580cf2f63c2Smrg#   This special exception to the GPL applies to versions of the Autoconf
2581cf2f63c2Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2582cf2f63c2Smrg#   modified version of the Autoconf Macro, you may extend this special
2583cf2f63c2Smrg#   exception to the GPL to apply to your modified version as well.#
2584cf2f63c2SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2585cf2f63c2Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2586cf2f63c2Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2587cf2f63c2SmrgAS_LITERAL_IF([$1],
2588cf2f63c2Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2589cf2f63c2Smrg      ax_save_FLAGS=$LDFLAGS
2590cf2f63c2Smrg      LDFLAGS="$1"
2591cf2f63c2Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2592cf2f63c2Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2593cf2f63c2Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2594cf2f63c2Smrg      LDFLAGS=$ax_save_FLAGS])],
2595cf2f63c2Smrg  [ax_save_FLAGS=$LDFLAGS
2596cf2f63c2Smrg   LDFLAGS="$1"
2597cf2f63c2Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2598cf2f63c2Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2599cf2f63c2Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2600cf2f63c2Smrg   LDFLAGS=$ax_save_FLAGS])
2601cf2f63c2Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2602cf2f63c2SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2603cf2f63c2Smrgif test "x$xorg_check_linker_flags" = xyes; then
2604cf2f63c2Smrg	m4_default([$2], :)
2605cf2f63c2Smrgelse
2606cf2f63c2Smrg	m4_default([$3], :)
2607cf2f63c2Smrgfi
2608cf2f63c2Smrg]) # XORG_CHECK_LINKER_FLAGS
2609cf2f63c2Smrg
2610cf2f63c2Smrg# XORG_MEMORY_CHECK_FLAGS
2611cf2f63c2Smrg# -----------------------
2612cf2f63c2Smrg# Minimum version: 1.16.0
2613b3078addSmrg#
2614cf2f63c2Smrg# This macro attempts to find appropriate memory checking functionality
2615cf2f63c2Smrg# for various platforms which unit testing code may use to catch various
2616cf2f63c2Smrg# forms of memory allocation and access errors in testing.
2617b3078addSmrg#
2618b3078addSmrg# Interface to module:
2619cf2f63c2Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2620cf2f63c2Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2621b3078addSmrg#
2622cf2f63c2Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2623cf2f63c2Smrg#
2624cf2f63c2SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2625cf2f63c2Smrg
2626cf2f63c2SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2627cf2f63c2SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2628cf2f63c2Smrg           [Environment variables to enable memory checking in tests])
2629cf2f63c2Smrg
2630cf2f63c2Smrg# Check for different types of support on different platforms
2631cf2f63c2Smrgcase $host_os in
2632cf2f63c2Smrg    solaris*)
2633cf2f63c2Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2634cf2f63c2Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2635cf2f63c2Smrg        ;;
2636cf2f63c2Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2637cf2f63c2Smrg        # both directly and inverted, so should not be 0 or 255.
2638cf2f63c2Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2639cf2f63c2Smrg        ;;
2640cf2f63c2Smrg    darwin*)
2641cf2f63c2Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2642cf2f63c2Smrg        ;;
2643cf2f63c2Smrg    *bsd*)
2644cf2f63c2Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2645cf2f63c2Smrg        ;;
2646cf2f63c2Smrgesac
2647cf2f63c2Smrg
2648cf2f63c2Smrg# User supplied flags override default flags
2649cf2f63c2Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2650cf2f63c2Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2651cf2f63c2Smrgfi
2652cf2f63c2Smrg
2653cf2f63c2SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2654cf2f63c2Smrg]) # XORG_WITH_LINT
2655b3078addSmrg
2656b3078addSmrg# XORG_CHECK_MALLOC_ZERO
2657b3078addSmrg# ----------------------
2658b3078addSmrg# Minimum version: 1.0.0
2659b3078addSmrg#
2660b3078addSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2661b3078addSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2662b3078addSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2663b3078addSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2664b3078addSmrgAC_ARG_ENABLE(malloc0returnsnull,
2665b3078addSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2666b3078addSmrg		       [malloc(0) returns NULL (default: auto)]),
26675c10afb9Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
26685c10afb9Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
26695c10afb9Smrg
26705c10afb9SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
26715c10afb9Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2672cf2f63c2SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2673cf2f63c2Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2674cf2f63c2Smrg#include <stdlib.h>
2675cf2f63c2Smrg],[
26765c10afb9Smrg    char *m0, *r0, *c0, *p;
26775c10afb9Smrg    m0 = malloc(0);
26785c10afb9Smrg    p = malloc(10);
26795c10afb9Smrg    r0 = realloc(p,0);
2680cf2f63c2Smrg    c0 = calloc(0,10);
2681cf2f63c2Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2682cf2f63c2Smrg])],
2683cf2f63c2Smrg		[xorg_cv_malloc0_returns_null=yes],
2684cf2f63c2Smrg		[xorg_cv_malloc0_returns_null=no])])
2685cf2f63c2SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
26865c10afb9Smrgfi
26875c10afb9SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
26885c10afb9Smrg
26895c10afb9Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
26905c10afb9Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
26915c10afb9Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
26925c10afb9Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
26935c10afb9Smrgelse
26945c10afb9Smrg	MALLOC_ZERO_CFLAGS=""
26955c10afb9Smrg	XMALLOC_ZERO_CFLAGS=""
26965c10afb9Smrg	XTMALLOC_ZERO_CFLAGS=""
26975c10afb9Smrgfi
26985c10afb9Smrg
26995c10afb9SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
27005c10afb9SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
27015c10afb9SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
27025c10afb9Smrg]) # XORG_CHECK_MALLOC_ZERO
27035c10afb9Smrg
2704b3078addSmrg# XORG_WITH_LINT()
2705b3078addSmrg# ----------------
2706b3078addSmrg# Minimum version: 1.1.0
2707b3078addSmrg#
2708b3078addSmrg# This macro enables the use of a tool that flags some suspicious and
2709b3078addSmrg# non-portable constructs (likely to be bugs) in C language source code.
2710b3078addSmrg# It will attempt to locate the tool and use appropriate options.
2711b3078addSmrg# There are various lint type tools on different platforms.
2712b3078addSmrg#
2713b3078addSmrg# Interface to module:
2714b3078addSmrg# LINT:		returns the path to the tool found on the platform
2715b3078addSmrg#		or the value set to LINT on the configure cmd line
2716b3078addSmrg#		also an Automake conditional
2717b3078addSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2718b3078addSmrg#
2719b3078addSmrg# --with-lint:	'yes' user instructs the module to use lint
2720b3078addSmrg#		'no' user instructs the module not to use lint (default)
2721b3078addSmrg#
2722b3078addSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2723b3078addSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2724b3078addSmrg#
2725b3078addSmrgAC_DEFUN([XORG_WITH_LINT],[
2726b3078addSmrg
2727b3078addSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2728b3078addSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2729b3078addSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2730b3078addSmrg		[Use a lint-style source code checker (default: disabled)])],
2731b3078addSmrg		[use_lint=$withval], [use_lint=no])
2732b3078addSmrg
2733b3078addSmrg# Obtain platform specific info like program name and options
2734b3078addSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2735b3078addSmrgcase $host_os in
2736b3078addSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2737b3078addSmrg	lint_name=splint
2738b3078addSmrg	lint_options="-badflag"
2739b3078addSmrg	;;
2740b3078addSmrg  *freebsd* | *netbsd*)
2741b3078addSmrg	lint_name=lint
2742b3078addSmrg	lint_options="-u -b"
2743b3078addSmrg	;;
2744b3078addSmrg  *solaris*)
2745b3078addSmrg	lint_name=lint
2746b3078addSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2747b3078addSmrg	;;
2748b3078addSmrgesac
2749b3078addSmrg
2750b3078addSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2751b3078addSmrgif test "x$use_lint" = x"yes" ; then
2752b3078addSmrg   AC_PATH_PROG([LINT], [$lint_name])
2753b3078addSmrg   if test "x$LINT" = "x"; then
2754b3078addSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2755b3078addSmrg   fi
2756b3078addSmrgelif test "x$use_lint" = x"no" ; then
2757b3078addSmrg   if test "x$LINT" != "x"; then
2758b3078addSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2759b3078addSmrg   fi
2760b3078addSmrgelse
2761b3078addSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2762b3078addSmrgfi
2763b3078addSmrg
2764b3078addSmrg# User supplied flags override default flags
2765b3078addSmrgif test "x$LINT_FLAGS" != "x"; then
2766b3078addSmrg   lint_options=$LINT_FLAGS
2767b3078addSmrgfi
2768b3078addSmrg
2769b3078addSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2770b3078addSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2771b3078addSmrg
2772b3078addSmrg]) # XORG_WITH_LINT
2773b3078addSmrg
2774b3078addSmrg# XORG_LINT_LIBRARY(LIBNAME)
2775b3078addSmrg# --------------------------
2776b3078addSmrg# Minimum version: 1.1.0
2777b3078addSmrg#
2778b3078addSmrg# Sets up flags for building lint libraries for checking programs that call
2779b3078addSmrg# functions in the library.
2780b3078addSmrg#
2781b3078addSmrg# Interface to module:
2782b3078addSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2783b3078addSmrg# MAKE_LINT_LIB		- Automake conditional
2784b3078addSmrg#
2785b3078addSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2786b3078addSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2787b3078addSmrg
2788b3078addSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2789b3078addSmrgAC_REQUIRE([XORG_WITH_LINT])
2790b3078addSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2791b3078addSmrg	[Create lint library (default: disabled)])],
2792b3078addSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2793b3078addSmrg
2794b3078addSmrgif test "x$make_lint_lib" = x"yes" ; then
2795b3078addSmrg   LINTLIB=llib-l$1.ln
2796b3078addSmrg   if test "x$LINT" = "x"; then
2797b3078addSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2798b3078addSmrg   fi
2799b3078addSmrgelif test "x$make_lint_lib" != x"no" ; then
2800b3078addSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2801b3078addSmrgfi
2802b3078addSmrg
2803b3078addSmrgAC_SUBST(LINTLIB)
2804b3078addSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2805b3078addSmrg
2806b3078addSmrg]) # XORG_LINT_LIBRARY
2807b3078addSmrg
2808cf2f63c2Smrg# XORG_COMPILER_BRAND
2809cf2f63c2Smrg# -------------------
2810cf2f63c2Smrg# Minimum version: 1.14.0
2811cf2f63c2Smrg#
2812cf2f63c2Smrg# Checks for various brands of compilers and sets flags as appropriate:
2813cf2f63c2Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2814cf2f63c2Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2815cf2f63c2Smrg#   clang compiler - sets CLANGCC to "yes"
2816cf2f63c2Smrg#   Intel compiler - sets INTELCC to "yes"
2817cf2f63c2Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2818cf2f63c2Smrg#
2819cf2f63c2SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2820cf2f63c2SmrgAC_LANG_CASE(
2821cf2f63c2Smrg	[C], [
2822cf2f63c2Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2823cf2f63c2Smrg	],
2824cf2f63c2Smrg	[C++], [
2825cf2f63c2Smrg		AC_REQUIRE([AC_PROG_CXX])
2826cf2f63c2Smrg	]
2827cf2f63c2Smrg)
2828cf2f63c2SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2829cf2f63c2SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2830cf2f63c2SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2831cf2f63c2Smrg]) # XORG_COMPILER_BRAND
2832cf2f63c2Smrg
2833cf2f63c2Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2834cf2f63c2Smrg# ---------------
2835cf2f63c2Smrg# Minimum version: 1.16.0
2836cf2f63c2Smrg#
2837cf2f63c2Smrg# Test if the compiler works when passed the given flag as a command line argument.
2838cf2f63c2Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2839cf2f63c2Smrg# next flag in the list until there are no more options.
2840cf2f63c2Smrg#
2841cf2f63c2Smrg# Note that this does not guarantee that the compiler supports the flag as some
2842cf2f63c2Smrg# compilers will simply ignore arguments that they do not understand, but we do
2843cf2f63c2Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2844cf2f63c2Smrg# -Werror=unused-command-line-argument
2845cf2f63c2Smrg#
2846cf2f63c2SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2847cf2f63c2Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2848cf2f63c2Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2849cf2f63c2Smrg
2850cf2f63c2SmrgAC_LANG_COMPILER_REQUIRE
2851cf2f63c2Smrg
2852cf2f63c2SmrgAC_LANG_CASE(
2853cf2f63c2Smrg	[C], [
2854cf2f63c2Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2855cf2f63c2Smrg		define([PREFIX], [C])
2856cf2f63c2Smrg		define([CACHE_PREFIX], [cc])
2857cf2f63c2Smrg		define([COMPILER], [$CC])
2858cf2f63c2Smrg	],
2859cf2f63c2Smrg	[C++], [
2860cf2f63c2Smrg		define([PREFIX], [CXX])
2861cf2f63c2Smrg		define([CACHE_PREFIX], [cxx])
2862cf2f63c2Smrg		define([COMPILER], [$CXX])
2863cf2f63c2Smrg	]
2864cf2f63c2Smrg)
2865cf2f63c2Smrg
2866cf2f63c2Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2867cf2f63c2Smrg
2868cf2f63c2Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2869cf2f63c2Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2870cf2f63c2Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2871cf2f63c2Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2872cf2f63c2Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2873cf2f63c2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2874cf2f63c2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2875cf2f63c2Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2876cf2f63c2Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2877cf2f63c2Smrgfi
2878cf2f63c2Smrg
2879cf2f63c2Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2880cf2f63c2Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2881cf2f63c2Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2882cf2f63c2Smrg	fi
2883cf2f63c2Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2884cf2f63c2Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2885cf2f63c2Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2886cf2f63c2Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2887cf2f63c2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2888cf2f63c2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2889cf2f63c2Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2890cf2f63c2Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2891cf2f63c2Smrgfi
2892cf2f63c2Smrg
2893cf2f63c2Smrgfound="no"
2894cf2f63c2Smrgm4_foreach([flag], m4_cdr($@), [
2895cf2f63c2Smrg	if test $found = "no" ; then
2896cf2f63c2Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
2897cf2f63c2Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2898cf2f63c2Smrg		fi
2899cf2f63c2Smrg
2900cf2f63c2Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
2901cf2f63c2Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2902cf2f63c2Smrg		fi
2903cf2f63c2Smrg
2904cf2f63c2Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2905cf2f63c2Smrg
2906cf2f63c2Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2907cf2f63c2Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2908cf2f63c2Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2909cf2f63c2Smrg		AC_CACHE_VAL($cacheid,
2910cf2f63c2Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2911cf2f63c2Smrg					     [eval $cacheid=yes],
2912cf2f63c2Smrg					     [eval $cacheid=no])])
2913cf2f63c2Smrg
2914cf2f63c2Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2915cf2f63c2Smrg
2916cf2f63c2Smrg		eval supported=\$$cacheid
2917cf2f63c2Smrg		AC_MSG_RESULT([$supported])
2918cf2f63c2Smrg		if test "$supported" = "yes" ; then
2919cf2f63c2Smrg			$1="$$1 ]flag["
2920cf2f63c2Smrg			found="yes"
2921cf2f63c2Smrg		fi
2922cf2f63c2Smrg	fi
2923cf2f63c2Smrg])
2924cf2f63c2Smrg]) # XORG_TESTSET_CFLAG
2925cf2f63c2Smrg
2926cf2f63c2Smrg# XORG_COMPILER_FLAGS
2927cf2f63c2Smrg# ---------------
2928cf2f63c2Smrg# Minimum version: 1.16.0
2929cf2f63c2Smrg#
2930cf2f63c2Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2931cf2f63c2Smrg# arguments supported by the selected compiler which do NOT alter the generated
2932cf2f63c2Smrg# code.  These arguments will cause the compiler to print various warnings
2933cf2f63c2Smrg# during compilation AND turn a conservative set of warnings into errors.
2934cf2f63c2Smrg#
2935cf2f63c2Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2936cf2f63c2Smrg# future versions of util-macros as options are added to new compilers.
2937cf2f63c2Smrg#
2938cf2f63c2SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2939cf2f63c2SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2940cf2f63c2Smrg
2941cf2f63c2SmrgAC_ARG_ENABLE(selective-werror,
2942cf2f63c2Smrg              AS_HELP_STRING([--disable-selective-werror],
2943cf2f63c2Smrg                             [Turn off selective compiler errors. (default: enabled)]),
2944cf2f63c2Smrg              [SELECTIVE_WERROR=$enableval],
2945cf2f63c2Smrg              [SELECTIVE_WERROR=yes])
2946cf2f63c2Smrg
2947cf2f63c2SmrgAC_LANG_CASE(
2948cf2f63c2Smrg        [C], [
2949cf2f63c2Smrg                define([PREFIX], [C])
2950cf2f63c2Smrg        ],
2951cf2f63c2Smrg        [C++], [
2952cf2f63c2Smrg                define([PREFIX], [CXX])
2953cf2f63c2Smrg        ]
2954cf2f63c2Smrg)
2955cf2f63c2Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2956cf2f63c2Smrgif test "x$SUNCC" = "xyes"; then
2957cf2f63c2Smrg    [BASE_]PREFIX[FLAGS]="-v"
2958cf2f63c2Smrgelse
2959cf2f63c2Smrg    [BASE_]PREFIX[FLAGS]=""
2960cf2f63c2Smrgfi
2961cf2f63c2Smrg
2962cf2f63c2Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2963cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2964cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2965cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2966cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2967cf2f63c2Smrg
2968cf2f63c2SmrgAC_LANG_CASE(
2969cf2f63c2Smrg	[C], [
2970cf2f63c2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2971cf2f63c2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2972cf2f63c2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2973cf2f63c2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2974cf2f63c2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
2975cf2f63c2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2976cf2f63c2Smrg	]
2977cf2f63c2Smrg)
2978cf2f63c2Smrg
2979cf2f63c2Smrg# This chunk adds additional warnings that could catch undesired effects.
2980cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2981cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2982cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2983cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2984cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2985cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2986cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2987cf2f63c2Smrg
2988cf2f63c2Smrg# These are currently disabled because they are noisy.  They will be enabled
2989cf2f63c2Smrg# in the future once the codebase is sufficiently modernized to silence
2990cf2f63c2Smrg# them.  For now, I don't want them to drown out the other warnings.
2991cf2f63c2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2992cf2f63c2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2993cf2f63c2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2994cf2f63c2Smrg
2995cf2f63c2Smrg# Turn some warnings into errors, so we don't accidently get successful builds
2996cf2f63c2Smrg# when there are problems that should be fixed.
2997cf2f63c2Smrg
2998cf2f63c2Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2999cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3000cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3001cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3002cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3003cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3004cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3005cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3006cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3007cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3008cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3009cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3010cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3011cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3012cf2f63c2Smrgelse
3013cf2f63c2SmrgAC_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])
3014cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3015cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3016cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3017cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3018cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3019cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3020cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3021cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3022cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3023cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3024cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3025cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3026cf2f63c2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3027cf2f63c2Smrgfi
3028cf2f63c2Smrg
3029cf2f63c2SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3030cf2f63c2Smrg]) # XORG_COMPILER_FLAGS
3031cf2f63c2Smrg
3032b3078addSmrg# XORG_CWARNFLAGS
3033b3078addSmrg# ---------------
3034b3078addSmrg# Minimum version: 1.2.0
3035cf2f63c2Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3036b3078addSmrg#
3037b3078addSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3038b3078addSmrg#
3039cf2f63c2Smrg# This function is deprecated because it defines -fno-strict-aliasing
3040cf2f63c2Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3041cf2f63c2Smrg# is needed, then it should be added explicitly in the module when
3042cf2f63c2Smrg# it is updated to use BASE_CFLAGS.
3043cf2f63c2Smrg#
3044b3078addSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3045cf2f63c2SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3046cf2f63c2SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3047cf2f63c2SmrgAC_LANG_CASE(
3048cf2f63c2Smrg	[C], [
3049cf2f63c2Smrg		CWARNFLAGS="$BASE_CFLAGS"
3050cf2f63c2Smrg		if  test "x$GCC" = xyes ; then
3051cf2f63c2Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3052cf2f63c2Smrg		fi
3053cf2f63c2Smrg		AC_SUBST(CWARNFLAGS)
3054cf2f63c2Smrg	]
3055cf2f63c2Smrg)
3056b3078addSmrg]) # XORG_CWARNFLAGS
3057b3078addSmrg
3058b3078addSmrg# XORG_STRICT_OPTION
3059b3078addSmrg# -----------------------
3060b3078addSmrg# Minimum version: 1.3.0
3061b3078addSmrg#
3062cf2f63c2Smrg# Add configure option to enable strict compilation flags, such as treating
3063cf2f63c2Smrg# warnings as fatal errors.
3064cf2f63c2Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3065cf2f63c2Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3066cf2f63c2Smrg#
3067cf2f63c2Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3068cf2f63c2Smrg# when strict compilation is unconditionally desired.
3069b3078addSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3070b3078addSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3071cf2f63c2SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3072b3078addSmrg
3073b3078addSmrgAC_ARG_ENABLE(strict-compilation,
3074b3078addSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3075b3078addSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3076b3078addSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3077cf2f63c2Smrg
3078cf2f63c2SmrgAC_LANG_CASE(
3079cf2f63c2Smrg        [C], [
3080cf2f63c2Smrg                define([PREFIX], [C])
3081cf2f63c2Smrg        ],
3082cf2f63c2Smrg        [C++], [
3083cf2f63c2Smrg                define([PREFIX], [CXX])
3084cf2f63c2Smrg        ]
3085cf2f63c2Smrg)
3086cf2f63c2Smrg
3087cf2f63c2Smrg[STRICT_]PREFIX[FLAGS]=""
3088cf2f63c2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3089cf2f63c2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3090cf2f63c2Smrg
3091cf2f63c2Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3092cf2f63c2Smrg# activate it with -Werror, so we add it here explicitly.
3093cf2f63c2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3094cf2f63c2Smrg
3095b3078addSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3096cf2f63c2Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3097cf2f63c2Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3098b3078addSmrgfi
3099cf2f63c2SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3100cf2f63c2SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3101cf2f63c2SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3102b3078addSmrg]) # XORG_STRICT_OPTION
3103b3078addSmrg
3104b3078addSmrg# XORG_DEFAULT_OPTIONS
3105b3078addSmrg# --------------------
3106b3078addSmrg# Minimum version: 1.3.0
3107b3078addSmrg#
3108b3078addSmrg# Defines default options for X.Org modules.
3109b3078addSmrg#
3110b3078addSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3111b3078addSmrgAC_REQUIRE([AC_PROG_INSTALL])
3112cf2f63c2SmrgXORG_COMPILER_FLAGS
3113b3078addSmrgXORG_CWARNFLAGS
3114b3078addSmrgXORG_STRICT_OPTION
3115b3078addSmrgXORG_RELEASE_VERSION
3116b3078addSmrgXORG_CHANGELOG
3117b3078addSmrgXORG_INSTALL
3118b3078addSmrgXORG_MANPAGE_SECTIONS
3119b3078addSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3120b3078addSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3121b3078addSmrg]) # XORG_DEFAULT_OPTIONS
3122b3078addSmrg
3123b3078addSmrg# XORG_INSTALL()
3124b3078addSmrg# ----------------
3125b3078addSmrg# Minimum version: 1.4.0
3126b3078addSmrg#
3127b3078addSmrg# Defines the variable INSTALL_CMD as the command to copy
3128b3078addSmrg# INSTALL from $prefix/share/util-macros.
3129b3078addSmrg#
3130b3078addSmrgAC_DEFUN([XORG_INSTALL], [
3131b3078addSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3132b3078addSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3133b3078addSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3134b3078addSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3135b3078addSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3136b3078addSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3137b3078addSmrgAC_SUBST([INSTALL_CMD])
3138b3078addSmrg]) # XORG_INSTALL
31395c10afb9Smrgdnl Copyright 2005 Red Hat, Inc
31405c10afb9Smrgdnl
31415c10afb9Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
31425c10afb9Smrgdnl documentation for any purpose is hereby granted without fee, provided that
31435c10afb9Smrgdnl the above copyright notice appear in all copies and that both that
31445c10afb9Smrgdnl copyright notice and this permission notice appear in supporting
31455c10afb9Smrgdnl documentation.
31465c10afb9Smrgdnl
31475c10afb9Smrgdnl The above copyright notice and this permission notice shall be included
31485c10afb9Smrgdnl in all copies or substantial portions of the Software.
31495c10afb9Smrgdnl
31505c10afb9Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31515c10afb9Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31525c10afb9Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31535c10afb9Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
31545c10afb9Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31555c10afb9Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31565c10afb9Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
31575c10afb9Smrgdnl
31585c10afb9Smrgdnl Except as contained in this notice, the name of the copyright holders shall
31595c10afb9Smrgdnl not be used in advertising or otherwise to promote the sale, use or
31605c10afb9Smrgdnl other dealings in this Software without prior written authorization
31615c10afb9Smrgdnl from the copyright holders.
31625c10afb9Smrgdnl
31635c10afb9Smrg
31645c10afb9Smrg# XORG_RELEASE_VERSION
31655c10afb9Smrg# --------------------
3166b3078addSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3167cf2f63c2Smrg
31685c10afb9SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3169b3078addSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3170b3078addSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3171b3078addSmrg		[Major version of this package])
3172b3078addSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3173b3078addSmrg	if test "x$PVM" = "x"; then
3174b3078addSmrg		PVM="0"
31755c10afb9Smrg	fi
3176b3078addSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3177b3078addSmrg		[$PVM],
3178b3078addSmrg		[Minor version of this package])
3179b3078addSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3180b3078addSmrg	if test "x$PVP" = "x"; then
3181b3078addSmrg		PVP="0"
3182b3078addSmrg	fi
3183b3078addSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3184b3078addSmrg		[$PVP],
3185b3078addSmrg		[Patch version of this package])
31865c10afb9Smrg])
31875c10afb9Smrg
3188b3078addSmrg# XORG_CHANGELOG()
3189b3078addSmrg# ----------------
3190b3078addSmrg# Minimum version: 1.2.0
3191b3078addSmrg#
3192b3078addSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3193b3078addSmrg# ChangeLog from git.
3194b3078addSmrg#
3195b3078addSmrg#
3196b3078addSmrgAC_DEFUN([XORG_CHANGELOG], [
3197b3078addSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3198b3078addSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3199b3078addSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3200b3078addSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3201b3078addSmrgAC_SUBST([CHANGELOG_CMD])
3202b3078addSmrg]) # XORG_CHANGELOG
3203b3078addSmrg
3204b3078addSmrgdnl
3205cf2f63c2Smrgdnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
3206b3078addSmrgdnl
3207b3078addSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3208b3078addSmrgdnl copy of this software and associated documentation files (the "Software"),
3209b3078addSmrgdnl to deal in the Software without restriction, including without limitation
3210b3078addSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3211b3078addSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
3212b3078addSmrgdnl Software is furnished to do so, subject to the following conditions:
3213b3078addSmrgdnl
3214b3078addSmrgdnl The above copyright notice and this permission notice (including the next
3215b3078addSmrgdnl paragraph) shall be included in all copies or substantial portions of the
3216b3078addSmrgdnl Software.
3217b3078addSmrgdnl
3218b3078addSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3219b3078addSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3220b3078addSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3221b3078addSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3222b3078addSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3223b3078addSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3224b3078addSmrgdnl DEALINGS IN THE SOFTWARE.
3225cf2f63c2Smrgdnl
3226b3078addSmrg
3227b3078addSmrg# XTRANS_TCP_FLAGS()
3228b3078addSmrg# ------------------
3229b3078addSmrg# Find needed libraries for TCP sockets, and check for IPv6 support
3230b3078addSmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
3231b3078addSmrg # SVR4 hides these in libraries other than libc
3232b3078addSmrg AC_SEARCH_LIBS(socket, [socket])
3233b3078addSmrg AC_SEARCH_LIBS(gethostbyname, [nsl])
3234b3078addSmrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
3235cf2f63c2Smrg   AC_CHECK_LIB([ws2_32],[main])
3236b3078addSmrg fi
3237b3078addSmrg
3238b3078addSmrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
3239cf2f63c2Smrg AC_ARG_ENABLE(ipv6,
3240cf2f63c2Smrg	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
3241cf2f63c2Smrg	[IPV6CONN=$enableval],
3242b3078addSmrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
3243b3078addSmrg AC_MSG_CHECKING([if IPv6 support should be built])
3244b3078addSmrg if test "$IPV6CONN" = "yes"; then
3245b3078addSmrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
3246b3078addSmrg fi
3247b3078addSmrg AC_MSG_RESULT($IPV6CONN)
3248b3078addSmrg
3249b3078addSmrg # 4.3BSD-Reno added a new member to struct sockaddr_in
3250cf2f63c2Smrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
3251b3078addSmrg	AC_DEFINE([BSD44SOCKETS],1,
3252b3078addSmrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
3253b3078addSmrg#include <sys/types.h>
3254b3078addSmrg#include <sys/socket.h>
3255b3078addSmrg#include <netinet/in.h>
3256b3078addSmrg ])
3257b3078addSmrg
3258b3078addSmrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
3259b3078addSmrg AC_CHECK_TYPES([socklen_t], [], [], [
3260b3078addSmrgAC_INCLUDES_DEFAULT
3261b3078addSmrg#include <sys/socket.h>])
3262cf2f63c2Smrg
3263cf2f63c2Smrg # XPG4v2/UNIX95 added msg_control - check to see if we need to define
3264cf2f63c2Smrg # _XOPEN_SOURCE to get it (such as on Solaris)
3265cf2f63c2Smrg AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
3266cf2f63c2Smrg                 [
3267cf2f63c2SmrgAC_INCLUDES_DEFAULT
3268cf2f63c2Smrg#include <sys/socket.h>
3269cf2f63c2Smrg                 ])
3270cf2f63c2Smrg # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
3271cf2f63c2Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
3272cf2f63c2Smrg     unset ac_cv_member_struct_msghdr_msg_control
3273cf2f63c2Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
3274cf2f63c2Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
3275cf2f63c2Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [600],
3276cf2f63c2Smrg                       [Defined if needed to expose struct msghdr.msg_control])
3277cf2f63c2Smrg                     ], [], [
3278cf2f63c2Smrg#define _XOPEN_SOURCE 600
3279cf2f63c2SmrgAC_INCLUDES_DEFAULT
3280cf2f63c2Smrg#include <sys/socket.h>
3281cf2f63c2Smrg                     ])
3282cf2f63c2Smrg fi
3283cf2f63c2Smrg # If that didn't work, fall back to XPG5/UNIX98 with C89
3284cf2f63c2Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
3285cf2f63c2Smrg     unset ac_cv_member_struct_msghdr_msg_control
3286cf2f63c2Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
3287cf2f63c2Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
3288cf2f63c2Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [500],
3289cf2f63c2Smrg                       [Defined if needed to expose struct msghdr.msg_control])
3290cf2f63c2Smrg                     ], [], [
3291cf2f63c2Smrg#define _XOPEN_SOURCE 500
3292cf2f63c2SmrgAC_INCLUDES_DEFAULT
3293cf2f63c2Smrg#include <sys/socket.h>
3294cf2f63c2Smrg                     ])
3295cf2f63c2Smrg fi
3296cf2f63c2Smrg
3297cf2f63c2Smrg
3298b3078addSmrg]) # XTRANS_TCP_FLAGS
3299b3078addSmrg
3300b3078addSmrg# XTRANS_CONNECTION_FLAGS()
3301b3078addSmrg# -------------------------
3302b3078addSmrg# Standard checks for which Xtrans transports to use by the Xorg packages
3303b3078addSmrg# that use Xtrans functions
3304b3078addSmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
3305b3078addSmrg AC_REQUIRE([AC_CANONICAL_HOST])
3306b3078addSmrg [case $host_os in
3307b3078addSmrg	mingw*)	unixdef="no"   ;;
3308b3078addSmrg	*)	unixdef="yes"  ;;
3309b3078addSmrg esac]
3310b3078addSmrg AC_ARG_ENABLE(unix-transport,
3311cf2f63c2Smrg	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
3312b3078addSmrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
3313b3078addSmrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
3314b3078addSmrg if test "$UNIXCONN" = "yes"; then
3315b3078addSmrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
3316b3078addSmrg fi
3317b3078addSmrg AC_MSG_RESULT($UNIXCONN)
3318cf2f63c2Smrg AC_ARG_ENABLE(tcp-transport,
3319cf2f63c2Smrg	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
3320b3078addSmrg	[TCPCONN=$enableval], [TCPCONN=yes])
3321b3078addSmrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
3322b3078addSmrg AC_MSG_RESULT($TCPCONN)
3323b3078addSmrg if test "$TCPCONN" = "yes"; then
3324b3078addSmrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
3325b3078addSmrg	XTRANS_TCP_FLAGS
3326b3078addSmrg fi
3327b3078addSmrg [case $host_os in
3328b3078addSmrg	solaris*|sco*|sysv4*)	localdef="yes" ;;
3329b3078addSmrg	*)			localdef="no"  ;;
3330b3078addSmrg esac]
3331b3078addSmrg AC_ARG_ENABLE(local-transport,
3332cf2f63c2Smrg	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
3333b3078addSmrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
3334b3078addSmrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
3335b3078addSmrg AC_MSG_RESULT($LOCALCONN)
3336b3078addSmrg if test "$LOCALCONN" = "yes"; then
3337b3078addSmrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
3338b3078addSmrg fi
3339cf2f63c2Smrg
3340b3078addSmrg]) # XTRANS_CONNECTION_FLAGS
3341b3078addSmrg
3342b3078addSmrg
3343b3078addSmrg# XTRANS_SECURE_RPC_FLAGS()
3344b3078addSmrg# -------------------------
3345b3078addSmrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
3346b3078addSmrg# so that any necessary networking libraries are already found
3347b3078addSmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
3348b3078addSmrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
3349cf2f63c2Smrg AC_ARG_ENABLE(secure-rpc,
3350cf2f63c2Smrg	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
3351b3078addSmrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
3352b3078addSmrg
3353b3078addSmrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
3354b3078addSmrg	FOUND_SECURE_RPC="no"
3355b3078addSmrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
3356b3078addSmrg			[FOUND_SECURE_RPC="yes"])
3357b3078addSmrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
3358b3078addSmrg		if test "x$SECURE_RPC" = "xyes" ; then
3359b3078addSmrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
3360cf2f63c2Smrg		fi
3361b3078addSmrg		SECURE_RPC="no"
3362b3078addSmrg	else
3363b3078addSmrg		dnl FreeBSD keeps getsecretkey in librpcsvc
3364b3078addSmrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
3365b3078addSmrg		SECURE_RPC="yes"
3366b3078addSmrg	fi
3367b3078addSmrg fi
3368b3078addSmrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
3369b3078addSmrg if test "x$SECURE_RPC" = "xyes" ; then
3370b3078addSmrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
3371b3078addSmrg fi
3372b3078addSmrg AC_MSG_RESULT($SECURE_RPC)
3373b3078addSmrg]) # XTRANS_SECURE_RPC_FLAGS
3374b3078addSmrg
3375b3078addSmrg
3376