aclocal.m4 revision a733a5bf
1a733a5bfSmrg# generated automatically by aclocal 1.14 -*- Autoconf -*-
2a733a5bfSmrg
3a733a5bfSmrg# Copyright (C) 1996-2013 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
17ce62200cSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
18ce62200cSmrg[m4_warning([this file was generated for autoconf 2.68.
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
23a733a5bfSmrg# Copyright (C) 2002-2013 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],
35a733a5bfSmrg[am__api_version='1.14'
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.
38a733a5bfSmrgm4_if([$1], [1.14], [],
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],
54a733a5bfSmrg[AM_AUTOMAKE_VERSION([1.14])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
61a733a5bfSmrg# Copyright (C) 2001-2013 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],
1061a30de1fSmrg[dnl Rely on autoconf to set up CDPATH properly.
1071a30de1fSmrgAC_PREREQ([2.50])dnl
1081a30de1fSmrg# expand $ac_aux_dir to an absolute path
1091a30de1fSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
1101a30de1fSmrg])
1111a30de1fSmrg
1121a30de1fSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1131a30de1fSmrg
114a733a5bfSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
1151a30de1fSmrg#
1161a30de1fSmrg# This file is free software; the Free Software Foundation
1171a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
1181a30de1fSmrg# with or without modifications, as long as this notice is preserved.
1191a30de1fSmrg
1201a30de1fSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1211a30de1fSmrg# -------------------------------------
1221a30de1fSmrg# Define a conditional.
1231a30de1fSmrgAC_DEFUN([AM_CONDITIONAL],
124a733a5bfSmrg[AC_PREREQ([2.52])dnl
125a733a5bfSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
126a733a5bfSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1271a30de1fSmrgAC_SUBST([$1_TRUE])dnl
1281a30de1fSmrgAC_SUBST([$1_FALSE])dnl
1291a30de1fSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1301a30de1fSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
131b7fb5eacSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1321a30de1fSmrgif $2; then
1331a30de1fSmrg  $1_TRUE=
1341a30de1fSmrg  $1_FALSE='#'
1351a30de1fSmrgelse
1361a30de1fSmrg  $1_TRUE='#'
1371a30de1fSmrg  $1_FALSE=
1381a30de1fSmrgfi
1391a30de1fSmrgAC_CONFIG_COMMANDS_PRE(
1401a30de1fSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1411a30de1fSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1421a30de1fSmrgUsually this means the macro was only invoked conditionally.]])
1431a30de1fSmrgfi])])
1441a30de1fSmrg
145a733a5bfSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
1461a30de1fSmrg#
1471a30de1fSmrg# This file is free software; the Free Software Foundation
1481a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
1491a30de1fSmrg# with or without modifications, as long as this notice is preserved.
1501a30de1fSmrg
1511a30de1fSmrg
152a733a5bfSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1531a30de1fSmrg# written in clear, in which case automake, when reading aclocal.m4,
1541a30de1fSmrg# will think it sees a *use*, and therefore will trigger all it's
1551a30de1fSmrg# C support machinery.  Also note that it means that autoscan, seeing
1561a30de1fSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1571a30de1fSmrg
1581a30de1fSmrg
1591a30de1fSmrg# _AM_DEPENDENCIES(NAME)
1601a30de1fSmrg# ----------------------
1611a30de1fSmrg# See how the compiler implements dependency checking.
162a733a5bfSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1631a30de1fSmrg# We try a few techniques and use that to set a single cache variable.
1641a30de1fSmrg#
1651a30de1fSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1661a30de1fSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1671a30de1fSmrg# dependency, and given that the user is not expected to run this macro,
1681a30de1fSmrg# just rely on AC_PROG_CC.
1691a30de1fSmrgAC_DEFUN([_AM_DEPENDENCIES],
1701a30de1fSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1711a30de1fSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1721a30de1fSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1731a30de1fSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1741a30de1fSmrg
175a733a5bfSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
176a733a5bfSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
177a733a5bfSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
178a733a5bfSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
179a733a5bfSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
180a733a5bfSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
181a733a5bfSmrg                    [depcc="$$1"   am_compiler_list=])
1821a30de1fSmrg
1831a30de1fSmrgAC_CACHE_CHECK([dependency style of $depcc],
1841a30de1fSmrg               [am_cv_$1_dependencies_compiler_type],
1851a30de1fSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1861a30de1fSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1871a30de1fSmrg  # making bogus files that we don't know about and never remove.  For
1881a30de1fSmrg  # instance it was reported that on HP-UX the gcc test will end up
189a733a5bfSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
190a733a5bfSmrg  # in D".
191a733a5bfSmrg  rm -rf conftest.dir
1921a30de1fSmrg  mkdir conftest.dir
1931a30de1fSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1941a30de1fSmrg  # using a relative directory.
1951a30de1fSmrg  cp "$am_depcomp" conftest.dir
1961a30de1fSmrg  cd conftest.dir
1971a30de1fSmrg  # We will build objects and dependencies in a subdirectory because
1981a30de1fSmrg  # it helps to detect inapplicable dependency modes.  For instance
1991a30de1fSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2001a30de1fSmrg  # side effect of compilation, but ICC will put the dependencies in
2011a30de1fSmrg  # the current directory while Tru64 will put them in the object
2021a30de1fSmrg  # directory.
2031a30de1fSmrg  mkdir sub
2041a30de1fSmrg
2051a30de1fSmrg  am_cv_$1_dependencies_compiler_type=none
2061a30de1fSmrg  if test "$am_compiler_list" = ""; then
2071a30de1fSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2081a30de1fSmrg  fi
209b7fb5eacSmrg  am__universal=false
210b7fb5eacSmrg  m4_case([$1], [CC],
211b7fb5eacSmrg    [case " $depcc " in #(
212b7fb5eacSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
213b7fb5eacSmrg     esac],
214b7fb5eacSmrg    [CXX],
215b7fb5eacSmrg    [case " $depcc " in #(
216b7fb5eacSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
217b7fb5eacSmrg     esac])
218b7fb5eacSmrg
2191a30de1fSmrg  for depmode in $am_compiler_list; do
2201a30de1fSmrg    # Setup a source with many dependencies, because some compilers
2211a30de1fSmrg    # like to wrap large dependency lists on column 80 (with \), and
2221a30de1fSmrg    # we should not choose a depcomp mode which is confused by this.
2231a30de1fSmrg    #
2241a30de1fSmrg    # We need to recreate these files for each test, as the compiler may
2251a30de1fSmrg    # overwrite some of them when testing with obscure command lines.
2261a30de1fSmrg    # This happens at least with the AIX C compiler.
2271a30de1fSmrg    : > sub/conftest.c
2281a30de1fSmrg    for i in 1 2 3 4 5 6; do
2291a30de1fSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
230a733a5bfSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
231a733a5bfSmrg      # Solaris 10 /bin/sh.
232a733a5bfSmrg      echo '/* dummy */' > sub/conftst$i.h
2331a30de1fSmrg    done
2341a30de1fSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2351a30de1fSmrg
236a733a5bfSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
237b7fb5eacSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
238a733a5bfSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
239a733a5bfSmrg    # versions had trouble with output in subdirs.
240b7fb5eacSmrg    am__obj=sub/conftest.${OBJEXT-o}
241b7fb5eacSmrg    am__minus_obj="-o $am__obj"
2421a30de1fSmrg    case $depmode in
243b7fb5eacSmrg    gcc)
244b7fb5eacSmrg      # This depmode causes a compiler race in universal mode.
245b7fb5eacSmrg      test "$am__universal" = false || continue
246b7fb5eacSmrg      ;;
2471a30de1fSmrg    nosideeffect)
248a733a5bfSmrg      # After this tag, mechanisms are not by side-effect, so they'll
249a733a5bfSmrg      # only be used when explicitly requested.
2501a30de1fSmrg      if test "x$enable_dependency_tracking" = xyes; then
2511a30de1fSmrg	continue
2521a30de1fSmrg      else
2531a30de1fSmrg	break
2541a30de1fSmrg      fi
2551a30de1fSmrg      ;;
256a733a5bfSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
257a733a5bfSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
258b7fb5eacSmrg      # not run yet.  These depmodes are late enough in the game, and
259b7fb5eacSmrg      # so weak that their functioning should not be impacted.
260b7fb5eacSmrg      am__obj=conftest.${OBJEXT-o}
261b7fb5eacSmrg      am__minus_obj=
262b7fb5eacSmrg      ;;
2631a30de1fSmrg    none) break ;;
2641a30de1fSmrg    esac
2651a30de1fSmrg    if depmode=$depmode \
266b7fb5eacSmrg       source=sub/conftest.c object=$am__obj \
2671a30de1fSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
268b7fb5eacSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2691a30de1fSmrg         >/dev/null 2>conftest.err &&
2701a30de1fSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2711a30de1fSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
272b7fb5eacSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2731a30de1fSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2741a30de1fSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2751a30de1fSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2761a30de1fSmrg      # that says an option was ignored or not supported.
2771a30de1fSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2781a30de1fSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2791a30de1fSmrg      # The diagnosis changed in icc 8.0:
2801a30de1fSmrg      #   icc: Command line remark: option '-MP' not supported
2811a30de1fSmrg      if (grep 'ignoring option' conftest.err ||
2821a30de1fSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2831a30de1fSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2841a30de1fSmrg        break
2851a30de1fSmrg      fi
2861a30de1fSmrg    fi
2871a30de1fSmrg  done
2881a30de1fSmrg
2891a30de1fSmrg  cd ..
2901a30de1fSmrg  rm -rf conftest.dir
2911a30de1fSmrgelse
2921a30de1fSmrg  am_cv_$1_dependencies_compiler_type=none
2931a30de1fSmrgfi
2941a30de1fSmrg])
2951a30de1fSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2961a30de1fSmrgAM_CONDITIONAL([am__fastdep$1], [
2971a30de1fSmrg  test "x$enable_dependency_tracking" != xno \
2981a30de1fSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2991a30de1fSmrg])
3001a30de1fSmrg
3011a30de1fSmrg
3021a30de1fSmrg# AM_SET_DEPDIR
3031a30de1fSmrg# -------------
3041a30de1fSmrg# Choose a directory name for dependency files.
305a733a5bfSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3061a30de1fSmrgAC_DEFUN([AM_SET_DEPDIR],
3071a30de1fSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3081a30de1fSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3091a30de1fSmrg])
3101a30de1fSmrg
3111a30de1fSmrg
3121a30de1fSmrg# AM_DEP_TRACK
3131a30de1fSmrg# ------------
3141a30de1fSmrgAC_DEFUN([AM_DEP_TRACK],
315a733a5bfSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
316a733a5bfSmrgAS_HELP_STRING(
317a733a5bfSmrg  [--enable-dependency-tracking],
318a733a5bfSmrg  [do not reject slow dependency extractors])
319a733a5bfSmrgAS_HELP_STRING(
320a733a5bfSmrg  [--disable-dependency-tracking],
321a733a5bfSmrg  [speeds up one-time build])])
3221a30de1fSmrgif test "x$enable_dependency_tracking" != xno; then
3231a30de1fSmrg  am_depcomp="$ac_aux_dir/depcomp"
3241a30de1fSmrg  AMDEPBACKSLASH='\'
325a733a5bfSmrg  am__nodep='_no'
3261a30de1fSmrgfi
3271a30de1fSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3281a30de1fSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3291a30de1fSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
330a733a5bfSmrgAC_SUBST([am__nodep])dnl
331a733a5bfSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3321a30de1fSmrg])
3331a30de1fSmrg
3341a30de1fSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3351a30de1fSmrg
336a733a5bfSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
3371a30de1fSmrg#
3381a30de1fSmrg# This file is free software; the Free Software Foundation
3391a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
3401a30de1fSmrg# with or without modifications, as long as this notice is preserved.
3411a30de1fSmrg
3421a30de1fSmrg
3431a30de1fSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3441a30de1fSmrg# ------------------------------
3451a30de1fSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
346b7fb5eacSmrg[{
347a733a5bfSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
348b7fb5eacSmrg  # are listed without --file.  Let's play safe and only enable the eval
349b7fb5eacSmrg  # if we detect the quoting.
350b7fb5eacSmrg  case $CONFIG_FILES in
351b7fb5eacSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
352b7fb5eacSmrg  *)   set x $CONFIG_FILES ;;
353b7fb5eacSmrg  esac
354b7fb5eacSmrg  shift
355b7fb5eacSmrg  for mf
356b7fb5eacSmrg  do
357b7fb5eacSmrg    # Strip MF so we end up with the name of the file.
358b7fb5eacSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
359b7fb5eacSmrg    # Check whether this is an Automake generated Makefile or not.
360a733a5bfSmrg    # We used to match only the files named 'Makefile.in', but
361b7fb5eacSmrg    # some people rename them; so instead we look at the file content.
362b7fb5eacSmrg    # Grep'ing the first line is not enough: some people post-process
363b7fb5eacSmrg    # each Makefile.in and add a new line on top of each file to say so.
364b7fb5eacSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
365b7fb5eacSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
366b7fb5eacSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
367b7fb5eacSmrg      dirpart=`AS_DIRNAME("$mf")`
368b7fb5eacSmrg    else
369b7fb5eacSmrg      continue
370b7fb5eacSmrg    fi
371b7fb5eacSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
372a733a5bfSmrg    # from the Makefile without running 'make'.
373b7fb5eacSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
374b7fb5eacSmrg    test -z "$DEPDIR" && continue
375b7fb5eacSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
376a733a5bfSmrg    test -z "$am__include" && continue
377b7fb5eacSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
378b7fb5eacSmrg    # Find all dependency output files, they are included files with
379b7fb5eacSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
380b7fb5eacSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
381b7fb5eacSmrg    # expansion.
382b7fb5eacSmrg    for file in `sed -n "
383b7fb5eacSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
384a733a5bfSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
385b7fb5eacSmrg      # Make sure the directory exists.
386b7fb5eacSmrg      test -f "$dirpart/$file" && continue
387b7fb5eacSmrg      fdir=`AS_DIRNAME(["$file"])`
388b7fb5eacSmrg      AS_MKDIR_P([$dirpart/$fdir])
389b7fb5eacSmrg      # echo "creating $dirpart/$file"
390b7fb5eacSmrg      echo '# dummy' > "$dirpart/$file"
391b7fb5eacSmrg    done
3921a30de1fSmrg  done
393b7fb5eacSmrg}
3941a30de1fSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3951a30de1fSmrg
3961a30de1fSmrg
3971a30de1fSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3981a30de1fSmrg# -----------------------------
3991a30de1fSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
4001a30de1fSmrg#
4011a30de1fSmrg# This code is only required when automatic dependency tracking
402a733a5bfSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
4031a30de1fSmrg# need in order to bootstrap the dependency handling code.
4041a30de1fSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4051a30de1fSmrg[AC_CONFIG_COMMANDS([depfiles],
4061a30de1fSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4071a30de1fSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4081a30de1fSmrg])
4091a30de1fSmrg
4101a30de1fSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4111a30de1fSmrg
412a733a5bfSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4131a30de1fSmrg#
4141a30de1fSmrg# This file is free software; the Free Software Foundation
4151a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
4161a30de1fSmrg# with or without modifications, as long as this notice is preserved.
4171a30de1fSmrg
4181a30de1fSmrg# This macro actually does too much.  Some checks are only needed if
4191a30de1fSmrg# your package does certain things.  But this isn't really a big deal.
4201a30de1fSmrg
421a733a5bfSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
422a733a5bfSmrgm4_define([AC_PROG_CC],
423a733a5bfSmrgm4_defn([AC_PROG_CC])
424a733a5bfSmrg[_AM_PROG_CC_C_O
425a733a5bfSmrg])
426a733a5bfSmrg
4271a30de1fSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4281a30de1fSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4291a30de1fSmrg# -----------------------------------------------
4301a30de1fSmrg# The call with PACKAGE and VERSION arguments is the old style
4311a30de1fSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4321a30de1fSmrg# and VERSION should now be passed to AC_INIT and removed from
4331a30de1fSmrg# the call to AM_INIT_AUTOMAKE.
4341a30de1fSmrg# We support both call styles for the transition.  After
4351a30de1fSmrg# the next Automake release, Autoconf can make the AC_INIT
4361a30de1fSmrg# arguments mandatory, and then we can depend on a new Autoconf
4371a30de1fSmrg# release and drop the old call support.
4381a30de1fSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
439a733a5bfSmrg[AC_PREREQ([2.65])dnl
4401a30de1fSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4411a30de1fSmrgdnl the ones we care about.
4421a30de1fSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4431a30de1fSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4441a30de1fSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4451a30de1fSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4461a30de1fSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4471a30de1fSmrg  # is not polluted with repeated "-I."
4481a30de1fSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4491a30de1fSmrg  # test to see if srcdir already configured
4501a30de1fSmrg  if test -f $srcdir/config.status; then
4511a30de1fSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4521a30de1fSmrg  fi
4531a30de1fSmrgfi
4541a30de1fSmrg
4551a30de1fSmrg# test whether we have cygpath
4561a30de1fSmrgif test -z "$CYGPATH_W"; then
4571a30de1fSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4581a30de1fSmrg    CYGPATH_W='cygpath -w'
4591a30de1fSmrg  else
4601a30de1fSmrg    CYGPATH_W=echo
4611a30de1fSmrg  fi
4621a30de1fSmrgfi
4631a30de1fSmrgAC_SUBST([CYGPATH_W])
4641a30de1fSmrg
4651a30de1fSmrg# Define the identity of the package.
4661a30de1fSmrgdnl Distinguish between old-style and new-style calls.
4671a30de1fSmrgm4_ifval([$2],
468a733a5bfSmrg[AC_DIAGNOSE([obsolete],
469a733a5bfSmrg             [$0: two- and three-arguments forms are deprecated.])
470a733a5bfSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4711a30de1fSmrg AC_SUBST([PACKAGE], [$1])dnl
4721a30de1fSmrg AC_SUBST([VERSION], [$2])],
4731a30de1fSmrg[_AM_SET_OPTIONS([$1])dnl
4741a30de1fSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
475a733a5bfSmrgm4_if(
476a733a5bfSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
477a733a5bfSmrg  [ok:ok],,
4781a30de1fSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4791a30de1fSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4801a30de1fSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4811a30de1fSmrg
4821a30de1fSmrg_AM_IF_OPTION([no-define],,
483a733a5bfSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
484a733a5bfSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4851a30de1fSmrg
4861a30de1fSmrg# Some tools Automake needs.
4871a30de1fSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4881a30de1fSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
489a733a5bfSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
490a733a5bfSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
491a733a5bfSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
492a733a5bfSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
493a733a5bfSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
494b7fb5eacSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
495b7fb5eacSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
496a733a5bfSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
497a733a5bfSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
498a733a5bfSmrg# dies out for good.  For more background, see:
499a733a5bfSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
500a733a5bfSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
501a733a5bfSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
5021a30de1fSmrg# We need awk for the "check" target.  The system "awk" is bad on
5031a30de1fSmrg# some platforms.
5041a30de1fSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5051a30de1fSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5061a30de1fSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5071a30de1fSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
508b7fb5eacSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
509b7fb5eacSmrg			     [_AM_PROG_TAR([v7])])])
5101a30de1fSmrg_AM_IF_OPTION([no-dependencies],,
5111a30de1fSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
512a733a5bfSmrg		  [_AM_DEPENDENCIES([CC])],
513a733a5bfSmrg		  [m4_define([AC_PROG_CC],
514a733a5bfSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5151a30de1fSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
516a733a5bfSmrg		  [_AM_DEPENDENCIES([CXX])],
517a733a5bfSmrg		  [m4_define([AC_PROG_CXX],
518a733a5bfSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5191a30de1fSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
520a733a5bfSmrg		  [_AM_DEPENDENCIES([OBJC])],
521a733a5bfSmrg		  [m4_define([AC_PROG_OBJC],
522a733a5bfSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
523a733a5bfSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
524a733a5bfSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
525a733a5bfSmrg		  [m4_define([AC_PROG_OBJCXX],
526a733a5bfSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5271a30de1fSmrg])
528a733a5bfSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
529a733a5bfSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
530a733a5bfSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
531a733a5bfSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
532b7fb5eacSmrgAC_CONFIG_COMMANDS_PRE(dnl
533b7fb5eacSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
534b7fb5eacSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5351a30de1fSmrg
536a733a5bfSmrg# POSIX will say in a future version that running "rm -f" with no argument
537a733a5bfSmrg# is OK; and we want to be able to make that assumption in our Makefile
538a733a5bfSmrg# recipes.  So use an aggressive probe to check that the usage we want is
539a733a5bfSmrg# actually supported "in the wild" to an acceptable degree.
540a733a5bfSmrg# See automake bug#10828.
541a733a5bfSmrg# To make any issue more visible, cause the running configure to be aborted
542a733a5bfSmrg# by default if the 'rm' program in use doesn't match our expectations; the
543a733a5bfSmrg# user can still override this though.
544a733a5bfSmrgif rm -f && rm -fr && rm -rf; then : OK; else
545a733a5bfSmrg  cat >&2 <<'END'
546a733a5bfSmrgOops!
547a733a5bfSmrg
548a733a5bfSmrgYour 'rm' program seems unable to run without file operands specified
549a733a5bfSmrgon the command line, even when the '-f' option is present.  This is contrary
550a733a5bfSmrgto the behaviour of most rm programs out there, and not conforming with
551a733a5bfSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
552a733a5bfSmrg
553a733a5bfSmrgPlease tell bug-automake@gnu.org about your system, including the value
554a733a5bfSmrgof your $PATH and any error possibly output before this message.  This
555a733a5bfSmrgcan help us improve future automake versions.
556a733a5bfSmrg
557a733a5bfSmrgEND
558a733a5bfSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
559a733a5bfSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
560a733a5bfSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
561a733a5bfSmrg    echo >&2
562a733a5bfSmrg  else
563a733a5bfSmrg    cat >&2 <<'END'
564a733a5bfSmrgAborting the configuration process, to ensure you take notice of the issue.
565a733a5bfSmrg
566a733a5bfSmrgYou can download and install GNU coreutils to get an 'rm' implementation
567a733a5bfSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
568a733a5bfSmrg
569a733a5bfSmrgIf you want to complete the configuration process using your problematic
570a733a5bfSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
571a733a5bfSmrgto "yes", and re-run configure.
572a733a5bfSmrg
573a733a5bfSmrgEND
574a733a5bfSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
575a733a5bfSmrg  fi
576a733a5bfSmrgfi])
577a733a5bfSmrg
578a733a5bfSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
579b7fb5eacSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
580b7fb5eacSmrgdnl mangled by Autoconf and run in a shell conditional statement.
581b7fb5eacSmrgm4_define([_AC_COMPILER_EXEEXT],
582b7fb5eacSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
583b7fb5eacSmrg
5841a30de1fSmrg# When config.status generates a header, we must update the stamp-h file.
5851a30de1fSmrg# This file resides in the same directory as the config header
5861a30de1fSmrg# that is generated.  The stamp files are numbered to have different names.
5871a30de1fSmrg
5881a30de1fSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5891a30de1fSmrg# loop where config.status creates the headers, so we can generate
5901a30de1fSmrg# our stamp files there.
5911a30de1fSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5921a30de1fSmrg[# Compute $1's index in $config_headers.
593b7fb5eacSmrg_am_arg=$1
5941a30de1fSmrg_am_stamp_count=1
5951a30de1fSmrgfor _am_header in $config_headers :; do
5961a30de1fSmrg  case $_am_header in
597b7fb5eacSmrg    $_am_arg | $_am_arg:* )
5981a30de1fSmrg      break ;;
5991a30de1fSmrg    * )
6001a30de1fSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6011a30de1fSmrg  esac
6021a30de1fSmrgdone
603b7fb5eacSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6041a30de1fSmrg
605a733a5bfSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6061a30de1fSmrg#
6071a30de1fSmrg# This file is free software; the Free Software Foundation
6081a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
6091a30de1fSmrg# with or without modifications, as long as this notice is preserved.
6101a30de1fSmrg
6111a30de1fSmrg# AM_PROG_INSTALL_SH
6121a30de1fSmrg# ------------------
6131a30de1fSmrg# Define $install_sh.
6141a30de1fSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6151a30de1fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
616b7fb5eacSmrgif test x"${install_sh}" != xset; then
617b7fb5eacSmrg  case $am_aux_dir in
618b7fb5eacSmrg  *\ * | *\	*)
619b7fb5eacSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
620b7fb5eacSmrg  *)
621b7fb5eacSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
622b7fb5eacSmrg  esac
623b7fb5eacSmrgfi
624a733a5bfSmrgAC_SUBST([install_sh])])
6251a30de1fSmrg
626a733a5bfSmrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
6271a30de1fSmrg#
6281a30de1fSmrg# This file is free software; the Free Software Foundation
6291a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
6301a30de1fSmrg# with or without modifications, as long as this notice is preserved.
6311a30de1fSmrg
6321a30de1fSmrg# Check whether the underlying file-system supports filenames
6331a30de1fSmrg# with a leading dot.  For instance MS-DOS doesn't.
6341a30de1fSmrgAC_DEFUN([AM_SET_LEADING_DOT],
6351a30de1fSmrg[rm -rf .tst 2>/dev/null
6361a30de1fSmrgmkdir .tst 2>/dev/null
6371a30de1fSmrgif test -d .tst; then
6381a30de1fSmrg  am__leading_dot=.
6391a30de1fSmrgelse
6401a30de1fSmrg  am__leading_dot=_
6411a30de1fSmrgfi
6421a30de1fSmrgrmdir .tst 2>/dev/null
6431a30de1fSmrgAC_SUBST([am__leading_dot])])
6441a30de1fSmrg
6451a30de1fSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
6461a30de1fSmrg# From Jim Meyering
6471a30de1fSmrg
648a733a5bfSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
6491a30de1fSmrg#
6501a30de1fSmrg# This file is free software; the Free Software Foundation
6511a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
6521a30de1fSmrg# with or without modifications, as long as this notice is preserved.
6531a30de1fSmrg
654b7fb5eacSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
655b7fb5eacSmrg# ----------------------------------
656b7fb5eacSmrg# Control maintainer-specific portions of Makefiles.
657a733a5bfSmrg# Default is to disable them, unless 'enable' is passed literally.
658a733a5bfSmrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
659b7fb5eacSmrg# can override the default with the --enable/--disable switch.
6601a30de1fSmrgAC_DEFUN([AM_MAINTAINER_MODE],
661b7fb5eacSmrg[m4_case(m4_default([$1], [disable]),
662b7fb5eacSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
663b7fb5eacSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
664b7fb5eacSmrg       [m4_define([am_maintainer_other], [enable])
665b7fb5eacSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
666a733a5bfSmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
667b7fb5eacSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
668b7fb5eacSmrg  AC_ARG_ENABLE([maintainer-mode],
669a733a5bfSmrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
670a733a5bfSmrg      am_maintainer_other[ make rules and dependencies not useful
671a733a5bfSmrg      (and sometimes confusing) to the casual installer])],
672a733a5bfSmrg    [USE_MAINTAINER_MODE=$enableval],
673a733a5bfSmrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6741a30de1fSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
675b7fb5eacSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6761a30de1fSmrg  MAINT=$MAINTAINER_MODE_TRUE
677b7fb5eacSmrg  AC_SUBST([MAINT])dnl
6781a30de1fSmrg]
6791a30de1fSmrg)
6801a30de1fSmrg
6811a30de1fSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6821a30de1fSmrg
683a733a5bfSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6841a30de1fSmrg#
6851a30de1fSmrg# This file is free software; the Free Software Foundation
6861a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
6871a30de1fSmrg# with or without modifications, as long as this notice is preserved.
6881a30de1fSmrg
6891a30de1fSmrg# AM_MAKE_INCLUDE()
6901a30de1fSmrg# -----------------
6911a30de1fSmrg# Check to see how make treats includes.
6921a30de1fSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6931a30de1fSmrg[am_make=${MAKE-make}
6941a30de1fSmrgcat > confinc << 'END'
6951a30de1fSmrgam__doit:
696b7fb5eacSmrg	@echo this is the am__doit target
6971a30de1fSmrg.PHONY: am__doit
6981a30de1fSmrgEND
6991a30de1fSmrg# If we don't find an include directive, just comment out the code.
7001a30de1fSmrgAC_MSG_CHECKING([for style of include used by $am_make])
7011a30de1fSmrgam__include="#"
7021a30de1fSmrgam__quote=
7031a30de1fSmrg_am_result=none
7041a30de1fSmrg# First try GNU make style include.
7051a30de1fSmrgecho "include confinc" > confmf
706a733a5bfSmrg# Ignore all kinds of additional output from 'make'.
707b7fb5eacSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
708b7fb5eacSmrg*the\ am__doit\ target*)
709b7fb5eacSmrg  am__include=include
710b7fb5eacSmrg  am__quote=
711b7fb5eacSmrg  _am_result=GNU
712b7fb5eacSmrg  ;;
713b7fb5eacSmrgesac
7141a30de1fSmrg# Now try BSD make style include.
7151a30de1fSmrgif test "$am__include" = "#"; then
7161a30de1fSmrg   echo '.include "confinc"' > confmf
717b7fb5eacSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
718b7fb5eacSmrg   *the\ am__doit\ target*)
719b7fb5eacSmrg     am__include=.include
720b7fb5eacSmrg     am__quote="\""
721b7fb5eacSmrg     _am_result=BSD
722b7fb5eacSmrg     ;;
723b7fb5eacSmrg   esac
7241a30de1fSmrgfi
7251a30de1fSmrgAC_SUBST([am__include])
7261a30de1fSmrgAC_SUBST([am__quote])
7271a30de1fSmrgAC_MSG_RESULT([$_am_result])
7281a30de1fSmrgrm -f confinc confmf
7291a30de1fSmrg])
7301a30de1fSmrg
7311a30de1fSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7321a30de1fSmrg
733a733a5bfSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
7341a30de1fSmrg#
7351a30de1fSmrg# This file is free software; the Free Software Foundation
7361a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
7371a30de1fSmrg# with or without modifications, as long as this notice is preserved.
7381a30de1fSmrg
7391a30de1fSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7401a30de1fSmrg# ------------------------------
7411a30de1fSmrgAC_DEFUN([AM_MISSING_PROG],
7421a30de1fSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7431a30de1fSmrg$1=${$1-"${am_missing_run}$2"}
7441a30de1fSmrgAC_SUBST($1)])
7451a30de1fSmrg
7461a30de1fSmrg# AM_MISSING_HAS_RUN
7471a30de1fSmrg# ------------------
748a733a5bfSmrg# Define MISSING if not defined so far and test if it is modern enough.
749a733a5bfSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7501a30de1fSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7511a30de1fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7521a30de1fSmrgAC_REQUIRE_AUX_FILE([missing])dnl
753b7fb5eacSmrgif test x"${MISSING+set}" != xset; then
754b7fb5eacSmrg  case $am_aux_dir in
755b7fb5eacSmrg  *\ * | *\	*)
756b7fb5eacSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
757b7fb5eacSmrg  *)
758b7fb5eacSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
759b7fb5eacSmrg  esac
760b7fb5eacSmrgfi
7611a30de1fSmrg# Use eval to expand $SHELL
762a733a5bfSmrgif eval "$MISSING --is-lightweight"; then
763a733a5bfSmrg  am_missing_run="$MISSING "
7641a30de1fSmrgelse
7651a30de1fSmrg  am_missing_run=
766a733a5bfSmrg  AC_MSG_WARN(['missing' script is too old or missing])
7671a30de1fSmrgfi
7681a30de1fSmrg])
7691a30de1fSmrg
7701a30de1fSmrg# Helper functions for option handling.                     -*- Autoconf -*-
7711a30de1fSmrg
772a733a5bfSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
7731a30de1fSmrg#
7741a30de1fSmrg# This file is free software; the Free Software Foundation
7751a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
7761a30de1fSmrg# with or without modifications, as long as this notice is preserved.
7771a30de1fSmrg
7781a30de1fSmrg# _AM_MANGLE_OPTION(NAME)
7791a30de1fSmrg# -----------------------
7801a30de1fSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7811a30de1fSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7821a30de1fSmrg
7831a30de1fSmrg# _AM_SET_OPTION(NAME)
784a733a5bfSmrg# --------------------
7851a30de1fSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7861a30de1fSmrgAC_DEFUN([_AM_SET_OPTION],
787a733a5bfSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7881a30de1fSmrg
7891a30de1fSmrg# _AM_SET_OPTIONS(OPTIONS)
790a733a5bfSmrg# ------------------------
7911a30de1fSmrg# OPTIONS is a space-separated list of Automake options.
7921a30de1fSmrgAC_DEFUN([_AM_SET_OPTIONS],
793b7fb5eacSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7941a30de1fSmrg
7951a30de1fSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7961a30de1fSmrg# -------------------------------------------
7971a30de1fSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7981a30de1fSmrgAC_DEFUN([_AM_IF_OPTION],
7991a30de1fSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
8001a30de1fSmrg
801a733a5bfSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
802a733a5bfSmrg#
803a733a5bfSmrg# This file is free software; the Free Software Foundation
804a733a5bfSmrg# gives unlimited permission to copy and/or distribute it,
805a733a5bfSmrg# with or without modifications, as long as this notice is preserved.
806a733a5bfSmrg
807a733a5bfSmrg# _AM_PROG_CC_C_O
808a733a5bfSmrg# ---------------
809a733a5bfSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
810a733a5bfSmrg# to automatically call this.
811a733a5bfSmrgAC_DEFUN([_AM_PROG_CC_C_O],
812a733a5bfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
813a733a5bfSmrgAC_REQUIRE_AUX_FILE([compile])dnl
814a733a5bfSmrgAC_LANG_PUSH([C])dnl
815a733a5bfSmrgAC_CACHE_CHECK(
816a733a5bfSmrg  [whether $CC understands -c and -o together],
817a733a5bfSmrg  [am_cv_prog_cc_c_o],
818a733a5bfSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
819a733a5bfSmrg  # Make sure it works both with $CC and with simple cc.
820a733a5bfSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
821a733a5bfSmrg  # compilers refuse to overwrite an existing .o file with -o,
822a733a5bfSmrg  # though they will create one.
823a733a5bfSmrg  am_cv_prog_cc_c_o=yes
824a733a5bfSmrg  for am_i in 1 2; do
825a733a5bfSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
826a733a5bfSmrg         && test -f conftest2.$ac_objext; then
827a733a5bfSmrg      : OK
828a733a5bfSmrg    else
829a733a5bfSmrg      am_cv_prog_cc_c_o=no
830a733a5bfSmrg      break
831a733a5bfSmrg    fi
832a733a5bfSmrg  done
833a733a5bfSmrg  rm -f core conftest*
834a733a5bfSmrg  unset am_i])
835a733a5bfSmrgif test "$am_cv_prog_cc_c_o" != yes; then
836a733a5bfSmrg   # Losing compiler, so override with the script.
837a733a5bfSmrg   # FIXME: It is wrong to rewrite CC.
838a733a5bfSmrg   # But if we don't then we get into trouble of one sort or another.
839a733a5bfSmrg   # A longer-term fix would be to have automake use am__CC in this case,
840a733a5bfSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
841a733a5bfSmrg   CC="$am_aux_dir/compile $CC"
842a733a5bfSmrgfi
843a733a5bfSmrgAC_LANG_POP([C])])
844a733a5bfSmrg
845a733a5bfSmrg# For backward compatibility.
846a733a5bfSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8471a30de1fSmrg
848a733a5bfSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
8491a30de1fSmrg#
8501a30de1fSmrg# This file is free software; the Free Software Foundation
8511a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
8521a30de1fSmrg# with or without modifications, as long as this notice is preserved.
8531a30de1fSmrg
854a733a5bfSmrg# AM_RUN_LOG(COMMAND)
855a733a5bfSmrg# -------------------
856a733a5bfSmrg# Run COMMAND, save the exit status in ac_status, and log it.
857a733a5bfSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
858a733a5bfSmrgAC_DEFUN([AM_RUN_LOG],
859a733a5bfSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
860a733a5bfSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
861a733a5bfSmrg   ac_status=$?
862a733a5bfSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
863a733a5bfSmrg   (exit $ac_status); }])
864a733a5bfSmrg
865a733a5bfSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
866a733a5bfSmrg
867a733a5bfSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
868a733a5bfSmrg#
869a733a5bfSmrg# This file is free software; the Free Software Foundation
870a733a5bfSmrg# gives unlimited permission to copy and/or distribute it,
871a733a5bfSmrg# with or without modifications, as long as this notice is preserved.
8721a30de1fSmrg
8731a30de1fSmrg# AM_SANITY_CHECK
8741a30de1fSmrg# ---------------
8751a30de1fSmrgAC_DEFUN([AM_SANITY_CHECK],
8761a30de1fSmrg[AC_MSG_CHECKING([whether build environment is sane])
877b7fb5eacSmrg# Reject unsafe characters in $srcdir or the absolute working directory
878b7fb5eacSmrg# name.  Accept space and tab only in the latter.
879b7fb5eacSmrgam_lf='
880b7fb5eacSmrg'
881b7fb5eacSmrgcase `pwd` in
882b7fb5eacSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
883b7fb5eacSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
884b7fb5eacSmrgesac
885b7fb5eacSmrgcase $srcdir in
886b7fb5eacSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
887a733a5bfSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
888b7fb5eacSmrgesac
889b7fb5eacSmrg
890a733a5bfSmrg# Do 'set' in a subshell so we don't clobber the current shell's
8911a30de1fSmrg# arguments.  Must try -L first in case configure is actually a
8921a30de1fSmrg# symlink; some systems play weird games with the mod time of symlinks
8931a30de1fSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8941a30de1fSmrg# directory).
8951a30de1fSmrgif (
896a733a5bfSmrg   am_has_slept=no
897a733a5bfSmrg   for am_try in 1 2; do
898a733a5bfSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
899a733a5bfSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
900a733a5bfSmrg     if test "$[*]" = "X"; then
901a733a5bfSmrg	# -L didn't work.
902a733a5bfSmrg	set X `ls -t "$srcdir/configure" conftest.file`
903a733a5bfSmrg     fi
904a733a5bfSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
905a733a5bfSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
906a733a5bfSmrg
907a733a5bfSmrg	# If neither matched, then we have a broken ls.  This can happen
908a733a5bfSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
909a733a5bfSmrg	# broken ls alias from the environment.  This has actually
910a733a5bfSmrg	# happened.  Such a system could not be considered "sane".
911a733a5bfSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
912a733a5bfSmrg  alias in your environment])
913a733a5bfSmrg     fi
914a733a5bfSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
915a733a5bfSmrg       break
916a733a5bfSmrg     fi
917a733a5bfSmrg     # Just in case.
918a733a5bfSmrg     sleep 1
919a733a5bfSmrg     am_has_slept=yes
920a733a5bfSmrg   done
9211a30de1fSmrg   test "$[2]" = conftest.file
9221a30de1fSmrg   )
9231a30de1fSmrgthen
9241a30de1fSmrg   # Ok.
9251a30de1fSmrg   :
9261a30de1fSmrgelse
9271a30de1fSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
9281a30de1fSmrgCheck your system clock])
9291a30de1fSmrgfi
930a733a5bfSmrgAC_MSG_RESULT([yes])
931a733a5bfSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
932a733a5bfSmrg# generated files are strictly newer.
933a733a5bfSmrgam_sleep_pid=
934a733a5bfSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
935a733a5bfSmrg  ( sleep 1 ) &
936a733a5bfSmrg  am_sleep_pid=$!
937a733a5bfSmrgfi
938a733a5bfSmrgAC_CONFIG_COMMANDS_PRE(
939a733a5bfSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
940a733a5bfSmrg   if test -n "$am_sleep_pid"; then
941a733a5bfSmrg     # Hide warnings about reused PIDs.
942a733a5bfSmrg     wait $am_sleep_pid 2>/dev/null
943a733a5bfSmrg   fi
944a733a5bfSmrg   AC_MSG_RESULT([done])])
945a733a5bfSmrgrm -f conftest.file
946a733a5bfSmrg])
9471a30de1fSmrg
948a733a5bfSmrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
949b7fb5eacSmrg#
950b7fb5eacSmrg# This file is free software; the Free Software Foundation
951b7fb5eacSmrg# gives unlimited permission to copy and/or distribute it,
952b7fb5eacSmrg# with or without modifications, as long as this notice is preserved.
953b7fb5eacSmrg
954b7fb5eacSmrg# AM_SILENT_RULES([DEFAULT])
955b7fb5eacSmrg# --------------------------
956b7fb5eacSmrg# Enable less verbose build rules; with the default set to DEFAULT
957a733a5bfSmrg# ("yes" being less verbose, "no" or empty being verbose).
958b7fb5eacSmrgAC_DEFUN([AM_SILENT_RULES],
959a733a5bfSmrg[AC_ARG_ENABLE([silent-rules], [dnl
960a733a5bfSmrgAS_HELP_STRING(
961a733a5bfSmrg  [--enable-silent-rules],
962a733a5bfSmrg  [less verbose build output (undo: "make V=1")])
963a733a5bfSmrgAS_HELP_STRING(
964a733a5bfSmrg  [--disable-silent-rules],
965a733a5bfSmrg  [verbose build output (undo: "make V=0")])dnl
966a733a5bfSmrg])
967a733a5bfSmrgcase $enable_silent_rules in @%:@ (((
968a733a5bfSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
969a733a5bfSmrg   no) AM_DEFAULT_VERBOSITY=1;;
970a733a5bfSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
971b7fb5eacSmrgesac
972a733a5bfSmrgdnl
973a733a5bfSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
974a733a5bfSmrgdnl do not support nested variable expansions.
975a733a5bfSmrgdnl See automake bug#9928 and bug#10237.
976a733a5bfSmrgam_make=${MAKE-make}
977a733a5bfSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
978a733a5bfSmrg   [am_cv_make_support_nested_variables],
979a733a5bfSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
980a733a5bfSmrgBAR0=false
981a733a5bfSmrgBAR1=true
982a733a5bfSmrgV=1
983a733a5bfSmrgam__doit:
984a733a5bfSmrg	@$(TRUE)
985a733a5bfSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
986a733a5bfSmrg  am_cv_make_support_nested_variables=yes
987a733a5bfSmrgelse
988a733a5bfSmrg  am_cv_make_support_nested_variables=no
989a733a5bfSmrgfi])
990a733a5bfSmrgif test $am_cv_make_support_nested_variables = yes; then
991a733a5bfSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
992a733a5bfSmrg  AM_V='$(V)'
993a733a5bfSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
994a733a5bfSmrgelse
995a733a5bfSmrg  AM_V=$AM_DEFAULT_VERBOSITY
996a733a5bfSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
997a733a5bfSmrgfi
998a733a5bfSmrgAC_SUBST([AM_V])dnl
999a733a5bfSmrgAM_SUBST_NOTMAKE([AM_V])dnl
1000a733a5bfSmrgAC_SUBST([AM_DEFAULT_V])dnl
1001a733a5bfSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1002b7fb5eacSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1003b7fb5eacSmrgAM_BACKSLASH='\'
1004b7fb5eacSmrgAC_SUBST([AM_BACKSLASH])dnl
1005b7fb5eacSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1006b7fb5eacSmrg])
1007b7fb5eacSmrg
1008a733a5bfSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
10091a30de1fSmrg#
10101a30de1fSmrg# This file is free software; the Free Software Foundation
10111a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
10121a30de1fSmrg# with or without modifications, as long as this notice is preserved.
10131a30de1fSmrg
10141a30de1fSmrg# AM_PROG_INSTALL_STRIP
10151a30de1fSmrg# ---------------------
1016a733a5bfSmrg# One issue with vendor 'install' (even GNU) is that you can't
10171a30de1fSmrg# specify the program used to strip binaries.  This is especially
10181a30de1fSmrg# annoying in cross-compiling environments, where the build's strip
10191a30de1fSmrg# is unlikely to handle the host's binaries.
10201a30de1fSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
1021a733a5bfSmrg# always use install-sh in "make install-strip", and initialize
10221a30de1fSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
10231a30de1fSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
10241a30de1fSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1025a733a5bfSmrg# Installed binaries are usually stripped using 'strip' when the user
1026a733a5bfSmrg# run "make install-strip".  However 'strip' might not be the right
10271a30de1fSmrg# tool to use in cross-compilation environments, therefore Automake
1028a733a5bfSmrg# will honor the 'STRIP' environment variable to overrule this program.
1029a733a5bfSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
10301a30de1fSmrgif test "$cross_compiling" != no; then
10311a30de1fSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
10321a30de1fSmrgfi
10331a30de1fSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
10341a30de1fSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10351a30de1fSmrg
1036a733a5bfSmrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
10371a30de1fSmrg#
10381a30de1fSmrg# This file is free software; the Free Software Foundation
10391a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
10401a30de1fSmrg# with or without modifications, as long as this notice is preserved.
10411a30de1fSmrg
10421a30de1fSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10431a30de1fSmrg# ---------------------------
1044b7fb5eacSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10451a30de1fSmrg# This macro is traced by Automake.
10461a30de1fSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10471a30de1fSmrg
1048b7fb5eacSmrg# AM_SUBST_NOTMAKE(VARIABLE)
1049a733a5bfSmrg# --------------------------
1050b7fb5eacSmrg# Public sister of _AM_SUBST_NOTMAKE.
1051b7fb5eacSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1052b7fb5eacSmrg
10531a30de1fSmrg# Check how to create a tarball.                            -*- Autoconf -*-
10541a30de1fSmrg
1055a733a5bfSmrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
10561a30de1fSmrg#
10571a30de1fSmrg# This file is free software; the Free Software Foundation
10581a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
10591a30de1fSmrg# with or without modifications, as long as this notice is preserved.
10601a30de1fSmrg
10611a30de1fSmrg# _AM_PROG_TAR(FORMAT)
10621a30de1fSmrg# --------------------
10631a30de1fSmrg# Check how to create a tarball in format FORMAT.
1064a733a5bfSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10651a30de1fSmrg#
10661a30de1fSmrg# Substitute a variable $(am__tar) that is a command
10671a30de1fSmrg# writing to stdout a FORMAT-tarball containing the directory
10681a30de1fSmrg# $tardir.
10691a30de1fSmrg#     tardir=directory && $(am__tar) > result.tar
10701a30de1fSmrg#
10711a30de1fSmrg# Substitute a variable $(am__untar) that extract such
10721a30de1fSmrg# a tarball read from stdin.
10731a30de1fSmrg#     $(am__untar) < result.tar
1074a733a5bfSmrg#
10751a30de1fSmrgAC_DEFUN([_AM_PROG_TAR],
1076a733a5bfSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1077a733a5bfSmrg# in the wild :-(  We should find a proper way to deprecate it ...
1078a733a5bfSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1079a733a5bfSmrg
1080a733a5bfSmrg# We'll loop over all known methods to create a tar archive until one works.
10811a30de1fSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10821a30de1fSmrg
1083a733a5bfSmrgm4_if([$1], [v7],
1084a733a5bfSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1085a733a5bfSmrg
1086a733a5bfSmrg  [m4_case([$1],
1087a733a5bfSmrg    [ustar],
1088a733a5bfSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1089a733a5bfSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1090a733a5bfSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1091a733a5bfSmrg      # and bug#13588).
1092a733a5bfSmrg      am_max_uid=2097151 # 2^21 - 1
1093a733a5bfSmrg      am_max_gid=$am_max_uid
1094a733a5bfSmrg      # The $UID and $GID variables are not portable, so we need to resort
1095a733a5bfSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1096a733a5bfSmrg      # below are definitely unexpected, so allow the users to see them
1097a733a5bfSmrg      # (that is, avoid stderr redirection).
1098a733a5bfSmrg      am_uid=`id -u || echo unknown`
1099a733a5bfSmrg      am_gid=`id -g || echo unknown`
1100a733a5bfSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1101a733a5bfSmrg      if test $am_uid -le $am_max_uid; then
1102a733a5bfSmrg         AC_MSG_RESULT([yes])
1103a733a5bfSmrg      else
1104a733a5bfSmrg         AC_MSG_RESULT([no])
1105a733a5bfSmrg         _am_tools=none
1106a733a5bfSmrg      fi
1107a733a5bfSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1108a733a5bfSmrg      if test $am_gid -le $am_max_gid; then
1109a733a5bfSmrg         AC_MSG_RESULT([yes])
1110a733a5bfSmrg      else
1111a733a5bfSmrg        AC_MSG_RESULT([no])
1112a733a5bfSmrg        _am_tools=none
1113a733a5bfSmrg      fi],
1114a733a5bfSmrg
1115a733a5bfSmrg  [pax],
1116a733a5bfSmrg    [],
1117a733a5bfSmrg
1118a733a5bfSmrg  [m4_fatal([Unknown tar format])])
1119a733a5bfSmrg
1120a733a5bfSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1121a733a5bfSmrg
1122a733a5bfSmrg  # Go ahead even if we have the value already cached.  We do so because we
1123a733a5bfSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1124a733a5bfSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1125a733a5bfSmrg
1126a733a5bfSmrg  for _am_tool in $_am_tools; do
1127a733a5bfSmrg    case $_am_tool in
1128a733a5bfSmrg    gnutar)
1129a733a5bfSmrg      for _am_tar in tar gnutar gtar; do
1130a733a5bfSmrg        AM_RUN_LOG([$_am_tar --version]) && break
1131a733a5bfSmrg      done
1132a733a5bfSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1133a733a5bfSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1134a733a5bfSmrg      am__untar="$_am_tar -xf -"
1135a733a5bfSmrg      ;;
1136a733a5bfSmrg    plaintar)
1137a733a5bfSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1138a733a5bfSmrg      # ustar tarball either.
1139a733a5bfSmrg      (tar --version) >/dev/null 2>&1 && continue
1140a733a5bfSmrg      am__tar='tar chf - "$$tardir"'
1141a733a5bfSmrg      am__tar_='tar chf - "$tardir"'
1142a733a5bfSmrg      am__untar='tar xf -'
1143a733a5bfSmrg      ;;
1144a733a5bfSmrg    pax)
1145a733a5bfSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
1146a733a5bfSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
1147a733a5bfSmrg      am__untar='pax -r'
1148a733a5bfSmrg      ;;
1149a733a5bfSmrg    cpio)
1150a733a5bfSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1151a733a5bfSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1152a733a5bfSmrg      am__untar='cpio -i -H $1 -d'
1153a733a5bfSmrg      ;;
1154a733a5bfSmrg    none)
1155a733a5bfSmrg      am__tar=false
1156a733a5bfSmrg      am__tar_=false
1157a733a5bfSmrg      am__untar=false
1158a733a5bfSmrg      ;;
1159a733a5bfSmrg    esac
11601a30de1fSmrg
1161a733a5bfSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
1162a733a5bfSmrg    # and am__untar set.
1163a733a5bfSmrg    test -n "${am_cv_prog_tar_$1}" && break
1164a733a5bfSmrg
1165a733a5bfSmrg    # tar/untar a dummy directory, and stop if the command works.
1166a733a5bfSmrg    rm -rf conftest.dir
1167a733a5bfSmrg    mkdir conftest.dir
1168a733a5bfSmrg    echo GrepMe > conftest.dir/file
1169a733a5bfSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1170a733a5bfSmrg    rm -rf conftest.dir
1171a733a5bfSmrg    if test -s conftest.tar; then
1172a733a5bfSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
1173a733a5bfSmrg      AM_RUN_LOG([cat conftest.dir/file])
1174a733a5bfSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1175a733a5bfSmrg    fi
1176a733a5bfSmrg  done
11771a30de1fSmrg  rm -rf conftest.dir
11781a30de1fSmrg
1179a733a5bfSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1180a733a5bfSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1181a733a5bfSmrg
11821a30de1fSmrgAC_SUBST([am__tar])
11831a30de1fSmrgAC_SUBST([am__untar])
11841a30de1fSmrg]) # _AM_PROG_TAR
11851a30de1fSmrg
1186a733a5bfSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1187a733a5bfSmrg# 
1188a733a5bfSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11891a30de1fSmrg#
1190a733a5bfSmrg# This program is free software; you can redistribute it and/or modify
1191a733a5bfSmrg# it under the terms of the GNU General Public License as published by
1192a733a5bfSmrg# the Free Software Foundation; either version 2 of the License, or
1193a733a5bfSmrg# (at your option) any later version.
11941a30de1fSmrg#
1195a733a5bfSmrg# This program is distributed in the hope that it will be useful, but
1196a733a5bfSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1197a733a5bfSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1198a733a5bfSmrg# General Public License for more details.
11991a30de1fSmrg#
1200a733a5bfSmrg# You should have received a copy of the GNU General Public License
1201a733a5bfSmrg# along with this program; if not, write to the Free Software
1202a733a5bfSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
12031a30de1fSmrg#
1204a733a5bfSmrg# As a special exception to the GNU General Public License, if you
1205a733a5bfSmrg# distribute this file as part of a program that contains a
1206a733a5bfSmrg# configuration script generated by Autoconf, you may include it under
1207a733a5bfSmrg# the same distribution terms that you use for the rest of that program.
12081a30de1fSmrg
1209a733a5bfSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1210a733a5bfSmrg# ----------------------------------
1211a733a5bfSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1212a733a5bfSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1213a733a5bfSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1214a733a5bfSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1215a733a5bfSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1216a733a5bfSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12171a30de1fSmrgfi
1218a733a5bfSmrgif test -n "$PKG_CONFIG"; then
1219a733a5bfSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1220a733a5bfSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1221a733a5bfSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12221a30de1fSmrg		AC_MSG_RESULT([yes])
12231a30de1fSmrg	else
1224a733a5bfSmrg		AC_MSG_RESULT([no])
1225a733a5bfSmrg		PKG_CONFIG=""
12261a30de1fSmrg	fi
1227a733a5bfSmrg		
1228a733a5bfSmrgfi[]dnl
1229a733a5bfSmrg])# PKG_PROG_PKG_CONFIG
12301a30de1fSmrg
1231a733a5bfSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12321a30de1fSmrg#
1233a733a5bfSmrg# Check to see whether a particular set of modules exists.  Similar
1234a733a5bfSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1235a733a5bfSmrg#
1236a733a5bfSmrg#
1237a733a5bfSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1238a733a5bfSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
1239a733a5bfSmrg# PKG_CHECK_EXISTS manually
1240a733a5bfSmrg# --------------------------------------------------------------
1241a733a5bfSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1242a733a5bfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1243a733a5bfSmrgif test -n "$PKG_CONFIG" && \
1244a733a5bfSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1245a733a5bfSmrg  m4_ifval([$2], [$2], [:])
1246a733a5bfSmrgm4_ifvaln([$3], [else
1247a733a5bfSmrg  $3])dnl
1248a733a5bfSmrgfi])
12491a30de1fSmrg
1250a733a5bfSmrg
1251a733a5bfSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252a733a5bfSmrg# ---------------------------------------------
1253a733a5bfSmrgm4_define([_PKG_CONFIG],
1254a733a5bfSmrg[if test -n "$$1"; then
1255a733a5bfSmrg    pkg_cv_[]$1="$$1"
1256a733a5bfSmrg elif test -n "$PKG_CONFIG"; then
1257a733a5bfSmrg    PKG_CHECK_EXISTS([$3],
1258a733a5bfSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1259a733a5bfSmrg		     [pkg_failed=yes])
1260a733a5bfSmrg else
1261a733a5bfSmrg    pkg_failed=untried
1262a733a5bfSmrgfi[]dnl
1263a733a5bfSmrg])# _PKG_CONFIG
1264a733a5bfSmrg
1265a733a5bfSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1266a733a5bfSmrg# -----------------------------
1267a733a5bfSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1268a733a5bfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1269a733a5bfSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1270a733a5bfSmrg        _pkg_short_errors_supported=yes
1271a733a5bfSmrgelse
1272a733a5bfSmrg        _pkg_short_errors_supported=no
1273a733a5bfSmrgfi[]dnl
1274a733a5bfSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1275a733a5bfSmrg
1276a733a5bfSmrg
1277a733a5bfSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1278a733a5bfSmrg# [ACTION-IF-NOT-FOUND])
1279a733a5bfSmrg#
1280a733a5bfSmrg#
1281a733a5bfSmrg# Note that if there is a possibility the first call to
1282a733a5bfSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1283a733a5bfSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1284a733a5bfSmrg#
1285a733a5bfSmrg#
1286a733a5bfSmrg# --------------------------------------------------------------
1287a733a5bfSmrgAC_DEFUN([PKG_CHECK_MODULES],
1288a733a5bfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1289a733a5bfSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1290a733a5bfSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1291a733a5bfSmrg
1292a733a5bfSmrgpkg_failed=no
1293a733a5bfSmrgAC_MSG_CHECKING([for $1])
1294a733a5bfSmrg
1295a733a5bfSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1296a733a5bfSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1297a733a5bfSmrg
1298a733a5bfSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1299a733a5bfSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1300a733a5bfSmrgSee the pkg-config man page for more details.])
1301a733a5bfSmrg
1302a733a5bfSmrgif test $pkg_failed = yes; then
1303a733a5bfSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1304a733a5bfSmrg        if test $_pkg_short_errors_supported = yes; then
1305a733a5bfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1306a733a5bfSmrg        else 
1307a733a5bfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1308a733a5bfSmrg        fi
1309a733a5bfSmrg	# Put the nasty error message in config.log where it belongs
1310a733a5bfSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1311a733a5bfSmrg
1312a733a5bfSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1313a733a5bfSmrg[Package requirements ($2) were not met:
1314a733a5bfSmrg
1315a733a5bfSmrg$$1_PKG_ERRORS
1316a733a5bfSmrg
1317a733a5bfSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1318a733a5bfSmrginstalled software in a non-standard prefix.
1319a733a5bfSmrg
1320a733a5bfSmrg_PKG_TEXT
1321a733a5bfSmrg])],
1322a733a5bfSmrg		[AC_MSG_RESULT([no])
1323a733a5bfSmrg                $4])
1324a733a5bfSmrgelif test $pkg_failed = untried; then
1325a733a5bfSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1326a733a5bfSmrg[The pkg-config script could not be found or is too old.  Make sure it
1327a733a5bfSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1328a733a5bfSmrgpath to pkg-config.
1329a733a5bfSmrg
1330a733a5bfSmrg_PKG_TEXT
1331a733a5bfSmrg
1332a733a5bfSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1333a733a5bfSmrg		[$4])
1334a733a5bfSmrgelse
1335a733a5bfSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1336a733a5bfSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1337a733a5bfSmrg        AC_MSG_RESULT([yes])
1338a733a5bfSmrg	ifelse([$3], , :, [$3])
1339a733a5bfSmrgfi[]dnl
1340a733a5bfSmrg])# PKG_CHECK_MODULES
1341a733a5bfSmrg
1342a733a5bfSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1343a733a5bfSmrgdnl
1344a733a5bfSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1345a733a5bfSmrgdnl
1346a733a5bfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1347a733a5bfSmrgdnl copy of this software and associated documentation files (the "Software"),
1348a733a5bfSmrgdnl to deal in the Software without restriction, including without limitation
1349a733a5bfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1350a733a5bfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1351a733a5bfSmrgdnl Software is furnished to do so, subject to the following conditions:
1352a733a5bfSmrgdnl
1353a733a5bfSmrgdnl The above copyright notice and this permission notice (including the next
1354a733a5bfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1355a733a5bfSmrgdnl Software.
1356a733a5bfSmrgdnl
1357a733a5bfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1358a733a5bfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1359a733a5bfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1360a733a5bfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1361a733a5bfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1362a733a5bfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1363a733a5bfSmrgdnl DEALINGS IN THE SOFTWARE.
1364a733a5bfSmrg
1365a733a5bfSmrg# XORG_MACROS_VERSION(required-version)
1366a733a5bfSmrg# -------------------------------------
1367a733a5bfSmrg# Minimum version: 1.1.0
1368a733a5bfSmrg#
1369a733a5bfSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1370a733a5bfSmrg# your configure.ac with the minimum required version, such as:
1371a733a5bfSmrg# XORG_MACROS_VERSION(1.1)
1372a733a5bfSmrg#
1373a733a5bfSmrg# To ensure that this macro is defined, also add:
1374a733a5bfSmrg# m4_ifndef([XORG_MACROS_VERSION],
1375a733a5bfSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1376a733a5bfSmrg#
1377a733a5bfSmrg#
1378a733a5bfSmrg# See the "minimum version" comment for each macro you use to see what
1379a733a5bfSmrg# version you require.
1380a733a5bfSmrgm4_defun([XORG_MACROS_VERSION],[
1381a733a5bfSmrgm4_define([vers_have], [1.17.1])
1382a733a5bfSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1383a733a5bfSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1384a733a5bfSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1385a733a5bfSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1386a733a5bfSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1387a733a5bfSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1388a733a5bfSmrgm4_undefine([vers_have])
1389a733a5bfSmrgm4_undefine([maj_have])
1390a733a5bfSmrgm4_undefine([maj_needed])
1391a733a5bfSmrg]) # XORG_MACROS_VERSION
1392a733a5bfSmrg
1393a733a5bfSmrg# XORG_PROG_RAWCPP()
1394a733a5bfSmrg# ------------------
1395a733a5bfSmrg# Minimum version: 1.0.0
1396a733a5bfSmrg#
1397a733a5bfSmrg# Find cpp program and necessary flags for use in pre-processing text files
1398a733a5bfSmrg# such as man pages and config files
1399a733a5bfSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1400a733a5bfSmrgAC_REQUIRE([AC_PROG_CPP])
1401a733a5bfSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
1402a733a5bfSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1403a733a5bfSmrg
1404a733a5bfSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1405a733a5bfSmrg# which is not the best choice for supporting other OS'es, but covers most
1406a733a5bfSmrg# of the ones we need for now.
1407a733a5bfSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1408a733a5bfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1409a733a5bfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1410a733a5bfSmrg	AC_MSG_RESULT([no])
1411a733a5bfSmrgelse
1412a733a5bfSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1413a733a5bfSmrg		RAWCPPFLAGS=-undef
1414a733a5bfSmrg		AC_MSG_RESULT([yes])
1415a733a5bfSmrg	# under Cygwin unix is still defined even with -undef
1416a733a5bfSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1417a733a5bfSmrg		RAWCPPFLAGS="-undef -ansi"
1418a733a5bfSmrg		AC_MSG_RESULT([yes, with -ansi])
1419a733a5bfSmrg	else
1420a733a5bfSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1421a733a5bfSmrg	fi
1422a733a5bfSmrgfi
1423a733a5bfSmrgrm -f conftest.$ac_ext
1424a733a5bfSmrg
1425a733a5bfSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1426a733a5bfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1427a733a5bfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1428a733a5bfSmrg	AC_MSG_RESULT([no])
1429a733a5bfSmrgelse
1430a733a5bfSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1431a733a5bfSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1432a733a5bfSmrg		AC_MSG_RESULT([yes])
1433a733a5bfSmrg	else
1434a733a5bfSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1435a733a5bfSmrg	fi
1436a733a5bfSmrgfi
1437a733a5bfSmrgrm -f conftest.$ac_ext
1438a733a5bfSmrgAC_SUBST(RAWCPPFLAGS)
1439a733a5bfSmrg]) # XORG_PROG_RAWCPP
1440a733a5bfSmrg
1441a733a5bfSmrg# XORG_MANPAGE_SECTIONS()
1442a733a5bfSmrg# -----------------------
1443a733a5bfSmrg# Minimum version: 1.0.0
1444a733a5bfSmrg#
1445a733a5bfSmrg# Determine which sections man pages go in for the different man page types
1446a733a5bfSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1447a733a5bfSmrg# Not sure if there's any better way than just hardcoding by OS name.
1448a733a5bfSmrg# Override default settings by setting environment variables
1449a733a5bfSmrg# Added MAN_SUBSTS in version 1.8
1450a733a5bfSmrg# Added AC_PROG_SED in version 1.8
1451a733a5bfSmrg
1452a733a5bfSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1453a733a5bfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1454a733a5bfSmrgAC_REQUIRE([AC_PROG_SED])
14551a30de1fSmrg
14561a30de1fSmrgif test x$APP_MAN_SUFFIX = x    ; then
14571a30de1fSmrg    APP_MAN_SUFFIX=1
14581a30de1fSmrgfi
14591a30de1fSmrgif test x$APP_MAN_DIR = x    ; then
14601a30de1fSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
14611a30de1fSmrgfi
14621a30de1fSmrg
14631a30de1fSmrgif test x$LIB_MAN_SUFFIX = x    ; then
14641a30de1fSmrg    LIB_MAN_SUFFIX=3
14651a30de1fSmrgfi
14661a30de1fSmrgif test x$LIB_MAN_DIR = x    ; then
14671a30de1fSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
14681a30de1fSmrgfi
14691a30de1fSmrg
14701a30de1fSmrgif test x$FILE_MAN_SUFFIX = x    ; then
14711a30de1fSmrg    case $host_os in
14721a30de1fSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
14731a30de1fSmrg	*)		FILE_MAN_SUFFIX=5  ;;
14741a30de1fSmrg    esac
14751a30de1fSmrgfi
14761a30de1fSmrgif test x$FILE_MAN_DIR = x    ; then
14771a30de1fSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
14781a30de1fSmrgfi
14791a30de1fSmrg
14801a30de1fSmrgif test x$MISC_MAN_SUFFIX = x    ; then
14811a30de1fSmrg    case $host_os in
14821a30de1fSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
14831a30de1fSmrg	*)		MISC_MAN_SUFFIX=7  ;;
14841a30de1fSmrg    esac
14851a30de1fSmrgfi
14861a30de1fSmrgif test x$MISC_MAN_DIR = x    ; then
14871a30de1fSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
14881a30de1fSmrgfi
14891a30de1fSmrg
14901a30de1fSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
14911a30de1fSmrg    case $host_os in
14921a30de1fSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
14931a30de1fSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
14941a30de1fSmrg    esac
14951a30de1fSmrgfi
14961a30de1fSmrgif test x$DRIVER_MAN_DIR = x    ; then
14971a30de1fSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
14981a30de1fSmrgfi
14991a30de1fSmrg
15001a30de1fSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15011a30de1fSmrg    case $host_os in
15021a30de1fSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
15031a30de1fSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
15041a30de1fSmrg    esac
15051a30de1fSmrgfi
15061a30de1fSmrgif test x$ADMIN_MAN_DIR = x    ; then
15071a30de1fSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
15081a30de1fSmrgfi
15091a30de1fSmrg
15101a30de1fSmrg
15111a30de1fSmrgAC_SUBST([APP_MAN_SUFFIX])
15121a30de1fSmrgAC_SUBST([LIB_MAN_SUFFIX])
15131a30de1fSmrgAC_SUBST([FILE_MAN_SUFFIX])
15141a30de1fSmrgAC_SUBST([MISC_MAN_SUFFIX])
15151a30de1fSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
15161a30de1fSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
15171a30de1fSmrgAC_SUBST([APP_MAN_DIR])
15181a30de1fSmrgAC_SUBST([LIB_MAN_DIR])
15191a30de1fSmrgAC_SUBST([FILE_MAN_DIR])
15201a30de1fSmrgAC_SUBST([MISC_MAN_DIR])
15211a30de1fSmrgAC_SUBST([DRIVER_MAN_DIR])
15221a30de1fSmrgAC_SUBST([ADMIN_MAN_DIR])
1523ce62200cSmrg
1524ce62200cSmrgXORG_MAN_PAGE="X Version 11"
1525ce62200cSmrgAC_SUBST([XORG_MAN_PAGE])
1526ce62200cSmrgMAN_SUBSTS="\
1527ce62200cSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1528ce62200cSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1529ce62200cSmrg	-e 's|__xservername__|Xorg|g' \
1530ce62200cSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1531ce62200cSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1532ce62200cSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1533ce62200cSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1534ce62200cSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1535ce62200cSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1536ce62200cSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1537ce62200cSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1538ce62200cSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1539ce62200cSmrgAC_SUBST([MAN_SUBSTS])
1540ce62200cSmrg
15411a30de1fSmrg]) # XORG_MANPAGE_SECTIONS
15421a30de1fSmrg
1543ce62200cSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1544ce62200cSmrg# ------------------------
1545ce62200cSmrg# Minimum version: 1.7.0
1546ce62200cSmrg#
1547ce62200cSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1548ce62200cSmrg# provided by xorg-sgml-doctools, if installed.
1549ce62200cSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1550ce62200cSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1551ce62200cSmrgXORG_SGML_PATH=
1552ce62200cSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1553ce62200cSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1554ce62200cSmrg    [m4_ifval([$1],[:],
1555ce62200cSmrg        [if test x"$cross_compiling" != x"yes" ; then
1556ce62200cSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1557ce62200cSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1558ce62200cSmrg         fi])
1559ce62200cSmrg    ])
1560ce62200cSmrg
1561ce62200cSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1562ce62200cSmrg# the path and the name of the doc stylesheet
1563ce62200cSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1564ce62200cSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1565ce62200cSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1566ce62200cSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1567ce62200cSmrgelse
1568ce62200cSmrg   AC_MSG_RESULT([no])
1569ce62200cSmrgfi
1570ce62200cSmrg
1571ce62200cSmrgAC_SUBST(XORG_SGML_PATH)
1572ce62200cSmrgAC_SUBST(STYLESHEET_SRCDIR)
1573ce62200cSmrgAC_SUBST(XSL_STYLESHEET)
1574ce62200cSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1575ce62200cSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1576ce62200cSmrg
15771a30de1fSmrg# XORG_CHECK_LINUXDOC
15781a30de1fSmrg# -------------------
15791a30de1fSmrg# Minimum version: 1.0.0
15801a30de1fSmrg#
15811a30de1fSmrg# Defines the variable MAKE_TEXT if the necessary tools and
15821a30de1fSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
15831a30de1fSmrg# Whether or not the necessary tools and files are found can be checked
15841a30de1fSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
15851a30de1fSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1586ce62200cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1587ce62200cSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
15881a30de1fSmrg
15891a30de1fSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
15901a30de1fSmrg
1591ce62200cSmrgAC_MSG_CHECKING([whether to build documentation])
15921a30de1fSmrg
1593ce62200cSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
15941a30de1fSmrg   BUILDDOC=yes
15951a30de1fSmrgelse
15961a30de1fSmrg   BUILDDOC=no
15971a30de1fSmrgfi
15981a30de1fSmrg
15991a30de1fSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16001a30de1fSmrg
16011a30de1fSmrgAC_MSG_RESULT([$BUILDDOC])
16021a30de1fSmrg
1603ce62200cSmrgAC_MSG_CHECKING([whether to build pdf documentation])
16041a30de1fSmrg
1605ce62200cSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
16061a30de1fSmrg   BUILDPDFDOC=yes
16071a30de1fSmrgelse
16081a30de1fSmrg   BUILDPDFDOC=no
16091a30de1fSmrgfi
16101a30de1fSmrg
16111a30de1fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16121a30de1fSmrg
16131a30de1fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
16141a30de1fSmrg
1615ce62200cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
16161a30de1fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
16171a30de1fSmrgMAKE_PDF="$PS2PDF"
16181a30de1fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
16191a30de1fSmrg
16201a30de1fSmrgAC_SUBST(MAKE_TEXT)
16211a30de1fSmrgAC_SUBST(MAKE_PS)
16221a30de1fSmrgAC_SUBST(MAKE_PDF)
16231a30de1fSmrgAC_SUBST(MAKE_HTML)
16241a30de1fSmrg]) # XORG_CHECK_LINUXDOC
16251a30de1fSmrg
16261a30de1fSmrg# XORG_CHECK_DOCBOOK
16271a30de1fSmrg# -------------------
16281a30de1fSmrg# Minimum version: 1.0.0
16291a30de1fSmrg#
16301a30de1fSmrg# Checks for the ability to build output formats from SGML DocBook source.
16311a30de1fSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16321a30de1fSmrg# indicates whether the necessary tools and files are found and, if set,
16331a30de1fSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16341a30de1fSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1635ce62200cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1636ce62200cSmrg
16371a30de1fSmrgBUILDTXTDOC=no
16381a30de1fSmrgBUILDPDFDOC=no
16391a30de1fSmrgBUILDPSDOC=no
16401a30de1fSmrgBUILDHTMLDOC=no
16411a30de1fSmrg
16421a30de1fSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16431a30de1fSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16441a30de1fSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16451a30de1fSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
16461a30de1fSmrg
1647ce62200cSmrgAC_MSG_CHECKING([whether to build text documentation])
1648ce62200cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16491a30de1fSmrg   test x$BUILD_TXTDOC != xno; then
16501a30de1fSmrg	BUILDTXTDOC=yes
16511a30de1fSmrgfi
16521a30de1fSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16531a30de1fSmrgAC_MSG_RESULT([$BUILDTXTDOC])
16541a30de1fSmrg
1655ce62200cSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1656ce62200cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16571a30de1fSmrg   test x$BUILD_PDFDOC != xno; then
16581a30de1fSmrg	BUILDPDFDOC=yes
16591a30de1fSmrgfi
16601a30de1fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16611a30de1fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
16621a30de1fSmrg
1663ce62200cSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1664ce62200cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
16651a30de1fSmrg   test x$BUILD_PSDOC != xno; then
16661a30de1fSmrg	BUILDPSDOC=yes
16671a30de1fSmrgfi
16681a30de1fSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
16691a30de1fSmrgAC_MSG_RESULT([$BUILDPSDOC])
16701a30de1fSmrg
1671ce62200cSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1672ce62200cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
16731a30de1fSmrg   test x$BUILD_HTMLDOC != xno; then
16741a30de1fSmrg	BUILDHTMLDOC=yes
16751a30de1fSmrgfi
16761a30de1fSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
16771a30de1fSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
16781a30de1fSmrg
16791a30de1fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
16801a30de1fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
16811a30de1fSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
16821a30de1fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
16831a30de1fSmrg
16841a30de1fSmrgAC_SUBST(MAKE_TEXT)
16851a30de1fSmrgAC_SUBST(MAKE_PS)
16861a30de1fSmrgAC_SUBST(MAKE_PDF)
16871a30de1fSmrgAC_SUBST(MAKE_HTML)
16881a30de1fSmrg]) # XORG_CHECK_DOCBOOK
16891a30de1fSmrg
1690a733a5bfSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1691ce62200cSmrg# ----------------
1692ce62200cSmrg# Minimum version: 1.5.0
1693a733a5bfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1694ce62200cSmrg#
1695ce62200cSmrg# Documentation tools are not always available on all platforms and sometimes
1696ce62200cSmrg# not at the appropriate level. This macro enables a module to test for the
1697ce62200cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1698ce62200cSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1699a733a5bfSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1700a733a5bfSmrg# --with-xmlto assumes 'auto'.
1701ce62200cSmrg#
1702ce62200cSmrg# Interface to module:
1703ce62200cSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1704ce62200cSmrg# XMLTO:	returns the path of the xmlto program found
1705ce62200cSmrg#		returns the path set by the user in the environment
1706ce62200cSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1707ce62200cSmrg#		'no' user instructs the module not to use xmlto
1708ce62200cSmrg#
1709ce62200cSmrg# Added in version 1.10.0
1710ce62200cSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1711ce62200cSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1712ce62200cSmrg#
1713ce62200cSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1714ce62200cSmrg#
1715ce62200cSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1716ce62200cSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1717a733a5bfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1718ce62200cSmrgAC_ARG_WITH(xmlto,
1719ce62200cSmrg	AS_HELP_STRING([--with-xmlto],
1720a733a5bfSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1721a733a5bfSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1722a733a5bfSmrgm4_undefine([_defopt])
1723ce62200cSmrg
1724ce62200cSmrgif test "x$use_xmlto" = x"auto"; then
1725ce62200cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1726ce62200cSmrg   if test "x$XMLTO" = "x"; then
1727ce62200cSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1728ce62200cSmrg	have_xmlto=no
1729ce62200cSmrg   else
1730ce62200cSmrg        have_xmlto=yes
1731ce62200cSmrg   fi
1732ce62200cSmrgelif test "x$use_xmlto" = x"yes" ; then
1733ce62200cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1734ce62200cSmrg   if test "x$XMLTO" = "x"; then
1735ce62200cSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1736ce62200cSmrg   fi
1737ce62200cSmrg   have_xmlto=yes
1738ce62200cSmrgelif test "x$use_xmlto" = x"no" ; then
1739ce62200cSmrg   if test "x$XMLTO" != "x"; then
1740ce62200cSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1741ce62200cSmrg   fi
1742ce62200cSmrg   have_xmlto=no
1743ce62200cSmrgelse
1744ce62200cSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1745ce62200cSmrgfi
1746ce62200cSmrg
1747ce62200cSmrg# Test for a minimum version of xmlto, if provided.
1748ce62200cSmrgm4_ifval([$1],
1749ce62200cSmrg[if test "$have_xmlto" = yes; then
1750ce62200cSmrg    # scrape the xmlto version
1751ce62200cSmrg    AC_MSG_CHECKING([the xmlto version])
1752ce62200cSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1753ce62200cSmrg    AC_MSG_RESULT([$xmlto_version])
1754ce62200cSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1755ce62200cSmrg        [if test "x$use_xmlto" = xauto; then
1756ce62200cSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1757ce62200cSmrg            have_xmlto=no
1758ce62200cSmrg        else
1759ce62200cSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1760ce62200cSmrg        fi])
1761ce62200cSmrgfi])
1762ce62200cSmrg
1763ce62200cSmrg# Test for the ability of xmlto to generate a text target
1764ce62200cSmrghave_xmlto_text=no
1765ce62200cSmrgcat > conftest.xml << "EOF"
1766ce62200cSmrgEOF
1767ce62200cSmrgAS_IF([test "$have_xmlto" = yes],
1768ce62200cSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1769ce62200cSmrg             [have_xmlto_text=yes],
1770ce62200cSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1771ce62200cSmrgrm -f conftest.xml
1772ce62200cSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1773ce62200cSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1774ce62200cSmrg]) # XORG_WITH_XMLTO
1775ce62200cSmrg
1776a733a5bfSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1777a733a5bfSmrg# --------------------------------------------
1778a733a5bfSmrg# Minimum version: 1.12.0
1779a733a5bfSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1780a733a5bfSmrg#
1781a733a5bfSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1782a733a5bfSmrg# XML-based language used for the transformation of XML documents.
1783a733a5bfSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1784a733a5bfSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1785a733a5bfSmrg# The XSLT processor is often used as a standalone tool for transformations.
1786a733a5bfSmrg# It should not be assumed that this tool is used only to work with documnetation.
1787a733a5bfSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1788a733a5bfSmrg#
1789a733a5bfSmrg# Interface to module:
1790a733a5bfSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1791a733a5bfSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1792a733a5bfSmrg#		 returns the path set by the user in the environment
1793a733a5bfSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1794a733a5bfSmrg#		  'no' user instructs the module not to use xsltproc
1795a733a5bfSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1796a733a5bfSmrg#
1797a733a5bfSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1798a733a5bfSmrg#
1799a733a5bfSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1800a733a5bfSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1801a733a5bfSmrg# Preserves the interface, should it be implemented later
1802a733a5bfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1803a733a5bfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1804a733a5bfSmrgAC_ARG_WITH(xsltproc,
1805a733a5bfSmrg	AS_HELP_STRING([--with-xsltproc],
1806a733a5bfSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1807a733a5bfSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1808a733a5bfSmrgm4_undefine([_defopt])
1809a733a5bfSmrg
1810a733a5bfSmrgif test "x$use_xsltproc" = x"auto"; then
1811a733a5bfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1812a733a5bfSmrg   if test "x$XSLTPROC" = "x"; then
1813a733a5bfSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1814a733a5bfSmrg	have_xsltproc=no
1815a733a5bfSmrg   else
1816a733a5bfSmrg        have_xsltproc=yes
1817a733a5bfSmrg   fi
1818a733a5bfSmrgelif test "x$use_xsltproc" = x"yes" ; then
1819a733a5bfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1820a733a5bfSmrg   if test "x$XSLTPROC" = "x"; then
1821a733a5bfSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1822a733a5bfSmrg   fi
1823a733a5bfSmrg   have_xsltproc=yes
1824a733a5bfSmrgelif test "x$use_xsltproc" = x"no" ; then
1825a733a5bfSmrg   if test "x$XSLTPROC" != "x"; then
1826a733a5bfSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1827a733a5bfSmrg   fi
1828a733a5bfSmrg   have_xsltproc=no
1829a733a5bfSmrgelse
1830a733a5bfSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1831a733a5bfSmrgfi
1832a733a5bfSmrg
1833a733a5bfSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1834a733a5bfSmrg]) # XORG_WITH_XSLTPROC
1835a733a5bfSmrg
1836a733a5bfSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1837a733a5bfSmrg# ----------------------------------------
1838a733a5bfSmrg# Minimum version: 1.15.0
1839a733a5bfSmrg#
1840a733a5bfSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1841a733a5bfSmrg# scanning arbitrary text files, extracting information from those text files,
1842a733a5bfSmrg# and printing reports based on that information.
1843a733a5bfSmrg#
1844a733a5bfSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1845a733a5bfSmrg#
1846a733a5bfSmrg# Interface to module:
1847a733a5bfSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1848a733a5bfSmrg# PERL:	     returns the path of the perl program found
1849a733a5bfSmrg#	     returns the path set by the user in the environment
1850a733a5bfSmrg# --with-perl: 'yes' user instructs the module to use perl
1851a733a5bfSmrg#	       'no' user instructs the module not to use perl
1852a733a5bfSmrg# have_perl: returns yes if perl found in PATH or no
1853a733a5bfSmrg#
1854a733a5bfSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1855a733a5bfSmrg#
1856a733a5bfSmrgAC_DEFUN([XORG_WITH_PERL],[
1857a733a5bfSmrgAC_ARG_VAR([PERL], [Path to perl command])
1858a733a5bfSmrg# Preserves the interface, should it be implemented later
1859a733a5bfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1860a733a5bfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1861a733a5bfSmrgAC_ARG_WITH(perl,
1862a733a5bfSmrg	AS_HELP_STRING([--with-perl],
1863a733a5bfSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1864a733a5bfSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1865a733a5bfSmrgm4_undefine([_defopt])
1866a733a5bfSmrg
1867a733a5bfSmrgif test "x$use_perl" = x"auto"; then
1868a733a5bfSmrg   AC_PATH_PROG([PERL], [perl])
1869a733a5bfSmrg   if test "x$PERL" = "x"; then
1870a733a5bfSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1871a733a5bfSmrg	have_perl=no
1872a733a5bfSmrg   else
1873a733a5bfSmrg        have_perl=yes
1874a733a5bfSmrg   fi
1875a733a5bfSmrgelif test "x$use_perl" = x"yes" ; then
1876a733a5bfSmrg   AC_PATH_PROG([PERL], [perl])
1877a733a5bfSmrg   if test "x$PERL" = "x"; then
1878a733a5bfSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1879a733a5bfSmrg   fi
1880a733a5bfSmrg   have_perl=yes
1881a733a5bfSmrgelif test "x$use_perl" = x"no" ; then
1882a733a5bfSmrg   if test "x$PERL" != "x"; then
1883a733a5bfSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1884a733a5bfSmrg   fi
1885a733a5bfSmrg   have_perl=no
1886a733a5bfSmrgelse
1887a733a5bfSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1888a733a5bfSmrgfi
1889a733a5bfSmrg
1890a733a5bfSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1891a733a5bfSmrg]) # XORG_WITH_PERL
1892a733a5bfSmrg
1893a733a5bfSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1894ce62200cSmrg# ----------------
1895ce62200cSmrg# Minimum version: 1.5.0
1896a733a5bfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1897ce62200cSmrg#
1898ce62200cSmrg# Documentation tools are not always available on all platforms and sometimes
1899ce62200cSmrg# not at the appropriate level. This macro enables a module to test for the
1900ce62200cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1901ce62200cSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1902a733a5bfSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1903a733a5bfSmrg# --with-asciidoc assumes 'auto'.
1904ce62200cSmrg#
1905ce62200cSmrg# Interface to module:
1906ce62200cSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1907ce62200cSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1908ce62200cSmrg#		 returns the path set by the user in the environment
1909ce62200cSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1910ce62200cSmrg#		  'no' user instructs the module not to use asciidoc
1911ce62200cSmrg#
1912ce62200cSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1913ce62200cSmrg#
1914ce62200cSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1915ce62200cSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1916a733a5bfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1917ce62200cSmrgAC_ARG_WITH(asciidoc,
1918ce62200cSmrg	AS_HELP_STRING([--with-asciidoc],
1919a733a5bfSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1920a733a5bfSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1921a733a5bfSmrgm4_undefine([_defopt])
1922ce62200cSmrg
1923ce62200cSmrgif test "x$use_asciidoc" = x"auto"; then
1924ce62200cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1925ce62200cSmrg   if test "x$ASCIIDOC" = "x"; then
1926ce62200cSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1927ce62200cSmrg	have_asciidoc=no
1928ce62200cSmrg   else
1929ce62200cSmrg        have_asciidoc=yes
1930ce62200cSmrg   fi
1931ce62200cSmrgelif test "x$use_asciidoc" = x"yes" ; then
1932ce62200cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1933ce62200cSmrg   if test "x$ASCIIDOC" = "x"; then
1934ce62200cSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1935ce62200cSmrg   fi
1936ce62200cSmrg   have_asciidoc=yes
1937ce62200cSmrgelif test "x$use_asciidoc" = x"no" ; then
1938ce62200cSmrg   if test "x$ASCIIDOC" != "x"; then
1939ce62200cSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1940ce62200cSmrg   fi
1941ce62200cSmrg   have_asciidoc=no
1942ce62200cSmrgelse
1943ce62200cSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1944ce62200cSmrgfi
1945ce62200cSmrgm4_ifval([$1],
1946ce62200cSmrg[if test "$have_asciidoc" = yes; then
1947ce62200cSmrg    # scrape the asciidoc version
1948ce62200cSmrg    AC_MSG_CHECKING([the asciidoc version])
1949ce62200cSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1950ce62200cSmrg    AC_MSG_RESULT([$asciidoc_version])
1951ce62200cSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1952ce62200cSmrg        [if test "x$use_asciidoc" = xauto; then
1953ce62200cSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1954ce62200cSmrg            have_asciidoc=no
1955ce62200cSmrg        else
1956ce62200cSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1957ce62200cSmrg        fi])
1958ce62200cSmrgfi])
1959ce62200cSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1960ce62200cSmrg]) # XORG_WITH_ASCIIDOC
1961ce62200cSmrg
1962a733a5bfSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1963ce62200cSmrg# --------------------------------
1964ce62200cSmrg# Minimum version: 1.5.0
1965a733a5bfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1966ce62200cSmrg#
1967ce62200cSmrg# Documentation tools are not always available on all platforms and sometimes
1968ce62200cSmrg# not at the appropriate level. This macro enables a module to test for the
1969ce62200cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1970ce62200cSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1971a733a5bfSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1972a733a5bfSmrg# --with-doxygen assumes 'auto'.
1973ce62200cSmrg#
1974ce62200cSmrg# Interface to module:
1975ce62200cSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1976ce62200cSmrg# DOXYGEN:	 returns the path of the doxygen program found
1977ce62200cSmrg#		 returns the path set by the user in the environment
1978ce62200cSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1979ce62200cSmrg#		  'no' user instructs the module not to use doxygen
1980ce62200cSmrg#
1981ce62200cSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1982ce62200cSmrg#
1983ce62200cSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1984ce62200cSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1985a733a5bfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1986ce62200cSmrgAC_ARG_WITH(doxygen,
1987ce62200cSmrg	AS_HELP_STRING([--with-doxygen],
1988a733a5bfSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1989a733a5bfSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1990a733a5bfSmrgm4_undefine([_defopt])
1991ce62200cSmrg
1992ce62200cSmrgif test "x$use_doxygen" = x"auto"; then
1993ce62200cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1994ce62200cSmrg   if test "x$DOXYGEN" = "x"; then
1995ce62200cSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1996ce62200cSmrg	have_doxygen=no
1997ce62200cSmrg   else
1998ce62200cSmrg        have_doxygen=yes
1999ce62200cSmrg   fi
2000ce62200cSmrgelif test "x$use_doxygen" = x"yes" ; then
2001ce62200cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2002ce62200cSmrg   if test "x$DOXYGEN" = "x"; then
2003ce62200cSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2004ce62200cSmrg   fi
2005ce62200cSmrg   have_doxygen=yes
2006ce62200cSmrgelif test "x$use_doxygen" = x"no" ; then
2007ce62200cSmrg   if test "x$DOXYGEN" != "x"; then
2008ce62200cSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2009ce62200cSmrg   fi
2010ce62200cSmrg   have_doxygen=no
2011ce62200cSmrgelse
2012ce62200cSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2013ce62200cSmrgfi
2014ce62200cSmrgm4_ifval([$1],
2015ce62200cSmrg[if test "$have_doxygen" = yes; then
2016ce62200cSmrg    # scrape the doxygen version
2017ce62200cSmrg    AC_MSG_CHECKING([the doxygen version])
2018ce62200cSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2019ce62200cSmrg    AC_MSG_RESULT([$doxygen_version])
2020ce62200cSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2021ce62200cSmrg        [if test "x$use_doxygen" = xauto; then
2022ce62200cSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2023ce62200cSmrg            have_doxygen=no
2024ce62200cSmrg        else
2025ce62200cSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2026ce62200cSmrg        fi])
2027ce62200cSmrgfi])
2028ce62200cSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2029ce62200cSmrg]) # XORG_WITH_DOXYGEN
2030ce62200cSmrg
2031a733a5bfSmrg# XORG_WITH_GROFF([DEFAULT])
2032ce62200cSmrg# ----------------
2033ce62200cSmrg# Minimum version: 1.6.0
2034a733a5bfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2035ce62200cSmrg#
2036ce62200cSmrg# Documentation tools are not always available on all platforms and sometimes
2037ce62200cSmrg# not at the appropriate level. This macro enables a module to test for the
2038ce62200cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2039ce62200cSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2040a733a5bfSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2041a733a5bfSmrg# --with-groff assumes 'auto'.
2042ce62200cSmrg#
2043ce62200cSmrg# Interface to module:
2044ce62200cSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2045ce62200cSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2046ce62200cSmrg# HAVE_GROFF_MS: the -ms macros package
2047ce62200cSmrg# GROFF:	 returns the path of the groff program found
2048ce62200cSmrg#		 returns the path set by the user in the environment
2049ce62200cSmrg# --with-groff:	 'yes' user instructs the module to use groff
2050ce62200cSmrg#		 'no' user instructs the module not to use groff
2051ce62200cSmrg#
2052ce62200cSmrg# Added in version 1.9.0:
2053ce62200cSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2054ce62200cSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2055ce62200cSmrg#		   psselect from the psutils package.
2056ce62200cSmrg#		   the ghostcript package. Refer to the grohtml man pages
2057ce62200cSmrg#
2058ce62200cSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2059ce62200cSmrg#
2060ce62200cSmrg# OS and distros often splits groff in a basic and full package, the former
2061ce62200cSmrg# having the groff program and the later having devices, fonts and macros
2062ce62200cSmrg# Checking for the groff executable is not enough.
2063ce62200cSmrg#
2064ce62200cSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2065ce62200cSmrg# unset HAVE_GROFF or GROFF env variables.
2066ce62200cSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2067ce62200cSmrg#
2068ce62200cSmrgAC_DEFUN([XORG_WITH_GROFF],[
2069ce62200cSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2070a733a5bfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2071ce62200cSmrgAC_ARG_WITH(groff,
2072ce62200cSmrg	AS_HELP_STRING([--with-groff],
2073a733a5bfSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2074a733a5bfSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2075a733a5bfSmrgm4_undefine([_defopt])
2076ce62200cSmrg
2077ce62200cSmrgif test "x$use_groff" = x"auto"; then
2078ce62200cSmrg   AC_PATH_PROG([GROFF], [groff])
2079ce62200cSmrg   if test "x$GROFF" = "x"; then
2080ce62200cSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2081ce62200cSmrg	have_groff=no
2082ce62200cSmrg   else
2083ce62200cSmrg        have_groff=yes
2084ce62200cSmrg   fi
2085ce62200cSmrgelif test "x$use_groff" = x"yes" ; then
2086ce62200cSmrg   AC_PATH_PROG([GROFF], [groff])
2087ce62200cSmrg   if test "x$GROFF" = "x"; then
2088ce62200cSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2089ce62200cSmrg   fi
2090ce62200cSmrg   have_groff=yes
2091ce62200cSmrgelif test "x$use_groff" = x"no" ; then
2092ce62200cSmrg   if test "x$GROFF" != "x"; then
2093ce62200cSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2094ce62200cSmrg   fi
2095ce62200cSmrg   have_groff=no
2096ce62200cSmrgelse
2097ce62200cSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2098ce62200cSmrgfi
2099ce62200cSmrg
2100ce62200cSmrg# We have groff, test for the presence of the macro packages
2101ce62200cSmrgif test "x$have_groff" = x"yes"; then
2102ce62200cSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2103ce62200cSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2104ce62200cSmrg        groff_ms_works=yes
2105ce62200cSmrg    else
2106ce62200cSmrg        groff_ms_works=no
2107ce62200cSmrg    fi
2108ce62200cSmrg    AC_MSG_RESULT([$groff_ms_works])
2109ce62200cSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2110ce62200cSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2111ce62200cSmrg        groff_mm_works=yes
2112ce62200cSmrg    else
2113ce62200cSmrg        groff_mm_works=no
2114ce62200cSmrg    fi
2115ce62200cSmrg    AC_MSG_RESULT([$groff_mm_works])
2116ce62200cSmrgfi
2117ce62200cSmrg
2118ce62200cSmrg# We have groff, test for HTML dependencies, one command per package
2119ce62200cSmrgif test "x$have_groff" = x"yes"; then
2120ce62200cSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2121ce62200cSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2122ce62200cSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2123ce62200cSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2124ce62200cSmrg      have_groff_html=yes
2125ce62200cSmrg   else
2126ce62200cSmrg      have_groff_html=no
2127ce62200cSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2128ce62200cSmrg   fi
2129ce62200cSmrgfi
2130ce62200cSmrg
2131ce62200cSmrg# Set Automake conditionals for Makefiles
2132ce62200cSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2133ce62200cSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2134ce62200cSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2135ce62200cSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2136ce62200cSmrg]) # XORG_WITH_GROFF
2137ce62200cSmrg
2138a733a5bfSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2139a733a5bfSmrg# ---------------------------------------
2140ce62200cSmrg# Minimum version: 1.6.0
2141a733a5bfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2142a733a5bfSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2143ce62200cSmrg#
2144ce62200cSmrg# Documentation tools are not always available on all platforms and sometimes
2145ce62200cSmrg# not at the appropriate level. This macro enables a module to test for the
2146ce62200cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2147ce62200cSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2148a733a5bfSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2149a733a5bfSmrg# --with-fop assumes 'auto'.
2150ce62200cSmrg#
2151ce62200cSmrg# Interface to module:
2152ce62200cSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2153ce62200cSmrg# FOP:	 	returns the path of the fop program found
2154ce62200cSmrg#		returns the path set by the user in the environment
2155ce62200cSmrg# --with-fop: 	'yes' user instructs the module to use fop
2156ce62200cSmrg#		'no' user instructs the module not to use fop
2157ce62200cSmrg#
2158ce62200cSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2159ce62200cSmrg#
2160ce62200cSmrgAC_DEFUN([XORG_WITH_FOP],[
2161ce62200cSmrgAC_ARG_VAR([FOP], [Path to fop command])
2162a733a5bfSmrgm4_define([_defopt], m4_default([$2], [auto]))
2163ce62200cSmrgAC_ARG_WITH(fop,
2164ce62200cSmrg	AS_HELP_STRING([--with-fop],
2165a733a5bfSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2166a733a5bfSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2167a733a5bfSmrgm4_undefine([_defopt])
2168ce62200cSmrg
2169ce62200cSmrgif test "x$use_fop" = x"auto"; then
2170ce62200cSmrg   AC_PATH_PROG([FOP], [fop])
2171ce62200cSmrg   if test "x$FOP" = "x"; then
2172ce62200cSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2173ce62200cSmrg	have_fop=no
2174ce62200cSmrg   else
2175ce62200cSmrg        have_fop=yes
2176ce62200cSmrg   fi
2177ce62200cSmrgelif test "x$use_fop" = x"yes" ; then
2178ce62200cSmrg   AC_PATH_PROG([FOP], [fop])
2179ce62200cSmrg   if test "x$FOP" = "x"; then
2180ce62200cSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2181ce62200cSmrg   fi
2182ce62200cSmrg   have_fop=yes
2183ce62200cSmrgelif test "x$use_fop" = x"no" ; then
2184ce62200cSmrg   if test "x$FOP" != "x"; then
2185ce62200cSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2186ce62200cSmrg   fi
2187ce62200cSmrg   have_fop=no
2188ce62200cSmrgelse
2189ce62200cSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2190ce62200cSmrgfi
2191a733a5bfSmrg
2192a733a5bfSmrg# Test for a minimum version of fop, if provided.
2193a733a5bfSmrgm4_ifval([$1],
2194a733a5bfSmrg[if test "$have_fop" = yes; then
2195a733a5bfSmrg    # scrape the fop version
2196a733a5bfSmrg    AC_MSG_CHECKING([for fop minimum version])
2197a733a5bfSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2198a733a5bfSmrg    AC_MSG_RESULT([$fop_version])
2199a733a5bfSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2200a733a5bfSmrg        [if test "x$use_fop" = xauto; then
2201a733a5bfSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2202a733a5bfSmrg            have_fop=no
2203a733a5bfSmrg        else
2204a733a5bfSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2205a733a5bfSmrg        fi])
2206a733a5bfSmrgfi])
2207ce62200cSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2208ce62200cSmrg]) # XORG_WITH_FOP
2209ce62200cSmrg
2210a733a5bfSmrg# XORG_WITH_PS2PDF([DEFAULT])
2211ce62200cSmrg# ----------------
2212ce62200cSmrg# Minimum version: 1.6.0
2213a733a5bfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2214ce62200cSmrg#
2215ce62200cSmrg# Documentation tools are not always available on all platforms and sometimes
2216ce62200cSmrg# not at the appropriate level. This macro enables a module to test for the
2217ce62200cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2218ce62200cSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2219a733a5bfSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2220a733a5bfSmrg# --with-ps2pdf assumes 'auto'.
2221ce62200cSmrg#
2222ce62200cSmrg# Interface to module:
2223ce62200cSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2224ce62200cSmrg# PS2PDF:	returns the path of the ps2pdf program found
2225ce62200cSmrg#		returns the path set by the user in the environment
2226ce62200cSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2227ce62200cSmrg#		 'no' user instructs the module not to use ps2pdf
2228ce62200cSmrg#
2229ce62200cSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2230ce62200cSmrg#
2231ce62200cSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2232ce62200cSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2233a733a5bfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2234ce62200cSmrgAC_ARG_WITH(ps2pdf,
2235ce62200cSmrg	AS_HELP_STRING([--with-ps2pdf],
2236a733a5bfSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2237a733a5bfSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2238a733a5bfSmrgm4_undefine([_defopt])
2239ce62200cSmrg
2240ce62200cSmrgif test "x$use_ps2pdf" = x"auto"; then
2241ce62200cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2242ce62200cSmrg   if test "x$PS2PDF" = "x"; then
2243ce62200cSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2244ce62200cSmrg	have_ps2pdf=no
2245ce62200cSmrg   else
2246ce62200cSmrg        have_ps2pdf=yes
2247ce62200cSmrg   fi
2248ce62200cSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2249ce62200cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2250ce62200cSmrg   if test "x$PS2PDF" = "x"; then
2251ce62200cSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2252ce62200cSmrg   fi
2253ce62200cSmrg   have_ps2pdf=yes
2254ce62200cSmrgelif test "x$use_ps2pdf" = x"no" ; then
2255ce62200cSmrg   if test "x$PS2PDF" != "x"; then
2256ce62200cSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2257ce62200cSmrg   fi
2258ce62200cSmrg   have_ps2pdf=no
2259ce62200cSmrgelse
2260ce62200cSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2261ce62200cSmrgfi
2262ce62200cSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2263ce62200cSmrg]) # XORG_WITH_PS2PDF
2264ce62200cSmrg
2265ce62200cSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2266ce62200cSmrg# ----------------
2267ce62200cSmrg# Minimum version: 1.6.0
2268ce62200cSmrg#
2269ce62200cSmrg# Documentation tools are not always available on all platforms and sometimes
2270ce62200cSmrg# not at the appropriate level. This macro enables a builder to skip all
2271ce62200cSmrg# documentation targets except traditional man pages.
2272ce62200cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2273ce62200cSmrg# maximum flexibilty in controlling documentation building.
2274ce62200cSmrg# Refer to:
2275ce62200cSmrg# XORG_WITH_XMLTO         --with-xmlto
2276ce62200cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2277ce62200cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2278ce62200cSmrg# XORG_WITH_FOP           --with-fop
2279ce62200cSmrg# XORG_WITH_GROFF         --with-groff
2280ce62200cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2281ce62200cSmrg#
2282ce62200cSmrg# Interface to module:
2283ce62200cSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2284ce62200cSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2285ce62200cSmrg#		 'no' user instructs the module not to generate docs
2286ce62200cSmrg# parm1:	specify the default value, yes or no.
2287ce62200cSmrg#
2288ce62200cSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2289a733a5bfSmrgm4_define([docs_default], m4_default([$1], [yes]))
2290ce62200cSmrgAC_ARG_ENABLE(docs,
2291ce62200cSmrg	AS_HELP_STRING([--enable-docs],
2292a733a5bfSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2293a733a5bfSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2294a733a5bfSmrgm4_undefine([docs_default])
2295ce62200cSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2296ce62200cSmrgAC_MSG_CHECKING([whether to build documentation])
2297ce62200cSmrgAC_MSG_RESULT([$build_docs])
2298ce62200cSmrg]) # XORG_ENABLE_DOCS
2299ce62200cSmrg
2300ce62200cSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2301ce62200cSmrg# ----------------
2302ce62200cSmrg# Minimum version: 1.6.0
2303ce62200cSmrg#
2304ce62200cSmrg# This macro enables a builder to skip all developer documentation.
2305ce62200cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2306ce62200cSmrg# maximum flexibilty in controlling documentation building.
2307ce62200cSmrg# Refer to:
2308ce62200cSmrg# XORG_WITH_XMLTO         --with-xmlto
2309ce62200cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2310ce62200cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2311ce62200cSmrg# XORG_WITH_FOP           --with-fop
2312ce62200cSmrg# XORG_WITH_GROFF         --with-groff
2313ce62200cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2314ce62200cSmrg#
2315ce62200cSmrg# Interface to module:
2316ce62200cSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2317ce62200cSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2318ce62200cSmrg#			'no' user instructs the module not to generate developer docs
2319ce62200cSmrg# parm1:		specify the default value, yes or no.
2320ce62200cSmrg#
2321ce62200cSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2322a733a5bfSmrgm4_define([devel_default], m4_default([$1], [yes]))
2323ce62200cSmrgAC_ARG_ENABLE(devel-docs,
2324ce62200cSmrg	AS_HELP_STRING([--enable-devel-docs],
2325a733a5bfSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2326a733a5bfSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2327a733a5bfSmrgm4_undefine([devel_default])
2328ce62200cSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2329ce62200cSmrgAC_MSG_CHECKING([whether to build developer documentation])
2330ce62200cSmrgAC_MSG_RESULT([$build_devel_docs])
2331ce62200cSmrg]) # XORG_ENABLE_DEVEL_DOCS
2332ce62200cSmrg
2333ce62200cSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2334ce62200cSmrg# ----------------
2335ce62200cSmrg# Minimum version: 1.6.0
2336ce62200cSmrg#
2337ce62200cSmrg# This macro enables a builder to skip all functional specification targets.
2338ce62200cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2339ce62200cSmrg# maximum flexibilty in controlling documentation building.
2340ce62200cSmrg# Refer to:
2341ce62200cSmrg# XORG_WITH_XMLTO         --with-xmlto
2342ce62200cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2343ce62200cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2344ce62200cSmrg# XORG_WITH_FOP           --with-fop
2345ce62200cSmrg# XORG_WITH_GROFF         --with-groff
2346ce62200cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2347ce62200cSmrg#
2348ce62200cSmrg# Interface to module:
2349ce62200cSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2350ce62200cSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2351ce62200cSmrg#			'no' user instructs the module not to generate specs
2352ce62200cSmrg# parm1:		specify the default value, yes or no.
2353ce62200cSmrg#
2354ce62200cSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2355a733a5bfSmrgm4_define([spec_default], m4_default([$1], [yes]))
2356ce62200cSmrgAC_ARG_ENABLE(specs,
2357ce62200cSmrg	AS_HELP_STRING([--enable-specs],
2358a733a5bfSmrg	   [Enable building the specs (default: ]spec_default[)]),
2359a733a5bfSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2360a733a5bfSmrgm4_undefine([spec_default])
2361ce62200cSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2362ce62200cSmrgAC_MSG_CHECKING([whether to build functional specifications])
2363ce62200cSmrgAC_MSG_RESULT([$build_specs])
2364ce62200cSmrg]) # XORG_ENABLE_SPECS
2365ce62200cSmrg
2366a733a5bfSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2367a733a5bfSmrg# ----------------------------------------------
2368a733a5bfSmrg# Minimum version: 1.13.0
2369a733a5bfSmrg#
2370a733a5bfSmrg# This macro enables a builder to enable/disable unit testing
2371a733a5bfSmrg# It makes no assumption about the test cases implementation
2372a733a5bfSmrg# Test cases may or may not use Automake "Support for test suites"
2373a733a5bfSmrg# They may or may not use the software utility library GLib
2374a733a5bfSmrg#
2375a733a5bfSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2376a733a5bfSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2377a733a5bfSmrg# The variable enable_unit_tests is used by other macros in this file.
2378a733a5bfSmrg#
2379a733a5bfSmrg# Interface to module:
2380a733a5bfSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2381a733a5bfSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2382a733a5bfSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2383a733a5bfSmrg#			'no' user instructs the module not to build tests
2384a733a5bfSmrg# parm1:		specify the default value, yes or no.
2385a733a5bfSmrg#
2386a733a5bfSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2387a733a5bfSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2388a733a5bfSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2389a733a5bfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2390a733a5bfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2391a733a5bfSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2392a733a5bfSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2393a733a5bfSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2394a733a5bfSmrgm4_undefine([_defopt])
2395a733a5bfSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2396a733a5bfSmrgAC_MSG_CHECKING([whether to build unit test cases])
2397a733a5bfSmrgAC_MSG_RESULT([$enable_unit_tests])
2398a733a5bfSmrg]) # XORG_ENABLE_UNIT_TESTS
2399a733a5bfSmrg
2400a733a5bfSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2401a733a5bfSmrg# ------------------------------------------------------
2402a733a5bfSmrg# Minimum version: 1.17.0
2403a733a5bfSmrg#
2404a733a5bfSmrg# This macro enables a builder to enable/disable integration testing
2405a733a5bfSmrg# It makes no assumption about the test cases' implementation
2406a733a5bfSmrg# Test cases may or may not use Automake "Support for test suites"
2407a733a5bfSmrg#
2408a733a5bfSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2409a733a5bfSmrg# usually requires less dependencies and may be built and run under less
2410a733a5bfSmrg# stringent environments than integration tests.
2411a733a5bfSmrg#
2412a733a5bfSmrg# Interface to module:
2413a733a5bfSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2414a733a5bfSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2415a733a5bfSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2416a733a5bfSmrg#                             'no' user instructs the module not to build tests
2417a733a5bfSmrg# parm1:                      specify the default value, yes or no.
2418a733a5bfSmrg#
2419a733a5bfSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2420a733a5bfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2421a733a5bfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2422a733a5bfSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2423a733a5bfSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2424a733a5bfSmrg	[enable_integration_tests=$enableval],
2425a733a5bfSmrg	[enable_integration_tests=]_defopt)
2426a733a5bfSmrgm4_undefine([_defopt])
2427a733a5bfSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2428a733a5bfSmrg	[test "x$enable_integration_tests" != xno])
2429a733a5bfSmrgAC_MSG_CHECKING([whether to build unit test cases])
2430a733a5bfSmrgAC_MSG_RESULT([$enable_integration_tests])
2431a733a5bfSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2432a733a5bfSmrg
2433a733a5bfSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2434a733a5bfSmrg# ----------------------------------------
2435a733a5bfSmrg# Minimum version: 1.13.0
2436a733a5bfSmrg#
2437a733a5bfSmrg# GLib is a library which provides advanced data structures and functions.
2438a733a5bfSmrg# This macro enables a module to test for the presence of Glib.
2439a733a5bfSmrg#
2440a733a5bfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2441a733a5bfSmrg# Otherwise the value of $enable_unit_tests is blank.
2442a733a5bfSmrg#
2443a733a5bfSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2444a733a5bfSmrg# test support usually requires less dependencies and may be built and run under
2445a733a5bfSmrg# less stringent environments than integration tests.
2446a733a5bfSmrg#
2447a733a5bfSmrg# Interface to module:
2448a733a5bfSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2449a733a5bfSmrg# with_glib: used in configure.ac to know if GLib has been found
2450a733a5bfSmrg# --with-glib:	'yes' user instructs the module to use glib
2451a733a5bfSmrg#		'no' user instructs the module not to use glib
2452a733a5bfSmrg#
2453a733a5bfSmrgAC_DEFUN([XORG_WITH_GLIB],[
2454a733a5bfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2455a733a5bfSmrgm4_define([_defopt], m4_default([$2], [auto]))
2456a733a5bfSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2457a733a5bfSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2458a733a5bfSmrg	[with_glib=$withval], [with_glib=]_defopt)
2459a733a5bfSmrgm4_undefine([_defopt])
2460a733a5bfSmrg
2461a733a5bfSmrghave_glib=no
2462a733a5bfSmrg# Do not probe GLib if user explicitly disabled unit testing
2463a733a5bfSmrgif test "x$enable_unit_tests" != x"no"; then
2464a733a5bfSmrg  # Do not probe GLib if user explicitly disabled it
2465a733a5bfSmrg  if test "x$with_glib" != x"no"; then
2466a733a5bfSmrg    m4_ifval(
2467a733a5bfSmrg      [$1],
2468a733a5bfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2469a733a5bfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2470a733a5bfSmrg    )
2471a733a5bfSmrg  fi
2472a733a5bfSmrgfi
2473a733a5bfSmrg
2474a733a5bfSmrg# Not having GLib when unit testing has been explicitly requested is an error
2475a733a5bfSmrgif test "x$enable_unit_tests" = x"yes"; then
2476a733a5bfSmrg  if test "x$have_glib" = x"no"; then
2477a733a5bfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2478a733a5bfSmrg  fi
2479a733a5bfSmrgfi
2480a733a5bfSmrg
2481a733a5bfSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2482a733a5bfSmrgif test "x$enable_unit_tests" = x"no"; then
2483a733a5bfSmrg  if test "x$with_glib" = x"yes"; then
2484a733a5bfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2485a733a5bfSmrg  fi
2486a733a5bfSmrgfi
2487a733a5bfSmrg
2488a733a5bfSmrg# Not having GLib when it has been explicitly requested is an error
2489a733a5bfSmrgif test "x$with_glib" = x"yes"; then
2490a733a5bfSmrg  if test "x$have_glib" = x"no"; then
2491a733a5bfSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2492a733a5bfSmrg  fi
2493a733a5bfSmrgfi
2494a733a5bfSmrg
2495a733a5bfSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2496a733a5bfSmrg]) # XORG_WITH_GLIB
2497a733a5bfSmrg
2498a733a5bfSmrg# XORG_LD_WRAP([required|optional])
2499a733a5bfSmrg# ---------------------------------
2500a733a5bfSmrg# Minimum version: 1.13.0
2501a733a5bfSmrg#
2502a733a5bfSmrg# Check if linker supports -wrap, passed via compiler flags
2503a733a5bfSmrg#
2504a733a5bfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2505a733a5bfSmrg# Otherwise the value of $enable_unit_tests is blank.
2506a733a5bfSmrg#
2507a733a5bfSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2508a733a5bfSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2509a733a5bfSmrg# available, an argument of "optional" allows use when some unit tests require
2510a733a5bfSmrg# ld -wrap and others do not.
2511a733a5bfSmrg#
2512a733a5bfSmrgAC_DEFUN([XORG_LD_WRAP],[
2513a733a5bfSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2514a733a5bfSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2515a733a5bfSmrg                      void __wrap_exit(int status) { return; }],
2516a733a5bfSmrg                     [exit(0);])])
2517a733a5bfSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2518a733a5bfSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2519a733a5bfSmrg  if test "x$have_ld_wrap" = x"no"; then
2520a733a5bfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2521a733a5bfSmrg  fi
2522a733a5bfSmrgfi
2523a733a5bfSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2524a733a5bfSmrg#
2525a733a5bfSmrg]) # XORG_LD_WRAP
2526a733a5bfSmrg
2527a733a5bfSmrg# XORG_CHECK_LINKER_FLAGS
2528a733a5bfSmrg# -----------------------
2529a733a5bfSmrg# SYNOPSIS
2530a733a5bfSmrg#
2531a733a5bfSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2532a733a5bfSmrg#
2533a733a5bfSmrg# DESCRIPTION
2534a733a5bfSmrg#
2535a733a5bfSmrg#   Check whether the given linker FLAGS work with the current language's
2536a733a5bfSmrg#   linker, or whether they give an error.
2537a733a5bfSmrg#
2538a733a5bfSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2539a733a5bfSmrg#   success/failure.
2540a733a5bfSmrg#
2541a733a5bfSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2542a733a5bfSmrg#
2543a733a5bfSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2544a733a5bfSmrg#
2545a733a5bfSmrg# LICENSE
2546a733a5bfSmrg#
2547a733a5bfSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2548a733a5bfSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2549a733a5bfSmrg#   Copyright (c) 2009 Matteo Frigo
2550a733a5bfSmrg#
2551a733a5bfSmrg#   This program is free software: you can redistribute it and/or modify it
2552a733a5bfSmrg#   under the terms of the GNU General Public License as published by the
2553a733a5bfSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2554a733a5bfSmrg#   option) any later version.
2555a733a5bfSmrg#
2556a733a5bfSmrg#   This program is distributed in the hope that it will be useful, but
2557a733a5bfSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2558a733a5bfSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2559a733a5bfSmrg#   Public License for more details.
2560a733a5bfSmrg#
2561a733a5bfSmrg#   You should have received a copy of the GNU General Public License along
2562a733a5bfSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2563a733a5bfSmrg#
2564a733a5bfSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2565a733a5bfSmrg#   gives unlimited permission to copy, distribute and modify the configure
2566a733a5bfSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2567a733a5bfSmrg#   need not follow the terms of the GNU General Public License when using
2568a733a5bfSmrg#   or distributing such scripts, even though portions of the text of the
2569a733a5bfSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2570a733a5bfSmrg#   all other use of the material that constitutes the Autoconf Macro.
2571a733a5bfSmrg#
2572a733a5bfSmrg#   This special exception to the GPL applies to versions of the Autoconf
2573a733a5bfSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2574a733a5bfSmrg#   modified version of the Autoconf Macro, you may extend this special
2575a733a5bfSmrg#   exception to the GPL to apply to your modified version as well.#
2576a733a5bfSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2577a733a5bfSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2578a733a5bfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2579a733a5bfSmrgAS_LITERAL_IF([$1],
2580a733a5bfSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2581a733a5bfSmrg      ax_save_FLAGS=$LDFLAGS
2582a733a5bfSmrg      LDFLAGS="$1"
2583a733a5bfSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2584a733a5bfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2585a733a5bfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2586a733a5bfSmrg      LDFLAGS=$ax_save_FLAGS])],
2587a733a5bfSmrg  [ax_save_FLAGS=$LDFLAGS
2588a733a5bfSmrg   LDFLAGS="$1"
2589a733a5bfSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2590a733a5bfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2591a733a5bfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2592a733a5bfSmrg   LDFLAGS=$ax_save_FLAGS])
2593a733a5bfSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2594a733a5bfSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2595a733a5bfSmrgif test "x$xorg_check_linker_flags" = xyes; then
2596a733a5bfSmrg	m4_default([$2], :)
2597a733a5bfSmrgelse
2598a733a5bfSmrg	m4_default([$3], :)
2599a733a5bfSmrgfi
2600a733a5bfSmrg]) # XORG_CHECK_LINKER_FLAGS
2601a733a5bfSmrg
2602a733a5bfSmrg# XORG_MEMORY_CHECK_FLAGS
2603a733a5bfSmrg# -----------------------
2604a733a5bfSmrg# Minimum version: 1.16.0
2605a733a5bfSmrg#
2606a733a5bfSmrg# This macro attempts to find appropriate memory checking functionality
2607a733a5bfSmrg# for various platforms which unit testing code may use to catch various
2608a733a5bfSmrg# forms of memory allocation and access errors in testing.
2609a733a5bfSmrg#
2610a733a5bfSmrg# Interface to module:
2611a733a5bfSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2612a733a5bfSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2613a733a5bfSmrg#
2614a733a5bfSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2615a733a5bfSmrg#
2616a733a5bfSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2617a733a5bfSmrg
2618a733a5bfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2619a733a5bfSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2620a733a5bfSmrg           [Environment variables to enable memory checking in tests])
2621a733a5bfSmrg
2622a733a5bfSmrg# Check for different types of support on different platforms
2623a733a5bfSmrgcase $host_os in
2624a733a5bfSmrg    solaris*)
2625a733a5bfSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2626a733a5bfSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2627a733a5bfSmrg        ;;
2628a733a5bfSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2629a733a5bfSmrg        # both directly and inverted, so should not be 0 or 255.
2630a733a5bfSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2631a733a5bfSmrg        ;;
2632a733a5bfSmrg    darwin*)
2633a733a5bfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2634a733a5bfSmrg        ;;
2635a733a5bfSmrg    *bsd*)
2636a733a5bfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2637a733a5bfSmrg        ;;
2638a733a5bfSmrgesac
2639a733a5bfSmrg
2640a733a5bfSmrg# User supplied flags override default flags
2641a733a5bfSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2642a733a5bfSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2643a733a5bfSmrgfi
2644a733a5bfSmrg
2645a733a5bfSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2646a733a5bfSmrg]) # XORG_WITH_LINT
2647a733a5bfSmrg
26481a30de1fSmrg# XORG_CHECK_MALLOC_ZERO
26491a30de1fSmrg# ----------------------
26501a30de1fSmrg# Minimum version: 1.0.0
26511a30de1fSmrg#
26521a30de1fSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
26531a30de1fSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
26541a30de1fSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
26551a30de1fSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
26561a30de1fSmrgAC_ARG_ENABLE(malloc0returnsnull,
2657b7fb5eacSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
26581a30de1fSmrg		       [malloc(0) returns NULL (default: auto)]),
26591a30de1fSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
26601a30de1fSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
26611a30de1fSmrg
26621a30de1fSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
26631a30de1fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2664a733a5bfSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2665a733a5bfSmrg#include <stdlib.h>
2666a733a5bfSmrg],[
26671a30de1fSmrg    char *m0, *r0, *c0, *p;
26681a30de1fSmrg    m0 = malloc(0);
26691a30de1fSmrg    p = malloc(10);
26701a30de1fSmrg    r0 = realloc(p,0);
2671a733a5bfSmrg    c0 = calloc(0,10);
2672a733a5bfSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2673a733a5bfSmrg])],
26741a30de1fSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2675ce62200cSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
2676ce62200cSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
26771a30de1fSmrgfi
26781a30de1fSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
26791a30de1fSmrg
26801a30de1fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
26811a30de1fSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
26821a30de1fSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
26831a30de1fSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
26841a30de1fSmrgelse
26851a30de1fSmrg	MALLOC_ZERO_CFLAGS=""
26861a30de1fSmrg	XMALLOC_ZERO_CFLAGS=""
26871a30de1fSmrg	XTMALLOC_ZERO_CFLAGS=""
26881a30de1fSmrgfi
26891a30de1fSmrg
26901a30de1fSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
26911a30de1fSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
26921a30de1fSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
26931a30de1fSmrg]) # XORG_CHECK_MALLOC_ZERO
26941a30de1fSmrg
26951a30de1fSmrg# XORG_WITH_LINT()
26961a30de1fSmrg# ----------------
26971a30de1fSmrg# Minimum version: 1.1.0
26981a30de1fSmrg#
2699ce62200cSmrg# This macro enables the use of a tool that flags some suspicious and
2700ce62200cSmrg# non-portable constructs (likely to be bugs) in C language source code.
2701ce62200cSmrg# It will attempt to locate the tool and use appropriate options.
2702ce62200cSmrg# There are various lint type tools on different platforms.
2703ce62200cSmrg#
2704ce62200cSmrg# Interface to module:
2705ce62200cSmrg# LINT:		returns the path to the tool found on the platform
2706ce62200cSmrg#		or the value set to LINT on the configure cmd line
2707ce62200cSmrg#		also an Automake conditional
2708ce62200cSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2709ce62200cSmrg#
2710ce62200cSmrg# --with-lint:	'yes' user instructs the module to use lint
2711ce62200cSmrg#		'no' user instructs the module not to use lint (default)
2712ce62200cSmrg#
2713ce62200cSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2714ce62200cSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
27151a30de1fSmrg#
27161a30de1fSmrgAC_DEFUN([XORG_WITH_LINT],[
27171a30de1fSmrg
2718ce62200cSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2719ce62200cSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2720b7fb5eacSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27211a30de1fSmrg		[Use a lint-style source code checker (default: disabled)])],
27221a30de1fSmrg		[use_lint=$withval], [use_lint=no])
2723ce62200cSmrg
2724ce62200cSmrg# Obtain platform specific info like program name and options
2725ce62200cSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2726ce62200cSmrgcase $host_os in
2727ce62200cSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2728ce62200cSmrg	lint_name=splint
2729ce62200cSmrg	lint_options="-badflag"
2730ce62200cSmrg	;;
2731ce62200cSmrg  *freebsd* | *netbsd*)
2732ce62200cSmrg	lint_name=lint
2733ce62200cSmrg	lint_options="-u -b"
2734ce62200cSmrg	;;
2735ce62200cSmrg  *solaris*)
2736ce62200cSmrg	lint_name=lint
2737ce62200cSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2738ce62200cSmrg	;;
2739ce62200cSmrgesac
2740ce62200cSmrg
2741ce62200cSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2742ce62200cSmrgif test "x$use_lint" = x"yes" ; then
2743ce62200cSmrg   AC_PATH_PROG([LINT], [$lint_name])
2744ce62200cSmrg   if test "x$LINT" = "x"; then
2745ce62200cSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2746ce62200cSmrg   fi
2747ce62200cSmrgelif test "x$use_lint" = x"no" ; then
2748ce62200cSmrg   if test "x$LINT" != "x"; then
2749ce62200cSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2750ce62200cSmrg   fi
27511a30de1fSmrgelse
2752ce62200cSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
27531a30de1fSmrgfi
2754ce62200cSmrg
2755ce62200cSmrg# User supplied flags override default flags
2756ce62200cSmrgif test "x$LINT_FLAGS" != "x"; then
2757ce62200cSmrg   lint_options=$LINT_FLAGS
27581a30de1fSmrgfi
27591a30de1fSmrg
2760ce62200cSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2761ce62200cSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
27621a30de1fSmrg
27631a30de1fSmrg]) # XORG_WITH_LINT
27641a30de1fSmrg
27651a30de1fSmrg# XORG_LINT_LIBRARY(LIBNAME)
27661a30de1fSmrg# --------------------------
27671a30de1fSmrg# Minimum version: 1.1.0
27681a30de1fSmrg#
27691a30de1fSmrg# Sets up flags for building lint libraries for checking programs that call
27701a30de1fSmrg# functions in the library.
27711a30de1fSmrg#
2772ce62200cSmrg# Interface to module:
2773ce62200cSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2774ce62200cSmrg# MAKE_LINT_LIB		- Automake conditional
2775ce62200cSmrg#
2776ce62200cSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2777ce62200cSmrg#			  - 'no' user instructs the module not to create a lint library (default)
27781a30de1fSmrg
27791a30de1fSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
27801a30de1fSmrgAC_REQUIRE([XORG_WITH_LINT])
2781b7fb5eacSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
27821a30de1fSmrg	[Create lint library (default: disabled)])],
27831a30de1fSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2784ce62200cSmrg
2785ce62200cSmrgif test "x$make_lint_lib" = x"yes" ; then
2786ce62200cSmrg   LINTLIB=llib-l$1.ln
2787ce62200cSmrg   if test "x$LINT" = "x"; then
2788ce62200cSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2789ce62200cSmrg   fi
2790ce62200cSmrgelif test "x$make_lint_lib" != x"no" ; then
2791ce62200cSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
27921a30de1fSmrgfi
2793ce62200cSmrg
27941a30de1fSmrgAC_SUBST(LINTLIB)
27951a30de1fSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
27961a30de1fSmrg
27971a30de1fSmrg]) # XORG_LINT_LIBRARY
27981a30de1fSmrg
2799a733a5bfSmrg# XORG_COMPILER_BRAND
2800a733a5bfSmrg# -------------------
2801a733a5bfSmrg# Minimum version: 1.14.0
2802a733a5bfSmrg#
2803a733a5bfSmrg# Checks for various brands of compilers and sets flags as appropriate:
2804a733a5bfSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2805a733a5bfSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2806a733a5bfSmrg#   clang compiler - sets CLANGCC to "yes"
2807a733a5bfSmrg#   Intel compiler - sets INTELCC to "yes"
2808a733a5bfSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2809a733a5bfSmrg#
2810a733a5bfSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2811a733a5bfSmrgAC_LANG_CASE(
2812a733a5bfSmrg	[C], [
2813a733a5bfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2814a733a5bfSmrg	],
2815a733a5bfSmrg	[C++], [
2816a733a5bfSmrg		AC_REQUIRE([AC_PROG_CXX])
2817a733a5bfSmrg	]
2818a733a5bfSmrg)
2819a733a5bfSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2820a733a5bfSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2821a733a5bfSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2822a733a5bfSmrg]) # XORG_COMPILER_BRAND
2823a733a5bfSmrg
2824a733a5bfSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2825a733a5bfSmrg# ---------------
2826a733a5bfSmrg# Minimum version: 1.16.0
2827a733a5bfSmrg#
2828a733a5bfSmrg# Test if the compiler works when passed the given flag as a command line argument.
2829a733a5bfSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2830a733a5bfSmrg# next flag in the list until there are no more options.
2831a733a5bfSmrg#
2832a733a5bfSmrg# Note that this does not guarantee that the compiler supports the flag as some
2833a733a5bfSmrg# compilers will simply ignore arguments that they do not understand, but we do
2834a733a5bfSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2835a733a5bfSmrg# -Werror=unused-command-line-argument
2836a733a5bfSmrg#
2837a733a5bfSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2838a733a5bfSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2839a733a5bfSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2840a733a5bfSmrg
2841a733a5bfSmrgAC_LANG_COMPILER_REQUIRE
2842a733a5bfSmrg
2843a733a5bfSmrgAC_LANG_CASE(
2844a733a5bfSmrg	[C], [
2845a733a5bfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2846a733a5bfSmrg		define([PREFIX], [C])
2847a733a5bfSmrg		define([CACHE_PREFIX], [cc])
2848a733a5bfSmrg		define([COMPILER], [$CC])
2849a733a5bfSmrg	],
2850a733a5bfSmrg	[C++], [
2851a733a5bfSmrg		define([PREFIX], [CXX])
2852a733a5bfSmrg		define([CACHE_PREFIX], [cxx])
2853a733a5bfSmrg		define([COMPILER], [$CXX])
2854a733a5bfSmrg	]
2855a733a5bfSmrg)
2856a733a5bfSmrg
2857a733a5bfSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2858a733a5bfSmrg
2859a733a5bfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2860a733a5bfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2861a733a5bfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2862a733a5bfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2863a733a5bfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2864a733a5bfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2865a733a5bfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2866a733a5bfSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2867a733a5bfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2868a733a5bfSmrgfi
2869a733a5bfSmrg
2870a733a5bfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2871a733a5bfSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2872a733a5bfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2873a733a5bfSmrg	fi
2874a733a5bfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2875a733a5bfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2876a733a5bfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2877a733a5bfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2878a733a5bfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2879a733a5bfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2880a733a5bfSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2881a733a5bfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2882a733a5bfSmrgfi
2883a733a5bfSmrg
2884a733a5bfSmrgfound="no"
2885a733a5bfSmrgm4_foreach([flag], m4_cdr($@), [
2886a733a5bfSmrg	if test $found = "no" ; then
2887a733a5bfSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
2888a733a5bfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2889a733a5bfSmrg		fi
2890a733a5bfSmrg
2891a733a5bfSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
2892a733a5bfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2893a733a5bfSmrg		fi
2894a733a5bfSmrg
2895a733a5bfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2896a733a5bfSmrg
2897a733a5bfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2898a733a5bfSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2899a733a5bfSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2900a733a5bfSmrg		AC_CACHE_VAL($cacheid,
2901a733a5bfSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2902a733a5bfSmrg					     [eval $cacheid=yes],
2903a733a5bfSmrg					     [eval $cacheid=no])])
2904a733a5bfSmrg
2905a733a5bfSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2906a733a5bfSmrg
2907a733a5bfSmrg		eval supported=\$$cacheid
2908a733a5bfSmrg		AC_MSG_RESULT([$supported])
2909a733a5bfSmrg		if test "$supported" = "yes" ; then
2910a733a5bfSmrg			$1="$$1 ]flag["
2911a733a5bfSmrg			found="yes"
2912a733a5bfSmrg		fi
2913a733a5bfSmrg	fi
2914a733a5bfSmrg])
2915a733a5bfSmrg]) # XORG_TESTSET_CFLAG
2916a733a5bfSmrg
2917a733a5bfSmrg# XORG_COMPILER_FLAGS
2918a733a5bfSmrg# ---------------
2919a733a5bfSmrg# Minimum version: 1.16.0
2920a733a5bfSmrg#
2921a733a5bfSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2922a733a5bfSmrg# arguments supported by the selected compiler which do NOT alter the generated
2923a733a5bfSmrg# code.  These arguments will cause the compiler to print various warnings
2924a733a5bfSmrg# during compilation AND turn a conservative set of warnings into errors.
2925a733a5bfSmrg#
2926a733a5bfSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2927a733a5bfSmrg# future versions of util-macros as options are added to new compilers.
2928a733a5bfSmrg#
2929a733a5bfSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2930a733a5bfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2931a733a5bfSmrg
2932a733a5bfSmrgAC_ARG_ENABLE(selective-werror,
2933a733a5bfSmrg              AS_HELP_STRING([--disable-selective-werror],
2934a733a5bfSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2935a733a5bfSmrg              [SELECTIVE_WERROR=$enableval],
2936a733a5bfSmrg              [SELECTIVE_WERROR=yes])
2937a733a5bfSmrg
2938a733a5bfSmrgAC_LANG_CASE(
2939a733a5bfSmrg        [C], [
2940a733a5bfSmrg                define([PREFIX], [C])
2941a733a5bfSmrg        ],
2942a733a5bfSmrg        [C++], [
2943a733a5bfSmrg                define([PREFIX], [CXX])
2944a733a5bfSmrg        ]
2945a733a5bfSmrg)
2946a733a5bfSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2947a733a5bfSmrgif test "x$SUNCC" = "xyes"; then
2948a733a5bfSmrg    [BASE_]PREFIX[FLAGS]="-v"
2949a733a5bfSmrgelse
2950a733a5bfSmrg    [BASE_]PREFIX[FLAGS]=""
2951a733a5bfSmrgfi
2952a733a5bfSmrg
2953a733a5bfSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2954a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2955a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2956a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2957a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2958a733a5bfSmrg
2959a733a5bfSmrgAC_LANG_CASE(
2960a733a5bfSmrg	[C], [
2961a733a5bfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2962a733a5bfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2963a733a5bfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2964a733a5bfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2965a733a5bfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2966a733a5bfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2967a733a5bfSmrg	]
2968a733a5bfSmrg)
2969a733a5bfSmrg
2970a733a5bfSmrg# This chunk adds additional warnings that could catch undesired effects.
2971a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2972a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2973a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2974a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2975a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2976a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2977a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2978a733a5bfSmrg
2979a733a5bfSmrg# These are currently disabled because they are noisy.  They will be enabled
2980a733a5bfSmrg# in the future once the codebase is sufficiently modernized to silence
2981a733a5bfSmrg# them.  For now, I don't want them to drown out the other warnings.
2982a733a5bfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2983a733a5bfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2984a733a5bfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2985a733a5bfSmrg
2986a733a5bfSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2987a733a5bfSmrg# when there are problems that should be fixed.
2988a733a5bfSmrg
2989a733a5bfSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2990a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2991a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2992a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2993a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2994a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2995a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2996a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2997a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2998a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2999a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3000a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3001a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3002a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3003a733a5bfSmrgelse
3004a733a5bfSmrgAC_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])
3005a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3006a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3007a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3008a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3009a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3010a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3011a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3012a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3013a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3014a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3015a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3016a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3017a733a5bfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3018a733a5bfSmrgfi
3019a733a5bfSmrg
3020a733a5bfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3021a733a5bfSmrg]) # XORG_COMPILER_FLAGS
3022a733a5bfSmrg
3023b7fb5eacSmrg# XORG_CWARNFLAGS
3024b7fb5eacSmrg# ---------------
3025b7fb5eacSmrg# Minimum version: 1.2.0
3026a733a5bfSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3027b7fb5eacSmrg#
3028b7fb5eacSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3029b7fb5eacSmrg#
3030a733a5bfSmrg# This function is deprecated because it defines -fno-strict-aliasing
3031a733a5bfSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3032a733a5bfSmrg# is needed, then it should be added explicitly in the module when
3033a733a5bfSmrg# it is updated to use BASE_CFLAGS.
3034a733a5bfSmrg#
3035b7fb5eacSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3036a733a5bfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3037a733a5bfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3038a733a5bfSmrgAC_LANG_CASE(
3039a733a5bfSmrg	[C], [
3040a733a5bfSmrg		CWARNFLAGS="$BASE_CFLAGS"
3041a733a5bfSmrg		if  test "x$GCC" = xyes ; then
3042a733a5bfSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3043a733a5bfSmrg		fi
3044a733a5bfSmrg		AC_SUBST(CWARNFLAGS)
3045a733a5bfSmrg	]
3046a733a5bfSmrg)
3047b7fb5eacSmrg]) # XORG_CWARNFLAGS
3048b7fb5eacSmrg
3049b7fb5eacSmrg# XORG_STRICT_OPTION
3050b7fb5eacSmrg# -----------------------
3051b7fb5eacSmrg# Minimum version: 1.3.0
3052b7fb5eacSmrg#
3053a733a5bfSmrg# Add configure option to enable strict compilation flags, such as treating
3054a733a5bfSmrg# warnings as fatal errors.
3055a733a5bfSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3056a733a5bfSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3057a733a5bfSmrg#
3058a733a5bfSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3059a733a5bfSmrg# when strict compilation is unconditionally desired.
3060b7fb5eacSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3061b7fb5eacSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3062a733a5bfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3063b7fb5eacSmrg
3064b7fb5eacSmrgAC_ARG_ENABLE(strict-compilation,
3065b7fb5eacSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3066b7fb5eacSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3067b7fb5eacSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3068a733a5bfSmrg
3069a733a5bfSmrgAC_LANG_CASE(
3070a733a5bfSmrg        [C], [
3071a733a5bfSmrg                define([PREFIX], [C])
3072a733a5bfSmrg        ],
3073a733a5bfSmrg        [C++], [
3074a733a5bfSmrg                define([PREFIX], [CXX])
3075a733a5bfSmrg        ]
3076a733a5bfSmrg)
3077a733a5bfSmrg
3078a733a5bfSmrg[STRICT_]PREFIX[FLAGS]=""
3079a733a5bfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3080a733a5bfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3081a733a5bfSmrg
3082a733a5bfSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3083a733a5bfSmrg# activate it with -Werror, so we add it here explicitly.
3084a733a5bfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3085a733a5bfSmrg
3086b7fb5eacSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3087a733a5bfSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3088a733a5bfSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3089b7fb5eacSmrgfi
3090a733a5bfSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3091a733a5bfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3092a733a5bfSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3093b7fb5eacSmrg]) # XORG_STRICT_OPTION
3094b7fb5eacSmrg
3095b7fb5eacSmrg# XORG_DEFAULT_OPTIONS
3096b7fb5eacSmrg# --------------------
3097b7fb5eacSmrg# Minimum version: 1.3.0
3098b7fb5eacSmrg#
3099b7fb5eacSmrg# Defines default options for X.Org modules.
3100b7fb5eacSmrg#
3101b7fb5eacSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3102ce62200cSmrgAC_REQUIRE([AC_PROG_INSTALL])
3103a733a5bfSmrgXORG_COMPILER_FLAGS
3104b7fb5eacSmrgXORG_CWARNFLAGS
3105b7fb5eacSmrgXORG_STRICT_OPTION
3106b7fb5eacSmrgXORG_RELEASE_VERSION
3107b7fb5eacSmrgXORG_CHANGELOG
3108ce62200cSmrgXORG_INSTALL
3109b7fb5eacSmrgXORG_MANPAGE_SECTIONS
3110ce62200cSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3111ce62200cSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3112b7fb5eacSmrg]) # XORG_DEFAULT_OPTIONS
3113ce62200cSmrg
3114ce62200cSmrg# XORG_INSTALL()
3115ce62200cSmrg# ----------------
3116ce62200cSmrg# Minimum version: 1.4.0
3117ce62200cSmrg#
3118ce62200cSmrg# Defines the variable INSTALL_CMD as the command to copy
3119ce62200cSmrg# INSTALL from $prefix/share/util-macros.
3120ce62200cSmrg#
3121ce62200cSmrgAC_DEFUN([XORG_INSTALL], [
3122ce62200cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3123ce62200cSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3124ce62200cSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3125ce62200cSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3126ce62200cSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3127ce62200cSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3128ce62200cSmrgAC_SUBST([INSTALL_CMD])
3129ce62200cSmrg]) # XORG_INSTALL
31301a30de1fSmrgdnl Copyright 2005 Red Hat, Inc
31311a30de1fSmrgdnl
31321a30de1fSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
31331a30de1fSmrgdnl documentation for any purpose is hereby granted without fee, provided that
31341a30de1fSmrgdnl the above copyright notice appear in all copies and that both that
31351a30de1fSmrgdnl copyright notice and this permission notice appear in supporting
31361a30de1fSmrgdnl documentation.
31371a30de1fSmrgdnl
31381a30de1fSmrgdnl The above copyright notice and this permission notice shall be included
31391a30de1fSmrgdnl in all copies or substantial portions of the Software.
31401a30de1fSmrgdnl
31411a30de1fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31421a30de1fSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31431a30de1fSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31441a30de1fSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
31451a30de1fSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31461a30de1fSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31471a30de1fSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
31481a30de1fSmrgdnl
31491a30de1fSmrgdnl Except as contained in this notice, the name of the copyright holders shall
31501a30de1fSmrgdnl not be used in advertising or otherwise to promote the sale, use or
31511a30de1fSmrgdnl other dealings in this Software without prior written authorization
31521a30de1fSmrgdnl from the copyright holders.
31531a30de1fSmrgdnl
31541a30de1fSmrg
31551a30de1fSmrg# XORG_RELEASE_VERSION
31561a30de1fSmrg# --------------------
3157ce62200cSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3158a733a5bfSmrg
31591a30de1fSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
31601a30de1fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
31611a30de1fSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
31621a30de1fSmrg		[Major version of this package])
3163b7fb5eacSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
31641a30de1fSmrg	if test "x$PVM" = "x"; then
31651a30de1fSmrg		PVM="0"
31661a30de1fSmrg	fi
31671a30de1fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
31681a30de1fSmrg		[$PVM],
31691a30de1fSmrg		[Minor version of this package])
3170b7fb5eacSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
31711a30de1fSmrg	if test "x$PVP" = "x"; then
31721a30de1fSmrg		PVP="0"
31731a30de1fSmrg	fi
31741a30de1fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
31751a30de1fSmrg		[$PVP],
31761a30de1fSmrg		[Patch version of this package])
31771a30de1fSmrg])
31781a30de1fSmrg
3179b7fb5eacSmrg# XORG_CHANGELOG()
3180b7fb5eacSmrg# ----------------
3181b7fb5eacSmrg# Minimum version: 1.2.0
3182b7fb5eacSmrg#
3183b7fb5eacSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3184b7fb5eacSmrg# ChangeLog from git.
3185b7fb5eacSmrg#
3186b7fb5eacSmrg#
3187b7fb5eacSmrgAC_DEFUN([XORG_CHANGELOG], [
3188ce62200cSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3189ce62200cSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3190ce62200cSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3191b7fb5eacSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3192b7fb5eacSmrgAC_SUBST([CHANGELOG_CMD])
3193b7fb5eacSmrg]) # XORG_CHANGELOG
3194b7fb5eacSmrg
3195