aclocal.m4 revision e8ac26b0
1e8ac26b0Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
29d794632Smrg
3e8ac26b0Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
49fe995a9Smrg
59fe995a9Smrg# This file is free software; the Free Software Foundation
69fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
79fe995a9Smrg# with or without modifications, as long as this notice is preserved.
89fe995a9Smrg
99fe995a9Smrg# This program is distributed in the hope that it will be useful,
109fe995a9Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
119fe995a9Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
129fe995a9Smrg# PARTICULAR PURPOSE.
139fe995a9Smrg
149d794632Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15b62cc08cSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16b62cc08cSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17e8ac26b0Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18e8ac26b0Smrg[m4_warning([this file was generated for autoconf 2.69.
19b62cc08cSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20b62cc08cSmrgIf you have problems, you may need to regenerate the build system entirely.
219d794632SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
229fe995a9Smrg
23e8ac26b0Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
249fe995a9Smrg#
259fe995a9Smrg# This file is free software; the Free Software Foundation
269fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
279fe995a9Smrg# with or without modifications, as long as this notice is preserved.
289fe995a9Smrg
299fe995a9Smrg# AM_AUTOMAKE_VERSION(VERSION)
309fe995a9Smrg# ----------------------------
319fe995a9Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
329fe995a9Smrg# generated from the m4 files accompanying Automake X.Y.
339fe995a9Smrg# (This private macro should not be called outside this file.)
349fe995a9SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35e8ac26b0Smrg[am__api_version='1.15'
369fe995a9Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
379fe995a9Smrgdnl require some minimum version.  Point them to the right macro.
38e8ac26b0Smrgm4_if([$1], [1.15], [],
399fe995a9Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
409fe995a9Smrg])
419fe995a9Smrg
429fe995a9Smrg# _AM_AUTOCONF_VERSION(VERSION)
439fe995a9Smrg# -----------------------------
449fe995a9Smrg# aclocal traces this macro to find the Autoconf version.
459fe995a9Smrg# This is a private macro too.  Using m4_define simplifies
469fe995a9Smrg# the logic in aclocal, which can simply ignore this definition.
479fe995a9Smrgm4_define([_AM_AUTOCONF_VERSION], [])
489fe995a9Smrg
499fe995a9Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
509fe995a9Smrg# -------------------------------
519fe995a9Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52b62cc08cSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
539fe995a9SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54e8ac26b0Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
55b62cc08cSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56b62cc08cSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57b62cc08cSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
589fe995a9Smrg
599fe995a9Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
609fe995a9Smrg
61e8ac26b0Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
629fe995a9Smrg#
639fe995a9Smrg# This file is free software; the Free Software Foundation
649fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
659fe995a9Smrg# with or without modifications, as long as this notice is preserved.
669fe995a9Smrg
679fe995a9Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
689d794632Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
699d794632Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
709fe995a9Smrg#
719fe995a9Smrg# Of course, Automake must honor this variable whenever it calls a
729fe995a9Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
739fe995a9Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
749fe995a9Smrg# depending on how configure is run.  This is pretty annoying, since
759fe995a9Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
769fe995a9Smrg# source directory, any form will work fine, but in subdirectories a
779fe995a9Smrg# relative path needs to be adjusted first.
789fe995a9Smrg#
799fe995a9Smrg# $ac_aux_dir/missing
809fe995a9Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
819fe995a9Smrg# $top_srcdir/$ac_aux_dir/missing
829fe995a9Smrg#    fails if $ac_aux_dir is absolute,
839fe995a9Smrg#    fails when called from a subdirectory in a VPATH build with
849fe995a9Smrg#          a relative $ac_aux_dir
859fe995a9Smrg#
869fe995a9Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
879fe995a9Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
889d794632Smrg# harmless because $srcdir is '.', but things will broke when you
899fe995a9Smrg# start a VPATH build or use an absolute $srcdir.
909fe995a9Smrg#
919fe995a9Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
929fe995a9Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
939fe995a9Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
949fe995a9Smrg# and then we would define $MISSING as
959fe995a9Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
969fe995a9Smrg# This will work as long as MISSING is not called from configure, because
979fe995a9Smrg# unfortunately $(top_srcdir) has no meaning in configure.
989fe995a9Smrg# However there are other variables, like CC, which are often used in
999fe995a9Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1009fe995a9Smrg#
1019fe995a9Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1029fe995a9Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1039fe995a9Smrg# configured tree to be moved without reconfiguration.
1049fe995a9Smrg
1059fe995a9SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106e8ac26b0Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107e8ac26b0Smrg# Expand $ac_aux_dir to an absolute path.
108e8ac26b0Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1099fe995a9Smrg])
1109fe995a9Smrg
1119fe995a9Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1129fe995a9Smrg
113e8ac26b0Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
1149fe995a9Smrg#
1159fe995a9Smrg# This file is free software; the Free Software Foundation
1169fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
1179fe995a9Smrg# with or without modifications, as long as this notice is preserved.
1189fe995a9Smrg
1199fe995a9Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1209fe995a9Smrg# -------------------------------------
1219fe995a9Smrg# Define a conditional.
1229fe995a9SmrgAC_DEFUN([AM_CONDITIONAL],
1239d794632Smrg[AC_PREREQ([2.52])dnl
1249d794632Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1259d794632Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1269fe995a9SmrgAC_SUBST([$1_TRUE])dnl
1279fe995a9SmrgAC_SUBST([$1_FALSE])dnl
1289fe995a9Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1299fe995a9Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130b62cc08cSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1319fe995a9Smrgif $2; then
1329fe995a9Smrg  $1_TRUE=
1339fe995a9Smrg  $1_FALSE='#'
1349fe995a9Smrgelse
1359fe995a9Smrg  $1_TRUE='#'
1369fe995a9Smrg  $1_FALSE=
1379fe995a9Smrgfi
1389fe995a9SmrgAC_CONFIG_COMMANDS_PRE(
1399fe995a9Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1409fe995a9Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1419fe995a9SmrgUsually this means the macro was only invoked conditionally.]])
1429fe995a9Smrgfi])])
1439fe995a9Smrg
144e8ac26b0Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
1459fe995a9Smrg#
1469fe995a9Smrg# This file is free software; the Free Software Foundation
1479fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
1489fe995a9Smrg# with or without modifications, as long as this notice is preserved.
1499fe995a9Smrg
1509fe995a9Smrg
1519d794632Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1529fe995a9Smrg# written in clear, in which case automake, when reading aclocal.m4,
1539fe995a9Smrg# will think it sees a *use*, and therefore will trigger all it's
1549fe995a9Smrg# C support machinery.  Also note that it means that autoscan, seeing
1559fe995a9Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1569fe995a9Smrg
1579fe995a9Smrg
1589fe995a9Smrg# _AM_DEPENDENCIES(NAME)
1599fe995a9Smrg# ----------------------
1609fe995a9Smrg# See how the compiler implements dependency checking.
1619d794632Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1629fe995a9Smrg# We try a few techniques and use that to set a single cache variable.
1639fe995a9Smrg#
1649fe995a9Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1659fe995a9Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1669fe995a9Smrg# dependency, and given that the user is not expected to run this macro,
1679fe995a9Smrg# just rely on AC_PROG_CC.
1689fe995a9SmrgAC_DEFUN([_AM_DEPENDENCIES],
1699fe995a9Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1709fe995a9SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1719fe995a9SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1729fe995a9SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1739fe995a9Smrg
1749d794632Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1759d794632Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1769d794632Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1779d794632Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1789d794632Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1799d794632Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1809d794632Smrg                    [depcc="$$1"   am_compiler_list=])
1819fe995a9Smrg
1829fe995a9SmrgAC_CACHE_CHECK([dependency style of $depcc],
1839fe995a9Smrg               [am_cv_$1_dependencies_compiler_type],
1849fe995a9Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1859fe995a9Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1869fe995a9Smrg  # making bogus files that we don't know about and never remove.  For
1879fe995a9Smrg  # instance it was reported that on HP-UX the gcc test will end up
1889d794632Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1899d794632Smrg  # in D".
1909d794632Smrg  rm -rf conftest.dir
1919fe995a9Smrg  mkdir conftest.dir
1929fe995a9Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1939fe995a9Smrg  # using a relative directory.
1949fe995a9Smrg  cp "$am_depcomp" conftest.dir
1959fe995a9Smrg  cd conftest.dir
1969fe995a9Smrg  # We will build objects and dependencies in a subdirectory because
1979fe995a9Smrg  # it helps to detect inapplicable dependency modes.  For instance
1989fe995a9Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1999fe995a9Smrg  # side effect of compilation, but ICC will put the dependencies in
2009fe995a9Smrg  # the current directory while Tru64 will put them in the object
2019fe995a9Smrg  # directory.
2029fe995a9Smrg  mkdir sub
2039fe995a9Smrg
2049fe995a9Smrg  am_cv_$1_dependencies_compiler_type=none
2059fe995a9Smrg  if test "$am_compiler_list" = ""; then
2069fe995a9Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2079fe995a9Smrg  fi
208b62cc08cSmrg  am__universal=false
209b62cc08cSmrg  m4_case([$1], [CC],
210b62cc08cSmrg    [case " $depcc " in #(
211b62cc08cSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212b62cc08cSmrg     esac],
213b62cc08cSmrg    [CXX],
214b62cc08cSmrg    [case " $depcc " in #(
215b62cc08cSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216b62cc08cSmrg     esac])
217b62cc08cSmrg
2189fe995a9Smrg  for depmode in $am_compiler_list; do
2199fe995a9Smrg    # Setup a source with many dependencies, because some compilers
2209fe995a9Smrg    # like to wrap large dependency lists on column 80 (with \), and
2219fe995a9Smrg    # we should not choose a depcomp mode which is confused by this.
2229fe995a9Smrg    #
2239fe995a9Smrg    # We need to recreate these files for each test, as the compiler may
2249fe995a9Smrg    # overwrite some of them when testing with obscure command lines.
2259fe995a9Smrg    # This happens at least with the AIX C compiler.
2269fe995a9Smrg    : > sub/conftest.c
2279fe995a9Smrg    for i in 1 2 3 4 5 6; do
2289fe995a9Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2299d794632Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2309d794632Smrg      # Solaris 10 /bin/sh.
2319d794632Smrg      echo '/* dummy */' > sub/conftst$i.h
2329fe995a9Smrg    done
2339fe995a9Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2349fe995a9Smrg
2359d794632Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236b62cc08cSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2379d794632Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2389d794632Smrg    # versions had trouble with output in subdirs.
239b62cc08cSmrg    am__obj=sub/conftest.${OBJEXT-o}
240b62cc08cSmrg    am__minus_obj="-o $am__obj"
2419fe995a9Smrg    case $depmode in
242b62cc08cSmrg    gcc)
243b62cc08cSmrg      # This depmode causes a compiler race in universal mode.
244b62cc08cSmrg      test "$am__universal" = false || continue
245b62cc08cSmrg      ;;
2469fe995a9Smrg    nosideeffect)
2479d794632Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2489d794632Smrg      # only be used when explicitly requested.
2499fe995a9Smrg      if test "x$enable_dependency_tracking" = xyes; then
2509fe995a9Smrg	continue
2519fe995a9Smrg      else
2529fe995a9Smrg	break
2539fe995a9Smrg      fi
2549fe995a9Smrg      ;;
2559d794632Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2569d794632Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257b62cc08cSmrg      # not run yet.  These depmodes are late enough in the game, and
258b62cc08cSmrg      # so weak that their functioning should not be impacted.
259b62cc08cSmrg      am__obj=conftest.${OBJEXT-o}
260b62cc08cSmrg      am__minus_obj=
261b62cc08cSmrg      ;;
2629fe995a9Smrg    none) break ;;
2639fe995a9Smrg    esac
2649fe995a9Smrg    if depmode=$depmode \
265b62cc08cSmrg       source=sub/conftest.c object=$am__obj \
2669fe995a9Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267b62cc08cSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2689fe995a9Smrg         >/dev/null 2>conftest.err &&
2699fe995a9Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2709fe995a9Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271b62cc08cSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2729fe995a9Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2739fe995a9Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2749fe995a9Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2759fe995a9Smrg      # that says an option was ignored or not supported.
2769fe995a9Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2779fe995a9Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2789fe995a9Smrg      # The diagnosis changed in icc 8.0:
2799fe995a9Smrg      #   icc: Command line remark: option '-MP' not supported
2809fe995a9Smrg      if (grep 'ignoring option' conftest.err ||
2819fe995a9Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2829fe995a9Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2839fe995a9Smrg        break
2849fe995a9Smrg      fi
2859fe995a9Smrg    fi
2869fe995a9Smrg  done
2879fe995a9Smrg
2889fe995a9Smrg  cd ..
2899fe995a9Smrg  rm -rf conftest.dir
2909fe995a9Smrgelse
2919fe995a9Smrg  am_cv_$1_dependencies_compiler_type=none
2929fe995a9Smrgfi
2939fe995a9Smrg])
2949fe995a9SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2959fe995a9SmrgAM_CONDITIONAL([am__fastdep$1], [
2969fe995a9Smrg  test "x$enable_dependency_tracking" != xno \
2979fe995a9Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2989fe995a9Smrg])
2999fe995a9Smrg
3009fe995a9Smrg
3019fe995a9Smrg# AM_SET_DEPDIR
3029fe995a9Smrg# -------------
3039fe995a9Smrg# Choose a directory name for dependency files.
3049d794632Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3059fe995a9SmrgAC_DEFUN([AM_SET_DEPDIR],
3069fe995a9Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3079fe995a9SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3089fe995a9Smrg])
3099fe995a9Smrg
3109fe995a9Smrg
3119fe995a9Smrg# AM_DEP_TRACK
3129fe995a9Smrg# ------------
3139fe995a9SmrgAC_DEFUN([AM_DEP_TRACK],
3149d794632Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3159d794632SmrgAS_HELP_STRING(
3169d794632Smrg  [--enable-dependency-tracking],
3179d794632Smrg  [do not reject slow dependency extractors])
3189d794632SmrgAS_HELP_STRING(
3199d794632Smrg  [--disable-dependency-tracking],
3209d794632Smrg  [speeds up one-time build])])
3219fe995a9Smrgif test "x$enable_dependency_tracking" != xno; then
3229fe995a9Smrg  am_depcomp="$ac_aux_dir/depcomp"
3239fe995a9Smrg  AMDEPBACKSLASH='\'
3249d794632Smrg  am__nodep='_no'
3259fe995a9Smrgfi
3269fe995a9SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3279fe995a9SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3289fe995a9Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3299d794632SmrgAC_SUBST([am__nodep])dnl
3309d794632Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3319fe995a9Smrg])
3329fe995a9Smrg
3339fe995a9Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3349fe995a9Smrg
335e8ac26b0Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
3369fe995a9Smrg#
3379fe995a9Smrg# This file is free software; the Free Software Foundation
3389fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
3399fe995a9Smrg# with or without modifications, as long as this notice is preserved.
3409fe995a9Smrg
3419fe995a9Smrg
3429fe995a9Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3439fe995a9Smrg# ------------------------------
3449fe995a9SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
345b62cc08cSmrg[{
3469d794632Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
347b62cc08cSmrg  # are listed without --file.  Let's play safe and only enable the eval
348b62cc08cSmrg  # if we detect the quoting.
349b62cc08cSmrg  case $CONFIG_FILES in
350b62cc08cSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
351b62cc08cSmrg  *)   set x $CONFIG_FILES ;;
352b62cc08cSmrg  esac
353b62cc08cSmrg  shift
354b62cc08cSmrg  for mf
355b62cc08cSmrg  do
356b62cc08cSmrg    # Strip MF so we end up with the name of the file.
357b62cc08cSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
358b62cc08cSmrg    # Check whether this is an Automake generated Makefile or not.
3599d794632Smrg    # We used to match only the files named 'Makefile.in', but
360b62cc08cSmrg    # some people rename them; so instead we look at the file content.
361b62cc08cSmrg    # Grep'ing the first line is not enough: some people post-process
362b62cc08cSmrg    # each Makefile.in and add a new line on top of each file to say so.
363b62cc08cSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
364b62cc08cSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
365b62cc08cSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
366b62cc08cSmrg      dirpart=`AS_DIRNAME("$mf")`
367b62cc08cSmrg    else
368b62cc08cSmrg      continue
369b62cc08cSmrg    fi
370b62cc08cSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
3719d794632Smrg    # from the Makefile without running 'make'.
372b62cc08cSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
373b62cc08cSmrg    test -z "$DEPDIR" && continue
374b62cc08cSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3759d794632Smrg    test -z "$am__include" && continue
376b62cc08cSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
377b62cc08cSmrg    # Find all dependency output files, they are included files with
378b62cc08cSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379b62cc08cSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380b62cc08cSmrg    # expansion.
381b62cc08cSmrg    for file in `sed -n "
382b62cc08cSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3839d794632Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
384b62cc08cSmrg      # Make sure the directory exists.
385b62cc08cSmrg      test -f "$dirpart/$file" && continue
386b62cc08cSmrg      fdir=`AS_DIRNAME(["$file"])`
387b62cc08cSmrg      AS_MKDIR_P([$dirpart/$fdir])
388b62cc08cSmrg      # echo "creating $dirpart/$file"
389b62cc08cSmrg      echo '# dummy' > "$dirpart/$file"
390b62cc08cSmrg    done
3919fe995a9Smrg  done
392b62cc08cSmrg}
3939fe995a9Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3949fe995a9Smrg
3959fe995a9Smrg
3969fe995a9Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3979fe995a9Smrg# -----------------------------
3989fe995a9Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3999fe995a9Smrg#
4009fe995a9Smrg# This code is only required when automatic dependency tracking
4019d794632Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
4029fe995a9Smrg# need in order to bootstrap the dependency handling code.
4039fe995a9SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4049fe995a9Smrg[AC_CONFIG_COMMANDS([depfiles],
4059fe995a9Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4069fe995a9Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4079fe995a9Smrg])
4089fe995a9Smrg
4099fe995a9Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4109fe995a9Smrg
411e8ac26b0Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4129fe995a9Smrg#
4139fe995a9Smrg# This file is free software; the Free Software Foundation
4149fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
4159fe995a9Smrg# with or without modifications, as long as this notice is preserved.
4169fe995a9Smrg
4179fe995a9Smrg# This macro actually does too much.  Some checks are only needed if
4189fe995a9Smrg# your package does certain things.  But this isn't really a big deal.
4199fe995a9Smrg
4209d794632Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4219d794632Smrgm4_define([AC_PROG_CC],
4229d794632Smrgm4_defn([AC_PROG_CC])
4239d794632Smrg[_AM_PROG_CC_C_O
4249d794632Smrg])
4259d794632Smrg
4269fe995a9Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4279fe995a9Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4289fe995a9Smrg# -----------------------------------------------
4299fe995a9Smrg# The call with PACKAGE and VERSION arguments is the old style
4309fe995a9Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4319fe995a9Smrg# and VERSION should now be passed to AC_INIT and removed from
4329fe995a9Smrg# the call to AM_INIT_AUTOMAKE.
4339fe995a9Smrg# We support both call styles for the transition.  After
4349fe995a9Smrg# the next Automake release, Autoconf can make the AC_INIT
4359fe995a9Smrg# arguments mandatory, and then we can depend on a new Autoconf
4369fe995a9Smrg# release and drop the old call support.
4379fe995a9SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4389d794632Smrg[AC_PREREQ([2.65])dnl
4399fe995a9Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4409fe995a9Smrgdnl the ones we care about.
4419fe995a9Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4429fe995a9SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4439fe995a9SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4449fe995a9Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4459fe995a9Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4469fe995a9Smrg  # is not polluted with repeated "-I."
4479fe995a9Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4489fe995a9Smrg  # test to see if srcdir already configured
4499fe995a9Smrg  if test -f $srcdir/config.status; then
4509fe995a9Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4519fe995a9Smrg  fi
4529fe995a9Smrgfi
4539fe995a9Smrg
4549fe995a9Smrg# test whether we have cygpath
4559fe995a9Smrgif test -z "$CYGPATH_W"; then
4569fe995a9Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4579fe995a9Smrg    CYGPATH_W='cygpath -w'
4589fe995a9Smrg  else
4599fe995a9Smrg    CYGPATH_W=echo
4609fe995a9Smrg  fi
4619fe995a9Smrgfi
4629fe995a9SmrgAC_SUBST([CYGPATH_W])
4639fe995a9Smrg
4649fe995a9Smrg# Define the identity of the package.
4659fe995a9Smrgdnl Distinguish between old-style and new-style calls.
4669fe995a9Smrgm4_ifval([$2],
4679d794632Smrg[AC_DIAGNOSE([obsolete],
4689d794632Smrg             [$0: two- and three-arguments forms are deprecated.])
4699d794632Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4709fe995a9Smrg AC_SUBST([PACKAGE], [$1])dnl
4719fe995a9Smrg AC_SUBST([VERSION], [$2])],
4729fe995a9Smrg[_AM_SET_OPTIONS([$1])dnl
4739fe995a9Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4749d794632Smrgm4_if(
4759d794632Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
4769d794632Smrg  [ok:ok],,
4779fe995a9Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4789fe995a9Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4799fe995a9Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4809fe995a9Smrg
4819fe995a9Smrg_AM_IF_OPTION([no-define],,
4829d794632Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4839d794632Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4849fe995a9Smrg
4859fe995a9Smrg# Some tools Automake needs.
4869fe995a9SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4879fe995a9SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4889d794632SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4899d794632SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4909d794632SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4919d794632SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4929d794632SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
493b62cc08cSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
494b62cc08cSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4959d794632SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4969d794632Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4979d794632Smrg# dies out for good.  For more background, see:
4989d794632Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4999d794632Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
5009d794632SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
501e8ac26b0Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
502e8ac26b0Smrg# system "awk" is bad on some platforms.
5039fe995a9SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5049fe995a9SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5059fe995a9SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5069fe995a9Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
507b62cc08cSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
508b62cc08cSmrg			     [_AM_PROG_TAR([v7])])])
5099fe995a9Smrg_AM_IF_OPTION([no-dependencies],,
5109fe995a9Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5119d794632Smrg		  [_AM_DEPENDENCIES([CC])],
5129d794632Smrg		  [m4_define([AC_PROG_CC],
5139d794632Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5149fe995a9SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5159d794632Smrg		  [_AM_DEPENDENCIES([CXX])],
5169d794632Smrg		  [m4_define([AC_PROG_CXX],
5179d794632Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5189fe995a9SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5199d794632Smrg		  [_AM_DEPENDENCIES([OBJC])],
5209d794632Smrg		  [m4_define([AC_PROG_OBJC],
5219d794632Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5229d794632SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5239d794632Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5249d794632Smrg		  [m4_define([AC_PROG_OBJCXX],
5259d794632Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5269fe995a9Smrg])
5279d794632SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5289d794632Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5299d794632Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5309d794632Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
531b62cc08cSmrgAC_CONFIG_COMMANDS_PRE(dnl
532b62cc08cSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
533b62cc08cSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5349fe995a9Smrg
5359d794632Smrg# POSIX will say in a future version that running "rm -f" with no argument
5369d794632Smrg# is OK; and we want to be able to make that assumption in our Makefile
5379d794632Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5389d794632Smrg# actually supported "in the wild" to an acceptable degree.
5399d794632Smrg# See automake bug#10828.
5409d794632Smrg# To make any issue more visible, cause the running configure to be aborted
5419d794632Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5429d794632Smrg# user can still override this though.
5439d794632Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5449d794632Smrg  cat >&2 <<'END'
5459d794632SmrgOops!
5469d794632Smrg
5479d794632SmrgYour 'rm' program seems unable to run without file operands specified
5489d794632Smrgon the command line, even when the '-f' option is present.  This is contrary
5499d794632Smrgto the behaviour of most rm programs out there, and not conforming with
5509d794632Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5519d794632Smrg
5529d794632SmrgPlease tell bug-automake@gnu.org about your system, including the value
5539d794632Smrgof your $PATH and any error possibly output before this message.  This
5549d794632Smrgcan help us improve future automake versions.
5559d794632Smrg
5569d794632SmrgEND
5579d794632Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5589d794632Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5599d794632Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5609d794632Smrg    echo >&2
5619d794632Smrg  else
5629d794632Smrg    cat >&2 <<'END'
5639d794632SmrgAborting the configuration process, to ensure you take notice of the issue.
5649d794632Smrg
5659d794632SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5669d794632Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
5679d794632Smrg
5689d794632SmrgIf you want to complete the configuration process using your problematic
5699d794632Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5709d794632Smrgto "yes", and re-run configure.
5719d794632Smrg
5729d794632SmrgEND
5739d794632Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5749d794632Smrg  fi
575e8ac26b0Smrgfi
576e8ac26b0Smrgdnl The trailing newline in this macro's definition is deliberate, for
577e8ac26b0Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
578e8ac26b0Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
579e8ac26b0Smrg])
5809d794632Smrg
5819d794632Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
582b62cc08cSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
583b62cc08cSmrgdnl mangled by Autoconf and run in a shell conditional statement.
584b62cc08cSmrgm4_define([_AC_COMPILER_EXEEXT],
585b62cc08cSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
586b62cc08cSmrg
5879fe995a9Smrg# When config.status generates a header, we must update the stamp-h file.
5889fe995a9Smrg# This file resides in the same directory as the config header
5899fe995a9Smrg# that is generated.  The stamp files are numbered to have different names.
5909fe995a9Smrg
5919fe995a9Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5929fe995a9Smrg# loop where config.status creates the headers, so we can generate
5939fe995a9Smrg# our stamp files there.
5949fe995a9SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5959fe995a9Smrg[# Compute $1's index in $config_headers.
596b62cc08cSmrg_am_arg=$1
5979fe995a9Smrg_am_stamp_count=1
5989fe995a9Smrgfor _am_header in $config_headers :; do
5999fe995a9Smrg  case $_am_header in
600b62cc08cSmrg    $_am_arg | $_am_arg:* )
6019fe995a9Smrg      break ;;
6029fe995a9Smrg    * )
6039fe995a9Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6049fe995a9Smrg  esac
6059fe995a9Smrgdone
606b62cc08cSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6079fe995a9Smrg
608e8ac26b0Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6099fe995a9Smrg#
6109fe995a9Smrg# This file is free software; the Free Software Foundation
6119fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
6129fe995a9Smrg# with or without modifications, as long as this notice is preserved.
6139fe995a9Smrg
6149fe995a9Smrg# AM_PROG_INSTALL_SH
6159fe995a9Smrg# ------------------
6169fe995a9Smrg# Define $install_sh.
6179fe995a9SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6189fe995a9Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
619e8ac26b0Smrgif test x"${install_sh+set}" != xset; then
620b62cc08cSmrg  case $am_aux_dir in
621b62cc08cSmrg  *\ * | *\	*)
622b62cc08cSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
623b62cc08cSmrg  *)
624b62cc08cSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
625b62cc08cSmrg  esac
626b62cc08cSmrgfi
6279d794632SmrgAC_SUBST([install_sh])])
6289fe995a9Smrg
629e8ac26b0Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
6309fe995a9Smrg#
6319fe995a9Smrg# This file is free software; the Free Software Foundation
6329fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
6339fe995a9Smrg# with or without modifications, as long as this notice is preserved.
6349fe995a9Smrg
6359fe995a9Smrg# Check whether the underlying file-system supports filenames
6369fe995a9Smrg# with a leading dot.  For instance MS-DOS doesn't.
6379fe995a9SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6389fe995a9Smrg[rm -rf .tst 2>/dev/null
6399fe995a9Smrgmkdir .tst 2>/dev/null
6409fe995a9Smrgif test -d .tst; then
6419fe995a9Smrg  am__leading_dot=.
6429fe995a9Smrgelse
6439fe995a9Smrg  am__leading_dot=_
6449fe995a9Smrgfi
6459fe995a9Smrgrmdir .tst 2>/dev/null
6469fe995a9SmrgAC_SUBST([am__leading_dot])])
6479fe995a9Smrg
6489fe995a9Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6499fe995a9Smrg
650e8ac26b0Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6519fe995a9Smrg#
6529fe995a9Smrg# This file is free software; the Free Software Foundation
6539fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
6549fe995a9Smrg# with or without modifications, as long as this notice is preserved.
6559fe995a9Smrg
6569fe995a9Smrg# AM_MAKE_INCLUDE()
6579fe995a9Smrg# -----------------
6589fe995a9Smrg# Check to see how make treats includes.
6599fe995a9SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6609fe995a9Smrg[am_make=${MAKE-make}
6619fe995a9Smrgcat > confinc << 'END'
6629fe995a9Smrgam__doit:
663b62cc08cSmrg	@echo this is the am__doit target
6649fe995a9Smrg.PHONY: am__doit
6659fe995a9SmrgEND
6669fe995a9Smrg# If we don't find an include directive, just comment out the code.
6679fe995a9SmrgAC_MSG_CHECKING([for style of include used by $am_make])
6689fe995a9Smrgam__include="#"
6699fe995a9Smrgam__quote=
6709fe995a9Smrg_am_result=none
6719fe995a9Smrg# First try GNU make style include.
6729fe995a9Smrgecho "include confinc" > confmf
6739d794632Smrg# Ignore all kinds of additional output from 'make'.
674b62cc08cSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
675b62cc08cSmrg*the\ am__doit\ target*)
676b62cc08cSmrg  am__include=include
677b62cc08cSmrg  am__quote=
678b62cc08cSmrg  _am_result=GNU
679b62cc08cSmrg  ;;
680b62cc08cSmrgesac
6819fe995a9Smrg# Now try BSD make style include.
6829fe995a9Smrgif test "$am__include" = "#"; then
6839fe995a9Smrg   echo '.include "confinc"' > confmf
684b62cc08cSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
685b62cc08cSmrg   *the\ am__doit\ target*)
686b62cc08cSmrg     am__include=.include
687b62cc08cSmrg     am__quote="\""
688b62cc08cSmrg     _am_result=BSD
689b62cc08cSmrg     ;;
690b62cc08cSmrg   esac
6919fe995a9Smrgfi
6929fe995a9SmrgAC_SUBST([am__include])
6939fe995a9SmrgAC_SUBST([am__quote])
6949fe995a9SmrgAC_MSG_RESULT([$_am_result])
6959fe995a9Smrgrm -f confinc confmf
6969fe995a9Smrg])
6979fe995a9Smrg
6989fe995a9Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6999fe995a9Smrg
700e8ac26b0Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
7019fe995a9Smrg#
7029fe995a9Smrg# This file is free software; the Free Software Foundation
7039fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
7049fe995a9Smrg# with or without modifications, as long as this notice is preserved.
7059fe995a9Smrg
7069fe995a9Smrg# AM_MISSING_PROG(NAME, PROGRAM)
7079fe995a9Smrg# ------------------------------
7089fe995a9SmrgAC_DEFUN([AM_MISSING_PROG],
7099fe995a9Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7109fe995a9Smrg$1=${$1-"${am_missing_run}$2"}
7119fe995a9SmrgAC_SUBST($1)])
7129fe995a9Smrg
7139fe995a9Smrg# AM_MISSING_HAS_RUN
7149fe995a9Smrg# ------------------
7159d794632Smrg# Define MISSING if not defined so far and test if it is modern enough.
7169d794632Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7179fe995a9SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7189fe995a9Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7199fe995a9SmrgAC_REQUIRE_AUX_FILE([missing])dnl
720b62cc08cSmrgif test x"${MISSING+set}" != xset; then
721b62cc08cSmrg  case $am_aux_dir in
722b62cc08cSmrg  *\ * | *\	*)
723b62cc08cSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
724b62cc08cSmrg  *)
725b62cc08cSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
726b62cc08cSmrg  esac
727b62cc08cSmrgfi
7289fe995a9Smrg# Use eval to expand $SHELL
7299d794632Smrgif eval "$MISSING --is-lightweight"; then
7309d794632Smrg  am_missing_run="$MISSING "
7319fe995a9Smrgelse
7329fe995a9Smrg  am_missing_run=
7339d794632Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7349fe995a9Smrgfi
7359fe995a9Smrg])
7369fe995a9Smrg
7379fe995a9Smrg# Helper functions for option handling.                     -*- Autoconf -*-
7389fe995a9Smrg
739e8ac26b0Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
7409fe995a9Smrg#
7419fe995a9Smrg# This file is free software; the Free Software Foundation
7429fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
7439fe995a9Smrg# with or without modifications, as long as this notice is preserved.
7449fe995a9Smrg
7459fe995a9Smrg# _AM_MANGLE_OPTION(NAME)
7469fe995a9Smrg# -----------------------
7479fe995a9SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7489fe995a9Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7499fe995a9Smrg
7509fe995a9Smrg# _AM_SET_OPTION(NAME)
7519d794632Smrg# --------------------
7529fe995a9Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7539fe995a9SmrgAC_DEFUN([_AM_SET_OPTION],
7549d794632Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7559fe995a9Smrg
7569fe995a9Smrg# _AM_SET_OPTIONS(OPTIONS)
7579d794632Smrg# ------------------------
7589fe995a9Smrg# OPTIONS is a space-separated list of Automake options.
7599fe995a9SmrgAC_DEFUN([_AM_SET_OPTIONS],
760b62cc08cSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7619fe995a9Smrg
7629fe995a9Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7639fe995a9Smrg# -------------------------------------------
7649fe995a9Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7659fe995a9SmrgAC_DEFUN([_AM_IF_OPTION],
7669fe995a9Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7679fe995a9Smrg
768e8ac26b0Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
7699d794632Smrg#
7709d794632Smrg# This file is free software; the Free Software Foundation
7719d794632Smrg# gives unlimited permission to copy and/or distribute it,
7729d794632Smrg# with or without modifications, as long as this notice is preserved.
7739fe995a9Smrg
7749d794632Smrg# _AM_PROG_CC_C_O
7759d794632Smrg# ---------------
7769d794632Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7779d794632Smrg# to automatically call this.
7789d794632SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7799d794632Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7809d794632SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7819d794632SmrgAC_LANG_PUSH([C])dnl
7829d794632SmrgAC_CACHE_CHECK(
7839d794632Smrg  [whether $CC understands -c and -o together],
7849d794632Smrg  [am_cv_prog_cc_c_o],
7859d794632Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7869d794632Smrg  # Make sure it works both with $CC and with simple cc.
7879d794632Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7889d794632Smrg  # compilers refuse to overwrite an existing .o file with -o,
7899d794632Smrg  # though they will create one.
7909d794632Smrg  am_cv_prog_cc_c_o=yes
7919d794632Smrg  for am_i in 1 2; do
7929d794632Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7939d794632Smrg         && test -f conftest2.$ac_objext; then
7949d794632Smrg      : OK
7959d794632Smrg    else
7969d794632Smrg      am_cv_prog_cc_c_o=no
7979d794632Smrg      break
7989d794632Smrg    fi
7999d794632Smrg  done
8009d794632Smrg  rm -f core conftest*
8019d794632Smrg  unset am_i])
8029d794632Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8039d794632Smrg   # Losing compiler, so override with the script.
8049d794632Smrg   # FIXME: It is wrong to rewrite CC.
8059d794632Smrg   # But if we don't then we get into trouble of one sort or another.
8069d794632Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8079d794632Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8089d794632Smrg   CC="$am_aux_dir/compile $CC"
8099d794632Smrgfi
8109d794632SmrgAC_LANG_POP([C])])
8119d794632Smrg
8129d794632Smrg# For backward compatibility.
8139d794632SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8149d794632Smrg
815e8ac26b0Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
8169fe995a9Smrg#
8179fe995a9Smrg# This file is free software; the Free Software Foundation
8189fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
8199fe995a9Smrg# with or without modifications, as long as this notice is preserved.
8209fe995a9Smrg
8219d794632Smrg# AM_RUN_LOG(COMMAND)
8229d794632Smrg# -------------------
8239d794632Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8249d794632Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8259d794632SmrgAC_DEFUN([AM_RUN_LOG],
8269d794632Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8279d794632Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8289d794632Smrg   ac_status=$?
8299d794632Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8309d794632Smrg   (exit $ac_status); }])
8319d794632Smrg
8329d794632Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8339d794632Smrg
834e8ac26b0Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
8359d794632Smrg#
8369d794632Smrg# This file is free software; the Free Software Foundation
8379d794632Smrg# gives unlimited permission to copy and/or distribute it,
8389d794632Smrg# with or without modifications, as long as this notice is preserved.
8399fe995a9Smrg
8409fe995a9Smrg# AM_SANITY_CHECK
8419fe995a9Smrg# ---------------
8429fe995a9SmrgAC_DEFUN([AM_SANITY_CHECK],
8439fe995a9Smrg[AC_MSG_CHECKING([whether build environment is sane])
844b62cc08cSmrg# Reject unsafe characters in $srcdir or the absolute working directory
845b62cc08cSmrg# name.  Accept space and tab only in the latter.
846b62cc08cSmrgam_lf='
847b62cc08cSmrg'
848b62cc08cSmrgcase `pwd` in
849b62cc08cSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
850b62cc08cSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
851b62cc08cSmrgesac
852b62cc08cSmrgcase $srcdir in
853b62cc08cSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8549d794632Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
855b62cc08cSmrgesac
856b62cc08cSmrg
8579d794632Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8589fe995a9Smrg# arguments.  Must try -L first in case configure is actually a
8599fe995a9Smrg# symlink; some systems play weird games with the mod time of symlinks
8609fe995a9Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8619fe995a9Smrg# directory).
8629fe995a9Smrgif (
8639d794632Smrg   am_has_slept=no
8649d794632Smrg   for am_try in 1 2; do
8659d794632Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8669d794632Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8679d794632Smrg     if test "$[*]" = "X"; then
8689d794632Smrg	# -L didn't work.
8699d794632Smrg	set X `ls -t "$srcdir/configure" conftest.file`
8709d794632Smrg     fi
8719d794632Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8729d794632Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8739d794632Smrg
8749d794632Smrg	# If neither matched, then we have a broken ls.  This can happen
8759d794632Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8769d794632Smrg	# broken ls alias from the environment.  This has actually
8779d794632Smrg	# happened.  Such a system could not be considered "sane".
8789d794632Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8799d794632Smrg  alias in your environment])
8809d794632Smrg     fi
8819d794632Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8829d794632Smrg       break
8839d794632Smrg     fi
8849d794632Smrg     # Just in case.
8859d794632Smrg     sleep 1
8869d794632Smrg     am_has_slept=yes
8879d794632Smrg   done
8889fe995a9Smrg   test "$[2]" = conftest.file
8899fe995a9Smrg   )
8909fe995a9Smrgthen
8919fe995a9Smrg   # Ok.
8929fe995a9Smrg   :
8939fe995a9Smrgelse
8949fe995a9Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
8959fe995a9SmrgCheck your system clock])
8969fe995a9Smrgfi
8979d794632SmrgAC_MSG_RESULT([yes])
8989d794632Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8999d794632Smrg# generated files are strictly newer.
9009d794632Smrgam_sleep_pid=
9019d794632Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9029d794632Smrg  ( sleep 1 ) &
9039d794632Smrg  am_sleep_pid=$!
9049d794632Smrgfi
9059d794632SmrgAC_CONFIG_COMMANDS_PRE(
9069d794632Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9079d794632Smrg   if test -n "$am_sleep_pid"; then
9089d794632Smrg     # Hide warnings about reused PIDs.
9099d794632Smrg     wait $am_sleep_pid 2>/dev/null
9109d794632Smrg   fi
9119d794632Smrg   AC_MSG_RESULT([done])])
9129d794632Smrgrm -f conftest.file
9139d794632Smrg])
9149fe995a9Smrg
915e8ac26b0Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
916b62cc08cSmrg#
917b62cc08cSmrg# This file is free software; the Free Software Foundation
918b62cc08cSmrg# gives unlimited permission to copy and/or distribute it,
919b62cc08cSmrg# with or without modifications, as long as this notice is preserved.
920b62cc08cSmrg
921b62cc08cSmrg# AM_SILENT_RULES([DEFAULT])
922b62cc08cSmrg# --------------------------
923b62cc08cSmrg# Enable less verbose build rules; with the default set to DEFAULT
9249d794632Smrg# ("yes" being less verbose, "no" or empty being verbose).
925b62cc08cSmrgAC_DEFUN([AM_SILENT_RULES],
9269d794632Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9279d794632SmrgAS_HELP_STRING(
9289d794632Smrg  [--enable-silent-rules],
9299d794632Smrg  [less verbose build output (undo: "make V=1")])
9309d794632SmrgAS_HELP_STRING(
9319d794632Smrg  [--disable-silent-rules],
9329d794632Smrg  [verbose build output (undo: "make V=0")])dnl
9339d794632Smrg])
9349d794632Smrgcase $enable_silent_rules in @%:@ (((
9359d794632Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9369d794632Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9379d794632Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
938b62cc08cSmrgesac
9399d794632Smrgdnl
9409d794632Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9419d794632Smrgdnl do not support nested variable expansions.
9429d794632Smrgdnl See automake bug#9928 and bug#10237.
9439d794632Smrgam_make=${MAKE-make}
9449d794632SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9459d794632Smrg   [am_cv_make_support_nested_variables],
9469d794632Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9479d794632SmrgBAR0=false
9489d794632SmrgBAR1=true
9499d794632SmrgV=1
9509d794632Smrgam__doit:
9519d794632Smrg	@$(TRUE)
9529d794632Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9539d794632Smrg  am_cv_make_support_nested_variables=yes
9549d794632Smrgelse
9559d794632Smrg  am_cv_make_support_nested_variables=no
9569d794632Smrgfi])
9579d794632Smrgif test $am_cv_make_support_nested_variables = yes; then
9589d794632Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9599d794632Smrg  AM_V='$(V)'
9609d794632Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9619d794632Smrgelse
9629d794632Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9639d794632Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9649d794632Smrgfi
9659d794632SmrgAC_SUBST([AM_V])dnl
9669d794632SmrgAM_SUBST_NOTMAKE([AM_V])dnl
9679d794632SmrgAC_SUBST([AM_DEFAULT_V])dnl
9689d794632SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
969b62cc08cSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
970b62cc08cSmrgAM_BACKSLASH='\'
971b62cc08cSmrgAC_SUBST([AM_BACKSLASH])dnl
972b62cc08cSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
973b62cc08cSmrg])
974b62cc08cSmrg
975e8ac26b0Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
9769fe995a9Smrg#
9779fe995a9Smrg# This file is free software; the Free Software Foundation
9789fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
9799fe995a9Smrg# with or without modifications, as long as this notice is preserved.
9809fe995a9Smrg
9819fe995a9Smrg# AM_PROG_INSTALL_STRIP
9829fe995a9Smrg# ---------------------
9839d794632Smrg# One issue with vendor 'install' (even GNU) is that you can't
9849fe995a9Smrg# specify the program used to strip binaries.  This is especially
9859fe995a9Smrg# annoying in cross-compiling environments, where the build's strip
9869fe995a9Smrg# is unlikely to handle the host's binaries.
9879fe995a9Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9889d794632Smrg# always use install-sh in "make install-strip", and initialize
9899fe995a9Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
9909fe995a9SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9919fe995a9Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9929d794632Smrg# Installed binaries are usually stripped using 'strip' when the user
9939d794632Smrg# run "make install-strip".  However 'strip' might not be the right
9949fe995a9Smrg# tool to use in cross-compilation environments, therefore Automake
9959d794632Smrg# will honor the 'STRIP' environment variable to overrule this program.
9969d794632Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9979fe995a9Smrgif test "$cross_compiling" != no; then
9989fe995a9Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9999fe995a9Smrgfi
10009fe995a9SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
10019fe995a9SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10029fe995a9Smrg
1003e8ac26b0Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
10049fe995a9Smrg#
10059fe995a9Smrg# This file is free software; the Free Software Foundation
10069fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
10079fe995a9Smrg# with or without modifications, as long as this notice is preserved.
10089fe995a9Smrg
10099fe995a9Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
10109fe995a9Smrg# ---------------------------
1011b62cc08cSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10129fe995a9Smrg# This macro is traced by Automake.
10139fe995a9SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10149fe995a9Smrg
1015b62cc08cSmrg# AM_SUBST_NOTMAKE(VARIABLE)
10169d794632Smrg# --------------------------
1017b62cc08cSmrg# Public sister of _AM_SUBST_NOTMAKE.
1018b62cc08cSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1019b62cc08cSmrg
10209fe995a9Smrg# Check how to create a tarball.                            -*- Autoconf -*-
10219fe995a9Smrg
1022e8ac26b0Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
10239fe995a9Smrg#
10249fe995a9Smrg# This file is free software; the Free Software Foundation
10259fe995a9Smrg# gives unlimited permission to copy and/or distribute it,
10269fe995a9Smrg# with or without modifications, as long as this notice is preserved.
10279fe995a9Smrg
10289fe995a9Smrg# _AM_PROG_TAR(FORMAT)
10299fe995a9Smrg# --------------------
10309fe995a9Smrg# Check how to create a tarball in format FORMAT.
10319d794632Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10329fe995a9Smrg#
10339fe995a9Smrg# Substitute a variable $(am__tar) that is a command
10349fe995a9Smrg# writing to stdout a FORMAT-tarball containing the directory
10359fe995a9Smrg# $tardir.
10369fe995a9Smrg#     tardir=directory && $(am__tar) > result.tar
10379fe995a9Smrg#
10389fe995a9Smrg# Substitute a variable $(am__untar) that extract such
10399fe995a9Smrg# a tarball read from stdin.
10409fe995a9Smrg#     $(am__untar) < result.tar
10419d794632Smrg#
10429fe995a9SmrgAC_DEFUN([_AM_PROG_TAR],
10439d794632Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10449d794632Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10459d794632SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10469d794632Smrg
10479d794632Smrg# We'll loop over all known methods to create a tar archive until one works.
10489fe995a9Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10499fe995a9Smrg
10509d794632Smrgm4_if([$1], [v7],
10519d794632Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10529d794632Smrg
10539d794632Smrg  [m4_case([$1],
10549d794632Smrg    [ustar],
10559d794632Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10569d794632Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10579d794632Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10589d794632Smrg      # and bug#13588).
10599d794632Smrg      am_max_uid=2097151 # 2^21 - 1
10609d794632Smrg      am_max_gid=$am_max_uid
10619d794632Smrg      # The $UID and $GID variables are not portable, so we need to resort
10629d794632Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10639d794632Smrg      # below are definitely unexpected, so allow the users to see them
10649d794632Smrg      # (that is, avoid stderr redirection).
10659d794632Smrg      am_uid=`id -u || echo unknown`
10669d794632Smrg      am_gid=`id -g || echo unknown`
10679d794632Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10689d794632Smrg      if test $am_uid -le $am_max_uid; then
10699d794632Smrg         AC_MSG_RESULT([yes])
10709d794632Smrg      else
10719d794632Smrg         AC_MSG_RESULT([no])
10729d794632Smrg         _am_tools=none
10739d794632Smrg      fi
10749d794632Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10759d794632Smrg      if test $am_gid -le $am_max_gid; then
10769d794632Smrg         AC_MSG_RESULT([yes])
10779d794632Smrg      else
10789d794632Smrg        AC_MSG_RESULT([no])
10799d794632Smrg        _am_tools=none
10809d794632Smrg      fi],
10819d794632Smrg
10829d794632Smrg  [pax],
10839d794632Smrg    [],
10849d794632Smrg
10859d794632Smrg  [m4_fatal([Unknown tar format])])
10869d794632Smrg
10879d794632Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
10889d794632Smrg
10899d794632Smrg  # Go ahead even if we have the value already cached.  We do so because we
10909d794632Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10919d794632Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10929d794632Smrg
10939d794632Smrg  for _am_tool in $_am_tools; do
10949d794632Smrg    case $_am_tool in
10959d794632Smrg    gnutar)
10969d794632Smrg      for _am_tar in tar gnutar gtar; do
10979d794632Smrg        AM_RUN_LOG([$_am_tar --version]) && break
10989d794632Smrg      done
10999d794632Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
11009d794632Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
11019d794632Smrg      am__untar="$_am_tar -xf -"
11029d794632Smrg      ;;
11039d794632Smrg    plaintar)
11049d794632Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11059d794632Smrg      # ustar tarball either.
11069d794632Smrg      (tar --version) >/dev/null 2>&1 && continue
11079d794632Smrg      am__tar='tar chf - "$$tardir"'
11089d794632Smrg      am__tar_='tar chf - "$tardir"'
11099d794632Smrg      am__untar='tar xf -'
11109d794632Smrg      ;;
11119d794632Smrg    pax)
11129d794632Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11139d794632Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11149d794632Smrg      am__untar='pax -r'
11159d794632Smrg      ;;
11169d794632Smrg    cpio)
11179d794632Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11189d794632Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11199d794632Smrg      am__untar='cpio -i -H $1 -d'
11209d794632Smrg      ;;
11219d794632Smrg    none)
11229d794632Smrg      am__tar=false
11239d794632Smrg      am__tar_=false
11249d794632Smrg      am__untar=false
11259d794632Smrg      ;;
11269d794632Smrg    esac
11279fe995a9Smrg
11289d794632Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11299d794632Smrg    # and am__untar set.
11309d794632Smrg    test -n "${am_cv_prog_tar_$1}" && break
11319d794632Smrg
11329d794632Smrg    # tar/untar a dummy directory, and stop if the command works.
11339d794632Smrg    rm -rf conftest.dir
11349d794632Smrg    mkdir conftest.dir
11359d794632Smrg    echo GrepMe > conftest.dir/file
11369d794632Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11379d794632Smrg    rm -rf conftest.dir
11389d794632Smrg    if test -s conftest.tar; then
11399d794632Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11409d794632Smrg      AM_RUN_LOG([cat conftest.dir/file])
11419d794632Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11429d794632Smrg    fi
11439d794632Smrg  done
11449fe995a9Smrg  rm -rf conftest.dir
11459fe995a9Smrg
11469d794632Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11479d794632Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11489d794632Smrg
11499fe995a9SmrgAC_SUBST([am__tar])
11509fe995a9SmrgAC_SUBST([am__untar])
11519fe995a9Smrg]) # _AM_PROG_TAR
11529fe995a9Smrg
115390b6713cSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
115490b6713cSmrg# 
115590b6713cSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115690b6713cSmrg#
115790b6713cSmrg# This program is free software; you can redistribute it and/or modify
115890b6713cSmrg# it under the terms of the GNU General Public License as published by
115990b6713cSmrg# the Free Software Foundation; either version 2 of the License, or
116090b6713cSmrg# (at your option) any later version.
116190b6713cSmrg#
116290b6713cSmrg# This program is distributed in the hope that it will be useful, but
116390b6713cSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
116490b6713cSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
116590b6713cSmrg# General Public License for more details.
116690b6713cSmrg#
116790b6713cSmrg# You should have received a copy of the GNU General Public License
116890b6713cSmrg# along with this program; if not, write to the Free Software
116990b6713cSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
117090b6713cSmrg#
117190b6713cSmrg# As a special exception to the GNU General Public License, if you
117290b6713cSmrg# distribute this file as part of a program that contains a
117390b6713cSmrg# configuration script generated by Autoconf, you may include it under
117490b6713cSmrg# the same distribution terms that you use for the rest of that program.
117590b6713cSmrg
117690b6713cSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
117790b6713cSmrg# ----------------------------------
117890b6713cSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
117990b6713cSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
118090b6713cSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
11819d794632SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
118290b6713cSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
118390b6713cSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
118490b6713cSmrgfi
118590b6713cSmrgif test -n "$PKG_CONFIG"; then
118690b6713cSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
118790b6713cSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
118890b6713cSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
118990b6713cSmrg		AC_MSG_RESULT([yes])
119090b6713cSmrg	else
119190b6713cSmrg		AC_MSG_RESULT([no])
119290b6713cSmrg		PKG_CONFIG=""
119390b6713cSmrg	fi
11949d794632Smrg		
119590b6713cSmrgfi[]dnl
119690b6713cSmrg])# PKG_PROG_PKG_CONFIG
119790b6713cSmrg
119890b6713cSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
119990b6713cSmrg#
120090b6713cSmrg# Check to see whether a particular set of modules exists.  Similar
120190b6713cSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
120290b6713cSmrg#
12039d794632Smrg#
12049d794632Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
12059d794632Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
12069d794632Smrg# PKG_CHECK_EXISTS manually
120790b6713cSmrg# --------------------------------------------------------------
120890b6713cSmrgAC_DEFUN([PKG_CHECK_EXISTS],
120990b6713cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
121090b6713cSmrgif test -n "$PKG_CONFIG" && \
121190b6713cSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12129d794632Smrg  m4_ifval([$2], [$2], [:])
121390b6713cSmrgm4_ifvaln([$3], [else
121490b6713cSmrg  $3])dnl
121590b6713cSmrgfi])
121690b6713cSmrg
12179d794632Smrg
121890b6713cSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
121990b6713cSmrg# ---------------------------------------------
122090b6713cSmrgm4_define([_PKG_CONFIG],
122190b6713cSmrg[if test -n "$$1"; then
122290b6713cSmrg    pkg_cv_[]$1="$$1"
122390b6713cSmrg elif test -n "$PKG_CONFIG"; then
122490b6713cSmrg    PKG_CHECK_EXISTS([$3],
122590b6713cSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
122690b6713cSmrg		     [pkg_failed=yes])
122790b6713cSmrg else
122890b6713cSmrg    pkg_failed=untried
122990b6713cSmrgfi[]dnl
123090b6713cSmrg])# _PKG_CONFIG
123190b6713cSmrg
123290b6713cSmrg# _PKG_SHORT_ERRORS_SUPPORTED
123390b6713cSmrg# -----------------------------
123490b6713cSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
123590b6713cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123690b6713cSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
123790b6713cSmrg        _pkg_short_errors_supported=yes
123890b6713cSmrgelse
123990b6713cSmrg        _pkg_short_errors_supported=no
124090b6713cSmrgfi[]dnl
124190b6713cSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
124290b6713cSmrg
124390b6713cSmrg
124490b6713cSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
124590b6713cSmrg# [ACTION-IF-NOT-FOUND])
124690b6713cSmrg#
124790b6713cSmrg#
124890b6713cSmrg# Note that if there is a possibility the first call to
124990b6713cSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
125090b6713cSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
125190b6713cSmrg#
125290b6713cSmrg#
125390b6713cSmrg# --------------------------------------------------------------
125490b6713cSmrgAC_DEFUN([PKG_CHECK_MODULES],
125590b6713cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
125690b6713cSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
125790b6713cSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
125890b6713cSmrg
125990b6713cSmrgpkg_failed=no
126090b6713cSmrgAC_MSG_CHECKING([for $1])
126190b6713cSmrg
126290b6713cSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
126390b6713cSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
126490b6713cSmrg
126590b6713cSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
126690b6713cSmrgand $1[]_LIBS to avoid the need to call pkg-config.
126790b6713cSmrgSee the pkg-config man page for more details.])
126890b6713cSmrg
126990b6713cSmrgif test $pkg_failed = yes; then
127090b6713cSmrg        _PKG_SHORT_ERRORS_SUPPORTED
127190b6713cSmrg        if test $_pkg_short_errors_supported = yes; then
127290b6713cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
127390b6713cSmrg        else 
127490b6713cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
127590b6713cSmrg        fi
127690b6713cSmrg	# Put the nasty error message in config.log where it belongs
127790b6713cSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
127890b6713cSmrg
12799d794632Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
128090b6713cSmrg[Package requirements ($2) were not met:
128190b6713cSmrg
128290b6713cSmrg$$1_PKG_ERRORS
128390b6713cSmrg
128490b6713cSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
128590b6713cSmrginstalled software in a non-standard prefix.
128690b6713cSmrg
12879d794632Smrg_PKG_TEXT
12889d794632Smrg])],
12899d794632Smrg		[AC_MSG_RESULT([no])
12909d794632Smrg                $4])
129190b6713cSmrgelif test $pkg_failed = untried; then
12929d794632Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
129390b6713cSmrg[The pkg-config script could not be found or is too old.  Make sure it
129490b6713cSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
129590b6713cSmrgpath to pkg-config.
129690b6713cSmrg
129790b6713cSmrg_PKG_TEXT
129890b6713cSmrg
12999d794632SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
13009d794632Smrg		[$4])
130190b6713cSmrgelse
130290b6713cSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
130390b6713cSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
130490b6713cSmrg        AC_MSG_RESULT([yes])
13059d794632Smrg	ifelse([$3], , :, [$3])
130690b6713cSmrgfi[]dnl
130790b6713cSmrg])# PKG_CHECK_MODULES
130890b6713cSmrg
1309b62cc08cSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
13109fe995a9Smrgdnl
1311b62cc08cSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1312e8ac26b0Smrgdnl
13139fe995a9Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1314b62cc08cSmrgdnl copy of this software and associated documentation files (the "Software"),
1315b62cc08cSmrgdnl to deal in the Software without restriction, including without limitation
1316b62cc08cSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1317b62cc08cSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1318b62cc08cSmrgdnl Software is furnished to do so, subject to the following conditions:
13199fe995a9Smrgdnl
1320b62cc08cSmrgdnl The above copyright notice and this permission notice (including the next
1321b62cc08cSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1322b62cc08cSmrgdnl Software.
13239fe995a9Smrgdnl
1324b62cc08cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1325b62cc08cSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1326b62cc08cSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1327b62cc08cSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1328b62cc08cSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1329b62cc08cSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1330b62cc08cSmrgdnl DEALINGS IN THE SOFTWARE.
13319fe995a9Smrg
13329fe995a9Smrg# XORG_MACROS_VERSION(required-version)
13339fe995a9Smrg# -------------------------------------
13349fe995a9Smrg# Minimum version: 1.1.0
13359fe995a9Smrg#
13369fe995a9Smrg# If you're using a macro added in Version 1.1 or newer, include this in
13379fe995a9Smrg# your configure.ac with the minimum required version, such as:
13389fe995a9Smrg# XORG_MACROS_VERSION(1.1)
13399fe995a9Smrg#
1340b62cc08cSmrg# To ensure that this macro is defined, also add:
1341b62cc08cSmrg# m4_ifndef([XORG_MACROS_VERSION],
1342b62cc08cSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
13439fe995a9Smrg#
13449fe995a9Smrg#
1345e8ac26b0Smrg# See the "minimum version" comment for each macro you use to see what
13469fe995a9Smrg# version you require.
1347b62cc08cSmrgm4_defun([XORG_MACROS_VERSION],[
1348e8ac26b0Smrgm4_define([vers_have], [1.19.0])
1349b62cc08cSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1350b62cc08cSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1351b62cc08cSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1352b62cc08cSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1353b62cc08cSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1354b62cc08cSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1355b62cc08cSmrgm4_undefine([vers_have])
1356b62cc08cSmrgm4_undefine([maj_have])
1357b62cc08cSmrgm4_undefine([maj_needed])
13589fe995a9Smrg]) # XORG_MACROS_VERSION
13599fe995a9Smrg
13609fe995a9Smrg# XORG_PROG_RAWCPP()
13619fe995a9Smrg# ------------------
13629fe995a9Smrg# Minimum version: 1.0.0
13639fe995a9Smrg#
13649fe995a9Smrg# Find cpp program and necessary flags for use in pre-processing text files
13659fe995a9Smrg# such as man pages and config files
13669fe995a9SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
13679fe995a9SmrgAC_REQUIRE([AC_PROG_CPP])
1368e8ac26b0SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
13699fe995a9Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
13709fe995a9Smrg
13719fe995a9Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
13729fe995a9Smrg# which is not the best choice for supporting other OS'es, but covers most
13739fe995a9Smrg# of the ones we need for now.
13749fe995a9SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
13759d794632SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
13769fe995a9Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13779fe995a9Smrg	AC_MSG_RESULT([no])
13789fe995a9Smrgelse
13799fe995a9Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13809fe995a9Smrg		RAWCPPFLAGS=-undef
13819fe995a9Smrg		AC_MSG_RESULT([yes])
1382b62cc08cSmrg	# under Cygwin unix is still defined even with -undef
1383b62cc08cSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1384b62cc08cSmrg		RAWCPPFLAGS="-undef -ansi"
1385b62cc08cSmrg		AC_MSG_RESULT([yes, with -ansi])
13869fe995a9Smrg	else
13879fe995a9Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
13889fe995a9Smrg	fi
13899fe995a9Smrgfi
13909fe995a9Smrgrm -f conftest.$ac_ext
13919fe995a9Smrg
13929fe995a9SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
13939d794632SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
13949fe995a9Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
13959fe995a9Smrg	AC_MSG_RESULT([no])
13969fe995a9Smrgelse
13979fe995a9Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1398e8ac26b0Smrg		TRADITIONALCPPFLAGS="-traditional"
13999fe995a9Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
14009fe995a9Smrg		AC_MSG_RESULT([yes])
14019fe995a9Smrg	else
14029fe995a9Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
14039fe995a9Smrg	fi
14049fe995a9Smrgfi
14059fe995a9Smrgrm -f conftest.$ac_ext
14069fe995a9SmrgAC_SUBST(RAWCPPFLAGS)
1407e8ac26b0SmrgAC_SUBST(TRADITIONALCPPFLAGS)
14089fe995a9Smrg]) # XORG_PROG_RAWCPP
14099fe995a9Smrg
14109fe995a9Smrg# XORG_MANPAGE_SECTIONS()
14119fe995a9Smrg# -----------------------
14129fe995a9Smrg# Minimum version: 1.0.0
14139fe995a9Smrg#
14149fe995a9Smrg# Determine which sections man pages go in for the different man page types
14159fe995a9Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
14169fe995a9Smrg# Not sure if there's any better way than just hardcoding by OS name.
14179fe995a9Smrg# Override default settings by setting environment variables
1418b62cc08cSmrg# Added MAN_SUBSTS in version 1.8
1419b62cc08cSmrg# Added AC_PROG_SED in version 1.8
14209fe995a9Smrg
14219fe995a9SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
14229fe995a9SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1423b62cc08cSmrgAC_REQUIRE([AC_PROG_SED])
14249fe995a9Smrg
14259fe995a9Smrgif test x$APP_MAN_SUFFIX = x    ; then
14269fe995a9Smrg    APP_MAN_SUFFIX=1
14279fe995a9Smrgfi
14289fe995a9Smrgif test x$APP_MAN_DIR = x    ; then
14299fe995a9Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
14309fe995a9Smrgfi
14319fe995a9Smrg
14329fe995a9Smrgif test x$LIB_MAN_SUFFIX = x    ; then
14339fe995a9Smrg    LIB_MAN_SUFFIX=3
14349fe995a9Smrgfi
14359fe995a9Smrgif test x$LIB_MAN_DIR = x    ; then
14369fe995a9Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
14379fe995a9Smrgfi
14389fe995a9Smrg
14399fe995a9Smrgif test x$FILE_MAN_SUFFIX = x    ; then
14409fe995a9Smrg    case $host_os in
14419fe995a9Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
14429fe995a9Smrg	*)		FILE_MAN_SUFFIX=5  ;;
14439fe995a9Smrg    esac
14449fe995a9Smrgfi
14459fe995a9Smrgif test x$FILE_MAN_DIR = x    ; then
14469fe995a9Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
14479fe995a9Smrgfi
14489fe995a9Smrg
14499fe995a9Smrgif test x$MISC_MAN_SUFFIX = x    ; then
14509fe995a9Smrg    case $host_os in
14519fe995a9Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
14529fe995a9Smrg	*)		MISC_MAN_SUFFIX=7  ;;
14539fe995a9Smrg    esac
14549fe995a9Smrgfi
14559fe995a9Smrgif test x$MISC_MAN_DIR = x    ; then
14569fe995a9Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
14579fe995a9Smrgfi
14589fe995a9Smrg
14599fe995a9Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
14609fe995a9Smrg    case $host_os in
14619fe995a9Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
14629fe995a9Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
14639fe995a9Smrg    esac
14649fe995a9Smrgfi
14659fe995a9Smrgif test x$DRIVER_MAN_DIR = x    ; then
14669fe995a9Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
14679fe995a9Smrgfi
14689fe995a9Smrg
14699fe995a9Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
14709fe995a9Smrg    case $host_os in
14719fe995a9Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
14729fe995a9Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
14739fe995a9Smrg    esac
14749fe995a9Smrgfi
14759fe995a9Smrgif test x$ADMIN_MAN_DIR = x    ; then
14769fe995a9Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
14779fe995a9Smrgfi
14789fe995a9Smrg
14799fe995a9Smrg
14809fe995a9SmrgAC_SUBST([APP_MAN_SUFFIX])
14819fe995a9SmrgAC_SUBST([LIB_MAN_SUFFIX])
14829fe995a9SmrgAC_SUBST([FILE_MAN_SUFFIX])
14839fe995a9SmrgAC_SUBST([MISC_MAN_SUFFIX])
14849fe995a9SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
14859fe995a9SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
14869fe995a9SmrgAC_SUBST([APP_MAN_DIR])
14879fe995a9SmrgAC_SUBST([LIB_MAN_DIR])
14889fe995a9SmrgAC_SUBST([FILE_MAN_DIR])
14899fe995a9SmrgAC_SUBST([MISC_MAN_DIR])
14909fe995a9SmrgAC_SUBST([DRIVER_MAN_DIR])
14919fe995a9SmrgAC_SUBST([ADMIN_MAN_DIR])
1492b62cc08cSmrg
1493b62cc08cSmrgXORG_MAN_PAGE="X Version 11"
1494b62cc08cSmrgAC_SUBST([XORG_MAN_PAGE])
1495b62cc08cSmrgMAN_SUBSTS="\
1496b62cc08cSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1497b62cc08cSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1498b62cc08cSmrg	-e 's|__xservername__|Xorg|g' \
1499b62cc08cSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1500b62cc08cSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1501b62cc08cSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1502b62cc08cSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1503b62cc08cSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1504b62cc08cSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1505b62cc08cSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1506b62cc08cSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1507b62cc08cSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1508b62cc08cSmrgAC_SUBST([MAN_SUBSTS])
1509b62cc08cSmrg
15109fe995a9Smrg]) # XORG_MANPAGE_SECTIONS
15119fe995a9Smrg
1512b62cc08cSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1513b62cc08cSmrg# ------------------------
1514b62cc08cSmrg# Minimum version: 1.7.0
1515b62cc08cSmrg#
1516b62cc08cSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1517b62cc08cSmrg# provided by xorg-sgml-doctools, if installed.
1518b62cc08cSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1519b62cc08cSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1520b62cc08cSmrgXORG_SGML_PATH=
1521b62cc08cSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1522b62cc08cSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1523b62cc08cSmrg    [m4_ifval([$1],[:],
1524b62cc08cSmrg        [if test x"$cross_compiling" != x"yes" ; then
1525b62cc08cSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1526b62cc08cSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1527b62cc08cSmrg         fi])
1528b62cc08cSmrg    ])
1529b62cc08cSmrg
1530b62cc08cSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1531b62cc08cSmrg# the path and the name of the doc stylesheet
1532b62cc08cSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1533b62cc08cSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1534b62cc08cSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1535b62cc08cSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1536b62cc08cSmrgelse
1537b62cc08cSmrg   AC_MSG_RESULT([no])
1538b62cc08cSmrgfi
1539b62cc08cSmrg
1540b62cc08cSmrgAC_SUBST(XORG_SGML_PATH)
1541b62cc08cSmrgAC_SUBST(STYLESHEET_SRCDIR)
1542b62cc08cSmrgAC_SUBST(XSL_STYLESHEET)
1543b62cc08cSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1544b62cc08cSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1545b62cc08cSmrg
15469fe995a9Smrg# XORG_CHECK_LINUXDOC
15479fe995a9Smrg# -------------------
15489fe995a9Smrg# Minimum version: 1.0.0
15499fe995a9Smrg#
15509fe995a9Smrg# Defines the variable MAKE_TEXT if the necessary tools and
15519fe995a9Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
15529fe995a9Smrg# Whether or not the necessary tools and files are found can be checked
15539fe995a9Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
15549fe995a9SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1555b62cc08cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1556b62cc08cSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
15579fe995a9Smrg
15589fe995a9SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
15599fe995a9Smrg
1560b62cc08cSmrgAC_MSG_CHECKING([whether to build documentation])
15619fe995a9Smrg
1562b62cc08cSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
15639fe995a9Smrg   BUILDDOC=yes
15649fe995a9Smrgelse
15659fe995a9Smrg   BUILDDOC=no
15669fe995a9Smrgfi
15679fe995a9Smrg
15689fe995a9SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
15699fe995a9Smrg
15709fe995a9SmrgAC_MSG_RESULT([$BUILDDOC])
15719fe995a9Smrg
1572b62cc08cSmrgAC_MSG_CHECKING([whether to build pdf documentation])
15739fe995a9Smrg
1574b62cc08cSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
15759fe995a9Smrg   BUILDPDFDOC=yes
15769fe995a9Smrgelse
15779fe995a9Smrg   BUILDPDFDOC=no
15789fe995a9Smrgfi
15799fe995a9Smrg
15809fe995a9SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
15819fe995a9Smrg
15829fe995a9SmrgAC_MSG_RESULT([$BUILDPDFDOC])
15839fe995a9Smrg
1584b62cc08cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
15859fe995a9SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
15869fe995a9SmrgMAKE_PDF="$PS2PDF"
15879fe995a9SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
15889fe995a9Smrg
15899fe995a9SmrgAC_SUBST(MAKE_TEXT)
15909fe995a9SmrgAC_SUBST(MAKE_PS)
15919fe995a9SmrgAC_SUBST(MAKE_PDF)
15929fe995a9SmrgAC_SUBST(MAKE_HTML)
15939fe995a9Smrg]) # XORG_CHECK_LINUXDOC
15949fe995a9Smrg
15959fe995a9Smrg# XORG_CHECK_DOCBOOK
15969fe995a9Smrg# -------------------
15979fe995a9Smrg# Minimum version: 1.0.0
15989fe995a9Smrg#
15999fe995a9Smrg# Checks for the ability to build output formats from SGML DocBook source.
16009fe995a9Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16019fe995a9Smrg# indicates whether the necessary tools and files are found and, if set,
16029fe995a9Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16039fe995a9SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1604b62cc08cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1605b62cc08cSmrg
16069fe995a9SmrgBUILDTXTDOC=no
16079fe995a9SmrgBUILDPDFDOC=no
16089fe995a9SmrgBUILDPSDOC=no
16099fe995a9SmrgBUILDHTMLDOC=no
16109fe995a9Smrg
16119fe995a9SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16129fe995a9SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16139fe995a9SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16149fe995a9SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
16159fe995a9Smrg
1616b62cc08cSmrgAC_MSG_CHECKING([whether to build text documentation])
1617b62cc08cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16189fe995a9Smrg   test x$BUILD_TXTDOC != xno; then
16199fe995a9Smrg	BUILDTXTDOC=yes
16209fe995a9Smrgfi
16219fe995a9SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16229fe995a9SmrgAC_MSG_RESULT([$BUILDTXTDOC])
16239fe995a9Smrg
1624b62cc08cSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1625b62cc08cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16269fe995a9Smrg   test x$BUILD_PDFDOC != xno; then
16279fe995a9Smrg	BUILDPDFDOC=yes
16289fe995a9Smrgfi
16299fe995a9SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16309fe995a9SmrgAC_MSG_RESULT([$BUILDPDFDOC])
16319fe995a9Smrg
1632b62cc08cSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1633b62cc08cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
16349fe995a9Smrg   test x$BUILD_PSDOC != xno; then
16359fe995a9Smrg	BUILDPSDOC=yes
16369fe995a9Smrgfi
16379fe995a9SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
16389fe995a9SmrgAC_MSG_RESULT([$BUILDPSDOC])
16399fe995a9Smrg
1640b62cc08cSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1641b62cc08cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
16429fe995a9Smrg   test x$BUILD_HTMLDOC != xno; then
16439fe995a9Smrg	BUILDHTMLDOC=yes
16449fe995a9Smrgfi
16459fe995a9SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
16469fe995a9SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
16479fe995a9Smrg
16489fe995a9SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
16499fe995a9SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
16509fe995a9SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
16519fe995a9SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
16529fe995a9Smrg
16539fe995a9SmrgAC_SUBST(MAKE_TEXT)
16549fe995a9SmrgAC_SUBST(MAKE_PS)
16559fe995a9SmrgAC_SUBST(MAKE_PDF)
16569fe995a9SmrgAC_SUBST(MAKE_HTML)
16579fe995a9Smrg]) # XORG_CHECK_DOCBOOK
16589fe995a9Smrg
1659b62cc08cSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1660b62cc08cSmrg# ----------------
1661b62cc08cSmrg# Minimum version: 1.5.0
1662b62cc08cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1663b62cc08cSmrg#
1664b62cc08cSmrg# Documentation tools are not always available on all platforms and sometimes
1665b62cc08cSmrg# not at the appropriate level. This macro enables a module to test for the
1666b62cc08cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1667b62cc08cSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1668b62cc08cSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1669b62cc08cSmrg# --with-xmlto assumes 'auto'.
1670b62cc08cSmrg#
1671b62cc08cSmrg# Interface to module:
1672b62cc08cSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1673b62cc08cSmrg# XMLTO:	returns the path of the xmlto program found
1674b62cc08cSmrg#		returns the path set by the user in the environment
1675b62cc08cSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1676b62cc08cSmrg#		'no' user instructs the module not to use xmlto
1677b62cc08cSmrg#
1678b62cc08cSmrg# Added in version 1.10.0
1679b62cc08cSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1680b62cc08cSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1681b62cc08cSmrg#
1682b62cc08cSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1683b62cc08cSmrg#
1684b62cc08cSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1685b62cc08cSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1686b62cc08cSmrgm4_define([_defopt], m4_default([$2], [auto]))
1687b62cc08cSmrgAC_ARG_WITH(xmlto,
1688b62cc08cSmrg	AS_HELP_STRING([--with-xmlto],
1689b62cc08cSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1690b62cc08cSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1691b62cc08cSmrgm4_undefine([_defopt])
1692b62cc08cSmrg
1693b62cc08cSmrgif test "x$use_xmlto" = x"auto"; then
1694b62cc08cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1695b62cc08cSmrg   if test "x$XMLTO" = "x"; then
1696b62cc08cSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1697b62cc08cSmrg	have_xmlto=no
1698b62cc08cSmrg   else
1699b62cc08cSmrg        have_xmlto=yes
1700b62cc08cSmrg   fi
1701b62cc08cSmrgelif test "x$use_xmlto" = x"yes" ; then
1702b62cc08cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1703b62cc08cSmrg   if test "x$XMLTO" = "x"; then
1704b62cc08cSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1705b62cc08cSmrg   fi
1706b62cc08cSmrg   have_xmlto=yes
1707b62cc08cSmrgelif test "x$use_xmlto" = x"no" ; then
1708b62cc08cSmrg   if test "x$XMLTO" != "x"; then
1709b62cc08cSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1710b62cc08cSmrg   fi
1711b62cc08cSmrg   have_xmlto=no
1712b62cc08cSmrgelse
1713b62cc08cSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1714b62cc08cSmrgfi
1715b62cc08cSmrg
1716b62cc08cSmrg# Test for a minimum version of xmlto, if provided.
1717b62cc08cSmrgm4_ifval([$1],
1718b62cc08cSmrg[if test "$have_xmlto" = yes; then
1719b62cc08cSmrg    # scrape the xmlto version
1720b62cc08cSmrg    AC_MSG_CHECKING([the xmlto version])
1721b62cc08cSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1722b62cc08cSmrg    AC_MSG_RESULT([$xmlto_version])
1723b62cc08cSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1724b62cc08cSmrg        [if test "x$use_xmlto" = xauto; then
1725b62cc08cSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1726b62cc08cSmrg            have_xmlto=no
1727b62cc08cSmrg        else
1728b62cc08cSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1729b62cc08cSmrg        fi])
1730b62cc08cSmrgfi])
1731b62cc08cSmrg
1732b62cc08cSmrg# Test for the ability of xmlto to generate a text target
1733b62cc08cSmrghave_xmlto_text=no
1734b62cc08cSmrgcat > conftest.xml << "EOF"
1735b62cc08cSmrgEOF
1736b62cc08cSmrgAS_IF([test "$have_xmlto" = yes],
1737b62cc08cSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1738b62cc08cSmrg             [have_xmlto_text=yes],
1739b62cc08cSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1740b62cc08cSmrgrm -f conftest.xml
1741b62cc08cSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1742b62cc08cSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1743b62cc08cSmrg]) # XORG_WITH_XMLTO
1744b62cc08cSmrg
174590b6713cSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
174690b6713cSmrg# --------------------------------------------
174790b6713cSmrg# Minimum version: 1.12.0
174890b6713cSmrg# Minimum version for optional DEFAULT argument: 1.12.0
174990b6713cSmrg#
175090b6713cSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
175190b6713cSmrg# XML-based language used for the transformation of XML documents.
175290b6713cSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
175390b6713cSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
175490b6713cSmrg# The XSLT processor is often used as a standalone tool for transformations.
175590b6713cSmrg# It should not be assumed that this tool is used only to work with documnetation.
175690b6713cSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
175790b6713cSmrg#
175890b6713cSmrg# Interface to module:
175990b6713cSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
176090b6713cSmrg# XSLTPROC:	 returns the path of the xsltproc program found
176190b6713cSmrg#		 returns the path set by the user in the environment
176290b6713cSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
176390b6713cSmrg#		  'no' user instructs the module not to use xsltproc
176490b6713cSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
176590b6713cSmrg#
176690b6713cSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
176790b6713cSmrg#
176890b6713cSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
176990b6713cSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
17709d794632Smrg# Preserves the interface, should it be implemented later
17719d794632Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
177290b6713cSmrgm4_define([_defopt], m4_default([$2], [auto]))
177390b6713cSmrgAC_ARG_WITH(xsltproc,
177490b6713cSmrg	AS_HELP_STRING([--with-xsltproc],
177590b6713cSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
177690b6713cSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
177790b6713cSmrgm4_undefine([_defopt])
177890b6713cSmrg
177990b6713cSmrgif test "x$use_xsltproc" = x"auto"; then
178090b6713cSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
178190b6713cSmrg   if test "x$XSLTPROC" = "x"; then
178290b6713cSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
178390b6713cSmrg	have_xsltproc=no
178490b6713cSmrg   else
178590b6713cSmrg        have_xsltproc=yes
178690b6713cSmrg   fi
178790b6713cSmrgelif test "x$use_xsltproc" = x"yes" ; then
178890b6713cSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
178990b6713cSmrg   if test "x$XSLTPROC" = "x"; then
179090b6713cSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
179190b6713cSmrg   fi
179290b6713cSmrg   have_xsltproc=yes
179390b6713cSmrgelif test "x$use_xsltproc" = x"no" ; then
179490b6713cSmrg   if test "x$XSLTPROC" != "x"; then
179590b6713cSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
179690b6713cSmrg   fi
179790b6713cSmrg   have_xsltproc=no
179890b6713cSmrgelse
179990b6713cSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
180090b6713cSmrgfi
180190b6713cSmrg
180290b6713cSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
180390b6713cSmrg]) # XORG_WITH_XSLTPROC
180490b6713cSmrg
18059d794632Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
18069d794632Smrg# ----------------------------------------
18079d794632Smrg# Minimum version: 1.15.0
18089d794632Smrg#
18099d794632Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
18109d794632Smrg# scanning arbitrary text files, extracting information from those text files,
18119d794632Smrg# and printing reports based on that information.
18129d794632Smrg#
18139d794632Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
18149d794632Smrg#
18159d794632Smrg# Interface to module:
18169d794632Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
18179d794632Smrg# PERL:	     returns the path of the perl program found
18189d794632Smrg#	     returns the path set by the user in the environment
18199d794632Smrg# --with-perl: 'yes' user instructs the module to use perl
18209d794632Smrg#	       'no' user instructs the module not to use perl
18219d794632Smrg# have_perl: returns yes if perl found in PATH or no
18229d794632Smrg#
18239d794632Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
18249d794632Smrg#
18259d794632SmrgAC_DEFUN([XORG_WITH_PERL],[
18269d794632SmrgAC_ARG_VAR([PERL], [Path to perl command])
18279d794632Smrg# Preserves the interface, should it be implemented later
18289d794632Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
18299d794632Smrgm4_define([_defopt], m4_default([$2], [auto]))
18309d794632SmrgAC_ARG_WITH(perl,
18319d794632Smrg	AS_HELP_STRING([--with-perl],
18329d794632Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
18339d794632Smrg	   [use_perl=$withval], [use_perl=]_defopt)
18349d794632Smrgm4_undefine([_defopt])
18359d794632Smrg
18369d794632Smrgif test "x$use_perl" = x"auto"; then
18379d794632Smrg   AC_PATH_PROG([PERL], [perl])
18389d794632Smrg   if test "x$PERL" = "x"; then
18399d794632Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
18409d794632Smrg	have_perl=no
18419d794632Smrg   else
18429d794632Smrg        have_perl=yes
18439d794632Smrg   fi
18449d794632Smrgelif test "x$use_perl" = x"yes" ; then
18459d794632Smrg   AC_PATH_PROG([PERL], [perl])
18469d794632Smrg   if test "x$PERL" = "x"; then
18479d794632Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
18489d794632Smrg   fi
18499d794632Smrg   have_perl=yes
18509d794632Smrgelif test "x$use_perl" = x"no" ; then
18519d794632Smrg   if test "x$PERL" != "x"; then
18529d794632Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
18539d794632Smrg   fi
18549d794632Smrg   have_perl=no
18559d794632Smrgelse
18569d794632Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
18579d794632Smrgfi
18589d794632Smrg
18599d794632SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
18609d794632Smrg]) # XORG_WITH_PERL
186190b6713cSmrg
1862b62cc08cSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1863b62cc08cSmrg# ----------------
1864b62cc08cSmrg# Minimum version: 1.5.0
1865b62cc08cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1866b62cc08cSmrg#
1867b62cc08cSmrg# Documentation tools are not always available on all platforms and sometimes
1868b62cc08cSmrg# not at the appropriate level. This macro enables a module to test for the
1869b62cc08cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1870b62cc08cSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1871b62cc08cSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1872b62cc08cSmrg# --with-asciidoc assumes 'auto'.
1873b62cc08cSmrg#
1874b62cc08cSmrg# Interface to module:
1875b62cc08cSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1876b62cc08cSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1877b62cc08cSmrg#		 returns the path set by the user in the environment
1878b62cc08cSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1879b62cc08cSmrg#		  'no' user instructs the module not to use asciidoc
1880b62cc08cSmrg#
1881b62cc08cSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1882b62cc08cSmrg#
1883b62cc08cSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1884b62cc08cSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1885b62cc08cSmrgm4_define([_defopt], m4_default([$2], [auto]))
1886b62cc08cSmrgAC_ARG_WITH(asciidoc,
1887b62cc08cSmrg	AS_HELP_STRING([--with-asciidoc],
1888b62cc08cSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1889b62cc08cSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1890b62cc08cSmrgm4_undefine([_defopt])
1891b62cc08cSmrg
1892b62cc08cSmrgif test "x$use_asciidoc" = x"auto"; then
1893b62cc08cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1894b62cc08cSmrg   if test "x$ASCIIDOC" = "x"; then
1895b62cc08cSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1896b62cc08cSmrg	have_asciidoc=no
1897b62cc08cSmrg   else
1898b62cc08cSmrg        have_asciidoc=yes
1899b62cc08cSmrg   fi
1900b62cc08cSmrgelif test "x$use_asciidoc" = x"yes" ; then
1901b62cc08cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1902b62cc08cSmrg   if test "x$ASCIIDOC" = "x"; then
1903b62cc08cSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1904b62cc08cSmrg   fi
1905b62cc08cSmrg   have_asciidoc=yes
1906b62cc08cSmrgelif test "x$use_asciidoc" = x"no" ; then
1907b62cc08cSmrg   if test "x$ASCIIDOC" != "x"; then
1908b62cc08cSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1909b62cc08cSmrg   fi
1910b62cc08cSmrg   have_asciidoc=no
1911b62cc08cSmrgelse
1912b62cc08cSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1913b62cc08cSmrgfi
1914b62cc08cSmrgm4_ifval([$1],
1915b62cc08cSmrg[if test "$have_asciidoc" = yes; then
1916b62cc08cSmrg    # scrape the asciidoc version
1917b62cc08cSmrg    AC_MSG_CHECKING([the asciidoc version])
1918b62cc08cSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1919b62cc08cSmrg    AC_MSG_RESULT([$asciidoc_version])
1920b62cc08cSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1921b62cc08cSmrg        [if test "x$use_asciidoc" = xauto; then
1922b62cc08cSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1923b62cc08cSmrg            have_asciidoc=no
1924b62cc08cSmrg        else
1925b62cc08cSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1926b62cc08cSmrg        fi])
1927b62cc08cSmrgfi])
1928b62cc08cSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1929b62cc08cSmrg]) # XORG_WITH_ASCIIDOC
1930b62cc08cSmrg
1931b62cc08cSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1932e8ac26b0Smrg# -------------------------------------------
1933b62cc08cSmrg# Minimum version: 1.5.0
1934b62cc08cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1935e8ac26b0Smrg# Minimum version for optional DOT checking: 1.18.0
1936b62cc08cSmrg#
1937b62cc08cSmrg# Documentation tools are not always available on all platforms and sometimes
1938b62cc08cSmrg# not at the appropriate level. This macro enables a module to test for the
1939b62cc08cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1940b62cc08cSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1941b62cc08cSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1942b62cc08cSmrg# --with-doxygen assumes 'auto'.
1943b62cc08cSmrg#
1944b62cc08cSmrg# Interface to module:
1945b62cc08cSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1946b62cc08cSmrg# DOXYGEN:	 returns the path of the doxygen program found
1947b62cc08cSmrg#		 returns the path set by the user in the environment
1948b62cc08cSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1949b62cc08cSmrg#		  'no' user instructs the module not to use doxygen
1950b62cc08cSmrg#
1951b62cc08cSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1952b62cc08cSmrg#
1953b62cc08cSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1954b62cc08cSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1955e8ac26b0SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
1956b62cc08cSmrgm4_define([_defopt], m4_default([$2], [auto]))
1957b62cc08cSmrgAC_ARG_WITH(doxygen,
1958b62cc08cSmrg	AS_HELP_STRING([--with-doxygen],
1959b62cc08cSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1960b62cc08cSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1961b62cc08cSmrgm4_undefine([_defopt])
1962b62cc08cSmrg
1963b62cc08cSmrgif test "x$use_doxygen" = x"auto"; then
1964b62cc08cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1965b62cc08cSmrg   if test "x$DOXYGEN" = "x"; then
1966b62cc08cSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1967b62cc08cSmrg	have_doxygen=no
1968b62cc08cSmrg   else
1969b62cc08cSmrg        have_doxygen=yes
1970b62cc08cSmrg   fi
1971b62cc08cSmrgelif test "x$use_doxygen" = x"yes" ; then
1972b62cc08cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1973b62cc08cSmrg   if test "x$DOXYGEN" = "x"; then
1974b62cc08cSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1975b62cc08cSmrg   fi
1976b62cc08cSmrg   have_doxygen=yes
1977b62cc08cSmrgelif test "x$use_doxygen" = x"no" ; then
1978b62cc08cSmrg   if test "x$DOXYGEN" != "x"; then
1979b62cc08cSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1980b62cc08cSmrg   fi
1981b62cc08cSmrg   have_doxygen=no
1982b62cc08cSmrgelse
1983b62cc08cSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1984b62cc08cSmrgfi
1985b62cc08cSmrgm4_ifval([$1],
1986b62cc08cSmrg[if test "$have_doxygen" = yes; then
1987b62cc08cSmrg    # scrape the doxygen version
1988b62cc08cSmrg    AC_MSG_CHECKING([the doxygen version])
1989b62cc08cSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1990b62cc08cSmrg    AC_MSG_RESULT([$doxygen_version])
1991b62cc08cSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1992b62cc08cSmrg        [if test "x$use_doxygen" = xauto; then
1993b62cc08cSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1994b62cc08cSmrg            have_doxygen=no
1995b62cc08cSmrg        else
1996b62cc08cSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1997b62cc08cSmrg        fi])
1998b62cc08cSmrgfi])
1999e8ac26b0Smrg
2000e8ac26b0Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2001e8ac26b0Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2002e8ac26b0Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2003e8ac26b0SmrgHAVE_DOT=no
2004e8ac26b0Smrgif test "x$have_doxygen" = "xyes"; then
2005e8ac26b0Smrg  AC_PATH_PROG([DOT], [dot])
2006e8ac26b0Smrg    if test "x$DOT" != "x"; then
2007e8ac26b0Smrg      HAVE_DOT=yes
2008e8ac26b0Smrg    fi
2009e8ac26b0Smrgfi
2010e8ac26b0Smrg
2011e8ac26b0SmrgAC_SUBST([HAVE_DOT])
2012e8ac26b0SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2013b62cc08cSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2014b62cc08cSmrg]) # XORG_WITH_DOXYGEN
2015b62cc08cSmrg
2016b62cc08cSmrg# XORG_WITH_GROFF([DEFAULT])
2017b62cc08cSmrg# ----------------
2018b62cc08cSmrg# Minimum version: 1.6.0
2019b62cc08cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2020b62cc08cSmrg#
2021b62cc08cSmrg# Documentation tools are not always available on all platforms and sometimes
2022b62cc08cSmrg# not at the appropriate level. This macro enables a module to test for the
2023b62cc08cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2024b62cc08cSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2025b62cc08cSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2026b62cc08cSmrg# --with-groff assumes 'auto'.
2027b62cc08cSmrg#
2028b62cc08cSmrg# Interface to module:
2029b62cc08cSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2030b62cc08cSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2031b62cc08cSmrg# HAVE_GROFF_MS: the -ms macros package
2032b62cc08cSmrg# GROFF:	 returns the path of the groff program found
2033b62cc08cSmrg#		 returns the path set by the user in the environment
2034b62cc08cSmrg# --with-groff:	 'yes' user instructs the module to use groff
2035b62cc08cSmrg#		 'no' user instructs the module not to use groff
2036b62cc08cSmrg#
2037b62cc08cSmrg# Added in version 1.9.0:
2038b62cc08cSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2039b62cc08cSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2040b62cc08cSmrg#		   psselect from the psutils package.
2041b62cc08cSmrg#		   the ghostcript package. Refer to the grohtml man pages
2042b62cc08cSmrg#
2043b62cc08cSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2044b62cc08cSmrg#
2045b62cc08cSmrg# OS and distros often splits groff in a basic and full package, the former
2046b62cc08cSmrg# having the groff program and the later having devices, fonts and macros
2047b62cc08cSmrg# Checking for the groff executable is not enough.
2048b62cc08cSmrg#
2049b62cc08cSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2050b62cc08cSmrg# unset HAVE_GROFF or GROFF env variables.
2051b62cc08cSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2052b62cc08cSmrg#
2053b62cc08cSmrgAC_DEFUN([XORG_WITH_GROFF],[
2054b62cc08cSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2055b62cc08cSmrgm4_define([_defopt], m4_default([$1], [auto]))
2056b62cc08cSmrgAC_ARG_WITH(groff,
2057b62cc08cSmrg	AS_HELP_STRING([--with-groff],
2058b62cc08cSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2059b62cc08cSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2060b62cc08cSmrgm4_undefine([_defopt])
2061b62cc08cSmrg
2062b62cc08cSmrgif test "x$use_groff" = x"auto"; then
2063b62cc08cSmrg   AC_PATH_PROG([GROFF], [groff])
2064b62cc08cSmrg   if test "x$GROFF" = "x"; then
2065b62cc08cSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2066b62cc08cSmrg	have_groff=no
2067b62cc08cSmrg   else
2068b62cc08cSmrg        have_groff=yes
2069b62cc08cSmrg   fi
2070b62cc08cSmrgelif test "x$use_groff" = x"yes" ; then
2071b62cc08cSmrg   AC_PATH_PROG([GROFF], [groff])
2072b62cc08cSmrg   if test "x$GROFF" = "x"; then
2073b62cc08cSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2074b62cc08cSmrg   fi
2075b62cc08cSmrg   have_groff=yes
2076b62cc08cSmrgelif test "x$use_groff" = x"no" ; then
2077b62cc08cSmrg   if test "x$GROFF" != "x"; then
2078b62cc08cSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2079b62cc08cSmrg   fi
2080b62cc08cSmrg   have_groff=no
2081b62cc08cSmrgelse
2082b62cc08cSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2083b62cc08cSmrgfi
2084b62cc08cSmrg
2085b62cc08cSmrg# We have groff, test for the presence of the macro packages
2086b62cc08cSmrgif test "x$have_groff" = x"yes"; then
2087b62cc08cSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2088b62cc08cSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2089b62cc08cSmrg        groff_ms_works=yes
2090b62cc08cSmrg    else
2091b62cc08cSmrg        groff_ms_works=no
2092b62cc08cSmrg    fi
2093b62cc08cSmrg    AC_MSG_RESULT([$groff_ms_works])
2094b62cc08cSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2095b62cc08cSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2096b62cc08cSmrg        groff_mm_works=yes
2097b62cc08cSmrg    else
2098b62cc08cSmrg        groff_mm_works=no
2099b62cc08cSmrg    fi
2100b62cc08cSmrg    AC_MSG_RESULT([$groff_mm_works])
2101b62cc08cSmrgfi
2102b62cc08cSmrg
2103b62cc08cSmrg# We have groff, test for HTML dependencies, one command per package
2104b62cc08cSmrgif test "x$have_groff" = x"yes"; then
2105b62cc08cSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2106b62cc08cSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2107b62cc08cSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2108b62cc08cSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2109b62cc08cSmrg      have_groff_html=yes
2110b62cc08cSmrg   else
2111b62cc08cSmrg      have_groff_html=no
2112b62cc08cSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2113b62cc08cSmrg   fi
2114b62cc08cSmrgfi
2115b62cc08cSmrg
2116b62cc08cSmrg# Set Automake conditionals for Makefiles
2117b62cc08cSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2118b62cc08cSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2119b62cc08cSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2120b62cc08cSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2121b62cc08cSmrg]) # XORG_WITH_GROFF
2122b62cc08cSmrg
21239d794632Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
21249d794632Smrg# ---------------------------------------
2125b62cc08cSmrg# Minimum version: 1.6.0
2126b62cc08cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
21279d794632Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2128b62cc08cSmrg#
2129b62cc08cSmrg# Documentation tools are not always available on all platforms and sometimes
2130b62cc08cSmrg# not at the appropriate level. This macro enables a module to test for the
2131b62cc08cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2132b62cc08cSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2133b62cc08cSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2134b62cc08cSmrg# --with-fop assumes 'auto'.
2135b62cc08cSmrg#
2136b62cc08cSmrg# Interface to module:
2137b62cc08cSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2138b62cc08cSmrg# FOP:	 	returns the path of the fop program found
2139b62cc08cSmrg#		returns the path set by the user in the environment
2140b62cc08cSmrg# --with-fop: 	'yes' user instructs the module to use fop
2141b62cc08cSmrg#		'no' user instructs the module not to use fop
2142b62cc08cSmrg#
2143b62cc08cSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2144b62cc08cSmrg#
2145b62cc08cSmrgAC_DEFUN([XORG_WITH_FOP],[
2146b62cc08cSmrgAC_ARG_VAR([FOP], [Path to fop command])
21479d794632Smrgm4_define([_defopt], m4_default([$2], [auto]))
2148b62cc08cSmrgAC_ARG_WITH(fop,
2149b62cc08cSmrg	AS_HELP_STRING([--with-fop],
2150b62cc08cSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2151b62cc08cSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2152b62cc08cSmrgm4_undefine([_defopt])
2153b62cc08cSmrg
2154b62cc08cSmrgif test "x$use_fop" = x"auto"; then
2155b62cc08cSmrg   AC_PATH_PROG([FOP], [fop])
2156b62cc08cSmrg   if test "x$FOP" = "x"; then
2157b62cc08cSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2158b62cc08cSmrg	have_fop=no
2159b62cc08cSmrg   else
2160b62cc08cSmrg        have_fop=yes
2161b62cc08cSmrg   fi
2162b62cc08cSmrgelif test "x$use_fop" = x"yes" ; then
2163b62cc08cSmrg   AC_PATH_PROG([FOP], [fop])
2164b62cc08cSmrg   if test "x$FOP" = "x"; then
2165b62cc08cSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2166b62cc08cSmrg   fi
2167b62cc08cSmrg   have_fop=yes
2168b62cc08cSmrgelif test "x$use_fop" = x"no" ; then
2169b62cc08cSmrg   if test "x$FOP" != "x"; then
2170b62cc08cSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2171b62cc08cSmrg   fi
2172b62cc08cSmrg   have_fop=no
2173b62cc08cSmrgelse
2174b62cc08cSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2175b62cc08cSmrgfi
21769d794632Smrg
21779d794632Smrg# Test for a minimum version of fop, if provided.
21789d794632Smrgm4_ifval([$1],
21799d794632Smrg[if test "$have_fop" = yes; then
21809d794632Smrg    # scrape the fop version
21819d794632Smrg    AC_MSG_CHECKING([for fop minimum version])
21829d794632Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
21839d794632Smrg    AC_MSG_RESULT([$fop_version])
21849d794632Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
21859d794632Smrg        [if test "x$use_fop" = xauto; then
21869d794632Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
21879d794632Smrg            have_fop=no
21889d794632Smrg        else
21899d794632Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
21909d794632Smrg        fi])
21919d794632Smrgfi])
2192b62cc08cSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2193b62cc08cSmrg]) # XORG_WITH_FOP
2194b62cc08cSmrg
2195e8ac26b0Smrg# XORG_WITH_M4([MIN-VERSION])
2196e8ac26b0Smrg# ---------------------------
2197e8ac26b0Smrg# Minimum version: 1.19.0
2198e8ac26b0Smrg#
2199e8ac26b0Smrg# This macro attempts to locate an m4 macro processor which supports
2200e8ac26b0Smrg# -I option and is only useful for modules relying on M4 in order to
2201e8ac26b0Smrg# expand macros in source code files.
2202e8ac26b0Smrg#
2203e8ac26b0Smrg# Interface to module:
2204e8ac26b0Smrg# M4:	 	returns the path of the m4 program found
2205e8ac26b0Smrg#		returns the path set by the user in the environment
2206e8ac26b0Smrg#
2207e8ac26b0SmrgAC_DEFUN([XORG_WITH_M4], [
2208e8ac26b0SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2209e8ac26b0Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2210e8ac26b0Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2211e8ac26b0Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2212e8ac26b0Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2213e8ac26b0Smrg   [$PATH:/usr/gnu/bin])])
2214e8ac26b0Smrg
2215e8ac26b0SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2216e8ac26b0Smrg]) # XORG_WITH_M4
2217e8ac26b0Smrg
2218b62cc08cSmrg# XORG_WITH_PS2PDF([DEFAULT])
2219b62cc08cSmrg# ----------------
2220b62cc08cSmrg# Minimum version: 1.6.0
2221b62cc08cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2222b62cc08cSmrg#
2223b62cc08cSmrg# Documentation tools are not always available on all platforms and sometimes
2224b62cc08cSmrg# not at the appropriate level. This macro enables a module to test for the
2225b62cc08cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2226b62cc08cSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2227b62cc08cSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2228b62cc08cSmrg# --with-ps2pdf assumes 'auto'.
2229b62cc08cSmrg#
2230b62cc08cSmrg# Interface to module:
2231b62cc08cSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2232b62cc08cSmrg# PS2PDF:	returns the path of the ps2pdf program found
2233b62cc08cSmrg#		returns the path set by the user in the environment
2234b62cc08cSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2235b62cc08cSmrg#		 'no' user instructs the module not to use ps2pdf
2236b62cc08cSmrg#
2237b62cc08cSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2238b62cc08cSmrg#
2239b62cc08cSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2240b62cc08cSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2241b62cc08cSmrgm4_define([_defopt], m4_default([$1], [auto]))
2242b62cc08cSmrgAC_ARG_WITH(ps2pdf,
2243b62cc08cSmrg	AS_HELP_STRING([--with-ps2pdf],
2244b62cc08cSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2245b62cc08cSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2246b62cc08cSmrgm4_undefine([_defopt])
2247b62cc08cSmrg
2248b62cc08cSmrgif test "x$use_ps2pdf" = x"auto"; then
2249b62cc08cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2250b62cc08cSmrg   if test "x$PS2PDF" = "x"; then
2251b62cc08cSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2252b62cc08cSmrg	have_ps2pdf=no
2253b62cc08cSmrg   else
2254b62cc08cSmrg        have_ps2pdf=yes
2255b62cc08cSmrg   fi
2256b62cc08cSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2257b62cc08cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2258b62cc08cSmrg   if test "x$PS2PDF" = "x"; then
2259b62cc08cSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2260b62cc08cSmrg   fi
2261b62cc08cSmrg   have_ps2pdf=yes
2262b62cc08cSmrgelif test "x$use_ps2pdf" = x"no" ; then
2263b62cc08cSmrg   if test "x$PS2PDF" != "x"; then
2264b62cc08cSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2265b62cc08cSmrg   fi
2266b62cc08cSmrg   have_ps2pdf=no
2267b62cc08cSmrgelse
2268b62cc08cSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2269b62cc08cSmrgfi
2270b62cc08cSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2271b62cc08cSmrg]) # XORG_WITH_PS2PDF
2272b62cc08cSmrg
2273b62cc08cSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2274b62cc08cSmrg# ----------------
2275b62cc08cSmrg# Minimum version: 1.6.0
2276b62cc08cSmrg#
2277b62cc08cSmrg# Documentation tools are not always available on all platforms and sometimes
2278b62cc08cSmrg# not at the appropriate level. This macro enables a builder to skip all
2279b62cc08cSmrg# documentation targets except traditional man pages.
2280b62cc08cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2281b62cc08cSmrg# maximum flexibilty in controlling documentation building.
2282b62cc08cSmrg# Refer to:
2283b62cc08cSmrg# XORG_WITH_XMLTO         --with-xmlto
2284b62cc08cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2285b62cc08cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2286b62cc08cSmrg# XORG_WITH_FOP           --with-fop
2287b62cc08cSmrg# XORG_WITH_GROFF         --with-groff
2288b62cc08cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2289b62cc08cSmrg#
2290b62cc08cSmrg# Interface to module:
2291b62cc08cSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2292b62cc08cSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2293b62cc08cSmrg#		 'no' user instructs the module not to generate docs
2294b62cc08cSmrg# parm1:	specify the default value, yes or no.
2295b62cc08cSmrg#
2296b62cc08cSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
229790b6713cSmrgm4_define([docs_default], m4_default([$1], [yes]))
2298b62cc08cSmrgAC_ARG_ENABLE(docs,
2299b62cc08cSmrg	AS_HELP_STRING([--enable-docs],
230090b6713cSmrg	   [Enable building the documentation (default: ]docs_default[)]),
230190b6713cSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
230290b6713cSmrgm4_undefine([docs_default])
2303b62cc08cSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2304b62cc08cSmrgAC_MSG_CHECKING([whether to build documentation])
2305b62cc08cSmrgAC_MSG_RESULT([$build_docs])
2306b62cc08cSmrg]) # XORG_ENABLE_DOCS
2307b62cc08cSmrg
2308b62cc08cSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2309b62cc08cSmrg# ----------------
2310b62cc08cSmrg# Minimum version: 1.6.0
2311b62cc08cSmrg#
2312b62cc08cSmrg# This macro enables a builder to skip all developer documentation.
2313b62cc08cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2314b62cc08cSmrg# maximum flexibilty in controlling documentation building.
2315b62cc08cSmrg# Refer to:
2316b62cc08cSmrg# XORG_WITH_XMLTO         --with-xmlto
2317b62cc08cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2318b62cc08cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2319b62cc08cSmrg# XORG_WITH_FOP           --with-fop
2320b62cc08cSmrg# XORG_WITH_GROFF         --with-groff
2321b62cc08cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2322b62cc08cSmrg#
2323b62cc08cSmrg# Interface to module:
2324b62cc08cSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2325b62cc08cSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2326b62cc08cSmrg#			'no' user instructs the module not to generate developer docs
2327b62cc08cSmrg# parm1:		specify the default value, yes or no.
2328b62cc08cSmrg#
2329b62cc08cSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2330b62cc08cSmrgm4_define([devel_default], m4_default([$1], [yes]))
2331b62cc08cSmrgAC_ARG_ENABLE(devel-docs,
2332b62cc08cSmrg	AS_HELP_STRING([--enable-devel-docs],
2333b62cc08cSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2334b62cc08cSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2335b62cc08cSmrgm4_undefine([devel_default])
2336b62cc08cSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2337b62cc08cSmrgAC_MSG_CHECKING([whether to build developer documentation])
2338b62cc08cSmrgAC_MSG_RESULT([$build_devel_docs])
2339b62cc08cSmrg]) # XORG_ENABLE_DEVEL_DOCS
2340b62cc08cSmrg
2341b62cc08cSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2342b62cc08cSmrg# ----------------
2343b62cc08cSmrg# Minimum version: 1.6.0
2344b62cc08cSmrg#
2345b62cc08cSmrg# This macro enables a builder to skip all functional specification targets.
2346b62cc08cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2347b62cc08cSmrg# maximum flexibilty in controlling documentation building.
2348b62cc08cSmrg# Refer to:
2349b62cc08cSmrg# XORG_WITH_XMLTO         --with-xmlto
2350b62cc08cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2351b62cc08cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2352b62cc08cSmrg# XORG_WITH_FOP           --with-fop
2353b62cc08cSmrg# XORG_WITH_GROFF         --with-groff
2354b62cc08cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2355b62cc08cSmrg#
2356b62cc08cSmrg# Interface to module:
2357b62cc08cSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2358b62cc08cSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2359b62cc08cSmrg#			'no' user instructs the module not to generate specs
2360b62cc08cSmrg# parm1:		specify the default value, yes or no.
2361b62cc08cSmrg#
2362b62cc08cSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2363b62cc08cSmrgm4_define([spec_default], m4_default([$1], [yes]))
2364b62cc08cSmrgAC_ARG_ENABLE(specs,
2365b62cc08cSmrg	AS_HELP_STRING([--enable-specs],
2366b62cc08cSmrg	   [Enable building the specs (default: ]spec_default[)]),
2367b62cc08cSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2368b62cc08cSmrgm4_undefine([spec_default])
2369b62cc08cSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2370b62cc08cSmrgAC_MSG_CHECKING([whether to build functional specifications])
2371b62cc08cSmrgAC_MSG_RESULT([$build_specs])
2372b62cc08cSmrg]) # XORG_ENABLE_SPECS
2373b62cc08cSmrg
237490b6713cSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
237590b6713cSmrg# ----------------------------------------------
237690b6713cSmrg# Minimum version: 1.13.0
237790b6713cSmrg#
237890b6713cSmrg# This macro enables a builder to enable/disable unit testing
237990b6713cSmrg# It makes no assumption about the test cases implementation
238090b6713cSmrg# Test cases may or may not use Automake "Support for test suites"
238190b6713cSmrg# They may or may not use the software utility library GLib
238290b6713cSmrg#
238390b6713cSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
238490b6713cSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
238590b6713cSmrg# The variable enable_unit_tests is used by other macros in this file.
238690b6713cSmrg#
238790b6713cSmrg# Interface to module:
238890b6713cSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
238990b6713cSmrg# enable_unit_tests:    used in configure.ac for additional configuration
239090b6713cSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
239190b6713cSmrg#			'no' user instructs the module not to build tests
239290b6713cSmrg# parm1:		specify the default value, yes or no.
239390b6713cSmrg#
239490b6713cSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
239590b6713cSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
239690b6713cSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
23979d794632SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
239890b6713cSmrgm4_define([_defopt], m4_default([$1], [auto]))
239990b6713cSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
240090b6713cSmrg	[Enable building unit test cases (default: ]_defopt[)]),
240190b6713cSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
240290b6713cSmrgm4_undefine([_defopt])
240390b6713cSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
240490b6713cSmrgAC_MSG_CHECKING([whether to build unit test cases])
240590b6713cSmrgAC_MSG_RESULT([$enable_unit_tests])
240690b6713cSmrg]) # XORG_ENABLE_UNIT_TESTS
240790b6713cSmrg
24089d794632Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
24099d794632Smrg# ------------------------------------------------------
24109d794632Smrg# Minimum version: 1.17.0
24119d794632Smrg#
24129d794632Smrg# This macro enables a builder to enable/disable integration testing
24139d794632Smrg# It makes no assumption about the test cases' implementation
24149d794632Smrg# Test cases may or may not use Automake "Support for test suites"
24159d794632Smrg#
24169d794632Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
24179d794632Smrg# usually requires less dependencies and may be built and run under less
24189d794632Smrg# stringent environments than integration tests.
24199d794632Smrg#
24209d794632Smrg# Interface to module:
24219d794632Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
24229d794632Smrg# enable_integration_tests:   used in configure.ac for additional configuration
24239d794632Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
24249d794632Smrg#                             'no' user instructs the module not to build tests
24259d794632Smrg# parm1:                      specify the default value, yes or no.
24269d794632Smrg#
24279d794632SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
24289d794632SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
24299d794632Smrgm4_define([_defopt], m4_default([$1], [auto]))
24309d794632SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
24319d794632Smrg	[Enable building integration test cases (default: ]_defopt[)]),
24329d794632Smrg	[enable_integration_tests=$enableval],
24339d794632Smrg	[enable_integration_tests=]_defopt)
24349d794632Smrgm4_undefine([_defopt])
24359d794632SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
24369d794632Smrg	[test "x$enable_integration_tests" != xno])
24379d794632SmrgAC_MSG_CHECKING([whether to build unit test cases])
24389d794632SmrgAC_MSG_RESULT([$enable_integration_tests])
24399d794632Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
24409d794632Smrg
244190b6713cSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
244290b6713cSmrg# ----------------------------------------
244390b6713cSmrg# Minimum version: 1.13.0
244490b6713cSmrg#
244590b6713cSmrg# GLib is a library which provides advanced data structures and functions.
244690b6713cSmrg# This macro enables a module to test for the presence of Glib.
244790b6713cSmrg#
244890b6713cSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
244990b6713cSmrg# Otherwise the value of $enable_unit_tests is blank.
245090b6713cSmrg#
24519d794632Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
24529d794632Smrg# test support usually requires less dependencies and may be built and run under
24539d794632Smrg# less stringent environments than integration tests.
24549d794632Smrg#
245590b6713cSmrg# Interface to module:
245690b6713cSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
245790b6713cSmrg# with_glib: used in configure.ac to know if GLib has been found
245890b6713cSmrg# --with-glib:	'yes' user instructs the module to use glib
245990b6713cSmrg#		'no' user instructs the module not to use glib
246090b6713cSmrg#
246190b6713cSmrgAC_DEFUN([XORG_WITH_GLIB],[
246290b6713cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
246390b6713cSmrgm4_define([_defopt], m4_default([$2], [auto]))
246490b6713cSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
246590b6713cSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
246690b6713cSmrg	[with_glib=$withval], [with_glib=]_defopt)
246790b6713cSmrgm4_undefine([_defopt])
246890b6713cSmrg
246990b6713cSmrghave_glib=no
247090b6713cSmrg# Do not probe GLib if user explicitly disabled unit testing
247190b6713cSmrgif test "x$enable_unit_tests" != x"no"; then
247290b6713cSmrg  # Do not probe GLib if user explicitly disabled it
247390b6713cSmrg  if test "x$with_glib" != x"no"; then
247490b6713cSmrg    m4_ifval(
247590b6713cSmrg      [$1],
247690b6713cSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
247790b6713cSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
247890b6713cSmrg    )
247990b6713cSmrg  fi
248090b6713cSmrgfi
248190b6713cSmrg
248290b6713cSmrg# Not having GLib when unit testing has been explicitly requested is an error
248390b6713cSmrgif test "x$enable_unit_tests" = x"yes"; then
248490b6713cSmrg  if test "x$have_glib" = x"no"; then
248590b6713cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
248690b6713cSmrg  fi
248790b6713cSmrgfi
248890b6713cSmrg
248990b6713cSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
249090b6713cSmrgif test "x$enable_unit_tests" = x"no"; then
249190b6713cSmrg  if test "x$with_glib" = x"yes"; then
249290b6713cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
249390b6713cSmrg  fi
249490b6713cSmrgfi
249590b6713cSmrg
249690b6713cSmrg# Not having GLib when it has been explicitly requested is an error
249790b6713cSmrgif test "x$with_glib" = x"yes"; then
249890b6713cSmrg  if test "x$have_glib" = x"no"; then
249990b6713cSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
250090b6713cSmrg  fi
250190b6713cSmrgfi
250290b6713cSmrg
250390b6713cSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
250490b6713cSmrg]) # XORG_WITH_GLIB
250590b6713cSmrg
25069d794632Smrg# XORG_LD_WRAP([required|optional])
25079d794632Smrg# ---------------------------------
250890b6713cSmrg# Minimum version: 1.13.0
250990b6713cSmrg#
251090b6713cSmrg# Check if linker supports -wrap, passed via compiler flags
251190b6713cSmrg#
251290b6713cSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
251390b6713cSmrg# Otherwise the value of $enable_unit_tests is blank.
251490b6713cSmrg#
25159d794632Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
25169d794632Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
25179d794632Smrg# available, an argument of "optional" allows use when some unit tests require
25189d794632Smrg# ld -wrap and others do not.
25199d794632Smrg#
252090b6713cSmrgAC_DEFUN([XORG_LD_WRAP],[
25219d794632SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
25229d794632Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
25239d794632Smrg                      void __wrap_exit(int status) { return; }],
25249d794632Smrg                     [exit(0);])])
252590b6713cSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
25269d794632Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
252790b6713cSmrg  if test "x$have_ld_wrap" = x"no"; then
252890b6713cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
252990b6713cSmrg  fi
253090b6713cSmrgfi
253190b6713cSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
253290b6713cSmrg#
253390b6713cSmrg]) # XORG_LD_WRAP
253490b6713cSmrg
253590b6713cSmrg# XORG_CHECK_LINKER_FLAGS
253690b6713cSmrg# -----------------------
253790b6713cSmrg# SYNOPSIS
253890b6713cSmrg#
25399d794632Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
254090b6713cSmrg#
254190b6713cSmrg# DESCRIPTION
254290b6713cSmrg#
254390b6713cSmrg#   Check whether the given linker FLAGS work with the current language's
254490b6713cSmrg#   linker, or whether they give an error.
254590b6713cSmrg#
254690b6713cSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
254790b6713cSmrg#   success/failure.
254890b6713cSmrg#
25499d794632Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
25509d794632Smrg#
255190b6713cSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
255290b6713cSmrg#
255390b6713cSmrg# LICENSE
255490b6713cSmrg#
255590b6713cSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
255690b6713cSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
255790b6713cSmrg#   Copyright (c) 2009 Matteo Frigo
255890b6713cSmrg#
255990b6713cSmrg#   This program is free software: you can redistribute it and/or modify it
256090b6713cSmrg#   under the terms of the GNU General Public License as published by the
256190b6713cSmrg#   Free Software Foundation, either version 3 of the License, or (at your
256290b6713cSmrg#   option) any later version.
256390b6713cSmrg#
256490b6713cSmrg#   This program is distributed in the hope that it will be useful, but
256590b6713cSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
256690b6713cSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
256790b6713cSmrg#   Public License for more details.
256890b6713cSmrg#
256990b6713cSmrg#   You should have received a copy of the GNU General Public License along
257090b6713cSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
257190b6713cSmrg#
257290b6713cSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
257390b6713cSmrg#   gives unlimited permission to copy, distribute and modify the configure
257490b6713cSmrg#   scripts that are the output of Autoconf when processing the Macro. You
257590b6713cSmrg#   need not follow the terms of the GNU General Public License when using
257690b6713cSmrg#   or distributing such scripts, even though portions of the text of the
257790b6713cSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
257890b6713cSmrg#   all other use of the material that constitutes the Autoconf Macro.
257990b6713cSmrg#
258090b6713cSmrg#   This special exception to the GPL applies to versions of the Autoconf
258190b6713cSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
258290b6713cSmrg#   modified version of the Autoconf Macro, you may extend this special
258390b6713cSmrg#   exception to the GPL to apply to your modified version as well.#
258490b6713cSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
258590b6713cSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
258690b6713cSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
258790b6713cSmrgAS_LITERAL_IF([$1],
258890b6713cSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
258990b6713cSmrg      ax_save_FLAGS=$LDFLAGS
259090b6713cSmrg      LDFLAGS="$1"
25919d794632Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
259290b6713cSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
259390b6713cSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
259490b6713cSmrg      LDFLAGS=$ax_save_FLAGS])],
259590b6713cSmrg  [ax_save_FLAGS=$LDFLAGS
259690b6713cSmrg   LDFLAGS="$1"
259790b6713cSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
259890b6713cSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
259990b6713cSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
260090b6713cSmrg   LDFLAGS=$ax_save_FLAGS])
260190b6713cSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
260290b6713cSmrgAC_MSG_RESULT($xorg_check_linker_flags)
260390b6713cSmrgif test "x$xorg_check_linker_flags" = xyes; then
260490b6713cSmrg	m4_default([$2], :)
260590b6713cSmrgelse
260690b6713cSmrg	m4_default([$3], :)
260790b6713cSmrgfi
260890b6713cSmrg]) # XORG_CHECK_LINKER_FLAGS
260990b6713cSmrg
26109d794632Smrg# XORG_MEMORY_CHECK_FLAGS
26119d794632Smrg# -----------------------
26129d794632Smrg# Minimum version: 1.16.0
26139d794632Smrg#
26149d794632Smrg# This macro attempts to find appropriate memory checking functionality
26159d794632Smrg# for various platforms which unit testing code may use to catch various
26169d794632Smrg# forms of memory allocation and access errors in testing.
26179d794632Smrg#
26189d794632Smrg# Interface to module:
26199d794632Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
26209d794632Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
26219d794632Smrg#
26229d794632Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
26239d794632Smrg#
26249d794632SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
26259d794632Smrg
26269d794632SmrgAC_REQUIRE([AC_CANONICAL_HOST])
26279d794632SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
26289d794632Smrg           [Environment variables to enable memory checking in tests])
26299d794632Smrg
26309d794632Smrg# Check for different types of support on different platforms
26319d794632Smrgcase $host_os in
26329d794632Smrg    solaris*)
26339d794632Smrg        AC_CHECK_LIB([umem], [umem_alloc],
26349d794632Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
26359d794632Smrg        ;;
26369d794632Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
26379d794632Smrg        # both directly and inverted, so should not be 0 or 255.
26389d794632Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
26399d794632Smrg        ;;
26409d794632Smrg    darwin*)
26419d794632Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
26429d794632Smrg        ;;
26439d794632Smrg    *bsd*)
26449d794632Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
26459d794632Smrg        ;;
26469d794632Smrgesac
26479d794632Smrg
26489d794632Smrg# User supplied flags override default flags
26499d794632Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
26509d794632Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
26519d794632Smrgfi
26529d794632Smrg
26539d794632SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
26549d794632Smrg]) # XORG_WITH_LINT
26559d794632Smrg
26569fe995a9Smrg# XORG_CHECK_MALLOC_ZERO
26579fe995a9Smrg# ----------------------
26589fe995a9Smrg# Minimum version: 1.0.0
26599fe995a9Smrg#
26609fe995a9Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
26619fe995a9Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
26629fe995a9Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
26639fe995a9SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
26649fe995a9SmrgAC_ARG_ENABLE(malloc0returnsnull,
2665b62cc08cSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
26669fe995a9Smrg		       [malloc(0) returns NULL (default: auto)]),
26679fe995a9Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
26689fe995a9Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
26699fe995a9Smrg
26709fe995a9SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
26719fe995a9Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2672e8ac26b0SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2673e8ac26b0Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
267490b6713cSmrg#include <stdlib.h>
267590b6713cSmrg],[
26769fe995a9Smrg    char *m0, *r0, *c0, *p;
26779fe995a9Smrg    m0 = malloc(0);
26789fe995a9Smrg    p = malloc(10);
26799fe995a9Smrg    r0 = realloc(p,0);
268090b6713cSmrg    c0 = calloc(0,10);
268190b6713cSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
268290b6713cSmrg])],
2683e8ac26b0Smrg		[xorg_cv_malloc0_returns_null=yes],
2684e8ac26b0Smrg		[xorg_cv_malloc0_returns_null=no])])
2685e8ac26b0SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
26869fe995a9Smrgfi
26879fe995a9SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
26889fe995a9Smrg
26899fe995a9Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
26909fe995a9Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
26919fe995a9Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
26929fe995a9Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
26939fe995a9Smrgelse
26949fe995a9Smrg	MALLOC_ZERO_CFLAGS=""
26959fe995a9Smrg	XMALLOC_ZERO_CFLAGS=""
26969fe995a9Smrg	XTMALLOC_ZERO_CFLAGS=""
26979fe995a9Smrgfi
26989fe995a9Smrg
26999fe995a9SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
27009fe995a9SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
27019fe995a9SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
27029fe995a9Smrg]) # XORG_CHECK_MALLOC_ZERO
27039fe995a9Smrg
27049fe995a9Smrg# XORG_WITH_LINT()
27059fe995a9Smrg# ----------------
27069fe995a9Smrg# Minimum version: 1.1.0
27079fe995a9Smrg#
2708b62cc08cSmrg# This macro enables the use of a tool that flags some suspicious and
2709b62cc08cSmrg# non-portable constructs (likely to be bugs) in C language source code.
2710b62cc08cSmrg# It will attempt to locate the tool and use appropriate options.
2711b62cc08cSmrg# There are various lint type tools on different platforms.
2712b62cc08cSmrg#
2713b62cc08cSmrg# Interface to module:
2714b62cc08cSmrg# LINT:		returns the path to the tool found on the platform
2715b62cc08cSmrg#		or the value set to LINT on the configure cmd line
2716b62cc08cSmrg#		also an Automake conditional
2717b62cc08cSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2718b62cc08cSmrg#
2719b62cc08cSmrg# --with-lint:	'yes' user instructs the module to use lint
2720b62cc08cSmrg#		'no' user instructs the module not to use lint (default)
2721b62cc08cSmrg#
2722b62cc08cSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2723b62cc08cSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
27249fe995a9Smrg#
27259fe995a9SmrgAC_DEFUN([XORG_WITH_LINT],[
27269fe995a9Smrg
2727b62cc08cSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2728b62cc08cSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2729b62cc08cSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27309fe995a9Smrg		[Use a lint-style source code checker (default: disabled)])],
27319fe995a9Smrg		[use_lint=$withval], [use_lint=no])
2732b62cc08cSmrg
2733b62cc08cSmrg# Obtain platform specific info like program name and options
2734b62cc08cSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2735b62cc08cSmrgcase $host_os in
2736b62cc08cSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2737b62cc08cSmrg	lint_name=splint
2738b62cc08cSmrg	lint_options="-badflag"
2739b62cc08cSmrg	;;
2740b62cc08cSmrg  *freebsd* | *netbsd*)
2741b62cc08cSmrg	lint_name=lint
2742b62cc08cSmrg	lint_options="-u -b"
2743b62cc08cSmrg	;;
2744b62cc08cSmrg  *solaris*)
2745b62cc08cSmrg	lint_name=lint
2746b62cc08cSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2747b62cc08cSmrg	;;
2748b62cc08cSmrgesac
2749b62cc08cSmrg
2750b62cc08cSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2751b62cc08cSmrgif test "x$use_lint" = x"yes" ; then
2752b62cc08cSmrg   AC_PATH_PROG([LINT], [$lint_name])
2753b62cc08cSmrg   if test "x$LINT" = "x"; then
2754b62cc08cSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2755b62cc08cSmrg   fi
2756b62cc08cSmrgelif test "x$use_lint" = x"no" ; then
2757b62cc08cSmrg   if test "x$LINT" != "x"; then
2758b62cc08cSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2759b62cc08cSmrg   fi
27609fe995a9Smrgelse
2761b62cc08cSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
27629fe995a9Smrgfi
2763b62cc08cSmrg
2764b62cc08cSmrg# User supplied flags override default flags
2765b62cc08cSmrgif test "x$LINT_FLAGS" != "x"; then
2766b62cc08cSmrg   lint_options=$LINT_FLAGS
27679fe995a9Smrgfi
27689fe995a9Smrg
2769b62cc08cSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2770b62cc08cSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
27719fe995a9Smrg
27729fe995a9Smrg]) # XORG_WITH_LINT
27739fe995a9Smrg
27749fe995a9Smrg# XORG_LINT_LIBRARY(LIBNAME)
27759fe995a9Smrg# --------------------------
27769fe995a9Smrg# Minimum version: 1.1.0
27779fe995a9Smrg#
27789fe995a9Smrg# Sets up flags for building lint libraries for checking programs that call
27799fe995a9Smrg# functions in the library.
27809fe995a9Smrg#
2781b62cc08cSmrg# Interface to module:
2782b62cc08cSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2783b62cc08cSmrg# MAKE_LINT_LIB		- Automake conditional
2784b62cc08cSmrg#
2785b62cc08cSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2786b62cc08cSmrg#			  - 'no' user instructs the module not to create a lint library (default)
27879fe995a9Smrg
27889fe995a9SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
27899fe995a9SmrgAC_REQUIRE([XORG_WITH_LINT])
2790b62cc08cSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
27919fe995a9Smrg	[Create lint library (default: disabled)])],
27929fe995a9Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2793b62cc08cSmrg
2794b62cc08cSmrgif test "x$make_lint_lib" = x"yes" ; then
2795b62cc08cSmrg   LINTLIB=llib-l$1.ln
2796b62cc08cSmrg   if test "x$LINT" = "x"; then
2797b62cc08cSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2798b62cc08cSmrg   fi
2799b62cc08cSmrgelif test "x$make_lint_lib" != x"no" ; then
2800b62cc08cSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
28019fe995a9Smrgfi
2802b62cc08cSmrg
28039fe995a9SmrgAC_SUBST(LINTLIB)
28049fe995a9SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
28059fe995a9Smrg
28069fe995a9Smrg]) # XORG_LINT_LIBRARY
28079fe995a9Smrg
28089d794632Smrg# XORG_COMPILER_BRAND
28099d794632Smrg# -------------------
28109d794632Smrg# Minimum version: 1.14.0
28119d794632Smrg#
28129d794632Smrg# Checks for various brands of compilers and sets flags as appropriate:
28139d794632Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
28149d794632Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
28159d794632Smrg#   clang compiler - sets CLANGCC to "yes"
28169d794632Smrg#   Intel compiler - sets INTELCC to "yes"
28179d794632Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
28189d794632Smrg#
28199d794632SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
28209d794632SmrgAC_LANG_CASE(
28219d794632Smrg	[C], [
28229d794632Smrg		AC_REQUIRE([AC_PROG_CC_C99])
28239d794632Smrg	],
28249d794632Smrg	[C++], [
28259d794632Smrg		AC_REQUIRE([AC_PROG_CXX])
28269d794632Smrg	]
28279d794632Smrg)
28289d794632SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
28299d794632SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
28309d794632SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
28319d794632Smrg]) # XORG_COMPILER_BRAND
28329d794632Smrg
28339d794632Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
28349d794632Smrg# ---------------
28359d794632Smrg# Minimum version: 1.16.0
28369d794632Smrg#
28379d794632Smrg# Test if the compiler works when passed the given flag as a command line argument.
28389d794632Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
28399d794632Smrg# next flag in the list until there are no more options.
28409d794632Smrg#
28419d794632Smrg# Note that this does not guarantee that the compiler supports the flag as some
28429d794632Smrg# compilers will simply ignore arguments that they do not understand, but we do
28439d794632Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
28449d794632Smrg# -Werror=unused-command-line-argument
28459d794632Smrg#
28469d794632SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
28479d794632Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28489d794632Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28499d794632Smrg
28509d794632SmrgAC_LANG_COMPILER_REQUIRE
28519d794632Smrg
28529d794632SmrgAC_LANG_CASE(
28539d794632Smrg	[C], [
28549d794632Smrg		AC_REQUIRE([AC_PROG_CC_C99])
28559d794632Smrg		define([PREFIX], [C])
28569d794632Smrg		define([CACHE_PREFIX], [cc])
28579d794632Smrg		define([COMPILER], [$CC])
28589d794632Smrg	],
28599d794632Smrg	[C++], [
28609d794632Smrg		define([PREFIX], [CXX])
28619d794632Smrg		define([CACHE_PREFIX], [cxx])
28629d794632Smrg		define([COMPILER], [$CXX])
28639d794632Smrg	]
28649d794632Smrg)
28659d794632Smrg
28669d794632Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
28679d794632Smrg
28689d794632Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
28699d794632Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28709d794632Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
28719d794632Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
28729d794632Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28739d794632Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
28749d794632Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
28759d794632Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
28769d794632Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28779d794632Smrgfi
28789d794632Smrg
28799d794632Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
28809d794632Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
28819d794632Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28829d794632Smrg	fi
28839d794632Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
28849d794632Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
28859d794632Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
28869d794632Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28879d794632Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
28889d794632Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
28899d794632Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
28909d794632Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28919d794632Smrgfi
28929d794632Smrg
28939d794632Smrgfound="no"
28949d794632Smrgm4_foreach([flag], m4_cdr($@), [
28959d794632Smrg	if test $found = "no" ; then
2896e8ac26b0Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
28979d794632Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28989d794632Smrg		fi
28999d794632Smrg
2900e8ac26b0Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
29019d794632Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
29029d794632Smrg		fi
29039d794632Smrg
29049d794632Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
29059d794632Smrg
29069d794632Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
29079d794632Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
29089d794632Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
29099d794632Smrg		AC_CACHE_VAL($cacheid,
29109d794632Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
29119d794632Smrg					     [eval $cacheid=yes],
29129d794632Smrg					     [eval $cacheid=no])])
29139d794632Smrg
29149d794632Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
29159d794632Smrg
29169d794632Smrg		eval supported=\$$cacheid
29179d794632Smrg		AC_MSG_RESULT([$supported])
29189d794632Smrg		if test "$supported" = "yes" ; then
29199d794632Smrg			$1="$$1 ]flag["
29209d794632Smrg			found="yes"
29219d794632Smrg		fi
29229d794632Smrg	fi
29239d794632Smrg])
29249d794632Smrg]) # XORG_TESTSET_CFLAG
29259d794632Smrg
29269d794632Smrg# XORG_COMPILER_FLAGS
29279d794632Smrg# ---------------
29289d794632Smrg# Minimum version: 1.16.0
29299d794632Smrg#
29309d794632Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
29319d794632Smrg# arguments supported by the selected compiler which do NOT alter the generated
29329d794632Smrg# code.  These arguments will cause the compiler to print various warnings
29339d794632Smrg# during compilation AND turn a conservative set of warnings into errors.
29349d794632Smrg#
29359d794632Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
29369d794632Smrg# future versions of util-macros as options are added to new compilers.
29379d794632Smrg#
29389d794632SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
29399d794632SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
29409d794632Smrg
29419d794632SmrgAC_ARG_ENABLE(selective-werror,
29429d794632Smrg              AS_HELP_STRING([--disable-selective-werror],
29439d794632Smrg                             [Turn off selective compiler errors. (default: enabled)]),
29449d794632Smrg              [SELECTIVE_WERROR=$enableval],
29459d794632Smrg              [SELECTIVE_WERROR=yes])
29469d794632Smrg
29479d794632SmrgAC_LANG_CASE(
29489d794632Smrg        [C], [
29499d794632Smrg                define([PREFIX], [C])
29509d794632Smrg        ],
29519d794632Smrg        [C++], [
29529d794632Smrg                define([PREFIX], [CXX])
29539d794632Smrg        ]
29549d794632Smrg)
29559d794632Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
29569d794632Smrgif test "x$SUNCC" = "xyes"; then
29579d794632Smrg    [BASE_]PREFIX[FLAGS]="-v"
29589d794632Smrgelse
29599d794632Smrg    [BASE_]PREFIX[FLAGS]=""
29609d794632Smrgfi
29619d794632Smrg
29629d794632Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
29639d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
29649d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
29659d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
29669d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
29679d794632Smrg
29689d794632SmrgAC_LANG_CASE(
29699d794632Smrg	[C], [
29709d794632Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
29719d794632Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
29729d794632Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
29739d794632Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2974e8ac26b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
29759d794632Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
29769d794632Smrg	]
29779d794632Smrg)
29789d794632Smrg
29799d794632Smrg# This chunk adds additional warnings that could catch undesired effects.
29809d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
29819d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
29829d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
29839d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
29849d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
29859d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2986e8ac26b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
29879d794632Smrg
29889d794632Smrg# These are currently disabled because they are noisy.  They will be enabled
29899d794632Smrg# in the future once the codebase is sufficiently modernized to silence
29909d794632Smrg# them.  For now, I don't want them to drown out the other warnings.
29919d794632Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
29929d794632Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2993e8ac26b0Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
29949d794632Smrg
29959d794632Smrg# Turn some warnings into errors, so we don't accidently get successful builds
29969d794632Smrg# when there are problems that should be fixed.
29979d794632Smrg
29989d794632Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
29999d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
30009d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
30019d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
30029d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
30039d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
30049d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
30059d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
30069d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
30079d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
30089d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
30099d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
30109d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
30119d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
30129d794632Smrgelse
30139d794632SmrgAC_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])
30149d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
30159d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
30169d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
30179d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
30189d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
30199d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
30209d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
30219d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
30229d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
30239d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
30249d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
30259d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
30269d794632SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
30279d794632Smrgfi
30289d794632Smrg
30299d794632SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
30309d794632Smrg]) # XORG_COMPILER_FLAGS
30319d794632Smrg
3032b62cc08cSmrg# XORG_CWARNFLAGS
3033b62cc08cSmrg# ---------------
3034b62cc08cSmrg# Minimum version: 1.2.0
30359d794632Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3036b62cc08cSmrg#
3037b62cc08cSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3038b62cc08cSmrg#
30399d794632Smrg# This function is deprecated because it defines -fno-strict-aliasing
30409d794632Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
30419d794632Smrg# is needed, then it should be added explicitly in the module when
30429d794632Smrg# it is updated to use BASE_CFLAGS.
30439d794632Smrg#
3044b62cc08cSmrgAC_DEFUN([XORG_CWARNFLAGS], [
30459d794632SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30469d794632SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30479d794632SmrgAC_LANG_CASE(
30489d794632Smrg	[C], [
30499d794632Smrg		CWARNFLAGS="$BASE_CFLAGS"
30509d794632Smrg		if  test "x$GCC" = xyes ; then
30519d794632Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
30529d794632Smrg		fi
30539d794632Smrg		AC_SUBST(CWARNFLAGS)
30549d794632Smrg	]
30559d794632Smrg)
3056b62cc08cSmrg]) # XORG_CWARNFLAGS
3057b62cc08cSmrg
3058b62cc08cSmrg# XORG_STRICT_OPTION
3059b62cc08cSmrg# -----------------------
3060b62cc08cSmrg# Minimum version: 1.3.0
3061b62cc08cSmrg#
30629d794632Smrg# Add configure option to enable strict compilation flags, such as treating
30639d794632Smrg# warnings as fatal errors.
30649d794632Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
30659d794632Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
30669d794632Smrg#
30679d794632Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
30689d794632Smrg# when strict compilation is unconditionally desired.
3069b62cc08cSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3070b62cc08cSmrgAC_REQUIRE([XORG_CWARNFLAGS])
30719d794632SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3072b62cc08cSmrg
3073b62cc08cSmrgAC_ARG_ENABLE(strict-compilation,
3074b62cc08cSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3075b62cc08cSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3076b62cc08cSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
30779d794632Smrg
30789d794632SmrgAC_LANG_CASE(
30799d794632Smrg        [C], [
30809d794632Smrg                define([PREFIX], [C])
30819d794632Smrg        ],
30829d794632Smrg        [C++], [
30839d794632Smrg                define([PREFIX], [CXX])
30849d794632Smrg        ]
30859d794632Smrg)
30869d794632Smrg
30879d794632Smrg[STRICT_]PREFIX[FLAGS]=""
30889d794632SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
30899d794632SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
30909d794632Smrg
30919d794632Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
30929d794632Smrg# activate it with -Werror, so we add it here explicitly.
30939d794632SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
30949d794632Smrg
3095b62cc08cSmrgif test "x$STRICT_COMPILE" = "xyes"; then
30969d794632Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
30979d794632Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3098b62cc08cSmrgfi
30999d794632SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
31009d794632SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31019d794632SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3102b62cc08cSmrg]) # XORG_STRICT_OPTION
3103b62cc08cSmrg
3104b62cc08cSmrg# XORG_DEFAULT_OPTIONS
3105b62cc08cSmrg# --------------------
3106b62cc08cSmrg# Minimum version: 1.3.0
3107b62cc08cSmrg#
3108b62cc08cSmrg# Defines default options for X.Org modules.
3109b62cc08cSmrg#
3110b62cc08cSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3111b62cc08cSmrgAC_REQUIRE([AC_PROG_INSTALL])
31129d794632SmrgXORG_COMPILER_FLAGS
3113b62cc08cSmrgXORG_CWARNFLAGS
3114b62cc08cSmrgXORG_STRICT_OPTION
3115b62cc08cSmrgXORG_RELEASE_VERSION
3116b62cc08cSmrgXORG_CHANGELOG
3117b62cc08cSmrgXORG_INSTALL
3118b62cc08cSmrgXORG_MANPAGE_SECTIONS
3119b62cc08cSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3120b62cc08cSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3121b62cc08cSmrg]) # XORG_DEFAULT_OPTIONS
3122b62cc08cSmrg
3123b62cc08cSmrg# XORG_INSTALL()
3124b62cc08cSmrg# ----------------
3125b62cc08cSmrg# Minimum version: 1.4.0
3126b62cc08cSmrg#
3127b62cc08cSmrg# Defines the variable INSTALL_CMD as the command to copy
3128b62cc08cSmrg# INSTALL from $prefix/share/util-macros.
3129b62cc08cSmrg#
3130b62cc08cSmrgAC_DEFUN([XORG_INSTALL], [
3131b62cc08cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3132b62cc08cSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3133b62cc08cSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3134b62cc08cSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3135b62cc08cSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3136b62cc08cSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3137b62cc08cSmrgAC_SUBST([INSTALL_CMD])
3138b62cc08cSmrg]) # XORG_INSTALL
31399fe995a9Smrgdnl Copyright 2005 Red Hat, Inc
31409fe995a9Smrgdnl
31419fe995a9Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
31429fe995a9Smrgdnl documentation for any purpose is hereby granted without fee, provided that
31439fe995a9Smrgdnl the above copyright notice appear in all copies and that both that
31449fe995a9Smrgdnl copyright notice and this permission notice appear in supporting
31459fe995a9Smrgdnl documentation.
31469fe995a9Smrgdnl
31479fe995a9Smrgdnl The above copyright notice and this permission notice shall be included
31489fe995a9Smrgdnl in all copies or substantial portions of the Software.
31499fe995a9Smrgdnl
31509fe995a9Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31519fe995a9Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31529fe995a9Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31539fe995a9Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
31549fe995a9Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31559fe995a9Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31569fe995a9Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
31579fe995a9Smrgdnl
31589fe995a9Smrgdnl Except as contained in this notice, the name of the copyright holders shall
31599fe995a9Smrgdnl not be used in advertising or otherwise to promote the sale, use or
31609fe995a9Smrgdnl other dealings in this Software without prior written authorization
31619fe995a9Smrgdnl from the copyright holders.
31629fe995a9Smrgdnl
31639fe995a9Smrg
31649fe995a9Smrg# XORG_RELEASE_VERSION
31659fe995a9Smrg# --------------------
3166b62cc08cSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3167e8ac26b0Smrg
31689fe995a9SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
31699fe995a9Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
31709fe995a9Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
31719fe995a9Smrg		[Major version of this package])
3172b62cc08cSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
31739fe995a9Smrg	if test "x$PVM" = "x"; then
31749fe995a9Smrg		PVM="0"
31759fe995a9Smrg	fi
31769fe995a9Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
31779fe995a9Smrg		[$PVM],
31789fe995a9Smrg		[Minor version of this package])
3179b62cc08cSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
31809fe995a9Smrg	if test "x$PVP" = "x"; then
31819fe995a9Smrg		PVP="0"
31829fe995a9Smrg	fi
31839fe995a9Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
31849fe995a9Smrg		[$PVP],
31859fe995a9Smrg		[Patch version of this package])
31869fe995a9Smrg])
31879fe995a9Smrg
3188b62cc08cSmrg# XORG_CHANGELOG()
3189b62cc08cSmrg# ----------------
3190b62cc08cSmrg# Minimum version: 1.2.0
3191b62cc08cSmrg#
3192b62cc08cSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3193b62cc08cSmrg# ChangeLog from git.
3194b62cc08cSmrg#
3195b62cc08cSmrg#
3196b62cc08cSmrgAC_DEFUN([XORG_CHANGELOG], [
3197b62cc08cSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3198b62cc08cSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3199b62cc08cSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3200b62cc08cSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3201b62cc08cSmrgAC_SUBST([CHANGELOG_CMD])
3202b62cc08cSmrg]) # XORG_CHANGELOG
3203b62cc08cSmrg
3204