aclocal.m4 revision 1b983734
11b983734Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2a733a5bfSmrg
31b983734Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
41a30de1fSmrg
51a30de1fSmrg# This file is free software; the Free Software Foundation
61a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
71a30de1fSmrg# with or without modifications, as long as this notice is preserved.
81a30de1fSmrg
91a30de1fSmrg# This program is distributed in the hope that it will be useful,
101a30de1fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
111a30de1fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
121a30de1fSmrg# PARTICULAR PURPOSE.
131a30de1fSmrg
14a733a5bfSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15b7fb5eacSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16b7fb5eacSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
171b983734Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
181b983734Smrg[m4_warning([this file was generated for autoconf 2.69.
19b7fb5eacSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20b7fb5eacSmrgIf you have problems, you may need to regenerate the build system entirely.
21a733a5bfSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
221a30de1fSmrg
231b983734Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
241a30de1fSmrg#
251a30de1fSmrg# This file is free software; the Free Software Foundation
261a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
271a30de1fSmrg# with or without modifications, as long as this notice is preserved.
281a30de1fSmrg
291a30de1fSmrg# AM_AUTOMAKE_VERSION(VERSION)
301a30de1fSmrg# ----------------------------
311a30de1fSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
321a30de1fSmrg# generated from the m4 files accompanying Automake X.Y.
331a30de1fSmrg# (This private macro should not be called outside this file.)
341a30de1fSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
351b983734Smrg[am__api_version='1.15'
361a30de1fSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
371a30de1fSmrgdnl require some minimum version.  Point them to the right macro.
381b983734Smrgm4_if([$1], [1.15], [],
391a30de1fSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
401a30de1fSmrg])
411a30de1fSmrg
421a30de1fSmrg# _AM_AUTOCONF_VERSION(VERSION)
431a30de1fSmrg# -----------------------------
441a30de1fSmrg# aclocal traces this macro to find the Autoconf version.
451a30de1fSmrg# This is a private macro too.  Using m4_define simplifies
461a30de1fSmrg# the logic in aclocal, which can simply ignore this definition.
471a30de1fSmrgm4_define([_AM_AUTOCONF_VERSION], [])
481a30de1fSmrg
491a30de1fSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
501a30de1fSmrg# -------------------------------
511a30de1fSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52b7fb5eacSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
531a30de1fSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
541b983734Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
55b7fb5eacSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56b7fb5eacSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57b7fb5eacSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
581a30de1fSmrg
591a30de1fSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
601a30de1fSmrg
611b983734Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
621a30de1fSmrg#
631a30de1fSmrg# This file is free software; the Free Software Foundation
641a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
651a30de1fSmrg# with or without modifications, as long as this notice is preserved.
661a30de1fSmrg
671a30de1fSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68a733a5bfSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69a733a5bfSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
701a30de1fSmrg#
711a30de1fSmrg# Of course, Automake must honor this variable whenever it calls a
721a30de1fSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
731a30de1fSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
741a30de1fSmrg# depending on how configure is run.  This is pretty annoying, since
751a30de1fSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
761a30de1fSmrg# source directory, any form will work fine, but in subdirectories a
771a30de1fSmrg# relative path needs to be adjusted first.
781a30de1fSmrg#
791a30de1fSmrg# $ac_aux_dir/missing
801a30de1fSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
811a30de1fSmrg# $top_srcdir/$ac_aux_dir/missing
821a30de1fSmrg#    fails if $ac_aux_dir is absolute,
831a30de1fSmrg#    fails when called from a subdirectory in a VPATH build with
841a30de1fSmrg#          a relative $ac_aux_dir
851a30de1fSmrg#
861a30de1fSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
871a30de1fSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
88a733a5bfSmrg# harmless because $srcdir is '.', but things will broke when you
891a30de1fSmrg# start a VPATH build or use an absolute $srcdir.
901a30de1fSmrg#
911a30de1fSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
921a30de1fSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
931a30de1fSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
941a30de1fSmrg# and then we would define $MISSING as
951a30de1fSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
961a30de1fSmrg# This will work as long as MISSING is not called from configure, because
971a30de1fSmrg# unfortunately $(top_srcdir) has no meaning in configure.
981a30de1fSmrg# However there are other variables, like CC, which are often used in
991a30de1fSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1001a30de1fSmrg#
1011a30de1fSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1021a30de1fSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1031a30de1fSmrg# configured tree to be moved without reconfiguration.
1041a30de1fSmrg
1051a30de1fSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1061b983734Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1071b983734Smrg# Expand $ac_aux_dir to an absolute path.
1081b983734Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1091a30de1fSmrg])
1101a30de1fSmrg
1111a30de1fSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1121a30de1fSmrg
1131b983734Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
1141a30de1fSmrg#
1151a30de1fSmrg# This file is free software; the Free Software Foundation
1161a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
1171a30de1fSmrg# with or without modifications, as long as this notice is preserved.
1181a30de1fSmrg
1191a30de1fSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1201a30de1fSmrg# -------------------------------------
1211a30de1fSmrg# Define a conditional.
1221a30de1fSmrgAC_DEFUN([AM_CONDITIONAL],
123a733a5bfSmrg[AC_PREREQ([2.52])dnl
124a733a5bfSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125a733a5bfSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1261a30de1fSmrgAC_SUBST([$1_TRUE])dnl
1271a30de1fSmrgAC_SUBST([$1_FALSE])dnl
1281a30de1fSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1291a30de1fSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130b7fb5eacSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1311a30de1fSmrgif $2; then
1321a30de1fSmrg  $1_TRUE=
1331a30de1fSmrg  $1_FALSE='#'
1341a30de1fSmrgelse
1351a30de1fSmrg  $1_TRUE='#'
1361a30de1fSmrg  $1_FALSE=
1371a30de1fSmrgfi
1381a30de1fSmrgAC_CONFIG_COMMANDS_PRE(
1391a30de1fSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1401a30de1fSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1411a30de1fSmrgUsually this means the macro was only invoked conditionally.]])
1421a30de1fSmrgfi])])
1431a30de1fSmrg
1441b983734Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
1451a30de1fSmrg#
1461a30de1fSmrg# This file is free software; the Free Software Foundation
1471a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
1481a30de1fSmrg# with or without modifications, as long as this notice is preserved.
1491a30de1fSmrg
1501a30de1fSmrg
151a733a5bfSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1521a30de1fSmrg# written in clear, in which case automake, when reading aclocal.m4,
1531a30de1fSmrg# will think it sees a *use*, and therefore will trigger all it's
1541a30de1fSmrg# C support machinery.  Also note that it means that autoscan, seeing
1551a30de1fSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1561a30de1fSmrg
1571a30de1fSmrg
1581a30de1fSmrg# _AM_DEPENDENCIES(NAME)
1591a30de1fSmrg# ----------------------
1601a30de1fSmrg# See how the compiler implements dependency checking.
161a733a5bfSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1621a30de1fSmrg# We try a few techniques and use that to set a single cache variable.
1631a30de1fSmrg#
1641a30de1fSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1651a30de1fSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1661a30de1fSmrg# dependency, and given that the user is not expected to run this macro,
1671a30de1fSmrg# just rely on AC_PROG_CC.
1681a30de1fSmrgAC_DEFUN([_AM_DEPENDENCIES],
1691a30de1fSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1701a30de1fSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1711a30de1fSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1721a30de1fSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1731a30de1fSmrg
174a733a5bfSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175a733a5bfSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176a733a5bfSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177a733a5bfSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178a733a5bfSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179a733a5bfSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180a733a5bfSmrg                    [depcc="$$1"   am_compiler_list=])
1811a30de1fSmrg
1821a30de1fSmrgAC_CACHE_CHECK([dependency style of $depcc],
1831a30de1fSmrg               [am_cv_$1_dependencies_compiler_type],
1841a30de1fSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1851a30de1fSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1861a30de1fSmrg  # making bogus files that we don't know about and never remove.  For
1871a30de1fSmrg  # instance it was reported that on HP-UX the gcc test will end up
188a733a5bfSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189a733a5bfSmrg  # in D".
190a733a5bfSmrg  rm -rf conftest.dir
1911a30de1fSmrg  mkdir conftest.dir
1921a30de1fSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1931a30de1fSmrg  # using a relative directory.
1941a30de1fSmrg  cp "$am_depcomp" conftest.dir
1951a30de1fSmrg  cd conftest.dir
1961a30de1fSmrg  # We will build objects and dependencies in a subdirectory because
1971a30de1fSmrg  # it helps to detect inapplicable dependency modes.  For instance
1981a30de1fSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1991a30de1fSmrg  # side effect of compilation, but ICC will put the dependencies in
2001a30de1fSmrg  # the current directory while Tru64 will put them in the object
2011a30de1fSmrg  # directory.
2021a30de1fSmrg  mkdir sub
2031a30de1fSmrg
2041a30de1fSmrg  am_cv_$1_dependencies_compiler_type=none
2051a30de1fSmrg  if test "$am_compiler_list" = ""; then
2061a30de1fSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2071a30de1fSmrg  fi
208b7fb5eacSmrg  am__universal=false
209b7fb5eacSmrg  m4_case([$1], [CC],
210b7fb5eacSmrg    [case " $depcc " in #(
211b7fb5eacSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212b7fb5eacSmrg     esac],
213b7fb5eacSmrg    [CXX],
214b7fb5eacSmrg    [case " $depcc " in #(
215b7fb5eacSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216b7fb5eacSmrg     esac])
217b7fb5eacSmrg
2181a30de1fSmrg  for depmode in $am_compiler_list; do
2191a30de1fSmrg    # Setup a source with many dependencies, because some compilers
2201a30de1fSmrg    # like to wrap large dependency lists on column 80 (with \), and
2211a30de1fSmrg    # we should not choose a depcomp mode which is confused by this.
2221a30de1fSmrg    #
2231a30de1fSmrg    # We need to recreate these files for each test, as the compiler may
2241a30de1fSmrg    # overwrite some of them when testing with obscure command lines.
2251a30de1fSmrg    # This happens at least with the AIX C compiler.
2261a30de1fSmrg    : > sub/conftest.c
2271a30de1fSmrg    for i in 1 2 3 4 5 6; do
2281a30de1fSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229a733a5bfSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230a733a5bfSmrg      # Solaris 10 /bin/sh.
231a733a5bfSmrg      echo '/* dummy */' > sub/conftst$i.h
2321a30de1fSmrg    done
2331a30de1fSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2341a30de1fSmrg
235a733a5bfSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236b7fb5eacSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237a733a5bfSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238a733a5bfSmrg    # versions had trouble with output in subdirs.
239b7fb5eacSmrg    am__obj=sub/conftest.${OBJEXT-o}
240b7fb5eacSmrg    am__minus_obj="-o $am__obj"
2411a30de1fSmrg    case $depmode in
242b7fb5eacSmrg    gcc)
243b7fb5eacSmrg      # This depmode causes a compiler race in universal mode.
244b7fb5eacSmrg      test "$am__universal" = false || continue
245b7fb5eacSmrg      ;;
2461a30de1fSmrg    nosideeffect)
247a733a5bfSmrg      # After this tag, mechanisms are not by side-effect, so they'll
248a733a5bfSmrg      # only be used when explicitly requested.
2491a30de1fSmrg      if test "x$enable_dependency_tracking" = xyes; then
2501a30de1fSmrg	continue
2511a30de1fSmrg      else
2521a30de1fSmrg	break
2531a30de1fSmrg      fi
2541a30de1fSmrg      ;;
255a733a5bfSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256a733a5bfSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
257b7fb5eacSmrg      # not run yet.  These depmodes are late enough in the game, and
258b7fb5eacSmrg      # so weak that their functioning should not be impacted.
259b7fb5eacSmrg      am__obj=conftest.${OBJEXT-o}
260b7fb5eacSmrg      am__minus_obj=
261b7fb5eacSmrg      ;;
2621a30de1fSmrg    none) break ;;
2631a30de1fSmrg    esac
2641a30de1fSmrg    if depmode=$depmode \
265b7fb5eacSmrg       source=sub/conftest.c object=$am__obj \
2661a30de1fSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267b7fb5eacSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2681a30de1fSmrg         >/dev/null 2>conftest.err &&
2691a30de1fSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2701a30de1fSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271b7fb5eacSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2721a30de1fSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2731a30de1fSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2741a30de1fSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2751a30de1fSmrg      # that says an option was ignored or not supported.
2761a30de1fSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2771a30de1fSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2781a30de1fSmrg      # The diagnosis changed in icc 8.0:
2791a30de1fSmrg      #   icc: Command line remark: option '-MP' not supported
2801a30de1fSmrg      if (grep 'ignoring option' conftest.err ||
2811a30de1fSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2821a30de1fSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2831a30de1fSmrg        break
2841a30de1fSmrg      fi
2851a30de1fSmrg    fi
2861a30de1fSmrg  done
2871a30de1fSmrg
2881a30de1fSmrg  cd ..
2891a30de1fSmrg  rm -rf conftest.dir
2901a30de1fSmrgelse
2911a30de1fSmrg  am_cv_$1_dependencies_compiler_type=none
2921a30de1fSmrgfi
2931a30de1fSmrg])
2941a30de1fSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2951a30de1fSmrgAM_CONDITIONAL([am__fastdep$1], [
2961a30de1fSmrg  test "x$enable_dependency_tracking" != xno \
2971a30de1fSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2981a30de1fSmrg])
2991a30de1fSmrg
3001a30de1fSmrg
3011a30de1fSmrg# AM_SET_DEPDIR
3021a30de1fSmrg# -------------
3031a30de1fSmrg# Choose a directory name for dependency files.
304a733a5bfSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3051a30de1fSmrgAC_DEFUN([AM_SET_DEPDIR],
3061a30de1fSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3071a30de1fSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3081a30de1fSmrg])
3091a30de1fSmrg
3101a30de1fSmrg
3111a30de1fSmrg# AM_DEP_TRACK
3121a30de1fSmrg# ------------
3131a30de1fSmrgAC_DEFUN([AM_DEP_TRACK],
314a733a5bfSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315a733a5bfSmrgAS_HELP_STRING(
316a733a5bfSmrg  [--enable-dependency-tracking],
317a733a5bfSmrg  [do not reject slow dependency extractors])
318a733a5bfSmrgAS_HELP_STRING(
319a733a5bfSmrg  [--disable-dependency-tracking],
320a733a5bfSmrg  [speeds up one-time build])])
3211a30de1fSmrgif test "x$enable_dependency_tracking" != xno; then
3221a30de1fSmrg  am_depcomp="$ac_aux_dir/depcomp"
3231a30de1fSmrg  AMDEPBACKSLASH='\'
324a733a5bfSmrg  am__nodep='_no'
3251a30de1fSmrgfi
3261a30de1fSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3271a30de1fSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3281a30de1fSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329a733a5bfSmrgAC_SUBST([am__nodep])dnl
330a733a5bfSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3311a30de1fSmrg])
3321a30de1fSmrg
3331a30de1fSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3341a30de1fSmrg
3351b983734Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
3361a30de1fSmrg#
3371a30de1fSmrg# This file is free software; the Free Software Foundation
3381a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
3391a30de1fSmrg# with or without modifications, as long as this notice is preserved.
3401a30de1fSmrg
3411a30de1fSmrg
3421a30de1fSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3431a30de1fSmrg# ------------------------------
3441a30de1fSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
345b7fb5eacSmrg[{
346a733a5bfSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
347b7fb5eacSmrg  # are listed without --file.  Let's play safe and only enable the eval
348b7fb5eacSmrg  # if we detect the quoting.
349b7fb5eacSmrg  case $CONFIG_FILES in
350b7fb5eacSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
351b7fb5eacSmrg  *)   set x $CONFIG_FILES ;;
352b7fb5eacSmrg  esac
353b7fb5eacSmrg  shift
354b7fb5eacSmrg  for mf
355b7fb5eacSmrg  do
356b7fb5eacSmrg    # Strip MF so we end up with the name of the file.
357b7fb5eacSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
358b7fb5eacSmrg    # Check whether this is an Automake generated Makefile or not.
359a733a5bfSmrg    # We used to match only the files named 'Makefile.in', but
360b7fb5eacSmrg    # some people rename them; so instead we look at the file content.
361b7fb5eacSmrg    # Grep'ing the first line is not enough: some people post-process
362b7fb5eacSmrg    # each Makefile.in and add a new line on top of each file to say so.
363b7fb5eacSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
364b7fb5eacSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
365b7fb5eacSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
366b7fb5eacSmrg      dirpart=`AS_DIRNAME("$mf")`
367b7fb5eacSmrg    else
368b7fb5eacSmrg      continue
369b7fb5eacSmrg    fi
370b7fb5eacSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
371a733a5bfSmrg    # from the Makefile without running 'make'.
372b7fb5eacSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
373b7fb5eacSmrg    test -z "$DEPDIR" && continue
374b7fb5eacSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
375a733a5bfSmrg    test -z "$am__include" && continue
376b7fb5eacSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
377b7fb5eacSmrg    # Find all dependency output files, they are included files with
378b7fb5eacSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379b7fb5eacSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380b7fb5eacSmrg    # expansion.
381b7fb5eacSmrg    for file in `sed -n "
382b7fb5eacSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383a733a5bfSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
384b7fb5eacSmrg      # Make sure the directory exists.
385b7fb5eacSmrg      test -f "$dirpart/$file" && continue
386b7fb5eacSmrg      fdir=`AS_DIRNAME(["$file"])`
387b7fb5eacSmrg      AS_MKDIR_P([$dirpart/$fdir])
388b7fb5eacSmrg      # echo "creating $dirpart/$file"
389b7fb5eacSmrg      echo '# dummy' > "$dirpart/$file"
390b7fb5eacSmrg    done
3911a30de1fSmrg  done
392b7fb5eacSmrg}
3931a30de1fSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3941a30de1fSmrg
3951a30de1fSmrg
3961a30de1fSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3971a30de1fSmrg# -----------------------------
3981a30de1fSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3991a30de1fSmrg#
4001a30de1fSmrg# This code is only required when automatic dependency tracking
401a733a5bfSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
4021a30de1fSmrg# need in order to bootstrap the dependency handling code.
4031a30de1fSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4041a30de1fSmrg[AC_CONFIG_COMMANDS([depfiles],
4051a30de1fSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4061a30de1fSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4071a30de1fSmrg])
4081a30de1fSmrg
4091a30de1fSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4101a30de1fSmrg
4111b983734Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4121a30de1fSmrg#
4131a30de1fSmrg# This file is free software; the Free Software Foundation
4141a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
4151a30de1fSmrg# with or without modifications, as long as this notice is preserved.
4161a30de1fSmrg
4171a30de1fSmrg# This macro actually does too much.  Some checks are only needed if
4181a30de1fSmrg# your package does certain things.  But this isn't really a big deal.
4191a30de1fSmrg
420a733a5bfSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
421a733a5bfSmrgm4_define([AC_PROG_CC],
422a733a5bfSmrgm4_defn([AC_PROG_CC])
423a733a5bfSmrg[_AM_PROG_CC_C_O
424a733a5bfSmrg])
425a733a5bfSmrg
4261a30de1fSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4271a30de1fSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4281a30de1fSmrg# -----------------------------------------------
4291a30de1fSmrg# The call with PACKAGE and VERSION arguments is the old style
4301a30de1fSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4311a30de1fSmrg# and VERSION should now be passed to AC_INIT and removed from
4321a30de1fSmrg# the call to AM_INIT_AUTOMAKE.
4331a30de1fSmrg# We support both call styles for the transition.  After
4341a30de1fSmrg# the next Automake release, Autoconf can make the AC_INIT
4351a30de1fSmrg# arguments mandatory, and then we can depend on a new Autoconf
4361a30de1fSmrg# release and drop the old call support.
4371a30de1fSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
438a733a5bfSmrg[AC_PREREQ([2.65])dnl
4391a30de1fSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4401a30de1fSmrgdnl the ones we care about.
4411a30de1fSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4421a30de1fSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4431a30de1fSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4441a30de1fSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4451a30de1fSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4461a30de1fSmrg  # is not polluted with repeated "-I."
4471a30de1fSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4481a30de1fSmrg  # test to see if srcdir already configured
4491a30de1fSmrg  if test -f $srcdir/config.status; then
4501a30de1fSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4511a30de1fSmrg  fi
4521a30de1fSmrgfi
4531a30de1fSmrg
4541a30de1fSmrg# test whether we have cygpath
4551a30de1fSmrgif test -z "$CYGPATH_W"; then
4561a30de1fSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4571a30de1fSmrg    CYGPATH_W='cygpath -w'
4581a30de1fSmrg  else
4591a30de1fSmrg    CYGPATH_W=echo
4601a30de1fSmrg  fi
4611a30de1fSmrgfi
4621a30de1fSmrgAC_SUBST([CYGPATH_W])
4631a30de1fSmrg
4641a30de1fSmrg# Define the identity of the package.
4651a30de1fSmrgdnl Distinguish between old-style and new-style calls.
4661a30de1fSmrgm4_ifval([$2],
467a733a5bfSmrg[AC_DIAGNOSE([obsolete],
468a733a5bfSmrg             [$0: two- and three-arguments forms are deprecated.])
469a733a5bfSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4701a30de1fSmrg AC_SUBST([PACKAGE], [$1])dnl
4711a30de1fSmrg AC_SUBST([VERSION], [$2])],
4721a30de1fSmrg[_AM_SET_OPTIONS([$1])dnl
4731a30de1fSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
474a733a5bfSmrgm4_if(
475a733a5bfSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
476a733a5bfSmrg  [ok:ok],,
4771a30de1fSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4781a30de1fSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4791a30de1fSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4801a30de1fSmrg
4811a30de1fSmrg_AM_IF_OPTION([no-define],,
482a733a5bfSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
483a733a5bfSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4841a30de1fSmrg
4851a30de1fSmrg# Some tools Automake needs.
4861a30de1fSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4871a30de1fSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
488a733a5bfSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
489a733a5bfSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
490a733a5bfSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
491a733a5bfSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
492a733a5bfSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
493b7fb5eacSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
494b7fb5eacSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
495a733a5bfSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
496a733a5bfSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
497a733a5bfSmrg# dies out for good.  For more background, see:
498a733a5bfSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
499a733a5bfSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
500a733a5bfSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
5011b983734Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
5021b983734Smrg# system "awk" is bad on some platforms.
5031a30de1fSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5041a30de1fSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5051a30de1fSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5061a30de1fSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
507b7fb5eacSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
508b7fb5eacSmrg			     [_AM_PROG_TAR([v7])])])
5091a30de1fSmrg_AM_IF_OPTION([no-dependencies],,
5101a30de1fSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
511a733a5bfSmrg		  [_AM_DEPENDENCIES([CC])],
512a733a5bfSmrg		  [m4_define([AC_PROG_CC],
513a733a5bfSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5141a30de1fSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
515a733a5bfSmrg		  [_AM_DEPENDENCIES([CXX])],
516a733a5bfSmrg		  [m4_define([AC_PROG_CXX],
517a733a5bfSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5181a30de1fSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
519a733a5bfSmrg		  [_AM_DEPENDENCIES([OBJC])],
520a733a5bfSmrg		  [m4_define([AC_PROG_OBJC],
521a733a5bfSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
522a733a5bfSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
523a733a5bfSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
524a733a5bfSmrg		  [m4_define([AC_PROG_OBJCXX],
525a733a5bfSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5261a30de1fSmrg])
527a733a5bfSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
528a733a5bfSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
529a733a5bfSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
530a733a5bfSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
531b7fb5eacSmrgAC_CONFIG_COMMANDS_PRE(dnl
532b7fb5eacSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
533b7fb5eacSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5341a30de1fSmrg
535a733a5bfSmrg# POSIX will say in a future version that running "rm -f" with no argument
536a733a5bfSmrg# is OK; and we want to be able to make that assumption in our Makefile
537a733a5bfSmrg# recipes.  So use an aggressive probe to check that the usage we want is
538a733a5bfSmrg# actually supported "in the wild" to an acceptable degree.
539a733a5bfSmrg# See automake bug#10828.
540a733a5bfSmrg# To make any issue more visible, cause the running configure to be aborted
541a733a5bfSmrg# by default if the 'rm' program in use doesn't match our expectations; the
542a733a5bfSmrg# user can still override this though.
543a733a5bfSmrgif rm -f && rm -fr && rm -rf; then : OK; else
544a733a5bfSmrg  cat >&2 <<'END'
545a733a5bfSmrgOops!
546a733a5bfSmrg
547a733a5bfSmrgYour 'rm' program seems unable to run without file operands specified
548a733a5bfSmrgon the command line, even when the '-f' option is present.  This is contrary
549a733a5bfSmrgto the behaviour of most rm programs out there, and not conforming with
550a733a5bfSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
551a733a5bfSmrg
552a733a5bfSmrgPlease tell bug-automake@gnu.org about your system, including the value
553a733a5bfSmrgof your $PATH and any error possibly output before this message.  This
554a733a5bfSmrgcan help us improve future automake versions.
555a733a5bfSmrg
556a733a5bfSmrgEND
557a733a5bfSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
558a733a5bfSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
559a733a5bfSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
560a733a5bfSmrg    echo >&2
561a733a5bfSmrg  else
562a733a5bfSmrg    cat >&2 <<'END'
563a733a5bfSmrgAborting the configuration process, to ensure you take notice of the issue.
564a733a5bfSmrg
565a733a5bfSmrgYou can download and install GNU coreutils to get an 'rm' implementation
566a733a5bfSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
567a733a5bfSmrg
568a733a5bfSmrgIf you want to complete the configuration process using your problematic
569a733a5bfSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
570a733a5bfSmrgto "yes", and re-run configure.
571a733a5bfSmrg
572a733a5bfSmrgEND
573a733a5bfSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
574a733a5bfSmrg  fi
5751b983734Smrgfi
5761b983734Smrgdnl The trailing newline in this macro's definition is deliberate, for
5771b983734Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5781b983734Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5791b983734Smrg])
580a733a5bfSmrg
581a733a5bfSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
582b7fb5eacSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
583b7fb5eacSmrgdnl mangled by Autoconf and run in a shell conditional statement.
584b7fb5eacSmrgm4_define([_AC_COMPILER_EXEEXT],
585b7fb5eacSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
586b7fb5eacSmrg
5871a30de1fSmrg# When config.status generates a header, we must update the stamp-h file.
5881a30de1fSmrg# This file resides in the same directory as the config header
5891a30de1fSmrg# that is generated.  The stamp files are numbered to have different names.
5901a30de1fSmrg
5911a30de1fSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5921a30de1fSmrg# loop where config.status creates the headers, so we can generate
5931a30de1fSmrg# our stamp files there.
5941a30de1fSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5951a30de1fSmrg[# Compute $1's index in $config_headers.
596b7fb5eacSmrg_am_arg=$1
5971a30de1fSmrg_am_stamp_count=1
5981a30de1fSmrgfor _am_header in $config_headers :; do
5991a30de1fSmrg  case $_am_header in
600b7fb5eacSmrg    $_am_arg | $_am_arg:* )
6011a30de1fSmrg      break ;;
6021a30de1fSmrg    * )
6031a30de1fSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6041a30de1fSmrg  esac
6051a30de1fSmrgdone
606b7fb5eacSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6071a30de1fSmrg
6081b983734Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6091a30de1fSmrg#
6101a30de1fSmrg# This file is free software; the Free Software Foundation
6111a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
6121a30de1fSmrg# with or without modifications, as long as this notice is preserved.
6131a30de1fSmrg
6141a30de1fSmrg# AM_PROG_INSTALL_SH
6151a30de1fSmrg# ------------------
6161a30de1fSmrg# Define $install_sh.
6171a30de1fSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6181a30de1fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6191b983734Smrgif test x"${install_sh+set}" != xset; then
620b7fb5eacSmrg  case $am_aux_dir in
621b7fb5eacSmrg  *\ * | *\	*)
622b7fb5eacSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
623b7fb5eacSmrg  *)
624b7fb5eacSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
625b7fb5eacSmrg  esac
626b7fb5eacSmrgfi
627a733a5bfSmrgAC_SUBST([install_sh])])
6281a30de1fSmrg
6291b983734Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
6301a30de1fSmrg#
6311a30de1fSmrg# This file is free software; the Free Software Foundation
6321a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
6331a30de1fSmrg# with or without modifications, as long as this notice is preserved.
6341a30de1fSmrg
6351a30de1fSmrg# Check whether the underlying file-system supports filenames
6361a30de1fSmrg# with a leading dot.  For instance MS-DOS doesn't.
6371a30de1fSmrgAC_DEFUN([AM_SET_LEADING_DOT],
6381a30de1fSmrg[rm -rf .tst 2>/dev/null
6391a30de1fSmrgmkdir .tst 2>/dev/null
6401a30de1fSmrgif test -d .tst; then
6411a30de1fSmrg  am__leading_dot=.
6421a30de1fSmrgelse
6431a30de1fSmrg  am__leading_dot=_
6441a30de1fSmrgfi
6451a30de1fSmrgrmdir .tst 2>/dev/null
6461a30de1fSmrgAC_SUBST([am__leading_dot])])
6471a30de1fSmrg
6481a30de1fSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6491a30de1fSmrg
6501b983734Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6511a30de1fSmrg#
6521a30de1fSmrg# This file is free software; the Free Software Foundation
6531a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
6541a30de1fSmrg# with or without modifications, as long as this notice is preserved.
6551a30de1fSmrg
6561a30de1fSmrg# AM_MAKE_INCLUDE()
6571a30de1fSmrg# -----------------
6581a30de1fSmrg# Check to see how make treats includes.
6591a30de1fSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6601a30de1fSmrg[am_make=${MAKE-make}
6611a30de1fSmrgcat > confinc << 'END'
6621a30de1fSmrgam__doit:
663b7fb5eacSmrg	@echo this is the am__doit target
6641a30de1fSmrg.PHONY: am__doit
6651a30de1fSmrgEND
6661a30de1fSmrg# If we don't find an include directive, just comment out the code.
6671a30de1fSmrgAC_MSG_CHECKING([for style of include used by $am_make])
6681a30de1fSmrgam__include="#"
6691a30de1fSmrgam__quote=
6701a30de1fSmrg_am_result=none
6711a30de1fSmrg# First try GNU make style include.
6721a30de1fSmrgecho "include confinc" > confmf
673a733a5bfSmrg# Ignore all kinds of additional output from 'make'.
674b7fb5eacSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
675b7fb5eacSmrg*the\ am__doit\ target*)
676b7fb5eacSmrg  am__include=include
677b7fb5eacSmrg  am__quote=
678b7fb5eacSmrg  _am_result=GNU
679b7fb5eacSmrg  ;;
680b7fb5eacSmrgesac
6811a30de1fSmrg# Now try BSD make style include.
6821a30de1fSmrgif test "$am__include" = "#"; then
6831a30de1fSmrg   echo '.include "confinc"' > confmf
684b7fb5eacSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
685b7fb5eacSmrg   *the\ am__doit\ target*)
686b7fb5eacSmrg     am__include=.include
687b7fb5eacSmrg     am__quote="\""
688b7fb5eacSmrg     _am_result=BSD
689b7fb5eacSmrg     ;;
690b7fb5eacSmrg   esac
6911a30de1fSmrgfi
6921a30de1fSmrgAC_SUBST([am__include])
6931a30de1fSmrgAC_SUBST([am__quote])
6941a30de1fSmrgAC_MSG_RESULT([$_am_result])
6951a30de1fSmrgrm -f confinc confmf
6961a30de1fSmrg])
6971a30de1fSmrg
6981a30de1fSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6991a30de1fSmrg
7001b983734Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
7011a30de1fSmrg#
7021a30de1fSmrg# This file is free software; the Free Software Foundation
7031a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
7041a30de1fSmrg# with or without modifications, as long as this notice is preserved.
7051a30de1fSmrg
7061a30de1fSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7071a30de1fSmrg# ------------------------------
7081a30de1fSmrgAC_DEFUN([AM_MISSING_PROG],
7091a30de1fSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7101a30de1fSmrg$1=${$1-"${am_missing_run}$2"}
7111a30de1fSmrgAC_SUBST($1)])
7121a30de1fSmrg
7131a30de1fSmrg# AM_MISSING_HAS_RUN
7141a30de1fSmrg# ------------------
715a733a5bfSmrg# Define MISSING if not defined so far and test if it is modern enough.
716a733a5bfSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7171a30de1fSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7181a30de1fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7191a30de1fSmrgAC_REQUIRE_AUX_FILE([missing])dnl
720b7fb5eacSmrgif test x"${MISSING+set}" != xset; then
721b7fb5eacSmrg  case $am_aux_dir in
722b7fb5eacSmrg  *\ * | *\	*)
723b7fb5eacSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
724b7fb5eacSmrg  *)
725b7fb5eacSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
726b7fb5eacSmrg  esac
727b7fb5eacSmrgfi
7281a30de1fSmrg# Use eval to expand $SHELL
729a733a5bfSmrgif eval "$MISSING --is-lightweight"; then
730a733a5bfSmrg  am_missing_run="$MISSING "
7311a30de1fSmrgelse
7321a30de1fSmrg  am_missing_run=
733a733a5bfSmrg  AC_MSG_WARN(['missing' script is too old or missing])
7341a30de1fSmrgfi
7351a30de1fSmrg])
7361a30de1fSmrg
7371a30de1fSmrg# Helper functions for option handling.                     -*- Autoconf -*-
7381a30de1fSmrg
7391b983734Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
7401a30de1fSmrg#
7411a30de1fSmrg# This file is free software; the Free Software Foundation
7421a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
7431a30de1fSmrg# with or without modifications, as long as this notice is preserved.
7441a30de1fSmrg
7451a30de1fSmrg# _AM_MANGLE_OPTION(NAME)
7461a30de1fSmrg# -----------------------
7471a30de1fSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7481a30de1fSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7491a30de1fSmrg
7501a30de1fSmrg# _AM_SET_OPTION(NAME)
751a733a5bfSmrg# --------------------
7521a30de1fSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7531a30de1fSmrgAC_DEFUN([_AM_SET_OPTION],
754a733a5bfSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7551a30de1fSmrg
7561a30de1fSmrg# _AM_SET_OPTIONS(OPTIONS)
757a733a5bfSmrg# ------------------------
7581a30de1fSmrg# OPTIONS is a space-separated list of Automake options.
7591a30de1fSmrgAC_DEFUN([_AM_SET_OPTIONS],
760b7fb5eacSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7611a30de1fSmrg
7621a30de1fSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7631a30de1fSmrg# -------------------------------------------
7641a30de1fSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7651a30de1fSmrgAC_DEFUN([_AM_IF_OPTION],
7661a30de1fSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7671a30de1fSmrg
7681b983734Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
769a733a5bfSmrg#
770a733a5bfSmrg# This file is free software; the Free Software Foundation
771a733a5bfSmrg# gives unlimited permission to copy and/or distribute it,
772a733a5bfSmrg# with or without modifications, as long as this notice is preserved.
773a733a5bfSmrg
774a733a5bfSmrg# _AM_PROG_CC_C_O
775a733a5bfSmrg# ---------------
776a733a5bfSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
777a733a5bfSmrg# to automatically call this.
778a733a5bfSmrgAC_DEFUN([_AM_PROG_CC_C_O],
779a733a5bfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
780a733a5bfSmrgAC_REQUIRE_AUX_FILE([compile])dnl
781a733a5bfSmrgAC_LANG_PUSH([C])dnl
782a733a5bfSmrgAC_CACHE_CHECK(
783a733a5bfSmrg  [whether $CC understands -c and -o together],
784a733a5bfSmrg  [am_cv_prog_cc_c_o],
785a733a5bfSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
786a733a5bfSmrg  # Make sure it works both with $CC and with simple cc.
787a733a5bfSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
788a733a5bfSmrg  # compilers refuse to overwrite an existing .o file with -o,
789a733a5bfSmrg  # though they will create one.
790a733a5bfSmrg  am_cv_prog_cc_c_o=yes
791a733a5bfSmrg  for am_i in 1 2; do
792a733a5bfSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
793a733a5bfSmrg         && test -f conftest2.$ac_objext; then
794a733a5bfSmrg      : OK
795a733a5bfSmrg    else
796a733a5bfSmrg      am_cv_prog_cc_c_o=no
797a733a5bfSmrg      break
798a733a5bfSmrg    fi
799a733a5bfSmrg  done
800a733a5bfSmrg  rm -f core conftest*
801a733a5bfSmrg  unset am_i])
802a733a5bfSmrgif test "$am_cv_prog_cc_c_o" != yes; then
803a733a5bfSmrg   # Losing compiler, so override with the script.
804a733a5bfSmrg   # FIXME: It is wrong to rewrite CC.
805a733a5bfSmrg   # But if we don't then we get into trouble of one sort or another.
806a733a5bfSmrg   # A longer-term fix would be to have automake use am__CC in this case,
807a733a5bfSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
808a733a5bfSmrg   CC="$am_aux_dir/compile $CC"
809a733a5bfSmrgfi
810a733a5bfSmrgAC_LANG_POP([C])])
811a733a5bfSmrg
812a733a5bfSmrg# For backward compatibility.
813a733a5bfSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8141a30de1fSmrg
8151b983734Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
8161a30de1fSmrg#
8171a30de1fSmrg# This file is free software; the Free Software Foundation
8181a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
8191a30de1fSmrg# with or without modifications, as long as this notice is preserved.
8201a30de1fSmrg
821a733a5bfSmrg# AM_RUN_LOG(COMMAND)
822a733a5bfSmrg# -------------------
823a733a5bfSmrg# Run COMMAND, save the exit status in ac_status, and log it.
824a733a5bfSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
825a733a5bfSmrgAC_DEFUN([AM_RUN_LOG],
826a733a5bfSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
827a733a5bfSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
828a733a5bfSmrg   ac_status=$?
829a733a5bfSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
830a733a5bfSmrg   (exit $ac_status); }])
831a733a5bfSmrg
832a733a5bfSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
833a733a5bfSmrg
8341b983734Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
835a733a5bfSmrg#
836a733a5bfSmrg# This file is free software; the Free Software Foundation
837a733a5bfSmrg# gives unlimited permission to copy and/or distribute it,
838a733a5bfSmrg# with or without modifications, as long as this notice is preserved.
8391a30de1fSmrg
8401a30de1fSmrg# AM_SANITY_CHECK
8411a30de1fSmrg# ---------------
8421a30de1fSmrgAC_DEFUN([AM_SANITY_CHECK],
8431a30de1fSmrg[AC_MSG_CHECKING([whether build environment is sane])
844b7fb5eacSmrg# Reject unsafe characters in $srcdir or the absolute working directory
845b7fb5eacSmrg# name.  Accept space and tab only in the latter.
846b7fb5eacSmrgam_lf='
847b7fb5eacSmrg'
848b7fb5eacSmrgcase `pwd` in
849b7fb5eacSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
850b7fb5eacSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
851b7fb5eacSmrgesac
852b7fb5eacSmrgcase $srcdir in
853b7fb5eacSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
854a733a5bfSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
855b7fb5eacSmrgesac
856b7fb5eacSmrg
857a733a5bfSmrg# Do 'set' in a subshell so we don't clobber the current shell's
8581a30de1fSmrg# arguments.  Must try -L first in case configure is actually a
8591a30de1fSmrg# symlink; some systems play weird games with the mod time of symlinks
8601a30de1fSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8611a30de1fSmrg# directory).
8621a30de1fSmrgif (
863a733a5bfSmrg   am_has_slept=no
864a733a5bfSmrg   for am_try in 1 2; do
865a733a5bfSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
866a733a5bfSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
867a733a5bfSmrg     if test "$[*]" = "X"; then
868a733a5bfSmrg	# -L didn't work.
869a733a5bfSmrg	set X `ls -t "$srcdir/configure" conftest.file`
870a733a5bfSmrg     fi
871a733a5bfSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
872a733a5bfSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
873a733a5bfSmrg
874a733a5bfSmrg	# If neither matched, then we have a broken ls.  This can happen
875a733a5bfSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
876a733a5bfSmrg	# broken ls alias from the environment.  This has actually
877a733a5bfSmrg	# happened.  Such a system could not be considered "sane".
878a733a5bfSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
879a733a5bfSmrg  alias in your environment])
880a733a5bfSmrg     fi
881a733a5bfSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
882a733a5bfSmrg       break
883a733a5bfSmrg     fi
884a733a5bfSmrg     # Just in case.
885a733a5bfSmrg     sleep 1
886a733a5bfSmrg     am_has_slept=yes
887a733a5bfSmrg   done
8881a30de1fSmrg   test "$[2]" = conftest.file
8891a30de1fSmrg   )
8901a30de1fSmrgthen
8911a30de1fSmrg   # Ok.
8921a30de1fSmrg   :
8931a30de1fSmrgelse
8941a30de1fSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
8951a30de1fSmrgCheck your system clock])
8961a30de1fSmrgfi
897a733a5bfSmrgAC_MSG_RESULT([yes])
898a733a5bfSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
899a733a5bfSmrg# generated files are strictly newer.
900a733a5bfSmrgam_sleep_pid=
901a733a5bfSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
902a733a5bfSmrg  ( sleep 1 ) &
903a733a5bfSmrg  am_sleep_pid=$!
904a733a5bfSmrgfi
905a733a5bfSmrgAC_CONFIG_COMMANDS_PRE(
906a733a5bfSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
907a733a5bfSmrg   if test -n "$am_sleep_pid"; then
908a733a5bfSmrg     # Hide warnings about reused PIDs.
909a733a5bfSmrg     wait $am_sleep_pid 2>/dev/null
910a733a5bfSmrg   fi
911a733a5bfSmrg   AC_MSG_RESULT([done])])
912a733a5bfSmrgrm -f conftest.file
913a733a5bfSmrg])
9141a30de1fSmrg
9151b983734Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
916b7fb5eacSmrg#
917b7fb5eacSmrg# This file is free software; the Free Software Foundation
918b7fb5eacSmrg# gives unlimited permission to copy and/or distribute it,
919b7fb5eacSmrg# with or without modifications, as long as this notice is preserved.
920b7fb5eacSmrg
921b7fb5eacSmrg# AM_SILENT_RULES([DEFAULT])
922b7fb5eacSmrg# --------------------------
923b7fb5eacSmrg# Enable less verbose build rules; with the default set to DEFAULT
924a733a5bfSmrg# ("yes" being less verbose, "no" or empty being verbose).
925b7fb5eacSmrgAC_DEFUN([AM_SILENT_RULES],
926a733a5bfSmrg[AC_ARG_ENABLE([silent-rules], [dnl
927a733a5bfSmrgAS_HELP_STRING(
928a733a5bfSmrg  [--enable-silent-rules],
929a733a5bfSmrg  [less verbose build output (undo: "make V=1")])
930a733a5bfSmrgAS_HELP_STRING(
931a733a5bfSmrg  [--disable-silent-rules],
932a733a5bfSmrg  [verbose build output (undo: "make V=0")])dnl
933a733a5bfSmrg])
934a733a5bfSmrgcase $enable_silent_rules in @%:@ (((
935a733a5bfSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
936a733a5bfSmrg   no) AM_DEFAULT_VERBOSITY=1;;
937a733a5bfSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
938b7fb5eacSmrgesac
939a733a5bfSmrgdnl
940a733a5bfSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
941a733a5bfSmrgdnl do not support nested variable expansions.
942a733a5bfSmrgdnl See automake bug#9928 and bug#10237.
943a733a5bfSmrgam_make=${MAKE-make}
944a733a5bfSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
945a733a5bfSmrg   [am_cv_make_support_nested_variables],
946a733a5bfSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
947a733a5bfSmrgBAR0=false
948a733a5bfSmrgBAR1=true
949a733a5bfSmrgV=1
950a733a5bfSmrgam__doit:
951a733a5bfSmrg	@$(TRUE)
952a733a5bfSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
953a733a5bfSmrg  am_cv_make_support_nested_variables=yes
954a733a5bfSmrgelse
955a733a5bfSmrg  am_cv_make_support_nested_variables=no
956a733a5bfSmrgfi])
957a733a5bfSmrgif test $am_cv_make_support_nested_variables = yes; then
958a733a5bfSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
959a733a5bfSmrg  AM_V='$(V)'
960a733a5bfSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
961a733a5bfSmrgelse
962a733a5bfSmrg  AM_V=$AM_DEFAULT_VERBOSITY
963a733a5bfSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
964a733a5bfSmrgfi
965a733a5bfSmrgAC_SUBST([AM_V])dnl
966a733a5bfSmrgAM_SUBST_NOTMAKE([AM_V])dnl
967a733a5bfSmrgAC_SUBST([AM_DEFAULT_V])dnl
968a733a5bfSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
969b7fb5eacSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
970b7fb5eacSmrgAM_BACKSLASH='\'
971b7fb5eacSmrgAC_SUBST([AM_BACKSLASH])dnl
972b7fb5eacSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
973b7fb5eacSmrg])
974b7fb5eacSmrg
9751b983734Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
9761a30de1fSmrg#
9771a30de1fSmrg# This file is free software; the Free Software Foundation
9781a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
9791a30de1fSmrg# with or without modifications, as long as this notice is preserved.
9801a30de1fSmrg
9811a30de1fSmrg# AM_PROG_INSTALL_STRIP
9821a30de1fSmrg# ---------------------
983a733a5bfSmrg# One issue with vendor 'install' (even GNU) is that you can't
9841a30de1fSmrg# specify the program used to strip binaries.  This is especially
9851a30de1fSmrg# annoying in cross-compiling environments, where the build's strip
9861a30de1fSmrg# is unlikely to handle the host's binaries.
9871a30de1fSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
988a733a5bfSmrg# always use install-sh in "make install-strip", and initialize
9891a30de1fSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
9901a30de1fSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9911a30de1fSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
992a733a5bfSmrg# Installed binaries are usually stripped using 'strip' when the user
993a733a5bfSmrg# run "make install-strip".  However 'strip' might not be the right
9941a30de1fSmrg# tool to use in cross-compilation environments, therefore Automake
995a733a5bfSmrg# will honor the 'STRIP' environment variable to overrule this program.
996a733a5bfSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9971a30de1fSmrgif test "$cross_compiling" != no; then
9981a30de1fSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
9991a30de1fSmrgfi
10001a30de1fSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
10011a30de1fSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10021a30de1fSmrg
10031b983734Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
10041a30de1fSmrg#
10051a30de1fSmrg# This file is free software; the Free Software Foundation
10061a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
10071a30de1fSmrg# with or without modifications, as long as this notice is preserved.
10081a30de1fSmrg
10091a30de1fSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10101a30de1fSmrg# ---------------------------
1011b7fb5eacSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10121a30de1fSmrg# This macro is traced by Automake.
10131a30de1fSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10141a30de1fSmrg
1015b7fb5eacSmrg# AM_SUBST_NOTMAKE(VARIABLE)
1016a733a5bfSmrg# --------------------------
1017b7fb5eacSmrg# Public sister of _AM_SUBST_NOTMAKE.
1018b7fb5eacSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1019b7fb5eacSmrg
10201a30de1fSmrg# Check how to create a tarball.                            -*- Autoconf -*-
10211a30de1fSmrg
10221b983734Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
10231a30de1fSmrg#
10241a30de1fSmrg# This file is free software; the Free Software Foundation
10251a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
10261a30de1fSmrg# with or without modifications, as long as this notice is preserved.
10271a30de1fSmrg
10281a30de1fSmrg# _AM_PROG_TAR(FORMAT)
10291a30de1fSmrg# --------------------
10301a30de1fSmrg# Check how to create a tarball in format FORMAT.
1031a733a5bfSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10321a30de1fSmrg#
10331a30de1fSmrg# Substitute a variable $(am__tar) that is a command
10341a30de1fSmrg# writing to stdout a FORMAT-tarball containing the directory
10351a30de1fSmrg# $tardir.
10361a30de1fSmrg#     tardir=directory && $(am__tar) > result.tar
10371a30de1fSmrg#
10381a30de1fSmrg# Substitute a variable $(am__untar) that extract such
10391a30de1fSmrg# a tarball read from stdin.
10401a30de1fSmrg#     $(am__untar) < result.tar
1041a733a5bfSmrg#
10421a30de1fSmrgAC_DEFUN([_AM_PROG_TAR],
1043a733a5bfSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1044a733a5bfSmrg# in the wild :-(  We should find a proper way to deprecate it ...
1045a733a5bfSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1046a733a5bfSmrg
1047a733a5bfSmrg# We'll loop over all known methods to create a tar archive until one works.
10481a30de1fSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10491a30de1fSmrg
1050a733a5bfSmrgm4_if([$1], [v7],
1051a733a5bfSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1052a733a5bfSmrg
1053a733a5bfSmrg  [m4_case([$1],
1054a733a5bfSmrg    [ustar],
1055a733a5bfSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1056a733a5bfSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1057a733a5bfSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1058a733a5bfSmrg      # and bug#13588).
1059a733a5bfSmrg      am_max_uid=2097151 # 2^21 - 1
1060a733a5bfSmrg      am_max_gid=$am_max_uid
1061a733a5bfSmrg      # The $UID and $GID variables are not portable, so we need to resort
1062a733a5bfSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1063a733a5bfSmrg      # below are definitely unexpected, so allow the users to see them
1064a733a5bfSmrg      # (that is, avoid stderr redirection).
1065a733a5bfSmrg      am_uid=`id -u || echo unknown`
1066a733a5bfSmrg      am_gid=`id -g || echo unknown`
1067a733a5bfSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1068a733a5bfSmrg      if test $am_uid -le $am_max_uid; then
1069a733a5bfSmrg         AC_MSG_RESULT([yes])
1070a733a5bfSmrg      else
1071a733a5bfSmrg         AC_MSG_RESULT([no])
1072a733a5bfSmrg         _am_tools=none
1073a733a5bfSmrg      fi
1074a733a5bfSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1075a733a5bfSmrg      if test $am_gid -le $am_max_gid; then
1076a733a5bfSmrg         AC_MSG_RESULT([yes])
1077a733a5bfSmrg      else
1078a733a5bfSmrg        AC_MSG_RESULT([no])
1079a733a5bfSmrg        _am_tools=none
1080a733a5bfSmrg      fi],
1081a733a5bfSmrg
1082a733a5bfSmrg  [pax],
1083a733a5bfSmrg    [],
1084a733a5bfSmrg
1085a733a5bfSmrg  [m4_fatal([Unknown tar format])])
1086a733a5bfSmrg
1087a733a5bfSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1088a733a5bfSmrg
1089a733a5bfSmrg  # Go ahead even if we have the value already cached.  We do so because we
1090a733a5bfSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1091a733a5bfSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1092a733a5bfSmrg
1093a733a5bfSmrg  for _am_tool in $_am_tools; do
1094a733a5bfSmrg    case $_am_tool in
1095a733a5bfSmrg    gnutar)
1096a733a5bfSmrg      for _am_tar in tar gnutar gtar; do
1097a733a5bfSmrg        AM_RUN_LOG([$_am_tar --version]) && break
1098a733a5bfSmrg      done
1099a733a5bfSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1100a733a5bfSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1101a733a5bfSmrg      am__untar="$_am_tar -xf -"
1102a733a5bfSmrg      ;;
1103a733a5bfSmrg    plaintar)
1104a733a5bfSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1105a733a5bfSmrg      # ustar tarball either.
1106a733a5bfSmrg      (tar --version) >/dev/null 2>&1 && continue
1107a733a5bfSmrg      am__tar='tar chf - "$$tardir"'
1108a733a5bfSmrg      am__tar_='tar chf - "$tardir"'
1109a733a5bfSmrg      am__untar='tar xf -'
1110a733a5bfSmrg      ;;
1111a733a5bfSmrg    pax)
1112a733a5bfSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
1113a733a5bfSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
1114a733a5bfSmrg      am__untar='pax -r'
1115a733a5bfSmrg      ;;
1116a733a5bfSmrg    cpio)
1117a733a5bfSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1118a733a5bfSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1119a733a5bfSmrg      am__untar='cpio -i -H $1 -d'
1120a733a5bfSmrg      ;;
1121a733a5bfSmrg    none)
1122a733a5bfSmrg      am__tar=false
1123a733a5bfSmrg      am__tar_=false
1124a733a5bfSmrg      am__untar=false
1125a733a5bfSmrg      ;;
1126a733a5bfSmrg    esac
11271a30de1fSmrg
1128a733a5bfSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
1129a733a5bfSmrg    # and am__untar set.
1130a733a5bfSmrg    test -n "${am_cv_prog_tar_$1}" && break
1131a733a5bfSmrg
1132a733a5bfSmrg    # tar/untar a dummy directory, and stop if the command works.
1133a733a5bfSmrg    rm -rf conftest.dir
1134a733a5bfSmrg    mkdir conftest.dir
1135a733a5bfSmrg    echo GrepMe > conftest.dir/file
1136a733a5bfSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1137a733a5bfSmrg    rm -rf conftest.dir
1138a733a5bfSmrg    if test -s conftest.tar; then
1139a733a5bfSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
1140a733a5bfSmrg      AM_RUN_LOG([cat conftest.dir/file])
1141a733a5bfSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1142a733a5bfSmrg    fi
1143a733a5bfSmrg  done
11441a30de1fSmrg  rm -rf conftest.dir
11451a30de1fSmrg
1146a733a5bfSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1147a733a5bfSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1148a733a5bfSmrg
11491a30de1fSmrgAC_SUBST([am__tar])
11501a30de1fSmrgAC_SUBST([am__untar])
11511a30de1fSmrg]) # _AM_PROG_TAR
11521a30de1fSmrg
1153a733a5bfSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1154a733a5bfSmrg# 
1155a733a5bfSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11561a30de1fSmrg#
1157a733a5bfSmrg# This program is free software; you can redistribute it and/or modify
1158a733a5bfSmrg# it under the terms of the GNU General Public License as published by
1159a733a5bfSmrg# the Free Software Foundation; either version 2 of the License, or
1160a733a5bfSmrg# (at your option) any later version.
11611a30de1fSmrg#
1162a733a5bfSmrg# This program is distributed in the hope that it will be useful, but
1163a733a5bfSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1164a733a5bfSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1165a733a5bfSmrg# General Public License for more details.
11661a30de1fSmrg#
1167a733a5bfSmrg# You should have received a copy of the GNU General Public License
1168a733a5bfSmrg# along with this program; if not, write to the Free Software
1169a733a5bfSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
11701a30de1fSmrg#
1171a733a5bfSmrg# As a special exception to the GNU General Public License, if you
1172a733a5bfSmrg# distribute this file as part of a program that contains a
1173a733a5bfSmrg# configuration script generated by Autoconf, you may include it under
1174a733a5bfSmrg# the same distribution terms that you use for the rest of that program.
11751a30de1fSmrg
1176a733a5bfSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1177a733a5bfSmrg# ----------------------------------
1178a733a5bfSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1179a733a5bfSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1180a733a5bfSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1181a733a5bfSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1182a733a5bfSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1183a733a5bfSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
11841a30de1fSmrgfi
1185a733a5bfSmrgif test -n "$PKG_CONFIG"; then
1186a733a5bfSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1187a733a5bfSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1188a733a5bfSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
11891a30de1fSmrg		AC_MSG_RESULT([yes])
11901a30de1fSmrg	else
1191a733a5bfSmrg		AC_MSG_RESULT([no])
1192a733a5bfSmrg		PKG_CONFIG=""
11931a30de1fSmrg	fi
1194a733a5bfSmrg		
1195a733a5bfSmrgfi[]dnl
1196a733a5bfSmrg])# PKG_PROG_PKG_CONFIG
11971a30de1fSmrg
1198a733a5bfSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
11991a30de1fSmrg#
1200a733a5bfSmrg# Check to see whether a particular set of modules exists.  Similar
1201a733a5bfSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1202a733a5bfSmrg#
1203a733a5bfSmrg#
1204a733a5bfSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1205a733a5bfSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
1206a733a5bfSmrg# PKG_CHECK_EXISTS manually
1207a733a5bfSmrg# --------------------------------------------------------------
1208a733a5bfSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1209a733a5bfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1210a733a5bfSmrgif test -n "$PKG_CONFIG" && \
1211a733a5bfSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1212a733a5bfSmrg  m4_ifval([$2], [$2], [:])
1213a733a5bfSmrgm4_ifvaln([$3], [else
1214a733a5bfSmrg  $3])dnl
1215a733a5bfSmrgfi])
12161a30de1fSmrg
1217a733a5bfSmrg
1218a733a5bfSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1219a733a5bfSmrg# ---------------------------------------------
1220a733a5bfSmrgm4_define([_PKG_CONFIG],
1221a733a5bfSmrg[if test -n "$$1"; then
1222a733a5bfSmrg    pkg_cv_[]$1="$$1"
1223a733a5bfSmrg elif test -n "$PKG_CONFIG"; then
1224a733a5bfSmrg    PKG_CHECK_EXISTS([$3],
1225a733a5bfSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1226a733a5bfSmrg		     [pkg_failed=yes])
1227a733a5bfSmrg else
1228a733a5bfSmrg    pkg_failed=untried
1229a733a5bfSmrgfi[]dnl
1230a733a5bfSmrg])# _PKG_CONFIG
1231a733a5bfSmrg
1232a733a5bfSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1233a733a5bfSmrg# -----------------------------
1234a733a5bfSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1235a733a5bfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1236a733a5bfSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1237a733a5bfSmrg        _pkg_short_errors_supported=yes
1238a733a5bfSmrgelse
1239a733a5bfSmrg        _pkg_short_errors_supported=no
1240a733a5bfSmrgfi[]dnl
1241a733a5bfSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1242a733a5bfSmrg
1243a733a5bfSmrg
1244a733a5bfSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1245a733a5bfSmrg# [ACTION-IF-NOT-FOUND])
1246a733a5bfSmrg#
1247a733a5bfSmrg#
1248a733a5bfSmrg# Note that if there is a possibility the first call to
1249a733a5bfSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1250a733a5bfSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1251a733a5bfSmrg#
1252a733a5bfSmrg#
1253a733a5bfSmrg# --------------------------------------------------------------
1254a733a5bfSmrgAC_DEFUN([PKG_CHECK_MODULES],
1255a733a5bfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1256a733a5bfSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1257a733a5bfSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1258a733a5bfSmrg
1259a733a5bfSmrgpkg_failed=no
1260a733a5bfSmrgAC_MSG_CHECKING([for $1])
1261a733a5bfSmrg
1262a733a5bfSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1263a733a5bfSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1264a733a5bfSmrg
1265a733a5bfSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1266a733a5bfSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1267a733a5bfSmrgSee the pkg-config man page for more details.])
1268a733a5bfSmrg
1269a733a5bfSmrgif test $pkg_failed = yes; then
1270a733a5bfSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1271a733a5bfSmrg        if test $_pkg_short_errors_supported = yes; then
1272a733a5bfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1273a733a5bfSmrg        else 
1274a733a5bfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1275a733a5bfSmrg        fi
1276a733a5bfSmrg	# Put the nasty error message in config.log where it belongs
1277a733a5bfSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1278a733a5bfSmrg
1279a733a5bfSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1280a733a5bfSmrg[Package requirements ($2) were not met:
1281a733a5bfSmrg
1282a733a5bfSmrg$$1_PKG_ERRORS
1283a733a5bfSmrg
1284a733a5bfSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1285a733a5bfSmrginstalled software in a non-standard prefix.
1286a733a5bfSmrg
1287a733a5bfSmrg_PKG_TEXT
1288a733a5bfSmrg])],
1289a733a5bfSmrg		[AC_MSG_RESULT([no])
1290a733a5bfSmrg                $4])
1291a733a5bfSmrgelif test $pkg_failed = untried; then
1292a733a5bfSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1293a733a5bfSmrg[The pkg-config script could not be found or is too old.  Make sure it
1294a733a5bfSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1295a733a5bfSmrgpath to pkg-config.
1296a733a5bfSmrg
1297a733a5bfSmrg_PKG_TEXT
1298a733a5bfSmrg
1299a733a5bfSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1300a733a5bfSmrg		[$4])
1301a733a5bfSmrgelse
1302a733a5bfSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1303a733a5bfSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1304a733a5bfSmrg        AC_MSG_RESULT([yes])
1305a733a5bfSmrg	ifelse([$3], , :, [$3])
1306a733a5bfSmrgfi[]dnl
1307a733a5bfSmrg])# PKG_CHECK_MODULES
1308a733a5bfSmrg
1309a733a5bfSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1310a733a5bfSmrgdnl
1311a733a5bfSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1312a733a5bfSmrgdnl
1313a733a5bfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1314a733a5bfSmrgdnl copy of this software and associated documentation files (the "Software"),
1315a733a5bfSmrgdnl to deal in the Software without restriction, including without limitation
1316a733a5bfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1317a733a5bfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1318a733a5bfSmrgdnl Software is furnished to do so, subject to the following conditions:
1319a733a5bfSmrgdnl
1320a733a5bfSmrgdnl The above copyright notice and this permission notice (including the next
1321a733a5bfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1322a733a5bfSmrgdnl Software.
1323a733a5bfSmrgdnl
1324a733a5bfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1325a733a5bfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1326a733a5bfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1327a733a5bfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1328a733a5bfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1329a733a5bfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1330a733a5bfSmrgdnl DEALINGS IN THE SOFTWARE.
1331a733a5bfSmrg
1332a733a5bfSmrg# XORG_MACROS_VERSION(required-version)
1333a733a5bfSmrg# -------------------------------------
1334a733a5bfSmrg# Minimum version: 1.1.0
1335a733a5bfSmrg#
1336a733a5bfSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1337a733a5bfSmrg# your configure.ac with the minimum required version, such as:
1338a733a5bfSmrg# XORG_MACROS_VERSION(1.1)
1339a733a5bfSmrg#
1340a733a5bfSmrg# To ensure that this macro is defined, also add:
1341a733a5bfSmrg# m4_ifndef([XORG_MACROS_VERSION],
1342a733a5bfSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1343a733a5bfSmrg#
1344a733a5bfSmrg#
1345a733a5bfSmrg# See the "minimum version" comment for each macro you use to see what
1346a733a5bfSmrg# version you require.
1347a733a5bfSmrgm4_defun([XORG_MACROS_VERSION],[
13481b983734Smrgm4_define([vers_have], [1.19.0])
1349a733a5bfSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1350a733a5bfSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1351a733a5bfSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1352a733a5bfSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1353a733a5bfSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1354a733a5bfSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1355a733a5bfSmrgm4_undefine([vers_have])
1356a733a5bfSmrgm4_undefine([maj_have])
1357a733a5bfSmrgm4_undefine([maj_needed])
1358a733a5bfSmrg]) # XORG_MACROS_VERSION
1359a733a5bfSmrg
1360a733a5bfSmrg# XORG_PROG_RAWCPP()
1361a733a5bfSmrg# ------------------
1362a733a5bfSmrg# Minimum version: 1.0.0
1363a733a5bfSmrg#
1364a733a5bfSmrg# Find cpp program and necessary flags for use in pre-processing text files
1365a733a5bfSmrg# such as man pages and config files
1366a733a5bfSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1367a733a5bfSmrgAC_REQUIRE([AC_PROG_CPP])
1368a733a5bfSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
1369a733a5bfSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1370a733a5bfSmrg
1371a733a5bfSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1372a733a5bfSmrg# which is not the best choice for supporting other OS'es, but covers most
1373a733a5bfSmrg# of the ones we need for now.
1374a733a5bfSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1375a733a5bfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1376a733a5bfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1377a733a5bfSmrg	AC_MSG_RESULT([no])
1378a733a5bfSmrgelse
1379a733a5bfSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1380a733a5bfSmrg		RAWCPPFLAGS=-undef
1381a733a5bfSmrg		AC_MSG_RESULT([yes])
1382a733a5bfSmrg	# under Cygwin unix is still defined even with -undef
1383a733a5bfSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1384a733a5bfSmrg		RAWCPPFLAGS="-undef -ansi"
1385a733a5bfSmrg		AC_MSG_RESULT([yes, with -ansi])
1386a733a5bfSmrg	else
1387a733a5bfSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1388a733a5bfSmrg	fi
1389a733a5bfSmrgfi
1390a733a5bfSmrgrm -f conftest.$ac_ext
1391a733a5bfSmrg
1392a733a5bfSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1393a733a5bfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1394a733a5bfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1395a733a5bfSmrg	AC_MSG_RESULT([no])
1396a733a5bfSmrgelse
1397a733a5bfSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
13981b983734Smrg		TRADITIONALCPPFLAGS="-traditional"
1399a733a5bfSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1400a733a5bfSmrg		AC_MSG_RESULT([yes])
1401a733a5bfSmrg	else
1402a733a5bfSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1403a733a5bfSmrg	fi
1404a733a5bfSmrgfi
1405a733a5bfSmrgrm -f conftest.$ac_ext
1406a733a5bfSmrgAC_SUBST(RAWCPPFLAGS)
14071b983734SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1408a733a5bfSmrg]) # XORG_PROG_RAWCPP
1409a733a5bfSmrg
1410a733a5bfSmrg# XORG_MANPAGE_SECTIONS()
1411a733a5bfSmrg# -----------------------
1412a733a5bfSmrg# Minimum version: 1.0.0
1413a733a5bfSmrg#
1414a733a5bfSmrg# Determine which sections man pages go in for the different man page types
1415a733a5bfSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1416a733a5bfSmrg# Not sure if there's any better way than just hardcoding by OS name.
1417a733a5bfSmrg# Override default settings by setting environment variables
1418a733a5bfSmrg# Added MAN_SUBSTS in version 1.8
1419a733a5bfSmrg# Added AC_PROG_SED in version 1.8
1420a733a5bfSmrg
1421a733a5bfSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1422a733a5bfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1423a733a5bfSmrgAC_REQUIRE([AC_PROG_SED])
14241a30de1fSmrg
14251a30de1fSmrgif test x$APP_MAN_SUFFIX = x    ; then
14261a30de1fSmrg    APP_MAN_SUFFIX=1
14271a30de1fSmrgfi
14281a30de1fSmrgif test x$APP_MAN_DIR = x    ; then
14291a30de1fSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
14301a30de1fSmrgfi
14311a30de1fSmrg
14321a30de1fSmrgif test x$LIB_MAN_SUFFIX = x    ; then
14331a30de1fSmrg    LIB_MAN_SUFFIX=3
14341a30de1fSmrgfi
14351a30de1fSmrgif test x$LIB_MAN_DIR = x    ; then
14361a30de1fSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
14371a30de1fSmrgfi
14381a30de1fSmrg
14391a30de1fSmrgif test x$FILE_MAN_SUFFIX = x    ; then
14401a30de1fSmrg    case $host_os in
14411a30de1fSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
14421a30de1fSmrg	*)		FILE_MAN_SUFFIX=5  ;;
14431a30de1fSmrg    esac
14441a30de1fSmrgfi
14451a30de1fSmrgif test x$FILE_MAN_DIR = x    ; then
14461a30de1fSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
14471a30de1fSmrgfi
14481a30de1fSmrg
14491a30de1fSmrgif test x$MISC_MAN_SUFFIX = x    ; then
14501a30de1fSmrg    case $host_os in
14511a30de1fSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
14521a30de1fSmrg	*)		MISC_MAN_SUFFIX=7  ;;
14531a30de1fSmrg    esac
14541a30de1fSmrgfi
14551a30de1fSmrgif test x$MISC_MAN_DIR = x    ; then
14561a30de1fSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
14571a30de1fSmrgfi
14581a30de1fSmrg
14591a30de1fSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
14601a30de1fSmrg    case $host_os in
14611a30de1fSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
14621a30de1fSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
14631a30de1fSmrg    esac
14641a30de1fSmrgfi
14651a30de1fSmrgif test x$DRIVER_MAN_DIR = x    ; then
14661a30de1fSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
14671a30de1fSmrgfi
14681a30de1fSmrg
14691a30de1fSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
14701a30de1fSmrg    case $host_os in
14711a30de1fSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
14721a30de1fSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
14731a30de1fSmrg    esac
14741a30de1fSmrgfi
14751a30de1fSmrgif test x$ADMIN_MAN_DIR = x    ; then
14761a30de1fSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
14771a30de1fSmrgfi
14781a30de1fSmrg
14791a30de1fSmrg
14801a30de1fSmrgAC_SUBST([APP_MAN_SUFFIX])
14811a30de1fSmrgAC_SUBST([LIB_MAN_SUFFIX])
14821a30de1fSmrgAC_SUBST([FILE_MAN_SUFFIX])
14831a30de1fSmrgAC_SUBST([MISC_MAN_SUFFIX])
14841a30de1fSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
14851a30de1fSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
14861a30de1fSmrgAC_SUBST([APP_MAN_DIR])
14871a30de1fSmrgAC_SUBST([LIB_MAN_DIR])
14881a30de1fSmrgAC_SUBST([FILE_MAN_DIR])
14891a30de1fSmrgAC_SUBST([MISC_MAN_DIR])
14901a30de1fSmrgAC_SUBST([DRIVER_MAN_DIR])
14911a30de1fSmrgAC_SUBST([ADMIN_MAN_DIR])
1492ce62200cSmrg
1493ce62200cSmrgXORG_MAN_PAGE="X Version 11"
1494ce62200cSmrgAC_SUBST([XORG_MAN_PAGE])
1495ce62200cSmrgMAN_SUBSTS="\
1496ce62200cSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1497ce62200cSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1498ce62200cSmrg	-e 's|__xservername__|Xorg|g' \
1499ce62200cSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1500ce62200cSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1501ce62200cSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1502ce62200cSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1503ce62200cSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1504ce62200cSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1505ce62200cSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1506ce62200cSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1507ce62200cSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1508ce62200cSmrgAC_SUBST([MAN_SUBSTS])
1509ce62200cSmrg
15101a30de1fSmrg]) # XORG_MANPAGE_SECTIONS
15111a30de1fSmrg
1512ce62200cSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1513ce62200cSmrg# ------------------------
1514ce62200cSmrg# Minimum version: 1.7.0
1515ce62200cSmrg#
1516ce62200cSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1517ce62200cSmrg# provided by xorg-sgml-doctools, if installed.
1518ce62200cSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1519ce62200cSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1520ce62200cSmrgXORG_SGML_PATH=
1521ce62200cSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1522ce62200cSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1523ce62200cSmrg    [m4_ifval([$1],[:],
1524ce62200cSmrg        [if test x"$cross_compiling" != x"yes" ; then
1525ce62200cSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1526ce62200cSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1527ce62200cSmrg         fi])
1528ce62200cSmrg    ])
1529ce62200cSmrg
1530ce62200cSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1531ce62200cSmrg# the path and the name of the doc stylesheet
1532ce62200cSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1533ce62200cSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1534ce62200cSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1535ce62200cSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1536ce62200cSmrgelse
1537ce62200cSmrg   AC_MSG_RESULT([no])
1538ce62200cSmrgfi
1539ce62200cSmrg
1540ce62200cSmrgAC_SUBST(XORG_SGML_PATH)
1541ce62200cSmrgAC_SUBST(STYLESHEET_SRCDIR)
1542ce62200cSmrgAC_SUBST(XSL_STYLESHEET)
1543ce62200cSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1544ce62200cSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1545ce62200cSmrg
15461a30de1fSmrg# XORG_CHECK_LINUXDOC
15471a30de1fSmrg# -------------------
15481a30de1fSmrg# Minimum version: 1.0.0
15491a30de1fSmrg#
15501a30de1fSmrg# Defines the variable MAKE_TEXT if the necessary tools and
15511a30de1fSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
15521a30de1fSmrg# Whether or not the necessary tools and files are found can be checked
15531a30de1fSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
15541a30de1fSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1555ce62200cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1556ce62200cSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
15571a30de1fSmrg
15581a30de1fSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
15591a30de1fSmrg
1560ce62200cSmrgAC_MSG_CHECKING([whether to build documentation])
15611a30de1fSmrg
1562ce62200cSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
15631a30de1fSmrg   BUILDDOC=yes
15641a30de1fSmrgelse
15651a30de1fSmrg   BUILDDOC=no
15661a30de1fSmrgfi
15671a30de1fSmrg
15681a30de1fSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
15691a30de1fSmrg
15701a30de1fSmrgAC_MSG_RESULT([$BUILDDOC])
15711a30de1fSmrg
1572ce62200cSmrgAC_MSG_CHECKING([whether to build pdf documentation])
15731a30de1fSmrg
1574ce62200cSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
15751a30de1fSmrg   BUILDPDFDOC=yes
15761a30de1fSmrgelse
15771a30de1fSmrg   BUILDPDFDOC=no
15781a30de1fSmrgfi
15791a30de1fSmrg
15801a30de1fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
15811a30de1fSmrg
15821a30de1fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
15831a30de1fSmrg
1584ce62200cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
15851a30de1fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
15861a30de1fSmrgMAKE_PDF="$PS2PDF"
15871a30de1fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
15881a30de1fSmrg
15891a30de1fSmrgAC_SUBST(MAKE_TEXT)
15901a30de1fSmrgAC_SUBST(MAKE_PS)
15911a30de1fSmrgAC_SUBST(MAKE_PDF)
15921a30de1fSmrgAC_SUBST(MAKE_HTML)
15931a30de1fSmrg]) # XORG_CHECK_LINUXDOC
15941a30de1fSmrg
15951a30de1fSmrg# XORG_CHECK_DOCBOOK
15961a30de1fSmrg# -------------------
15971a30de1fSmrg# Minimum version: 1.0.0
15981a30de1fSmrg#
15991a30de1fSmrg# Checks for the ability to build output formats from SGML DocBook source.
16001a30de1fSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16011a30de1fSmrg# indicates whether the necessary tools and files are found and, if set,
16021a30de1fSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16031a30de1fSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1604ce62200cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1605ce62200cSmrg
16061a30de1fSmrgBUILDTXTDOC=no
16071a30de1fSmrgBUILDPDFDOC=no
16081a30de1fSmrgBUILDPSDOC=no
16091a30de1fSmrgBUILDHTMLDOC=no
16101a30de1fSmrg
16111a30de1fSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16121a30de1fSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16131a30de1fSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16141a30de1fSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
16151a30de1fSmrg
1616ce62200cSmrgAC_MSG_CHECKING([whether to build text documentation])
1617ce62200cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16181a30de1fSmrg   test x$BUILD_TXTDOC != xno; then
16191a30de1fSmrg	BUILDTXTDOC=yes
16201a30de1fSmrgfi
16211a30de1fSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16221a30de1fSmrgAC_MSG_RESULT([$BUILDTXTDOC])
16231a30de1fSmrg
1624ce62200cSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1625ce62200cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16261a30de1fSmrg   test x$BUILD_PDFDOC != xno; then
16271a30de1fSmrg	BUILDPDFDOC=yes
16281a30de1fSmrgfi
16291a30de1fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16301a30de1fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
16311a30de1fSmrg
1632ce62200cSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1633ce62200cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
16341a30de1fSmrg   test x$BUILD_PSDOC != xno; then
16351a30de1fSmrg	BUILDPSDOC=yes
16361a30de1fSmrgfi
16371a30de1fSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
16381a30de1fSmrgAC_MSG_RESULT([$BUILDPSDOC])
16391a30de1fSmrg
1640ce62200cSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1641ce62200cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
16421a30de1fSmrg   test x$BUILD_HTMLDOC != xno; then
16431a30de1fSmrg	BUILDHTMLDOC=yes
16441a30de1fSmrgfi
16451a30de1fSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
16461a30de1fSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
16471a30de1fSmrg
16481a30de1fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
16491a30de1fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
16501a30de1fSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
16511a30de1fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
16521a30de1fSmrg
16531a30de1fSmrgAC_SUBST(MAKE_TEXT)
16541a30de1fSmrgAC_SUBST(MAKE_PS)
16551a30de1fSmrgAC_SUBST(MAKE_PDF)
16561a30de1fSmrgAC_SUBST(MAKE_HTML)
16571a30de1fSmrg]) # XORG_CHECK_DOCBOOK
16581a30de1fSmrg
1659a733a5bfSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1660ce62200cSmrg# ----------------
1661ce62200cSmrg# Minimum version: 1.5.0
1662a733a5bfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1663ce62200cSmrg#
1664ce62200cSmrg# Documentation tools are not always available on all platforms and sometimes
1665ce62200cSmrg# not at the appropriate level. This macro enables a module to test for the
1666ce62200cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1667ce62200cSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1668a733a5bfSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1669a733a5bfSmrg# --with-xmlto assumes 'auto'.
1670ce62200cSmrg#
1671ce62200cSmrg# Interface to module:
1672ce62200cSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1673ce62200cSmrg# XMLTO:	returns the path of the xmlto program found
1674ce62200cSmrg#		returns the path set by the user in the environment
1675ce62200cSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1676ce62200cSmrg#		'no' user instructs the module not to use xmlto
1677ce62200cSmrg#
1678ce62200cSmrg# Added in version 1.10.0
1679ce62200cSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1680ce62200cSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1681ce62200cSmrg#
1682ce62200cSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1683ce62200cSmrg#
1684ce62200cSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1685ce62200cSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1686a733a5bfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1687ce62200cSmrgAC_ARG_WITH(xmlto,
1688ce62200cSmrg	AS_HELP_STRING([--with-xmlto],
1689a733a5bfSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1690a733a5bfSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1691a733a5bfSmrgm4_undefine([_defopt])
1692ce62200cSmrg
1693ce62200cSmrgif test "x$use_xmlto" = x"auto"; then
1694ce62200cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1695ce62200cSmrg   if test "x$XMLTO" = "x"; then
1696ce62200cSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1697ce62200cSmrg	have_xmlto=no
1698ce62200cSmrg   else
1699ce62200cSmrg        have_xmlto=yes
1700ce62200cSmrg   fi
1701ce62200cSmrgelif test "x$use_xmlto" = x"yes" ; then
1702ce62200cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1703ce62200cSmrg   if test "x$XMLTO" = "x"; then
1704ce62200cSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1705ce62200cSmrg   fi
1706ce62200cSmrg   have_xmlto=yes
1707ce62200cSmrgelif test "x$use_xmlto" = x"no" ; then
1708ce62200cSmrg   if test "x$XMLTO" != "x"; then
1709ce62200cSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1710ce62200cSmrg   fi
1711ce62200cSmrg   have_xmlto=no
1712ce62200cSmrgelse
1713ce62200cSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1714ce62200cSmrgfi
1715ce62200cSmrg
1716ce62200cSmrg# Test for a minimum version of xmlto, if provided.
1717ce62200cSmrgm4_ifval([$1],
1718ce62200cSmrg[if test "$have_xmlto" = yes; then
1719ce62200cSmrg    # scrape the xmlto version
1720ce62200cSmrg    AC_MSG_CHECKING([the xmlto version])
1721ce62200cSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1722ce62200cSmrg    AC_MSG_RESULT([$xmlto_version])
1723ce62200cSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1724ce62200cSmrg        [if test "x$use_xmlto" = xauto; then
1725ce62200cSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1726ce62200cSmrg            have_xmlto=no
1727ce62200cSmrg        else
1728ce62200cSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1729ce62200cSmrg        fi])
1730ce62200cSmrgfi])
1731ce62200cSmrg
1732ce62200cSmrg# Test for the ability of xmlto to generate a text target
1733ce62200cSmrghave_xmlto_text=no
1734ce62200cSmrgcat > conftest.xml << "EOF"
1735ce62200cSmrgEOF
1736ce62200cSmrgAS_IF([test "$have_xmlto" = yes],
1737ce62200cSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1738ce62200cSmrg             [have_xmlto_text=yes],
1739ce62200cSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1740ce62200cSmrgrm -f conftest.xml
1741ce62200cSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1742ce62200cSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1743ce62200cSmrg]) # XORG_WITH_XMLTO
1744ce62200cSmrg
1745a733a5bfSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1746a733a5bfSmrg# --------------------------------------------
1747a733a5bfSmrg# Minimum version: 1.12.0
1748a733a5bfSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1749a733a5bfSmrg#
1750a733a5bfSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1751a733a5bfSmrg# XML-based language used for the transformation of XML documents.
1752a733a5bfSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1753a733a5bfSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1754a733a5bfSmrg# The XSLT processor is often used as a standalone tool for transformations.
1755a733a5bfSmrg# It should not be assumed that this tool is used only to work with documnetation.
1756a733a5bfSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1757a733a5bfSmrg#
1758a733a5bfSmrg# Interface to module:
1759a733a5bfSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1760a733a5bfSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1761a733a5bfSmrg#		 returns the path set by the user in the environment
1762a733a5bfSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1763a733a5bfSmrg#		  'no' user instructs the module not to use xsltproc
1764a733a5bfSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1765a733a5bfSmrg#
1766a733a5bfSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1767a733a5bfSmrg#
1768a733a5bfSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1769a733a5bfSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1770a733a5bfSmrg# Preserves the interface, should it be implemented later
1771a733a5bfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1772a733a5bfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1773a733a5bfSmrgAC_ARG_WITH(xsltproc,
1774a733a5bfSmrg	AS_HELP_STRING([--with-xsltproc],
1775a733a5bfSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1776a733a5bfSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1777a733a5bfSmrgm4_undefine([_defopt])
1778a733a5bfSmrg
1779a733a5bfSmrgif test "x$use_xsltproc" = x"auto"; then
1780a733a5bfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1781a733a5bfSmrg   if test "x$XSLTPROC" = "x"; then
1782a733a5bfSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1783a733a5bfSmrg	have_xsltproc=no
1784a733a5bfSmrg   else
1785a733a5bfSmrg        have_xsltproc=yes
1786a733a5bfSmrg   fi
1787a733a5bfSmrgelif test "x$use_xsltproc" = x"yes" ; then
1788a733a5bfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1789a733a5bfSmrg   if test "x$XSLTPROC" = "x"; then
1790a733a5bfSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1791a733a5bfSmrg   fi
1792a733a5bfSmrg   have_xsltproc=yes
1793a733a5bfSmrgelif test "x$use_xsltproc" = x"no" ; then
1794a733a5bfSmrg   if test "x$XSLTPROC" != "x"; then
1795a733a5bfSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1796a733a5bfSmrg   fi
1797a733a5bfSmrg   have_xsltproc=no
1798a733a5bfSmrgelse
1799a733a5bfSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1800a733a5bfSmrgfi
1801a733a5bfSmrg
1802a733a5bfSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1803a733a5bfSmrg]) # XORG_WITH_XSLTPROC
1804a733a5bfSmrg
1805a733a5bfSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1806a733a5bfSmrg# ----------------------------------------
1807a733a5bfSmrg# Minimum version: 1.15.0
1808a733a5bfSmrg#
1809a733a5bfSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1810a733a5bfSmrg# scanning arbitrary text files, extracting information from those text files,
1811a733a5bfSmrg# and printing reports based on that information.
1812a733a5bfSmrg#
1813a733a5bfSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1814a733a5bfSmrg#
1815a733a5bfSmrg# Interface to module:
1816a733a5bfSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1817a733a5bfSmrg# PERL:	     returns the path of the perl program found
1818a733a5bfSmrg#	     returns the path set by the user in the environment
1819a733a5bfSmrg# --with-perl: 'yes' user instructs the module to use perl
1820a733a5bfSmrg#	       'no' user instructs the module not to use perl
1821a733a5bfSmrg# have_perl: returns yes if perl found in PATH or no
1822a733a5bfSmrg#
1823a733a5bfSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1824a733a5bfSmrg#
1825a733a5bfSmrgAC_DEFUN([XORG_WITH_PERL],[
1826a733a5bfSmrgAC_ARG_VAR([PERL], [Path to perl command])
1827a733a5bfSmrg# Preserves the interface, should it be implemented later
1828a733a5bfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1829a733a5bfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1830a733a5bfSmrgAC_ARG_WITH(perl,
1831a733a5bfSmrg	AS_HELP_STRING([--with-perl],
1832a733a5bfSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1833a733a5bfSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1834a733a5bfSmrgm4_undefine([_defopt])
1835a733a5bfSmrg
1836a733a5bfSmrgif test "x$use_perl" = x"auto"; then
1837a733a5bfSmrg   AC_PATH_PROG([PERL], [perl])
1838a733a5bfSmrg   if test "x$PERL" = "x"; then
1839a733a5bfSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1840a733a5bfSmrg	have_perl=no
1841a733a5bfSmrg   else
1842a733a5bfSmrg        have_perl=yes
1843a733a5bfSmrg   fi
1844a733a5bfSmrgelif test "x$use_perl" = x"yes" ; then
1845a733a5bfSmrg   AC_PATH_PROG([PERL], [perl])
1846a733a5bfSmrg   if test "x$PERL" = "x"; then
1847a733a5bfSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1848a733a5bfSmrg   fi
1849a733a5bfSmrg   have_perl=yes
1850a733a5bfSmrgelif test "x$use_perl" = x"no" ; then
1851a733a5bfSmrg   if test "x$PERL" != "x"; then
1852a733a5bfSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1853a733a5bfSmrg   fi
1854a733a5bfSmrg   have_perl=no
1855a733a5bfSmrgelse
1856a733a5bfSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1857a733a5bfSmrgfi
1858a733a5bfSmrg
1859a733a5bfSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1860a733a5bfSmrg]) # XORG_WITH_PERL
1861a733a5bfSmrg
1862a733a5bfSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1863ce62200cSmrg# ----------------
1864ce62200cSmrg# Minimum version: 1.5.0
1865a733a5bfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1866ce62200cSmrg#
1867ce62200cSmrg# Documentation tools are not always available on all platforms and sometimes
1868ce62200cSmrg# not at the appropriate level. This macro enables a module to test for the
1869ce62200cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1870ce62200cSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1871a733a5bfSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1872a733a5bfSmrg# --with-asciidoc assumes 'auto'.
1873ce62200cSmrg#
1874ce62200cSmrg# Interface to module:
1875ce62200cSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1876ce62200cSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1877ce62200cSmrg#		 returns the path set by the user in the environment
1878ce62200cSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1879ce62200cSmrg#		  'no' user instructs the module not to use asciidoc
1880ce62200cSmrg#
1881ce62200cSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1882ce62200cSmrg#
1883ce62200cSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1884ce62200cSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1885a733a5bfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1886ce62200cSmrgAC_ARG_WITH(asciidoc,
1887ce62200cSmrg	AS_HELP_STRING([--with-asciidoc],
1888a733a5bfSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1889a733a5bfSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1890a733a5bfSmrgm4_undefine([_defopt])
1891ce62200cSmrg
1892ce62200cSmrgif test "x$use_asciidoc" = x"auto"; then
1893ce62200cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1894ce62200cSmrg   if test "x$ASCIIDOC" = "x"; then
1895ce62200cSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1896ce62200cSmrg	have_asciidoc=no
1897ce62200cSmrg   else
1898ce62200cSmrg        have_asciidoc=yes
1899ce62200cSmrg   fi
1900ce62200cSmrgelif test "x$use_asciidoc" = x"yes" ; then
1901ce62200cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1902ce62200cSmrg   if test "x$ASCIIDOC" = "x"; then
1903ce62200cSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1904ce62200cSmrg   fi
1905ce62200cSmrg   have_asciidoc=yes
1906ce62200cSmrgelif test "x$use_asciidoc" = x"no" ; then
1907ce62200cSmrg   if test "x$ASCIIDOC" != "x"; then
1908ce62200cSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1909ce62200cSmrg   fi
1910ce62200cSmrg   have_asciidoc=no
1911ce62200cSmrgelse
1912ce62200cSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1913ce62200cSmrgfi
1914ce62200cSmrgm4_ifval([$1],
1915ce62200cSmrg[if test "$have_asciidoc" = yes; then
1916ce62200cSmrg    # scrape the asciidoc version
1917ce62200cSmrg    AC_MSG_CHECKING([the asciidoc version])
1918ce62200cSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1919ce62200cSmrg    AC_MSG_RESULT([$asciidoc_version])
1920ce62200cSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1921ce62200cSmrg        [if test "x$use_asciidoc" = xauto; then
1922ce62200cSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1923ce62200cSmrg            have_asciidoc=no
1924ce62200cSmrg        else
1925ce62200cSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1926ce62200cSmrg        fi])
1927ce62200cSmrgfi])
1928ce62200cSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1929ce62200cSmrg]) # XORG_WITH_ASCIIDOC
1930ce62200cSmrg
1931a733a5bfSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
19321b983734Smrg# -------------------------------------------
1933ce62200cSmrg# Minimum version: 1.5.0
1934a733a5bfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
19351b983734Smrg# Minimum version for optional DOT checking: 1.18.0
1936ce62200cSmrg#
1937ce62200cSmrg# Documentation tools are not always available on all platforms and sometimes
1938ce62200cSmrg# not at the appropriate level. This macro enables a module to test for the
1939ce62200cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1940ce62200cSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1941a733a5bfSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1942a733a5bfSmrg# --with-doxygen assumes 'auto'.
1943ce62200cSmrg#
1944ce62200cSmrg# Interface to module:
1945ce62200cSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1946ce62200cSmrg# DOXYGEN:	 returns the path of the doxygen program found
1947ce62200cSmrg#		 returns the path set by the user in the environment
1948ce62200cSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1949ce62200cSmrg#		  'no' user instructs the module not to use doxygen
1950ce62200cSmrg#
1951ce62200cSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1952ce62200cSmrg#
1953ce62200cSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1954ce62200cSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
19551b983734SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
1956a733a5bfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1957ce62200cSmrgAC_ARG_WITH(doxygen,
1958ce62200cSmrg	AS_HELP_STRING([--with-doxygen],
1959a733a5bfSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1960a733a5bfSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1961a733a5bfSmrgm4_undefine([_defopt])
1962ce62200cSmrg
1963ce62200cSmrgif test "x$use_doxygen" = x"auto"; then
1964ce62200cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1965ce62200cSmrg   if test "x$DOXYGEN" = "x"; then
1966ce62200cSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1967ce62200cSmrg	have_doxygen=no
1968ce62200cSmrg   else
1969ce62200cSmrg        have_doxygen=yes
1970ce62200cSmrg   fi
1971ce62200cSmrgelif test "x$use_doxygen" = x"yes" ; then
1972ce62200cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1973ce62200cSmrg   if test "x$DOXYGEN" = "x"; then
1974ce62200cSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1975ce62200cSmrg   fi
1976ce62200cSmrg   have_doxygen=yes
1977ce62200cSmrgelif test "x$use_doxygen" = x"no" ; then
1978ce62200cSmrg   if test "x$DOXYGEN" != "x"; then
1979ce62200cSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1980ce62200cSmrg   fi
1981ce62200cSmrg   have_doxygen=no
1982ce62200cSmrgelse
1983ce62200cSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1984ce62200cSmrgfi
1985ce62200cSmrgm4_ifval([$1],
1986ce62200cSmrg[if test "$have_doxygen" = yes; then
1987ce62200cSmrg    # scrape the doxygen version
1988ce62200cSmrg    AC_MSG_CHECKING([the doxygen version])
1989ce62200cSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1990ce62200cSmrg    AC_MSG_RESULT([$doxygen_version])
1991ce62200cSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1992ce62200cSmrg        [if test "x$use_doxygen" = xauto; then
1993ce62200cSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1994ce62200cSmrg            have_doxygen=no
1995ce62200cSmrg        else
1996ce62200cSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1997ce62200cSmrg        fi])
1998ce62200cSmrgfi])
19991b983734Smrg
20001b983734Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
20011b983734Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
20021b983734Smrgdnl 	HAVE_DOT = @HAVE_DOT@
20031b983734SmrgHAVE_DOT=no
20041b983734Smrgif test "x$have_doxygen" = "xyes"; then
20051b983734Smrg  AC_PATH_PROG([DOT], [dot])
20061b983734Smrg    if test "x$DOT" != "x"; then
20071b983734Smrg      HAVE_DOT=yes
20081b983734Smrg    fi
20091b983734Smrgfi
20101b983734Smrg
20111b983734SmrgAC_SUBST([HAVE_DOT])
20121b983734SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2013ce62200cSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2014ce62200cSmrg]) # XORG_WITH_DOXYGEN
2015ce62200cSmrg
2016a733a5bfSmrg# XORG_WITH_GROFF([DEFAULT])
2017ce62200cSmrg# ----------------
2018ce62200cSmrg# Minimum version: 1.6.0
2019a733a5bfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2020ce62200cSmrg#
2021ce62200cSmrg# Documentation tools are not always available on all platforms and sometimes
2022ce62200cSmrg# not at the appropriate level. This macro enables a module to test for the
2023ce62200cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2024ce62200cSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2025a733a5bfSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2026a733a5bfSmrg# --with-groff assumes 'auto'.
2027ce62200cSmrg#
2028ce62200cSmrg# Interface to module:
2029ce62200cSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2030ce62200cSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2031ce62200cSmrg# HAVE_GROFF_MS: the -ms macros package
2032ce62200cSmrg# GROFF:	 returns the path of the groff program found
2033ce62200cSmrg#		 returns the path set by the user in the environment
2034ce62200cSmrg# --with-groff:	 'yes' user instructs the module to use groff
2035ce62200cSmrg#		 'no' user instructs the module not to use groff
2036ce62200cSmrg#
2037ce62200cSmrg# Added in version 1.9.0:
2038ce62200cSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2039ce62200cSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2040ce62200cSmrg#		   psselect from the psutils package.
2041ce62200cSmrg#		   the ghostcript package. Refer to the grohtml man pages
2042ce62200cSmrg#
2043ce62200cSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2044ce62200cSmrg#
2045ce62200cSmrg# OS and distros often splits groff in a basic and full package, the former
2046ce62200cSmrg# having the groff program and the later having devices, fonts and macros
2047ce62200cSmrg# Checking for the groff executable is not enough.
2048ce62200cSmrg#
2049ce62200cSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2050ce62200cSmrg# unset HAVE_GROFF or GROFF env variables.
2051ce62200cSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2052ce62200cSmrg#
2053ce62200cSmrgAC_DEFUN([XORG_WITH_GROFF],[
2054ce62200cSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2055a733a5bfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2056ce62200cSmrgAC_ARG_WITH(groff,
2057ce62200cSmrg	AS_HELP_STRING([--with-groff],
2058a733a5bfSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2059a733a5bfSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2060a733a5bfSmrgm4_undefine([_defopt])
2061ce62200cSmrg
2062ce62200cSmrgif test "x$use_groff" = x"auto"; then
2063ce62200cSmrg   AC_PATH_PROG([GROFF], [groff])
2064ce62200cSmrg   if test "x$GROFF" = "x"; then
2065ce62200cSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2066ce62200cSmrg	have_groff=no
2067ce62200cSmrg   else
2068ce62200cSmrg        have_groff=yes
2069ce62200cSmrg   fi
2070ce62200cSmrgelif test "x$use_groff" = x"yes" ; then
2071ce62200cSmrg   AC_PATH_PROG([GROFF], [groff])
2072ce62200cSmrg   if test "x$GROFF" = "x"; then
2073ce62200cSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2074ce62200cSmrg   fi
2075ce62200cSmrg   have_groff=yes
2076ce62200cSmrgelif test "x$use_groff" = x"no" ; then
2077ce62200cSmrg   if test "x$GROFF" != "x"; then
2078ce62200cSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2079ce62200cSmrg   fi
2080ce62200cSmrg   have_groff=no
2081ce62200cSmrgelse
2082ce62200cSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2083ce62200cSmrgfi
2084ce62200cSmrg
2085ce62200cSmrg# We have groff, test for the presence of the macro packages
2086ce62200cSmrgif test "x$have_groff" = x"yes"; then
2087ce62200cSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2088ce62200cSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2089ce62200cSmrg        groff_ms_works=yes
2090ce62200cSmrg    else
2091ce62200cSmrg        groff_ms_works=no
2092ce62200cSmrg    fi
2093ce62200cSmrg    AC_MSG_RESULT([$groff_ms_works])
2094ce62200cSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2095ce62200cSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2096ce62200cSmrg        groff_mm_works=yes
2097ce62200cSmrg    else
2098ce62200cSmrg        groff_mm_works=no
2099ce62200cSmrg    fi
2100ce62200cSmrg    AC_MSG_RESULT([$groff_mm_works])
2101ce62200cSmrgfi
2102ce62200cSmrg
2103ce62200cSmrg# We have groff, test for HTML dependencies, one command per package
2104ce62200cSmrgif test "x$have_groff" = x"yes"; then
2105ce62200cSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2106ce62200cSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2107ce62200cSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2108ce62200cSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2109ce62200cSmrg      have_groff_html=yes
2110ce62200cSmrg   else
2111ce62200cSmrg      have_groff_html=no
2112ce62200cSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2113ce62200cSmrg   fi
2114ce62200cSmrgfi
2115ce62200cSmrg
2116ce62200cSmrg# Set Automake conditionals for Makefiles
2117ce62200cSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2118ce62200cSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2119ce62200cSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2120ce62200cSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2121ce62200cSmrg]) # XORG_WITH_GROFF
2122ce62200cSmrg
2123a733a5bfSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2124a733a5bfSmrg# ---------------------------------------
2125ce62200cSmrg# Minimum version: 1.6.0
2126a733a5bfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2127a733a5bfSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2128ce62200cSmrg#
2129ce62200cSmrg# Documentation tools are not always available on all platforms and sometimes
2130ce62200cSmrg# not at the appropriate level. This macro enables a module to test for the
2131ce62200cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2132ce62200cSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2133a733a5bfSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2134a733a5bfSmrg# --with-fop assumes 'auto'.
2135ce62200cSmrg#
2136ce62200cSmrg# Interface to module:
2137ce62200cSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2138ce62200cSmrg# FOP:	 	returns the path of the fop program found
2139ce62200cSmrg#		returns the path set by the user in the environment
2140ce62200cSmrg# --with-fop: 	'yes' user instructs the module to use fop
2141ce62200cSmrg#		'no' user instructs the module not to use fop
2142ce62200cSmrg#
2143ce62200cSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2144ce62200cSmrg#
2145ce62200cSmrgAC_DEFUN([XORG_WITH_FOP],[
2146ce62200cSmrgAC_ARG_VAR([FOP], [Path to fop command])
2147a733a5bfSmrgm4_define([_defopt], m4_default([$2], [auto]))
2148ce62200cSmrgAC_ARG_WITH(fop,
2149ce62200cSmrg	AS_HELP_STRING([--with-fop],
2150a733a5bfSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2151a733a5bfSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2152a733a5bfSmrgm4_undefine([_defopt])
2153ce62200cSmrg
2154ce62200cSmrgif test "x$use_fop" = x"auto"; then
2155ce62200cSmrg   AC_PATH_PROG([FOP], [fop])
2156ce62200cSmrg   if test "x$FOP" = "x"; then
2157ce62200cSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2158ce62200cSmrg	have_fop=no
2159ce62200cSmrg   else
2160ce62200cSmrg        have_fop=yes
2161ce62200cSmrg   fi
2162ce62200cSmrgelif test "x$use_fop" = x"yes" ; then
2163ce62200cSmrg   AC_PATH_PROG([FOP], [fop])
2164ce62200cSmrg   if test "x$FOP" = "x"; then
2165ce62200cSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2166ce62200cSmrg   fi
2167ce62200cSmrg   have_fop=yes
2168ce62200cSmrgelif test "x$use_fop" = x"no" ; then
2169ce62200cSmrg   if test "x$FOP" != "x"; then
2170ce62200cSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2171ce62200cSmrg   fi
2172ce62200cSmrg   have_fop=no
2173ce62200cSmrgelse
2174ce62200cSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2175ce62200cSmrgfi
2176a733a5bfSmrg
2177a733a5bfSmrg# Test for a minimum version of fop, if provided.
2178a733a5bfSmrgm4_ifval([$1],
2179a733a5bfSmrg[if test "$have_fop" = yes; then
2180a733a5bfSmrg    # scrape the fop version
2181a733a5bfSmrg    AC_MSG_CHECKING([for fop minimum version])
2182a733a5bfSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2183a733a5bfSmrg    AC_MSG_RESULT([$fop_version])
2184a733a5bfSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2185a733a5bfSmrg        [if test "x$use_fop" = xauto; then
2186a733a5bfSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2187a733a5bfSmrg            have_fop=no
2188a733a5bfSmrg        else
2189a733a5bfSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2190a733a5bfSmrg        fi])
2191a733a5bfSmrgfi])
2192ce62200cSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2193ce62200cSmrg]) # XORG_WITH_FOP
2194ce62200cSmrg
21951b983734Smrg# XORG_WITH_M4([MIN-VERSION])
21961b983734Smrg# ---------------------------
21971b983734Smrg# Minimum version: 1.19.0
21981b983734Smrg#
21991b983734Smrg# This macro attempts to locate an m4 macro processor which supports
22001b983734Smrg# -I option and is only useful for modules relying on M4 in order to
22011b983734Smrg# expand macros in source code files.
22021b983734Smrg#
22031b983734Smrg# Interface to module:
22041b983734Smrg# M4:	 	returns the path of the m4 program found
22051b983734Smrg#		returns the path set by the user in the environment
22061b983734Smrg#
22071b983734SmrgAC_DEFUN([XORG_WITH_M4], [
22081b983734SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
22091b983734Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
22101b983734Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
22111b983734Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
22121b983734Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
22131b983734Smrg   [$PATH:/usr/gnu/bin])])
22141b983734Smrg
22151b983734SmrgAC_SUBST([M4], [$ac_cv_path_M4])
22161b983734Smrg]) # XORG_WITH_M4
22171b983734Smrg
2218a733a5bfSmrg# XORG_WITH_PS2PDF([DEFAULT])
2219ce62200cSmrg# ----------------
2220ce62200cSmrg# Minimum version: 1.6.0
2221a733a5bfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2222ce62200cSmrg#
2223ce62200cSmrg# Documentation tools are not always available on all platforms and sometimes
2224ce62200cSmrg# not at the appropriate level. This macro enables a module to test for the
2225ce62200cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2226ce62200cSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2227a733a5bfSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2228a733a5bfSmrg# --with-ps2pdf assumes 'auto'.
2229ce62200cSmrg#
2230ce62200cSmrg# Interface to module:
2231ce62200cSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2232ce62200cSmrg# PS2PDF:	returns the path of the ps2pdf program found
2233ce62200cSmrg#		returns the path set by the user in the environment
2234ce62200cSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2235ce62200cSmrg#		 'no' user instructs the module not to use ps2pdf
2236ce62200cSmrg#
2237ce62200cSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2238ce62200cSmrg#
2239ce62200cSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2240ce62200cSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2241a733a5bfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2242ce62200cSmrgAC_ARG_WITH(ps2pdf,
2243ce62200cSmrg	AS_HELP_STRING([--with-ps2pdf],
2244a733a5bfSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2245a733a5bfSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2246a733a5bfSmrgm4_undefine([_defopt])
2247ce62200cSmrg
2248ce62200cSmrgif test "x$use_ps2pdf" = x"auto"; then
2249ce62200cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2250ce62200cSmrg   if test "x$PS2PDF" = "x"; then
2251ce62200cSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2252ce62200cSmrg	have_ps2pdf=no
2253ce62200cSmrg   else
2254ce62200cSmrg        have_ps2pdf=yes
2255ce62200cSmrg   fi
2256ce62200cSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2257ce62200cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2258ce62200cSmrg   if test "x$PS2PDF" = "x"; then
2259ce62200cSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2260ce62200cSmrg   fi
2261ce62200cSmrg   have_ps2pdf=yes
2262ce62200cSmrgelif test "x$use_ps2pdf" = x"no" ; then
2263ce62200cSmrg   if test "x$PS2PDF" != "x"; then
2264ce62200cSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2265ce62200cSmrg   fi
2266ce62200cSmrg   have_ps2pdf=no
2267ce62200cSmrgelse
2268ce62200cSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2269ce62200cSmrgfi
2270ce62200cSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2271ce62200cSmrg]) # XORG_WITH_PS2PDF
2272ce62200cSmrg
2273ce62200cSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2274ce62200cSmrg# ----------------
2275ce62200cSmrg# Minimum version: 1.6.0
2276ce62200cSmrg#
2277ce62200cSmrg# Documentation tools are not always available on all platforms and sometimes
2278ce62200cSmrg# not at the appropriate level. This macro enables a builder to skip all
2279ce62200cSmrg# documentation targets except traditional man pages.
2280ce62200cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2281ce62200cSmrg# maximum flexibilty in controlling documentation building.
2282ce62200cSmrg# Refer to:
2283ce62200cSmrg# XORG_WITH_XMLTO         --with-xmlto
2284ce62200cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2285ce62200cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2286ce62200cSmrg# XORG_WITH_FOP           --with-fop
2287ce62200cSmrg# XORG_WITH_GROFF         --with-groff
2288ce62200cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2289ce62200cSmrg#
2290ce62200cSmrg# Interface to module:
2291ce62200cSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2292ce62200cSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2293ce62200cSmrg#		 'no' user instructs the module not to generate docs
2294ce62200cSmrg# parm1:	specify the default value, yes or no.
2295ce62200cSmrg#
2296ce62200cSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2297a733a5bfSmrgm4_define([docs_default], m4_default([$1], [yes]))
2298ce62200cSmrgAC_ARG_ENABLE(docs,
2299ce62200cSmrg	AS_HELP_STRING([--enable-docs],
2300a733a5bfSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2301a733a5bfSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2302a733a5bfSmrgm4_undefine([docs_default])
2303ce62200cSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2304ce62200cSmrgAC_MSG_CHECKING([whether to build documentation])
2305ce62200cSmrgAC_MSG_RESULT([$build_docs])
2306ce62200cSmrg]) # XORG_ENABLE_DOCS
2307ce62200cSmrg
2308ce62200cSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2309ce62200cSmrg# ----------------
2310ce62200cSmrg# Minimum version: 1.6.0
2311ce62200cSmrg#
2312ce62200cSmrg# This macro enables a builder to skip all developer documentation.
2313ce62200cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2314ce62200cSmrg# maximum flexibilty in controlling documentation building.
2315ce62200cSmrg# Refer to:
2316ce62200cSmrg# XORG_WITH_XMLTO         --with-xmlto
2317ce62200cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2318ce62200cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2319ce62200cSmrg# XORG_WITH_FOP           --with-fop
2320ce62200cSmrg# XORG_WITH_GROFF         --with-groff
2321ce62200cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2322ce62200cSmrg#
2323ce62200cSmrg# Interface to module:
2324ce62200cSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2325ce62200cSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2326ce62200cSmrg#			'no' user instructs the module not to generate developer docs
2327ce62200cSmrg# parm1:		specify the default value, yes or no.
2328ce62200cSmrg#
2329ce62200cSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2330a733a5bfSmrgm4_define([devel_default], m4_default([$1], [yes]))
2331ce62200cSmrgAC_ARG_ENABLE(devel-docs,
2332ce62200cSmrg	AS_HELP_STRING([--enable-devel-docs],
2333a733a5bfSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2334a733a5bfSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2335a733a5bfSmrgm4_undefine([devel_default])
2336ce62200cSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2337ce62200cSmrgAC_MSG_CHECKING([whether to build developer documentation])
2338ce62200cSmrgAC_MSG_RESULT([$build_devel_docs])
2339ce62200cSmrg]) # XORG_ENABLE_DEVEL_DOCS
2340ce62200cSmrg
2341ce62200cSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2342ce62200cSmrg# ----------------
2343ce62200cSmrg# Minimum version: 1.6.0
2344ce62200cSmrg#
2345ce62200cSmrg# This macro enables a builder to skip all functional specification targets.
2346ce62200cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2347ce62200cSmrg# maximum flexibilty in controlling documentation building.
2348ce62200cSmrg# Refer to:
2349ce62200cSmrg# XORG_WITH_XMLTO         --with-xmlto
2350ce62200cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2351ce62200cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2352ce62200cSmrg# XORG_WITH_FOP           --with-fop
2353ce62200cSmrg# XORG_WITH_GROFF         --with-groff
2354ce62200cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2355ce62200cSmrg#
2356ce62200cSmrg# Interface to module:
2357ce62200cSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2358ce62200cSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2359ce62200cSmrg#			'no' user instructs the module not to generate specs
2360ce62200cSmrg# parm1:		specify the default value, yes or no.
2361ce62200cSmrg#
2362ce62200cSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2363a733a5bfSmrgm4_define([spec_default], m4_default([$1], [yes]))
2364ce62200cSmrgAC_ARG_ENABLE(specs,
2365ce62200cSmrg	AS_HELP_STRING([--enable-specs],
2366a733a5bfSmrg	   [Enable building the specs (default: ]spec_default[)]),
2367a733a5bfSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2368a733a5bfSmrgm4_undefine([spec_default])
2369ce62200cSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2370ce62200cSmrgAC_MSG_CHECKING([whether to build functional specifications])
2371ce62200cSmrgAC_MSG_RESULT([$build_specs])
2372ce62200cSmrg]) # XORG_ENABLE_SPECS
2373ce62200cSmrg
2374a733a5bfSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2375a733a5bfSmrg# ----------------------------------------------
2376a733a5bfSmrg# Minimum version: 1.13.0
2377a733a5bfSmrg#
2378a733a5bfSmrg# This macro enables a builder to enable/disable unit testing
2379a733a5bfSmrg# It makes no assumption about the test cases implementation
2380a733a5bfSmrg# Test cases may or may not use Automake "Support for test suites"
2381a733a5bfSmrg# They may or may not use the software utility library GLib
2382a733a5bfSmrg#
2383a733a5bfSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2384a733a5bfSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2385a733a5bfSmrg# The variable enable_unit_tests is used by other macros in this file.
2386a733a5bfSmrg#
2387a733a5bfSmrg# Interface to module:
2388a733a5bfSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2389a733a5bfSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2390a733a5bfSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2391a733a5bfSmrg#			'no' user instructs the module not to build tests
2392a733a5bfSmrg# parm1:		specify the default value, yes or no.
2393a733a5bfSmrg#
2394a733a5bfSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2395a733a5bfSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2396a733a5bfSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2397a733a5bfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2398a733a5bfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2399a733a5bfSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2400a733a5bfSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2401a733a5bfSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2402a733a5bfSmrgm4_undefine([_defopt])
2403a733a5bfSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2404a733a5bfSmrgAC_MSG_CHECKING([whether to build unit test cases])
2405a733a5bfSmrgAC_MSG_RESULT([$enable_unit_tests])
2406a733a5bfSmrg]) # XORG_ENABLE_UNIT_TESTS
2407a733a5bfSmrg
2408a733a5bfSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2409a733a5bfSmrg# ------------------------------------------------------
2410a733a5bfSmrg# Minimum version: 1.17.0
2411a733a5bfSmrg#
2412a733a5bfSmrg# This macro enables a builder to enable/disable integration testing
2413a733a5bfSmrg# It makes no assumption about the test cases' implementation
2414a733a5bfSmrg# Test cases may or may not use Automake "Support for test suites"
2415a733a5bfSmrg#
2416a733a5bfSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2417a733a5bfSmrg# usually requires less dependencies and may be built and run under less
2418a733a5bfSmrg# stringent environments than integration tests.
2419a733a5bfSmrg#
2420a733a5bfSmrg# Interface to module:
2421a733a5bfSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2422a733a5bfSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2423a733a5bfSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2424a733a5bfSmrg#                             'no' user instructs the module not to build tests
2425a733a5bfSmrg# parm1:                      specify the default value, yes or no.
2426a733a5bfSmrg#
2427a733a5bfSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2428a733a5bfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2429a733a5bfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2430a733a5bfSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2431a733a5bfSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2432a733a5bfSmrg	[enable_integration_tests=$enableval],
2433a733a5bfSmrg	[enable_integration_tests=]_defopt)
2434a733a5bfSmrgm4_undefine([_defopt])
2435a733a5bfSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2436a733a5bfSmrg	[test "x$enable_integration_tests" != xno])
2437a733a5bfSmrgAC_MSG_CHECKING([whether to build unit test cases])
2438a733a5bfSmrgAC_MSG_RESULT([$enable_integration_tests])
2439a733a5bfSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2440a733a5bfSmrg
2441a733a5bfSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2442a733a5bfSmrg# ----------------------------------------
2443a733a5bfSmrg# Minimum version: 1.13.0
2444a733a5bfSmrg#
2445a733a5bfSmrg# GLib is a library which provides advanced data structures and functions.
2446a733a5bfSmrg# This macro enables a module to test for the presence of Glib.
2447a733a5bfSmrg#
2448a733a5bfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2449a733a5bfSmrg# Otherwise the value of $enable_unit_tests is blank.
2450a733a5bfSmrg#
2451a733a5bfSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2452a733a5bfSmrg# test support usually requires less dependencies and may be built and run under
2453a733a5bfSmrg# less stringent environments than integration tests.
2454a733a5bfSmrg#
2455a733a5bfSmrg# Interface to module:
2456a733a5bfSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2457a733a5bfSmrg# with_glib: used in configure.ac to know if GLib has been found
2458a733a5bfSmrg# --with-glib:	'yes' user instructs the module to use glib
2459a733a5bfSmrg#		'no' user instructs the module not to use glib
2460a733a5bfSmrg#
2461a733a5bfSmrgAC_DEFUN([XORG_WITH_GLIB],[
2462a733a5bfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2463a733a5bfSmrgm4_define([_defopt], m4_default([$2], [auto]))
2464a733a5bfSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2465a733a5bfSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2466a733a5bfSmrg	[with_glib=$withval], [with_glib=]_defopt)
2467a733a5bfSmrgm4_undefine([_defopt])
2468a733a5bfSmrg
2469a733a5bfSmrghave_glib=no
2470a733a5bfSmrg# Do not probe GLib if user explicitly disabled unit testing
2471a733a5bfSmrgif test "x$enable_unit_tests" != x"no"; then
2472a733a5bfSmrg  # Do not probe GLib if user explicitly disabled it
2473a733a5bfSmrg  if test "x$with_glib" != x"no"; then
2474a733a5bfSmrg    m4_ifval(
2475a733a5bfSmrg      [$1],
2476a733a5bfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2477a733a5bfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2478a733a5bfSmrg    )
2479a733a5bfSmrg  fi
2480a733a5bfSmrgfi
2481a733a5bfSmrg
2482a733a5bfSmrg# Not having GLib when unit testing has been explicitly requested is an error
2483a733a5bfSmrgif test "x$enable_unit_tests" = x"yes"; then
2484a733a5bfSmrg  if test "x$have_glib" = x"no"; then
2485a733a5bfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2486a733a5bfSmrg  fi
2487a733a5bfSmrgfi
2488a733a5bfSmrg
2489a733a5bfSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2490a733a5bfSmrgif test "x$enable_unit_tests" = x"no"; then
2491a733a5bfSmrg  if test "x$with_glib" = x"yes"; then
2492a733a5bfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2493a733a5bfSmrg  fi
2494a733a5bfSmrgfi
2495a733a5bfSmrg
2496a733a5bfSmrg# Not having GLib when it has been explicitly requested is an error
2497a733a5bfSmrgif test "x$with_glib" = x"yes"; then
2498a733a5bfSmrg  if test "x$have_glib" = x"no"; then
2499a733a5bfSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2500a733a5bfSmrg  fi
2501a733a5bfSmrgfi
2502a733a5bfSmrg
2503a733a5bfSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2504a733a5bfSmrg]) # XORG_WITH_GLIB
2505a733a5bfSmrg
2506a733a5bfSmrg# XORG_LD_WRAP([required|optional])
2507a733a5bfSmrg# ---------------------------------
2508a733a5bfSmrg# Minimum version: 1.13.0
2509a733a5bfSmrg#
2510a733a5bfSmrg# Check if linker supports -wrap, passed via compiler flags
2511a733a5bfSmrg#
2512a733a5bfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2513a733a5bfSmrg# Otherwise the value of $enable_unit_tests is blank.
2514a733a5bfSmrg#
2515a733a5bfSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2516a733a5bfSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2517a733a5bfSmrg# available, an argument of "optional" allows use when some unit tests require
2518a733a5bfSmrg# ld -wrap and others do not.
2519a733a5bfSmrg#
2520a733a5bfSmrgAC_DEFUN([XORG_LD_WRAP],[
2521a733a5bfSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2522a733a5bfSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2523a733a5bfSmrg                      void __wrap_exit(int status) { return; }],
2524a733a5bfSmrg                     [exit(0);])])
2525a733a5bfSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2526a733a5bfSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2527a733a5bfSmrg  if test "x$have_ld_wrap" = x"no"; then
2528a733a5bfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2529a733a5bfSmrg  fi
2530a733a5bfSmrgfi
2531a733a5bfSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2532a733a5bfSmrg#
2533a733a5bfSmrg]) # XORG_LD_WRAP
2534a733a5bfSmrg
2535a733a5bfSmrg# XORG_CHECK_LINKER_FLAGS
2536a733a5bfSmrg# -----------------------
2537a733a5bfSmrg# SYNOPSIS
2538a733a5bfSmrg#
2539a733a5bfSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2540a733a5bfSmrg#
2541a733a5bfSmrg# DESCRIPTION
2542a733a5bfSmrg#
2543a733a5bfSmrg#   Check whether the given linker FLAGS work with the current language's
2544a733a5bfSmrg#   linker, or whether they give an error.
2545a733a5bfSmrg#
2546a733a5bfSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2547a733a5bfSmrg#   success/failure.
2548a733a5bfSmrg#
2549a733a5bfSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2550a733a5bfSmrg#
2551a733a5bfSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2552a733a5bfSmrg#
2553a733a5bfSmrg# LICENSE
2554a733a5bfSmrg#
2555a733a5bfSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2556a733a5bfSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2557a733a5bfSmrg#   Copyright (c) 2009 Matteo Frigo
2558a733a5bfSmrg#
2559a733a5bfSmrg#   This program is free software: you can redistribute it and/or modify it
2560a733a5bfSmrg#   under the terms of the GNU General Public License as published by the
2561a733a5bfSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2562a733a5bfSmrg#   option) any later version.
2563a733a5bfSmrg#
2564a733a5bfSmrg#   This program is distributed in the hope that it will be useful, but
2565a733a5bfSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2566a733a5bfSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2567a733a5bfSmrg#   Public License for more details.
2568a733a5bfSmrg#
2569a733a5bfSmrg#   You should have received a copy of the GNU General Public License along
2570a733a5bfSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2571a733a5bfSmrg#
2572a733a5bfSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2573a733a5bfSmrg#   gives unlimited permission to copy, distribute and modify the configure
2574a733a5bfSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2575a733a5bfSmrg#   need not follow the terms of the GNU General Public License when using
2576a733a5bfSmrg#   or distributing such scripts, even though portions of the text of the
2577a733a5bfSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2578a733a5bfSmrg#   all other use of the material that constitutes the Autoconf Macro.
2579a733a5bfSmrg#
2580a733a5bfSmrg#   This special exception to the GPL applies to versions of the Autoconf
2581a733a5bfSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2582a733a5bfSmrg#   modified version of the Autoconf Macro, you may extend this special
2583a733a5bfSmrg#   exception to the GPL to apply to your modified version as well.#
2584a733a5bfSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2585a733a5bfSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2586a733a5bfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2587a733a5bfSmrgAS_LITERAL_IF([$1],
2588a733a5bfSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2589a733a5bfSmrg      ax_save_FLAGS=$LDFLAGS
2590a733a5bfSmrg      LDFLAGS="$1"
2591a733a5bfSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2592a733a5bfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2593a733a5bfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2594a733a5bfSmrg      LDFLAGS=$ax_save_FLAGS])],
2595a733a5bfSmrg  [ax_save_FLAGS=$LDFLAGS
2596a733a5bfSmrg   LDFLAGS="$1"
2597a733a5bfSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2598a733a5bfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2599a733a5bfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2600a733a5bfSmrg   LDFLAGS=$ax_save_FLAGS])
2601a733a5bfSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2602a733a5bfSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2603a733a5bfSmrgif test "x$xorg_check_linker_flags" = xyes; then
2604a733a5bfSmrg	m4_default([$2], :)
2605a733a5bfSmrgelse
2606a733a5bfSmrg	m4_default([$3], :)
2607a733a5bfSmrgfi
2608a733a5bfSmrg]) # XORG_CHECK_LINKER_FLAGS
2609a733a5bfSmrg
2610a733a5bfSmrg# XORG_MEMORY_CHECK_FLAGS
2611a733a5bfSmrg# -----------------------
2612a733a5bfSmrg# Minimum version: 1.16.0
2613a733a5bfSmrg#
2614a733a5bfSmrg# This macro attempts to find appropriate memory checking functionality
2615a733a5bfSmrg# for various platforms which unit testing code may use to catch various
2616a733a5bfSmrg# forms of memory allocation and access errors in testing.
2617a733a5bfSmrg#
2618a733a5bfSmrg# Interface to module:
2619a733a5bfSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2620a733a5bfSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2621a733a5bfSmrg#
2622a733a5bfSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2623a733a5bfSmrg#
2624a733a5bfSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2625a733a5bfSmrg
2626a733a5bfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2627a733a5bfSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2628a733a5bfSmrg           [Environment variables to enable memory checking in tests])
2629a733a5bfSmrg
2630a733a5bfSmrg# Check for different types of support on different platforms
2631a733a5bfSmrgcase $host_os in
2632a733a5bfSmrg    solaris*)
2633a733a5bfSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2634a733a5bfSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2635a733a5bfSmrg        ;;
2636a733a5bfSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2637a733a5bfSmrg        # both directly and inverted, so should not be 0 or 255.
2638a733a5bfSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2639a733a5bfSmrg        ;;
2640a733a5bfSmrg    darwin*)
2641a733a5bfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2642a733a5bfSmrg        ;;
2643a733a5bfSmrg    *bsd*)
2644a733a5bfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2645a733a5bfSmrg        ;;
2646a733a5bfSmrgesac
2647a733a5bfSmrg
2648a733a5bfSmrg# User supplied flags override default flags
2649a733a5bfSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2650a733a5bfSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2651a733a5bfSmrgfi
2652a733a5bfSmrg
2653a733a5bfSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2654a733a5bfSmrg]) # XORG_WITH_LINT
2655a733a5bfSmrg
26561a30de1fSmrg# XORG_CHECK_MALLOC_ZERO
26571a30de1fSmrg# ----------------------
26581a30de1fSmrg# Minimum version: 1.0.0
26591a30de1fSmrg#
26601a30de1fSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
26611a30de1fSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
26621a30de1fSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
26631a30de1fSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
26641a30de1fSmrgAC_ARG_ENABLE(malloc0returnsnull,
2665b7fb5eacSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
26661a30de1fSmrg		       [malloc(0) returns NULL (default: auto)]),
26671a30de1fSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
26681a30de1fSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
26691a30de1fSmrg
26701a30de1fSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
26711a30de1fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
26721b983734SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
26731b983734Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2674a733a5bfSmrg#include <stdlib.h>
2675a733a5bfSmrg],[
26761a30de1fSmrg    char *m0, *r0, *c0, *p;
26771a30de1fSmrg    m0 = malloc(0);
26781a30de1fSmrg    p = malloc(10);
26791a30de1fSmrg    r0 = realloc(p,0);
2680a733a5bfSmrg    c0 = calloc(0,10);
2681a733a5bfSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2682a733a5bfSmrg])],
26831b983734Smrg		[xorg_cv_malloc0_returns_null=yes],
26841b983734Smrg		[xorg_cv_malloc0_returns_null=no])])
26851b983734SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
26861a30de1fSmrgfi
26871a30de1fSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
26881a30de1fSmrg
26891a30de1fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
26901a30de1fSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
26911a30de1fSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
26921a30de1fSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
26931a30de1fSmrgelse
26941a30de1fSmrg	MALLOC_ZERO_CFLAGS=""
26951a30de1fSmrg	XMALLOC_ZERO_CFLAGS=""
26961a30de1fSmrg	XTMALLOC_ZERO_CFLAGS=""
26971a30de1fSmrgfi
26981a30de1fSmrg
26991a30de1fSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
27001a30de1fSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
27011a30de1fSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
27021a30de1fSmrg]) # XORG_CHECK_MALLOC_ZERO
27031a30de1fSmrg
27041a30de1fSmrg# XORG_WITH_LINT()
27051a30de1fSmrg# ----------------
27061a30de1fSmrg# Minimum version: 1.1.0
27071a30de1fSmrg#
2708ce62200cSmrg# This macro enables the use of a tool that flags some suspicious and
2709ce62200cSmrg# non-portable constructs (likely to be bugs) in C language source code.
2710ce62200cSmrg# It will attempt to locate the tool and use appropriate options.
2711ce62200cSmrg# There are various lint type tools on different platforms.
2712ce62200cSmrg#
2713ce62200cSmrg# Interface to module:
2714ce62200cSmrg# LINT:		returns the path to the tool found on the platform
2715ce62200cSmrg#		or the value set to LINT on the configure cmd line
2716ce62200cSmrg#		also an Automake conditional
2717ce62200cSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2718ce62200cSmrg#
2719ce62200cSmrg# --with-lint:	'yes' user instructs the module to use lint
2720ce62200cSmrg#		'no' user instructs the module not to use lint (default)
2721ce62200cSmrg#
2722ce62200cSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2723ce62200cSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
27241a30de1fSmrg#
27251a30de1fSmrgAC_DEFUN([XORG_WITH_LINT],[
27261a30de1fSmrg
2727ce62200cSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2728ce62200cSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2729b7fb5eacSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27301a30de1fSmrg		[Use a lint-style source code checker (default: disabled)])],
27311a30de1fSmrg		[use_lint=$withval], [use_lint=no])
2732ce62200cSmrg
2733ce62200cSmrg# Obtain platform specific info like program name and options
2734ce62200cSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2735ce62200cSmrgcase $host_os in
2736ce62200cSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2737ce62200cSmrg	lint_name=splint
2738ce62200cSmrg	lint_options="-badflag"
2739ce62200cSmrg	;;
2740ce62200cSmrg  *freebsd* | *netbsd*)
2741ce62200cSmrg	lint_name=lint
2742ce62200cSmrg	lint_options="-u -b"
2743ce62200cSmrg	;;
2744ce62200cSmrg  *solaris*)
2745ce62200cSmrg	lint_name=lint
2746ce62200cSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2747ce62200cSmrg	;;
2748ce62200cSmrgesac
2749ce62200cSmrg
2750ce62200cSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2751ce62200cSmrgif test "x$use_lint" = x"yes" ; then
2752ce62200cSmrg   AC_PATH_PROG([LINT], [$lint_name])
2753ce62200cSmrg   if test "x$LINT" = "x"; then
2754ce62200cSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2755ce62200cSmrg   fi
2756ce62200cSmrgelif test "x$use_lint" = x"no" ; then
2757ce62200cSmrg   if test "x$LINT" != "x"; then
2758ce62200cSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2759ce62200cSmrg   fi
27601a30de1fSmrgelse
2761ce62200cSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
27621a30de1fSmrgfi
2763ce62200cSmrg
2764ce62200cSmrg# User supplied flags override default flags
2765ce62200cSmrgif test "x$LINT_FLAGS" != "x"; then
2766ce62200cSmrg   lint_options=$LINT_FLAGS
27671a30de1fSmrgfi
27681a30de1fSmrg
2769ce62200cSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2770ce62200cSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
27711a30de1fSmrg
27721a30de1fSmrg]) # XORG_WITH_LINT
27731a30de1fSmrg
27741a30de1fSmrg# XORG_LINT_LIBRARY(LIBNAME)
27751a30de1fSmrg# --------------------------
27761a30de1fSmrg# Minimum version: 1.1.0
27771a30de1fSmrg#
27781a30de1fSmrg# Sets up flags for building lint libraries for checking programs that call
27791a30de1fSmrg# functions in the library.
27801a30de1fSmrg#
2781ce62200cSmrg# Interface to module:
2782ce62200cSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2783ce62200cSmrg# MAKE_LINT_LIB		- Automake conditional
2784ce62200cSmrg#
2785ce62200cSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2786ce62200cSmrg#			  - 'no' user instructs the module not to create a lint library (default)
27871a30de1fSmrg
27881a30de1fSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
27891a30de1fSmrgAC_REQUIRE([XORG_WITH_LINT])
2790b7fb5eacSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
27911a30de1fSmrg	[Create lint library (default: disabled)])],
27921a30de1fSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2793ce62200cSmrg
2794ce62200cSmrgif test "x$make_lint_lib" = x"yes" ; then
2795ce62200cSmrg   LINTLIB=llib-l$1.ln
2796ce62200cSmrg   if test "x$LINT" = "x"; then
2797ce62200cSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2798ce62200cSmrg   fi
2799ce62200cSmrgelif test "x$make_lint_lib" != x"no" ; then
2800ce62200cSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
28011a30de1fSmrgfi
2802ce62200cSmrg
28031a30de1fSmrgAC_SUBST(LINTLIB)
28041a30de1fSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
28051a30de1fSmrg
28061a30de1fSmrg]) # XORG_LINT_LIBRARY
28071a30de1fSmrg
2808a733a5bfSmrg# XORG_COMPILER_BRAND
2809a733a5bfSmrg# -------------------
2810a733a5bfSmrg# Minimum version: 1.14.0
2811a733a5bfSmrg#
2812a733a5bfSmrg# Checks for various brands of compilers and sets flags as appropriate:
2813a733a5bfSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2814a733a5bfSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2815a733a5bfSmrg#   clang compiler - sets CLANGCC to "yes"
2816a733a5bfSmrg#   Intel compiler - sets INTELCC to "yes"
2817a733a5bfSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2818a733a5bfSmrg#
2819a733a5bfSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2820a733a5bfSmrgAC_LANG_CASE(
2821a733a5bfSmrg	[C], [
2822a733a5bfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2823a733a5bfSmrg	],
2824a733a5bfSmrg	[C++], [
2825a733a5bfSmrg		AC_REQUIRE([AC_PROG_CXX])
2826a733a5bfSmrg	]
2827a733a5bfSmrg)
2828a733a5bfSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2829a733a5bfSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2830a733a5bfSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2831a733a5bfSmrg]) # XORG_COMPILER_BRAND
2832a733a5bfSmrg
2833a733a5bfSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2834a733a5bfSmrg# ---------------
2835a733a5bfSmrg# Minimum version: 1.16.0
2836a733a5bfSmrg#
2837a733a5bfSmrg# Test if the compiler works when passed the given flag as a command line argument.
2838a733a5bfSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2839a733a5bfSmrg# next flag in the list until there are no more options.
2840a733a5bfSmrg#
2841a733a5bfSmrg# Note that this does not guarantee that the compiler supports the flag as some
2842a733a5bfSmrg# compilers will simply ignore arguments that they do not understand, but we do
2843a733a5bfSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2844a733a5bfSmrg# -Werror=unused-command-line-argument
2845a733a5bfSmrg#
2846a733a5bfSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2847a733a5bfSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2848a733a5bfSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2849a733a5bfSmrg
2850a733a5bfSmrgAC_LANG_COMPILER_REQUIRE
2851a733a5bfSmrg
2852a733a5bfSmrgAC_LANG_CASE(
2853a733a5bfSmrg	[C], [
2854a733a5bfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2855a733a5bfSmrg		define([PREFIX], [C])
2856a733a5bfSmrg		define([CACHE_PREFIX], [cc])
2857a733a5bfSmrg		define([COMPILER], [$CC])
2858a733a5bfSmrg	],
2859a733a5bfSmrg	[C++], [
2860a733a5bfSmrg		define([PREFIX], [CXX])
2861a733a5bfSmrg		define([CACHE_PREFIX], [cxx])
2862a733a5bfSmrg		define([COMPILER], [$CXX])
2863a733a5bfSmrg	]
2864a733a5bfSmrg)
2865a733a5bfSmrg
2866a733a5bfSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2867a733a5bfSmrg
2868a733a5bfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2869a733a5bfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2870a733a5bfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2871a733a5bfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2872a733a5bfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2873a733a5bfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2874a733a5bfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2875a733a5bfSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2876a733a5bfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2877a733a5bfSmrgfi
2878a733a5bfSmrg
2879a733a5bfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2880a733a5bfSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2881a733a5bfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2882a733a5bfSmrg	fi
2883a733a5bfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2884a733a5bfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2885a733a5bfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2886a733a5bfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2887a733a5bfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2888a733a5bfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2889a733a5bfSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2890a733a5bfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2891a733a5bfSmrgfi
2892a733a5bfSmrg
2893a733a5bfSmrgfound="no"
2894a733a5bfSmrgm4_foreach([flag], m4_cdr($@), [
2895a733a5bfSmrg	if test $found = "no" ; then
2896a733a5bfSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
2897a733a5bfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2898a733a5bfSmrg		fi
2899a733a5bfSmrg
2900a733a5bfSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
2901a733a5bfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2902a733a5bfSmrg		fi
2903a733a5bfSmrg
2904a733a5bfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2905a733a5bfSmrg
2906a733a5bfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2907a733a5bfSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2908a733a5bfSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2909a733a5bfSmrg		AC_CACHE_VAL($cacheid,
2910a733a5bfSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2911a733a5bfSmrg					     [eval $cacheid=yes],
2912a733a5bfSmrg					     [eval $cacheid=no])])
2913a733a5bfSmrg
2914a733a5bfSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2915a733a5bfSmrg
2916a733a5bfSmrg		eval supported=\$$cacheid
2917a733a5bfSmrg		AC_MSG_RESULT([$supported])
2918a733a5bfSmrg		if test "$supported" = "yes" ; then
2919a733a5bfSmrg			$1="$$1 ]flag["
2920a733a5bfSmrg			found="yes"
2921a733a5bfSmrg		fi
2922a733a5bfSmrg	fi
2923a733a5bfSmrg])
2924a733a5bfSmrg]) # XORG_TESTSET_CFLAG
2925a733a5bfSmrg
2926a733a5bfSmrg# XORG_COMPILER_FLAGS
2927a733a5bfSmrg# ---------------
2928a733a5bfSmrg# Minimum version: 1.16.0
2929a733a5bfSmrg#
2930a733a5bfSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2931a733a5bfSmrg# arguments supported by the selected compiler which do NOT alter the generated
2932a733a5bfSmrg# code.  These arguments will cause the compiler to print various warnings
2933a733a5bfSmrg# during compilation AND turn a conservative set of warnings into errors.
2934a733a5bfSmrg#
2935a733a5bfSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2936a733a5bfSmrg# future versions of util-macros as options are added to new compilers.
2937a733a5bfSmrg#
2938a733a5bfSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2939a733a5bfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2940a733a5bfSmrg
2941a733a5bfSmrgAC_ARG_ENABLE(selective-werror,
2942a733a5bfSmrg              AS_HELP_STRING([--disable-selective-werror],
2943a733a5bfSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2944a733a5bfSmrg              [SELECTIVE_WERROR=$enableval],
2945a733a5bfSmrg              [SELECTIVE_WERROR=yes])
2946a733a5bfSmrg
2947a733a5bfSmrgAC_LANG_CASE(
2948a733a5bfSmrg        [C], [
2949a733a5bfSmrg                define([PREFIX], [C])
2950a733a5bfSmrg        ],
2951a733a5bfSmrg        [C++], [
2952a733a5bfSmrg                define([PREFIX], [CXX])
2953a733a5bfSmrg        ]
2954a733a5bfSmrg)
2955a733a5bfSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2956a733a5bfSmrgif test "x$SUNCC" = "xyes"; then
2957a733a5bfSmrg    [BASE_]PREFIX[FLAGS]="-v"
2958a733a5bfSmrgelse
2959a733a5bfSmrg    [BASE_]PREFIX[FLAGS]=""
2960a733a5bfSmrgfi
2961a733a5bfSmrg
2962a733a5bfSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2963a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2964a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2965a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2966a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2967a733a5bfSmrg
2968a733a5bfSmrgAC_LANG_CASE(
2969a733a5bfSmrg	[C], [
2970a733a5bfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2971a733a5bfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2972a733a5bfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2973a733a5bfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
29741b983734Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
2975a733a5bfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2976a733a5bfSmrg	]
2977a733a5bfSmrg)
2978a733a5bfSmrg
2979a733a5bfSmrg# This chunk adds additional warnings that could catch undesired effects.
2980a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2981a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2982a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2983a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2984a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2985a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
29861b983734SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2987a733a5bfSmrg
2988a733a5bfSmrg# These are currently disabled because they are noisy.  They will be enabled
2989a733a5bfSmrg# in the future once the codebase is sufficiently modernized to silence
2990a733a5bfSmrg# them.  For now, I don't want them to drown out the other warnings.
2991a733a5bfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2992a733a5bfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
29931b983734Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2994a733a5bfSmrg
2995a733a5bfSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2996a733a5bfSmrg# when there are problems that should be fixed.
2997a733a5bfSmrg
2998a733a5bfSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2999a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3000a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3001a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3002a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3003a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3004a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3005a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3006a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3007a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3008a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3009a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3010a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3011a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3012a733a5bfSmrgelse
3013a733a5bfSmrgAC_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])
3014a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3015a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3016a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3017a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3018a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3019a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3020a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3021a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3022a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3023a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3024a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3025a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3026a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3027a733a5bfSmrgfi
3028a733a5bfSmrg
3029a733a5bfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3030a733a5bfSmrg]) # XORG_COMPILER_FLAGS
3031a733a5bfSmrg
3032b7fb5eacSmrg# XORG_CWARNFLAGS
3033b7fb5eacSmrg# ---------------
3034b7fb5eacSmrg# Minimum version: 1.2.0
3035a733a5bfSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3036b7fb5eacSmrg#
3037b7fb5eacSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3038b7fb5eacSmrg#
3039a733a5bfSmrg# This function is deprecated because it defines -fno-strict-aliasing
3040a733a5bfSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3041a733a5bfSmrg# is needed, then it should be added explicitly in the module when
3042a733a5bfSmrg# it is updated to use BASE_CFLAGS.
3043a733a5bfSmrg#
3044b7fb5eacSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3045a733a5bfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3046a733a5bfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3047a733a5bfSmrgAC_LANG_CASE(
3048a733a5bfSmrg	[C], [
3049a733a5bfSmrg		CWARNFLAGS="$BASE_CFLAGS"
3050a733a5bfSmrg		if  test "x$GCC" = xyes ; then
3051a733a5bfSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3052a733a5bfSmrg		fi
3053a733a5bfSmrg		AC_SUBST(CWARNFLAGS)
3054a733a5bfSmrg	]
3055a733a5bfSmrg)
3056b7fb5eacSmrg]) # XORG_CWARNFLAGS
3057b7fb5eacSmrg
3058b7fb5eacSmrg# XORG_STRICT_OPTION
3059b7fb5eacSmrg# -----------------------
3060b7fb5eacSmrg# Minimum version: 1.3.0
3061b7fb5eacSmrg#
3062a733a5bfSmrg# Add configure option to enable strict compilation flags, such as treating
3063a733a5bfSmrg# warnings as fatal errors.
3064a733a5bfSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3065a733a5bfSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3066a733a5bfSmrg#
3067a733a5bfSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3068a733a5bfSmrg# when strict compilation is unconditionally desired.
3069b7fb5eacSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3070b7fb5eacSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3071a733a5bfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3072b7fb5eacSmrg
3073b7fb5eacSmrgAC_ARG_ENABLE(strict-compilation,
3074b7fb5eacSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3075b7fb5eacSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3076b7fb5eacSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3077a733a5bfSmrg
3078a733a5bfSmrgAC_LANG_CASE(
3079a733a5bfSmrg        [C], [
3080a733a5bfSmrg                define([PREFIX], [C])
3081a733a5bfSmrg        ],
3082a733a5bfSmrg        [C++], [
3083a733a5bfSmrg                define([PREFIX], [CXX])
3084a733a5bfSmrg        ]
3085a733a5bfSmrg)
3086a733a5bfSmrg
3087a733a5bfSmrg[STRICT_]PREFIX[FLAGS]=""
3088a733a5bfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3089a733a5bfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3090a733a5bfSmrg
3091a733a5bfSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3092a733a5bfSmrg# activate it with -Werror, so we add it here explicitly.
3093a733a5bfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3094a733a5bfSmrg
3095b7fb5eacSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3096a733a5bfSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3097a733a5bfSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3098b7fb5eacSmrgfi
3099a733a5bfSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3100a733a5bfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3101a733a5bfSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3102b7fb5eacSmrg]) # XORG_STRICT_OPTION
3103b7fb5eacSmrg
3104b7fb5eacSmrg# XORG_DEFAULT_OPTIONS
3105b7fb5eacSmrg# --------------------
3106b7fb5eacSmrg# Minimum version: 1.3.0
3107b7fb5eacSmrg#
3108b7fb5eacSmrg# Defines default options for X.Org modules.
3109b7fb5eacSmrg#
3110b7fb5eacSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3111ce62200cSmrgAC_REQUIRE([AC_PROG_INSTALL])
3112a733a5bfSmrgXORG_COMPILER_FLAGS
3113b7fb5eacSmrgXORG_CWARNFLAGS
3114b7fb5eacSmrgXORG_STRICT_OPTION
3115b7fb5eacSmrgXORG_RELEASE_VERSION
3116b7fb5eacSmrgXORG_CHANGELOG
3117ce62200cSmrgXORG_INSTALL
3118b7fb5eacSmrgXORG_MANPAGE_SECTIONS
3119ce62200cSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3120ce62200cSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3121b7fb5eacSmrg]) # XORG_DEFAULT_OPTIONS
3122ce62200cSmrg
3123ce62200cSmrg# XORG_INSTALL()
3124ce62200cSmrg# ----------------
3125ce62200cSmrg# Minimum version: 1.4.0
3126ce62200cSmrg#
3127ce62200cSmrg# Defines the variable INSTALL_CMD as the command to copy
3128ce62200cSmrg# INSTALL from $prefix/share/util-macros.
3129ce62200cSmrg#
3130ce62200cSmrgAC_DEFUN([XORG_INSTALL], [
3131ce62200cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3132ce62200cSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3133ce62200cSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3134ce62200cSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3135ce62200cSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3136ce62200cSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3137ce62200cSmrgAC_SUBST([INSTALL_CMD])
3138ce62200cSmrg]) # XORG_INSTALL
31391a30de1fSmrgdnl Copyright 2005 Red Hat, Inc
31401a30de1fSmrgdnl
31411a30de1fSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
31421a30de1fSmrgdnl documentation for any purpose is hereby granted without fee, provided that
31431a30de1fSmrgdnl the above copyright notice appear in all copies and that both that
31441a30de1fSmrgdnl copyright notice and this permission notice appear in supporting
31451a30de1fSmrgdnl documentation.
31461a30de1fSmrgdnl
31471a30de1fSmrgdnl The above copyright notice and this permission notice shall be included
31481a30de1fSmrgdnl in all copies or substantial portions of the Software.
31491a30de1fSmrgdnl
31501a30de1fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31511a30de1fSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31521a30de1fSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31531a30de1fSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
31541a30de1fSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31551a30de1fSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31561a30de1fSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
31571a30de1fSmrgdnl
31581a30de1fSmrgdnl Except as contained in this notice, the name of the copyright holders shall
31591a30de1fSmrgdnl not be used in advertising or otherwise to promote the sale, use or
31601a30de1fSmrgdnl other dealings in this Software without prior written authorization
31611a30de1fSmrgdnl from the copyright holders.
31621a30de1fSmrgdnl
31631a30de1fSmrg
31641a30de1fSmrg# XORG_RELEASE_VERSION
31651a30de1fSmrg# --------------------
3166ce62200cSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3167a733a5bfSmrg
31681a30de1fSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
31691a30de1fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
31701a30de1fSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
31711a30de1fSmrg		[Major version of this package])
3172b7fb5eacSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
31731a30de1fSmrg	if test "x$PVM" = "x"; then
31741a30de1fSmrg		PVM="0"
31751a30de1fSmrg	fi
31761a30de1fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
31771a30de1fSmrg		[$PVM],
31781a30de1fSmrg		[Minor version of this package])
3179b7fb5eacSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
31801a30de1fSmrg	if test "x$PVP" = "x"; then
31811a30de1fSmrg		PVP="0"
31821a30de1fSmrg	fi
31831a30de1fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
31841a30de1fSmrg		[$PVP],
31851a30de1fSmrg		[Patch version of this package])
31861a30de1fSmrg])
31871a30de1fSmrg
3188b7fb5eacSmrg# XORG_CHANGELOG()
3189b7fb5eacSmrg# ----------------
3190b7fb5eacSmrg# Minimum version: 1.2.0
3191b7fb5eacSmrg#
3192b7fb5eacSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3193b7fb5eacSmrg# ChangeLog from git.
3194b7fb5eacSmrg#
3195b7fb5eacSmrg#
3196b7fb5eacSmrgAC_DEFUN([XORG_CHANGELOG], [
3197ce62200cSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3198ce62200cSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3199ce62200cSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3200b7fb5eacSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3201b7fb5eacSmrgAC_SUBST([CHANGELOG_CMD])
3202b7fb5eacSmrg]) # XORG_CHANGELOG
3203b7fb5eacSmrg
3204