aclocal.m4 revision 80b026c6
180b026c6Smrg# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
29aa228fdSmrg
39aa228fdSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
480b026c6Smrg# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
580b026c6Smrg# Inc.
69aa228fdSmrg# This file is free software; the Free Software Foundation
79aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
89aa228fdSmrg# with or without modifications, as long as this notice is preserved.
99aa228fdSmrg
109aa228fdSmrg# This program is distributed in the hope that it will be useful,
119aa228fdSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
129aa228fdSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
139aa228fdSmrg# PARTICULAR PURPOSE.
149aa228fdSmrg
158f65982aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
168f65982aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
178f65982aSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
188f65982aSmrg[m4_warning([this file was generated for autoconf 2.68.
198f65982aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
208f65982aSmrgIf you have problems, you may need to regenerate the build system entirely.
218f65982aSmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
229aa228fdSmrg
2380b026c6Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
2480b026c6Smrg# Foundation, Inc.
259aa228fdSmrg#
269aa228fdSmrg# This file is free software; the Free Software Foundation
279aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
289aa228fdSmrg# with or without modifications, as long as this notice is preserved.
299aa228fdSmrg
3080b026c6Smrg# serial 1
3180b026c6Smrg
329aa228fdSmrg# AM_AUTOMAKE_VERSION(VERSION)
339aa228fdSmrg# ----------------------------
349aa228fdSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
359aa228fdSmrg# generated from the m4 files accompanying Automake X.Y.
369aa228fdSmrg# (This private macro should not be called outside this file.)
379aa228fdSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
388f65982aSmrg[am__api_version='1.11'
399aa228fdSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
409aa228fdSmrgdnl require some minimum version.  Point them to the right macro.
4180b026c6Smrgm4_if([$1], [1.11.2], [],
429aa228fdSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
439aa228fdSmrg])
449aa228fdSmrg
459aa228fdSmrg# _AM_AUTOCONF_VERSION(VERSION)
469aa228fdSmrg# -----------------------------
479aa228fdSmrg# aclocal traces this macro to find the Autoconf version.
489aa228fdSmrg# This is a private macro too.  Using m4_define simplifies
499aa228fdSmrg# the logic in aclocal, which can simply ignore this definition.
509aa228fdSmrgm4_define([_AM_AUTOCONF_VERSION], [])
519aa228fdSmrg
529aa228fdSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
539aa228fdSmrg# -------------------------------
549aa228fdSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
558f65982aSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
569aa228fdSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5780b026c6Smrg[AM_AUTOMAKE_VERSION([1.11.2])dnl
588f65982aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
598f65982aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
608f65982aSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
619aa228fdSmrg
629aa228fdSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
639aa228fdSmrg
6480b026c6Smrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
659aa228fdSmrg#
669aa228fdSmrg# This file is free software; the Free Software Foundation
679aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
689aa228fdSmrg# with or without modifications, as long as this notice is preserved.
699aa228fdSmrg
7080b026c6Smrg# serial 1
7180b026c6Smrg
729aa228fdSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
739aa228fdSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
749aa228fdSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
759aa228fdSmrg#
769aa228fdSmrg# Of course, Automake must honor this variable whenever it calls a
779aa228fdSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
789aa228fdSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
799aa228fdSmrg# depending on how configure is run.  This is pretty annoying, since
809aa228fdSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
819aa228fdSmrg# source directory, any form will work fine, but in subdirectories a
829aa228fdSmrg# relative path needs to be adjusted first.
839aa228fdSmrg#
849aa228fdSmrg# $ac_aux_dir/missing
859aa228fdSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
869aa228fdSmrg# $top_srcdir/$ac_aux_dir/missing
879aa228fdSmrg#    fails if $ac_aux_dir is absolute,
889aa228fdSmrg#    fails when called from a subdirectory in a VPATH build with
899aa228fdSmrg#          a relative $ac_aux_dir
909aa228fdSmrg#
919aa228fdSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
929aa228fdSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
939aa228fdSmrg# harmless because $srcdir is `.', but things will broke when you
949aa228fdSmrg# start a VPATH build or use an absolute $srcdir.
959aa228fdSmrg#
969aa228fdSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
979aa228fdSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
989aa228fdSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
999aa228fdSmrg# and then we would define $MISSING as
1009aa228fdSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
1019aa228fdSmrg# This will work as long as MISSING is not called from configure, because
1029aa228fdSmrg# unfortunately $(top_srcdir) has no meaning in configure.
1039aa228fdSmrg# However there are other variables, like CC, which are often used in
1049aa228fdSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1059aa228fdSmrg#
1069aa228fdSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1079aa228fdSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1089aa228fdSmrg# configured tree to be moved without reconfiguration.
1099aa228fdSmrg
1109aa228fdSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1119aa228fdSmrg[dnl Rely on autoconf to set up CDPATH properly.
1129aa228fdSmrgAC_PREREQ([2.50])dnl
1139aa228fdSmrg# expand $ac_aux_dir to an absolute path
1149aa228fdSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
1159aa228fdSmrg])
1169aa228fdSmrg
1179aa228fdSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1189aa228fdSmrg
1198f65982aSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
1209aa228fdSmrg# Free Software Foundation, Inc.
1219aa228fdSmrg#
1229aa228fdSmrg# This file is free software; the Free Software Foundation
1239aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
1249aa228fdSmrg# with or without modifications, as long as this notice is preserved.
1259aa228fdSmrg
1268f65982aSmrg# serial 9
1279aa228fdSmrg
1289aa228fdSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1299aa228fdSmrg# -------------------------------------
1309aa228fdSmrg# Define a conditional.
1319aa228fdSmrgAC_DEFUN([AM_CONDITIONAL],
1329aa228fdSmrg[AC_PREREQ(2.52)dnl
1339aa228fdSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1349aa228fdSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1359aa228fdSmrgAC_SUBST([$1_TRUE])dnl
1369aa228fdSmrgAC_SUBST([$1_FALSE])dnl
1379aa228fdSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1389aa228fdSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1398f65982aSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1409aa228fdSmrgif $2; then
1419aa228fdSmrg  $1_TRUE=
1429aa228fdSmrg  $1_FALSE='#'
1439aa228fdSmrgelse
1449aa228fdSmrg  $1_TRUE='#'
1459aa228fdSmrg  $1_FALSE=
1469aa228fdSmrgfi
1479aa228fdSmrgAC_CONFIG_COMMANDS_PRE(
1489aa228fdSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1499aa228fdSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1509aa228fdSmrgUsually this means the macro was only invoked conditionally.]])
1519aa228fdSmrgfi])])
1529aa228fdSmrg
15380b026c6Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
15480b026c6Smrg# 2010, 2011 Free Software Foundation, Inc.
1559aa228fdSmrg#
1569aa228fdSmrg# This file is free software; the Free Software Foundation
1579aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
1589aa228fdSmrg# with or without modifications, as long as this notice is preserved.
1599aa228fdSmrg
16080b026c6Smrg# serial 12
1619aa228fdSmrg
1629aa228fdSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1639aa228fdSmrg# written in clear, in which case automake, when reading aclocal.m4,
1649aa228fdSmrg# will think it sees a *use*, and therefore will trigger all it's
1659aa228fdSmrg# C support machinery.  Also note that it means that autoscan, seeing
1669aa228fdSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1679aa228fdSmrg
1689aa228fdSmrg
1699aa228fdSmrg# _AM_DEPENDENCIES(NAME)
1709aa228fdSmrg# ----------------------
1719aa228fdSmrg# See how the compiler implements dependency checking.
1729aa228fdSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
1739aa228fdSmrg# We try a few techniques and use that to set a single cache variable.
1749aa228fdSmrg#
1759aa228fdSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1769aa228fdSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1779aa228fdSmrg# dependency, and given that the user is not expected to run this macro,
1789aa228fdSmrg# just rely on AC_PROG_CC.
1799aa228fdSmrgAC_DEFUN([_AM_DEPENDENCIES],
1809aa228fdSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1819aa228fdSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1829aa228fdSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1839aa228fdSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1849aa228fdSmrg
1859aa228fdSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
1869aa228fdSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
1879aa228fdSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1889aa228fdSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
1899aa228fdSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1909aa228fdSmrg                   [depcc="$$1"   am_compiler_list=])
1919aa228fdSmrg
1929aa228fdSmrgAC_CACHE_CHECK([dependency style of $depcc],
1939aa228fdSmrg               [am_cv_$1_dependencies_compiler_type],
1949aa228fdSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1959aa228fdSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1969aa228fdSmrg  # making bogus files that we don't know about and never remove.  For
1979aa228fdSmrg  # instance it was reported that on HP-UX the gcc test will end up
1989aa228fdSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
1999aa228fdSmrg  # in D'.
20080b026c6Smrg  rm -rf conftest.dir
2019aa228fdSmrg  mkdir conftest.dir
2029aa228fdSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
2039aa228fdSmrg  # using a relative directory.
2049aa228fdSmrg  cp "$am_depcomp" conftest.dir
2059aa228fdSmrg  cd conftest.dir
2069aa228fdSmrg  # We will build objects and dependencies in a subdirectory because
2079aa228fdSmrg  # it helps to detect inapplicable dependency modes.  For instance
2089aa228fdSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2099aa228fdSmrg  # side effect of compilation, but ICC will put the dependencies in
2109aa228fdSmrg  # the current directory while Tru64 will put them in the object
2119aa228fdSmrg  # directory.
2129aa228fdSmrg  mkdir sub
2139aa228fdSmrg
2149aa228fdSmrg  am_cv_$1_dependencies_compiler_type=none
2159aa228fdSmrg  if test "$am_compiler_list" = ""; then
2169aa228fdSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2179aa228fdSmrg  fi
2188f65982aSmrg  am__universal=false
2198f65982aSmrg  m4_case([$1], [CC],
2208f65982aSmrg    [case " $depcc " in #(
2218f65982aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2228f65982aSmrg     esac],
2238f65982aSmrg    [CXX],
2248f65982aSmrg    [case " $depcc " in #(
2258f65982aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2268f65982aSmrg     esac])
2278f65982aSmrg
2289aa228fdSmrg  for depmode in $am_compiler_list; do
2299aa228fdSmrg    # Setup a source with many dependencies, because some compilers
2309aa228fdSmrg    # like to wrap large dependency lists on column 80 (with \), and
2319aa228fdSmrg    # we should not choose a depcomp mode which is confused by this.
2329aa228fdSmrg    #
2339aa228fdSmrg    # We need to recreate these files for each test, as the compiler may
2349aa228fdSmrg    # overwrite some of them when testing with obscure command lines.
2359aa228fdSmrg    # This happens at least with the AIX C compiler.
2369aa228fdSmrg    : > sub/conftest.c
2379aa228fdSmrg    for i in 1 2 3 4 5 6; do
2389aa228fdSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2399aa228fdSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
2409aa228fdSmrg      # Solaris 8's {/usr,}/bin/sh.
2419aa228fdSmrg      touch sub/conftst$i.h
2429aa228fdSmrg    done
2439aa228fdSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2449aa228fdSmrg
2458f65982aSmrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
2468f65982aSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2478f65982aSmrg    # handle `-M -o', and we need to detect this.  Also, some Intel
2488f65982aSmrg    # versions had trouble with output in subdirs
2498f65982aSmrg    am__obj=sub/conftest.${OBJEXT-o}
2508f65982aSmrg    am__minus_obj="-o $am__obj"
2519aa228fdSmrg    case $depmode in
2528f65982aSmrg    gcc)
2538f65982aSmrg      # This depmode causes a compiler race in universal mode.
2548f65982aSmrg      test "$am__universal" = false || continue
2558f65982aSmrg      ;;
2569aa228fdSmrg    nosideeffect)
2579aa228fdSmrg      # after this tag, mechanisms are not by side-effect, so they'll
2589aa228fdSmrg      # only be used when explicitly requested
2599aa228fdSmrg      if test "x$enable_dependency_tracking" = xyes; then
2609aa228fdSmrg	continue
2619aa228fdSmrg      else
2629aa228fdSmrg	break
2639aa228fdSmrg      fi
2649aa228fdSmrg      ;;
26580b026c6Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2668f65982aSmrg      # This compiler won't grok `-c -o', but also, the minuso test has
2678f65982aSmrg      # not run yet.  These depmodes are late enough in the game, and
2688f65982aSmrg      # so weak that their functioning should not be impacted.
2698f65982aSmrg      am__obj=conftest.${OBJEXT-o}
2708f65982aSmrg      am__minus_obj=
2718f65982aSmrg      ;;
2729aa228fdSmrg    none) break ;;
2739aa228fdSmrg    esac
2749aa228fdSmrg    if depmode=$depmode \
2758f65982aSmrg       source=sub/conftest.c object=$am__obj \
2769aa228fdSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2778f65982aSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2789aa228fdSmrg         >/dev/null 2>conftest.err &&
2799aa228fdSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2809aa228fdSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2818f65982aSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2829aa228fdSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2839aa228fdSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2849aa228fdSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2859aa228fdSmrg      # that says an option was ignored or not supported.
2869aa228fdSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2879aa228fdSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2889aa228fdSmrg      # The diagnosis changed in icc 8.0:
2899aa228fdSmrg      #   icc: Command line remark: option '-MP' not supported
2909aa228fdSmrg      if (grep 'ignoring option' conftest.err ||
2919aa228fdSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2929aa228fdSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2939aa228fdSmrg        break
2949aa228fdSmrg      fi
2959aa228fdSmrg    fi
2969aa228fdSmrg  done
2979aa228fdSmrg
2989aa228fdSmrg  cd ..
2999aa228fdSmrg  rm -rf conftest.dir
3009aa228fdSmrgelse
3019aa228fdSmrg  am_cv_$1_dependencies_compiler_type=none
3029aa228fdSmrgfi
3039aa228fdSmrg])
3049aa228fdSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
3059aa228fdSmrgAM_CONDITIONAL([am__fastdep$1], [
3069aa228fdSmrg  test "x$enable_dependency_tracking" != xno \
3079aa228fdSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
3089aa228fdSmrg])
3099aa228fdSmrg
3109aa228fdSmrg
3119aa228fdSmrg# AM_SET_DEPDIR
3129aa228fdSmrg# -------------
3139aa228fdSmrg# Choose a directory name for dependency files.
3149aa228fdSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
3159aa228fdSmrgAC_DEFUN([AM_SET_DEPDIR],
3169aa228fdSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3179aa228fdSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3189aa228fdSmrg])
3199aa228fdSmrg
3209aa228fdSmrg
3219aa228fdSmrg# AM_DEP_TRACK
3229aa228fdSmrg# ------------
3239aa228fdSmrgAC_DEFUN([AM_DEP_TRACK],
3249aa228fdSmrg[AC_ARG_ENABLE(dependency-tracking,
3259aa228fdSmrg[  --disable-dependency-tracking  speeds up one-time build
3269aa228fdSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
3279aa228fdSmrgif test "x$enable_dependency_tracking" != xno; then
3289aa228fdSmrg  am_depcomp="$ac_aux_dir/depcomp"
3299aa228fdSmrg  AMDEPBACKSLASH='\'
33080b026c6Smrg  am__nodep='_no'
3319aa228fdSmrgfi
3329aa228fdSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3339aa228fdSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3349aa228fdSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
33580b026c6SmrgAC_SUBST([am__nodep])dnl
33680b026c6Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3379aa228fdSmrg])
3389aa228fdSmrg
3399aa228fdSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3409aa228fdSmrg
3418f65982aSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
3429aa228fdSmrg# Free Software Foundation, Inc.
3439aa228fdSmrg#
3449aa228fdSmrg# This file is free software; the Free Software Foundation
3459aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
3469aa228fdSmrg# with or without modifications, as long as this notice is preserved.
3479aa228fdSmrg
3488f65982aSmrg#serial 5
3499aa228fdSmrg
3509aa228fdSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3519aa228fdSmrg# ------------------------------
3529aa228fdSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3538f65982aSmrg[{
3548f65982aSmrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
3558f65982aSmrg  # are listed without --file.  Let's play safe and only enable the eval
3568f65982aSmrg  # if we detect the quoting.
3578f65982aSmrg  case $CONFIG_FILES in
3588f65982aSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
3598f65982aSmrg  *)   set x $CONFIG_FILES ;;
3608f65982aSmrg  esac
3618f65982aSmrg  shift
3628f65982aSmrg  for mf
3638f65982aSmrg  do
3648f65982aSmrg    # Strip MF so we end up with the name of the file.
3658f65982aSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3668f65982aSmrg    # Check whether this is an Automake generated Makefile or not.
3678f65982aSmrg    # We used to match only the files named `Makefile.in', but
3688f65982aSmrg    # some people rename them; so instead we look at the file content.
3698f65982aSmrg    # Grep'ing the first line is not enough: some people post-process
3708f65982aSmrg    # each Makefile.in and add a new line on top of each file to say so.
3718f65982aSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
3728f65982aSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3738f65982aSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3748f65982aSmrg      dirpart=`AS_DIRNAME("$mf")`
3758f65982aSmrg    else
3768f65982aSmrg      continue
3778f65982aSmrg    fi
3788f65982aSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
3798f65982aSmrg    # from the Makefile without running `make'.
3808f65982aSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3818f65982aSmrg    test -z "$DEPDIR" && continue
3828f65982aSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3838f65982aSmrg    test -z "am__include" && continue
3848f65982aSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3858f65982aSmrg    # When using ansi2knr, U may be empty or an underscore; expand it
3868f65982aSmrg    U=`sed -n 's/^U = //p' < "$mf"`
3878f65982aSmrg    # Find all dependency output files, they are included files with
3888f65982aSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3898f65982aSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3908f65982aSmrg    # expansion.
3918f65982aSmrg    for file in `sed -n "
3928f65982aSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3938f65982aSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
3948f65982aSmrg      # Make sure the directory exists.
3958f65982aSmrg      test -f "$dirpart/$file" && continue
3968f65982aSmrg      fdir=`AS_DIRNAME(["$file"])`
3978f65982aSmrg      AS_MKDIR_P([$dirpart/$fdir])
3988f65982aSmrg      # echo "creating $dirpart/$file"
3998f65982aSmrg      echo '# dummy' > "$dirpart/$file"
4008f65982aSmrg    done
4019aa228fdSmrg  done
4028f65982aSmrg}
4039aa228fdSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
4049aa228fdSmrg
4059aa228fdSmrg
4069aa228fdSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
4079aa228fdSmrg# -----------------------------
4089aa228fdSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
4099aa228fdSmrg#
4109aa228fdSmrg# This code is only required when automatic dependency tracking
4119aa228fdSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
4129aa228fdSmrg# need in order to bootstrap the dependency handling code.
4139aa228fdSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4149aa228fdSmrg[AC_CONFIG_COMMANDS([depfiles],
4159aa228fdSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4169aa228fdSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4179aa228fdSmrg])
4189aa228fdSmrg
4199aa228fdSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4209aa228fdSmrg
4219aa228fdSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4228f65982aSmrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
4239aa228fdSmrg#
4249aa228fdSmrg# This file is free software; the Free Software Foundation
4259aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
4269aa228fdSmrg# with or without modifications, as long as this notice is preserved.
4279aa228fdSmrg
4288f65982aSmrg# serial 16
4299aa228fdSmrg
4309aa228fdSmrg# This macro actually does too much.  Some checks are only needed if
4319aa228fdSmrg# your package does certain things.  But this isn't really a big deal.
4329aa228fdSmrg
4339aa228fdSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4349aa228fdSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4359aa228fdSmrg# -----------------------------------------------
4369aa228fdSmrg# The call with PACKAGE and VERSION arguments is the old style
4379aa228fdSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4389aa228fdSmrg# and VERSION should now be passed to AC_INIT and removed from
4399aa228fdSmrg# the call to AM_INIT_AUTOMAKE.
4409aa228fdSmrg# We support both call styles for the transition.  After
4419aa228fdSmrg# the next Automake release, Autoconf can make the AC_INIT
4429aa228fdSmrg# arguments mandatory, and then we can depend on a new Autoconf
4439aa228fdSmrg# release and drop the old call support.
4449aa228fdSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4458f65982aSmrg[AC_PREREQ([2.62])dnl
4469aa228fdSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4479aa228fdSmrgdnl the ones we care about.
4489aa228fdSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4499aa228fdSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4509aa228fdSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4519aa228fdSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4529aa228fdSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4539aa228fdSmrg  # is not polluted with repeated "-I."
4549aa228fdSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4559aa228fdSmrg  # test to see if srcdir already configured
4569aa228fdSmrg  if test -f $srcdir/config.status; then
4579aa228fdSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4589aa228fdSmrg  fi
4599aa228fdSmrgfi
4609aa228fdSmrg
4619aa228fdSmrg# test whether we have cygpath
4629aa228fdSmrgif test -z "$CYGPATH_W"; then
4639aa228fdSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4649aa228fdSmrg    CYGPATH_W='cygpath -w'
4659aa228fdSmrg  else
4669aa228fdSmrg    CYGPATH_W=echo
4679aa228fdSmrg  fi
4689aa228fdSmrgfi
4699aa228fdSmrgAC_SUBST([CYGPATH_W])
4709aa228fdSmrg
4719aa228fdSmrg# Define the identity of the package.
4729aa228fdSmrgdnl Distinguish between old-style and new-style calls.
4739aa228fdSmrgm4_ifval([$2],
4749aa228fdSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4759aa228fdSmrg AC_SUBST([PACKAGE], [$1])dnl
4769aa228fdSmrg AC_SUBST([VERSION], [$2])],
4779aa228fdSmrg[_AM_SET_OPTIONS([$1])dnl
4789aa228fdSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4799aa228fdSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
4809aa228fdSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4819aa228fdSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4829aa228fdSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4839aa228fdSmrg
4849aa228fdSmrg_AM_IF_OPTION([no-define],,
4859aa228fdSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
4869aa228fdSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
4879aa228fdSmrg
4889aa228fdSmrg# Some tools Automake needs.
4899aa228fdSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4909aa228fdSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4919aa228fdSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
4929aa228fdSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
4939aa228fdSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
4949aa228fdSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
4959aa228fdSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
4968f65982aSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4978f65982aSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4989aa228fdSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
4999aa228fdSmrg# We need awk for the "check" target.  The system "awk" is bad on
5009aa228fdSmrg# some platforms.
5019aa228fdSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5029aa228fdSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5039aa228fdSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5049aa228fdSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5058f65982aSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5068f65982aSmrg			     [_AM_PROG_TAR([v7])])])
5079aa228fdSmrg_AM_IF_OPTION([no-dependencies],,
5089aa228fdSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5098f65982aSmrg		  [_AM_DEPENDENCIES(CC)],
5108f65982aSmrg		  [define([AC_PROG_CC],
5118f65982aSmrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
5129aa228fdSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5138f65982aSmrg		  [_AM_DEPENDENCIES(CXX)],
5148f65982aSmrg		  [define([AC_PROG_CXX],
5158f65982aSmrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
5169aa228fdSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5178f65982aSmrg		  [_AM_DEPENDENCIES(OBJC)],
5188f65982aSmrg		  [define([AC_PROG_OBJC],
5198f65982aSmrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
5209aa228fdSmrg])
5218f65982aSmrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
5228f65982aSmrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
5238f65982aSmrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
5248f65982aSmrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
5258f65982aSmrgAC_CONFIG_COMMANDS_PRE(dnl
5268f65982aSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5278f65982aSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5289aa228fdSmrg])
5299aa228fdSmrg
5308f65982aSmrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5318f65982aSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5328f65982aSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5338f65982aSmrgm4_define([_AC_COMPILER_EXEEXT],
5348f65982aSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5358f65982aSmrg
5369aa228fdSmrg
5379aa228fdSmrg# When config.status generates a header, we must update the stamp-h file.
5389aa228fdSmrg# This file resides in the same directory as the config header
5399aa228fdSmrg# that is generated.  The stamp files are numbered to have different names.
5409aa228fdSmrg
5419aa228fdSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5429aa228fdSmrg# loop where config.status creates the headers, so we can generate
5439aa228fdSmrg# our stamp files there.
5449aa228fdSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5459aa228fdSmrg[# Compute $1's index in $config_headers.
5468f65982aSmrg_am_arg=$1
5479aa228fdSmrg_am_stamp_count=1
5489aa228fdSmrgfor _am_header in $config_headers :; do
5499aa228fdSmrg  case $_am_header in
5508f65982aSmrg    $_am_arg | $_am_arg:* )
5519aa228fdSmrg      break ;;
5529aa228fdSmrg    * )
5539aa228fdSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5549aa228fdSmrg  esac
5559aa228fdSmrgdone
5568f65982aSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5579aa228fdSmrg
55880b026c6Smrg# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
55980b026c6Smrg# Inc.
5609aa228fdSmrg#
5619aa228fdSmrg# This file is free software; the Free Software Foundation
5629aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
5639aa228fdSmrg# with or without modifications, as long as this notice is preserved.
5649aa228fdSmrg
56580b026c6Smrg# serial 1
56680b026c6Smrg
5679aa228fdSmrg# AM_PROG_INSTALL_SH
5689aa228fdSmrg# ------------------
5699aa228fdSmrg# Define $install_sh.
5709aa228fdSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
5719aa228fdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5728f65982aSmrgif test x"${install_sh}" != xset; then
5738f65982aSmrg  case $am_aux_dir in
5748f65982aSmrg  *\ * | *\	*)
5758f65982aSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5768f65982aSmrg  *)
5778f65982aSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5788f65982aSmrg  esac
5798f65982aSmrgfi
5809aa228fdSmrgAC_SUBST(install_sh)])
5819aa228fdSmrg
5829aa228fdSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
5839aa228fdSmrg#
5849aa228fdSmrg# This file is free software; the Free Software Foundation
5859aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
5869aa228fdSmrg# with or without modifications, as long as this notice is preserved.
5879aa228fdSmrg
5889aa228fdSmrg# serial 2
5899aa228fdSmrg
5909aa228fdSmrg# Check whether the underlying file-system supports filenames
5919aa228fdSmrg# with a leading dot.  For instance MS-DOS doesn't.
5929aa228fdSmrgAC_DEFUN([AM_SET_LEADING_DOT],
5939aa228fdSmrg[rm -rf .tst 2>/dev/null
5949aa228fdSmrgmkdir .tst 2>/dev/null
5959aa228fdSmrgif test -d .tst; then
5969aa228fdSmrg  am__leading_dot=.
5979aa228fdSmrgelse
5989aa228fdSmrg  am__leading_dot=_
5999aa228fdSmrgfi
6009aa228fdSmrgrmdir .tst 2>/dev/null
6019aa228fdSmrgAC_SUBST([am__leading_dot])])
6029aa228fdSmrg
6039aa228fdSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
6049aa228fdSmrg# From Jim Meyering
6059aa228fdSmrg
60680b026c6Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
60780b026c6Smrg# 2011 Free Software Foundation, Inc.
6089aa228fdSmrg#
6099aa228fdSmrg# This file is free software; the Free Software Foundation
6109aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
6119aa228fdSmrg# with or without modifications, as long as this notice is preserved.
6129aa228fdSmrg
6138f65982aSmrg# serial 5
6149aa228fdSmrg
6158f65982aSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6168f65982aSmrg# ----------------------------------
6178f65982aSmrg# Control maintainer-specific portions of Makefiles.
6188f65982aSmrg# Default is to disable them, unless `enable' is passed literally.
6198f65982aSmrg# For symmetry, `disable' may be passed as well.  Anyway, the user
6208f65982aSmrg# can override the default with the --enable/--disable switch.
6219aa228fdSmrgAC_DEFUN([AM_MAINTAINER_MODE],
6228f65982aSmrg[m4_case(m4_default([$1], [disable]),
6238f65982aSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
6248f65982aSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
6258f65982aSmrg       [m4_define([am_maintainer_other], [enable])
6268f65982aSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
62780b026c6SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
6288f65982aSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6298f65982aSmrg  AC_ARG_ENABLE([maintainer-mode],
6308f65982aSmrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
6319aa228fdSmrg			  (and sometimes confusing) to the casual installer],
6328f65982aSmrg      [USE_MAINTAINER_MODE=$enableval],
6338f65982aSmrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6349aa228fdSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6358f65982aSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6369aa228fdSmrg  MAINT=$MAINTAINER_MODE_TRUE
6378f65982aSmrg  AC_SUBST([MAINT])dnl
6389aa228fdSmrg]
6399aa228fdSmrg)
6409aa228fdSmrg
6419aa228fdSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
6429aa228fdSmrg
6439aa228fdSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6449aa228fdSmrg
6458f65982aSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
6469aa228fdSmrg#
6479aa228fdSmrg# This file is free software; the Free Software Foundation
6489aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
6499aa228fdSmrg# with or without modifications, as long as this notice is preserved.
6509aa228fdSmrg
6518f65982aSmrg# serial 4
6529aa228fdSmrg
6539aa228fdSmrg# AM_MAKE_INCLUDE()
6549aa228fdSmrg# -----------------
6559aa228fdSmrg# Check to see how make treats includes.
6569aa228fdSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6579aa228fdSmrg[am_make=${MAKE-make}
6589aa228fdSmrgcat > confinc << 'END'
6599aa228fdSmrgam__doit:
6608f65982aSmrg	@echo this is the am__doit target
6619aa228fdSmrg.PHONY: am__doit
6629aa228fdSmrgEND
6639aa228fdSmrg# If we don't find an include directive, just comment out the code.
6649aa228fdSmrgAC_MSG_CHECKING([for style of include used by $am_make])
6659aa228fdSmrgam__include="#"
6669aa228fdSmrgam__quote=
6679aa228fdSmrg_am_result=none
6689aa228fdSmrg# First try GNU make style include.
6699aa228fdSmrgecho "include confinc" > confmf
6708f65982aSmrg# Ignore all kinds of additional output from `make'.
6718f65982aSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
6728f65982aSmrg*the\ am__doit\ target*)
6738f65982aSmrg  am__include=include
6748f65982aSmrg  am__quote=
6758f65982aSmrg  _am_result=GNU
6768f65982aSmrg  ;;
6778f65982aSmrgesac
6789aa228fdSmrg# Now try BSD make style include.
6799aa228fdSmrgif test "$am__include" = "#"; then
6809aa228fdSmrg   echo '.include "confinc"' > confmf
6818f65982aSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
6828f65982aSmrg   *the\ am__doit\ target*)
6838f65982aSmrg     am__include=.include
6848f65982aSmrg     am__quote="\""
6858f65982aSmrg     _am_result=BSD
6868f65982aSmrg     ;;
6878f65982aSmrg   esac
6889aa228fdSmrgfi
6899aa228fdSmrgAC_SUBST([am__include])
6909aa228fdSmrgAC_SUBST([am__quote])
6919aa228fdSmrgAC_MSG_RESULT([$_am_result])
6929aa228fdSmrgrm -f confinc confmf
6939aa228fdSmrg])
6949aa228fdSmrg
6959aa228fdSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6969aa228fdSmrg
6978f65982aSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
6989aa228fdSmrg# Free Software Foundation, Inc.
6999aa228fdSmrg#
7009aa228fdSmrg# This file is free software; the Free Software Foundation
7019aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
7029aa228fdSmrg# with or without modifications, as long as this notice is preserved.
7039aa228fdSmrg
7048f65982aSmrg# serial 6
7059aa228fdSmrg
7069aa228fdSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7079aa228fdSmrg# ------------------------------
7089aa228fdSmrgAC_DEFUN([AM_MISSING_PROG],
7099aa228fdSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7109aa228fdSmrg$1=${$1-"${am_missing_run}$2"}
7119aa228fdSmrgAC_SUBST($1)])
7129aa228fdSmrg
7139aa228fdSmrg
7149aa228fdSmrg# AM_MISSING_HAS_RUN
7159aa228fdSmrg# ------------------
7169aa228fdSmrg# Define MISSING if not defined so far and test if it supports --run.
7179aa228fdSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
7189aa228fdSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7199aa228fdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7209aa228fdSmrgAC_REQUIRE_AUX_FILE([missing])dnl
7218f65982aSmrgif test x"${MISSING+set}" != xset; then
7228f65982aSmrg  case $am_aux_dir in
7238f65982aSmrg  *\ * | *\	*)
7248f65982aSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7258f65982aSmrg  *)
7268f65982aSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7278f65982aSmrg  esac
7288f65982aSmrgfi
7299aa228fdSmrg# Use eval to expand $SHELL
7309aa228fdSmrgif eval "$MISSING --run true"; then
7319aa228fdSmrg  am_missing_run="$MISSING --run "
7329aa228fdSmrgelse
7339aa228fdSmrg  am_missing_run=
7349aa228fdSmrg  AC_MSG_WARN([`missing' script is too old or missing])
7359aa228fdSmrgfi
7369aa228fdSmrg])
7379aa228fdSmrg
73880b026c6Smrg# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
73980b026c6Smrg# Inc.
7409aa228fdSmrg#
7419aa228fdSmrg# This file is free software; the Free Software Foundation
7429aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
7439aa228fdSmrg# with or without modifications, as long as this notice is preserved.
7449aa228fdSmrg
74580b026c6Smrg# serial 1
74680b026c6Smrg
7479aa228fdSmrg# AM_PROG_MKDIR_P
7489aa228fdSmrg# ---------------
7499aa228fdSmrg# Check for `mkdir -p'.
7509aa228fdSmrgAC_DEFUN([AM_PROG_MKDIR_P],
7519aa228fdSmrg[AC_PREREQ([2.60])dnl
7529aa228fdSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
7539aa228fdSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
7549aa228fdSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
7559aa228fdSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
7569aa228fdSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
7579aa228fdSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
7589aa228fdSmrgdnl adjustment using top_builddir (which is defined more often than
7599aa228fdSmrgdnl MKDIR_P).
7609aa228fdSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
7619aa228fdSmrgcase $mkdir_p in
7629aa228fdSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
7639aa228fdSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
7649aa228fdSmrgesac
7659aa228fdSmrg])
7669aa228fdSmrg
7679aa228fdSmrg# Helper functions for option handling.                     -*- Autoconf -*-
7689aa228fdSmrg
76980b026c6Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
77080b026c6Smrg# Foundation, Inc.
7719aa228fdSmrg#
7729aa228fdSmrg# This file is free software; the Free Software Foundation
7739aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
7749aa228fdSmrg# with or without modifications, as long as this notice is preserved.
7759aa228fdSmrg
77680b026c6Smrg# serial 5
7779aa228fdSmrg
7789aa228fdSmrg# _AM_MANGLE_OPTION(NAME)
7799aa228fdSmrg# -----------------------
7809aa228fdSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7819aa228fdSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7829aa228fdSmrg
7839aa228fdSmrg# _AM_SET_OPTION(NAME)
78480b026c6Smrg# --------------------
7859aa228fdSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7869aa228fdSmrgAC_DEFUN([_AM_SET_OPTION],
7879aa228fdSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
7889aa228fdSmrg
7899aa228fdSmrg# _AM_SET_OPTIONS(OPTIONS)
79080b026c6Smrg# ------------------------
7919aa228fdSmrg# OPTIONS is a space-separated list of Automake options.
7929aa228fdSmrgAC_DEFUN([_AM_SET_OPTIONS],
7938f65982aSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7949aa228fdSmrg
7959aa228fdSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7969aa228fdSmrg# -------------------------------------------
7979aa228fdSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7989aa228fdSmrgAC_DEFUN([_AM_IF_OPTION],
7999aa228fdSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
8009aa228fdSmrg
8019aa228fdSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8029aa228fdSmrg
8038f65982aSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
8049aa228fdSmrg# Free Software Foundation, Inc.
8059aa228fdSmrg#
8069aa228fdSmrg# This file is free software; the Free Software Foundation
8079aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
8089aa228fdSmrg# with or without modifications, as long as this notice is preserved.
8099aa228fdSmrg
8108f65982aSmrg# serial 5
8119aa228fdSmrg
8129aa228fdSmrg# AM_SANITY_CHECK
8139aa228fdSmrg# ---------------
8149aa228fdSmrgAC_DEFUN([AM_SANITY_CHECK],
8159aa228fdSmrg[AC_MSG_CHECKING([whether build environment is sane])
8169aa228fdSmrg# Just in case
8179aa228fdSmrgsleep 1
8189aa228fdSmrgecho timestamp > conftest.file
8198f65982aSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8208f65982aSmrg# name.  Accept space and tab only in the latter.
8218f65982aSmrgam_lf='
8228f65982aSmrg'
8238f65982aSmrgcase `pwd` in
8248f65982aSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8258f65982aSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8268f65982aSmrgesac
8278f65982aSmrgcase $srcdir in
8288f65982aSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8298f65982aSmrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
8308f65982aSmrgesac
8318f65982aSmrg
8329aa228fdSmrg# Do `set' in a subshell so we don't clobber the current shell's
8339aa228fdSmrg# arguments.  Must try -L first in case configure is actually a
8349aa228fdSmrg# symlink; some systems play weird games with the mod time of symlinks
8359aa228fdSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8369aa228fdSmrg# directory).
8379aa228fdSmrgif (
8388f65982aSmrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8399aa228fdSmrg   if test "$[*]" = "X"; then
8409aa228fdSmrg      # -L didn't work.
8418f65982aSmrg      set X `ls -t "$srcdir/configure" conftest.file`
8429aa228fdSmrg   fi
8439aa228fdSmrg   rm -f conftest.file
8449aa228fdSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
8459aa228fdSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
8469aa228fdSmrg
8479aa228fdSmrg      # If neither matched, then we have a broken ls.  This can happen
8489aa228fdSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
8499aa228fdSmrg      # broken ls alias from the environment.  This has actually
8509aa228fdSmrg      # happened.  Such a system could not be considered "sane".
8519aa228fdSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8529aa228fdSmrgalias in your environment])
8539aa228fdSmrg   fi
8549aa228fdSmrg
8559aa228fdSmrg   test "$[2]" = conftest.file
8569aa228fdSmrg   )
8579aa228fdSmrgthen
8589aa228fdSmrg   # Ok.
8599aa228fdSmrg   :
8609aa228fdSmrgelse
8619aa228fdSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
8629aa228fdSmrgCheck your system clock])
8639aa228fdSmrgfi
8649aa228fdSmrgAC_MSG_RESULT(yes)])
8659aa228fdSmrg
8668f65982aSmrg# Copyright (C) 2009  Free Software Foundation, Inc.
8678f65982aSmrg#
8688f65982aSmrg# This file is free software; the Free Software Foundation
8698f65982aSmrg# gives unlimited permission to copy and/or distribute it,
8708f65982aSmrg# with or without modifications, as long as this notice is preserved.
8718f65982aSmrg
8728f65982aSmrg# serial 1
8738f65982aSmrg
8748f65982aSmrg# AM_SILENT_RULES([DEFAULT])
8758f65982aSmrg# --------------------------
8768f65982aSmrg# Enable less verbose build rules; with the default set to DEFAULT
8778f65982aSmrg# (`yes' being less verbose, `no' or empty being verbose).
8788f65982aSmrgAC_DEFUN([AM_SILENT_RULES],
8798f65982aSmrg[AC_ARG_ENABLE([silent-rules],
8808f65982aSmrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
8818f65982aSmrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
8828f65982aSmrgcase $enable_silent_rules in
8838f65982aSmrgyes) AM_DEFAULT_VERBOSITY=0;;
8848f65982aSmrgno)  AM_DEFAULT_VERBOSITY=1;;
8858f65982aSmrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
8868f65982aSmrgesac
8878f65982aSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
8888f65982aSmrgAM_BACKSLASH='\'
8898f65982aSmrgAC_SUBST([AM_BACKSLASH])dnl
8908f65982aSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
8918f65982aSmrg])
8928f65982aSmrg
89380b026c6Smrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
8949aa228fdSmrg#
8959aa228fdSmrg# This file is free software; the Free Software Foundation
8969aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
8979aa228fdSmrg# with or without modifications, as long as this notice is preserved.
8989aa228fdSmrg
89980b026c6Smrg# serial 1
90080b026c6Smrg
9019aa228fdSmrg# AM_PROG_INSTALL_STRIP
9029aa228fdSmrg# ---------------------
9039aa228fdSmrg# One issue with vendor `install' (even GNU) is that you can't
9049aa228fdSmrg# specify the program used to strip binaries.  This is especially
9059aa228fdSmrg# annoying in cross-compiling environments, where the build's strip
9069aa228fdSmrg# is unlikely to handle the host's binaries.
9079aa228fdSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9089aa228fdSmrg# always use install-sh in `make install-strip', and initialize
9099aa228fdSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
9109aa228fdSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9119aa228fdSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9129aa228fdSmrg# Installed binaries are usually stripped using `strip' when the user
9139aa228fdSmrg# run `make install-strip'.  However `strip' might not be the right
9149aa228fdSmrg# tool to use in cross-compilation environments, therefore Automake
9159aa228fdSmrg# will honor the `STRIP' environment variable to overrule this program.
9169aa228fdSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
9179aa228fdSmrgif test "$cross_compiling" != no; then
9189aa228fdSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
9199aa228fdSmrgfi
9209aa228fdSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9219aa228fdSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
9229aa228fdSmrg
92380b026c6Smrg# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
9249aa228fdSmrg#
9259aa228fdSmrg# This file is free software; the Free Software Foundation
9269aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
9279aa228fdSmrg# with or without modifications, as long as this notice is preserved.
9289aa228fdSmrg
92980b026c6Smrg# serial 3
9308f65982aSmrg
9319aa228fdSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
9329aa228fdSmrg# ---------------------------
9338f65982aSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
9349aa228fdSmrg# This macro is traced by Automake.
9359aa228fdSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
9369aa228fdSmrg
9378f65982aSmrg# AM_SUBST_NOTMAKE(VARIABLE)
93880b026c6Smrg# --------------------------
9398f65982aSmrg# Public sister of _AM_SUBST_NOTMAKE.
9408f65982aSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
9418f65982aSmrg
9429aa228fdSmrg# Check how to create a tarball.                            -*- Autoconf -*-
9439aa228fdSmrg
9449aa228fdSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
9459aa228fdSmrg#
9469aa228fdSmrg# This file is free software; the Free Software Foundation
9479aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
9489aa228fdSmrg# with or without modifications, as long as this notice is preserved.
9499aa228fdSmrg
9509aa228fdSmrg# serial 2
9519aa228fdSmrg
9529aa228fdSmrg# _AM_PROG_TAR(FORMAT)
9539aa228fdSmrg# --------------------
9549aa228fdSmrg# Check how to create a tarball in format FORMAT.
9559aa228fdSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
9569aa228fdSmrg#
9579aa228fdSmrg# Substitute a variable $(am__tar) that is a command
9589aa228fdSmrg# writing to stdout a FORMAT-tarball containing the directory
9599aa228fdSmrg# $tardir.
9609aa228fdSmrg#     tardir=directory && $(am__tar) > result.tar
9619aa228fdSmrg#
9629aa228fdSmrg# Substitute a variable $(am__untar) that extract such
9639aa228fdSmrg# a tarball read from stdin.
9649aa228fdSmrg#     $(am__untar) < result.tar
9659aa228fdSmrgAC_DEFUN([_AM_PROG_TAR],
9669aa228fdSmrg[# Always define AMTAR for backward compatibility.
9679aa228fdSmrgAM_MISSING_PROG([AMTAR], [tar])
9689aa228fdSmrgm4_if([$1], [v7],
9699aa228fdSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
9709aa228fdSmrg     [m4_case([$1], [ustar],, [pax],,
9719aa228fdSmrg              [m4_fatal([Unknown tar format])])
9729aa228fdSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
9739aa228fdSmrg# Loop over all known methods to create a tar archive until one works.
9749aa228fdSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
9759aa228fdSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
9769aa228fdSmrg# Do not fold the above two line into one, because Tru64 sh and
9779aa228fdSmrg# Solaris sh will not grok spaces in the rhs of `-'.
9789aa228fdSmrgfor _am_tool in $_am_tools
9799aa228fdSmrgdo
9809aa228fdSmrg  case $_am_tool in
9819aa228fdSmrg  gnutar)
9829aa228fdSmrg    for _am_tar in tar gnutar gtar;
9839aa228fdSmrg    do
9849aa228fdSmrg      AM_RUN_LOG([$_am_tar --version]) && break
9859aa228fdSmrg    done
9869aa228fdSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
9879aa228fdSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
9889aa228fdSmrg    am__untar="$_am_tar -xf -"
9899aa228fdSmrg    ;;
9909aa228fdSmrg  plaintar)
9919aa228fdSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
9929aa228fdSmrg    # ustar tarball either.
9939aa228fdSmrg    (tar --version) >/dev/null 2>&1 && continue
9949aa228fdSmrg    am__tar='tar chf - "$$tardir"'
9959aa228fdSmrg    am__tar_='tar chf - "$tardir"'
9969aa228fdSmrg    am__untar='tar xf -'
9979aa228fdSmrg    ;;
9989aa228fdSmrg  pax)
9999aa228fdSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
10009aa228fdSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
10019aa228fdSmrg    am__untar='pax -r'
10029aa228fdSmrg    ;;
10039aa228fdSmrg  cpio)
10049aa228fdSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
10059aa228fdSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
10069aa228fdSmrg    am__untar='cpio -i -H $1 -d'
10079aa228fdSmrg    ;;
10089aa228fdSmrg  none)
10099aa228fdSmrg    am__tar=false
10109aa228fdSmrg    am__tar_=false
10119aa228fdSmrg    am__untar=false
10129aa228fdSmrg    ;;
10139aa228fdSmrg  esac
10149aa228fdSmrg
10159aa228fdSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
10169aa228fdSmrg  # and am__untar set.
10179aa228fdSmrg  test -n "${am_cv_prog_tar_$1}" && break
10189aa228fdSmrg
10199aa228fdSmrg  # tar/untar a dummy directory, and stop if the command works
10209aa228fdSmrg  rm -rf conftest.dir
10219aa228fdSmrg  mkdir conftest.dir
10229aa228fdSmrg  echo GrepMe > conftest.dir/file
10239aa228fdSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
10249aa228fdSmrg  rm -rf conftest.dir
10259aa228fdSmrg  if test -s conftest.tar; then
10269aa228fdSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
10279aa228fdSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
10289aa228fdSmrg  fi
10299aa228fdSmrgdone
10309aa228fdSmrgrm -rf conftest.dir
10319aa228fdSmrg
10329aa228fdSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
10339aa228fdSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
10349aa228fdSmrgAC_SUBST([am__tar])
10359aa228fdSmrgAC_SUBST([am__untar])
10369aa228fdSmrg]) # _AM_PROG_TAR
10379aa228fdSmrg
103880b026c6Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
103980b026c6Smrg# 
104080b026c6Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
104180b026c6Smrg#
104280b026c6Smrg# This program is free software; you can redistribute it and/or modify
104380b026c6Smrg# it under the terms of the GNU General Public License as published by
104480b026c6Smrg# the Free Software Foundation; either version 2 of the License, or
104580b026c6Smrg# (at your option) any later version.
104680b026c6Smrg#
104780b026c6Smrg# This program is distributed in the hope that it will be useful, but
104880b026c6Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
104980b026c6Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
105080b026c6Smrg# General Public License for more details.
105180b026c6Smrg#
105280b026c6Smrg# You should have received a copy of the GNU General Public License
105380b026c6Smrg# along with this program; if not, write to the Free Software
105480b026c6Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
105580b026c6Smrg#
105680b026c6Smrg# As a special exception to the GNU General Public License, if you
105780b026c6Smrg# distribute this file as part of a program that contains a
105880b026c6Smrg# configuration script generated by Autoconf, you may include it under
105980b026c6Smrg# the same distribution terms that you use for the rest of that program.
106080b026c6Smrg
106180b026c6Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
106280b026c6Smrg# ----------------------------------
106380b026c6SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
106480b026c6Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
106580b026c6Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
106680b026c6SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
106780b026c6Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
106880b026c6Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
106980b026c6Smrgfi
107080b026c6Smrgif test -n "$PKG_CONFIG"; then
107180b026c6Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
107280b026c6Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
107380b026c6Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
107480b026c6Smrg		AC_MSG_RESULT([yes])
107580b026c6Smrg	else
107680b026c6Smrg		AC_MSG_RESULT([no])
107780b026c6Smrg		PKG_CONFIG=""
107880b026c6Smrg	fi
107980b026c6Smrg		
108080b026c6Smrgfi[]dnl
108180b026c6Smrg])# PKG_PROG_PKG_CONFIG
108280b026c6Smrg
108380b026c6Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
108480b026c6Smrg#
108580b026c6Smrg# Check to see whether a particular set of modules exists.  Similar
108680b026c6Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
108780b026c6Smrg#
108880b026c6Smrg#
108980b026c6Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
109080b026c6Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
109180b026c6Smrg# PKG_CHECK_EXISTS manually
109280b026c6Smrg# --------------------------------------------------------------
109380b026c6SmrgAC_DEFUN([PKG_CHECK_EXISTS],
109480b026c6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
109580b026c6Smrgif test -n "$PKG_CONFIG" && \
109680b026c6Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
109780b026c6Smrg  m4_ifval([$2], [$2], [:])
109880b026c6Smrgm4_ifvaln([$3], [else
109980b026c6Smrg  $3])dnl
110080b026c6Smrgfi])
110180b026c6Smrg
110280b026c6Smrg
110380b026c6Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
110480b026c6Smrg# ---------------------------------------------
110580b026c6Smrgm4_define([_PKG_CONFIG],
110680b026c6Smrg[if test -n "$$1"; then
110780b026c6Smrg    pkg_cv_[]$1="$$1"
110880b026c6Smrg elif test -n "$PKG_CONFIG"; then
110980b026c6Smrg    PKG_CHECK_EXISTS([$3],
111080b026c6Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
111180b026c6Smrg		     [pkg_failed=yes])
111280b026c6Smrg else
111380b026c6Smrg    pkg_failed=untried
111480b026c6Smrgfi[]dnl
111580b026c6Smrg])# _PKG_CONFIG
111680b026c6Smrg
111780b026c6Smrg# _PKG_SHORT_ERRORS_SUPPORTED
111880b026c6Smrg# -----------------------------
111980b026c6SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
112080b026c6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
112180b026c6Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
112280b026c6Smrg        _pkg_short_errors_supported=yes
112380b026c6Smrgelse
112480b026c6Smrg        _pkg_short_errors_supported=no
112580b026c6Smrgfi[]dnl
112680b026c6Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
112780b026c6Smrg
112880b026c6Smrg
112980b026c6Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
113080b026c6Smrg# [ACTION-IF-NOT-FOUND])
113180b026c6Smrg#
113280b026c6Smrg#
113380b026c6Smrg# Note that if there is a possibility the first call to
113480b026c6Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
113580b026c6Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
113680b026c6Smrg#
113780b026c6Smrg#
113880b026c6Smrg# --------------------------------------------------------------
113980b026c6SmrgAC_DEFUN([PKG_CHECK_MODULES],
114080b026c6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
114180b026c6SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
114280b026c6SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
114380b026c6Smrg
114480b026c6Smrgpkg_failed=no
114580b026c6SmrgAC_MSG_CHECKING([for $1])
114680b026c6Smrg
114780b026c6Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
114880b026c6Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
114980b026c6Smrg
115080b026c6Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
115180b026c6Smrgand $1[]_LIBS to avoid the need to call pkg-config.
115280b026c6SmrgSee the pkg-config man page for more details.])
115380b026c6Smrg
115480b026c6Smrgif test $pkg_failed = yes; then
115580b026c6Smrg        _PKG_SHORT_ERRORS_SUPPORTED
115680b026c6Smrg        if test $_pkg_short_errors_supported = yes; then
115780b026c6Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
115880b026c6Smrg        else 
115980b026c6Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
116080b026c6Smrg        fi
116180b026c6Smrg	# Put the nasty error message in config.log where it belongs
116280b026c6Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
116380b026c6Smrg
116480b026c6Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
116580b026c6Smrg[Package requirements ($2) were not met:
116680b026c6Smrg
116780b026c6Smrg$$1_PKG_ERRORS
116880b026c6Smrg
116980b026c6SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
117080b026c6Smrginstalled software in a non-standard prefix.
117180b026c6Smrg
117280b026c6Smrg_PKG_TEXT
117380b026c6Smrg])],
117480b026c6Smrg		[AC_MSG_RESULT([no])
117580b026c6Smrg                $4])
117680b026c6Smrgelif test $pkg_failed = untried; then
117780b026c6Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
117880b026c6Smrg[The pkg-config script could not be found or is too old.  Make sure it
117980b026c6Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
118080b026c6Smrgpath to pkg-config.
118180b026c6Smrg
118280b026c6Smrg_PKG_TEXT
118380b026c6Smrg
118480b026c6SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
118580b026c6Smrg		[$4])
118680b026c6Smrgelse
118780b026c6Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
118880b026c6Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
118980b026c6Smrg        AC_MSG_RESULT([yes])
119080b026c6Smrg	ifelse([$3], , :, [$3])
119180b026c6Smrgfi[]dnl
119280b026c6Smrg])# PKG_CHECK_MODULES
119380b026c6Smrg
119483d7c197Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
11959aa228fdSmrgdnl
11968f65982aSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
11979aa228fdSmrgdnl 
11989aa228fdSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
11998f65982aSmrgdnl copy of this software and associated documentation files (the "Software"),
12008f65982aSmrgdnl to deal in the Software without restriction, including without limitation
12018f65982aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
12028f65982aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
12038f65982aSmrgdnl Software is furnished to do so, subject to the following conditions:
12049aa228fdSmrgdnl
12058f65982aSmrgdnl The above copyright notice and this permission notice (including the next
12068f65982aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
12078f65982aSmrgdnl Software.
12089aa228fdSmrgdnl
12098f65982aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12108f65982aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12118f65982aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
12128f65982aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12138f65982aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
12148f65982aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
12158f65982aSmrgdnl DEALINGS IN THE SOFTWARE.
12169aa228fdSmrg
12179aa228fdSmrg# XORG_MACROS_VERSION(required-version)
12189aa228fdSmrg# -------------------------------------
12199aa228fdSmrg# Minimum version: 1.1.0
12209aa228fdSmrg#
12219aa228fdSmrg# If you're using a macro added in Version 1.1 or newer, include this in
12229aa228fdSmrg# your configure.ac with the minimum required version, such as:
12239aa228fdSmrg# XORG_MACROS_VERSION(1.1)
12249aa228fdSmrg#
122583d7c197Smrg# To ensure that this macro is defined, also add:
122683d7c197Smrg# m4_ifndef([XORG_MACROS_VERSION],
122783d7c197Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
12289aa228fdSmrg#
12299aa228fdSmrg#
12309aa228fdSmrg# See the "minimum version" comment for each macro you use to see what 
12319aa228fdSmrg# version you require.
123283d7c197Smrgm4_defun([XORG_MACROS_VERSION],[
123380b026c6Smrgm4_define([vers_have], [1.17])
123483d7c197Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
123583d7c197Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
123683d7c197Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
123783d7c197Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
123883d7c197Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
123983d7c197Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
124083d7c197Smrgm4_undefine([vers_have])
124183d7c197Smrgm4_undefine([maj_have])
124283d7c197Smrgm4_undefine([maj_needed])
12439aa228fdSmrg]) # XORG_MACROS_VERSION
12449aa228fdSmrg
12459aa228fdSmrg# XORG_PROG_RAWCPP()
12469aa228fdSmrg# ------------------
12479aa228fdSmrg# Minimum version: 1.0.0
12489aa228fdSmrg#
12499aa228fdSmrg# Find cpp program and necessary flags for use in pre-processing text files
12509aa228fdSmrg# such as man pages and config files
12519aa228fdSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
12529aa228fdSmrgAC_REQUIRE([AC_PROG_CPP])
12539aa228fdSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
12549aa228fdSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
12559aa228fdSmrg
12569aa228fdSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
12579aa228fdSmrg# which is not the best choice for supporting other OS'es, but covers most
12589aa228fdSmrg# of the ones we need for now.
12599aa228fdSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
126080b026c6SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
12619aa228fdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12629aa228fdSmrg	AC_MSG_RESULT([no])
12639aa228fdSmrgelse
12649aa228fdSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12659aa228fdSmrg		RAWCPPFLAGS=-undef
12669aa228fdSmrg		AC_MSG_RESULT([yes])
126783d7c197Smrg	# under Cygwin unix is still defined even with -undef
126883d7c197Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
126983d7c197Smrg		RAWCPPFLAGS="-undef -ansi"
127083d7c197Smrg		AC_MSG_RESULT([yes, with -ansi])
12719aa228fdSmrg	else
12729aa228fdSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
12739aa228fdSmrg	fi
12749aa228fdSmrgfi
12759aa228fdSmrgrm -f conftest.$ac_ext
12769aa228fdSmrg
12779aa228fdSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
127880b026c6SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
12799aa228fdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12809aa228fdSmrg	AC_MSG_RESULT([no])
12819aa228fdSmrgelse
12829aa228fdSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12839aa228fdSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
12849aa228fdSmrg		AC_MSG_RESULT([yes])
12859aa228fdSmrg	else
12869aa228fdSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
12879aa228fdSmrg	fi
12889aa228fdSmrgfi
12899aa228fdSmrgrm -f conftest.$ac_ext
12909aa228fdSmrgAC_SUBST(RAWCPPFLAGS)
12919aa228fdSmrg]) # XORG_PROG_RAWCPP
12929aa228fdSmrg
12939aa228fdSmrg# XORG_MANPAGE_SECTIONS()
12949aa228fdSmrg# -----------------------
12959aa228fdSmrg# Minimum version: 1.0.0
12969aa228fdSmrg#
12979aa228fdSmrg# Determine which sections man pages go in for the different man page types
12989aa228fdSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
12999aa228fdSmrg# Not sure if there's any better way than just hardcoding by OS name.
13009aa228fdSmrg# Override default settings by setting environment variables
13018f65982aSmrg# Added MAN_SUBSTS in version 1.8
13028f65982aSmrg# Added AC_PROG_SED in version 1.8
13039aa228fdSmrg
13049aa228fdSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
13059aa228fdSmrgAC_REQUIRE([AC_CANONICAL_HOST])
13068f65982aSmrgAC_REQUIRE([AC_PROG_SED])
13079aa228fdSmrg
13089aa228fdSmrgif test x$APP_MAN_SUFFIX = x    ; then
13099aa228fdSmrg    APP_MAN_SUFFIX=1
13109aa228fdSmrgfi
13119aa228fdSmrgif test x$APP_MAN_DIR = x    ; then
13129aa228fdSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
13139aa228fdSmrgfi
13149aa228fdSmrg
13159aa228fdSmrgif test x$LIB_MAN_SUFFIX = x    ; then
13169aa228fdSmrg    LIB_MAN_SUFFIX=3
13179aa228fdSmrgfi
13189aa228fdSmrgif test x$LIB_MAN_DIR = x    ; then
13199aa228fdSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
13209aa228fdSmrgfi
13219aa228fdSmrg
13229aa228fdSmrgif test x$FILE_MAN_SUFFIX = x    ; then
13239aa228fdSmrg    case $host_os in
13249aa228fdSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
13259aa228fdSmrg	*)		FILE_MAN_SUFFIX=5  ;;
13269aa228fdSmrg    esac
13279aa228fdSmrgfi
13289aa228fdSmrgif test x$FILE_MAN_DIR = x    ; then
13299aa228fdSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
13309aa228fdSmrgfi
13319aa228fdSmrg
13329aa228fdSmrgif test x$MISC_MAN_SUFFIX = x    ; then
13339aa228fdSmrg    case $host_os in
13349aa228fdSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
13359aa228fdSmrg	*)		MISC_MAN_SUFFIX=7  ;;
13369aa228fdSmrg    esac
13379aa228fdSmrgfi
13389aa228fdSmrgif test x$MISC_MAN_DIR = x    ; then
13399aa228fdSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
13409aa228fdSmrgfi
13419aa228fdSmrg
13429aa228fdSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
13439aa228fdSmrg    case $host_os in
13449aa228fdSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
13459aa228fdSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
13469aa228fdSmrg    esac
13479aa228fdSmrgfi
13489aa228fdSmrgif test x$DRIVER_MAN_DIR = x    ; then
13499aa228fdSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
13509aa228fdSmrgfi
13519aa228fdSmrg
13529aa228fdSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
13539aa228fdSmrg    case $host_os in
13549aa228fdSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
13559aa228fdSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
13569aa228fdSmrg    esac
13579aa228fdSmrgfi
13589aa228fdSmrgif test x$ADMIN_MAN_DIR = x    ; then
13599aa228fdSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
13609aa228fdSmrgfi
13619aa228fdSmrg
13629aa228fdSmrg
13639aa228fdSmrgAC_SUBST([APP_MAN_SUFFIX])
13649aa228fdSmrgAC_SUBST([LIB_MAN_SUFFIX])
13659aa228fdSmrgAC_SUBST([FILE_MAN_SUFFIX])
13669aa228fdSmrgAC_SUBST([MISC_MAN_SUFFIX])
13679aa228fdSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
13689aa228fdSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
13699aa228fdSmrgAC_SUBST([APP_MAN_DIR])
13709aa228fdSmrgAC_SUBST([LIB_MAN_DIR])
13719aa228fdSmrgAC_SUBST([FILE_MAN_DIR])
13729aa228fdSmrgAC_SUBST([MISC_MAN_DIR])
13739aa228fdSmrgAC_SUBST([DRIVER_MAN_DIR])
13749aa228fdSmrgAC_SUBST([ADMIN_MAN_DIR])
13758f65982aSmrg
13768f65982aSmrgXORG_MAN_PAGE="X Version 11"
13778f65982aSmrgAC_SUBST([XORG_MAN_PAGE])
13788f65982aSmrgMAN_SUBSTS="\
13798f65982aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
13808f65982aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
13818f65982aSmrg	-e 's|__xservername__|Xorg|g' \
13828f65982aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
13838f65982aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
13848f65982aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
13858f65982aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
13868f65982aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
13878f65982aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
13888f65982aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
13898f65982aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
13908f65982aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
13918f65982aSmrgAC_SUBST([MAN_SUBSTS])
13928f65982aSmrg
13939aa228fdSmrg]) # XORG_MANPAGE_SECTIONS
13949aa228fdSmrg
13958f65982aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
13968f65982aSmrg# ------------------------
13978f65982aSmrg# Minimum version: 1.7.0
13988f65982aSmrg#
13998f65982aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
14008f65982aSmrg# provided by xorg-sgml-doctools, if installed.
14018f65982aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
14028f65982aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
14038f65982aSmrgXORG_SGML_PATH=
14048f65982aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
14058f65982aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
14068f65982aSmrg    [m4_ifval([$1],[:],
14078f65982aSmrg        [if test x"$cross_compiling" != x"yes" ; then
14088f65982aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
14098f65982aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
14108f65982aSmrg         fi])
14118f65982aSmrg    ])
14128f65982aSmrg
14138f65982aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
14148f65982aSmrg# the path and the name of the doc stylesheet
14158f65982aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
14168f65982aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
14178f65982aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
14188f65982aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
14198f65982aSmrgelse
14208f65982aSmrg   AC_MSG_RESULT([no])
14218f65982aSmrgfi
14228f65982aSmrg
14238f65982aSmrgAC_SUBST(XORG_SGML_PATH)
14248f65982aSmrgAC_SUBST(STYLESHEET_SRCDIR)
14258f65982aSmrgAC_SUBST(XSL_STYLESHEET)
14268f65982aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
14278f65982aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
14288f65982aSmrg
14299aa228fdSmrg# XORG_CHECK_LINUXDOC
14309aa228fdSmrg# -------------------
14319aa228fdSmrg# Minimum version: 1.0.0
14329aa228fdSmrg#
14339aa228fdSmrg# Defines the variable MAKE_TEXT if the necessary tools and
14349aa228fdSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
14359aa228fdSmrg# Whether or not the necessary tools and files are found can be checked
14369aa228fdSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
14379aa228fdSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
14388f65982aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
14398f65982aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
14409aa228fdSmrg
14419aa228fdSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
14429aa228fdSmrg
14438f65982aSmrgAC_MSG_CHECKING([whether to build documentation])
14449aa228fdSmrg
14458f65982aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
14469aa228fdSmrg   BUILDDOC=yes
14479aa228fdSmrgelse
14489aa228fdSmrg   BUILDDOC=no
14499aa228fdSmrgfi
14509aa228fdSmrg
14519aa228fdSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
14529aa228fdSmrg
14539aa228fdSmrgAC_MSG_RESULT([$BUILDDOC])
14549aa228fdSmrg
14558f65982aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
14569aa228fdSmrg
14578f65982aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
14589aa228fdSmrg   BUILDPDFDOC=yes
14599aa228fdSmrgelse
14609aa228fdSmrg   BUILDPDFDOC=no
14619aa228fdSmrgfi
14629aa228fdSmrg
14639aa228fdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
14649aa228fdSmrg
14659aa228fdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
14669aa228fdSmrg
14678f65982aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
14689aa228fdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
14699aa228fdSmrgMAKE_PDF="$PS2PDF"
14709aa228fdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
14719aa228fdSmrg
14729aa228fdSmrgAC_SUBST(MAKE_TEXT)
14739aa228fdSmrgAC_SUBST(MAKE_PS)
14749aa228fdSmrgAC_SUBST(MAKE_PDF)
14759aa228fdSmrgAC_SUBST(MAKE_HTML)
14769aa228fdSmrg]) # XORG_CHECK_LINUXDOC
14779aa228fdSmrg
14789aa228fdSmrg# XORG_CHECK_DOCBOOK
14799aa228fdSmrg# -------------------
14809aa228fdSmrg# Minimum version: 1.0.0
14819aa228fdSmrg#
14829aa228fdSmrg# Checks for the ability to build output formats from SGML DocBook source.
14839aa228fdSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
14849aa228fdSmrg# indicates whether the necessary tools and files are found and, if set,
14859aa228fdSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
14869aa228fdSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
14878f65982aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
14888f65982aSmrg
14899aa228fdSmrgBUILDTXTDOC=no
14909aa228fdSmrgBUILDPDFDOC=no
14919aa228fdSmrgBUILDPSDOC=no
14929aa228fdSmrgBUILDHTMLDOC=no
14939aa228fdSmrg
14949aa228fdSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
14959aa228fdSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
14969aa228fdSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
14979aa228fdSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
14989aa228fdSmrg
14998f65982aSmrgAC_MSG_CHECKING([whether to build text documentation])
15008f65982aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
15019aa228fdSmrg   test x$BUILD_TXTDOC != xno; then
15029aa228fdSmrg	BUILDTXTDOC=yes
15039aa228fdSmrgfi
15049aa228fdSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
15059aa228fdSmrgAC_MSG_RESULT([$BUILDTXTDOC])
15069aa228fdSmrg
15078f65982aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
15088f65982aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
15099aa228fdSmrg   test x$BUILD_PDFDOC != xno; then
15109aa228fdSmrg	BUILDPDFDOC=yes
15119aa228fdSmrgfi
15129aa228fdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
15139aa228fdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
15149aa228fdSmrg
15158f65982aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
15168f65982aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
15179aa228fdSmrg   test x$BUILD_PSDOC != xno; then
15189aa228fdSmrg	BUILDPSDOC=yes
15199aa228fdSmrgfi
15209aa228fdSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
15219aa228fdSmrgAC_MSG_RESULT([$BUILDPSDOC])
15229aa228fdSmrg
15238f65982aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
15248f65982aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
15259aa228fdSmrg   test x$BUILD_HTMLDOC != xno; then
15269aa228fdSmrg	BUILDHTMLDOC=yes
15279aa228fdSmrgfi
15289aa228fdSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
15299aa228fdSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
15309aa228fdSmrg
15319aa228fdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
15329aa228fdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
15339aa228fdSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
15349aa228fdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
15359aa228fdSmrg
15369aa228fdSmrgAC_SUBST(MAKE_TEXT)
15379aa228fdSmrgAC_SUBST(MAKE_PS)
15389aa228fdSmrgAC_SUBST(MAKE_PDF)
15399aa228fdSmrgAC_SUBST(MAKE_HTML)
15409aa228fdSmrg]) # XORG_CHECK_DOCBOOK
15419aa228fdSmrg
15428f65982aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
15438f65982aSmrg# ----------------
15448f65982aSmrg# Minimum version: 1.5.0
15458f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
15468f65982aSmrg#
15478f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
15488f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
15498f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
15508f65982aSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
15518f65982aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
15528f65982aSmrg# --with-xmlto assumes 'auto'.
15538f65982aSmrg#
15548f65982aSmrg# Interface to module:
15558f65982aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
15568f65982aSmrg# XMLTO:	returns the path of the xmlto program found
15578f65982aSmrg#		returns the path set by the user in the environment
15588f65982aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
15598f65982aSmrg#		'no' user instructs the module not to use xmlto
15608f65982aSmrg#
15618f65982aSmrg# Added in version 1.10.0
15628f65982aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
15638f65982aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
15648f65982aSmrg#
15658f65982aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
15668f65982aSmrg#
15678f65982aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
15688f65982aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
15698f65982aSmrgm4_define([_defopt], m4_default([$2], [auto]))
15708f65982aSmrgAC_ARG_WITH(xmlto,
15718f65982aSmrg	AS_HELP_STRING([--with-xmlto],
15728f65982aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
15738f65982aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
15748f65982aSmrgm4_undefine([_defopt])
15758f65982aSmrg
15768f65982aSmrgif test "x$use_xmlto" = x"auto"; then
15778f65982aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
15788f65982aSmrg   if test "x$XMLTO" = "x"; then
15798f65982aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
15808f65982aSmrg	have_xmlto=no
15818f65982aSmrg   else
15828f65982aSmrg        have_xmlto=yes
15838f65982aSmrg   fi
15848f65982aSmrgelif test "x$use_xmlto" = x"yes" ; then
15858f65982aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
15868f65982aSmrg   if test "x$XMLTO" = "x"; then
15878f65982aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
15888f65982aSmrg   fi
15898f65982aSmrg   have_xmlto=yes
15908f65982aSmrgelif test "x$use_xmlto" = x"no" ; then
15918f65982aSmrg   if test "x$XMLTO" != "x"; then
15928f65982aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
15938f65982aSmrg   fi
15948f65982aSmrg   have_xmlto=no
15958f65982aSmrgelse
15968f65982aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
15978f65982aSmrgfi
15988f65982aSmrg
15998f65982aSmrg# Test for a minimum version of xmlto, if provided.
16008f65982aSmrgm4_ifval([$1],
16018f65982aSmrg[if test "$have_xmlto" = yes; then
16028f65982aSmrg    # scrape the xmlto version
16038f65982aSmrg    AC_MSG_CHECKING([the xmlto version])
16048f65982aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
16058f65982aSmrg    AC_MSG_RESULT([$xmlto_version])
16068f65982aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
16078f65982aSmrg        [if test "x$use_xmlto" = xauto; then
16088f65982aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
16098f65982aSmrg            have_xmlto=no
16108f65982aSmrg        else
16118f65982aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
16128f65982aSmrg        fi])
16138f65982aSmrgfi])
16148f65982aSmrg
16158f65982aSmrg# Test for the ability of xmlto to generate a text target
16168f65982aSmrghave_xmlto_text=no
16178f65982aSmrgcat > conftest.xml << "EOF"
16188f65982aSmrgEOF
16198f65982aSmrgAS_IF([test "$have_xmlto" = yes],
16208f65982aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
16218f65982aSmrg             [have_xmlto_text=yes],
16228f65982aSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
16238f65982aSmrgrm -f conftest.xml
16248f65982aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
16258f65982aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
16268f65982aSmrg]) # XORG_WITH_XMLTO
16278f65982aSmrg
162880b026c6Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
162980b026c6Smrg# --------------------------------------------
163080b026c6Smrg# Minimum version: 1.12.0
163180b026c6Smrg# Minimum version for optional DEFAULT argument: 1.12.0
163280b026c6Smrg#
163380b026c6Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
163480b026c6Smrg# XML-based language used for the transformation of XML documents.
163580b026c6Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
163680b026c6Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
163780b026c6Smrg# The XSLT processor is often used as a standalone tool for transformations.
163880b026c6Smrg# It should not be assumed that this tool is used only to work with documnetation.
163980b026c6Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
164080b026c6Smrg#
164180b026c6Smrg# Interface to module:
164280b026c6Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
164380b026c6Smrg# XSLTPROC:	 returns the path of the xsltproc program found
164480b026c6Smrg#		 returns the path set by the user in the environment
164580b026c6Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
164680b026c6Smrg#		  'no' user instructs the module not to use xsltproc
164780b026c6Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
164880b026c6Smrg#
164980b026c6Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
165080b026c6Smrg#
165180b026c6SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
165280b026c6SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
165380b026c6Smrg# Preserves the interface, should it be implemented later
165480b026c6Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
165580b026c6Smrgm4_define([_defopt], m4_default([$2], [auto]))
165680b026c6SmrgAC_ARG_WITH(xsltproc,
165780b026c6Smrg	AS_HELP_STRING([--with-xsltproc],
165880b026c6Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
165980b026c6Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
166080b026c6Smrgm4_undefine([_defopt])
166180b026c6Smrg
166280b026c6Smrgif test "x$use_xsltproc" = x"auto"; then
166380b026c6Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
166480b026c6Smrg   if test "x$XSLTPROC" = "x"; then
166580b026c6Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
166680b026c6Smrg	have_xsltproc=no
166780b026c6Smrg   else
166880b026c6Smrg        have_xsltproc=yes
166980b026c6Smrg   fi
167080b026c6Smrgelif test "x$use_xsltproc" = x"yes" ; then
167180b026c6Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
167280b026c6Smrg   if test "x$XSLTPROC" = "x"; then
167380b026c6Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
167480b026c6Smrg   fi
167580b026c6Smrg   have_xsltproc=yes
167680b026c6Smrgelif test "x$use_xsltproc" = x"no" ; then
167780b026c6Smrg   if test "x$XSLTPROC" != "x"; then
167880b026c6Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
167980b026c6Smrg   fi
168080b026c6Smrg   have_xsltproc=no
168180b026c6Smrgelse
168280b026c6Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
168380b026c6Smrgfi
168480b026c6Smrg
168580b026c6SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
168680b026c6Smrg]) # XORG_WITH_XSLTPROC
168780b026c6Smrg
168880b026c6Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
168980b026c6Smrg# ----------------------------------------
169080b026c6Smrg# Minimum version: 1.15.0
169180b026c6Smrg#
169280b026c6Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
169380b026c6Smrg# scanning arbitrary text files, extracting information from those text files,
169480b026c6Smrg# and printing reports based on that information.
169580b026c6Smrg#
169680b026c6Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
169780b026c6Smrg#
169880b026c6Smrg# Interface to module:
169980b026c6Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
170080b026c6Smrg# PERL:	     returns the path of the perl program found
170180b026c6Smrg#	     returns the path set by the user in the environment
170280b026c6Smrg# --with-perl: 'yes' user instructs the module to use perl
170380b026c6Smrg#	       'no' user instructs the module not to use perl
170480b026c6Smrg# have_perl: returns yes if perl found in PATH or no
170580b026c6Smrg#
170680b026c6Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
170780b026c6Smrg#
170880b026c6SmrgAC_DEFUN([XORG_WITH_PERL],[
170980b026c6SmrgAC_ARG_VAR([PERL], [Path to perl command])
171080b026c6Smrg# Preserves the interface, should it be implemented later
171180b026c6Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
171280b026c6Smrgm4_define([_defopt], m4_default([$2], [auto]))
171380b026c6SmrgAC_ARG_WITH(perl,
171480b026c6Smrg	AS_HELP_STRING([--with-perl],
171580b026c6Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
171680b026c6Smrg	   [use_perl=$withval], [use_perl=]_defopt)
171780b026c6Smrgm4_undefine([_defopt])
171880b026c6Smrg
171980b026c6Smrgif test "x$use_perl" = x"auto"; then
172080b026c6Smrg   AC_PATH_PROG([PERL], [perl])
172180b026c6Smrg   if test "x$PERL" = "x"; then
172280b026c6Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
172380b026c6Smrg	have_perl=no
172480b026c6Smrg   else
172580b026c6Smrg        have_perl=yes
172680b026c6Smrg   fi
172780b026c6Smrgelif test "x$use_perl" = x"yes" ; then
172880b026c6Smrg   AC_PATH_PROG([PERL], [perl])
172980b026c6Smrg   if test "x$PERL" = "x"; then
173080b026c6Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
173180b026c6Smrg   fi
173280b026c6Smrg   have_perl=yes
173380b026c6Smrgelif test "x$use_perl" = x"no" ; then
173480b026c6Smrg   if test "x$PERL" != "x"; then
173580b026c6Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
173680b026c6Smrg   fi
173780b026c6Smrg   have_perl=no
173880b026c6Smrgelse
173980b026c6Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
174080b026c6Smrgfi
174180b026c6Smrg
174280b026c6SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
174380b026c6Smrg]) # XORG_WITH_PERL
174480b026c6Smrg
17458f65982aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
17468f65982aSmrg# ----------------
17478f65982aSmrg# Minimum version: 1.5.0
17488f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
17498f65982aSmrg#
17508f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
17518f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
17528f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
17538f65982aSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
17548f65982aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
17558f65982aSmrg# --with-asciidoc assumes 'auto'.
17568f65982aSmrg#
17578f65982aSmrg# Interface to module:
17588f65982aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
17598f65982aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
17608f65982aSmrg#		 returns the path set by the user in the environment
17618f65982aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
17628f65982aSmrg#		  'no' user instructs the module not to use asciidoc
17638f65982aSmrg#
17648f65982aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
17658f65982aSmrg#
17668f65982aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
17678f65982aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
17688f65982aSmrgm4_define([_defopt], m4_default([$2], [auto]))
17698f65982aSmrgAC_ARG_WITH(asciidoc,
17708f65982aSmrg	AS_HELP_STRING([--with-asciidoc],
17718f65982aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
17728f65982aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
17738f65982aSmrgm4_undefine([_defopt])
17748f65982aSmrg
17758f65982aSmrgif test "x$use_asciidoc" = x"auto"; then
17768f65982aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
17778f65982aSmrg   if test "x$ASCIIDOC" = "x"; then
17788f65982aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
17798f65982aSmrg	have_asciidoc=no
17808f65982aSmrg   else
17818f65982aSmrg        have_asciidoc=yes
17828f65982aSmrg   fi
17838f65982aSmrgelif test "x$use_asciidoc" = x"yes" ; then
17848f65982aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
17858f65982aSmrg   if test "x$ASCIIDOC" = "x"; then
17868f65982aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
17878f65982aSmrg   fi
17888f65982aSmrg   have_asciidoc=yes
17898f65982aSmrgelif test "x$use_asciidoc" = x"no" ; then
17908f65982aSmrg   if test "x$ASCIIDOC" != "x"; then
17918f65982aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
17928f65982aSmrg   fi
17938f65982aSmrg   have_asciidoc=no
17948f65982aSmrgelse
17958f65982aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
17968f65982aSmrgfi
17978f65982aSmrgm4_ifval([$1],
17988f65982aSmrg[if test "$have_asciidoc" = yes; then
17998f65982aSmrg    # scrape the asciidoc version
18008f65982aSmrg    AC_MSG_CHECKING([the asciidoc version])
18018f65982aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
18028f65982aSmrg    AC_MSG_RESULT([$asciidoc_version])
18038f65982aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
18048f65982aSmrg        [if test "x$use_asciidoc" = xauto; then
18058f65982aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
18068f65982aSmrg            have_asciidoc=no
18078f65982aSmrg        else
18088f65982aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
18098f65982aSmrg        fi])
18108f65982aSmrgfi])
18118f65982aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
18128f65982aSmrg]) # XORG_WITH_ASCIIDOC
18138f65982aSmrg
18148f65982aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
18158f65982aSmrg# --------------------------------
18168f65982aSmrg# Minimum version: 1.5.0
18178f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
18188f65982aSmrg#
18198f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
18208f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
18218f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
18228f65982aSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
18238f65982aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
18248f65982aSmrg# --with-doxygen assumes 'auto'.
18258f65982aSmrg#
18268f65982aSmrg# Interface to module:
18278f65982aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
18288f65982aSmrg# DOXYGEN:	 returns the path of the doxygen program found
18298f65982aSmrg#		 returns the path set by the user in the environment
18308f65982aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
18318f65982aSmrg#		  'no' user instructs the module not to use doxygen
18328f65982aSmrg#
18338f65982aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
18348f65982aSmrg#
18358f65982aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
18368f65982aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
18378f65982aSmrgm4_define([_defopt], m4_default([$2], [auto]))
18388f65982aSmrgAC_ARG_WITH(doxygen,
18398f65982aSmrg	AS_HELP_STRING([--with-doxygen],
18408f65982aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
18418f65982aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
18428f65982aSmrgm4_undefine([_defopt])
18438f65982aSmrg
18448f65982aSmrgif test "x$use_doxygen" = x"auto"; then
18458f65982aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
18468f65982aSmrg   if test "x$DOXYGEN" = "x"; then
18478f65982aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
18488f65982aSmrg	have_doxygen=no
18498f65982aSmrg   else
18508f65982aSmrg        have_doxygen=yes
18518f65982aSmrg   fi
18528f65982aSmrgelif test "x$use_doxygen" = x"yes" ; then
18538f65982aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
18548f65982aSmrg   if test "x$DOXYGEN" = "x"; then
18558f65982aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
18568f65982aSmrg   fi
18578f65982aSmrg   have_doxygen=yes
18588f65982aSmrgelif test "x$use_doxygen" = x"no" ; then
18598f65982aSmrg   if test "x$DOXYGEN" != "x"; then
18608f65982aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
18618f65982aSmrg   fi
18628f65982aSmrg   have_doxygen=no
18638f65982aSmrgelse
18648f65982aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
18658f65982aSmrgfi
18668f65982aSmrgm4_ifval([$1],
18678f65982aSmrg[if test "$have_doxygen" = yes; then
18688f65982aSmrg    # scrape the doxygen version
18698f65982aSmrg    AC_MSG_CHECKING([the doxygen version])
18708f65982aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
18718f65982aSmrg    AC_MSG_RESULT([$doxygen_version])
18728f65982aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
18738f65982aSmrg        [if test "x$use_doxygen" = xauto; then
18748f65982aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
18758f65982aSmrg            have_doxygen=no
18768f65982aSmrg        else
18778f65982aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
18788f65982aSmrg        fi])
18798f65982aSmrgfi])
18808f65982aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
18818f65982aSmrg]) # XORG_WITH_DOXYGEN
18828f65982aSmrg
18838f65982aSmrg# XORG_WITH_GROFF([DEFAULT])
18848f65982aSmrg# ----------------
18858f65982aSmrg# Minimum version: 1.6.0
18868f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
18878f65982aSmrg#
18888f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
18898f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
18908f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
18918f65982aSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
18928f65982aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
18938f65982aSmrg# --with-groff assumes 'auto'.
18948f65982aSmrg#
18958f65982aSmrg# Interface to module:
18968f65982aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
18978f65982aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
18988f65982aSmrg# HAVE_GROFF_MS: the -ms macros package
18998f65982aSmrg# GROFF:	 returns the path of the groff program found
19008f65982aSmrg#		 returns the path set by the user in the environment
19018f65982aSmrg# --with-groff:	 'yes' user instructs the module to use groff
19028f65982aSmrg#		 'no' user instructs the module not to use groff
19038f65982aSmrg#
19048f65982aSmrg# Added in version 1.9.0:
19058f65982aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
19068f65982aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
19078f65982aSmrg#		   psselect from the psutils package.
19088f65982aSmrg#		   the ghostcript package. Refer to the grohtml man pages
19098f65982aSmrg#
19108f65982aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
19118f65982aSmrg#
19128f65982aSmrg# OS and distros often splits groff in a basic and full package, the former
19138f65982aSmrg# having the groff program and the later having devices, fonts and macros
19148f65982aSmrg# Checking for the groff executable is not enough.
19158f65982aSmrg#
19168f65982aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
19178f65982aSmrg# unset HAVE_GROFF or GROFF env variables.
19188f65982aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
19198f65982aSmrg#
19208f65982aSmrgAC_DEFUN([XORG_WITH_GROFF],[
19218f65982aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
19228f65982aSmrgm4_define([_defopt], m4_default([$1], [auto]))
19238f65982aSmrgAC_ARG_WITH(groff,
19248f65982aSmrg	AS_HELP_STRING([--with-groff],
19258f65982aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
19268f65982aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
19278f65982aSmrgm4_undefine([_defopt])
19288f65982aSmrg
19298f65982aSmrgif test "x$use_groff" = x"auto"; then
19308f65982aSmrg   AC_PATH_PROG([GROFF], [groff])
19318f65982aSmrg   if test "x$GROFF" = "x"; then
19328f65982aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
19338f65982aSmrg	have_groff=no
19348f65982aSmrg   else
19358f65982aSmrg        have_groff=yes
19368f65982aSmrg   fi
19378f65982aSmrgelif test "x$use_groff" = x"yes" ; then
19388f65982aSmrg   AC_PATH_PROG([GROFF], [groff])
19398f65982aSmrg   if test "x$GROFF" = "x"; then
19408f65982aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
19418f65982aSmrg   fi
19428f65982aSmrg   have_groff=yes
19438f65982aSmrgelif test "x$use_groff" = x"no" ; then
19448f65982aSmrg   if test "x$GROFF" != "x"; then
19458f65982aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
19468f65982aSmrg   fi
19478f65982aSmrg   have_groff=no
19488f65982aSmrgelse
19498f65982aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
19508f65982aSmrgfi
19518f65982aSmrg
19528f65982aSmrg# We have groff, test for the presence of the macro packages
19538f65982aSmrgif test "x$have_groff" = x"yes"; then
19548f65982aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
19558f65982aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
19568f65982aSmrg        groff_ms_works=yes
19578f65982aSmrg    else
19588f65982aSmrg        groff_ms_works=no
19598f65982aSmrg    fi
19608f65982aSmrg    AC_MSG_RESULT([$groff_ms_works])
19618f65982aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
19628f65982aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
19638f65982aSmrg        groff_mm_works=yes
19648f65982aSmrg    else
19658f65982aSmrg        groff_mm_works=no
19668f65982aSmrg    fi
19678f65982aSmrg    AC_MSG_RESULT([$groff_mm_works])
19688f65982aSmrgfi
19698f65982aSmrg
19708f65982aSmrg# We have groff, test for HTML dependencies, one command per package
19718f65982aSmrgif test "x$have_groff" = x"yes"; then
19728f65982aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
19738f65982aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
19748f65982aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
19758f65982aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
19768f65982aSmrg      have_groff_html=yes
19778f65982aSmrg   else
19788f65982aSmrg      have_groff_html=no
19798f65982aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
19808f65982aSmrg   fi
19818f65982aSmrgfi
19828f65982aSmrg
19838f65982aSmrg# Set Automake conditionals for Makefiles
19848f65982aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
19858f65982aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
19868f65982aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
19878f65982aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
19888f65982aSmrg]) # XORG_WITH_GROFF
19898f65982aSmrg
199080b026c6Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
199180b026c6Smrg# ---------------------------------------
19928f65982aSmrg# Minimum version: 1.6.0
19938f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
199480b026c6Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
19958f65982aSmrg#
19968f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
19978f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
19988f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
19998f65982aSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
20008f65982aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
20018f65982aSmrg# --with-fop assumes 'auto'.
20028f65982aSmrg#
20038f65982aSmrg# Interface to module:
20048f65982aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
20058f65982aSmrg# FOP:	 	returns the path of the fop program found
20068f65982aSmrg#		returns the path set by the user in the environment
20078f65982aSmrg# --with-fop: 	'yes' user instructs the module to use fop
20088f65982aSmrg#		'no' user instructs the module not to use fop
20098f65982aSmrg#
20108f65982aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
20118f65982aSmrg#
20128f65982aSmrgAC_DEFUN([XORG_WITH_FOP],[
20138f65982aSmrgAC_ARG_VAR([FOP], [Path to fop command])
201480b026c6Smrgm4_define([_defopt], m4_default([$2], [auto]))
20158f65982aSmrgAC_ARG_WITH(fop,
20168f65982aSmrg	AS_HELP_STRING([--with-fop],
20178f65982aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
20188f65982aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
20198f65982aSmrgm4_undefine([_defopt])
20208f65982aSmrg
20218f65982aSmrgif test "x$use_fop" = x"auto"; then
20228f65982aSmrg   AC_PATH_PROG([FOP], [fop])
20238f65982aSmrg   if test "x$FOP" = "x"; then
20248f65982aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
20258f65982aSmrg	have_fop=no
20268f65982aSmrg   else
20278f65982aSmrg        have_fop=yes
20288f65982aSmrg   fi
20298f65982aSmrgelif test "x$use_fop" = x"yes" ; then
20308f65982aSmrg   AC_PATH_PROG([FOP], [fop])
20318f65982aSmrg   if test "x$FOP" = "x"; then
20328f65982aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
20338f65982aSmrg   fi
20348f65982aSmrg   have_fop=yes
20358f65982aSmrgelif test "x$use_fop" = x"no" ; then
20368f65982aSmrg   if test "x$FOP" != "x"; then
20378f65982aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
20388f65982aSmrg   fi
20398f65982aSmrg   have_fop=no
20408f65982aSmrgelse
20418f65982aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
20428f65982aSmrgfi
204380b026c6Smrg
204480b026c6Smrg# Test for a minimum version of fop, if provided.
204580b026c6Smrgm4_ifval([$1],
204680b026c6Smrg[if test "$have_fop" = yes; then
204780b026c6Smrg    # scrape the fop version
204880b026c6Smrg    AC_MSG_CHECKING([for fop minimum version])
204980b026c6Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
205080b026c6Smrg    AC_MSG_RESULT([$fop_version])
205180b026c6Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
205280b026c6Smrg        [if test "x$use_fop" = xauto; then
205380b026c6Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
205480b026c6Smrg            have_fop=no
205580b026c6Smrg        else
205680b026c6Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
205780b026c6Smrg        fi])
205880b026c6Smrgfi])
20598f65982aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
20608f65982aSmrg]) # XORG_WITH_FOP
20618f65982aSmrg
20628f65982aSmrg# XORG_WITH_PS2PDF([DEFAULT])
20638f65982aSmrg# ----------------
20648f65982aSmrg# Minimum version: 1.6.0
20658f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20668f65982aSmrg#
20678f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
20688f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
20698f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20708f65982aSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
20718f65982aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
20728f65982aSmrg# --with-ps2pdf assumes 'auto'.
20738f65982aSmrg#
20748f65982aSmrg# Interface to module:
20758f65982aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
20768f65982aSmrg# PS2PDF:	returns the path of the ps2pdf program found
20778f65982aSmrg#		returns the path set by the user in the environment
20788f65982aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
20798f65982aSmrg#		 'no' user instructs the module not to use ps2pdf
20808f65982aSmrg#
20818f65982aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
20828f65982aSmrg#
20838f65982aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
20848f65982aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
20858f65982aSmrgm4_define([_defopt], m4_default([$1], [auto]))
20868f65982aSmrgAC_ARG_WITH(ps2pdf,
20878f65982aSmrg	AS_HELP_STRING([--with-ps2pdf],
20888f65982aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
20898f65982aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
20908f65982aSmrgm4_undefine([_defopt])
20918f65982aSmrg
20928f65982aSmrgif test "x$use_ps2pdf" = x"auto"; then
20938f65982aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
20948f65982aSmrg   if test "x$PS2PDF" = "x"; then
20958f65982aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
20968f65982aSmrg	have_ps2pdf=no
20978f65982aSmrg   else
20988f65982aSmrg        have_ps2pdf=yes
20998f65982aSmrg   fi
21008f65982aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
21018f65982aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
21028f65982aSmrg   if test "x$PS2PDF" = "x"; then
21038f65982aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
21048f65982aSmrg   fi
21058f65982aSmrg   have_ps2pdf=yes
21068f65982aSmrgelif test "x$use_ps2pdf" = x"no" ; then
21078f65982aSmrg   if test "x$PS2PDF" != "x"; then
21088f65982aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
21098f65982aSmrg   fi
21108f65982aSmrg   have_ps2pdf=no
21118f65982aSmrgelse
21128f65982aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
21138f65982aSmrgfi
21148f65982aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
21158f65982aSmrg]) # XORG_WITH_PS2PDF
21168f65982aSmrg
21178f65982aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
21188f65982aSmrg# ----------------
21198f65982aSmrg# Minimum version: 1.6.0
21208f65982aSmrg#
21218f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
21228f65982aSmrg# not at the appropriate level. This macro enables a builder to skip all
21238f65982aSmrg# documentation targets except traditional man pages.
21248f65982aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21258f65982aSmrg# maximum flexibilty in controlling documentation building.
21268f65982aSmrg# Refer to:
21278f65982aSmrg# XORG_WITH_XMLTO         --with-xmlto
21288f65982aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21298f65982aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
21308f65982aSmrg# XORG_WITH_FOP           --with-fop
21318f65982aSmrg# XORG_WITH_GROFF         --with-groff
21328f65982aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
21338f65982aSmrg#
21348f65982aSmrg# Interface to module:
21358f65982aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
21368f65982aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
21378f65982aSmrg#		 'no' user instructs the module not to generate docs
21388f65982aSmrg# parm1:	specify the default value, yes or no.
21398f65982aSmrg#
21408f65982aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
214180b026c6Smrgm4_define([docs_default], m4_default([$1], [yes]))
21428f65982aSmrgAC_ARG_ENABLE(docs,
21438f65982aSmrg	AS_HELP_STRING([--enable-docs],
214480b026c6Smrg	   [Enable building the documentation (default: ]docs_default[)]),
214580b026c6Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
214680b026c6Smrgm4_undefine([docs_default])
21478f65982aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
21488f65982aSmrgAC_MSG_CHECKING([whether to build documentation])
21498f65982aSmrgAC_MSG_RESULT([$build_docs])
21508f65982aSmrg]) # XORG_ENABLE_DOCS
21518f65982aSmrg
21528f65982aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
21538f65982aSmrg# ----------------
21548f65982aSmrg# Minimum version: 1.6.0
21558f65982aSmrg#
21568f65982aSmrg# This macro enables a builder to skip all developer documentation.
21578f65982aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21588f65982aSmrg# maximum flexibilty in controlling documentation building.
21598f65982aSmrg# Refer to:
21608f65982aSmrg# XORG_WITH_XMLTO         --with-xmlto
21618f65982aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21628f65982aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
21638f65982aSmrg# XORG_WITH_FOP           --with-fop
21648f65982aSmrg# XORG_WITH_GROFF         --with-groff
21658f65982aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
21668f65982aSmrg#
21678f65982aSmrg# Interface to module:
21688f65982aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
21698f65982aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
21708f65982aSmrg#			'no' user instructs the module not to generate developer docs
21718f65982aSmrg# parm1:		specify the default value, yes or no.
21728f65982aSmrg#
21738f65982aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
21748f65982aSmrgm4_define([devel_default], m4_default([$1], [yes]))
21758f65982aSmrgAC_ARG_ENABLE(devel-docs,
21768f65982aSmrg	AS_HELP_STRING([--enable-devel-docs],
21778f65982aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
21788f65982aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
21798f65982aSmrgm4_undefine([devel_default])
21808f65982aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
21818f65982aSmrgAC_MSG_CHECKING([whether to build developer documentation])
21828f65982aSmrgAC_MSG_RESULT([$build_devel_docs])
21838f65982aSmrg]) # XORG_ENABLE_DEVEL_DOCS
21848f65982aSmrg
21858f65982aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
21868f65982aSmrg# ----------------
21878f65982aSmrg# Minimum version: 1.6.0
21888f65982aSmrg#
21898f65982aSmrg# This macro enables a builder to skip all functional specification targets.
21908f65982aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21918f65982aSmrg# maximum flexibilty in controlling documentation building.
21928f65982aSmrg# Refer to:
21938f65982aSmrg# XORG_WITH_XMLTO         --with-xmlto
21948f65982aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21958f65982aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
21968f65982aSmrg# XORG_WITH_FOP           --with-fop
21978f65982aSmrg# XORG_WITH_GROFF         --with-groff
21988f65982aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
21998f65982aSmrg#
22008f65982aSmrg# Interface to module:
22018f65982aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
22028f65982aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
22038f65982aSmrg#			'no' user instructs the module not to generate specs
22048f65982aSmrg# parm1:		specify the default value, yes or no.
22058f65982aSmrg#
22068f65982aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
22078f65982aSmrgm4_define([spec_default], m4_default([$1], [yes]))
22088f65982aSmrgAC_ARG_ENABLE(specs,
22098f65982aSmrg	AS_HELP_STRING([--enable-specs],
22108f65982aSmrg	   [Enable building the specs (default: ]spec_default[)]),
22118f65982aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
22128f65982aSmrgm4_undefine([spec_default])
22138f65982aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
22148f65982aSmrgAC_MSG_CHECKING([whether to build functional specifications])
22158f65982aSmrgAC_MSG_RESULT([$build_specs])
22168f65982aSmrg]) # XORG_ENABLE_SPECS
22178f65982aSmrg
221880b026c6Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
221980b026c6Smrg# ----------------------------------------------
222080b026c6Smrg# Minimum version: 1.13.0
222180b026c6Smrg#
222280b026c6Smrg# This macro enables a builder to enable/disable unit testing
222380b026c6Smrg# It makes no assumption about the test cases implementation
222480b026c6Smrg# Test cases may or may not use Automake "Support for test suites"
222580b026c6Smrg# They may or may not use the software utility library GLib
222680b026c6Smrg#
222780b026c6Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
222880b026c6Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
222980b026c6Smrg# The variable enable_unit_tests is used by other macros in this file.
223080b026c6Smrg#
223180b026c6Smrg# Interface to module:
223280b026c6Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
223380b026c6Smrg# enable_unit_tests:    used in configure.ac for additional configuration
223480b026c6Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
223580b026c6Smrg#			'no' user instructs the module not to build tests
223680b026c6Smrg# parm1:		specify the default value, yes or no.
223780b026c6Smrg#
223880b026c6SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
223980b026c6SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
224080b026c6SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
224180b026c6SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
224280b026c6Smrgm4_define([_defopt], m4_default([$1], [auto]))
224380b026c6SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
224480b026c6Smrg	[Enable building unit test cases (default: ]_defopt[)]),
224580b026c6Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
224680b026c6Smrgm4_undefine([_defopt])
224780b026c6SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
224880b026c6SmrgAC_MSG_CHECKING([whether to build unit test cases])
224980b026c6SmrgAC_MSG_RESULT([$enable_unit_tests])
225080b026c6Smrg]) # XORG_ENABLE_UNIT_TESTS
225180b026c6Smrg
225280b026c6Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
225380b026c6Smrg# ------------------------------------------------------
225480b026c6Smrg# Minimum version: 1.17.0
225580b026c6Smrg#
225680b026c6Smrg# This macro enables a builder to enable/disable integration testing
225780b026c6Smrg# It makes no assumption about the test cases' implementation
225880b026c6Smrg# Test cases may or may not use Automake "Support for test suites"
225980b026c6Smrg#
226080b026c6Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
226180b026c6Smrg# usually requires less dependencies and may be built and run under less
226280b026c6Smrg# stringent environments than integration tests.
226380b026c6Smrg#
226480b026c6Smrg# Interface to module:
226580b026c6Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
226680b026c6Smrg# enable_integration_tests:   used in configure.ac for additional configuration
226780b026c6Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
226880b026c6Smrg#                             'no' user instructs the module not to build tests
226980b026c6Smrg# parm1:                      specify the default value, yes or no.
227080b026c6Smrg#
227180b026c6SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
227280b026c6SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
227380b026c6Smrgm4_define([_defopt], m4_default([$1], [auto]))
227480b026c6SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
227580b026c6Smrg	[Enable building integration test cases (default: ]_defopt[)]),
227680b026c6Smrg	[enable_integration_tests=$enableval],
227780b026c6Smrg	[enable_integration_tests=]_defopt)
227880b026c6Smrgm4_undefine([_defopt])
227980b026c6SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
228080b026c6Smrg	[test "x$enable_integration_tests" != xno])
228180b026c6SmrgAC_MSG_CHECKING([whether to build unit test cases])
228280b026c6SmrgAC_MSG_RESULT([$enable_integration_tests])
228380b026c6Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
228480b026c6Smrg
228580b026c6Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
228680b026c6Smrg# ----------------------------------------
228780b026c6Smrg# Minimum version: 1.13.0
228880b026c6Smrg#
228980b026c6Smrg# GLib is a library which provides advanced data structures and functions.
229080b026c6Smrg# This macro enables a module to test for the presence of Glib.
229180b026c6Smrg#
229280b026c6Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
229380b026c6Smrg# Otherwise the value of $enable_unit_tests is blank.
229480b026c6Smrg#
229580b026c6Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
229680b026c6Smrg# test support usually requires less dependencies and may be built and run under
229780b026c6Smrg# less stringent environments than integration tests.
229880b026c6Smrg#
229980b026c6Smrg# Interface to module:
230080b026c6Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
230180b026c6Smrg# with_glib: used in configure.ac to know if GLib has been found
230280b026c6Smrg# --with-glib:	'yes' user instructs the module to use glib
230380b026c6Smrg#		'no' user instructs the module not to use glib
230480b026c6Smrg#
230580b026c6SmrgAC_DEFUN([XORG_WITH_GLIB],[
230680b026c6SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
230780b026c6Smrgm4_define([_defopt], m4_default([$2], [auto]))
230880b026c6SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
230980b026c6Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
231080b026c6Smrg	[with_glib=$withval], [with_glib=]_defopt)
231180b026c6Smrgm4_undefine([_defopt])
231280b026c6Smrg
231380b026c6Smrghave_glib=no
231480b026c6Smrg# Do not probe GLib if user explicitly disabled unit testing
231580b026c6Smrgif test "x$enable_unit_tests" != x"no"; then
231680b026c6Smrg  # Do not probe GLib if user explicitly disabled it
231780b026c6Smrg  if test "x$with_glib" != x"no"; then
231880b026c6Smrg    m4_ifval(
231980b026c6Smrg      [$1],
232080b026c6Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
232180b026c6Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
232280b026c6Smrg    )
232380b026c6Smrg  fi
232480b026c6Smrgfi
232580b026c6Smrg
232680b026c6Smrg# Not having GLib when unit testing has been explicitly requested is an error
232780b026c6Smrgif test "x$enable_unit_tests" = x"yes"; then
232880b026c6Smrg  if test "x$have_glib" = x"no"; then
232980b026c6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
233080b026c6Smrg  fi
233180b026c6Smrgfi
233280b026c6Smrg
233380b026c6Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
233480b026c6Smrgif test "x$enable_unit_tests" = x"no"; then
233580b026c6Smrg  if test "x$with_glib" = x"yes"; then
233680b026c6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
233780b026c6Smrg  fi
233880b026c6Smrgfi
233980b026c6Smrg
234080b026c6Smrg# Not having GLib when it has been explicitly requested is an error
234180b026c6Smrgif test "x$with_glib" = x"yes"; then
234280b026c6Smrg  if test "x$have_glib" = x"no"; then
234380b026c6Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
234480b026c6Smrg  fi
234580b026c6Smrgfi
234680b026c6Smrg
234780b026c6SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
234880b026c6Smrg]) # XORG_WITH_GLIB
234980b026c6Smrg
235080b026c6Smrg# XORG_LD_WRAP([required|optional])
235180b026c6Smrg# ---------------------------------
235280b026c6Smrg# Minimum version: 1.13.0
235380b026c6Smrg#
235480b026c6Smrg# Check if linker supports -wrap, passed via compiler flags
235580b026c6Smrg#
235680b026c6Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
235780b026c6Smrg# Otherwise the value of $enable_unit_tests is blank.
235880b026c6Smrg#
235980b026c6Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
236080b026c6Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
236180b026c6Smrg# available, an argument of "optional" allows use when some unit tests require
236280b026c6Smrg# ld -wrap and others do not.
236380b026c6Smrg#
236480b026c6SmrgAC_DEFUN([XORG_LD_WRAP],[
236580b026c6SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
236680b026c6Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
236780b026c6Smrg                      void __wrap_exit(int status) { return; }],
236880b026c6Smrg                     [exit(0);])])
236980b026c6Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
237080b026c6Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
237180b026c6Smrg  if test "x$have_ld_wrap" = x"no"; then
237280b026c6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
237380b026c6Smrg  fi
237480b026c6Smrgfi
237580b026c6SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
237680b026c6Smrg#
237780b026c6Smrg]) # XORG_LD_WRAP
237880b026c6Smrg
237980b026c6Smrg# XORG_CHECK_LINKER_FLAGS
238080b026c6Smrg# -----------------------
238180b026c6Smrg# SYNOPSIS
238280b026c6Smrg#
238380b026c6Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
238480b026c6Smrg#
238580b026c6Smrg# DESCRIPTION
238680b026c6Smrg#
238780b026c6Smrg#   Check whether the given linker FLAGS work with the current language's
238880b026c6Smrg#   linker, or whether they give an error.
238980b026c6Smrg#
239080b026c6Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
239180b026c6Smrg#   success/failure.
239280b026c6Smrg#
239380b026c6Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
239480b026c6Smrg#
239580b026c6Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
239680b026c6Smrg#
239780b026c6Smrg# LICENSE
239880b026c6Smrg#
239980b026c6Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
240080b026c6Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
240180b026c6Smrg#   Copyright (c) 2009 Matteo Frigo
240280b026c6Smrg#
240380b026c6Smrg#   This program is free software: you can redistribute it and/or modify it
240480b026c6Smrg#   under the terms of the GNU General Public License as published by the
240580b026c6Smrg#   Free Software Foundation, either version 3 of the License, or (at your
240680b026c6Smrg#   option) any later version.
240780b026c6Smrg#
240880b026c6Smrg#   This program is distributed in the hope that it will be useful, but
240980b026c6Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
241080b026c6Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
241180b026c6Smrg#   Public License for more details.
241280b026c6Smrg#
241380b026c6Smrg#   You should have received a copy of the GNU General Public License along
241480b026c6Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
241580b026c6Smrg#
241680b026c6Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
241780b026c6Smrg#   gives unlimited permission to copy, distribute and modify the configure
241880b026c6Smrg#   scripts that are the output of Autoconf when processing the Macro. You
241980b026c6Smrg#   need not follow the terms of the GNU General Public License when using
242080b026c6Smrg#   or distributing such scripts, even though portions of the text of the
242180b026c6Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
242280b026c6Smrg#   all other use of the material that constitutes the Autoconf Macro.
242380b026c6Smrg#
242480b026c6Smrg#   This special exception to the GPL applies to versions of the Autoconf
242580b026c6Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
242680b026c6Smrg#   modified version of the Autoconf Macro, you may extend this special
242780b026c6Smrg#   exception to the GPL to apply to your modified version as well.#
242880b026c6SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
242980b026c6Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
243080b026c6Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
243180b026c6SmrgAS_LITERAL_IF([$1],
243280b026c6Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
243380b026c6Smrg      ax_save_FLAGS=$LDFLAGS
243480b026c6Smrg      LDFLAGS="$1"
243580b026c6Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
243680b026c6Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
243780b026c6Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
243880b026c6Smrg      LDFLAGS=$ax_save_FLAGS])],
243980b026c6Smrg  [ax_save_FLAGS=$LDFLAGS
244080b026c6Smrg   LDFLAGS="$1"
244180b026c6Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
244280b026c6Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
244380b026c6Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
244480b026c6Smrg   LDFLAGS=$ax_save_FLAGS])
244580b026c6Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
244680b026c6SmrgAC_MSG_RESULT($xorg_check_linker_flags)
244780b026c6Smrgif test "x$xorg_check_linker_flags" = xyes; then
244880b026c6Smrg	m4_default([$2], :)
244980b026c6Smrgelse
245080b026c6Smrg	m4_default([$3], :)
245180b026c6Smrgfi
245280b026c6Smrg]) # XORG_CHECK_LINKER_FLAGS
245380b026c6Smrg
245480b026c6Smrg# XORG_MEMORY_CHECK_FLAGS
245580b026c6Smrg# -----------------------
245680b026c6Smrg# Minimum version: 1.16.0
245780b026c6Smrg#
245880b026c6Smrg# This macro attempts to find appropriate memory checking functionality
245980b026c6Smrg# for various platforms which unit testing code may use to catch various
246080b026c6Smrg# forms of memory allocation and access errors in testing.
246180b026c6Smrg#
246280b026c6Smrg# Interface to module:
246380b026c6Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
246480b026c6Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
246580b026c6Smrg#
246680b026c6Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
246780b026c6Smrg#
246880b026c6SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
246980b026c6Smrg
247080b026c6SmrgAC_REQUIRE([AC_CANONICAL_HOST])
247180b026c6SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
247280b026c6Smrg           [Environment variables to enable memory checking in tests])
247380b026c6Smrg
247480b026c6Smrg# Check for different types of support on different platforms
247580b026c6Smrgcase $host_os in
247680b026c6Smrg    solaris*)
247780b026c6Smrg        AC_CHECK_LIB([umem], [umem_alloc],
247880b026c6Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
247980b026c6Smrg        ;;
248080b026c6Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
248180b026c6Smrg        # both directly and inverted, so should not be 0 or 255.
248280b026c6Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
248380b026c6Smrg        ;;
248480b026c6Smrg    darwin*)
248580b026c6Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
248680b026c6Smrg        ;;
248780b026c6Smrg    *bsd*)
248880b026c6Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
248980b026c6Smrg        ;;
249080b026c6Smrgesac
249180b026c6Smrg
249280b026c6Smrg# User supplied flags override default flags
249380b026c6Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
249480b026c6Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
249580b026c6Smrgfi
249680b026c6Smrg
249780b026c6SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
249880b026c6Smrg]) # XORG_WITH_LINT
249980b026c6Smrg
25009aa228fdSmrg# XORG_CHECK_MALLOC_ZERO
25019aa228fdSmrg# ----------------------
25029aa228fdSmrg# Minimum version: 1.0.0
25039aa228fdSmrg#
25049aa228fdSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
25059aa228fdSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
25069aa228fdSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
25079aa228fdSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
25089aa228fdSmrgAC_ARG_ENABLE(malloc0returnsnull,
25098f65982aSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
25109aa228fdSmrg		       [malloc(0) returns NULL (default: auto)]),
25119aa228fdSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
25129aa228fdSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
25139aa228fdSmrg
25149aa228fdSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
25159aa228fdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
251680b026c6Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
251780b026c6Smrg#include <stdlib.h>
251880b026c6Smrg],[
25199aa228fdSmrg    char *m0, *r0, *c0, *p;
25209aa228fdSmrg    m0 = malloc(0);
25219aa228fdSmrg    p = malloc(10);
25229aa228fdSmrg    r0 = realloc(p,0);
252380b026c6Smrg    c0 = calloc(0,10);
252480b026c6Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
252580b026c6Smrg])],
25269aa228fdSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
25278f65982aSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
25288f65982aSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
25299aa228fdSmrgfi
25309aa228fdSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
25319aa228fdSmrg
25329aa228fdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
25339aa228fdSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
25349aa228fdSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
25359aa228fdSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
25369aa228fdSmrgelse
25379aa228fdSmrg	MALLOC_ZERO_CFLAGS=""
25389aa228fdSmrg	XMALLOC_ZERO_CFLAGS=""
25399aa228fdSmrg	XTMALLOC_ZERO_CFLAGS=""
25409aa228fdSmrgfi
25419aa228fdSmrg
25429aa228fdSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
25439aa228fdSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
25449aa228fdSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
25459aa228fdSmrg]) # XORG_CHECK_MALLOC_ZERO
25469aa228fdSmrg
25479aa228fdSmrg# XORG_WITH_LINT()
25489aa228fdSmrg# ----------------
25499aa228fdSmrg# Minimum version: 1.1.0
25509aa228fdSmrg#
25518f65982aSmrg# This macro enables the use of a tool that flags some suspicious and
25528f65982aSmrg# non-portable constructs (likely to be bugs) in C language source code.
25538f65982aSmrg# It will attempt to locate the tool and use appropriate options.
25548f65982aSmrg# There are various lint type tools on different platforms.
25558f65982aSmrg#
25568f65982aSmrg# Interface to module:
25578f65982aSmrg# LINT:		returns the path to the tool found on the platform
25588f65982aSmrg#		or the value set to LINT on the configure cmd line
25598f65982aSmrg#		also an Automake conditional
25608f65982aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
25618f65982aSmrg#
25628f65982aSmrg# --with-lint:	'yes' user instructs the module to use lint
25638f65982aSmrg#		'no' user instructs the module not to use lint (default)
25648f65982aSmrg#
25658f65982aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
25668f65982aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
25679aa228fdSmrg#
25689aa228fdSmrgAC_DEFUN([XORG_WITH_LINT],[
25699aa228fdSmrg
25708f65982aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
25718f65982aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
25728f65982aSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
25739aa228fdSmrg		[Use a lint-style source code checker (default: disabled)])],
25749aa228fdSmrg		[use_lint=$withval], [use_lint=no])
25758f65982aSmrg
25768f65982aSmrg# Obtain platform specific info like program name and options
25778f65982aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
25788f65982aSmrgcase $host_os in
25798f65982aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
25808f65982aSmrg	lint_name=splint
25818f65982aSmrg	lint_options="-badflag"
25828f65982aSmrg	;;
25838f65982aSmrg  *freebsd* | *netbsd*)
25848f65982aSmrg	lint_name=lint
25858f65982aSmrg	lint_options="-u -b"
25868f65982aSmrg	;;
25878f65982aSmrg  *solaris*)
25888f65982aSmrg	lint_name=lint
25898f65982aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
25908f65982aSmrg	;;
25918f65982aSmrgesac
25928f65982aSmrg
25938f65982aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
25948f65982aSmrgif test "x$use_lint" = x"yes" ; then
25958f65982aSmrg   AC_PATH_PROG([LINT], [$lint_name])
25968f65982aSmrg   if test "x$LINT" = "x"; then
25978f65982aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
25988f65982aSmrg   fi
25998f65982aSmrgelif test "x$use_lint" = x"no" ; then
26008f65982aSmrg   if test "x$LINT" != "x"; then
26018f65982aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
26028f65982aSmrg   fi
26039aa228fdSmrgelse
26048f65982aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
26059aa228fdSmrgfi
26068f65982aSmrg
26078f65982aSmrg# User supplied flags override default flags
26088f65982aSmrgif test "x$LINT_FLAGS" != "x"; then
26098f65982aSmrg   lint_options=$LINT_FLAGS
26109aa228fdSmrgfi
26119aa228fdSmrg
26128f65982aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
26138f65982aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
26149aa228fdSmrg
26159aa228fdSmrg]) # XORG_WITH_LINT
26169aa228fdSmrg
26179aa228fdSmrg# XORG_LINT_LIBRARY(LIBNAME)
26189aa228fdSmrg# --------------------------
26199aa228fdSmrg# Minimum version: 1.1.0
26209aa228fdSmrg#
26219aa228fdSmrg# Sets up flags for building lint libraries for checking programs that call
26229aa228fdSmrg# functions in the library.
26239aa228fdSmrg#
26248f65982aSmrg# Interface to module:
26258f65982aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
26268f65982aSmrg# MAKE_LINT_LIB		- Automake conditional
26278f65982aSmrg#
26288f65982aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
26298f65982aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
26309aa228fdSmrg
26319aa228fdSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
26329aa228fdSmrgAC_REQUIRE([XORG_WITH_LINT])
26338f65982aSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
26349aa228fdSmrg	[Create lint library (default: disabled)])],
26359aa228fdSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
26368f65982aSmrg
26378f65982aSmrgif test "x$make_lint_lib" = x"yes" ; then
26388f65982aSmrg   LINTLIB=llib-l$1.ln
26398f65982aSmrg   if test "x$LINT" = "x"; then
26408f65982aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
26418f65982aSmrg   fi
26428f65982aSmrgelif test "x$make_lint_lib" != x"no" ; then
26438f65982aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
26449aa228fdSmrgfi
26458f65982aSmrg
26469aa228fdSmrgAC_SUBST(LINTLIB)
26479aa228fdSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
26489aa228fdSmrg
26499aa228fdSmrg]) # XORG_LINT_LIBRARY
26509aa228fdSmrg
265180b026c6Smrg# XORG_COMPILER_BRAND
265280b026c6Smrg# -------------------
265380b026c6Smrg# Minimum version: 1.14.0
265480b026c6Smrg#
265580b026c6Smrg# Checks for various brands of compilers and sets flags as appropriate:
265680b026c6Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
265780b026c6Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
265880b026c6Smrg#   clang compiler - sets CLANGCC to "yes"
265980b026c6Smrg#   Intel compiler - sets INTELCC to "yes"
266080b026c6Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
266180b026c6Smrg#
266280b026c6SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
266380b026c6SmrgAC_LANG_CASE(
266480b026c6Smrg	[C], [
266580b026c6Smrg		AC_REQUIRE([AC_PROG_CC_C99])
266680b026c6Smrg	],
266780b026c6Smrg	[C++], [
266880b026c6Smrg		AC_REQUIRE([AC_PROG_CXX])
266980b026c6Smrg	]
267080b026c6Smrg)
267180b026c6SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
267280b026c6SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
267380b026c6SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
267480b026c6Smrg]) # XORG_COMPILER_BRAND
267580b026c6Smrg
267680b026c6Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
267780b026c6Smrg# ---------------
267880b026c6Smrg# Minimum version: 1.16.0
267980b026c6Smrg#
268080b026c6Smrg# Test if the compiler works when passed the given flag as a command line argument.
268180b026c6Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
268280b026c6Smrg# next flag in the list until there are no more options.
268380b026c6Smrg#
268480b026c6Smrg# Note that this does not guarantee that the compiler supports the flag as some
268580b026c6Smrg# compilers will simply ignore arguments that they do not understand, but we do
268680b026c6Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
268780b026c6Smrg# -Werror=unused-command-line-argument
268880b026c6Smrg#
268980b026c6SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
269080b026c6Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
269180b026c6Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
269280b026c6Smrg
269380b026c6SmrgAC_LANG_COMPILER_REQUIRE
269480b026c6Smrg
269580b026c6SmrgAC_LANG_CASE(
269680b026c6Smrg	[C], [
269780b026c6Smrg		AC_REQUIRE([AC_PROG_CC_C99])
269880b026c6Smrg		define([PREFIX], [C])
269980b026c6Smrg		define([CACHE_PREFIX], [cc])
270080b026c6Smrg		define([COMPILER], [$CC])
270180b026c6Smrg	],
270280b026c6Smrg	[C++], [
270380b026c6Smrg		define([PREFIX], [CXX])
270480b026c6Smrg		define([CACHE_PREFIX], [cxx])
270580b026c6Smrg		define([COMPILER], [$CXX])
270680b026c6Smrg	]
270780b026c6Smrg)
270880b026c6Smrg
270980b026c6Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
271080b026c6Smrg
271180b026c6Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
271280b026c6Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
271380b026c6Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
271480b026c6Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
271580b026c6Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
271680b026c6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
271780b026c6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
271880b026c6Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
271980b026c6Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
272080b026c6Smrgfi
272180b026c6Smrg
272280b026c6Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
272380b026c6Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
272480b026c6Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
272580b026c6Smrg	fi
272680b026c6Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
272780b026c6Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
272880b026c6Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
272980b026c6Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
273080b026c6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
273180b026c6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
273280b026c6Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
273380b026c6Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
273480b026c6Smrgfi
273580b026c6Smrg
273680b026c6Smrgfound="no"
273780b026c6Smrgm4_foreach([flag], m4_cdr($@), [
273880b026c6Smrg	if test $found = "no" ; then
273980b026c6Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
274080b026c6Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
274180b026c6Smrg		fi
274280b026c6Smrg
274380b026c6Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
274480b026c6Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
274580b026c6Smrg		fi
274680b026c6Smrg
274780b026c6Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
274880b026c6Smrg
274980b026c6Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
275080b026c6Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
275180b026c6Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
275280b026c6Smrg		AC_CACHE_VAL($cacheid,
275380b026c6Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
275480b026c6Smrg					     [eval $cacheid=yes],
275580b026c6Smrg					     [eval $cacheid=no])])
275680b026c6Smrg
275780b026c6Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
275880b026c6Smrg
275980b026c6Smrg		eval supported=\$$cacheid
276080b026c6Smrg		AC_MSG_RESULT([$supported])
276180b026c6Smrg		if test "$supported" = "yes" ; then
276280b026c6Smrg			$1="$$1 ]flag["
276380b026c6Smrg			found="yes"
276480b026c6Smrg		fi
276580b026c6Smrg	fi
276680b026c6Smrg])
276780b026c6Smrg]) # XORG_TESTSET_CFLAG
276880b026c6Smrg
276980b026c6Smrg# XORG_COMPILER_FLAGS
277080b026c6Smrg# ---------------
277180b026c6Smrg# Minimum version: 1.16.0
277280b026c6Smrg#
277380b026c6Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
277480b026c6Smrg# arguments supported by the selected compiler which do NOT alter the generated
277580b026c6Smrg# code.  These arguments will cause the compiler to print various warnings
277680b026c6Smrg# during compilation AND turn a conservative set of warnings into errors.
277780b026c6Smrg#
277880b026c6Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
277980b026c6Smrg# future versions of util-macros as options are added to new compilers.
278080b026c6Smrg#
278180b026c6SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
278280b026c6SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
278380b026c6Smrg
278480b026c6SmrgAC_ARG_ENABLE(selective-werror,
278580b026c6Smrg              AS_HELP_STRING([--disable-selective-werror],
278680b026c6Smrg                             [Turn off selective compiler errors. (default: enabled)]),
278780b026c6Smrg              [SELECTIVE_WERROR=$enableval],
278880b026c6Smrg              [SELECTIVE_WERROR=yes])
278980b026c6Smrg
279080b026c6SmrgAC_LANG_CASE(
279180b026c6Smrg        [C], [
279280b026c6Smrg                define([PREFIX], [C])
279380b026c6Smrg        ],
279480b026c6Smrg        [C++], [
279580b026c6Smrg                define([PREFIX], [CXX])
279680b026c6Smrg        ]
279780b026c6Smrg)
279880b026c6Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
279980b026c6Smrgif test "x$SUNCC" = "xyes"; then
280080b026c6Smrg    [BASE_]PREFIX[FLAGS]="-v"
280180b026c6Smrgelse
280280b026c6Smrg    [BASE_]PREFIX[FLAGS]=""
280380b026c6Smrgfi
280480b026c6Smrg
280580b026c6Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
280680b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
280780b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
280880b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
280980b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
281080b026c6Smrg
281180b026c6SmrgAC_LANG_CASE(
281280b026c6Smrg	[C], [
281380b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
281480b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
281580b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
281680b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
281780b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
281880b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
281980b026c6Smrg	]
282080b026c6Smrg)
282180b026c6Smrg
282280b026c6Smrg# This chunk adds additional warnings that could catch undesired effects.
282380b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
282480b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
282580b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
282680b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
282780b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
282880b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
282980b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
283080b026c6Smrg
283180b026c6Smrg# These are currently disabled because they are noisy.  They will be enabled
283280b026c6Smrg# in the future once the codebase is sufficiently modernized to silence
283380b026c6Smrg# them.  For now, I don't want them to drown out the other warnings.
283480b026c6Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
283580b026c6Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
283680b026c6Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
283780b026c6Smrg
283880b026c6Smrg# Turn some warnings into errors, so we don't accidently get successful builds
283980b026c6Smrg# when there are problems that should be fixed.
284080b026c6Smrg
284180b026c6Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
284280b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
284380b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
284480b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
284580b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
284680b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
284780b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
284880b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
284980b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
285080b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
285180b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
285280b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
285380b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
285480b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
285580b026c6Smrgelse
285680b026c6SmrgAC_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])
285780b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
285880b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
285980b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
286080b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
286180b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
286280b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
286380b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
286480b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
286580b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
286680b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
286780b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
286880b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
286980b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
287080b026c6Smrgfi
287180b026c6Smrg
287280b026c6SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
287380b026c6Smrg]) # XORG_COMPILER_FLAGS
287480b026c6Smrg
287583d7c197Smrg# XORG_CWARNFLAGS
287683d7c197Smrg# ---------------
287783d7c197Smrg# Minimum version: 1.2.0
287880b026c6Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
287983d7c197Smrg#
288083d7c197Smrg# Defines CWARNFLAGS to enable C compiler warnings.
288183d7c197Smrg#
288280b026c6Smrg# This function is deprecated because it defines -fno-strict-aliasing
288380b026c6Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
288480b026c6Smrg# is needed, then it should be added explicitly in the module when
288580b026c6Smrg# it is updated to use BASE_CFLAGS.
288680b026c6Smrg#
288783d7c197SmrgAC_DEFUN([XORG_CWARNFLAGS], [
288880b026c6SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
288980b026c6SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
289080b026c6SmrgAC_LANG_CASE(
289180b026c6Smrg	[C], [
289280b026c6Smrg		CWARNFLAGS="$BASE_CFLAGS"
289380b026c6Smrg		if  test "x$GCC" = xyes ; then
289480b026c6Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
289580b026c6Smrg		fi
289680b026c6Smrg		AC_SUBST(CWARNFLAGS)
289780b026c6Smrg	]
289880b026c6Smrg)
289983d7c197Smrg]) # XORG_CWARNFLAGS
29008f65982aSmrg
29018f65982aSmrg# XORG_STRICT_OPTION
29028f65982aSmrg# -----------------------
29038f65982aSmrg# Minimum version: 1.3.0
29048f65982aSmrg#
290580b026c6Smrg# Add configure option to enable strict compilation flags, such as treating
290680b026c6Smrg# warnings as fatal errors.
290780b026c6Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
290880b026c6Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
290980b026c6Smrg#
291080b026c6Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
291180b026c6Smrg# when strict compilation is unconditionally desired.
29128f65982aSmrgAC_DEFUN([XORG_STRICT_OPTION], [
29138f65982aSmrgAC_REQUIRE([XORG_CWARNFLAGS])
291480b026c6SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
29158f65982aSmrg
29168f65982aSmrgAC_ARG_ENABLE(strict-compilation,
29178f65982aSmrg			  AS_HELP_STRING([--enable-strict-compilation],
29188f65982aSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
29198f65982aSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
292080b026c6Smrg
292180b026c6SmrgAC_LANG_CASE(
292280b026c6Smrg        [C], [
292380b026c6Smrg                define([PREFIX], [C])
292480b026c6Smrg        ],
292580b026c6Smrg        [C++], [
292680b026c6Smrg                define([PREFIX], [CXX])
292780b026c6Smrg        ]
292880b026c6Smrg)
292980b026c6Smrg
293080b026c6Smrg[STRICT_]PREFIX[FLAGS]=""
293180b026c6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
293280b026c6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
293380b026c6Smrg
293480b026c6Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
293580b026c6Smrg# activate it with -Werror, so we add it here explicitly.
293680b026c6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
293780b026c6Smrg
29388f65982aSmrgif test "x$STRICT_COMPILE" = "xyes"; then
293980b026c6Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
294080b026c6Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
29418f65982aSmrgfi
294280b026c6SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
294380b026c6SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
294480b026c6SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
29458f65982aSmrg]) # XORG_STRICT_OPTION
29468f65982aSmrg
29478f65982aSmrg# XORG_DEFAULT_OPTIONS
29488f65982aSmrg# --------------------
29498f65982aSmrg# Minimum version: 1.3.0
29508f65982aSmrg#
29518f65982aSmrg# Defines default options for X.Org modules.
29528f65982aSmrg#
29538f65982aSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
29548f65982aSmrgAC_REQUIRE([AC_PROG_INSTALL])
295580b026c6SmrgXORG_COMPILER_FLAGS
29568f65982aSmrgXORG_CWARNFLAGS
29578f65982aSmrgXORG_STRICT_OPTION
29588f65982aSmrgXORG_RELEASE_VERSION
29598f65982aSmrgXORG_CHANGELOG
29608f65982aSmrgXORG_INSTALL
29618f65982aSmrgXORG_MANPAGE_SECTIONS
29628f65982aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
29638f65982aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
29648f65982aSmrg]) # XORG_DEFAULT_OPTIONS
29658f65982aSmrg
29668f65982aSmrg# XORG_INSTALL()
29678f65982aSmrg# ----------------
29688f65982aSmrg# Minimum version: 1.4.0
29698f65982aSmrg#
29708f65982aSmrg# Defines the variable INSTALL_CMD as the command to copy
29718f65982aSmrg# INSTALL from $prefix/share/util-macros.
29728f65982aSmrg#
29738f65982aSmrgAC_DEFUN([XORG_INSTALL], [
29748f65982aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
29758f65982aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
29768f65982aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
29778f65982aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
29788f65982aSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
29798f65982aSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
29808f65982aSmrgAC_SUBST([INSTALL_CMD])
29818f65982aSmrg]) # XORG_INSTALL
29829aa228fdSmrgdnl Copyright 2005 Red Hat, Inc
29839aa228fdSmrgdnl
29849aa228fdSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
29859aa228fdSmrgdnl documentation for any purpose is hereby granted without fee, provided that
29869aa228fdSmrgdnl the above copyright notice appear in all copies and that both that
29879aa228fdSmrgdnl copyright notice and this permission notice appear in supporting
29889aa228fdSmrgdnl documentation.
29899aa228fdSmrgdnl
29909aa228fdSmrgdnl The above copyright notice and this permission notice shall be included
29919aa228fdSmrgdnl in all copies or substantial portions of the Software.
29929aa228fdSmrgdnl
29939aa228fdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
29949aa228fdSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29959aa228fdSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
29969aa228fdSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
29979aa228fdSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
29989aa228fdSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29999aa228fdSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
30009aa228fdSmrgdnl
30019aa228fdSmrgdnl Except as contained in this notice, the name of the copyright holders shall
30029aa228fdSmrgdnl not be used in advertising or otherwise to promote the sale, use or
30039aa228fdSmrgdnl other dealings in this Software without prior written authorization
30049aa228fdSmrgdnl from the copyright holders.
30059aa228fdSmrgdnl
30069aa228fdSmrg
30079aa228fdSmrg# XORG_RELEASE_VERSION
30089aa228fdSmrg# --------------------
30098f65982aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
30109aa228fdSmrg 
30119aa228fdSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
30129aa228fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
30139aa228fdSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
30149aa228fdSmrg		[Major version of this package])
301583d7c197Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
30169aa228fdSmrg	if test "x$PVM" = "x"; then
30179aa228fdSmrg		PVM="0"
30189aa228fdSmrg	fi
30199aa228fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
30209aa228fdSmrg		[$PVM],
30219aa228fdSmrg		[Minor version of this package])
302283d7c197Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
30239aa228fdSmrg	if test "x$PVP" = "x"; then
30249aa228fdSmrg		PVP="0"
30259aa228fdSmrg	fi
30269aa228fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
30279aa228fdSmrg		[$PVP],
30289aa228fdSmrg		[Patch version of this package])
30299aa228fdSmrg])
30309aa228fdSmrg
303183d7c197Smrg# XORG_CHANGELOG()
303283d7c197Smrg# ----------------
303383d7c197Smrg# Minimum version: 1.2.0
303483d7c197Smrg#
303583d7c197Smrg# Defines the variable CHANGELOG_CMD as the command to generate
303683d7c197Smrg# ChangeLog from git.
303783d7c197Smrg#
303883d7c197Smrg#
303983d7c197SmrgAC_DEFUN([XORG_CHANGELOG], [
30408f65982aSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
30418f65982aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
30428f65982aSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
304383d7c197Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
304483d7c197SmrgAC_SUBST([CHANGELOG_CMD])
304583d7c197Smrg]) # XORG_CHANGELOG
304683d7c197Smrg
3047