aclocal.m4 revision 33734831
133734831Smrg# generated automatically by aclocal 1.13.4 -*- Autoconf -*-
233734831Smrg
333734831Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4b1297603Smrg
5b1297603Smrg# This file is free software; the Free Software Foundation
6b1297603Smrg# gives unlimited permission to copy and/or distribute it,
7b1297603Smrg# with or without modifications, as long as this notice is preserved.
8b1297603Smrg
9b1297603Smrg# This program is distributed in the hope that it will be useful,
10b1297603Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11b1297603Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12b1297603Smrg# PARTICULAR PURPOSE.
13b1297603Smrg
1433734831Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
155b944e2aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
165b944e2aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1733734831Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1833734831Smrg[m4_warning([this file was generated for autoconf 2.69.
195b944e2aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
205b944e2aSmrgIf you have problems, you may need to regenerate the build system entirely.
2133734831SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
225b944e2aSmrg
2333734831Smrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
24b1297603Smrg#
2533734831Smrg# This file is free software; the Free Software Foundation
2633734831Smrg# gives unlimited permission to copy and/or distribute it,
2733734831Smrg# with or without modifications, as long as this notice is preserved.
2854e0bb33Smrg
2933734831Smrg# AM_AUTOMAKE_VERSION(VERSION)
3033734831Smrg# ----------------------------
3133734831Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3233734831Smrg# generated from the m4 files accompanying Automake X.Y.
3333734831Smrg# (This private macro should not be called outside this file.)
3433734831SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3533734831Smrg[am__api_version='1.13'
3633734831Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3733734831Smrgdnl require some minimum version.  Point them to the right macro.
3833734831Smrgm4_if([$1], [1.13.4], [],
3933734831Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4033734831Smrg])
41b1297603Smrg
4233734831Smrg# _AM_AUTOCONF_VERSION(VERSION)
4333734831Smrg# -----------------------------
4433734831Smrg# aclocal traces this macro to find the Autoconf version.
4533734831Smrg# This is a private macro too.  Using m4_define simplifies
4633734831Smrg# the logic in aclocal, which can simply ignore this definition.
4733734831Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48b1297603Smrg
4933734831Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5033734831Smrg# -------------------------------
5133734831Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5233734831Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5333734831SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5433734831Smrg[AM_AUTOMAKE_VERSION([1.13.4])dnl
5533734831Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5633734831Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5733734831Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58b1297603Smrg
5933734831Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60b1297603Smrg
6133734831Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6233734831Smrg#
6333734831Smrg# This file is free software; the Free Software Foundation
6433734831Smrg# gives unlimited permission to copy and/or distribute it,
6533734831Smrg# with or without modifications, as long as this notice is preserved.
66b1297603Smrg
6733734831Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6833734831Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6933734831Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7033734831Smrg#
7133734831Smrg# Of course, Automake must honor this variable whenever it calls a
7233734831Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7333734831Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7433734831Smrg# depending on how configure is run.  This is pretty annoying, since
7533734831Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7633734831Smrg# source directory, any form will work fine, but in subdirectories a
7733734831Smrg# relative path needs to be adjusted first.
78b1297603Smrg#
7933734831Smrg# $ac_aux_dir/missing
8033734831Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8133734831Smrg# $top_srcdir/$ac_aux_dir/missing
8233734831Smrg#    fails if $ac_aux_dir is absolute,
8333734831Smrg#    fails when called from a subdirectory in a VPATH build with
8433734831Smrg#          a relative $ac_aux_dir
85b1297603Smrg#
8633734831Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8733734831Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8833734831Smrg# harmless because $srcdir is '.', but things will broke when you
8933734831Smrg# start a VPATH build or use an absolute $srcdir.
90b1297603Smrg#
9133734831Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9233734831Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9333734831Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9433734831Smrg# and then we would define $MISSING as
9533734831Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9633734831Smrg# This will work as long as MISSING is not called from configure, because
9733734831Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9833734831Smrg# However there are other variables, like CC, which are often used in
9933734831Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100b1297603Smrg#
10133734831Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10233734831Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10333734831Smrg# configured tree to be moved without reconfiguration.
104b1297603Smrg
10533734831SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10633734831Smrg[dnl Rely on autoconf to set up CDPATH properly.
10733734831SmrgAC_PREREQ([2.50])dnl
10833734831Smrg# expand $ac_aux_dir to an absolute path
10933734831Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
11033734831Smrg])
111b1297603Smrg
11233734831Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
113b1297603Smrg
11433734831Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
11533734831Smrg#
11633734831Smrg# This file is free software; the Free Software Foundation
11733734831Smrg# gives unlimited permission to copy and/or distribute it,
11833734831Smrg# with or without modifications, as long as this notice is preserved.
119b1297603Smrg
12033734831Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12133734831Smrg# -------------------------------------
12233734831Smrg# Define a conditional.
12333734831SmrgAC_DEFUN([AM_CONDITIONAL],
12433734831Smrg[AC_PREREQ([2.52])dnl
12533734831Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12633734831Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12733734831SmrgAC_SUBST([$1_TRUE])dnl
12833734831SmrgAC_SUBST([$1_FALSE])dnl
12933734831Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
13033734831Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13133734831Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13233734831Smrgif $2; then
13333734831Smrg  $1_TRUE=
13433734831Smrg  $1_FALSE='#'
13533734831Smrgelse
13633734831Smrg  $1_TRUE='#'
13733734831Smrg  $1_FALSE=
13833734831Smrgfi
13933734831SmrgAC_CONFIG_COMMANDS_PRE(
14033734831Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14133734831Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14233734831SmrgUsually this means the macro was only invoked conditionally.]])
14333734831Smrgfi])])
144b1297603Smrg
14533734831Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
14633734831Smrg#
14733734831Smrg# This file is free software; the Free Software Foundation
14833734831Smrg# gives unlimited permission to copy and/or distribute it,
14933734831Smrg# with or without modifications, as long as this notice is preserved.
150b1297603Smrg
151b1297603Smrg
15233734831Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15333734831Smrg# written in clear, in which case automake, when reading aclocal.m4,
15433734831Smrg# will think it sees a *use*, and therefore will trigger all it's
15533734831Smrg# C support machinery.  Also note that it means that autoscan, seeing
15633734831Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
157b1297603Smrg
158b1297603Smrg
15933734831Smrg# _AM_DEPENDENCIES(NAME)
16033734831Smrg# ----------------------
16133734831Smrg# See how the compiler implements dependency checking.
16233734831Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16333734831Smrg# We try a few techniques and use that to set a single cache variable.
16433734831Smrg#
16533734831Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16633734831Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16733734831Smrg# dependency, and given that the user is not expected to run this macro,
16833734831Smrg# just rely on AC_PROG_CC.
16933734831SmrgAC_DEFUN([_AM_DEPENDENCIES],
17033734831Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17133734831SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17233734831SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17333734831SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
174b1297603Smrg
17533734831Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17633734831Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17733734831Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17833734831Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17933734831Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
18033734831Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18133734831Smrg                    [depcc="$$1"   am_compiler_list=])
182b1297603Smrg
18333734831SmrgAC_CACHE_CHECK([dependency style of $depcc],
18433734831Smrg               [am_cv_$1_dependencies_compiler_type],
18533734831Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18633734831Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18733734831Smrg  # making bogus files that we don't know about and never remove.  For
18833734831Smrg  # instance it was reported that on HP-UX the gcc test will end up
18933734831Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
19033734831Smrg  # in D".
19133734831Smrg  rm -rf conftest.dir
19233734831Smrg  mkdir conftest.dir
19333734831Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19433734831Smrg  # using a relative directory.
19533734831Smrg  cp "$am_depcomp" conftest.dir
19633734831Smrg  cd conftest.dir
19733734831Smrg  # We will build objects and dependencies in a subdirectory because
19833734831Smrg  # it helps to detect inapplicable dependency modes.  For instance
19933734831Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
20033734831Smrg  # side effect of compilation, but ICC will put the dependencies in
20133734831Smrg  # the current directory while Tru64 will put them in the object
20233734831Smrg  # directory.
20333734831Smrg  mkdir sub
204cea37944Smrg
20533734831Smrg  am_cv_$1_dependencies_compiler_type=none
20633734831Smrg  if test "$am_compiler_list" = ""; then
20733734831Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20833734831Smrg  fi
20933734831Smrg  am__universal=false
21033734831Smrg  m4_case([$1], [CC],
21133734831Smrg    [case " $depcc " in #(
21233734831Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21333734831Smrg     esac],
21433734831Smrg    [CXX],
21533734831Smrg    [case " $depcc " in #(
21633734831Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21733734831Smrg     esac])
218cea37944Smrg
21933734831Smrg  for depmode in $am_compiler_list; do
22033734831Smrg    # Setup a source with many dependencies, because some compilers
22133734831Smrg    # like to wrap large dependency lists on column 80 (with \), and
22233734831Smrg    # we should not choose a depcomp mode which is confused by this.
22333734831Smrg    #
22433734831Smrg    # We need to recreate these files for each test, as the compiler may
22533734831Smrg    # overwrite some of them when testing with obscure command lines.
22633734831Smrg    # This happens at least with the AIX C compiler.
22733734831Smrg    : > sub/conftest.c
22833734831Smrg    for i in 1 2 3 4 5 6; do
22933734831Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
23033734831Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23133734831Smrg      # Solaris 10 /bin/sh.
23233734831Smrg      echo '/* dummy */' > sub/conftst$i.h
23333734831Smrg    done
23433734831Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
235b1297603Smrg
23633734831Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23733734831Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23833734831Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23933734831Smrg    # versions had trouble with output in subdirs.
24033734831Smrg    am__obj=sub/conftest.${OBJEXT-o}
24133734831Smrg    am__minus_obj="-o $am__obj"
24233734831Smrg    case $depmode in
24333734831Smrg    gcc)
24433734831Smrg      # This depmode causes a compiler race in universal mode.
24533734831Smrg      test "$am__universal" = false || continue
24633734831Smrg      ;;
24733734831Smrg    nosideeffect)
24833734831Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24933734831Smrg      # only be used when explicitly requested.
25033734831Smrg      if test "x$enable_dependency_tracking" = xyes; then
25133734831Smrg	continue
25233734831Smrg      else
25333734831Smrg	break
25433734831Smrg      fi
25533734831Smrg      ;;
25633734831Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25733734831Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25833734831Smrg      # not run yet.  These depmodes are late enough in the game, and
25933734831Smrg      # so weak that their functioning should not be impacted.
26033734831Smrg      am__obj=conftest.${OBJEXT-o}
26133734831Smrg      am__minus_obj=
26233734831Smrg      ;;
26333734831Smrg    none) break ;;
26433734831Smrg    esac
26533734831Smrg    if depmode=$depmode \
26633734831Smrg       source=sub/conftest.c object=$am__obj \
26733734831Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26833734831Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26933734831Smrg         >/dev/null 2>conftest.err &&
27033734831Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27133734831Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27233734831Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27333734831Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27433734831Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27533734831Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27633734831Smrg      # that says an option was ignored or not supported.
27733734831Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27833734831Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27933734831Smrg      # The diagnosis changed in icc 8.0:
28033734831Smrg      #   icc: Command line remark: option '-MP' not supported
28133734831Smrg      if (grep 'ignoring option' conftest.err ||
28233734831Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28333734831Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28433734831Smrg        break
28533734831Smrg      fi
28633734831Smrg    fi
28733734831Smrg  done
288b1297603Smrg
28933734831Smrg  cd ..
29033734831Smrg  rm -rf conftest.dir
291b1297603Smrgelse
29233734831Smrg  am_cv_$1_dependencies_compiler_type=none
293b1297603Smrgfi
29433734831Smrg])
29533734831SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29633734831SmrgAM_CONDITIONAL([am__fastdep$1], [
29733734831Smrg  test "x$enable_dependency_tracking" != xno \
29833734831Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29933734831Smrg])
300b1297603Smrg
301b1297603Smrg
30233734831Smrg# AM_SET_DEPDIR
30333734831Smrg# -------------
30433734831Smrg# Choose a directory name for dependency files.
30533734831Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30633734831SmrgAC_DEFUN([AM_SET_DEPDIR],
30733734831Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30833734831SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30933734831Smrg])
310b1297603Smrg
311b1297603Smrg
31233734831Smrg# AM_DEP_TRACK
31333734831Smrg# ------------
31433734831SmrgAC_DEFUN([AM_DEP_TRACK],
31533734831Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31633734831SmrgAS_HELP_STRING(
31733734831Smrg  [--enable-dependency-tracking],
31833734831Smrg  [do not reject slow dependency extractors])
31933734831SmrgAS_HELP_STRING(
32033734831Smrg  [--disable-dependency-tracking],
32133734831Smrg  [speeds up one-time build])])
32233734831Smrgif test "x$enable_dependency_tracking" != xno; then
32333734831Smrg  am_depcomp="$ac_aux_dir/depcomp"
32433734831Smrg  AMDEPBACKSLASH='\'
32533734831Smrg  am__nodep='_no'
32654e0bb33Smrgfi
32733734831SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32833734831SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32933734831Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
33033734831SmrgAC_SUBST([am__nodep])dnl
33133734831Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33233734831Smrg])
333b1297603Smrg
33433734831Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
335b1297603Smrg
33633734831Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
33733734831Smrg#
33833734831Smrg# This file is free software; the Free Software Foundation
33933734831Smrg# gives unlimited permission to copy and/or distribute it,
34033734831Smrg# with or without modifications, as long as this notice is preserved.
341b1297603Smrg
34254e0bb33Smrg
34333734831Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34433734831Smrg# ------------------------------
34533734831SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34633734831Smrg[{
34733734831Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34833734831Smrg  # are listed without --file.  Let's play safe and only enable the eval
34933734831Smrg  # if we detect the quoting.
35033734831Smrg  case $CONFIG_FILES in
35133734831Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
35233734831Smrg  *)   set x $CONFIG_FILES ;;
35333734831Smrg  esac
35433734831Smrg  shift
35533734831Smrg  for mf
35633734831Smrg  do
35733734831Smrg    # Strip MF so we end up with the name of the file.
35833734831Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
35933734831Smrg    # Check whether this is an Automake generated Makefile or not.
36033734831Smrg    # We used to match only the files named 'Makefile.in', but
36133734831Smrg    # some people rename them; so instead we look at the file content.
36233734831Smrg    # Grep'ing the first line is not enough: some people post-process
36333734831Smrg    # each Makefile.in and add a new line on top of each file to say so.
36433734831Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
36533734831Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36633734831Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
36733734831Smrg      dirpart=`AS_DIRNAME("$mf")`
36833734831Smrg    else
36933734831Smrg      continue
37033734831Smrg    fi
37133734831Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
37233734831Smrg    # from the Makefile without running 'make'.
37333734831Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
37433734831Smrg    test -z "$DEPDIR" && continue
37533734831Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
37633734831Smrg    test -z "$am__include" && continue
37733734831Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
37833734831Smrg    # Find all dependency output files, they are included files with
37933734831Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
38033734831Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
38133734831Smrg    # expansion.
38233734831Smrg    for file in `sed -n "
38333734831Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
38433734831Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
38533734831Smrg      # Make sure the directory exists.
38633734831Smrg      test -f "$dirpart/$file" && continue
38733734831Smrg      fdir=`AS_DIRNAME(["$file"])`
38833734831Smrg      AS_MKDIR_P([$dirpart/$fdir])
38933734831Smrg      # echo "creating $dirpart/$file"
39033734831Smrg      echo '# dummy' > "$dirpart/$file"
39133734831Smrg    done
39233734831Smrg  done
39333734831Smrg}
39433734831Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
39554e0bb33Smrg
39654e0bb33Smrg
39733734831Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39833734831Smrg# -----------------------------
39933734831Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
40054e0bb33Smrg#
40133734831Smrg# This code is only required when automatic dependency tracking
40233734831Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
40333734831Smrg# need in order to bootstrap the dependency handling code.
40433734831SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
40533734831Smrg[AC_CONFIG_COMMANDS([depfiles],
40633734831Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
40733734831Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
40833734831Smrg])
409b1297603Smrg
41033734831Smrg# Do all the work for Automake.                             -*- Autoconf -*-
411b1297603Smrg
41233734831Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
41354e0bb33Smrg#
41433734831Smrg# This file is free software; the Free Software Foundation
41533734831Smrg# gives unlimited permission to copy and/or distribute it,
41633734831Smrg# with or without modifications, as long as this notice is preserved.
4175b944e2aSmrg
41833734831Smrg# This macro actually does too much.  Some checks are only needed if
41933734831Smrg# your package does certain things.  But this isn't really a big deal.
420b1297603Smrg
42133734831Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
42233734831Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42333734831Smrg# -----------------------------------------------
42433734831Smrg# The call with PACKAGE and VERSION arguments is the old style
42533734831Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42633734831Smrg# and VERSION should now be passed to AC_INIT and removed from
42733734831Smrg# the call to AM_INIT_AUTOMAKE.
42833734831Smrg# We support both call styles for the transition.  After
42933734831Smrg# the next Automake release, Autoconf can make the AC_INIT
43033734831Smrg# arguments mandatory, and then we can depend on a new Autoconf
43133734831Smrg# release and drop the old call support.
43233734831SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43333734831Smrg[AC_PREREQ([2.65])dnl
43433734831Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43533734831Smrgdnl the ones we care about.
43633734831Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43733734831SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43833734831SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
43933734831Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44033734831Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44133734831Smrg  # is not polluted with repeated "-I."
44233734831Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44333734831Smrg  # test to see if srcdir already configured
44433734831Smrg  if test -f $srcdir/config.status; then
44533734831Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44633734831Smrg  fi
44753719b08Smrgfi
448b1297603Smrg
44933734831Smrg# test whether we have cygpath
45033734831Smrgif test -z "$CYGPATH_W"; then
45133734831Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45233734831Smrg    CYGPATH_W='cygpath -w'
45333734831Smrg  else
45433734831Smrg    CYGPATH_W=echo
45533734831Smrg  fi
45633734831Smrgfi
45733734831SmrgAC_SUBST([CYGPATH_W])
458b1297603Smrg
45933734831Smrg# Define the identity of the package.
46033734831Smrgdnl Distinguish between old-style and new-style calls.
46133734831Smrgm4_ifval([$2],
46233734831Smrg[AC_DIAGNOSE([obsolete],
46333734831Smrg             [$0: two- and three-arguments forms are deprecated.])
46433734831Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46533734831Smrg AC_SUBST([PACKAGE], [$1])dnl
46633734831Smrg AC_SUBST([VERSION], [$2])],
46733734831Smrg[_AM_SET_OPTIONS([$1])dnl
46833734831Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
46933734831Smrgm4_if(
47033734831Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
47133734831Smrg  [ok:ok],,
47233734831Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47333734831Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47433734831Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
475b1297603Smrg
47633734831Smrg_AM_IF_OPTION([no-define],,
47733734831Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47833734831Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
479cea37944Smrg
48033734831Smrg# Some tools Automake needs.
48133734831SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48233734831SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48333734831SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48433734831SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48533734831SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48633734831SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48733734831SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48833734831SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
48933734831SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49033734831SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49133734831Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49233734831Smrg# dies out for good.  For more background, see:
49333734831Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49433734831Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49533734831SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49633734831Smrg# We need awk for the "check" target.  The system "awk" is bad on
49733734831Smrg# some platforms.
49833734831SmrgAC_REQUIRE([AC_PROG_AWK])dnl
49933734831SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50033734831SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50133734831Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50233734831Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50333734831Smrg			     [_AM_PROG_TAR([v7])])])
50433734831Smrg_AM_IF_OPTION([no-dependencies],,
50533734831Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50633734831Smrg		  [_AM_DEPENDENCIES([CC])],
50733734831Smrg		  [m4_define([AC_PROG_CC],
50833734831Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
50933734831SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51033734831Smrg		  [_AM_DEPENDENCIES([CXX])],
51133734831Smrg		  [m4_define([AC_PROG_CXX],
51233734831Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51333734831SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51433734831Smrg		  [_AM_DEPENDENCIES([OBJC])],
51533734831Smrg		  [m4_define([AC_PROG_OBJC],
51633734831Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51733734831SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51833734831Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
51933734831Smrg		  [m4_define([AC_PROG_OBJCXX],
52033734831Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52133734831Smrg])
52233734831SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
52333734831Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
52433734831Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
52533734831Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
52633734831SmrgAC_CONFIG_COMMANDS_PRE(dnl
52733734831Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
52833734831Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
52933734831Smrg])
530cea37944Smrg
53133734831Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
53233734831Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
53333734831Smrgdnl mangled by Autoconf and run in a shell conditional statement.
53433734831Smrgm4_define([_AC_COMPILER_EXEEXT],
53533734831Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
536cea37944Smrg
537cea37944Smrg
53833734831Smrg# When config.status generates a header, we must update the stamp-h file.
53933734831Smrg# This file resides in the same directory as the config header
54033734831Smrg# that is generated.  The stamp files are numbered to have different names.
541cea37944Smrg
54233734831Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
54333734831Smrg# loop where config.status creates the headers, so we can generate
54433734831Smrg# our stamp files there.
54533734831SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
54633734831Smrg[# Compute $1's index in $config_headers.
54733734831Smrg_am_arg=$1
54833734831Smrg_am_stamp_count=1
54933734831Smrgfor _am_header in $config_headers :; do
55033734831Smrg  case $_am_header in
55133734831Smrg    $_am_arg | $_am_arg:* )
55233734831Smrg      break ;;
55333734831Smrg    * )
55433734831Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
55533734831Smrg  esac
55633734831Smrgdone
55733734831Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
558cea37944Smrg
55933734831Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
56033734831Smrg#
56133734831Smrg# This file is free software; the Free Software Foundation
56233734831Smrg# gives unlimited permission to copy and/or distribute it,
56333734831Smrg# with or without modifications, as long as this notice is preserved.
564cea37944Smrg
56533734831Smrg# AM_PROG_INSTALL_SH
56633734831Smrg# ------------------
56733734831Smrg# Define $install_sh.
56833734831SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
56933734831Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
57033734831Smrgif test x"${install_sh}" != xset; then
57133734831Smrg  case $am_aux_dir in
57233734831Smrg  *\ * | *\	*)
57333734831Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
57433734831Smrg  *)
57533734831Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
57633734831Smrg  esac
57753719b08Smrgfi
57833734831SmrgAC_SUBST([install_sh])])
579b1297603Smrg
58033734831Smrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
58133734831Smrg#
58233734831Smrg# This file is free software; the Free Software Foundation
58333734831Smrg# gives unlimited permission to copy and/or distribute it,
58433734831Smrg# with or without modifications, as long as this notice is preserved.
585cea37944Smrg
58633734831Smrg# Check whether the underlying file-system supports filenames
58733734831Smrg# with a leading dot.  For instance MS-DOS doesn't.
58833734831SmrgAC_DEFUN([AM_SET_LEADING_DOT],
58933734831Smrg[rm -rf .tst 2>/dev/null
59033734831Smrgmkdir .tst 2>/dev/null
59133734831Smrgif test -d .tst; then
59233734831Smrg  am__leading_dot=.
59333734831Smrgelse
59433734831Smrg  am__leading_dot=_
59554e0bb33Smrgfi
59633734831Smrgrmdir .tst 2>/dev/null
59733734831SmrgAC_SUBST([am__leading_dot])])
598cea37944Smrg
59933734831Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
60033734831Smrg# From Jim Meyering
601cea37944Smrg
60233734831Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
60333734831Smrg#
60433734831Smrg# This file is free software; the Free Software Foundation
60533734831Smrg# gives unlimited permission to copy and/or distribute it,
60633734831Smrg# with or without modifications, as long as this notice is preserved.
607cea37944Smrg
60833734831Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
60933734831Smrg# ----------------------------------
61033734831Smrg# Control maintainer-specific portions of Makefiles.
61133734831Smrg# Default is to disable them, unless 'enable' is passed literally.
61233734831Smrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
61333734831Smrg# can override the default with the --enable/--disable switch.
61433734831SmrgAC_DEFUN([AM_MAINTAINER_MODE],
61533734831Smrg[m4_case(m4_default([$1], [disable]),
61633734831Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
61733734831Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
61833734831Smrg       [m4_define([am_maintainer_other], [enable])
61933734831Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
62033734831SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
62133734831Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
62233734831Smrg  AC_ARG_ENABLE([maintainer-mode],
62333734831Smrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
62433734831Smrg      am_maintainer_other[ make rules and dependencies not useful
62533734831Smrg      (and sometimes confusing) to the casual installer])],
62633734831Smrg    [USE_MAINTAINER_MODE=$enableval],
62733734831Smrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
62833734831Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
62933734831Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
63033734831Smrg  MAINT=$MAINTAINER_MODE_TRUE
63133734831Smrg  AC_SUBST([MAINT])dnl
63233734831Smrg]
63333734831Smrg)
634cea37944Smrg
63533734831Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
63633734831Smrg
63733734831Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
63854e0bb33Smrg#
63933734831Smrg# This file is free software; the Free Software Foundation
64033734831Smrg# gives unlimited permission to copy and/or distribute it,
64133734831Smrg# with or without modifications, as long as this notice is preserved.
642cea37944Smrg
64333734831Smrg# AM_MAKE_INCLUDE()
64433734831Smrg# -----------------
64533734831Smrg# Check to see how make treats includes.
64633734831SmrgAC_DEFUN([AM_MAKE_INCLUDE],
64733734831Smrg[am_make=${MAKE-make}
64833734831Smrgcat > confinc << 'END'
64933734831Smrgam__doit:
65033734831Smrg	@echo this is the am__doit target
65133734831Smrg.PHONY: am__doit
65233734831SmrgEND
65333734831Smrg# If we don't find an include directive, just comment out the code.
65433734831SmrgAC_MSG_CHECKING([for style of include used by $am_make])
65533734831Smrgam__include="#"
65633734831Smrgam__quote=
65733734831Smrg_am_result=none
65833734831Smrg# First try GNU make style include.
65933734831Smrgecho "include confinc" > confmf
66033734831Smrg# Ignore all kinds of additional output from 'make'.
66133734831Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
66233734831Smrg*the\ am__doit\ target*)
66333734831Smrg  am__include=include
66433734831Smrg  am__quote=
66533734831Smrg  _am_result=GNU
66633734831Smrg  ;;
66733734831Smrgesac
66833734831Smrg# Now try BSD make style include.
66933734831Smrgif test "$am__include" = "#"; then
67033734831Smrg   echo '.include "confinc"' > confmf
67133734831Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
67233734831Smrg   *the\ am__doit\ target*)
67333734831Smrg     am__include=.include
67433734831Smrg     am__quote="\""
67533734831Smrg     _am_result=BSD
67633734831Smrg     ;;
67733734831Smrg   esac
67853719b08Smrgfi
67933734831SmrgAC_SUBST([am__include])
68033734831SmrgAC_SUBST([am__quote])
68133734831SmrgAC_MSG_RESULT([$_am_result])
68233734831Smrgrm -f confinc confmf
68333734831Smrg])
684cea37944Smrg
68533734831Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
686cea37944Smrg
68733734831Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
6880309d3b3Smrg#
68933734831Smrg# This file is free software; the Free Software Foundation
69033734831Smrg# gives unlimited permission to copy and/or distribute it,
69133734831Smrg# with or without modifications, as long as this notice is preserved.
6920309d3b3Smrg
69333734831Smrg# AM_MISSING_PROG(NAME, PROGRAM)
69433734831Smrg# ------------------------------
69533734831SmrgAC_DEFUN([AM_MISSING_PROG],
69633734831Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
69733734831Smrg$1=${$1-"${am_missing_run}$2"}
69833734831SmrgAC_SUBST($1)])
69933734831Smrg
70033734831Smrg# AM_MISSING_HAS_RUN
70133734831Smrg# ------------------
70233734831Smrg# Define MISSING if not defined so far and test if it is modern enough.
70333734831Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
70433734831SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
70533734831Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
70633734831SmrgAC_REQUIRE_AUX_FILE([missing])dnl
70733734831Smrgif test x"${MISSING+set}" != xset; then
70833734831Smrg  case $am_aux_dir in
70933734831Smrg  *\ * | *\	*)
71033734831Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
71133734831Smrg  *)
71233734831Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
71333734831Smrg  esac
71433734831Smrgfi
71533734831Smrg# Use eval to expand $SHELL
71633734831Smrgif eval "$MISSING --is-lightweight"; then
71733734831Smrg  am_missing_run="$MISSING "
7180309d3b3Smrgelse
71933734831Smrg  am_missing_run=
72033734831Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7210309d3b3Smrgfi
72233734831Smrg])
7230309d3b3Smrg
72433734831Smrg# Helper functions for option handling.                     -*- Autoconf -*-
7250309d3b3Smrg
72633734831Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
7270309d3b3Smrg#
72833734831Smrg# This file is free software; the Free Software Foundation
72933734831Smrg# gives unlimited permission to copy and/or distribute it,
73033734831Smrg# with or without modifications, as long as this notice is preserved.
7310309d3b3Smrg
73233734831Smrg# _AM_MANGLE_OPTION(NAME)
73333734831Smrg# -----------------------
73433734831SmrgAC_DEFUN([_AM_MANGLE_OPTION],
73533734831Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7360309d3b3Smrg
73733734831Smrg# _AM_SET_OPTION(NAME)
73833734831Smrg# --------------------
73933734831Smrg# Set option NAME.  Presently that only means defining a flag for this option.
74033734831SmrgAC_DEFUN([_AM_SET_OPTION],
74133734831Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7420309d3b3Smrg
74333734831Smrg# _AM_SET_OPTIONS(OPTIONS)
74433734831Smrg# ------------------------
74533734831Smrg# OPTIONS is a space-separated list of Automake options.
74633734831SmrgAC_DEFUN([_AM_SET_OPTIONS],
74733734831Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
74833734831Smrg
74933734831Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
75033734831Smrg# -------------------------------------------
75133734831Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
75233734831SmrgAC_DEFUN([_AM_IF_OPTION],
75333734831Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
75433734831Smrg
75533734831Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
75633734831Smrg
75733734831Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
75854e0bb33Smrg#
75933734831Smrg# This file is free software; the Free Software Foundation
76033734831Smrg# gives unlimited permission to copy and/or distribute it,
76133734831Smrg# with or without modifications, as long as this notice is preserved.
762cea37944Smrg
76333734831Smrg# AM_SANITY_CHECK
76433734831Smrg# ---------------
76533734831SmrgAC_DEFUN([AM_SANITY_CHECK],
76633734831Smrg[AC_MSG_CHECKING([whether build environment is sane])
76733734831Smrg# Reject unsafe characters in $srcdir or the absolute working directory
76833734831Smrg# name.  Accept space and tab only in the latter.
76933734831Smrgam_lf='
77033734831Smrg'
77133734831Smrgcase `pwd` in
77233734831Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
77333734831Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
77433734831Smrgesac
77533734831Smrgcase $srcdir in
77633734831Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
77733734831Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
77833734831Smrgesac
77933734831Smrg
78033734831Smrg# Do 'set' in a subshell so we don't clobber the current shell's
78133734831Smrg# arguments.  Must try -L first in case configure is actually a
78233734831Smrg# symlink; some systems play weird games with the mod time of symlinks
78333734831Smrg# (eg FreeBSD returns the mod time of the symlink's containing
78433734831Smrg# directory).
78533734831Smrgif (
78633734831Smrg   am_has_slept=no
78733734831Smrg   for am_try in 1 2; do
78833734831Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
78933734831Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
79033734831Smrg     if test "$[*]" = "X"; then
79133734831Smrg	# -L didn't work.
79233734831Smrg	set X `ls -t "$srcdir/configure" conftest.file`
79333734831Smrg     fi
79433734831Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
79533734831Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
79633734831Smrg
79733734831Smrg	# If neither matched, then we have a broken ls.  This can happen
79833734831Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
79933734831Smrg	# broken ls alias from the environment.  This has actually
80033734831Smrg	# happened.  Such a system could not be considered "sane".
80133734831Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
80233734831Smrg  alias in your environment])
80333734831Smrg     fi
80433734831Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
80533734831Smrg       break
80633734831Smrg     fi
80733734831Smrg     # Just in case.
80833734831Smrg     sleep 1
80933734831Smrg     am_has_slept=yes
81033734831Smrg   done
81133734831Smrg   test "$[2]" = conftest.file
81233734831Smrg   )
81333734831Smrgthen
81433734831Smrg   # Ok.
81533734831Smrg   :
81654e0bb33Smrgelse
81733734831Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
81833734831SmrgCheck your system clock])
81953719b08Smrgfi
82033734831SmrgAC_MSG_RESULT([yes])
82133734831Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
82233734831Smrg# generated files are strictly newer.
82333734831Smrgam_sleep_pid=
82433734831Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
82533734831Smrg  ( sleep 1 ) &
82633734831Smrg  am_sleep_pid=$!
82733734831Smrgfi
82833734831SmrgAC_CONFIG_COMMANDS_PRE(
82933734831Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
83033734831Smrg   if test -n "$am_sleep_pid"; then
83133734831Smrg     # Hide warnings about reused PIDs.
83233734831Smrg     wait $am_sleep_pid 2>/dev/null
83333734831Smrg   fi
83433734831Smrg   AC_MSG_RESULT([done])])
83533734831Smrgrm -f conftest.file
83633734831Smrg])
8375b944e2aSmrg
83833734831Smrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
83954e0bb33Smrg#
84033734831Smrg# This file is free software; the Free Software Foundation
84133734831Smrg# gives unlimited permission to copy and/or distribute it,
84233734831Smrg# with or without modifications, as long as this notice is preserved.
843cea37944Smrg
84433734831Smrg# AM_SILENT_RULES([DEFAULT])
84533734831Smrg# --------------------------
84633734831Smrg# Enable less verbose build rules; with the default set to DEFAULT
84733734831Smrg# ("yes" being less verbose, "no" or empty being verbose).
84833734831SmrgAC_DEFUN([AM_SILENT_RULES],
84933734831Smrg[AC_ARG_ENABLE([silent-rules], [dnl
85033734831SmrgAS_HELP_STRING(
85133734831Smrg  [--enable-silent-rules],
85233734831Smrg  [less verbose build output (undo: "make V=1")])
85333734831SmrgAS_HELP_STRING(
85433734831Smrg  [--disable-silent-rules],
85533734831Smrg  [verbose build output (undo: "make V=0")])dnl
85633734831Smrg])
85733734831Smrgcase $enable_silent_rules in @%:@ (((
85833734831Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
85933734831Smrg   no) AM_DEFAULT_VERBOSITY=1;;
86033734831Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
86133734831Smrgesac
86233734831Smrgdnl
86333734831Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
86433734831Smrgdnl do not support nested variable expansions.
86533734831Smrgdnl See automake bug#9928 and bug#10237.
86633734831Smrgam_make=${MAKE-make}
86733734831SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
86833734831Smrg   [am_cv_make_support_nested_variables],
86933734831Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
87033734831SmrgBAR0=false
87133734831SmrgBAR1=true
87233734831SmrgV=1
87333734831Smrgam__doit:
87433734831Smrg	@$(TRUE)
87533734831Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
87633734831Smrg  am_cv_make_support_nested_variables=yes
877b1297603Smrgelse
87833734831Smrg  am_cv_make_support_nested_variables=no
87954e0bb33Smrgfi])
88033734831Smrgif test $am_cv_make_support_nested_variables = yes; then
88133734831Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
88233734831Smrg  AM_V='$(V)'
88333734831Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
88433734831Smrgelse
88533734831Smrg  AM_V=$AM_DEFAULT_VERBOSITY
88633734831Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
88733734831Smrgfi
88833734831SmrgAC_SUBST([AM_V])dnl
88933734831SmrgAM_SUBST_NOTMAKE([AM_V])dnl
89033734831SmrgAC_SUBST([AM_DEFAULT_V])dnl
89133734831SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
89233734831SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
89333734831SmrgAM_BACKSLASH='\'
89433734831SmrgAC_SUBST([AM_BACKSLASH])dnl
89533734831Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
89633734831Smrg])
897b1297603Smrg
89833734831Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
89953719b08Smrg#
90033734831Smrg# This file is free software; the Free Software Foundation
90133734831Smrg# gives unlimited permission to copy and/or distribute it,
90233734831Smrg# with or without modifications, as long as this notice is preserved.
90333734831Smrg
90433734831Smrg# AM_PROG_INSTALL_STRIP
90533734831Smrg# ---------------------
90633734831Smrg# One issue with vendor 'install' (even GNU) is that you can't
90733734831Smrg# specify the program used to strip binaries.  This is especially
90833734831Smrg# annoying in cross-compiling environments, where the build's strip
90933734831Smrg# is unlikely to handle the host's binaries.
91033734831Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
91133734831Smrg# always use install-sh in "make install-strip", and initialize
91233734831Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
91333734831SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
91433734831Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
91533734831Smrg# Installed binaries are usually stripped using 'strip' when the user
91633734831Smrg# run "make install-strip".  However 'strip' might not be the right
91733734831Smrg# tool to use in cross-compilation environments, therefore Automake
91833734831Smrg# will honor the 'STRIP' environment variable to overrule this program.
91933734831Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
92033734831Smrgif test "$cross_compiling" != no; then
92133734831Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
92233734831Smrgfi
92333734831SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
92433734831SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
92533734831Smrg
92633734831Smrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
92754e0bb33Smrg#
92833734831Smrg# This file is free software; the Free Software Foundation
92933734831Smrg# gives unlimited permission to copy and/or distribute it,
93033734831Smrg# with or without modifications, as long as this notice is preserved.
93133734831Smrg
93233734831Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
93333734831Smrg# ---------------------------
93433734831Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
93533734831Smrg# This macro is traced by Automake.
93633734831SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
93733734831Smrg
93833734831Smrg# AM_SUBST_NOTMAKE(VARIABLE)
93933734831Smrg# --------------------------
94033734831Smrg# Public sister of _AM_SUBST_NOTMAKE.
94133734831SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
94233734831Smrg
94333734831Smrg# Check how to create a tarball.                            -*- Autoconf -*-
94433734831Smrg
94533734831Smrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
94654e0bb33Smrg#
94733734831Smrg# This file is free software; the Free Software Foundation
94833734831Smrg# gives unlimited permission to copy and/or distribute it,
94933734831Smrg# with or without modifications, as long as this notice is preserved.
95033734831Smrg
95133734831Smrg# _AM_PROG_TAR(FORMAT)
95233734831Smrg# --------------------
95333734831Smrg# Check how to create a tarball in format FORMAT.
95433734831Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
95554e0bb33Smrg#
95633734831Smrg# Substitute a variable $(am__tar) that is a command
95733734831Smrg# writing to stdout a FORMAT-tarball containing the directory
95833734831Smrg# $tardir.
95933734831Smrg#     tardir=directory && $(am__tar) > result.tar
96054e0bb33Smrg#
96133734831Smrg# Substitute a variable $(am__untar) that extract such
96233734831Smrg# a tarball read from stdin.
96333734831Smrg#     $(am__untar) < result.tar
96454e0bb33Smrg#
96533734831SmrgAC_DEFUN([_AM_PROG_TAR],
96633734831Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
96733734831Smrg# in the wild :-(  We should find a proper way to deprecate it ...
96833734831SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
969b1297603Smrg
97033734831Smrg# We'll loop over all known methods to create a tar archive until one works.
97133734831Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
972b1297603Smrg
97333734831Smrgm4_if([$1], [v7],
97433734831Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
97533734831Smrg
97633734831Smrg  [m4_case([$1],
97733734831Smrg    [ustar],
97833734831Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
97933734831Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
98033734831Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
98133734831Smrg      # and bug#13588).
98233734831Smrg      am_max_uid=2097151 # 2^21 - 1
98333734831Smrg      am_max_gid=$am_max_uid
98433734831Smrg      # The $UID and $GID variables are not portable, so we need to resort
98533734831Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
98633734831Smrg      # below are definitely unexpected, so allow the users to see them
98733734831Smrg      # (that is, avoid stderr redirection).
98833734831Smrg      am_uid=`id -u || echo unknown`
98933734831Smrg      am_gid=`id -g || echo unknown`
99033734831Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
99133734831Smrg      if test $am_uid -le $am_max_uid; then
99233734831Smrg         AC_MSG_RESULT([yes])
99333734831Smrg      else
99433734831Smrg         AC_MSG_RESULT([no])
99533734831Smrg         _am_tools=none
99633734831Smrg      fi
99733734831Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
99833734831Smrg      if test $am_gid -le $am_max_gid; then
99933734831Smrg         AC_MSG_RESULT([yes])
100033734831Smrg      else
100133734831Smrg        AC_MSG_RESULT([no])
100233734831Smrg        _am_tools=none
100333734831Smrg      fi],
100433734831Smrg
100533734831Smrg  [pax],
100633734831Smrg    [],
100733734831Smrg
100833734831Smrg  [m4_fatal([Unknown tar format])])
100933734831Smrg
101033734831Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
101133734831Smrg
101233734831Smrg  # Go ahead even if we have the value already cached.  We do so because we
101333734831Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
101433734831Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
101533734831Smrg
101633734831Smrg  for _am_tool in $_am_tools; do
101733734831Smrg    case $_am_tool in
101833734831Smrg    gnutar)
101933734831Smrg      for _am_tar in tar gnutar gtar; do
102033734831Smrg        AM_RUN_LOG([$_am_tar --version]) && break
102133734831Smrg      done
102233734831Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
102333734831Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
102433734831Smrg      am__untar="$_am_tar -xf -"
102533734831Smrg      ;;
102633734831Smrg    plaintar)
102733734831Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
102833734831Smrg      # ustar tarball either.
102933734831Smrg      (tar --version) >/dev/null 2>&1 && continue
103033734831Smrg      am__tar='tar chf - "$$tardir"'
103133734831Smrg      am__tar_='tar chf - "$tardir"'
103233734831Smrg      am__untar='tar xf -'
103333734831Smrg      ;;
103433734831Smrg    pax)
103533734831Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
103633734831Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
103733734831Smrg      am__untar='pax -r'
103833734831Smrg      ;;
103933734831Smrg    cpio)
104033734831Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
104133734831Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
104233734831Smrg      am__untar='cpio -i -H $1 -d'
104333734831Smrg      ;;
104433734831Smrg    none)
104533734831Smrg      am__tar=false
104633734831Smrg      am__tar_=false
104733734831Smrg      am__untar=false
104833734831Smrg      ;;
104933734831Smrg    esac
105033734831Smrg
105133734831Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
105233734831Smrg    # and am__untar set.
105333734831Smrg    test -n "${am_cv_prog_tar_$1}" && break
105433734831Smrg
105533734831Smrg    # tar/untar a dummy directory, and stop if the command works.
105633734831Smrg    rm -rf conftest.dir
105733734831Smrg    mkdir conftest.dir
105833734831Smrg    echo GrepMe > conftest.dir/file
105933734831Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
106033734831Smrg    rm -rf conftest.dir
106133734831Smrg    if test -s conftest.tar; then
106233734831Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
106333734831Smrg      AM_RUN_LOG([cat conftest.dir/file])
106433734831Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
106554e0bb33Smrg    fi
106633734831Smrg  done
106733734831Smrg  rm -rf conftest.dir
1068b1297603Smrg
106933734831Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
107033734831Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1071b1297603Smrg
107233734831SmrgAC_SUBST([am__tar])
107333734831SmrgAC_SUBST([am__untar])
107433734831Smrg]) # _AM_PROG_TAR
1075b1297603Smrg
107633734831Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
107733734831Smrg# serial 1 (pkg-config-0.24)
107833734831Smrg# 
107933734831Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
108053719b08Smrg#
108133734831Smrg# This program is free software; you can redistribute it and/or modify
108233734831Smrg# it under the terms of the GNU General Public License as published by
108333734831Smrg# the Free Software Foundation; either version 2 of the License, or
108433734831Smrg# (at your option) any later version.
108554e0bb33Smrg#
108633734831Smrg# This program is distributed in the hope that it will be useful, but
108733734831Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
108833734831Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
108933734831Smrg# General Public License for more details.
109054e0bb33Smrg#
109133734831Smrg# You should have received a copy of the GNU General Public License
109233734831Smrg# along with this program; if not, write to the Free Software
109333734831Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
109454e0bb33Smrg#
109533734831Smrg# As a special exception to the GNU General Public License, if you
109633734831Smrg# distribute this file as part of a program that contains a
109733734831Smrg# configuration script generated by Autoconf, you may include it under
109833734831Smrg# the same distribution terms that you use for the rest of that program.
1099cea37944Smrg
110033734831Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
110133734831Smrg# ----------------------------------
110233734831SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
110333734831Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
110433734831Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
110533734831SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
110633734831SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
110733734831SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
11080309d3b3Smrg
110933734831Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
111033734831Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
111133734831Smrgfi
111233734831Smrgif test -n "$PKG_CONFIG"; then
111333734831Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
111433734831Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
111533734831Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
111633734831Smrg		AC_MSG_RESULT([yes])
111733734831Smrg	else
111833734831Smrg		AC_MSG_RESULT([no])
111933734831Smrg		PKG_CONFIG=""
112033734831Smrg	fi
112133734831Smrgfi[]dnl
112233734831Smrg])# PKG_PROG_PKG_CONFIG
1123b1297603Smrg
112433734831Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
112554e0bb33Smrg#
112633734831Smrg# Check to see whether a particular set of modules exists.  Similar
112733734831Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
112854e0bb33Smrg#
112933734831Smrg# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
113033734831Smrg# only at the first occurence in configure.ac, so if the first place
113133734831Smrg# it's called might be skipped (such as if it is within an "if", you
113233734831Smrg# have to call PKG_CHECK_EXISTS manually
113333734831Smrg# --------------------------------------------------------------
113433734831SmrgAC_DEFUN([PKG_CHECK_EXISTS],
113533734831Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
113633734831Smrgif test -n "$PKG_CONFIG" && \
113733734831Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
113833734831Smrg  m4_default([$2], [:])
113933734831Smrgm4_ifvaln([$3], [else
114033734831Smrg  $3])dnl
114133734831Smrgfi])
1142cea37944Smrg
114333734831Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
114433734831Smrg# ---------------------------------------------
114533734831Smrgm4_define([_PKG_CONFIG],
114633734831Smrg[if test -n "$$1"; then
114733734831Smrg    pkg_cv_[]$1="$$1"
114833734831Smrg elif test -n "$PKG_CONFIG"; then
114933734831Smrg    PKG_CHECK_EXISTS([$3],
115033734831Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
115133734831Smrg		     [pkg_failed=yes])
115233734831Smrg else
115333734831Smrg    pkg_failed=untried
115433734831Smrgfi[]dnl
115533734831Smrg])# _PKG_CONFIG
115633734831Smrg
115733734831Smrg# _PKG_SHORT_ERRORS_SUPPORTED
115833734831Smrg# -----------------------------
115933734831SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
116033734831Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
116133734831Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
116233734831Smrg        _pkg_short_errors_supported=yes
116354e0bb33Smrgelse
116433734831Smrg        _pkg_short_errors_supported=no
116533734831Smrgfi[]dnl
116633734831Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1167cea37944Smrg
116833734831Smrg
116933734831Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
117033734831Smrg# [ACTION-IF-NOT-FOUND])
117153719b08Smrg#
1172b1297603Smrg#
117333734831Smrg# Note that if there is a possibility the first call to
117433734831Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
117533734831Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
117654e0bb33Smrg#
1177cea37944Smrg#
117833734831Smrg# --------------------------------------------------------------
117933734831SmrgAC_DEFUN([PKG_CHECK_MODULES],
118033734831Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
118133734831SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
118233734831SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
118354e0bb33Smrg
118433734831Smrgpkg_failed=no
118533734831SmrgAC_MSG_CHECKING([for $1])
1186b1297603Smrg
118733734831Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
118833734831Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
11890309d3b3Smrg
119033734831Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
119133734831Smrgand $1[]_LIBS to avoid the need to call pkg-config.
119233734831SmrgSee the pkg-config man page for more details.])
11930309d3b3Smrg
119433734831Smrgif test $pkg_failed = yes; then
119533734831Smrg   	AC_MSG_RESULT([no])
119633734831Smrg        _PKG_SHORT_ERRORS_SUPPORTED
119733734831Smrg        if test $_pkg_short_errors_supported = yes; then
119833734831Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
119933734831Smrg        else 
120033734831Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
120133734831Smrg        fi
120233734831Smrg	# Put the nasty error message in config.log where it belongs
120333734831Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
12040309d3b3Smrg
120533734831Smrg	m4_default([$4], [AC_MSG_ERROR(
120633734831Smrg[Package requirements ($2) were not met:
12070309d3b3Smrg
120833734831Smrg$$1_PKG_ERRORS
12090309d3b3Smrg
121033734831SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
121133734831Smrginstalled software in a non-standard prefix.
12120309d3b3Smrg
121333734831Smrg_PKG_TEXT])
121433734831Smrg        ])
121533734831Smrgelif test $pkg_failed = untried; then
121633734831Smrg     	AC_MSG_RESULT([no])
121733734831Smrg	m4_default([$4], [AC_MSG_FAILURE(
121833734831Smrg[The pkg-config script could not be found or is too old.  Make sure it
121933734831Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
122033734831Smrgpath to pkg-config.
12210309d3b3Smrg
122233734831Smrg_PKG_TEXT
12230309d3b3Smrg
122433734831SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])
122533734831Smrg        ])
122633734831Smrgelse
122733734831Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
122833734831Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
122933734831Smrg        AC_MSG_RESULT([yes])
123033734831Smrg	$3
123133734831Smrgfi[]dnl
123233734831Smrg])# PKG_CHECK_MODULES
123333734831Smrg
123433734831Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
123533734831Smrgdnl
123633734831Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
123733734831Smrgdnl 
123833734831Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
123933734831Smrgdnl copy of this software and associated documentation files (the "Software"),
124033734831Smrgdnl to deal in the Software without restriction, including without limitation
124133734831Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
124233734831Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
124333734831Smrgdnl Software is furnished to do so, subject to the following conditions:
124433734831Smrgdnl
124533734831Smrgdnl The above copyright notice and this permission notice (including the next
124633734831Smrgdnl paragraph) shall be included in all copies or substantial portions of the
124733734831Smrgdnl Software.
124833734831Smrgdnl
124933734831Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
125033734831Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
125133734831Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
125233734831Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
125333734831Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
125433734831Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
125533734831Smrgdnl DEALINGS IN THE SOFTWARE.
125633734831Smrg
125733734831Smrg# XORG_MACROS_VERSION(required-version)
125833734831Smrg# -------------------------------------
125933734831Smrg# Minimum version: 1.1.0
12600309d3b3Smrg#
126133734831Smrg# If you're using a macro added in Version 1.1 or newer, include this in
126233734831Smrg# your configure.ac with the minimum required version, such as:
126333734831Smrg# XORG_MACROS_VERSION(1.1)
12640309d3b3Smrg#
126533734831Smrg# To ensure that this macro is defined, also add:
126633734831Smrg# m4_ifndef([XORG_MACROS_VERSION],
126733734831Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
12680309d3b3Smrg#
12690309d3b3Smrg#
127033734831Smrg# See the "minimum version" comment for each macro you use to see what 
127133734831Smrg# version you require.
127233734831Smrgm4_defun([XORG_MACROS_VERSION],[
127333734831Smrgm4_define([vers_have], [1.17])
127433734831Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
127533734831Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
127633734831Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
127733734831Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
127833734831Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
127933734831Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
128033734831Smrgm4_undefine([vers_have])
128133734831Smrgm4_undefine([maj_have])
128233734831Smrgm4_undefine([maj_needed])
128333734831Smrg]) # XORG_MACROS_VERSION
128433734831Smrg
128533734831Smrg# XORG_PROG_RAWCPP()
128633734831Smrg# ------------------
128733734831Smrg# Minimum version: 1.0.0
12880309d3b3Smrg#
128933734831Smrg# Find cpp program and necessary flags for use in pre-processing text files
129033734831Smrg# such as man pages and config files
129133734831SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
129233734831SmrgAC_REQUIRE([AC_PROG_CPP])
129333734831SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
129433734831Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
129533734831Smrg
129633734831Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
129733734831Smrg# which is not the best choice for supporting other OS'es, but covers most
129833734831Smrg# of the ones we need for now.
129933734831SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
130033734831SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
130133734831Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
130233734831Smrg	AC_MSG_RESULT([no])
13030309d3b3Smrgelse
130433734831Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
130533734831Smrg		RAWCPPFLAGS=-undef
130633734831Smrg		AC_MSG_RESULT([yes])
130733734831Smrg	# under Cygwin unix is still defined even with -undef
130833734831Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
130933734831Smrg		RAWCPPFLAGS="-undef -ansi"
131033734831Smrg		AC_MSG_RESULT([yes, with -ansi])
131133734831Smrg	else
131233734831Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
131333734831Smrg	fi
13140309d3b3Smrgfi
131533734831Smrgrm -f conftest.$ac_ext
13160309d3b3Smrg
131733734831SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
131833734831SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
131933734831Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
132033734831Smrg	AC_MSG_RESULT([no])
132133734831Smrgelse
132233734831Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
132333734831Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
132433734831Smrg		AC_MSG_RESULT([yes])
132533734831Smrg	else
132633734831Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
132733734831Smrg	fi
132833734831Smrgfi
132933734831Smrgrm -f conftest.$ac_ext
133033734831SmrgAC_SUBST(RAWCPPFLAGS)
133133734831Smrg]) # XORG_PROG_RAWCPP
133233734831Smrg
133333734831Smrg# XORG_MANPAGE_SECTIONS()
13340309d3b3Smrg# -----------------------
133533734831Smrg# Minimum version: 1.0.0
13360309d3b3Smrg#
133733734831Smrg# Determine which sections man pages go in for the different man page types
133833734831Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
133933734831Smrg# Not sure if there's any better way than just hardcoding by OS name.
134033734831Smrg# Override default settings by setting environment variables
134133734831Smrg# Added MAN_SUBSTS in version 1.8
134233734831Smrg# Added AC_PROG_SED in version 1.8
13430309d3b3Smrg
134433734831SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
13450309d3b3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
134633734831SmrgAC_REQUIRE([AC_PROG_SED])
13470309d3b3Smrg
134833734831Smrgif test x$APP_MAN_SUFFIX = x    ; then
134933734831Smrg    APP_MAN_SUFFIX=1
135033734831Smrgfi
135133734831Smrgif test x$APP_MAN_DIR = x    ; then
135233734831Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
135333734831Smrgfi
13540309d3b3Smrg
135533734831Smrgif test x$LIB_MAN_SUFFIX = x    ; then
135633734831Smrg    LIB_MAN_SUFFIX=3
135733734831Smrgfi
135833734831Smrgif test x$LIB_MAN_DIR = x    ; then
135933734831Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
13600309d3b3Smrgfi
13610309d3b3Smrg
136233734831Smrgif test x$FILE_MAN_SUFFIX = x    ; then
136333734831Smrg    case $host_os in
136433734831Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
136533734831Smrg	*)		FILE_MAN_SUFFIX=5  ;;
136633734831Smrg    esac
136733734831Smrgfi
136833734831Smrgif test x$FILE_MAN_DIR = x    ; then
136933734831Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
137033734831Smrgfi
13710309d3b3Smrg
137233734831Smrgif test x$MISC_MAN_SUFFIX = x    ; then
137333734831Smrg    case $host_os in
137433734831Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
137533734831Smrg	*)		MISC_MAN_SUFFIX=7  ;;
137633734831Smrg    esac
137733734831Smrgfi
137833734831Smrgif test x$MISC_MAN_DIR = x    ; then
137933734831Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
138033734831Smrgfi
138153719b08Smrg
138233734831Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
138333734831Smrg    case $host_os in
138433734831Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
138533734831Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
138633734831Smrg    esac
138733734831Smrgfi
138833734831Smrgif test x$DRIVER_MAN_DIR = x    ; then
138933734831Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
13905b944e2aSmrgfi
13915b944e2aSmrg
139233734831Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
139333734831Smrg    case $host_os in
139433734831Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
139533734831Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
139633734831Smrg    esac
139733734831Smrgfi
139833734831Smrgif test x$ADMIN_MAN_DIR = x    ; then
139933734831Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1400cea37944Smrgfi
1401b1297603Smrg
140254e0bb33Smrg
140333734831SmrgAC_SUBST([APP_MAN_SUFFIX])
140433734831SmrgAC_SUBST([LIB_MAN_SUFFIX])
140533734831SmrgAC_SUBST([FILE_MAN_SUFFIX])
140633734831SmrgAC_SUBST([MISC_MAN_SUFFIX])
140733734831SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
140833734831SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
140933734831SmrgAC_SUBST([APP_MAN_DIR])
141033734831SmrgAC_SUBST([LIB_MAN_DIR])
141133734831SmrgAC_SUBST([FILE_MAN_DIR])
141233734831SmrgAC_SUBST([MISC_MAN_DIR])
141333734831SmrgAC_SUBST([DRIVER_MAN_DIR])
141433734831SmrgAC_SUBST([ADMIN_MAN_DIR])
141533734831Smrg
141633734831SmrgXORG_MAN_PAGE="X Version 11"
141733734831SmrgAC_SUBST([XORG_MAN_PAGE])
141833734831SmrgMAN_SUBSTS="\
141933734831Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
142033734831Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
142133734831Smrg	-e 's|__xservername__|Xorg|g' \
142233734831Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
142333734831Smrg	-e 's|__xorgconfdir__|xorg.conf.d|g' \
142433734831Smrg	-e 's|__projectroot__|\$(prefix)|g' \
142533734831Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
142633734831Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
142733734831Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
142833734831Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
142933734831Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
143033734831Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
143133734831Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
143233734831SmrgAC_SUBST([MAN_SUBSTS])
143333734831Smrg
143433734831Smrg]) # XORG_MANPAGE_SECTIONS
143533734831Smrg
143633734831Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
143733734831Smrg# ------------------------
143833734831Smrg# Minimum version: 1.7.0
143954e0bb33Smrg#
144033734831Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
144133734831Smrg# provided by xorg-sgml-doctools, if installed.
144233734831SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
144333734831SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
144433734831SmrgXORG_SGML_PATH=
144533734831SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
144633734831Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
144733734831Smrg    [m4_ifval([$1],[:],
144833734831Smrg        [if test x"$cross_compiling" != x"yes" ; then
144933734831Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
145033734831Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
145133734831Smrg         fi])
145233734831Smrg    ])
145333734831Smrg
145433734831Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
145533734831Smrg# the path and the name of the doc stylesheet
145633734831Smrgif test "x$XORG_SGML_PATH" != "x" ; then
145733734831Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
145833734831Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
145933734831Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
146033734831Smrgelse
146133734831Smrg   AC_MSG_RESULT([no])
146233734831Smrgfi
146333734831Smrg
146433734831SmrgAC_SUBST(XORG_SGML_PATH)
146533734831SmrgAC_SUBST(STYLESHEET_SRCDIR)
146633734831SmrgAC_SUBST(XSL_STYLESHEET)
146733734831SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
146833734831Smrg]) # XORG_CHECK_SGML_DOCTOOLS
146933734831Smrg
147033734831Smrg# XORG_CHECK_LINUXDOC
147133734831Smrg# -------------------
147233734831Smrg# Minimum version: 1.0.0
147354e0bb33Smrg#
147433734831Smrg# Defines the variable MAKE_TEXT if the necessary tools and
147533734831Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
147633734831Smrg# Whether or not the necessary tools and files are found can be checked
147733734831Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
147833734831SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
147933734831SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
148033734831SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1481b1297603Smrg
148233734831SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1483b1297603Smrg
148433734831SmrgAC_MSG_CHECKING([whether to build documentation])
1485b1297603Smrg
148633734831Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
148733734831Smrg   BUILDDOC=yes
148854e0bb33Smrgelse
148933734831Smrg   BUILDDOC=no
1490cea37944Smrgfi
1491b1297603Smrg
149233734831SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1493b1297603Smrg
149433734831SmrgAC_MSG_RESULT([$BUILDDOC])
1495b1297603Smrg
149633734831SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1497b1297603Smrg
149833734831Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
149933734831Smrg   BUILDPDFDOC=yes
150033734831Smrgelse
150133734831Smrg   BUILDPDFDOC=no
150233734831Smrgfi
1503b1297603Smrg
150433734831SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1505b1297603Smrg
150633734831SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1507b1297603Smrg
150833734831SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
150933734831SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
151033734831SmrgMAKE_PDF="$PS2PDF"
151133734831SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1512b1297603Smrg
151333734831SmrgAC_SUBST(MAKE_TEXT)
151433734831SmrgAC_SUBST(MAKE_PS)
151533734831SmrgAC_SUBST(MAKE_PDF)
151633734831SmrgAC_SUBST(MAKE_HTML)
151733734831Smrg]) # XORG_CHECK_LINUXDOC
1518b1297603Smrg
151933734831Smrg# XORG_CHECK_DOCBOOK
15200309d3b3Smrg# -------------------
152133734831Smrg# Minimum version: 1.0.0
15220309d3b3Smrg#
152333734831Smrg# Checks for the ability to build output formats from SGML DocBook source.
152433734831Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
152533734831Smrg# indicates whether the necessary tools and files are found and, if set,
152633734831Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
152733734831SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
152833734831SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
15290309d3b3Smrg
153033734831SmrgBUILDTXTDOC=no
153133734831SmrgBUILDPDFDOC=no
153233734831SmrgBUILDPSDOC=no
153333734831SmrgBUILDHTMLDOC=no
15340309d3b3Smrg
153533734831SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
153633734831SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
153733734831SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
153833734831SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
15390309d3b3Smrg
154033734831SmrgAC_MSG_CHECKING([whether to build text documentation])
154133734831Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
154233734831Smrg   test x$BUILD_TXTDOC != xno; then
154333734831Smrg	BUILDTXTDOC=yes
15440309d3b3Smrgfi
154533734831SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
154633734831SmrgAC_MSG_RESULT([$BUILDTXTDOC])
15470309d3b3Smrg
154833734831SmrgAC_MSG_CHECKING([whether to build PDF documentation])
154933734831Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
155033734831Smrg   test x$BUILD_PDFDOC != xno; then
155133734831Smrg	BUILDPDFDOC=yes
15520309d3b3Smrgfi
155333734831SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
155433734831SmrgAC_MSG_RESULT([$BUILDPDFDOC])
15550309d3b3Smrg
155633734831SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
155733734831Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
155833734831Smrg   test x$BUILD_PSDOC != xno; then
155933734831Smrg	BUILDPSDOC=yes
156033734831Smrgfi
156133734831SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
156233734831SmrgAC_MSG_RESULT([$BUILDPSDOC])
15630309d3b3Smrg
156433734831SmrgAC_MSG_CHECKING([whether to build HTML documentation])
156533734831Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
156633734831Smrg   test x$BUILD_HTMLDOC != xno; then
156733734831Smrg	BUILDHTMLDOC=yes
156833734831Smrgfi
156933734831SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
157033734831SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
15710309d3b3Smrg
157233734831SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
157333734831SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
157433734831SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
157533734831SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
157633734831Smrg
157733734831SmrgAC_SUBST(MAKE_TEXT)
157833734831SmrgAC_SUBST(MAKE_PS)
157933734831SmrgAC_SUBST(MAKE_PDF)
158033734831SmrgAC_SUBST(MAKE_HTML)
158133734831Smrg]) # XORG_CHECK_DOCBOOK
158233734831Smrg
158333734831Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
158433734831Smrg# ----------------
158533734831Smrg# Minimum version: 1.5.0
158633734831Smrg# Minimum version for optional DEFAULT argument: 1.11.0
158733734831Smrg#
158833734831Smrg# Documentation tools are not always available on all platforms and sometimes
158933734831Smrg# not at the appropriate level. This macro enables a module to test for the
159033734831Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
159133734831Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
159233734831Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
159333734831Smrg# --with-xmlto assumes 'auto'.
15940309d3b3Smrg#
159533734831Smrg# Interface to module:
159633734831Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
159733734831Smrg# XMLTO:	returns the path of the xmlto program found
159833734831Smrg#		returns the path set by the user in the environment
159933734831Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
160033734831Smrg#		'no' user instructs the module not to use xmlto
16010309d3b3Smrg#
160233734831Smrg# Added in version 1.10.0
160333734831Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
160433734831Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
16050309d3b3Smrg#
160633734831Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
160733734831Smrg#
160833734831SmrgAC_DEFUN([XORG_WITH_XMLTO],[
160933734831SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
161033734831Smrgm4_define([_defopt], m4_default([$2], [auto]))
161133734831SmrgAC_ARG_WITH(xmlto,
161233734831Smrg	AS_HELP_STRING([--with-xmlto],
161333734831Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
161433734831Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
161533734831Smrgm4_undefine([_defopt])
16160309d3b3Smrg
161733734831Smrgif test "x$use_xmlto" = x"auto"; then
161833734831Smrg   AC_PATH_PROG([XMLTO], [xmlto])
161933734831Smrg   if test "x$XMLTO" = "x"; then
162033734831Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
162133734831Smrg	have_xmlto=no
162233734831Smrg   else
162333734831Smrg        have_xmlto=yes
162433734831Smrg   fi
162533734831Smrgelif test "x$use_xmlto" = x"yes" ; then
162633734831Smrg   AC_PATH_PROG([XMLTO], [xmlto])
162733734831Smrg   if test "x$XMLTO" = "x"; then
162833734831Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
162933734831Smrg   fi
163033734831Smrg   have_xmlto=yes
163133734831Smrgelif test "x$use_xmlto" = x"no" ; then
163233734831Smrg   if test "x$XMLTO" != "x"; then
163333734831Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
163433734831Smrg   fi
163533734831Smrg   have_xmlto=no
16360309d3b3Smrgelse
163733734831Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
16380309d3b3Smrgfi
16390309d3b3Smrg
164033734831Smrg# Test for a minimum version of xmlto, if provided.
164133734831Smrgm4_ifval([$1],
164233734831Smrg[if test "$have_xmlto" = yes; then
164333734831Smrg    # scrape the xmlto version
164433734831Smrg    AC_MSG_CHECKING([the xmlto version])
164533734831Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
164633734831Smrg    AC_MSG_RESULT([$xmlto_version])
164733734831Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
164833734831Smrg        [if test "x$use_xmlto" = xauto; then
164933734831Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
165033734831Smrg            have_xmlto=no
165133734831Smrg        else
165233734831Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
165333734831Smrg        fi])
165433734831Smrgfi])
16550309d3b3Smrg
165633734831Smrg# Test for the ability of xmlto to generate a text target
165733734831Smrghave_xmlto_text=no
165833734831Smrgcat > conftest.xml << "EOF"
165933734831SmrgEOF
166033734831SmrgAS_IF([test "$have_xmlto" = yes],
166133734831Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
166233734831Smrg             [have_xmlto_text=yes],
166333734831Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
166433734831Smrgrm -f conftest.xml
166533734831SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
166633734831SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
166733734831Smrg]) # XORG_WITH_XMLTO
16680309d3b3Smrg
166933734831Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
167033734831Smrg# --------------------------------------------
167133734831Smrg# Minimum version: 1.12.0
167233734831Smrg# Minimum version for optional DEFAULT argument: 1.12.0
167333734831Smrg#
167433734831Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
167533734831Smrg# XML-based language used for the transformation of XML documents.
167633734831Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
167733734831Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
167833734831Smrg# The XSLT processor is often used as a standalone tool for transformations.
167933734831Smrg# It should not be assumed that this tool is used only to work with documnetation.
168033734831Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
168133734831Smrg#
168233734831Smrg# Interface to module:
168333734831Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
168433734831Smrg# XSLTPROC:	 returns the path of the xsltproc program found
168533734831Smrg#		 returns the path set by the user in the environment
168633734831Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
168733734831Smrg#		  'no' user instructs the module not to use xsltproc
168833734831Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
168933734831Smrg#
169033734831Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
169133734831Smrg#
169233734831SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
169333734831SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
169433734831Smrg# Preserves the interface, should it be implemented later
169533734831Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
169633734831Smrgm4_define([_defopt], m4_default([$2], [auto]))
169733734831SmrgAC_ARG_WITH(xsltproc,
169833734831Smrg	AS_HELP_STRING([--with-xsltproc],
169933734831Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
170033734831Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
170133734831Smrgm4_undefine([_defopt])
17020309d3b3Smrg
170333734831Smrgif test "x$use_xsltproc" = x"auto"; then
170433734831Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
170533734831Smrg   if test "x$XSLTPROC" = "x"; then
170633734831Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
170733734831Smrg	have_xsltproc=no
170833734831Smrg   else
170933734831Smrg        have_xsltproc=yes
171033734831Smrg   fi
171133734831Smrgelif test "x$use_xsltproc" = x"yes" ; then
171233734831Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
171333734831Smrg   if test "x$XSLTPROC" = "x"; then
171433734831Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
171533734831Smrg   fi
171633734831Smrg   have_xsltproc=yes
171733734831Smrgelif test "x$use_xsltproc" = x"no" ; then
171833734831Smrg   if test "x$XSLTPROC" != "x"; then
171933734831Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
172033734831Smrg   fi
172133734831Smrg   have_xsltproc=no
17220309d3b3Smrgelse
172333734831Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
17240309d3b3Smrgfi
17250309d3b3Smrg
172633734831SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
172733734831Smrg]) # XORG_WITH_XSLTPROC
17280309d3b3Smrg
172933734831Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
173033734831Smrg# ----------------------------------------
173133734831Smrg# Minimum version: 1.15.0
173254e0bb33Smrg#
173333734831Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
173433734831Smrg# scanning arbitrary text files, extracting information from those text files,
173533734831Smrg# and printing reports based on that information.
173654e0bb33Smrg#
173733734831Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
17380309d3b3Smrg#
173933734831Smrg# Interface to module:
174033734831Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
174133734831Smrg# PERL:	     returns the path of the perl program found
174233734831Smrg#	     returns the path set by the user in the environment
174333734831Smrg# --with-perl: 'yes' user instructs the module to use perl
174433734831Smrg#	       'no' user instructs the module not to use perl
174533734831Smrg# have_perl: returns yes if perl found in PATH or no
174654e0bb33Smrg#
174733734831Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
17480309d3b3Smrg#
174933734831SmrgAC_DEFUN([XORG_WITH_PERL],[
175033734831SmrgAC_ARG_VAR([PERL], [Path to perl command])
175133734831Smrg# Preserves the interface, should it be implemented later
175233734831Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
175333734831Smrgm4_define([_defopt], m4_default([$2], [auto]))
175433734831SmrgAC_ARG_WITH(perl,
175533734831Smrg	AS_HELP_STRING([--with-perl],
175633734831Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
175733734831Smrg	   [use_perl=$withval], [use_perl=]_defopt)
175833734831Smrgm4_undefine([_defopt])
1759b1297603Smrg
176033734831Smrgif test "x$use_perl" = x"auto"; then
176133734831Smrg   AC_PATH_PROG([PERL], [perl])
176233734831Smrg   if test "x$PERL" = "x"; then
176333734831Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
176433734831Smrg	have_perl=no
176533734831Smrg   else
176633734831Smrg        have_perl=yes
176733734831Smrg   fi
176833734831Smrgelif test "x$use_perl" = x"yes" ; then
176933734831Smrg   AC_PATH_PROG([PERL], [perl])
177033734831Smrg   if test "x$PERL" = "x"; then
177133734831Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
177233734831Smrg   fi
177333734831Smrg   have_perl=yes
177433734831Smrgelif test "x$use_perl" = x"no" ; then
177533734831Smrg   if test "x$PERL" != "x"; then
177633734831Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
177733734831Smrg   fi
177833734831Smrg   have_perl=no
177933734831Smrgelse
178033734831Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
178133734831Smrgfi
178253719b08Smrg
178333734831SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
178433734831Smrg]) # XORG_WITH_PERL
178553719b08Smrg
178633734831Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
178754e0bb33Smrg# ----------------
178833734831Smrg# Minimum version: 1.5.0
178933734831Smrg# Minimum version for optional DEFAULT argument: 1.11.0
179054e0bb33Smrg#
179133734831Smrg# Documentation tools are not always available on all platforms and sometimes
179233734831Smrg# not at the appropriate level. This macro enables a module to test for the
179333734831Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
179433734831Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
179533734831Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
179633734831Smrg# --with-asciidoc assumes 'auto'.
179754e0bb33Smrg#
179833734831Smrg# Interface to module:
179933734831Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
180033734831Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
180133734831Smrg#		 returns the path set by the user in the environment
180233734831Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
180333734831Smrg#		  'no' user instructs the module not to use asciidoc
180454e0bb33Smrg#
180533734831Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
180654e0bb33Smrg#
180733734831SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
180833734831SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
180933734831Smrgm4_define([_defopt], m4_default([$2], [auto]))
181033734831SmrgAC_ARG_WITH(asciidoc,
181133734831Smrg	AS_HELP_STRING([--with-asciidoc],
181233734831Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
181333734831Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
181433734831Smrgm4_undefine([_defopt])
1815cea37944Smrg
181633734831Smrgif test "x$use_asciidoc" = x"auto"; then
181733734831Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
181833734831Smrg   if test "x$ASCIIDOC" = "x"; then
181933734831Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
182033734831Smrg	have_asciidoc=no
182133734831Smrg   else
182233734831Smrg        have_asciidoc=yes
182333734831Smrg   fi
182433734831Smrgelif test "x$use_asciidoc" = x"yes" ; then
182533734831Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
182633734831Smrg   if test "x$ASCIIDOC" = "x"; then
182733734831Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
182833734831Smrg   fi
182933734831Smrg   have_asciidoc=yes
183033734831Smrgelif test "x$use_asciidoc" = x"no" ; then
183133734831Smrg   if test "x$ASCIIDOC" != "x"; then
183233734831Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
183333734831Smrg   fi
183433734831Smrg   have_asciidoc=no
183533734831Smrgelse
183633734831Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
183733734831Smrgfi
183833734831Smrgm4_ifval([$1],
183933734831Smrg[if test "$have_asciidoc" = yes; then
184033734831Smrg    # scrape the asciidoc version
184133734831Smrg    AC_MSG_CHECKING([the asciidoc version])
184233734831Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
184333734831Smrg    AC_MSG_RESULT([$asciidoc_version])
184433734831Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
184533734831Smrg        [if test "x$use_asciidoc" = xauto; then
184633734831Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
184733734831Smrg            have_asciidoc=no
184833734831Smrg        else
184933734831Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
185033734831Smrg        fi])
185133734831Smrgfi])
185233734831SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
185333734831Smrg]) # XORG_WITH_ASCIIDOC
18540309d3b3Smrg
185533734831Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
185633734831Smrg# --------------------------------
185733734831Smrg# Minimum version: 1.5.0
185833734831Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1859cea37944Smrg#
186033734831Smrg# Documentation tools are not always available on all platforms and sometimes
186133734831Smrg# not at the appropriate level. This macro enables a module to test for the
186233734831Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
186333734831Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
186433734831Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
186533734831Smrg# --with-doxygen assumes 'auto'.
1866cea37944Smrg#
186733734831Smrg# Interface to module:
186833734831Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
186933734831Smrg# DOXYGEN:	 returns the path of the doxygen program found
187033734831Smrg#		 returns the path set by the user in the environment
187133734831Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
187233734831Smrg#		  'no' user instructs the module not to use doxygen
1873cea37944Smrg#
187433734831Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1875cea37944Smrg#
187633734831SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
187733734831SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
187833734831Smrgm4_define([_defopt], m4_default([$2], [auto]))
187933734831SmrgAC_ARG_WITH(doxygen,
188033734831Smrg	AS_HELP_STRING([--with-doxygen],
188133734831Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
188233734831Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
188333734831Smrgm4_undefine([_defopt])
1884b1297603Smrg
188533734831Smrgif test "x$use_doxygen" = x"auto"; then
188633734831Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
188733734831Smrg   if test "x$DOXYGEN" = "x"; then
188833734831Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
188933734831Smrg	have_doxygen=no
189033734831Smrg   else
189133734831Smrg        have_doxygen=yes
189233734831Smrg   fi
189333734831Smrgelif test "x$use_doxygen" = x"yes" ; then
189433734831Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
189533734831Smrg   if test "x$DOXYGEN" = "x"; then
189633734831Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
189733734831Smrg   fi
189833734831Smrg   have_doxygen=yes
189933734831Smrgelif test "x$use_doxygen" = x"no" ; then
190033734831Smrg   if test "x$DOXYGEN" != "x"; then
190133734831Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
190233734831Smrg   fi
190333734831Smrg   have_doxygen=no
190433734831Smrgelse
190533734831Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
190633734831Smrgfi
190733734831Smrgm4_ifval([$1],
190833734831Smrg[if test "$have_doxygen" = yes; then
190933734831Smrg    # scrape the doxygen version
191033734831Smrg    AC_MSG_CHECKING([the doxygen version])
191133734831Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
191233734831Smrg    AC_MSG_RESULT([$doxygen_version])
191333734831Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
191433734831Smrg        [if test "x$use_doxygen" = xauto; then
191533734831Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
191633734831Smrg            have_doxygen=no
191733734831Smrg        else
191833734831Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
191933734831Smrg        fi])
192033734831Smrgfi])
192133734831SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
192233734831Smrg]) # XORG_WITH_DOXYGEN
192354e0bb33Smrg
192433734831Smrg# XORG_WITH_GROFF([DEFAULT])
192533734831Smrg# ----------------
192633734831Smrg# Minimum version: 1.6.0
192733734831Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1928cea37944Smrg#
192933734831Smrg# Documentation tools are not always available on all platforms and sometimes
193033734831Smrg# not at the appropriate level. This macro enables a module to test for the
193133734831Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
193233734831Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
193333734831Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
193433734831Smrg# --with-groff assumes 'auto'.
193533734831Smrg#
193633734831Smrg# Interface to module:
193733734831Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
193833734831Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
193933734831Smrg# HAVE_GROFF_MS: the -ms macros package
194033734831Smrg# GROFF:	 returns the path of the groff program found
194133734831Smrg#		 returns the path set by the user in the environment
194233734831Smrg# --with-groff:	 'yes' user instructs the module to use groff
194333734831Smrg#		 'no' user instructs the module not to use groff
194433734831Smrg#
194533734831Smrg# Added in version 1.9.0:
194633734831Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
194733734831Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
194833734831Smrg#		   psselect from the psutils package.
194933734831Smrg#		   the ghostcript package. Refer to the grohtml man pages
195033734831Smrg#
195133734831Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
195233734831Smrg#
195333734831Smrg# OS and distros often splits groff in a basic and full package, the former
195433734831Smrg# having the groff program and the later having devices, fonts and macros
195533734831Smrg# Checking for the groff executable is not enough.
195633734831Smrg#
195733734831Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
195833734831Smrg# unset HAVE_GROFF or GROFF env variables.
195933734831Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
196033734831Smrg#
196133734831SmrgAC_DEFUN([XORG_WITH_GROFF],[
196233734831SmrgAC_ARG_VAR([GROFF], [Path to groff command])
196333734831Smrgm4_define([_defopt], m4_default([$1], [auto]))
196433734831SmrgAC_ARG_WITH(groff,
196533734831Smrg	AS_HELP_STRING([--with-groff],
196633734831Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
196733734831Smrg	   [use_groff=$withval], [use_groff=]_defopt)
196833734831Smrgm4_undefine([_defopt])
196954e0bb33Smrg
197033734831Smrgif test "x$use_groff" = x"auto"; then
197133734831Smrg   AC_PATH_PROG([GROFF], [groff])
197233734831Smrg   if test "x$GROFF" = "x"; then
197333734831Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
197433734831Smrg	have_groff=no
197533734831Smrg   else
197633734831Smrg        have_groff=yes
197733734831Smrg   fi
197833734831Smrgelif test "x$use_groff" = x"yes" ; then
197933734831Smrg   AC_PATH_PROG([GROFF], [groff])
198033734831Smrg   if test "x$GROFF" = "x"; then
198133734831Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
198233734831Smrg   fi
198333734831Smrg   have_groff=yes
198433734831Smrgelif test "x$use_groff" = x"no" ; then
198533734831Smrg   if test "x$GROFF" != "x"; then
198633734831Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
198733734831Smrg   fi
198833734831Smrg   have_groff=no
1989cea37944Smrgelse
199033734831Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
19915b944e2aSmrgfi
1992cea37944Smrg
199333734831Smrg# We have groff, test for the presence of the macro packages
199433734831Smrgif test "x$have_groff" = x"yes"; then
199533734831Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
199633734831Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
199733734831Smrg        groff_ms_works=yes
199833734831Smrg    else
199933734831Smrg        groff_ms_works=no
200033734831Smrg    fi
200133734831Smrg    AC_MSG_RESULT([$groff_ms_works])
200233734831Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
200333734831Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
200433734831Smrg        groff_mm_works=yes
200533734831Smrg    else
200633734831Smrg        groff_mm_works=no
200733734831Smrg    fi
200833734831Smrg    AC_MSG_RESULT([$groff_mm_works])
200933734831Smrgfi
201054e0bb33Smrg
201133734831Smrg# We have groff, test for HTML dependencies, one command per package
201233734831Smrgif test "x$have_groff" = x"yes"; then
201333734831Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
201433734831Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
201533734831Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
201633734831Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
201733734831Smrg      have_groff_html=yes
201833734831Smrg   else
201933734831Smrg      have_groff_html=no
202033734831Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
202133734831Smrg   fi
202233734831Smrgfi
202354e0bb33Smrg
202433734831Smrg# Set Automake conditionals for Makefiles
202533734831SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
202633734831SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
202733734831SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
202833734831SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
202933734831Smrg]) # XORG_WITH_GROFF
203054e0bb33Smrg
203133734831Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
203233734831Smrg# ---------------------------------------
203333734831Smrg# Minimum version: 1.6.0
203433734831Smrg# Minimum version for optional DEFAULT argument: 1.11.0
203533734831Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
203654e0bb33Smrg#
203733734831Smrg# Documentation tools are not always available on all platforms and sometimes
203833734831Smrg# not at the appropriate level. This macro enables a module to test for the
203933734831Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
204033734831Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
204133734831Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
204233734831Smrg# --with-fop assumes 'auto'.
204333734831Smrg#
204433734831Smrg# Interface to module:
204533734831Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
204633734831Smrg# FOP:	 	returns the path of the fop program found
204733734831Smrg#		returns the path set by the user in the environment
204833734831Smrg# --with-fop: 	'yes' user instructs the module to use fop
204933734831Smrg#		'no' user instructs the module not to use fop
205033734831Smrg#
205133734831Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
205233734831Smrg#
205333734831SmrgAC_DEFUN([XORG_WITH_FOP],[
205433734831SmrgAC_ARG_VAR([FOP], [Path to fop command])
205533734831Smrgm4_define([_defopt], m4_default([$2], [auto]))
205633734831SmrgAC_ARG_WITH(fop,
205733734831Smrg	AS_HELP_STRING([--with-fop],
205833734831Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
205933734831Smrg	   [use_fop=$withval], [use_fop=]_defopt)
206033734831Smrgm4_undefine([_defopt])
206154e0bb33Smrg
206233734831Smrgif test "x$use_fop" = x"auto"; then
206333734831Smrg   AC_PATH_PROG([FOP], [fop])
206433734831Smrg   if test "x$FOP" = "x"; then
206533734831Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
206633734831Smrg	have_fop=no
206733734831Smrg   else
206833734831Smrg        have_fop=yes
206933734831Smrg   fi
207033734831Smrgelif test "x$use_fop" = x"yes" ; then
207133734831Smrg   AC_PATH_PROG([FOP], [fop])
207233734831Smrg   if test "x$FOP" = "x"; then
207333734831Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
207433734831Smrg   fi
207533734831Smrg   have_fop=yes
207633734831Smrgelif test "x$use_fop" = x"no" ; then
207733734831Smrg   if test "x$FOP" != "x"; then
207833734831Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
207933734831Smrg   fi
208033734831Smrg   have_fop=no
208133734831Smrgelse
208233734831Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
208333734831Smrgfi
208454e0bb33Smrg
208533734831Smrg# Test for a minimum version of fop, if provided.
208633734831Smrgm4_ifval([$1],
208733734831Smrg[if test "$have_fop" = yes; then
208833734831Smrg    # scrape the fop version
208933734831Smrg    AC_MSG_CHECKING([for fop minimum version])
209033734831Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
209133734831Smrg    AC_MSG_RESULT([$fop_version])
209233734831Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
209333734831Smrg        [if test "x$use_fop" = xauto; then
209433734831Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
209533734831Smrg            have_fop=no
209633734831Smrg        else
209733734831Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
209833734831Smrg        fi])
209933734831Smrgfi])
210033734831SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
210133734831Smrg]) # XORG_WITH_FOP
210254e0bb33Smrg
210333734831Smrg# XORG_WITH_PS2PDF([DEFAULT])
210433734831Smrg# ----------------
210533734831Smrg# Minimum version: 1.6.0
210633734831Smrg# Minimum version for optional DEFAULT argument: 1.11.0
210733734831Smrg#
210833734831Smrg# Documentation tools are not always available on all platforms and sometimes
210933734831Smrg# not at the appropriate level. This macro enables a module to test for the
211033734831Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
211133734831Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
211233734831Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
211333734831Smrg# --with-ps2pdf assumes 'auto'.
211433734831Smrg#
211533734831Smrg# Interface to module:
211633734831Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
211733734831Smrg# PS2PDF:	returns the path of the ps2pdf program found
211833734831Smrg#		returns the path set by the user in the environment
211933734831Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
212033734831Smrg#		 'no' user instructs the module not to use ps2pdf
212133734831Smrg#
212233734831Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
212333734831Smrg#
212433734831SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
212533734831SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
212633734831Smrgm4_define([_defopt], m4_default([$1], [auto]))
212733734831SmrgAC_ARG_WITH(ps2pdf,
212833734831Smrg	AS_HELP_STRING([--with-ps2pdf],
212933734831Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
213033734831Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
213133734831Smrgm4_undefine([_defopt])
213254e0bb33Smrg
213333734831Smrgif test "x$use_ps2pdf" = x"auto"; then
213433734831Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
213533734831Smrg   if test "x$PS2PDF" = "x"; then
213633734831Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
213733734831Smrg	have_ps2pdf=no
213833734831Smrg   else
213933734831Smrg        have_ps2pdf=yes
214033734831Smrg   fi
214133734831Smrgelif test "x$use_ps2pdf" = x"yes" ; then
214233734831Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
214333734831Smrg   if test "x$PS2PDF" = "x"; then
214433734831Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
214533734831Smrg   fi
214633734831Smrg   have_ps2pdf=yes
214733734831Smrgelif test "x$use_ps2pdf" = x"no" ; then
214833734831Smrg   if test "x$PS2PDF" != "x"; then
214933734831Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
215033734831Smrg   fi
215133734831Smrg   have_ps2pdf=no
2152cea37944Smrgelse
215333734831Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2154cea37944Smrgfi
215533734831SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
215633734831Smrg]) # XORG_WITH_PS2PDF
215754e0bb33Smrg
215833734831Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
215933734831Smrg# ----------------
216033734831Smrg# Minimum version: 1.6.0
2161cea37944Smrg#
216233734831Smrg# Documentation tools are not always available on all platforms and sometimes
216333734831Smrg# not at the appropriate level. This macro enables a builder to skip all
216433734831Smrg# documentation targets except traditional man pages.
216533734831Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
216633734831Smrg# maximum flexibilty in controlling documentation building.
216733734831Smrg# Refer to:
216833734831Smrg# XORG_WITH_XMLTO         --with-xmlto
216933734831Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
217033734831Smrg# XORG_WITH_DOXYGEN       --with-doxygen
217133734831Smrg# XORG_WITH_FOP           --with-fop
217233734831Smrg# XORG_WITH_GROFF         --with-groff
217333734831Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
217433734831Smrg#
217533734831Smrg# Interface to module:
217633734831Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
217733734831Smrg# --enable-docs: 'yes' user instructs the module to generate docs
217833734831Smrg#		 'no' user instructs the module not to generate docs
217933734831Smrg# parm1:	specify the default value, yes or no.
218033734831Smrg#
218133734831SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
218233734831Smrgm4_define([docs_default], m4_default([$1], [yes]))
218333734831SmrgAC_ARG_ENABLE(docs,
218433734831Smrg	AS_HELP_STRING([--enable-docs],
218533734831Smrg	   [Enable building the documentation (default: ]docs_default[)]),
218633734831Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
218733734831Smrgm4_undefine([docs_default])
218833734831SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
218933734831SmrgAC_MSG_CHECKING([whether to build documentation])
219033734831SmrgAC_MSG_RESULT([$build_docs])
219133734831Smrg]) # XORG_ENABLE_DOCS
2192b1297603Smrg
219333734831Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
219433734831Smrg# ----------------
219533734831Smrg# Minimum version: 1.6.0
219633734831Smrg#
219733734831Smrg# This macro enables a builder to skip all developer documentation.
219833734831Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
219933734831Smrg# maximum flexibilty in controlling documentation building.
220033734831Smrg# Refer to:
220133734831Smrg# XORG_WITH_XMLTO         --with-xmlto
220233734831Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
220333734831Smrg# XORG_WITH_DOXYGEN       --with-doxygen
220433734831Smrg# XORG_WITH_FOP           --with-fop
220533734831Smrg# XORG_WITH_GROFF         --with-groff
220633734831Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
220733734831Smrg#
220833734831Smrg# Interface to module:
220933734831Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
221033734831Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
221133734831Smrg#			'no' user instructs the module not to generate developer docs
221233734831Smrg# parm1:		specify the default value, yes or no.
2213b1297603Smrg#
221433734831SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
221533734831Smrgm4_define([devel_default], m4_default([$1], [yes]))
221633734831SmrgAC_ARG_ENABLE(devel-docs,
221733734831Smrg	AS_HELP_STRING([--enable-devel-docs],
221833734831Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
221933734831Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
222033734831Smrgm4_undefine([devel_default])
222133734831SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
222233734831SmrgAC_MSG_CHECKING([whether to build developer documentation])
222333734831SmrgAC_MSG_RESULT([$build_devel_docs])
222433734831Smrg]) # XORG_ENABLE_DEVEL_DOCS
222554e0bb33Smrg
222633734831Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
222733734831Smrg# ----------------
222833734831Smrg# Minimum version: 1.6.0
222933734831Smrg#
223033734831Smrg# This macro enables a builder to skip all functional specification targets.
223133734831Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
223233734831Smrg# maximum flexibilty in controlling documentation building.
223333734831Smrg# Refer to:
223433734831Smrg# XORG_WITH_XMLTO         --with-xmlto
223533734831Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
223633734831Smrg# XORG_WITH_DOXYGEN       --with-doxygen
223733734831Smrg# XORG_WITH_FOP           --with-fop
223833734831Smrg# XORG_WITH_GROFF         --with-groff
223933734831Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
224033734831Smrg#
224133734831Smrg# Interface to module:
224233734831Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
224333734831Smrg# --enable-specs:	'yes' user instructs the module to generate specs
224433734831Smrg#			'no' user instructs the module not to generate specs
224533734831Smrg# parm1:		specify the default value, yes or no.
224633734831Smrg#
224733734831SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
224833734831Smrgm4_define([spec_default], m4_default([$1], [yes]))
224933734831SmrgAC_ARG_ENABLE(specs,
225033734831Smrg	AS_HELP_STRING([--enable-specs],
225133734831Smrg	   [Enable building the specs (default: ]spec_default[)]),
225233734831Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
225333734831Smrgm4_undefine([spec_default])
225433734831SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
225533734831SmrgAC_MSG_CHECKING([whether to build functional specifications])
225633734831SmrgAC_MSG_RESULT([$build_specs])
225733734831Smrg]) # XORG_ENABLE_SPECS
225854e0bb33Smrg
225933734831Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
226033734831Smrg# ----------------------------------------------
226133734831Smrg# Minimum version: 1.13.0
2262cea37944Smrg#
226333734831Smrg# This macro enables a builder to enable/disable unit testing
226433734831Smrg# It makes no assumption about the test cases implementation
226533734831Smrg# Test cases may or may not use Automake "Support for test suites"
226633734831Smrg# They may or may not use the software utility library GLib
226733734831Smrg#
226833734831Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
226933734831Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
227033734831Smrg# The variable enable_unit_tests is used by other macros in this file.
227133734831Smrg#
227233734831Smrg# Interface to module:
227333734831Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
227433734831Smrg# enable_unit_tests:    used in configure.ac for additional configuration
227533734831Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
227633734831Smrg#			'no' user instructs the module not to build tests
227733734831Smrg# parm1:		specify the default value, yes or no.
227833734831Smrg#
227933734831SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
228033734831SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
228133734831SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
228233734831SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
228333734831Smrgm4_define([_defopt], m4_default([$1], [auto]))
228433734831SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
228533734831Smrg	[Enable building unit test cases (default: ]_defopt[)]),
228633734831Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
228733734831Smrgm4_undefine([_defopt])
228833734831SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
228933734831SmrgAC_MSG_CHECKING([whether to build unit test cases])
229033734831SmrgAC_MSG_RESULT([$enable_unit_tests])
229133734831Smrg]) # XORG_ENABLE_UNIT_TESTS
2292cea37944Smrg
229333734831Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
229433734831Smrg# ------------------------------------------------------
229533734831Smrg# Minimum version: 1.17.0
229633734831Smrg#
229733734831Smrg# This macro enables a builder to enable/disable integration testing
229833734831Smrg# It makes no assumption about the test cases' implementation
229933734831Smrg# Test cases may or may not use Automake "Support for test suites"
230033734831Smrg#
230133734831Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
230233734831Smrg# usually requires less dependencies and may be built and run under less
230333734831Smrg# stringent environments than integration tests.
230433734831Smrg#
230533734831Smrg# Interface to module:
230633734831Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
230733734831Smrg# enable_integration_tests:   used in configure.ac for additional configuration
230833734831Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
230933734831Smrg#                             'no' user instructs the module not to build tests
231033734831Smrg# parm1:                      specify the default value, yes or no.
231133734831Smrg#
231233734831SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
231333734831SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
231433734831Smrgm4_define([_defopt], m4_default([$1], [auto]))
231533734831SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
231633734831Smrg	[Enable building integration test cases (default: ]_defopt[)]),
231733734831Smrg	[enable_integration_tests=$enableval],
231833734831Smrg	[enable_integration_tests=]_defopt)
231933734831Smrgm4_undefine([_defopt])
232033734831SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
232133734831Smrg	[test "x$enable_integration_tests" != xno])
232233734831SmrgAC_MSG_CHECKING([whether to build unit test cases])
232333734831SmrgAC_MSG_RESULT([$enable_integration_tests])
232433734831Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
232554e0bb33Smrg
232633734831Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
232733734831Smrg# ----------------------------------------
232833734831Smrg# Minimum version: 1.13.0
232933734831Smrg#
233033734831Smrg# GLib is a library which provides advanced data structures and functions.
233133734831Smrg# This macro enables a module to test for the presence of Glib.
233233734831Smrg#
233333734831Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
233433734831Smrg# Otherwise the value of $enable_unit_tests is blank.
233533734831Smrg#
233633734831Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
233733734831Smrg# test support usually requires less dependencies and may be built and run under
233833734831Smrg# less stringent environments than integration tests.
233933734831Smrg#
234033734831Smrg# Interface to module:
234133734831Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
234233734831Smrg# with_glib: used in configure.ac to know if GLib has been found
234333734831Smrg# --with-glib:	'yes' user instructs the module to use glib
234433734831Smrg#		'no' user instructs the module not to use glib
234533734831Smrg#
234633734831SmrgAC_DEFUN([XORG_WITH_GLIB],[
234733734831SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
234833734831Smrgm4_define([_defopt], m4_default([$2], [auto]))
234933734831SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
235033734831Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
235133734831Smrg	[with_glib=$withval], [with_glib=]_defopt)
235233734831Smrgm4_undefine([_defopt])
235354e0bb33Smrg
235433734831Smrghave_glib=no
235533734831Smrg# Do not probe GLib if user explicitly disabled unit testing
235633734831Smrgif test "x$enable_unit_tests" != x"no"; then
235733734831Smrg  # Do not probe GLib if user explicitly disabled it
235833734831Smrg  if test "x$with_glib" != x"no"; then
235933734831Smrg    m4_ifval(
236033734831Smrg      [$1],
236133734831Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
236233734831Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
236333734831Smrg    )
236454e0bb33Smrg  fi
2365cea37944Smrgfi
236653719b08Smrg
236733734831Smrg# Not having GLib when unit testing has been explicitly requested is an error
236833734831Smrgif test "x$enable_unit_tests" = x"yes"; then
236933734831Smrg  if test "x$have_glib" = x"no"; then
237033734831Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
237154e0bb33Smrg  fi
237254e0bb33Smrgfi
237354e0bb33Smrg
237433734831Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
237533734831Smrgif test "x$enable_unit_tests" = x"no"; then
237633734831Smrg  if test "x$with_glib" = x"yes"; then
237733734831Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
237833734831Smrg  fi
237933734831Smrgfi
238033734831Smrg
238133734831Smrg# Not having GLib when it has been explicitly requested is an error
238233734831Smrgif test "x$with_glib" = x"yes"; then
238333734831Smrg  if test "x$have_glib" = x"no"; then
238433734831Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
238533734831Smrg  fi
2386cea37944Smrgfi
2387cea37944Smrg
238833734831SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
238933734831Smrg]) # XORG_WITH_GLIB
239054e0bb33Smrg
239133734831Smrg# XORG_LD_WRAP([required|optional])
239233734831Smrg# ---------------------------------
239333734831Smrg# Minimum version: 1.13.0
239433734831Smrg#
239533734831Smrg# Check if linker supports -wrap, passed via compiler flags
239633734831Smrg#
239733734831Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
239833734831Smrg# Otherwise the value of $enable_unit_tests is blank.
239933734831Smrg#
240033734831Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
240133734831Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
240233734831Smrg# available, an argument of "optional" allows use when some unit tests require
240333734831Smrg# ld -wrap and others do not.
240433734831Smrg#
240533734831SmrgAC_DEFUN([XORG_LD_WRAP],[
240633734831SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
240733734831Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
240833734831Smrg                      void __wrap_exit(int status) { return; }],
240933734831Smrg                     [exit(0);])])
241033734831Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
241133734831Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
241233734831Smrg  if test "x$have_ld_wrap" = x"no"; then
241333734831Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
241433734831Smrg  fi
241533734831Smrgfi
241633734831SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
241733734831Smrg#
241833734831Smrg]) # XORG_LD_WRAP
241954e0bb33Smrg
242033734831Smrg# XORG_CHECK_LINKER_FLAGS
242133734831Smrg# -----------------------
242233734831Smrg# SYNOPSIS
242333734831Smrg#
242433734831Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
242533734831Smrg#
242633734831Smrg# DESCRIPTION
242733734831Smrg#
242833734831Smrg#   Check whether the given linker FLAGS work with the current language's
242933734831Smrg#   linker, or whether they give an error.
243033734831Smrg#
243133734831Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
243233734831Smrg#   success/failure.
243333734831Smrg#
243433734831Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
243533734831Smrg#
243633734831Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
243733734831Smrg#
243833734831Smrg# LICENSE
243933734831Smrg#
244033734831Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
244133734831Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
244233734831Smrg#   Copyright (c) 2009 Matteo Frigo
244333734831Smrg#
244433734831Smrg#   This program is free software: you can redistribute it and/or modify it
244533734831Smrg#   under the terms of the GNU General Public License as published by the
244633734831Smrg#   Free Software Foundation, either version 3 of the License, or (at your
244733734831Smrg#   option) any later version.
244833734831Smrg#
244933734831Smrg#   This program is distributed in the hope that it will be useful, but
245033734831Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
245133734831Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
245233734831Smrg#   Public License for more details.
245333734831Smrg#
245433734831Smrg#   You should have received a copy of the GNU General Public License along
245533734831Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
245633734831Smrg#
245733734831Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
245833734831Smrg#   gives unlimited permission to copy, distribute and modify the configure
245933734831Smrg#   scripts that are the output of Autoconf when processing the Macro. You
246033734831Smrg#   need not follow the terms of the GNU General Public License when using
246133734831Smrg#   or distributing such scripts, even though portions of the text of the
246233734831Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
246333734831Smrg#   all other use of the material that constitutes the Autoconf Macro.
246433734831Smrg#
246533734831Smrg#   This special exception to the GPL applies to versions of the Autoconf
246633734831Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
246733734831Smrg#   modified version of the Autoconf Macro, you may extend this special
246833734831Smrg#   exception to the GPL to apply to your modified version as well.#
246933734831SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
247033734831Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
247133734831Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
247233734831SmrgAS_LITERAL_IF([$1],
247333734831Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
247433734831Smrg      ax_save_FLAGS=$LDFLAGS
247533734831Smrg      LDFLAGS="$1"
247633734831Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
247733734831Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
247833734831Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
247933734831Smrg      LDFLAGS=$ax_save_FLAGS])],
248033734831Smrg  [ax_save_FLAGS=$LDFLAGS
248133734831Smrg   LDFLAGS="$1"
248233734831Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
248333734831Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
248433734831Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
248533734831Smrg   LDFLAGS=$ax_save_FLAGS])
248633734831Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
248733734831SmrgAC_MSG_RESULT($xorg_check_linker_flags)
248833734831Smrgif test "x$xorg_check_linker_flags" = xyes; then
248933734831Smrg	m4_default([$2], :)
249054e0bb33Smrgelse
249133734831Smrg	m4_default([$3], :)
2492cea37944Smrgfi
249333734831Smrg]) # XORG_CHECK_LINKER_FLAGS
249454e0bb33Smrg
249533734831Smrg# XORG_MEMORY_CHECK_FLAGS
249633734831Smrg# -----------------------
249733734831Smrg# Minimum version: 1.16.0
2498cea37944Smrg#
249933734831Smrg# This macro attempts to find appropriate memory checking functionality
250033734831Smrg# for various platforms which unit testing code may use to catch various
250133734831Smrg# forms of memory allocation and access errors in testing.
250233734831Smrg#
250333734831Smrg# Interface to module:
250433734831Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
250533734831Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
250633734831Smrg#
250733734831Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
250833734831Smrg#
250933734831SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
251054e0bb33Smrg
251133734831SmrgAC_REQUIRE([AC_CANONICAL_HOST])
251233734831SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
251333734831Smrg           [Environment variables to enable memory checking in tests])
251454e0bb33Smrg
251533734831Smrg# Check for different types of support on different platforms
251633734831Smrgcase $host_os in
251733734831Smrg    solaris*)
251833734831Smrg        AC_CHECK_LIB([umem], [umem_alloc],
251933734831Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
252033734831Smrg        ;;
252133734831Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
252233734831Smrg        # both directly and inverted, so should not be 0 or 255.
252333734831Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
252433734831Smrg        ;;
252533734831Smrg    darwin*)
252633734831Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
252733734831Smrg        ;;
252833734831Smrg    *bsd*)
252933734831Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
253033734831Smrg        ;;
253133734831Smrgesac
253254e0bb33Smrg
253333734831Smrg# User supplied flags override default flags
253433734831Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
253533734831Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
253633734831Smrgfi
253754e0bb33Smrg
253833734831SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
253933734831Smrg]) # XORG_WITH_LINT
254054e0bb33Smrg
254133734831Smrg# XORG_CHECK_MALLOC_ZERO
254233734831Smrg# ----------------------
254333734831Smrg# Minimum version: 1.0.0
2544cea37944Smrg#
254533734831Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
254633734831Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
254733734831Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
254833734831SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
254933734831SmrgAC_ARG_ENABLE(malloc0returnsnull,
255033734831Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
255133734831Smrg		       [malloc(0) returns NULL (default: auto)]),
255233734831Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
255333734831Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
255454e0bb33Smrg
255533734831SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
255633734831Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
255733734831Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
255833734831Smrg#include <stdlib.h>
255933734831Smrg],[
256033734831Smrg    char *m0, *r0, *c0, *p;
256133734831Smrg    m0 = malloc(0);
256233734831Smrg    p = malloc(10);
256333734831Smrg    r0 = realloc(p,0);
256433734831Smrg    c0 = calloc(0,10);
256533734831Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
256633734831Smrg])],
256733734831Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
256833734831Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
256933734831Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
257033734831Smrgfi
257133734831SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
257254e0bb33Smrg
257333734831Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
257433734831Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
257533734831Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
257633734831Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
257733734831Smrgelse
257833734831Smrg	MALLOC_ZERO_CFLAGS=""
257933734831Smrg	XMALLOC_ZERO_CFLAGS=""
258033734831Smrg	XTMALLOC_ZERO_CFLAGS=""
2581cea37944Smrgfi
258253719b08Smrg
258333734831SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
258433734831SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
258533734831SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
258633734831Smrg]) # XORG_CHECK_MALLOC_ZERO
258754e0bb33Smrg
258833734831Smrg# XORG_WITH_LINT()
258933734831Smrg# ----------------
259033734831Smrg# Minimum version: 1.1.0
2591cea37944Smrg#
259233734831Smrg# This macro enables the use of a tool that flags some suspicious and
259333734831Smrg# non-portable constructs (likely to be bugs) in C language source code.
259433734831Smrg# It will attempt to locate the tool and use appropriate options.
259533734831Smrg# There are various lint type tools on different platforms.
259633734831Smrg#
259733734831Smrg# Interface to module:
259833734831Smrg# LINT:		returns the path to the tool found on the platform
259933734831Smrg#		or the value set to LINT on the configure cmd line
260033734831Smrg#		also an Automake conditional
260133734831Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
260233734831Smrg#
260333734831Smrg# --with-lint:	'yes' user instructs the module to use lint
260433734831Smrg#		'no' user instructs the module not to use lint (default)
260533734831Smrg#
260633734831Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
260733734831Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
260833734831Smrg#
260933734831SmrgAC_DEFUN([XORG_WITH_LINT],[
261054e0bb33Smrg
261133734831SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
261233734831SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
261333734831SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
261433734831Smrg		[Use a lint-style source code checker (default: disabled)])],
261533734831Smrg		[use_lint=$withval], [use_lint=no])
261654e0bb33Smrg
261733734831Smrg# Obtain platform specific info like program name and options
261833734831Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
261933734831Smrgcase $host_os in
262033734831Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
262133734831Smrg	lint_name=splint
262233734831Smrg	lint_options="-badflag"
262333734831Smrg	;;
262433734831Smrg  *freebsd* | *netbsd*)
262533734831Smrg	lint_name=lint
262633734831Smrg	lint_options="-u -b"
262733734831Smrg	;;
262833734831Smrg  *solaris*)
262933734831Smrg	lint_name=lint
263033734831Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
263133734831Smrg	;;
263233734831Smrgesac
263354e0bb33Smrg
263433734831Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
263533734831Smrgif test "x$use_lint" = x"yes" ; then
263633734831Smrg   AC_PATH_PROG([LINT], [$lint_name])
263733734831Smrg   if test "x$LINT" = "x"; then
263833734831Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
263933734831Smrg   fi
264033734831Smrgelif test "x$use_lint" = x"no" ; then
264133734831Smrg   if test "x$LINT" != "x"; then
264233734831Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
264333734831Smrg   fi
2644cea37944Smrgelse
264533734831Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2646cea37944Smrgfi
264753719b08Smrg
264833734831Smrg# User supplied flags override default flags
264933734831Smrgif test "x$LINT_FLAGS" != "x"; then
265033734831Smrg   lint_options=$LINT_FLAGS
265133734831Smrgfi
265233734831Smrg
265333734831SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
265433734831SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
265533734831Smrg
265633734831Smrg]) # XORG_WITH_LINT
265733734831Smrg
265833734831Smrg# XORG_LINT_LIBRARY(LIBNAME)
265933734831Smrg# --------------------------
266033734831Smrg# Minimum version: 1.1.0
2661cea37944Smrg#
266233734831Smrg# Sets up flags for building lint libraries for checking programs that call
266333734831Smrg# functions in the library.
266433734831Smrg#
266533734831Smrg# Interface to module:
266633734831Smrg# LINTLIB		- Automake variable with the name of lint library file to make
266733734831Smrg# MAKE_LINT_LIB		- Automake conditional
266833734831Smrg#
266933734831Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
267033734831Smrg#			  - 'no' user instructs the module not to create a lint library (default)
267154e0bb33Smrg
267233734831SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
267333734831SmrgAC_REQUIRE([XORG_WITH_LINT])
267433734831SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
267533734831Smrg	[Create lint library (default: disabled)])],
267633734831Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
26770309d3b3Smrg
267833734831Smrgif test "x$make_lint_lib" = x"yes" ; then
267933734831Smrg   LINTLIB=llib-l$1.ln
268033734831Smrg   if test "x$LINT" = "x"; then
268133734831Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
268233734831Smrg   fi
268333734831Smrgelif test "x$make_lint_lib" != x"no" ; then
268433734831Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
268533734831Smrgfi
268654e0bb33Smrg
268733734831SmrgAC_SUBST(LINTLIB)
268833734831SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
268954e0bb33Smrg
269033734831Smrg]) # XORG_LINT_LIBRARY
269154e0bb33Smrg
269233734831Smrg# XORG_COMPILER_BRAND
269333734831Smrg# -------------------
269433734831Smrg# Minimum version: 1.14.0
269533734831Smrg#
269633734831Smrg# Checks for various brands of compilers and sets flags as appropriate:
269733734831Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
269833734831Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
269933734831Smrg#   clang compiler - sets CLANGCC to "yes"
270033734831Smrg#   Intel compiler - sets INTELCC to "yes"
270133734831Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
270233734831Smrg#
270333734831SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
270433734831SmrgAC_LANG_CASE(
270533734831Smrg	[C], [
270633734831Smrg		AC_REQUIRE([AC_PROG_CC_C99])
270733734831Smrg	],
270833734831Smrg	[C++], [
270933734831Smrg		AC_REQUIRE([AC_PROG_CXX])
271033734831Smrg	]
271133734831Smrg)
271233734831SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
271333734831SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
271433734831SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
271533734831Smrg]) # XORG_COMPILER_BRAND
271654e0bb33Smrg
271733734831Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
271833734831Smrg# ---------------
271933734831Smrg# Minimum version: 1.16.0
272033734831Smrg#
272133734831Smrg# Test if the compiler works when passed the given flag as a command line argument.
272233734831Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
272333734831Smrg# next flag in the list until there are no more options.
272433734831Smrg#
272533734831Smrg# Note that this does not guarantee that the compiler supports the flag as some
272633734831Smrg# compilers will simply ignore arguments that they do not understand, but we do
272733734831Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
272833734831Smrg# -Werror=unused-command-line-argument
272933734831Smrg#
273033734831SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
273133734831Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
273233734831Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
273354e0bb33Smrg
273433734831SmrgAC_LANG_COMPILER_REQUIRE
273533734831Smrg
273633734831SmrgAC_LANG_CASE(
273733734831Smrg	[C], [
273833734831Smrg		AC_REQUIRE([AC_PROG_CC_C99])
273933734831Smrg		define([PREFIX], [C])
274033734831Smrg		define([CACHE_PREFIX], [cc])
274133734831Smrg		define([COMPILER], [$CC])
274233734831Smrg	],
274333734831Smrg	[C++], [
274433734831Smrg		define([PREFIX], [CXX])
274533734831Smrg		define([CACHE_PREFIX], [cxx])
274633734831Smrg		define([COMPILER], [$CXX])
274733734831Smrg	]
274833734831Smrg)
274954e0bb33Smrg
275033734831Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
275133734831Smrg
275233734831Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
275333734831Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
275433734831Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
275533734831Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
275633734831Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
275733734831Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
275833734831Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
275933734831Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
276033734831Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
276133734831Smrgfi
276254e0bb33Smrg
276333734831Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
276433734831Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
276533734831Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
276633734831Smrg	fi
276733734831Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
276833734831Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
276933734831Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
277033734831Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
277133734831Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
277233734831Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
277333734831Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
277433734831Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
277533734831Smrgfi
277654e0bb33Smrg
277733734831Smrgfound="no"
277833734831Smrgm4_foreach([flag], m4_cdr($@), [
277933734831Smrg	if test $found = "no" ; then
278033734831Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
278133734831Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
278233734831Smrg		fi
278354e0bb33Smrg
278433734831Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
278533734831Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
278633734831Smrg		fi
2787b1297603Smrg
278833734831Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
278953719b08Smrg
279033734831Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
279133734831Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
279233734831Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
279333734831Smrg		AC_CACHE_VAL($cacheid,
279433734831Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
279533734831Smrg					     [eval $cacheid=yes],
279633734831Smrg					     [eval $cacheid=no])])
279753719b08Smrg
279833734831Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27995b944e2aSmrg
280033734831Smrg		eval supported=\$$cacheid
280133734831Smrg		AC_MSG_RESULT([$supported])
280233734831Smrg		if test "$supported" = "yes" ; then
280333734831Smrg			$1="$$1 ]flag["
280433734831Smrg			found="yes"
280533734831Smrg		fi
280633734831Smrg	fi
280733734831Smrg])
280833734831Smrg]) # XORG_TESTSET_CFLAG
280953719b08Smrg
281033734831Smrg# XORG_COMPILER_FLAGS
281133734831Smrg# ---------------
281233734831Smrg# Minimum version: 1.16.0
281354e0bb33Smrg#
281433734831Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
281533734831Smrg# arguments supported by the selected compiler which do NOT alter the generated
281633734831Smrg# code.  These arguments will cause the compiler to print various warnings
281733734831Smrg# during compilation AND turn a conservative set of warnings into errors.
281833734831Smrg#
281933734831Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
282033734831Smrg# future versions of util-macros as options are added to new compilers.
282133734831Smrg#
282233734831SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
282333734831SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2824b1297603Smrg
282533734831SmrgAC_ARG_ENABLE(selective-werror,
282633734831Smrg              AS_HELP_STRING([--disable-selective-werror],
282733734831Smrg                             [Turn off selective compiler errors. (default: enabled)]),
282833734831Smrg              [SELECTIVE_WERROR=$enableval],
282933734831Smrg              [SELECTIVE_WERROR=yes])
2830b1297603Smrg
283133734831SmrgAC_LANG_CASE(
283233734831Smrg        [C], [
283333734831Smrg                define([PREFIX], [C])
283433734831Smrg        ],
283533734831Smrg        [C++], [
283633734831Smrg                define([PREFIX], [CXX])
283733734831Smrg        ]
283833734831Smrg)
283933734831Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
284033734831Smrgif test "x$SUNCC" = "xyes"; then
284133734831Smrg    [BASE_]PREFIX[FLAGS]="-v"
28420309d3b3Smrgelse
284333734831Smrg    [BASE_]PREFIX[FLAGS]=""
28440309d3b3Smrgfi
2845b1297603Smrg
284633734831Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
284733734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
284833734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
284933734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
285033734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
285133734831Smrg
285233734831SmrgAC_LANG_CASE(
285333734831Smrg	[C], [
285433734831Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
285533734831Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
285633734831Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
285733734831Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
285833734831Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
285933734831Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
286033734831Smrg	]
286133734831Smrg)
28625b944e2aSmrg
286333734831Smrg# This chunk adds additional warnings that could catch undesired effects.
286433734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
286533734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
286633734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
286733734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
286833734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
286933734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
287033734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
28710309d3b3Smrg
287233734831Smrg# These are currently disabled because they are noisy.  They will be enabled
287333734831Smrg# in the future once the codebase is sufficiently modernized to silence
287433734831Smrg# them.  For now, I don't want them to drown out the other warnings.
287533734831Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
287633734831Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
287733734831Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
287833734831Smrg
287933734831Smrg# Turn some warnings into errors, so we don't accidently get successful builds
288033734831Smrg# when there are problems that should be fixed.
288133734831Smrg
288233734831Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
288333734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
288433734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
288533734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
288633734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
288733734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
288833734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
288933734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
289033734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
289133734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
289233734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
289333734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
289433734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
289533734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
289633734831Smrgelse
289733734831SmrgAC_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])
289833734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
289933734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
290033734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
290133734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
290233734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
290333734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
290433734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
290533734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
290633734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
290733734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
290833734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
290933734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
291033734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2911cea37944Smrgfi
291253719b08Smrg
291333734831SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
291433734831Smrg]) # XORG_COMPILER_FLAGS
291533734831Smrg
291633734831Smrg# XORG_CWARNFLAGS
291733734831Smrg# ---------------
291833734831Smrg# Minimum version: 1.2.0
291933734831Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
292054e0bb33Smrg#
292133734831Smrg# Defines CWARNFLAGS to enable C compiler warnings.
292233734831Smrg#
292333734831Smrg# This function is deprecated because it defines -fno-strict-aliasing
292433734831Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
292533734831Smrg# is needed, then it should be added explicitly in the module when
292633734831Smrg# it is updated to use BASE_CFLAGS.
292733734831Smrg#
292833734831SmrgAC_DEFUN([XORG_CWARNFLAGS], [
292933734831SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
293033734831SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
293133734831SmrgAC_LANG_CASE(
293233734831Smrg	[C], [
293333734831Smrg		CWARNFLAGS="$BASE_CFLAGS"
293433734831Smrg		if  test "x$GCC" = xyes ; then
293533734831Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
293633734831Smrg		fi
293733734831Smrg		AC_SUBST(CWARNFLAGS)
293833734831Smrg	]
293933734831Smrg)
294033734831Smrg]) # XORG_CWARNFLAGS
294153719b08Smrg
294233734831Smrg# XORG_STRICT_OPTION
294333734831Smrg# -----------------------
294433734831Smrg# Minimum version: 1.3.0
294533734831Smrg#
294633734831Smrg# Add configure option to enable strict compilation flags, such as treating
294733734831Smrg# warnings as fatal errors.
294833734831Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
294933734831Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
295033734831Smrg#
295133734831Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
295233734831Smrg# when strict compilation is unconditionally desired.
295333734831SmrgAC_DEFUN([XORG_STRICT_OPTION], [
295433734831SmrgAC_REQUIRE([XORG_CWARNFLAGS])
295533734831SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
295653719b08Smrg
295733734831SmrgAC_ARG_ENABLE(strict-compilation,
295833734831Smrg			  AS_HELP_STRING([--enable-strict-compilation],
295933734831Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
296033734831Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
296153719b08Smrg
296233734831SmrgAC_LANG_CASE(
296333734831Smrg        [C], [
296433734831Smrg                define([PREFIX], [C])
296533734831Smrg        ],
296633734831Smrg        [C++], [
296733734831Smrg                define([PREFIX], [CXX])
296833734831Smrg        ]
296933734831Smrg)
297054e0bb33Smrg
297133734831Smrg[STRICT_]PREFIX[FLAGS]=""
297233734831SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
297333734831SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
297454e0bb33Smrg
297533734831Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
297633734831Smrg# activate it with -Werror, so we add it here explicitly.
297733734831SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
297853719b08Smrg
297933734831Smrgif test "x$STRICT_COMPILE" = "xyes"; then
298033734831Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
298133734831Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
298233734831Smrgfi
298333734831SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
298433734831SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
298533734831SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
298633734831Smrg]) # XORG_STRICT_OPTION
2987cea37944Smrg
298833734831Smrg# XORG_DEFAULT_OPTIONS
298953719b08Smrg# --------------------
299033734831Smrg# Minimum version: 1.3.0
2991b1297603Smrg#
299233734831Smrg# Defines default options for X.Org modules.
2993d3263506Smrg#
299433734831SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
299533734831SmrgAC_REQUIRE([AC_PROG_INSTALL])
299633734831SmrgXORG_COMPILER_FLAGS
299733734831SmrgXORG_CWARNFLAGS
299833734831SmrgXORG_STRICT_OPTION
299933734831SmrgXORG_RELEASE_VERSION
300033734831SmrgXORG_CHANGELOG
300133734831SmrgXORG_INSTALL
300233734831SmrgXORG_MANPAGE_SECTIONS
300333734831Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
300433734831Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
300533734831Smrg]) # XORG_DEFAULT_OPTIONS
300653719b08Smrg
300733734831Smrg# XORG_INSTALL()
300833734831Smrg# ----------------
300933734831Smrg# Minimum version: 1.4.0
301033734831Smrg#
301133734831Smrg# Defines the variable INSTALL_CMD as the command to copy
301233734831Smrg# INSTALL from $prefix/share/util-macros.
301333734831Smrg#
301433734831SmrgAC_DEFUN([XORG_INSTALL], [
301533734831SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
301633734831Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
301733734831SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
301833734831Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
301933734831Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
302033734831Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
302133734831SmrgAC_SUBST([INSTALL_CMD])
302233734831Smrg]) # XORG_INSTALL
302333734831Smrgdnl Copyright 2005 Red Hat, Inc
302433734831Smrgdnl
302533734831Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
302633734831Smrgdnl documentation for any purpose is hereby granted without fee, provided that
302733734831Smrgdnl the above copyright notice appear in all copies and that both that
302833734831Smrgdnl copyright notice and this permission notice appear in supporting
302933734831Smrgdnl documentation.
303033734831Smrgdnl
303133734831Smrgdnl The above copyright notice and this permission notice shall be included
303233734831Smrgdnl in all copies or substantial portions of the Software.
303333734831Smrgdnl
303433734831Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
303533734831Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
303633734831Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
303733734831Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
303833734831Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
303933734831Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
304033734831Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
304133734831Smrgdnl
304233734831Smrgdnl Except as contained in this notice, the name of the copyright holders shall
304333734831Smrgdnl not be used in advertising or otherwise to promote the sale, use or
304433734831Smrgdnl other dealings in this Software without prior written authorization
304533734831Smrgdnl from the copyright holders.
304633734831Smrgdnl
304753719b08Smrg
304833734831Smrg# XORG_RELEASE_VERSION
304933734831Smrg# --------------------
305033734831Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
305133734831Smrg 
305233734831SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
305333734831Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
305433734831Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
305533734831Smrg		[Major version of this package])
305633734831Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
305733734831Smrg	if test "x$PVM" = "x"; then
305833734831Smrg		PVM="0"
305933734831Smrg	fi
306033734831Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
306133734831Smrg		[$PVM],
306233734831Smrg		[Minor version of this package])
306333734831Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
306433734831Smrg	if test "x$PVP" = "x"; then
306533734831Smrg		PVP="0"
306633734831Smrg	fi
306733734831Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
306833734831Smrg		[$PVP],
306933734831Smrg		[Patch version of this package])
307033734831Smrg])
307153719b08Smrg
307233734831Smrg# XORG_CHANGELOG()
307333734831Smrg# ----------------
307433734831Smrg# Minimum version: 1.2.0
307533734831Smrg#
307633734831Smrg# Defines the variable CHANGELOG_CMD as the command to generate
307733734831Smrg# ChangeLog from git.
307833734831Smrg#
307933734831Smrg#
308033734831SmrgAC_DEFUN([XORG_CHANGELOG], [
308133734831SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
308233734831Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
308333734831Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
308433734831Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
308533734831SmrgAC_SUBST([CHANGELOG_CMD])
308633734831Smrg]) # XORG_CHANGELOG
3087b1297603Smrg
3088