aclocal.m4 revision 69ef5f27
169ef5f27Smrg# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
269ef5f27Smrg
369ef5f27Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4d1333322Smrg
5d1333322Smrg# This file is free software; the Free Software Foundation
6d1333322Smrg# gives unlimited permission to copy and/or distribute it,
7d1333322Smrg# with or without modifications, as long as this notice is preserved.
8d1333322Smrg
9d1333322Smrg# This program is distributed in the hope that it will be useful,
10d1333322Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11d1333322Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12d1333322Smrg# PARTICULAR PURPOSE.
13d1333322Smrg
1469ef5f27Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
154f9ac78aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
164f9ac78aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1769ef5f27Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1869ef5f27Smrg[m4_warning([this file was generated for autoconf 2.69.
194f9ac78aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
204f9ac78aSmrgIf you have problems, you may need to regenerate the build system entirely.
2169ef5f27SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22d1333322Smrg
2369ef5f27Smrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
24d1333322Smrg#
25d1333322Smrg# This file is free software; the Free Software Foundation
26d1333322Smrg# gives unlimited permission to copy and/or distribute it,
27d1333322Smrg# with or without modifications, as long as this notice is preserved.
28d1333322Smrg
29d1333322Smrg# AM_AUTOMAKE_VERSION(VERSION)
30d1333322Smrg# ----------------------------
31d1333322Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32d1333322Smrg# generated from the m4 files accompanying Automake X.Y.
33d1333322Smrg# (This private macro should not be called outside this file.)
34d1333322SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3569ef5f27Smrg[am__api_version='1.14'
36d1333322Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37d1333322Smrgdnl require some minimum version.  Point them to the right macro.
3869ef5f27Smrgm4_if([$1], [1.14.1], [],
39d1333322Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40d1333322Smrg])
41d1333322Smrg
42d1333322Smrg# _AM_AUTOCONF_VERSION(VERSION)
43d1333322Smrg# -----------------------------
44d1333322Smrg# aclocal traces this macro to find the Autoconf version.
45d1333322Smrg# This is a private macro too.  Using m4_define simplifies
46d1333322Smrg# the logic in aclocal, which can simply ignore this definition.
47d1333322Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48d1333322Smrg
49d1333322Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50d1333322Smrg# -------------------------------
51d1333322Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
524f9ac78aSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53d1333322SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5469ef5f27Smrg[AM_AUTOMAKE_VERSION([1.14.1])dnl
554f9ac78aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
564f9ac78aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
574f9ac78aSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58d1333322Smrg
59d1333322Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60d1333322Smrg
6169ef5f27Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
62d1333322Smrg#
63d1333322Smrg# This file is free software; the Free Software Foundation
64d1333322Smrg# gives unlimited permission to copy and/or distribute it,
65d1333322Smrg# with or without modifications, as long as this notice is preserved.
66d1333322Smrg
67d1333322Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6869ef5f27Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6969ef5f27Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70d1333322Smrg#
71d1333322Smrg# Of course, Automake must honor this variable whenever it calls a
72d1333322Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73d1333322Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74d1333322Smrg# depending on how configure is run.  This is pretty annoying, since
75d1333322Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76d1333322Smrg# source directory, any form will work fine, but in subdirectories a
77d1333322Smrg# relative path needs to be adjusted first.
78d1333322Smrg#
79d1333322Smrg# $ac_aux_dir/missing
80d1333322Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81d1333322Smrg# $top_srcdir/$ac_aux_dir/missing
82d1333322Smrg#    fails if $ac_aux_dir is absolute,
83d1333322Smrg#    fails when called from a subdirectory in a VPATH build with
84d1333322Smrg#          a relative $ac_aux_dir
85d1333322Smrg#
86d1333322Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87d1333322Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8869ef5f27Smrg# harmless because $srcdir is '.', but things will broke when you
89d1333322Smrg# start a VPATH build or use an absolute $srcdir.
90d1333322Smrg#
91d1333322Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92d1333322Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93d1333322Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94d1333322Smrg# and then we would define $MISSING as
95d1333322Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96d1333322Smrg# This will work as long as MISSING is not called from configure, because
97d1333322Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98d1333322Smrg# However there are other variables, like CC, which are often used in
99d1333322Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100d1333322Smrg#
101d1333322Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102d1333322Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103d1333322Smrg# configured tree to be moved without reconfiguration.
104d1333322Smrg
105d1333322SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106d1333322Smrg[dnl Rely on autoconf to set up CDPATH properly.
107d1333322SmrgAC_PREREQ([2.50])dnl
108d1333322Smrg# expand $ac_aux_dir to an absolute path
109d1333322Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
110d1333322Smrg])
111d1333322Smrg
112d1333322Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
113d1333322Smrg
11469ef5f27Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
115d1333322Smrg#
116d1333322Smrg# This file is free software; the Free Software Foundation
117d1333322Smrg# gives unlimited permission to copy and/or distribute it,
118d1333322Smrg# with or without modifications, as long as this notice is preserved.
119d1333322Smrg
120d1333322Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
121d1333322Smrg# -------------------------------------
122d1333322Smrg# Define a conditional.
123d1333322SmrgAC_DEFUN([AM_CONDITIONAL],
12469ef5f27Smrg[AC_PREREQ([2.52])dnl
12569ef5f27Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12669ef5f27Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
127d1333322SmrgAC_SUBST([$1_TRUE])dnl
128d1333322SmrgAC_SUBST([$1_FALSE])dnl
129d1333322Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
130d1333322Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1314f9ac78aSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
132d1333322Smrgif $2; then
133d1333322Smrg  $1_TRUE=
134d1333322Smrg  $1_FALSE='#'
135d1333322Smrgelse
136d1333322Smrg  $1_TRUE='#'
137d1333322Smrg  $1_FALSE=
138d1333322Smrgfi
139d1333322SmrgAC_CONFIG_COMMANDS_PRE(
140d1333322Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
141d1333322Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
142d1333322SmrgUsually this means the macro was only invoked conditionally.]])
143d1333322Smrgfi])])
144d1333322Smrg
14569ef5f27Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
146d1333322Smrg#
147d1333322Smrg# This file is free software; the Free Software Foundation
148d1333322Smrg# gives unlimited permission to copy and/or distribute it,
149d1333322Smrg# with or without modifications, as long as this notice is preserved.
150d1333322Smrg
151d1333322Smrg
15269ef5f27Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
153d1333322Smrg# written in clear, in which case automake, when reading aclocal.m4,
154d1333322Smrg# will think it sees a *use*, and therefore will trigger all it's
155d1333322Smrg# C support machinery.  Also note that it means that autoscan, seeing
156d1333322Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
157d1333322Smrg
158d1333322Smrg
159d1333322Smrg# _AM_DEPENDENCIES(NAME)
160d1333322Smrg# ----------------------
161d1333322Smrg# See how the compiler implements dependency checking.
16269ef5f27Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
163d1333322Smrg# We try a few techniques and use that to set a single cache variable.
164d1333322Smrg#
165d1333322Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
166d1333322Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
167d1333322Smrg# dependency, and given that the user is not expected to run this macro,
168d1333322Smrg# just rely on AC_PROG_CC.
169d1333322SmrgAC_DEFUN([_AM_DEPENDENCIES],
170d1333322Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
171d1333322SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
172d1333322SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
173d1333322SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
174d1333322Smrg
17569ef5f27Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17669ef5f27Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17769ef5f27Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17869ef5f27Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17969ef5f27Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
18069ef5f27Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18169ef5f27Smrg                    [depcc="$$1"   am_compiler_list=])
182d1333322Smrg
183d1333322SmrgAC_CACHE_CHECK([dependency style of $depcc],
184d1333322Smrg               [am_cv_$1_dependencies_compiler_type],
185d1333322Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
186d1333322Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
187d1333322Smrg  # making bogus files that we don't know about and never remove.  For
188d1333322Smrg  # instance it was reported that on HP-UX the gcc test will end up
18969ef5f27Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
19069ef5f27Smrg  # in D".
191c27291ebSmrg  rm -rf conftest.dir
192d1333322Smrg  mkdir conftest.dir
193d1333322Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
194d1333322Smrg  # using a relative directory.
195d1333322Smrg  cp "$am_depcomp" conftest.dir
196d1333322Smrg  cd conftest.dir
197d1333322Smrg  # We will build objects and dependencies in a subdirectory because
198d1333322Smrg  # it helps to detect inapplicable dependency modes.  For instance
199d1333322Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
200d1333322Smrg  # side effect of compilation, but ICC will put the dependencies in
201d1333322Smrg  # the current directory while Tru64 will put them in the object
202d1333322Smrg  # directory.
203d1333322Smrg  mkdir sub
204d1333322Smrg
205d1333322Smrg  am_cv_$1_dependencies_compiler_type=none
206d1333322Smrg  if test "$am_compiler_list" = ""; then
207d1333322Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
208d1333322Smrg  fi
2094f9ac78aSmrg  am__universal=false
2104f9ac78aSmrg  m4_case([$1], [CC],
2114f9ac78aSmrg    [case " $depcc " in #(
2124f9ac78aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2134f9ac78aSmrg     esac],
2144f9ac78aSmrg    [CXX],
2154f9ac78aSmrg    [case " $depcc " in #(
2164f9ac78aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2174f9ac78aSmrg     esac])
2184f9ac78aSmrg
219d1333322Smrg  for depmode in $am_compiler_list; do
220d1333322Smrg    # Setup a source with many dependencies, because some compilers
221d1333322Smrg    # like to wrap large dependency lists on column 80 (with \), and
222d1333322Smrg    # we should not choose a depcomp mode which is confused by this.
223d1333322Smrg    #
224d1333322Smrg    # We need to recreate these files for each test, as the compiler may
225d1333322Smrg    # overwrite some of them when testing with obscure command lines.
226d1333322Smrg    # This happens at least with the AIX C compiler.
227d1333322Smrg    : > sub/conftest.c
228d1333322Smrg    for i in 1 2 3 4 5 6; do
229d1333322Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
23069ef5f27Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23169ef5f27Smrg      # Solaris 10 /bin/sh.
23269ef5f27Smrg      echo '/* dummy */' > sub/conftst$i.h
233d1333322Smrg    done
234d1333322Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
235d1333322Smrg
23669ef5f27Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2374f9ac78aSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23869ef5f27Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23969ef5f27Smrg    # versions had trouble with output in subdirs.
2404f9ac78aSmrg    am__obj=sub/conftest.${OBJEXT-o}
2414f9ac78aSmrg    am__minus_obj="-o $am__obj"
242d1333322Smrg    case $depmode in
2434f9ac78aSmrg    gcc)
2444f9ac78aSmrg      # This depmode causes a compiler race in universal mode.
2454f9ac78aSmrg      test "$am__universal" = false || continue
2464f9ac78aSmrg      ;;
247d1333322Smrg    nosideeffect)
24869ef5f27Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24969ef5f27Smrg      # only be used when explicitly requested.
250d1333322Smrg      if test "x$enable_dependency_tracking" = xyes; then
251d1333322Smrg	continue
252d1333322Smrg      else
253d1333322Smrg	break
254d1333322Smrg      fi
255d1333322Smrg      ;;
256c27291ebSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25769ef5f27Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2584f9ac78aSmrg      # not run yet.  These depmodes are late enough in the game, and
2594f9ac78aSmrg      # so weak that their functioning should not be impacted.
2604f9ac78aSmrg      am__obj=conftest.${OBJEXT-o}
2614f9ac78aSmrg      am__minus_obj=
2624f9ac78aSmrg      ;;
263d1333322Smrg    none) break ;;
264d1333322Smrg    esac
265d1333322Smrg    if depmode=$depmode \
2664f9ac78aSmrg       source=sub/conftest.c object=$am__obj \
267d1333322Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2684f9ac78aSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
269d1333322Smrg         >/dev/null 2>conftest.err &&
270d1333322Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
271d1333322Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2724f9ac78aSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
273d1333322Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
274d1333322Smrg      # icc doesn't choke on unknown options, it will just issue warnings
275d1333322Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
276d1333322Smrg      # that says an option was ignored or not supported.
277d1333322Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
278d1333322Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
279d1333322Smrg      # The diagnosis changed in icc 8.0:
280d1333322Smrg      #   icc: Command line remark: option '-MP' not supported
281d1333322Smrg      if (grep 'ignoring option' conftest.err ||
282d1333322Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
283d1333322Smrg        am_cv_$1_dependencies_compiler_type=$depmode
284d1333322Smrg        break
285d1333322Smrg      fi
286d1333322Smrg    fi
287d1333322Smrg  done
288d1333322Smrg
289d1333322Smrg  cd ..
290d1333322Smrg  rm -rf conftest.dir
291d1333322Smrgelse
292d1333322Smrg  am_cv_$1_dependencies_compiler_type=none
293d1333322Smrgfi
294d1333322Smrg])
295d1333322SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
296d1333322SmrgAM_CONDITIONAL([am__fastdep$1], [
297d1333322Smrg  test "x$enable_dependency_tracking" != xno \
298d1333322Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
299d1333322Smrg])
300d1333322Smrg
301d1333322Smrg
302d1333322Smrg# AM_SET_DEPDIR
303d1333322Smrg# -------------
304d1333322Smrg# Choose a directory name for dependency files.
30569ef5f27Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
306d1333322SmrgAC_DEFUN([AM_SET_DEPDIR],
307d1333322Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
308d1333322SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
309d1333322Smrg])
310d1333322Smrg
311d1333322Smrg
312d1333322Smrg# AM_DEP_TRACK
313d1333322Smrg# ------------
314d1333322SmrgAC_DEFUN([AM_DEP_TRACK],
31569ef5f27Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31669ef5f27SmrgAS_HELP_STRING(
31769ef5f27Smrg  [--enable-dependency-tracking],
31869ef5f27Smrg  [do not reject slow dependency extractors])
31969ef5f27SmrgAS_HELP_STRING(
32069ef5f27Smrg  [--disable-dependency-tracking],
32169ef5f27Smrg  [speeds up one-time build])])
322d1333322Smrgif test "x$enable_dependency_tracking" != xno; then
323d1333322Smrg  am_depcomp="$ac_aux_dir/depcomp"
324d1333322Smrg  AMDEPBACKSLASH='\'
325c27291ebSmrg  am__nodep='_no'
326d1333322Smrgfi
327d1333322SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
328d1333322SmrgAC_SUBST([AMDEPBACKSLASH])dnl
329d1333322Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
330c27291ebSmrgAC_SUBST([am__nodep])dnl
331c27291ebSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
332d1333322Smrg])
333d1333322Smrg
334d1333322Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
335d1333322Smrg
33669ef5f27Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
337d1333322Smrg#
338d1333322Smrg# This file is free software; the Free Software Foundation
339d1333322Smrg# gives unlimited permission to copy and/or distribute it,
340d1333322Smrg# with or without modifications, as long as this notice is preserved.
341d1333322Smrg
342d1333322Smrg
343d1333322Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
344d1333322Smrg# ------------------------------
345d1333322SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3464f9ac78aSmrg[{
34769ef5f27Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3484f9ac78aSmrg  # are listed without --file.  Let's play safe and only enable the eval
3494f9ac78aSmrg  # if we detect the quoting.
3504f9ac78aSmrg  case $CONFIG_FILES in
3514f9ac78aSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
3524f9ac78aSmrg  *)   set x $CONFIG_FILES ;;
3534f9ac78aSmrg  esac
3544f9ac78aSmrg  shift
3554f9ac78aSmrg  for mf
3564f9ac78aSmrg  do
3574f9ac78aSmrg    # Strip MF so we end up with the name of the file.
3584f9ac78aSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3594f9ac78aSmrg    # Check whether this is an Automake generated Makefile or not.
36069ef5f27Smrg    # We used to match only the files named 'Makefile.in', but
3614f9ac78aSmrg    # some people rename them; so instead we look at the file content.
3624f9ac78aSmrg    # Grep'ing the first line is not enough: some people post-process
3634f9ac78aSmrg    # each Makefile.in and add a new line on top of each file to say so.
3644f9ac78aSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
3654f9ac78aSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3664f9ac78aSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3674f9ac78aSmrg      dirpart=`AS_DIRNAME("$mf")`
3684f9ac78aSmrg    else
3694f9ac78aSmrg      continue
3704f9ac78aSmrg    fi
3714f9ac78aSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
37269ef5f27Smrg    # from the Makefile without running 'make'.
3734f9ac78aSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3744f9ac78aSmrg    test -z "$DEPDIR" && continue
3754f9ac78aSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
37669ef5f27Smrg    test -z "$am__include" && continue
3774f9ac78aSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3784f9ac78aSmrg    # Find all dependency output files, they are included files with
3794f9ac78aSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3804f9ac78aSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3814f9ac78aSmrg    # expansion.
3824f9ac78aSmrg    for file in `sed -n "
3834f9ac78aSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
38469ef5f27Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
3854f9ac78aSmrg      # Make sure the directory exists.
3864f9ac78aSmrg      test -f "$dirpart/$file" && continue
3874f9ac78aSmrg      fdir=`AS_DIRNAME(["$file"])`
3884f9ac78aSmrg      AS_MKDIR_P([$dirpart/$fdir])
3894f9ac78aSmrg      # echo "creating $dirpart/$file"
3904f9ac78aSmrg      echo '# dummy' > "$dirpart/$file"
3914f9ac78aSmrg    done
392d1333322Smrg  done
3934f9ac78aSmrg}
394d1333322Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
395d1333322Smrg
396d1333322Smrg
397d1333322Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
398d1333322Smrg# -----------------------------
399d1333322Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
400d1333322Smrg#
401d1333322Smrg# This code is only required when automatic dependency tracking
40269ef5f27Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
403d1333322Smrg# need in order to bootstrap the dependency handling code.
404d1333322SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
405d1333322Smrg[AC_CONFIG_COMMANDS([depfiles],
406d1333322Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
407d1333322Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
408d1333322Smrg])
409d1333322Smrg
410d1333322Smrg# Do all the work for Automake.                             -*- Autoconf -*-
411d1333322Smrg
41269ef5f27Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
413d1333322Smrg#
414d1333322Smrg# This file is free software; the Free Software Foundation
415d1333322Smrg# gives unlimited permission to copy and/or distribute it,
416d1333322Smrg# with or without modifications, as long as this notice is preserved.
417d1333322Smrg
418d1333322Smrg# This macro actually does too much.  Some checks are only needed if
419d1333322Smrg# your package does certain things.  But this isn't really a big deal.
420d1333322Smrg
42169ef5f27Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
42269ef5f27Smrgm4_define([AC_PROG_CC],
42369ef5f27Smrgm4_defn([AC_PROG_CC])
42469ef5f27Smrg[_AM_PROG_CC_C_O
42569ef5f27Smrg])
42669ef5f27Smrg
427d1333322Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
428d1333322Smrg# AM_INIT_AUTOMAKE([OPTIONS])
429d1333322Smrg# -----------------------------------------------
430d1333322Smrg# The call with PACKAGE and VERSION arguments is the old style
431d1333322Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
432d1333322Smrg# and VERSION should now be passed to AC_INIT and removed from
433d1333322Smrg# the call to AM_INIT_AUTOMAKE.
434d1333322Smrg# We support both call styles for the transition.  After
435d1333322Smrg# the next Automake release, Autoconf can make the AC_INIT
436d1333322Smrg# arguments mandatory, and then we can depend on a new Autoconf
437d1333322Smrg# release and drop the old call support.
438d1333322SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43969ef5f27Smrg[AC_PREREQ([2.65])dnl
440d1333322Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
441d1333322Smrgdnl the ones we care about.
442d1333322Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
443d1333322SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
444d1333322SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
445d1333322Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
446d1333322Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
447d1333322Smrg  # is not polluted with repeated "-I."
448d1333322Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
449d1333322Smrg  # test to see if srcdir already configured
450d1333322Smrg  if test -f $srcdir/config.status; then
451d1333322Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
452d1333322Smrg  fi
453d1333322Smrgfi
454d1333322Smrg
455d1333322Smrg# test whether we have cygpath
456d1333322Smrgif test -z "$CYGPATH_W"; then
457d1333322Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
458d1333322Smrg    CYGPATH_W='cygpath -w'
459d1333322Smrg  else
460d1333322Smrg    CYGPATH_W=echo
461d1333322Smrg  fi
462d1333322Smrgfi
463d1333322SmrgAC_SUBST([CYGPATH_W])
464d1333322Smrg
465d1333322Smrg# Define the identity of the package.
466d1333322Smrgdnl Distinguish between old-style and new-style calls.
467d1333322Smrgm4_ifval([$2],
46869ef5f27Smrg[AC_DIAGNOSE([obsolete],
46969ef5f27Smrg             [$0: two- and three-arguments forms are deprecated.])
47069ef5f27Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
471d1333322Smrg AC_SUBST([PACKAGE], [$1])dnl
472d1333322Smrg AC_SUBST([VERSION], [$2])],
473d1333322Smrg[_AM_SET_OPTIONS([$1])dnl
474d1333322Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47569ef5f27Smrgm4_if(
47669ef5f27Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
47769ef5f27Smrg  [ok:ok],,
478d1333322Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
479d1333322Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
480d1333322Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
481d1333322Smrg
482d1333322Smrg_AM_IF_OPTION([no-define],,
48369ef5f27Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
48469ef5f27Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
485d1333322Smrg
486d1333322Smrg# Some tools Automake needs.
487d1333322SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
488d1333322SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48969ef5f27SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
49069ef5f27SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
49169ef5f27SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
49269ef5f27SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
49369ef5f27SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4944f9ac78aSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4954f9ac78aSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49669ef5f27SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49769ef5f27Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49869ef5f27Smrg# dies out for good.  For more background, see:
49969ef5f27Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
50069ef5f27Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
50169ef5f27SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
502d1333322Smrg# We need awk for the "check" target.  The system "awk" is bad on
503d1333322Smrg# some platforms.
504d1333322SmrgAC_REQUIRE([AC_PROG_AWK])dnl
505d1333322SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
506d1333322SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
507d1333322Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5084f9ac78aSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5094f9ac78aSmrg			     [_AM_PROG_TAR([v7])])])
510d1333322Smrg_AM_IF_OPTION([no-dependencies],,
511d1333322Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
51269ef5f27Smrg		  [_AM_DEPENDENCIES([CC])],
51369ef5f27Smrg		  [m4_define([AC_PROG_CC],
51469ef5f27Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
515d1333322SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51669ef5f27Smrg		  [_AM_DEPENDENCIES([CXX])],
51769ef5f27Smrg		  [m4_define([AC_PROG_CXX],
51869ef5f27Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
519d1333322SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
52069ef5f27Smrg		  [_AM_DEPENDENCIES([OBJC])],
52169ef5f27Smrg		  [m4_define([AC_PROG_OBJC],
52269ef5f27Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
52369ef5f27SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
52469ef5f27Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52569ef5f27Smrg		  [m4_define([AC_PROG_OBJCXX],
52669ef5f27Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
527d1333322Smrg])
52869ef5f27SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
52969ef5f27Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53069ef5f27Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
53169ef5f27Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5324f9ac78aSmrgAC_CONFIG_COMMANDS_PRE(dnl
5334f9ac78aSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5344f9ac78aSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
535d1333322Smrg
53669ef5f27Smrg# POSIX will say in a future version that running "rm -f" with no argument
53769ef5f27Smrg# is OK; and we want to be able to make that assumption in our Makefile
53869ef5f27Smrg# recipes.  So use an aggressive probe to check that the usage we want is
53969ef5f27Smrg# actually supported "in the wild" to an acceptable degree.
54069ef5f27Smrg# See automake bug#10828.
54169ef5f27Smrg# To make any issue more visible, cause the running configure to be aborted
54269ef5f27Smrg# by default if the 'rm' program in use doesn't match our expectations; the
54369ef5f27Smrg# user can still override this though.
54469ef5f27Smrgif rm -f && rm -fr && rm -rf; then : OK; else
54569ef5f27Smrg  cat >&2 <<'END'
54669ef5f27SmrgOops!
54769ef5f27Smrg
54869ef5f27SmrgYour 'rm' program seems unable to run without file operands specified
54969ef5f27Smrgon the command line, even when the '-f' option is present.  This is contrary
55069ef5f27Smrgto the behaviour of most rm programs out there, and not conforming with
55169ef5f27Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
55269ef5f27Smrg
55369ef5f27SmrgPlease tell bug-automake@gnu.org about your system, including the value
55469ef5f27Smrgof your $PATH and any error possibly output before this message.  This
55569ef5f27Smrgcan help us improve future automake versions.
55669ef5f27Smrg
55769ef5f27SmrgEND
55869ef5f27Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
55969ef5f27Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56069ef5f27Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
56169ef5f27Smrg    echo >&2
56269ef5f27Smrg  else
56369ef5f27Smrg    cat >&2 <<'END'
56469ef5f27SmrgAborting the configuration process, to ensure you take notice of the issue.
56569ef5f27Smrg
56669ef5f27SmrgYou can download and install GNU coreutils to get an 'rm' implementation
56769ef5f27Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
56869ef5f27Smrg
56969ef5f27SmrgIf you want to complete the configuration process using your problematic
57069ef5f27Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
57169ef5f27Smrgto "yes", and re-run configure.
57269ef5f27Smrg
57369ef5f27SmrgEND
57469ef5f27Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
57569ef5f27Smrg  fi
57669ef5f27Smrgfi])
57769ef5f27Smrg
57869ef5f27Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5794f9ac78aSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5804f9ac78aSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5814f9ac78aSmrgm4_define([_AC_COMPILER_EXEEXT],
5824f9ac78aSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5834f9ac78aSmrg
584d1333322Smrg# When config.status generates a header, we must update the stamp-h file.
585d1333322Smrg# This file resides in the same directory as the config header
586d1333322Smrg# that is generated.  The stamp files are numbered to have different names.
587d1333322Smrg
588d1333322Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
589d1333322Smrg# loop where config.status creates the headers, so we can generate
590d1333322Smrg# our stamp files there.
591d1333322SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
592d1333322Smrg[# Compute $1's index in $config_headers.
5934f9ac78aSmrg_am_arg=$1
594d1333322Smrg_am_stamp_count=1
595d1333322Smrgfor _am_header in $config_headers :; do
596d1333322Smrg  case $_am_header in
5974f9ac78aSmrg    $_am_arg | $_am_arg:* )
598d1333322Smrg      break ;;
599d1333322Smrg    * )
600d1333322Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
601d1333322Smrg  esac
602d1333322Smrgdone
6034f9ac78aSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
604d1333322Smrg
60569ef5f27Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
606d1333322Smrg#
607d1333322Smrg# This file is free software; the Free Software Foundation
608d1333322Smrg# gives unlimited permission to copy and/or distribute it,
609d1333322Smrg# with or without modifications, as long as this notice is preserved.
610d1333322Smrg
611d1333322Smrg# AM_PROG_INSTALL_SH
612d1333322Smrg# ------------------
613d1333322Smrg# Define $install_sh.
614d1333322SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
615d1333322Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6164f9ac78aSmrgif test x"${install_sh}" != xset; then
6174f9ac78aSmrg  case $am_aux_dir in
6184f9ac78aSmrg  *\ * | *\	*)
6194f9ac78aSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6204f9ac78aSmrg  *)
6214f9ac78aSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6224f9ac78aSmrg  esac
6234f9ac78aSmrgfi
62469ef5f27SmrgAC_SUBST([install_sh])])
625d1333322Smrg
62669ef5f27Smrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
627d1333322Smrg#
628d1333322Smrg# This file is free software; the Free Software Foundation
629d1333322Smrg# gives unlimited permission to copy and/or distribute it,
630d1333322Smrg# with or without modifications, as long as this notice is preserved.
631d1333322Smrg
632d1333322Smrg# Check whether the underlying file-system supports filenames
633d1333322Smrg# with a leading dot.  For instance MS-DOS doesn't.
634d1333322SmrgAC_DEFUN([AM_SET_LEADING_DOT],
635d1333322Smrg[rm -rf .tst 2>/dev/null
636d1333322Smrgmkdir .tst 2>/dev/null
637d1333322Smrgif test -d .tst; then
638d1333322Smrg  am__leading_dot=.
639d1333322Smrgelse
640d1333322Smrg  am__leading_dot=_
641d1333322Smrgfi
642d1333322Smrgrmdir .tst 2>/dev/null
643d1333322SmrgAC_SUBST([am__leading_dot])])
644d1333322Smrg
645d1333322Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
646d1333322Smrg
64769ef5f27Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
648d1333322Smrg#
649d1333322Smrg# This file is free software; the Free Software Foundation
650d1333322Smrg# gives unlimited permission to copy and/or distribute it,
651d1333322Smrg# with or without modifications, as long as this notice is preserved.
652d1333322Smrg
653d1333322Smrg# AM_MAKE_INCLUDE()
654d1333322Smrg# -----------------
655d1333322Smrg# Check to see how make treats includes.
656d1333322SmrgAC_DEFUN([AM_MAKE_INCLUDE],
657d1333322Smrg[am_make=${MAKE-make}
658d1333322Smrgcat > confinc << 'END'
659d1333322Smrgam__doit:
6604f9ac78aSmrg	@echo this is the am__doit target
661d1333322Smrg.PHONY: am__doit
662d1333322SmrgEND
663d1333322Smrg# If we don't find an include directive, just comment out the code.
664d1333322SmrgAC_MSG_CHECKING([for style of include used by $am_make])
665d1333322Smrgam__include="#"
666d1333322Smrgam__quote=
667d1333322Smrg_am_result=none
668d1333322Smrg# First try GNU make style include.
669d1333322Smrgecho "include confinc" > confmf
67069ef5f27Smrg# Ignore all kinds of additional output from 'make'.
6714f9ac78aSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
6724f9ac78aSmrg*the\ am__doit\ target*)
6734f9ac78aSmrg  am__include=include
6744f9ac78aSmrg  am__quote=
6754f9ac78aSmrg  _am_result=GNU
6764f9ac78aSmrg  ;;
6774f9ac78aSmrgesac
678d1333322Smrg# Now try BSD make style include.
679d1333322Smrgif test "$am__include" = "#"; then
680d1333322Smrg   echo '.include "confinc"' > confmf
6814f9ac78aSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
6824f9ac78aSmrg   *the\ am__doit\ target*)
6834f9ac78aSmrg     am__include=.include
6844f9ac78aSmrg     am__quote="\""
6854f9ac78aSmrg     _am_result=BSD
6864f9ac78aSmrg     ;;
6874f9ac78aSmrg   esac
688d1333322Smrgfi
689d1333322SmrgAC_SUBST([am__include])
690d1333322SmrgAC_SUBST([am__quote])
691d1333322SmrgAC_MSG_RESULT([$_am_result])
692d1333322Smrgrm -f confinc confmf
693d1333322Smrg])
694d1333322Smrg
695d1333322Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
696d1333322Smrg
69769ef5f27Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
698d1333322Smrg#
699d1333322Smrg# This file is free software; the Free Software Foundation
700d1333322Smrg# gives unlimited permission to copy and/or distribute it,
701d1333322Smrg# with or without modifications, as long as this notice is preserved.
702d1333322Smrg
703d1333322Smrg# AM_MISSING_PROG(NAME, PROGRAM)
704d1333322Smrg# ------------------------------
705d1333322SmrgAC_DEFUN([AM_MISSING_PROG],
706d1333322Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
707d1333322Smrg$1=${$1-"${am_missing_run}$2"}
708d1333322SmrgAC_SUBST($1)])
709d1333322Smrg
710d1333322Smrg# AM_MISSING_HAS_RUN
711d1333322Smrg# ------------------
71269ef5f27Smrg# Define MISSING if not defined so far and test if it is modern enough.
71369ef5f27Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
714d1333322SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
715d1333322Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
716d1333322SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7174f9ac78aSmrgif test x"${MISSING+set}" != xset; then
7184f9ac78aSmrg  case $am_aux_dir in
7194f9ac78aSmrg  *\ * | *\	*)
7204f9ac78aSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7214f9ac78aSmrg  *)
7224f9ac78aSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7234f9ac78aSmrg  esac
7244f9ac78aSmrgfi
725d1333322Smrg# Use eval to expand $SHELL
72669ef5f27Smrgif eval "$MISSING --is-lightweight"; then
72769ef5f27Smrg  am_missing_run="$MISSING "
728d1333322Smrgelse
729d1333322Smrg  am_missing_run=
73069ef5f27Smrg  AC_MSG_WARN(['missing' script is too old or missing])
731d1333322Smrgfi
732d1333322Smrg])
733d1333322Smrg
734d1333322Smrg# Helper functions for option handling.                     -*- Autoconf -*-
735d1333322Smrg
73669ef5f27Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
737d1333322Smrg#
738d1333322Smrg# This file is free software; the Free Software Foundation
739d1333322Smrg# gives unlimited permission to copy and/or distribute it,
740d1333322Smrg# with or without modifications, as long as this notice is preserved.
741d1333322Smrg
742d1333322Smrg# _AM_MANGLE_OPTION(NAME)
743d1333322Smrg# -----------------------
744d1333322SmrgAC_DEFUN([_AM_MANGLE_OPTION],
745d1333322Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
746d1333322Smrg
747d1333322Smrg# _AM_SET_OPTION(NAME)
748c27291ebSmrg# --------------------
749d1333322Smrg# Set option NAME.  Presently that only means defining a flag for this option.
750d1333322SmrgAC_DEFUN([_AM_SET_OPTION],
75169ef5f27Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
752d1333322Smrg
753d1333322Smrg# _AM_SET_OPTIONS(OPTIONS)
754c27291ebSmrg# ------------------------
755d1333322Smrg# OPTIONS is a space-separated list of Automake options.
756d1333322SmrgAC_DEFUN([_AM_SET_OPTIONS],
7574f9ac78aSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
758d1333322Smrg
759d1333322Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
760d1333322Smrg# -------------------------------------------
761d1333322Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
762d1333322SmrgAC_DEFUN([_AM_IF_OPTION],
763d1333322Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
764d1333322Smrg
76569ef5f27Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
76669ef5f27Smrg#
76769ef5f27Smrg# This file is free software; the Free Software Foundation
76869ef5f27Smrg# gives unlimited permission to copy and/or distribute it,
76969ef5f27Smrg# with or without modifications, as long as this notice is preserved.
770d1333322Smrg
77169ef5f27Smrg# _AM_PROG_CC_C_O
77269ef5f27Smrg# ---------------
77369ef5f27Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77469ef5f27Smrg# to automatically call this.
77569ef5f27SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77669ef5f27Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77769ef5f27SmrgAC_REQUIRE_AUX_FILE([compile])dnl
77869ef5f27SmrgAC_LANG_PUSH([C])dnl
77969ef5f27SmrgAC_CACHE_CHECK(
78069ef5f27Smrg  [whether $CC understands -c and -o together],
78169ef5f27Smrg  [am_cv_prog_cc_c_o],
78269ef5f27Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78369ef5f27Smrg  # Make sure it works both with $CC and with simple cc.
78469ef5f27Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78569ef5f27Smrg  # compilers refuse to overwrite an existing .o file with -o,
78669ef5f27Smrg  # though they will create one.
78769ef5f27Smrg  am_cv_prog_cc_c_o=yes
78869ef5f27Smrg  for am_i in 1 2; do
78969ef5f27Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79069ef5f27Smrg         && test -f conftest2.$ac_objext; then
79169ef5f27Smrg      : OK
79269ef5f27Smrg    else
79369ef5f27Smrg      am_cv_prog_cc_c_o=no
79469ef5f27Smrg      break
79569ef5f27Smrg    fi
79669ef5f27Smrg  done
79769ef5f27Smrg  rm -f core conftest*
79869ef5f27Smrg  unset am_i])
79969ef5f27Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80069ef5f27Smrg   # Losing compiler, so override with the script.
80169ef5f27Smrg   # FIXME: It is wrong to rewrite CC.
80269ef5f27Smrg   # But if we don't then we get into trouble of one sort or another.
80369ef5f27Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80469ef5f27Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80569ef5f27Smrg   CC="$am_aux_dir/compile $CC"
80669ef5f27Smrgfi
80769ef5f27SmrgAC_LANG_POP([C])])
80869ef5f27Smrg
80969ef5f27Smrg# For backward compatibility.
81069ef5f27SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
81169ef5f27Smrg
81269ef5f27Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
813d1333322Smrg#
814d1333322Smrg# This file is free software; the Free Software Foundation
815d1333322Smrg# gives unlimited permission to copy and/or distribute it,
816d1333322Smrg# with or without modifications, as long as this notice is preserved.
817d1333322Smrg
81869ef5f27Smrg# AM_RUN_LOG(COMMAND)
81969ef5f27Smrg# -------------------
82069ef5f27Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82169ef5f27Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82269ef5f27SmrgAC_DEFUN([AM_RUN_LOG],
82369ef5f27Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82469ef5f27Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82569ef5f27Smrg   ac_status=$?
82669ef5f27Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82769ef5f27Smrg   (exit $ac_status); }])
82869ef5f27Smrg
82969ef5f27Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83069ef5f27Smrg
83169ef5f27Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
83269ef5f27Smrg#
83369ef5f27Smrg# This file is free software; the Free Software Foundation
83469ef5f27Smrg# gives unlimited permission to copy and/or distribute it,
83569ef5f27Smrg# with or without modifications, as long as this notice is preserved.
836d1333322Smrg
837d1333322Smrg# AM_SANITY_CHECK
838d1333322Smrg# ---------------
839d1333322SmrgAC_DEFUN([AM_SANITY_CHECK],
840d1333322Smrg[AC_MSG_CHECKING([whether build environment is sane])
8414f9ac78aSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8424f9ac78aSmrg# name.  Accept space and tab only in the latter.
8434f9ac78aSmrgam_lf='
8444f9ac78aSmrg'
8454f9ac78aSmrgcase `pwd` in
8464f9ac78aSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8474f9ac78aSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8484f9ac78aSmrgesac
8494f9ac78aSmrgcase $srcdir in
8504f9ac78aSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85169ef5f27Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8524f9ac78aSmrgesac
8534f9ac78aSmrg
85469ef5f27Smrg# Do 'set' in a subshell so we don't clobber the current shell's
855d1333322Smrg# arguments.  Must try -L first in case configure is actually a
856d1333322Smrg# symlink; some systems play weird games with the mod time of symlinks
857d1333322Smrg# (eg FreeBSD returns the mod time of the symlink's containing
858d1333322Smrg# directory).
859d1333322Smrgif (
86069ef5f27Smrg   am_has_slept=no
86169ef5f27Smrg   for am_try in 1 2; do
86269ef5f27Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86369ef5f27Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86469ef5f27Smrg     if test "$[*]" = "X"; then
86569ef5f27Smrg	# -L didn't work.
86669ef5f27Smrg	set X `ls -t "$srcdir/configure" conftest.file`
86769ef5f27Smrg     fi
86869ef5f27Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
86969ef5f27Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87069ef5f27Smrg
87169ef5f27Smrg	# If neither matched, then we have a broken ls.  This can happen
87269ef5f27Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87369ef5f27Smrg	# broken ls alias from the environment.  This has actually
87469ef5f27Smrg	# happened.  Such a system could not be considered "sane".
87569ef5f27Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87669ef5f27Smrg  alias in your environment])
87769ef5f27Smrg     fi
87869ef5f27Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
87969ef5f27Smrg       break
88069ef5f27Smrg     fi
88169ef5f27Smrg     # Just in case.
88269ef5f27Smrg     sleep 1
88369ef5f27Smrg     am_has_slept=yes
88469ef5f27Smrg   done
885d1333322Smrg   test "$[2]" = conftest.file
886d1333322Smrg   )
887d1333322Smrgthen
888d1333322Smrg   # Ok.
889d1333322Smrg   :
890d1333322Smrgelse
891d1333322Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
892d1333322SmrgCheck your system clock])
893d1333322Smrgfi
89469ef5f27SmrgAC_MSG_RESULT([yes])
89569ef5f27Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89669ef5f27Smrg# generated files are strictly newer.
89769ef5f27Smrgam_sleep_pid=
89869ef5f27Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
89969ef5f27Smrg  ( sleep 1 ) &
90069ef5f27Smrg  am_sleep_pid=$!
90169ef5f27Smrgfi
90269ef5f27SmrgAC_CONFIG_COMMANDS_PRE(
90369ef5f27Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90469ef5f27Smrg   if test -n "$am_sleep_pid"; then
90569ef5f27Smrg     # Hide warnings about reused PIDs.
90669ef5f27Smrg     wait $am_sleep_pid 2>/dev/null
90769ef5f27Smrg   fi
90869ef5f27Smrg   AC_MSG_RESULT([done])])
90969ef5f27Smrgrm -f conftest.file
91069ef5f27Smrg])
911d1333322Smrg
91269ef5f27Smrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
9134f9ac78aSmrg#
9144f9ac78aSmrg# This file is free software; the Free Software Foundation
9154f9ac78aSmrg# gives unlimited permission to copy and/or distribute it,
9164f9ac78aSmrg# with or without modifications, as long as this notice is preserved.
9174f9ac78aSmrg
9184f9ac78aSmrg# AM_SILENT_RULES([DEFAULT])
9194f9ac78aSmrg# --------------------------
9204f9ac78aSmrg# Enable less verbose build rules; with the default set to DEFAULT
92169ef5f27Smrg# ("yes" being less verbose, "no" or empty being verbose).
9224f9ac78aSmrgAC_DEFUN([AM_SILENT_RULES],
92369ef5f27Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92469ef5f27SmrgAS_HELP_STRING(
92569ef5f27Smrg  [--enable-silent-rules],
92669ef5f27Smrg  [less verbose build output (undo: "make V=1")])
92769ef5f27SmrgAS_HELP_STRING(
92869ef5f27Smrg  [--disable-silent-rules],
92969ef5f27Smrg  [verbose build output (undo: "make V=0")])dnl
93069ef5f27Smrg])
93169ef5f27Smrgcase $enable_silent_rules in @%:@ (((
93269ef5f27Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93369ef5f27Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93469ef5f27Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9354f9ac78aSmrgesac
93669ef5f27Smrgdnl
93769ef5f27Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93869ef5f27Smrgdnl do not support nested variable expansions.
93969ef5f27Smrgdnl See automake bug#9928 and bug#10237.
94069ef5f27Smrgam_make=${MAKE-make}
94169ef5f27SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94269ef5f27Smrg   [am_cv_make_support_nested_variables],
94369ef5f27Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94469ef5f27SmrgBAR0=false
94569ef5f27SmrgBAR1=true
94669ef5f27SmrgV=1
94769ef5f27Smrgam__doit:
94869ef5f27Smrg	@$(TRUE)
94969ef5f27Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95069ef5f27Smrg  am_cv_make_support_nested_variables=yes
95169ef5f27Smrgelse
95269ef5f27Smrg  am_cv_make_support_nested_variables=no
95369ef5f27Smrgfi])
95469ef5f27Smrgif test $am_cv_make_support_nested_variables = yes; then
95569ef5f27Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95669ef5f27Smrg  AM_V='$(V)'
95769ef5f27Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95869ef5f27Smrgelse
95969ef5f27Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96069ef5f27Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
96169ef5f27Smrgfi
96269ef5f27SmrgAC_SUBST([AM_V])dnl
96369ef5f27SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96469ef5f27SmrgAC_SUBST([AM_DEFAULT_V])dnl
96569ef5f27SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9664f9ac78aSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9674f9ac78aSmrgAM_BACKSLASH='\'
9684f9ac78aSmrgAC_SUBST([AM_BACKSLASH])dnl
9694f9ac78aSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9704f9ac78aSmrg])
9714f9ac78aSmrg
97269ef5f27Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
973d1333322Smrg#
974d1333322Smrg# This file is free software; the Free Software Foundation
975d1333322Smrg# gives unlimited permission to copy and/or distribute it,
976d1333322Smrg# with or without modifications, as long as this notice is preserved.
977d1333322Smrg
978d1333322Smrg# AM_PROG_INSTALL_STRIP
979d1333322Smrg# ---------------------
98069ef5f27Smrg# One issue with vendor 'install' (even GNU) is that you can't
981d1333322Smrg# specify the program used to strip binaries.  This is especially
982d1333322Smrg# annoying in cross-compiling environments, where the build's strip
983d1333322Smrg# is unlikely to handle the host's binaries.
984d1333322Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98569ef5f27Smrg# always use install-sh in "make install-strip", and initialize
986d1333322Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
987d1333322SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
988d1333322Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
98969ef5f27Smrg# Installed binaries are usually stripped using 'strip' when the user
99069ef5f27Smrg# run "make install-strip".  However 'strip' might not be the right
991d1333322Smrg# tool to use in cross-compilation environments, therefore Automake
99269ef5f27Smrg# will honor the 'STRIP' environment variable to overrule this program.
99369ef5f27Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
994d1333322Smrgif test "$cross_compiling" != no; then
995d1333322Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
996d1333322Smrgfi
997d1333322SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
998d1333322SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
999d1333322Smrg
100069ef5f27Smrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
1001d1333322Smrg#
1002d1333322Smrg# This file is free software; the Free Software Foundation
1003d1333322Smrg# gives unlimited permission to copy and/or distribute it,
1004d1333322Smrg# with or without modifications, as long as this notice is preserved.
1005d1333322Smrg
1006d1333322Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1007d1333322Smrg# ---------------------------
10084f9ac78aSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1009d1333322Smrg# This macro is traced by Automake.
1010d1333322SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1011d1333322Smrg
10124f9ac78aSmrg# AM_SUBST_NOTMAKE(VARIABLE)
1013c27291ebSmrg# --------------------------
10144f9ac78aSmrg# Public sister of _AM_SUBST_NOTMAKE.
10154f9ac78aSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10164f9ac78aSmrg
1017d1333322Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1018d1333322Smrg
101969ef5f27Smrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
1020d1333322Smrg#
1021d1333322Smrg# This file is free software; the Free Software Foundation
1022d1333322Smrg# gives unlimited permission to copy and/or distribute it,
1023d1333322Smrg# with or without modifications, as long as this notice is preserved.
1024d1333322Smrg
1025d1333322Smrg# _AM_PROG_TAR(FORMAT)
1026d1333322Smrg# --------------------
1027d1333322Smrg# Check how to create a tarball in format FORMAT.
102869ef5f27Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1029d1333322Smrg#
1030d1333322Smrg# Substitute a variable $(am__tar) that is a command
1031d1333322Smrg# writing to stdout a FORMAT-tarball containing the directory
1032d1333322Smrg# $tardir.
1033d1333322Smrg#     tardir=directory && $(am__tar) > result.tar
1034d1333322Smrg#
1035d1333322Smrg# Substitute a variable $(am__untar) that extract such
1036d1333322Smrg# a tarball read from stdin.
1037d1333322Smrg#     $(am__untar) < result.tar
103869ef5f27Smrg#
1039d1333322SmrgAC_DEFUN([_AM_PROG_TAR],
104069ef5f27Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104169ef5f27Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104269ef5f27SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
104369ef5f27Smrg
104469ef5f27Smrg# We'll loop over all known methods to create a tar archive until one works.
1045d1333322Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1046d1333322Smrg
104769ef5f27Smrgm4_if([$1], [v7],
104869ef5f27Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
104969ef5f27Smrg
105069ef5f27Smrg  [m4_case([$1],
105169ef5f27Smrg    [ustar],
105269ef5f27Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105369ef5f27Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105469ef5f27Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105569ef5f27Smrg      # and bug#13588).
105669ef5f27Smrg      am_max_uid=2097151 # 2^21 - 1
105769ef5f27Smrg      am_max_gid=$am_max_uid
105869ef5f27Smrg      # The $UID and $GID variables are not portable, so we need to resort
105969ef5f27Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106069ef5f27Smrg      # below are definitely unexpected, so allow the users to see them
106169ef5f27Smrg      # (that is, avoid stderr redirection).
106269ef5f27Smrg      am_uid=`id -u || echo unknown`
106369ef5f27Smrg      am_gid=`id -g || echo unknown`
106469ef5f27Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106569ef5f27Smrg      if test $am_uid -le $am_max_uid; then
106669ef5f27Smrg         AC_MSG_RESULT([yes])
106769ef5f27Smrg      else
106869ef5f27Smrg         AC_MSG_RESULT([no])
106969ef5f27Smrg         _am_tools=none
107069ef5f27Smrg      fi
107169ef5f27Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107269ef5f27Smrg      if test $am_gid -le $am_max_gid; then
107369ef5f27Smrg         AC_MSG_RESULT([yes])
107469ef5f27Smrg      else
107569ef5f27Smrg        AC_MSG_RESULT([no])
107669ef5f27Smrg        _am_tools=none
107769ef5f27Smrg      fi],
107869ef5f27Smrg
107969ef5f27Smrg  [pax],
108069ef5f27Smrg    [],
108169ef5f27Smrg
108269ef5f27Smrg  [m4_fatal([Unknown tar format])])
108369ef5f27Smrg
108469ef5f27Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108569ef5f27Smrg
108669ef5f27Smrg  # Go ahead even if we have the value already cached.  We do so because we
108769ef5f27Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108869ef5f27Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
108969ef5f27Smrg
109069ef5f27Smrg  for _am_tool in $_am_tools; do
109169ef5f27Smrg    case $_am_tool in
109269ef5f27Smrg    gnutar)
109369ef5f27Smrg      for _am_tar in tar gnutar gtar; do
109469ef5f27Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109569ef5f27Smrg      done
109669ef5f27Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109769ef5f27Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109869ef5f27Smrg      am__untar="$_am_tar -xf -"
109969ef5f27Smrg      ;;
110069ef5f27Smrg    plaintar)
110169ef5f27Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110269ef5f27Smrg      # ustar tarball either.
110369ef5f27Smrg      (tar --version) >/dev/null 2>&1 && continue
110469ef5f27Smrg      am__tar='tar chf - "$$tardir"'
110569ef5f27Smrg      am__tar_='tar chf - "$tardir"'
110669ef5f27Smrg      am__untar='tar xf -'
110769ef5f27Smrg      ;;
110869ef5f27Smrg    pax)
110969ef5f27Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111069ef5f27Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111169ef5f27Smrg      am__untar='pax -r'
111269ef5f27Smrg      ;;
111369ef5f27Smrg    cpio)
111469ef5f27Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111569ef5f27Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111669ef5f27Smrg      am__untar='cpio -i -H $1 -d'
111769ef5f27Smrg      ;;
111869ef5f27Smrg    none)
111969ef5f27Smrg      am__tar=false
112069ef5f27Smrg      am__tar_=false
112169ef5f27Smrg      am__untar=false
112269ef5f27Smrg      ;;
112369ef5f27Smrg    esac
1124d1333322Smrg
112569ef5f27Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112669ef5f27Smrg    # and am__untar set.
112769ef5f27Smrg    test -n "${am_cv_prog_tar_$1}" && break
112869ef5f27Smrg
112969ef5f27Smrg    # tar/untar a dummy directory, and stop if the command works.
113069ef5f27Smrg    rm -rf conftest.dir
113169ef5f27Smrg    mkdir conftest.dir
113269ef5f27Smrg    echo GrepMe > conftest.dir/file
113369ef5f27Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113469ef5f27Smrg    rm -rf conftest.dir
113569ef5f27Smrg    if test -s conftest.tar; then
113669ef5f27Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
113769ef5f27Smrg      AM_RUN_LOG([cat conftest.dir/file])
113869ef5f27Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
113969ef5f27Smrg    fi
114069ef5f27Smrg  done
1141d1333322Smrg  rm -rf conftest.dir
1142d1333322Smrg
114369ef5f27Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114469ef5f27Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
114569ef5f27Smrg
1146d1333322SmrgAC_SUBST([am__tar])
1147d1333322SmrgAC_SUBST([am__untar])
1148d1333322Smrg]) # _AM_PROG_TAR
1149d1333322Smrg
1150c27291ebSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1151c27291ebSmrg# 
1152c27291ebSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1153c27291ebSmrg#
1154c27291ebSmrg# This program is free software; you can redistribute it and/or modify
1155c27291ebSmrg# it under the terms of the GNU General Public License as published by
1156c27291ebSmrg# the Free Software Foundation; either version 2 of the License, or
1157c27291ebSmrg# (at your option) any later version.
1158c27291ebSmrg#
1159c27291ebSmrg# This program is distributed in the hope that it will be useful, but
1160c27291ebSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1161c27291ebSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1162c27291ebSmrg# General Public License for more details.
1163c27291ebSmrg#
1164c27291ebSmrg# You should have received a copy of the GNU General Public License
1165c27291ebSmrg# along with this program; if not, write to the Free Software
1166c27291ebSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1167c27291ebSmrg#
1168c27291ebSmrg# As a special exception to the GNU General Public License, if you
1169c27291ebSmrg# distribute this file as part of a program that contains a
1170c27291ebSmrg# configuration script generated by Autoconf, you may include it under
1171c27291ebSmrg# the same distribution terms that you use for the rest of that program.
1172c27291ebSmrg
1173c27291ebSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1174c27291ebSmrg# ----------------------------------
1175c27291ebSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1176c27291ebSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1177c27291ebSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1178c27291ebSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1179c27291ebSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1180c27291ebSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1181c27291ebSmrgfi
1182c27291ebSmrgif test -n "$PKG_CONFIG"; then
1183c27291ebSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1184c27291ebSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1185c27291ebSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1186c27291ebSmrg		AC_MSG_RESULT([yes])
1187c27291ebSmrg	else
1188c27291ebSmrg		AC_MSG_RESULT([no])
1189c27291ebSmrg		PKG_CONFIG=""
1190c27291ebSmrg	fi
1191c27291ebSmrg		
1192c27291ebSmrgfi[]dnl
1193c27291ebSmrg])# PKG_PROG_PKG_CONFIG
1194c27291ebSmrg
1195c27291ebSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1196c27291ebSmrg#
1197c27291ebSmrg# Check to see whether a particular set of modules exists.  Similar
1198c27291ebSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1199c27291ebSmrg#
1200c27291ebSmrg#
1201c27291ebSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1202c27291ebSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
1203c27291ebSmrg# PKG_CHECK_EXISTS manually
1204c27291ebSmrg# --------------------------------------------------------------
1205c27291ebSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1206c27291ebSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1207c27291ebSmrgif test -n "$PKG_CONFIG" && \
1208c27291ebSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1209c27291ebSmrg  m4_ifval([$2], [$2], [:])
1210c27291ebSmrgm4_ifvaln([$3], [else
1211c27291ebSmrg  $3])dnl
1212c27291ebSmrgfi])
1213c27291ebSmrg
1214c27291ebSmrg
1215c27291ebSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1216c27291ebSmrg# ---------------------------------------------
1217c27291ebSmrgm4_define([_PKG_CONFIG],
1218c27291ebSmrg[if test -n "$$1"; then
1219c27291ebSmrg    pkg_cv_[]$1="$$1"
1220c27291ebSmrg elif test -n "$PKG_CONFIG"; then
1221c27291ebSmrg    PKG_CHECK_EXISTS([$3],
1222c27291ebSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1223c27291ebSmrg		     [pkg_failed=yes])
1224c27291ebSmrg else
1225c27291ebSmrg    pkg_failed=untried
1226c27291ebSmrgfi[]dnl
1227c27291ebSmrg])# _PKG_CONFIG
1228c27291ebSmrg
1229c27291ebSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1230c27291ebSmrg# -----------------------------
1231c27291ebSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1232c27291ebSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1233c27291ebSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1234c27291ebSmrg        _pkg_short_errors_supported=yes
1235c27291ebSmrgelse
1236c27291ebSmrg        _pkg_short_errors_supported=no
1237c27291ebSmrgfi[]dnl
1238c27291ebSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1239c27291ebSmrg
1240c27291ebSmrg
1241c27291ebSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1242c27291ebSmrg# [ACTION-IF-NOT-FOUND])
1243c27291ebSmrg#
1244c27291ebSmrg#
1245c27291ebSmrg# Note that if there is a possibility the first call to
1246c27291ebSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1247c27291ebSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1248c27291ebSmrg#
1249c27291ebSmrg#
1250c27291ebSmrg# --------------------------------------------------------------
1251c27291ebSmrgAC_DEFUN([PKG_CHECK_MODULES],
1252c27291ebSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1253c27291ebSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1254c27291ebSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1255c27291ebSmrg
1256c27291ebSmrgpkg_failed=no
1257c27291ebSmrgAC_MSG_CHECKING([for $1])
1258c27291ebSmrg
1259c27291ebSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1260c27291ebSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1261c27291ebSmrg
1262c27291ebSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1263c27291ebSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1264c27291ebSmrgSee the pkg-config man page for more details.])
1265c27291ebSmrg
1266c27291ebSmrgif test $pkg_failed = yes; then
1267c27291ebSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1268c27291ebSmrg        if test $_pkg_short_errors_supported = yes; then
1269c27291ebSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1270c27291ebSmrg        else 
1271c27291ebSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1272c27291ebSmrg        fi
1273c27291ebSmrg	# Put the nasty error message in config.log where it belongs
1274c27291ebSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1275c27291ebSmrg
1276c27291ebSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1277c27291ebSmrg[Package requirements ($2) were not met:
1278c27291ebSmrg
1279c27291ebSmrg$$1_PKG_ERRORS
1280c27291ebSmrg
1281c27291ebSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1282c27291ebSmrginstalled software in a non-standard prefix.
1283c27291ebSmrg
1284c27291ebSmrg_PKG_TEXT
1285c27291ebSmrg])],
1286c27291ebSmrg		[AC_MSG_RESULT([no])
1287c27291ebSmrg                $4])
1288c27291ebSmrgelif test $pkg_failed = untried; then
1289c27291ebSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1290c27291ebSmrg[The pkg-config script could not be found or is too old.  Make sure it
1291c27291ebSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1292c27291ebSmrgpath to pkg-config.
1293c27291ebSmrg
1294c27291ebSmrg_PKG_TEXT
1295c27291ebSmrg
1296c27291ebSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1297c27291ebSmrg		[$4])
1298c27291ebSmrgelse
1299c27291ebSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1300c27291ebSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1301c27291ebSmrg        AC_MSG_RESULT([yes])
1302c27291ebSmrg	ifelse([$3], , :, [$3])
1303c27291ebSmrgfi[]dnl
1304c27291ebSmrg])# PKG_CHECK_MODULES
1305c27291ebSmrg
13064f9ac78aSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1307d1333322Smrgdnl
13084f9ac78aSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
130969ef5f27Smrgdnl
1310d1333322Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
13114f9ac78aSmrgdnl copy of this software and associated documentation files (the "Software"),
13124f9ac78aSmrgdnl to deal in the Software without restriction, including without limitation
13134f9ac78aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
13144f9ac78aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
13154f9ac78aSmrgdnl Software is furnished to do so, subject to the following conditions:
1316d1333322Smrgdnl
13174f9ac78aSmrgdnl The above copyright notice and this permission notice (including the next
13184f9ac78aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
13194f9ac78aSmrgdnl Software.
1320d1333322Smrgdnl
13214f9ac78aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13224f9ac78aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13234f9ac78aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
13244f9ac78aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13254f9ac78aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13264f9ac78aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
13274f9ac78aSmrgdnl DEALINGS IN THE SOFTWARE.
1328d1333322Smrg
1329d1333322Smrg# XORG_MACROS_VERSION(required-version)
1330d1333322Smrg# -------------------------------------
1331d1333322Smrg# Minimum version: 1.1.0
1332d1333322Smrg#
1333d1333322Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1334d1333322Smrg# your configure.ac with the minimum required version, such as:
1335d1333322Smrg# XORG_MACROS_VERSION(1.1)
1336d1333322Smrg#
13374f9ac78aSmrg# To ensure that this macro is defined, also add:
13384f9ac78aSmrg# m4_ifndef([XORG_MACROS_VERSION],
13394f9ac78aSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1340d1333322Smrg#
1341d1333322Smrg#
134269ef5f27Smrg# See the "minimum version" comment for each macro you use to see what
1343d1333322Smrg# version you require.
13444f9ac78aSmrgm4_defun([XORG_MACROS_VERSION],[
134569ef5f27Smrgm4_define([vers_have], [1.19.0])
13464f9ac78aSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
13474f9ac78aSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
13484f9ac78aSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
13494f9ac78aSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
13504f9ac78aSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
13514f9ac78aSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
13524f9ac78aSmrgm4_undefine([vers_have])
13534f9ac78aSmrgm4_undefine([maj_have])
13544f9ac78aSmrgm4_undefine([maj_needed])
1355d1333322Smrg]) # XORG_MACROS_VERSION
1356d1333322Smrg
1357d1333322Smrg# XORG_PROG_RAWCPP()
1358d1333322Smrg# ------------------
1359d1333322Smrg# Minimum version: 1.0.0
1360d1333322Smrg#
1361d1333322Smrg# Find cpp program and necessary flags for use in pre-processing text files
1362d1333322Smrg# such as man pages and config files
1363d1333322SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1364d1333322SmrgAC_REQUIRE([AC_PROG_CPP])
136569ef5f27SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
1366d1333322Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1367d1333322Smrg
1368d1333322Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1369d1333322Smrg# which is not the best choice for supporting other OS'es, but covers most
1370d1333322Smrg# of the ones we need for now.
1371d1333322SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1372c27291ebSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1373d1333322Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1374d1333322Smrg	AC_MSG_RESULT([no])
1375d1333322Smrgelse
1376d1333322Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1377d1333322Smrg		RAWCPPFLAGS=-undef
1378d1333322Smrg		AC_MSG_RESULT([yes])
13794f9ac78aSmrg	# under Cygwin unix is still defined even with -undef
13804f9ac78aSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13814f9ac78aSmrg		RAWCPPFLAGS="-undef -ansi"
13824f9ac78aSmrg		AC_MSG_RESULT([yes, with -ansi])
1383d1333322Smrg	else
1384d1333322Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1385d1333322Smrg	fi
1386d1333322Smrgfi
1387d1333322Smrgrm -f conftest.$ac_ext
1388d1333322Smrg
1389d1333322SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1390c27291ebSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1391d1333322Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1392d1333322Smrg	AC_MSG_RESULT([no])
1393d1333322Smrgelse
1394d1333322Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
139569ef5f27Smrg		TRADITIONALCPPFLAGS="-traditional"
1396d1333322Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1397d1333322Smrg		AC_MSG_RESULT([yes])
1398d1333322Smrg	else
1399d1333322Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1400d1333322Smrg	fi
1401d1333322Smrgfi
1402d1333322Smrgrm -f conftest.$ac_ext
1403d1333322SmrgAC_SUBST(RAWCPPFLAGS)
140469ef5f27SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1405d1333322Smrg]) # XORG_PROG_RAWCPP
1406d1333322Smrg
1407d1333322Smrg# XORG_MANPAGE_SECTIONS()
1408d1333322Smrg# -----------------------
1409d1333322Smrg# Minimum version: 1.0.0
1410d1333322Smrg#
1411d1333322Smrg# Determine which sections man pages go in for the different man page types
1412d1333322Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1413d1333322Smrg# Not sure if there's any better way than just hardcoding by OS name.
1414d1333322Smrg# Override default settings by setting environment variables
14154f9ac78aSmrg# Added MAN_SUBSTS in version 1.8
14164f9ac78aSmrg# Added AC_PROG_SED in version 1.8
1417d1333322Smrg
1418d1333322SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1419d1333322SmrgAC_REQUIRE([AC_CANONICAL_HOST])
14204f9ac78aSmrgAC_REQUIRE([AC_PROG_SED])
1421d1333322Smrg
1422d1333322Smrgif test x$APP_MAN_SUFFIX = x    ; then
1423d1333322Smrg    APP_MAN_SUFFIX=1
1424d1333322Smrgfi
1425d1333322Smrgif test x$APP_MAN_DIR = x    ; then
1426d1333322Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1427d1333322Smrgfi
1428d1333322Smrg
1429d1333322Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1430d1333322Smrg    LIB_MAN_SUFFIX=3
1431d1333322Smrgfi
1432d1333322Smrgif test x$LIB_MAN_DIR = x    ; then
1433d1333322Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1434d1333322Smrgfi
1435d1333322Smrg
1436d1333322Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1437d1333322Smrg    case $host_os in
1438d1333322Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1439d1333322Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1440d1333322Smrg    esac
1441d1333322Smrgfi
1442d1333322Smrgif test x$FILE_MAN_DIR = x    ; then
1443d1333322Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1444d1333322Smrgfi
1445d1333322Smrg
1446d1333322Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1447d1333322Smrg    case $host_os in
1448d1333322Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1449d1333322Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1450d1333322Smrg    esac
1451d1333322Smrgfi
1452d1333322Smrgif test x$MISC_MAN_DIR = x    ; then
1453d1333322Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1454d1333322Smrgfi
1455d1333322Smrg
1456d1333322Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1457d1333322Smrg    case $host_os in
1458d1333322Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1459d1333322Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1460d1333322Smrg    esac
1461d1333322Smrgfi
1462d1333322Smrgif test x$DRIVER_MAN_DIR = x    ; then
1463d1333322Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1464d1333322Smrgfi
1465d1333322Smrg
1466d1333322Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1467d1333322Smrg    case $host_os in
1468d1333322Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1469d1333322Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1470d1333322Smrg    esac
1471d1333322Smrgfi
1472d1333322Smrgif test x$ADMIN_MAN_DIR = x    ; then
1473d1333322Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1474d1333322Smrgfi
1475d1333322Smrg
1476d1333322Smrg
1477d1333322SmrgAC_SUBST([APP_MAN_SUFFIX])
1478d1333322SmrgAC_SUBST([LIB_MAN_SUFFIX])
1479d1333322SmrgAC_SUBST([FILE_MAN_SUFFIX])
1480d1333322SmrgAC_SUBST([MISC_MAN_SUFFIX])
1481d1333322SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1482d1333322SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1483d1333322SmrgAC_SUBST([APP_MAN_DIR])
1484d1333322SmrgAC_SUBST([LIB_MAN_DIR])
1485d1333322SmrgAC_SUBST([FILE_MAN_DIR])
1486d1333322SmrgAC_SUBST([MISC_MAN_DIR])
1487d1333322SmrgAC_SUBST([DRIVER_MAN_DIR])
1488d1333322SmrgAC_SUBST([ADMIN_MAN_DIR])
14894f9ac78aSmrg
14904f9ac78aSmrgXORG_MAN_PAGE="X Version 11"
14914f9ac78aSmrgAC_SUBST([XORG_MAN_PAGE])
14924f9ac78aSmrgMAN_SUBSTS="\
14934f9ac78aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
14944f9ac78aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
14954f9ac78aSmrg	-e 's|__xservername__|Xorg|g' \
14964f9ac78aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
14974f9ac78aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
14984f9ac78aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
14994f9ac78aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
15004f9ac78aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
15014f9ac78aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
15024f9ac78aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
15034f9ac78aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
15044f9ac78aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
15054f9ac78aSmrgAC_SUBST([MAN_SUBSTS])
15064f9ac78aSmrg
1507d1333322Smrg]) # XORG_MANPAGE_SECTIONS
1508d1333322Smrg
15094f9ac78aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
15104f9ac78aSmrg# ------------------------
15114f9ac78aSmrg# Minimum version: 1.7.0
15124f9ac78aSmrg#
15134f9ac78aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
15144f9ac78aSmrg# provided by xorg-sgml-doctools, if installed.
15154f9ac78aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
15164f9ac78aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
15174f9ac78aSmrgXORG_SGML_PATH=
15184f9ac78aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
15194f9ac78aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
15204f9ac78aSmrg    [m4_ifval([$1],[:],
15214f9ac78aSmrg        [if test x"$cross_compiling" != x"yes" ; then
15224f9ac78aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
15234f9ac78aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
15244f9ac78aSmrg         fi])
15254f9ac78aSmrg    ])
15264f9ac78aSmrg
15274f9ac78aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
15284f9ac78aSmrg# the path and the name of the doc stylesheet
15294f9ac78aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
15304f9ac78aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
15314f9ac78aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
15324f9ac78aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
15334f9ac78aSmrgelse
15344f9ac78aSmrg   AC_MSG_RESULT([no])
15354f9ac78aSmrgfi
15364f9ac78aSmrg
15374f9ac78aSmrgAC_SUBST(XORG_SGML_PATH)
15384f9ac78aSmrgAC_SUBST(STYLESHEET_SRCDIR)
15394f9ac78aSmrgAC_SUBST(XSL_STYLESHEET)
15404f9ac78aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
15414f9ac78aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
15424f9ac78aSmrg
1543d1333322Smrg# XORG_CHECK_LINUXDOC
1544d1333322Smrg# -------------------
1545d1333322Smrg# Minimum version: 1.0.0
1546d1333322Smrg#
1547d1333322Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1548d1333322Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1549d1333322Smrg# Whether or not the necessary tools and files are found can be checked
1550d1333322Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1551d1333322SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
15524f9ac78aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
15534f9ac78aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1554d1333322Smrg
1555d1333322SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1556d1333322Smrg
15574f9ac78aSmrgAC_MSG_CHECKING([whether to build documentation])
1558d1333322Smrg
15594f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1560d1333322Smrg   BUILDDOC=yes
1561d1333322Smrgelse
1562d1333322Smrg   BUILDDOC=no
1563d1333322Smrgfi
1564d1333322Smrg
1565d1333322SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1566d1333322Smrg
1567d1333322SmrgAC_MSG_RESULT([$BUILDDOC])
1568d1333322Smrg
15694f9ac78aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1570d1333322Smrg
15714f9ac78aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1572d1333322Smrg   BUILDPDFDOC=yes
1573d1333322Smrgelse
1574d1333322Smrg   BUILDPDFDOC=no
1575d1333322Smrgfi
1576d1333322Smrg
1577d1333322SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1578d1333322Smrg
1579d1333322SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1580d1333322Smrg
15814f9ac78aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1582d1333322SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1583d1333322SmrgMAKE_PDF="$PS2PDF"
1584d1333322SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1585d1333322Smrg
1586d1333322SmrgAC_SUBST(MAKE_TEXT)
1587d1333322SmrgAC_SUBST(MAKE_PS)
1588d1333322SmrgAC_SUBST(MAKE_PDF)
1589d1333322SmrgAC_SUBST(MAKE_HTML)
1590d1333322Smrg]) # XORG_CHECK_LINUXDOC
1591d1333322Smrg
1592d1333322Smrg# XORG_CHECK_DOCBOOK
1593d1333322Smrg# -------------------
1594d1333322Smrg# Minimum version: 1.0.0
1595d1333322Smrg#
1596d1333322Smrg# Checks for the ability to build output formats from SGML DocBook source.
1597d1333322Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1598d1333322Smrg# indicates whether the necessary tools and files are found and, if set,
1599d1333322Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1600d1333322SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
16014f9ac78aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16024f9ac78aSmrg
1603d1333322SmrgBUILDTXTDOC=no
1604d1333322SmrgBUILDPDFDOC=no
1605d1333322SmrgBUILDPSDOC=no
1606d1333322SmrgBUILDHTMLDOC=no
1607d1333322Smrg
1608d1333322SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1609d1333322SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1610d1333322SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1611d1333322SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1612d1333322Smrg
16134f9ac78aSmrgAC_MSG_CHECKING([whether to build text documentation])
16144f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1615d1333322Smrg   test x$BUILD_TXTDOC != xno; then
1616d1333322Smrg	BUILDTXTDOC=yes
1617d1333322Smrgfi
1618d1333322SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1619d1333322SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1620d1333322Smrg
16214f9ac78aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
16224f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1623d1333322Smrg   test x$BUILD_PDFDOC != xno; then
1624d1333322Smrg	BUILDPDFDOC=yes
1625d1333322Smrgfi
1626d1333322SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1627d1333322SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1628d1333322Smrg
16294f9ac78aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
16304f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1631d1333322Smrg   test x$BUILD_PSDOC != xno; then
1632d1333322Smrg	BUILDPSDOC=yes
1633d1333322Smrgfi
1634d1333322SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1635d1333322SmrgAC_MSG_RESULT([$BUILDPSDOC])
1636d1333322Smrg
16374f9ac78aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
16384f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1639d1333322Smrg   test x$BUILD_HTMLDOC != xno; then
1640d1333322Smrg	BUILDHTMLDOC=yes
1641d1333322Smrgfi
1642d1333322SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1643d1333322SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1644d1333322Smrg
1645d1333322SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1646d1333322SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1647d1333322SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1648d1333322SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1649d1333322Smrg
1650d1333322SmrgAC_SUBST(MAKE_TEXT)
1651d1333322SmrgAC_SUBST(MAKE_PS)
1652d1333322SmrgAC_SUBST(MAKE_PDF)
1653d1333322SmrgAC_SUBST(MAKE_HTML)
1654d1333322Smrg]) # XORG_CHECK_DOCBOOK
1655d1333322Smrg
16564f9ac78aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
16574f9ac78aSmrg# ----------------
16584f9ac78aSmrg# Minimum version: 1.5.0
16594f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
16604f9ac78aSmrg#
16614f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
16624f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
16634f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
16644f9ac78aSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
16654f9ac78aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
16664f9ac78aSmrg# --with-xmlto assumes 'auto'.
16674f9ac78aSmrg#
16684f9ac78aSmrg# Interface to module:
16694f9ac78aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
16704f9ac78aSmrg# XMLTO:	returns the path of the xmlto program found
16714f9ac78aSmrg#		returns the path set by the user in the environment
16724f9ac78aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
16734f9ac78aSmrg#		'no' user instructs the module not to use xmlto
16744f9ac78aSmrg#
16754f9ac78aSmrg# Added in version 1.10.0
16764f9ac78aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
16774f9ac78aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
16784f9ac78aSmrg#
16794f9ac78aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
16804f9ac78aSmrg#
16814f9ac78aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
16824f9ac78aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
16834f9ac78aSmrgm4_define([_defopt], m4_default([$2], [auto]))
16844f9ac78aSmrgAC_ARG_WITH(xmlto,
16854f9ac78aSmrg	AS_HELP_STRING([--with-xmlto],
16864f9ac78aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
16874f9ac78aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
16884f9ac78aSmrgm4_undefine([_defopt])
16894f9ac78aSmrg
16904f9ac78aSmrgif test "x$use_xmlto" = x"auto"; then
16914f9ac78aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
16924f9ac78aSmrg   if test "x$XMLTO" = "x"; then
16934f9ac78aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
16944f9ac78aSmrg	have_xmlto=no
16954f9ac78aSmrg   else
16964f9ac78aSmrg        have_xmlto=yes
16974f9ac78aSmrg   fi
16984f9ac78aSmrgelif test "x$use_xmlto" = x"yes" ; then
16994f9ac78aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
17004f9ac78aSmrg   if test "x$XMLTO" = "x"; then
17014f9ac78aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
17024f9ac78aSmrg   fi
17034f9ac78aSmrg   have_xmlto=yes
17044f9ac78aSmrgelif test "x$use_xmlto" = x"no" ; then
17054f9ac78aSmrg   if test "x$XMLTO" != "x"; then
17064f9ac78aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
17074f9ac78aSmrg   fi
17084f9ac78aSmrg   have_xmlto=no
17094f9ac78aSmrgelse
17104f9ac78aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
17114f9ac78aSmrgfi
17124f9ac78aSmrg
17134f9ac78aSmrg# Test for a minimum version of xmlto, if provided.
17144f9ac78aSmrgm4_ifval([$1],
17154f9ac78aSmrg[if test "$have_xmlto" = yes; then
17164f9ac78aSmrg    # scrape the xmlto version
17174f9ac78aSmrg    AC_MSG_CHECKING([the xmlto version])
17184f9ac78aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
17194f9ac78aSmrg    AC_MSG_RESULT([$xmlto_version])
17204f9ac78aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
17214f9ac78aSmrg        [if test "x$use_xmlto" = xauto; then
17224f9ac78aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
17234f9ac78aSmrg            have_xmlto=no
17244f9ac78aSmrg        else
17254f9ac78aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
17264f9ac78aSmrg        fi])
17274f9ac78aSmrgfi])
17284f9ac78aSmrg
17294f9ac78aSmrg# Test for the ability of xmlto to generate a text target
17304f9ac78aSmrghave_xmlto_text=no
17314f9ac78aSmrgcat > conftest.xml << "EOF"
17324f9ac78aSmrgEOF
17334f9ac78aSmrgAS_IF([test "$have_xmlto" = yes],
17344f9ac78aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
17354f9ac78aSmrg             [have_xmlto_text=yes],
17364f9ac78aSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
17374f9ac78aSmrgrm -f conftest.xml
17384f9ac78aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
17394f9ac78aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
17404f9ac78aSmrg]) # XORG_WITH_XMLTO
17414f9ac78aSmrg
1742c27291ebSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1743c27291ebSmrg# --------------------------------------------
1744c27291ebSmrg# Minimum version: 1.12.0
1745c27291ebSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1746c27291ebSmrg#
1747c27291ebSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1748c27291ebSmrg# XML-based language used for the transformation of XML documents.
1749c27291ebSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1750c27291ebSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1751c27291ebSmrg# The XSLT processor is often used as a standalone tool for transformations.
1752c27291ebSmrg# It should not be assumed that this tool is used only to work with documnetation.
1753c27291ebSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1754c27291ebSmrg#
1755c27291ebSmrg# Interface to module:
1756c27291ebSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1757c27291ebSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1758c27291ebSmrg#		 returns the path set by the user in the environment
1759c27291ebSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1760c27291ebSmrg#		  'no' user instructs the module not to use xsltproc
1761c27291ebSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1762c27291ebSmrg#
1763c27291ebSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1764c27291ebSmrg#
1765c27291ebSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1766c27291ebSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1767c27291ebSmrg# Preserves the interface, should it be implemented later
1768c27291ebSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1769c27291ebSmrgm4_define([_defopt], m4_default([$2], [auto]))
1770c27291ebSmrgAC_ARG_WITH(xsltproc,
1771c27291ebSmrg	AS_HELP_STRING([--with-xsltproc],
1772c27291ebSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1773c27291ebSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1774c27291ebSmrgm4_undefine([_defopt])
1775c27291ebSmrg
1776c27291ebSmrgif test "x$use_xsltproc" = x"auto"; then
1777c27291ebSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1778c27291ebSmrg   if test "x$XSLTPROC" = "x"; then
1779c27291ebSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1780c27291ebSmrg	have_xsltproc=no
1781c27291ebSmrg   else
1782c27291ebSmrg        have_xsltproc=yes
1783c27291ebSmrg   fi
1784c27291ebSmrgelif test "x$use_xsltproc" = x"yes" ; then
1785c27291ebSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1786c27291ebSmrg   if test "x$XSLTPROC" = "x"; then
1787c27291ebSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1788c27291ebSmrg   fi
1789c27291ebSmrg   have_xsltproc=yes
1790c27291ebSmrgelif test "x$use_xsltproc" = x"no" ; then
1791c27291ebSmrg   if test "x$XSLTPROC" != "x"; then
1792c27291ebSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1793c27291ebSmrg   fi
1794c27291ebSmrg   have_xsltproc=no
1795c27291ebSmrgelse
1796c27291ebSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1797c27291ebSmrgfi
1798c27291ebSmrg
1799c27291ebSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1800c27291ebSmrg]) # XORG_WITH_XSLTPROC
1801c27291ebSmrg
1802c27291ebSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1803c27291ebSmrg# ----------------------------------------
1804c27291ebSmrg# Minimum version: 1.15.0
1805c27291ebSmrg#
1806c27291ebSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1807c27291ebSmrg# scanning arbitrary text files, extracting information from those text files,
1808c27291ebSmrg# and printing reports based on that information.
1809c27291ebSmrg#
1810c27291ebSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1811c27291ebSmrg#
1812c27291ebSmrg# Interface to module:
1813c27291ebSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1814c27291ebSmrg# PERL:	     returns the path of the perl program found
1815c27291ebSmrg#	     returns the path set by the user in the environment
1816c27291ebSmrg# --with-perl: 'yes' user instructs the module to use perl
1817c27291ebSmrg#	       'no' user instructs the module not to use perl
1818c27291ebSmrg# have_perl: returns yes if perl found in PATH or no
1819c27291ebSmrg#
1820c27291ebSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1821c27291ebSmrg#
1822c27291ebSmrgAC_DEFUN([XORG_WITH_PERL],[
1823c27291ebSmrgAC_ARG_VAR([PERL], [Path to perl command])
1824c27291ebSmrg# Preserves the interface, should it be implemented later
1825c27291ebSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1826c27291ebSmrgm4_define([_defopt], m4_default([$2], [auto]))
1827c27291ebSmrgAC_ARG_WITH(perl,
1828c27291ebSmrg	AS_HELP_STRING([--with-perl],
1829c27291ebSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1830c27291ebSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1831c27291ebSmrgm4_undefine([_defopt])
1832c27291ebSmrg
1833c27291ebSmrgif test "x$use_perl" = x"auto"; then
1834c27291ebSmrg   AC_PATH_PROG([PERL], [perl])
1835c27291ebSmrg   if test "x$PERL" = "x"; then
1836c27291ebSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1837c27291ebSmrg	have_perl=no
1838c27291ebSmrg   else
1839c27291ebSmrg        have_perl=yes
1840c27291ebSmrg   fi
1841c27291ebSmrgelif test "x$use_perl" = x"yes" ; then
1842c27291ebSmrg   AC_PATH_PROG([PERL], [perl])
1843c27291ebSmrg   if test "x$PERL" = "x"; then
1844c27291ebSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1845c27291ebSmrg   fi
1846c27291ebSmrg   have_perl=yes
1847c27291ebSmrgelif test "x$use_perl" = x"no" ; then
1848c27291ebSmrg   if test "x$PERL" != "x"; then
1849c27291ebSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1850c27291ebSmrg   fi
1851c27291ebSmrg   have_perl=no
1852c27291ebSmrgelse
1853c27291ebSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1854c27291ebSmrgfi
1855c27291ebSmrg
1856c27291ebSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1857c27291ebSmrg]) # XORG_WITH_PERL
1858c27291ebSmrg
18594f9ac78aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
18604f9ac78aSmrg# ----------------
18614f9ac78aSmrg# Minimum version: 1.5.0
18624f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
18634f9ac78aSmrg#
18644f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
18654f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
18664f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
18674f9ac78aSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
18684f9ac78aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
18694f9ac78aSmrg# --with-asciidoc assumes 'auto'.
18704f9ac78aSmrg#
18714f9ac78aSmrg# Interface to module:
18724f9ac78aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
18734f9ac78aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
18744f9ac78aSmrg#		 returns the path set by the user in the environment
18754f9ac78aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
18764f9ac78aSmrg#		  'no' user instructs the module not to use asciidoc
18774f9ac78aSmrg#
18784f9ac78aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
18794f9ac78aSmrg#
18804f9ac78aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
18814f9ac78aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
18824f9ac78aSmrgm4_define([_defopt], m4_default([$2], [auto]))
18834f9ac78aSmrgAC_ARG_WITH(asciidoc,
18844f9ac78aSmrg	AS_HELP_STRING([--with-asciidoc],
18854f9ac78aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
18864f9ac78aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
18874f9ac78aSmrgm4_undefine([_defopt])
18884f9ac78aSmrg
18894f9ac78aSmrgif test "x$use_asciidoc" = x"auto"; then
18904f9ac78aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
18914f9ac78aSmrg   if test "x$ASCIIDOC" = "x"; then
18924f9ac78aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
18934f9ac78aSmrg	have_asciidoc=no
18944f9ac78aSmrg   else
18954f9ac78aSmrg        have_asciidoc=yes
18964f9ac78aSmrg   fi
18974f9ac78aSmrgelif test "x$use_asciidoc" = x"yes" ; then
18984f9ac78aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
18994f9ac78aSmrg   if test "x$ASCIIDOC" = "x"; then
19004f9ac78aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
19014f9ac78aSmrg   fi
19024f9ac78aSmrg   have_asciidoc=yes
19034f9ac78aSmrgelif test "x$use_asciidoc" = x"no" ; then
19044f9ac78aSmrg   if test "x$ASCIIDOC" != "x"; then
19054f9ac78aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
19064f9ac78aSmrg   fi
19074f9ac78aSmrg   have_asciidoc=no
19084f9ac78aSmrgelse
19094f9ac78aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
19104f9ac78aSmrgfi
19114f9ac78aSmrgm4_ifval([$1],
19124f9ac78aSmrg[if test "$have_asciidoc" = yes; then
19134f9ac78aSmrg    # scrape the asciidoc version
19144f9ac78aSmrg    AC_MSG_CHECKING([the asciidoc version])
19154f9ac78aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
19164f9ac78aSmrg    AC_MSG_RESULT([$asciidoc_version])
19174f9ac78aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
19184f9ac78aSmrg        [if test "x$use_asciidoc" = xauto; then
19194f9ac78aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
19204f9ac78aSmrg            have_asciidoc=no
19214f9ac78aSmrg        else
19224f9ac78aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
19234f9ac78aSmrg        fi])
19244f9ac78aSmrgfi])
19254f9ac78aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
19264f9ac78aSmrg]) # XORG_WITH_ASCIIDOC
19274f9ac78aSmrg
19284f9ac78aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
192969ef5f27Smrg# -------------------------------------------
19304f9ac78aSmrg# Minimum version: 1.5.0
19314f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
193269ef5f27Smrg# Minimum version for optional DOT checking: 1.18.0
19334f9ac78aSmrg#
19344f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
19354f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
19364f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
19374f9ac78aSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
19384f9ac78aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
19394f9ac78aSmrg# --with-doxygen assumes 'auto'.
19404f9ac78aSmrg#
19414f9ac78aSmrg# Interface to module:
19424f9ac78aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
19434f9ac78aSmrg# DOXYGEN:	 returns the path of the doxygen program found
19444f9ac78aSmrg#		 returns the path set by the user in the environment
19454f9ac78aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
19464f9ac78aSmrg#		  'no' user instructs the module not to use doxygen
19474f9ac78aSmrg#
19484f9ac78aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
19494f9ac78aSmrg#
19504f9ac78aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
19514f9ac78aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
195269ef5f27SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
19534f9ac78aSmrgm4_define([_defopt], m4_default([$2], [auto]))
19544f9ac78aSmrgAC_ARG_WITH(doxygen,
19554f9ac78aSmrg	AS_HELP_STRING([--with-doxygen],
19564f9ac78aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
19574f9ac78aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
19584f9ac78aSmrgm4_undefine([_defopt])
19594f9ac78aSmrg
19604f9ac78aSmrgif test "x$use_doxygen" = x"auto"; then
19614f9ac78aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
19624f9ac78aSmrg   if test "x$DOXYGEN" = "x"; then
19634f9ac78aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
19644f9ac78aSmrg	have_doxygen=no
19654f9ac78aSmrg   else
19664f9ac78aSmrg        have_doxygen=yes
19674f9ac78aSmrg   fi
19684f9ac78aSmrgelif test "x$use_doxygen" = x"yes" ; then
19694f9ac78aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
19704f9ac78aSmrg   if test "x$DOXYGEN" = "x"; then
19714f9ac78aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
19724f9ac78aSmrg   fi
19734f9ac78aSmrg   have_doxygen=yes
19744f9ac78aSmrgelif test "x$use_doxygen" = x"no" ; then
19754f9ac78aSmrg   if test "x$DOXYGEN" != "x"; then
19764f9ac78aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
19774f9ac78aSmrg   fi
19784f9ac78aSmrg   have_doxygen=no
19794f9ac78aSmrgelse
19804f9ac78aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
19814f9ac78aSmrgfi
19824f9ac78aSmrgm4_ifval([$1],
19834f9ac78aSmrg[if test "$have_doxygen" = yes; then
19844f9ac78aSmrg    # scrape the doxygen version
19854f9ac78aSmrg    AC_MSG_CHECKING([the doxygen version])
19864f9ac78aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
19874f9ac78aSmrg    AC_MSG_RESULT([$doxygen_version])
19884f9ac78aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
19894f9ac78aSmrg        [if test "x$use_doxygen" = xauto; then
19904f9ac78aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
19914f9ac78aSmrg            have_doxygen=no
19924f9ac78aSmrg        else
19934f9ac78aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
19944f9ac78aSmrg        fi])
19954f9ac78aSmrgfi])
199669ef5f27Smrg
199769ef5f27Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
199869ef5f27Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
199969ef5f27Smrgdnl 	HAVE_DOT = @HAVE_DOT@
200069ef5f27SmrgHAVE_DOT=no
200169ef5f27Smrgif test "x$have_doxygen" = "xyes"; then
200269ef5f27Smrg  AC_PATH_PROG([DOT], [dot])
200369ef5f27Smrg    if test "x$DOT" != "x"; then
200469ef5f27Smrg      HAVE_DOT=yes
200569ef5f27Smrg    fi
200669ef5f27Smrgfi
200769ef5f27Smrg
200869ef5f27SmrgAC_SUBST([HAVE_DOT])
200969ef5f27SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
20104f9ac78aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
20114f9ac78aSmrg]) # XORG_WITH_DOXYGEN
20124f9ac78aSmrg
20134f9ac78aSmrg# XORG_WITH_GROFF([DEFAULT])
20144f9ac78aSmrg# ----------------
20154f9ac78aSmrg# Minimum version: 1.6.0
20164f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20174f9ac78aSmrg#
20184f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
20194f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
20204f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20214f9ac78aSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
20224f9ac78aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
20234f9ac78aSmrg# --with-groff assumes 'auto'.
20244f9ac78aSmrg#
20254f9ac78aSmrg# Interface to module:
20264f9ac78aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
20274f9ac78aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
20284f9ac78aSmrg# HAVE_GROFF_MS: the -ms macros package
20294f9ac78aSmrg# GROFF:	 returns the path of the groff program found
20304f9ac78aSmrg#		 returns the path set by the user in the environment
20314f9ac78aSmrg# --with-groff:	 'yes' user instructs the module to use groff
20324f9ac78aSmrg#		 'no' user instructs the module not to use groff
20334f9ac78aSmrg#
20344f9ac78aSmrg# Added in version 1.9.0:
20354f9ac78aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
20364f9ac78aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
20374f9ac78aSmrg#		   psselect from the psutils package.
20384f9ac78aSmrg#		   the ghostcript package. Refer to the grohtml man pages
20394f9ac78aSmrg#
20404f9ac78aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
20414f9ac78aSmrg#
20424f9ac78aSmrg# OS and distros often splits groff in a basic and full package, the former
20434f9ac78aSmrg# having the groff program and the later having devices, fonts and macros
20444f9ac78aSmrg# Checking for the groff executable is not enough.
20454f9ac78aSmrg#
20464f9ac78aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
20474f9ac78aSmrg# unset HAVE_GROFF or GROFF env variables.
20484f9ac78aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
20494f9ac78aSmrg#
20504f9ac78aSmrgAC_DEFUN([XORG_WITH_GROFF],[
20514f9ac78aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
20524f9ac78aSmrgm4_define([_defopt], m4_default([$1], [auto]))
20534f9ac78aSmrgAC_ARG_WITH(groff,
20544f9ac78aSmrg	AS_HELP_STRING([--with-groff],
20554f9ac78aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
20564f9ac78aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
20574f9ac78aSmrgm4_undefine([_defopt])
20584f9ac78aSmrg
20594f9ac78aSmrgif test "x$use_groff" = x"auto"; then
20604f9ac78aSmrg   AC_PATH_PROG([GROFF], [groff])
20614f9ac78aSmrg   if test "x$GROFF" = "x"; then
20624f9ac78aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
20634f9ac78aSmrg	have_groff=no
20644f9ac78aSmrg   else
20654f9ac78aSmrg        have_groff=yes
20664f9ac78aSmrg   fi
20674f9ac78aSmrgelif test "x$use_groff" = x"yes" ; then
20684f9ac78aSmrg   AC_PATH_PROG([GROFF], [groff])
20694f9ac78aSmrg   if test "x$GROFF" = "x"; then
20704f9ac78aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
20714f9ac78aSmrg   fi
20724f9ac78aSmrg   have_groff=yes
20734f9ac78aSmrgelif test "x$use_groff" = x"no" ; then
20744f9ac78aSmrg   if test "x$GROFF" != "x"; then
20754f9ac78aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
20764f9ac78aSmrg   fi
20774f9ac78aSmrg   have_groff=no
20784f9ac78aSmrgelse
20794f9ac78aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
20804f9ac78aSmrgfi
20814f9ac78aSmrg
20824f9ac78aSmrg# We have groff, test for the presence of the macro packages
20834f9ac78aSmrgif test "x$have_groff" = x"yes"; then
20844f9ac78aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
20854f9ac78aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
20864f9ac78aSmrg        groff_ms_works=yes
20874f9ac78aSmrg    else
20884f9ac78aSmrg        groff_ms_works=no
20894f9ac78aSmrg    fi
20904f9ac78aSmrg    AC_MSG_RESULT([$groff_ms_works])
20914f9ac78aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
20924f9ac78aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
20934f9ac78aSmrg        groff_mm_works=yes
20944f9ac78aSmrg    else
20954f9ac78aSmrg        groff_mm_works=no
20964f9ac78aSmrg    fi
20974f9ac78aSmrg    AC_MSG_RESULT([$groff_mm_works])
20984f9ac78aSmrgfi
20994f9ac78aSmrg
21004f9ac78aSmrg# We have groff, test for HTML dependencies, one command per package
21014f9ac78aSmrgif test "x$have_groff" = x"yes"; then
21024f9ac78aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
21034f9ac78aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
21044f9ac78aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
21054f9ac78aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
21064f9ac78aSmrg      have_groff_html=yes
21074f9ac78aSmrg   else
21084f9ac78aSmrg      have_groff_html=no
21094f9ac78aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
21104f9ac78aSmrg   fi
21114f9ac78aSmrgfi
21124f9ac78aSmrg
21134f9ac78aSmrg# Set Automake conditionals for Makefiles
21144f9ac78aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
21154f9ac78aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
21164f9ac78aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
21174f9ac78aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
21184f9ac78aSmrg]) # XORG_WITH_GROFF
21194f9ac78aSmrg
2120c27291ebSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2121c27291ebSmrg# ---------------------------------------
21224f9ac78aSmrg# Minimum version: 1.6.0
21234f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2124c27291ebSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
21254f9ac78aSmrg#
21264f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
21274f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
21284f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
21294f9ac78aSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
21304f9ac78aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
21314f9ac78aSmrg# --with-fop assumes 'auto'.
21324f9ac78aSmrg#
21334f9ac78aSmrg# Interface to module:
21344f9ac78aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
21354f9ac78aSmrg# FOP:	 	returns the path of the fop program found
21364f9ac78aSmrg#		returns the path set by the user in the environment
21374f9ac78aSmrg# --with-fop: 	'yes' user instructs the module to use fop
21384f9ac78aSmrg#		'no' user instructs the module not to use fop
21394f9ac78aSmrg#
21404f9ac78aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
21414f9ac78aSmrg#
21424f9ac78aSmrgAC_DEFUN([XORG_WITH_FOP],[
21434f9ac78aSmrgAC_ARG_VAR([FOP], [Path to fop command])
2144c27291ebSmrgm4_define([_defopt], m4_default([$2], [auto]))
21454f9ac78aSmrgAC_ARG_WITH(fop,
21464f9ac78aSmrg	AS_HELP_STRING([--with-fop],
21474f9ac78aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
21484f9ac78aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
21494f9ac78aSmrgm4_undefine([_defopt])
21504f9ac78aSmrg
21514f9ac78aSmrgif test "x$use_fop" = x"auto"; then
21524f9ac78aSmrg   AC_PATH_PROG([FOP], [fop])
21534f9ac78aSmrg   if test "x$FOP" = "x"; then
21544f9ac78aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
21554f9ac78aSmrg	have_fop=no
21564f9ac78aSmrg   else
21574f9ac78aSmrg        have_fop=yes
21584f9ac78aSmrg   fi
21594f9ac78aSmrgelif test "x$use_fop" = x"yes" ; then
21604f9ac78aSmrg   AC_PATH_PROG([FOP], [fop])
21614f9ac78aSmrg   if test "x$FOP" = "x"; then
21624f9ac78aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
21634f9ac78aSmrg   fi
21644f9ac78aSmrg   have_fop=yes
21654f9ac78aSmrgelif test "x$use_fop" = x"no" ; then
21664f9ac78aSmrg   if test "x$FOP" != "x"; then
21674f9ac78aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
21684f9ac78aSmrg   fi
21694f9ac78aSmrg   have_fop=no
21704f9ac78aSmrgelse
21714f9ac78aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
21724f9ac78aSmrgfi
2173c27291ebSmrg
2174c27291ebSmrg# Test for a minimum version of fop, if provided.
2175c27291ebSmrgm4_ifval([$1],
2176c27291ebSmrg[if test "$have_fop" = yes; then
2177c27291ebSmrg    # scrape the fop version
2178c27291ebSmrg    AC_MSG_CHECKING([for fop minimum version])
2179c27291ebSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2180c27291ebSmrg    AC_MSG_RESULT([$fop_version])
2181c27291ebSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2182c27291ebSmrg        [if test "x$use_fop" = xauto; then
2183c27291ebSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2184c27291ebSmrg            have_fop=no
2185c27291ebSmrg        else
2186c27291ebSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2187c27291ebSmrg        fi])
2188c27291ebSmrgfi])
21894f9ac78aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
21904f9ac78aSmrg]) # XORG_WITH_FOP
21914f9ac78aSmrg
219269ef5f27Smrg# XORG_WITH_M4([MIN-VERSION])
219369ef5f27Smrg# ---------------------------
219469ef5f27Smrg# Minimum version: 1.19.0
219569ef5f27Smrg#
219669ef5f27Smrg# This macro attempts to locate an m4 macro processor which supports
219769ef5f27Smrg# -I option and is only useful for modules relying on M4 in order to
219869ef5f27Smrg# expand macros in source code files.
219969ef5f27Smrg#
220069ef5f27Smrg# Interface to module:
220169ef5f27Smrg# M4:	 	returns the path of the m4 program found
220269ef5f27Smrg#		returns the path set by the user in the environment
220369ef5f27Smrg#
220469ef5f27SmrgAC_DEFUN([XORG_WITH_M4], [
220569ef5f27SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
220669ef5f27Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
220769ef5f27Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
220869ef5f27Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
220969ef5f27Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
221069ef5f27Smrg   [$PATH:/usr/gnu/bin])])
221169ef5f27Smrg
221269ef5f27SmrgAC_SUBST([M4], [$ac_cv_path_M4])
221369ef5f27Smrg]) # XORG_WITH_M4
221469ef5f27Smrg
22154f9ac78aSmrg# XORG_WITH_PS2PDF([DEFAULT])
22164f9ac78aSmrg# ----------------
22174f9ac78aSmrg# Minimum version: 1.6.0
22184f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
22194f9ac78aSmrg#
22204f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
22214f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
22224f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
22234f9ac78aSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
22244f9ac78aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
22254f9ac78aSmrg# --with-ps2pdf assumes 'auto'.
22264f9ac78aSmrg#
22274f9ac78aSmrg# Interface to module:
22284f9ac78aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
22294f9ac78aSmrg# PS2PDF:	returns the path of the ps2pdf program found
22304f9ac78aSmrg#		returns the path set by the user in the environment
22314f9ac78aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
22324f9ac78aSmrg#		 'no' user instructs the module not to use ps2pdf
22334f9ac78aSmrg#
22344f9ac78aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
22354f9ac78aSmrg#
22364f9ac78aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
22374f9ac78aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
22384f9ac78aSmrgm4_define([_defopt], m4_default([$1], [auto]))
22394f9ac78aSmrgAC_ARG_WITH(ps2pdf,
22404f9ac78aSmrg	AS_HELP_STRING([--with-ps2pdf],
22414f9ac78aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
22424f9ac78aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
22434f9ac78aSmrgm4_undefine([_defopt])
22444f9ac78aSmrg
22454f9ac78aSmrgif test "x$use_ps2pdf" = x"auto"; then
22464f9ac78aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
22474f9ac78aSmrg   if test "x$PS2PDF" = "x"; then
22484f9ac78aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
22494f9ac78aSmrg	have_ps2pdf=no
22504f9ac78aSmrg   else
22514f9ac78aSmrg        have_ps2pdf=yes
22524f9ac78aSmrg   fi
22534f9ac78aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
22544f9ac78aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
22554f9ac78aSmrg   if test "x$PS2PDF" = "x"; then
22564f9ac78aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
22574f9ac78aSmrg   fi
22584f9ac78aSmrg   have_ps2pdf=yes
22594f9ac78aSmrgelif test "x$use_ps2pdf" = x"no" ; then
22604f9ac78aSmrg   if test "x$PS2PDF" != "x"; then
22614f9ac78aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
22624f9ac78aSmrg   fi
22634f9ac78aSmrg   have_ps2pdf=no
22644f9ac78aSmrgelse
22654f9ac78aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
22664f9ac78aSmrgfi
22674f9ac78aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
22684f9ac78aSmrg]) # XORG_WITH_PS2PDF
22694f9ac78aSmrg
22704f9ac78aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
22714f9ac78aSmrg# ----------------
22724f9ac78aSmrg# Minimum version: 1.6.0
22734f9ac78aSmrg#
22744f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
22754f9ac78aSmrg# not at the appropriate level. This macro enables a builder to skip all
22764f9ac78aSmrg# documentation targets except traditional man pages.
22774f9ac78aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
22784f9ac78aSmrg# maximum flexibilty in controlling documentation building.
22794f9ac78aSmrg# Refer to:
22804f9ac78aSmrg# XORG_WITH_XMLTO         --with-xmlto
22814f9ac78aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
22824f9ac78aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
22834f9ac78aSmrg# XORG_WITH_FOP           --with-fop
22844f9ac78aSmrg# XORG_WITH_GROFF         --with-groff
22854f9ac78aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
22864f9ac78aSmrg#
22874f9ac78aSmrg# Interface to module:
22884f9ac78aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
22894f9ac78aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
22904f9ac78aSmrg#		 'no' user instructs the module not to generate docs
22914f9ac78aSmrg# parm1:	specify the default value, yes or no.
22924f9ac78aSmrg#
22934f9ac78aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2294c27291ebSmrgm4_define([docs_default], m4_default([$1], [yes]))
22954f9ac78aSmrgAC_ARG_ENABLE(docs,
22964f9ac78aSmrg	AS_HELP_STRING([--enable-docs],
2297c27291ebSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2298c27291ebSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2299c27291ebSmrgm4_undefine([docs_default])
23004f9ac78aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
23014f9ac78aSmrgAC_MSG_CHECKING([whether to build documentation])
23024f9ac78aSmrgAC_MSG_RESULT([$build_docs])
23034f9ac78aSmrg]) # XORG_ENABLE_DOCS
23044f9ac78aSmrg
23054f9ac78aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
23064f9ac78aSmrg# ----------------
23074f9ac78aSmrg# Minimum version: 1.6.0
23084f9ac78aSmrg#
23094f9ac78aSmrg# This macro enables a builder to skip all developer documentation.
23104f9ac78aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23114f9ac78aSmrg# maximum flexibilty in controlling documentation building.
23124f9ac78aSmrg# Refer to:
23134f9ac78aSmrg# XORG_WITH_XMLTO         --with-xmlto
23144f9ac78aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23154f9ac78aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
23164f9ac78aSmrg# XORG_WITH_FOP           --with-fop
23174f9ac78aSmrg# XORG_WITH_GROFF         --with-groff
23184f9ac78aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
23194f9ac78aSmrg#
23204f9ac78aSmrg# Interface to module:
23214f9ac78aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
23224f9ac78aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
23234f9ac78aSmrg#			'no' user instructs the module not to generate developer docs
23244f9ac78aSmrg# parm1:		specify the default value, yes or no.
23254f9ac78aSmrg#
23264f9ac78aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
23274f9ac78aSmrgm4_define([devel_default], m4_default([$1], [yes]))
23284f9ac78aSmrgAC_ARG_ENABLE(devel-docs,
23294f9ac78aSmrg	AS_HELP_STRING([--enable-devel-docs],
23304f9ac78aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
23314f9ac78aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
23324f9ac78aSmrgm4_undefine([devel_default])
23334f9ac78aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
23344f9ac78aSmrgAC_MSG_CHECKING([whether to build developer documentation])
23354f9ac78aSmrgAC_MSG_RESULT([$build_devel_docs])
23364f9ac78aSmrg]) # XORG_ENABLE_DEVEL_DOCS
23374f9ac78aSmrg
23384f9ac78aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
23394f9ac78aSmrg# ----------------
23404f9ac78aSmrg# Minimum version: 1.6.0
23414f9ac78aSmrg#
23424f9ac78aSmrg# This macro enables a builder to skip all functional specification targets.
23434f9ac78aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23444f9ac78aSmrg# maximum flexibilty in controlling documentation building.
23454f9ac78aSmrg# Refer to:
23464f9ac78aSmrg# XORG_WITH_XMLTO         --with-xmlto
23474f9ac78aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23484f9ac78aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
23494f9ac78aSmrg# XORG_WITH_FOP           --with-fop
23504f9ac78aSmrg# XORG_WITH_GROFF         --with-groff
23514f9ac78aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
23524f9ac78aSmrg#
23534f9ac78aSmrg# Interface to module:
23544f9ac78aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
23554f9ac78aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
23564f9ac78aSmrg#			'no' user instructs the module not to generate specs
23574f9ac78aSmrg# parm1:		specify the default value, yes or no.
23584f9ac78aSmrg#
23594f9ac78aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
23604f9ac78aSmrgm4_define([spec_default], m4_default([$1], [yes]))
23614f9ac78aSmrgAC_ARG_ENABLE(specs,
23624f9ac78aSmrg	AS_HELP_STRING([--enable-specs],
23634f9ac78aSmrg	   [Enable building the specs (default: ]spec_default[)]),
23644f9ac78aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
23654f9ac78aSmrgm4_undefine([spec_default])
23664f9ac78aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
23674f9ac78aSmrgAC_MSG_CHECKING([whether to build functional specifications])
23684f9ac78aSmrgAC_MSG_RESULT([$build_specs])
23694f9ac78aSmrg]) # XORG_ENABLE_SPECS
23704f9ac78aSmrg
2371c27291ebSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2372c27291ebSmrg# ----------------------------------------------
2373c27291ebSmrg# Minimum version: 1.13.0
2374c27291ebSmrg#
2375c27291ebSmrg# This macro enables a builder to enable/disable unit testing
2376c27291ebSmrg# It makes no assumption about the test cases implementation
2377c27291ebSmrg# Test cases may or may not use Automake "Support for test suites"
2378c27291ebSmrg# They may or may not use the software utility library GLib
2379c27291ebSmrg#
2380c27291ebSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2381c27291ebSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2382c27291ebSmrg# The variable enable_unit_tests is used by other macros in this file.
2383c27291ebSmrg#
2384c27291ebSmrg# Interface to module:
2385c27291ebSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2386c27291ebSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2387c27291ebSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2388c27291ebSmrg#			'no' user instructs the module not to build tests
2389c27291ebSmrg# parm1:		specify the default value, yes or no.
2390c27291ebSmrg#
2391c27291ebSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2392c27291ebSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2393c27291ebSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2394c27291ebSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2395c27291ebSmrgm4_define([_defopt], m4_default([$1], [auto]))
2396c27291ebSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2397c27291ebSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2398c27291ebSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2399c27291ebSmrgm4_undefine([_defopt])
2400c27291ebSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2401c27291ebSmrgAC_MSG_CHECKING([whether to build unit test cases])
2402c27291ebSmrgAC_MSG_RESULT([$enable_unit_tests])
2403c27291ebSmrg]) # XORG_ENABLE_UNIT_TESTS
2404c27291ebSmrg
2405c27291ebSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2406c27291ebSmrg# ------------------------------------------------------
2407c27291ebSmrg# Minimum version: 1.17.0
2408c27291ebSmrg#
2409c27291ebSmrg# This macro enables a builder to enable/disable integration testing
2410c27291ebSmrg# It makes no assumption about the test cases' implementation
2411c27291ebSmrg# Test cases may or may not use Automake "Support for test suites"
2412c27291ebSmrg#
2413c27291ebSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2414c27291ebSmrg# usually requires less dependencies and may be built and run under less
2415c27291ebSmrg# stringent environments than integration tests.
2416c27291ebSmrg#
2417c27291ebSmrg# Interface to module:
2418c27291ebSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2419c27291ebSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2420c27291ebSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2421c27291ebSmrg#                             'no' user instructs the module not to build tests
2422c27291ebSmrg# parm1:                      specify the default value, yes or no.
2423c27291ebSmrg#
2424c27291ebSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2425c27291ebSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2426c27291ebSmrgm4_define([_defopt], m4_default([$1], [auto]))
2427c27291ebSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2428c27291ebSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2429c27291ebSmrg	[enable_integration_tests=$enableval],
2430c27291ebSmrg	[enable_integration_tests=]_defopt)
2431c27291ebSmrgm4_undefine([_defopt])
2432c27291ebSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2433c27291ebSmrg	[test "x$enable_integration_tests" != xno])
2434c27291ebSmrgAC_MSG_CHECKING([whether to build unit test cases])
2435c27291ebSmrgAC_MSG_RESULT([$enable_integration_tests])
2436c27291ebSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2437c27291ebSmrg
2438c27291ebSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2439c27291ebSmrg# ----------------------------------------
2440c27291ebSmrg# Minimum version: 1.13.0
2441c27291ebSmrg#
2442c27291ebSmrg# GLib is a library which provides advanced data structures and functions.
2443c27291ebSmrg# This macro enables a module to test for the presence of Glib.
2444c27291ebSmrg#
2445c27291ebSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2446c27291ebSmrg# Otherwise the value of $enable_unit_tests is blank.
2447c27291ebSmrg#
2448c27291ebSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2449c27291ebSmrg# test support usually requires less dependencies and may be built and run under
2450c27291ebSmrg# less stringent environments than integration tests.
2451c27291ebSmrg#
2452c27291ebSmrg# Interface to module:
2453c27291ebSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2454c27291ebSmrg# with_glib: used in configure.ac to know if GLib has been found
2455c27291ebSmrg# --with-glib:	'yes' user instructs the module to use glib
2456c27291ebSmrg#		'no' user instructs the module not to use glib
2457c27291ebSmrg#
2458c27291ebSmrgAC_DEFUN([XORG_WITH_GLIB],[
2459c27291ebSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2460c27291ebSmrgm4_define([_defopt], m4_default([$2], [auto]))
2461c27291ebSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2462c27291ebSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2463c27291ebSmrg	[with_glib=$withval], [with_glib=]_defopt)
2464c27291ebSmrgm4_undefine([_defopt])
2465c27291ebSmrg
2466c27291ebSmrghave_glib=no
2467c27291ebSmrg# Do not probe GLib if user explicitly disabled unit testing
2468c27291ebSmrgif test "x$enable_unit_tests" != x"no"; then
2469c27291ebSmrg  # Do not probe GLib if user explicitly disabled it
2470c27291ebSmrg  if test "x$with_glib" != x"no"; then
2471c27291ebSmrg    m4_ifval(
2472c27291ebSmrg      [$1],
2473c27291ebSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2474c27291ebSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2475c27291ebSmrg    )
2476c27291ebSmrg  fi
2477c27291ebSmrgfi
2478c27291ebSmrg
2479c27291ebSmrg# Not having GLib when unit testing has been explicitly requested is an error
2480c27291ebSmrgif test "x$enable_unit_tests" = x"yes"; then
2481c27291ebSmrg  if test "x$have_glib" = x"no"; then
2482c27291ebSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2483c27291ebSmrg  fi
2484c27291ebSmrgfi
2485c27291ebSmrg
2486c27291ebSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2487c27291ebSmrgif test "x$enable_unit_tests" = x"no"; then
2488c27291ebSmrg  if test "x$with_glib" = x"yes"; then
2489c27291ebSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2490c27291ebSmrg  fi
2491c27291ebSmrgfi
2492c27291ebSmrg
2493c27291ebSmrg# Not having GLib when it has been explicitly requested is an error
2494c27291ebSmrgif test "x$with_glib" = x"yes"; then
2495c27291ebSmrg  if test "x$have_glib" = x"no"; then
2496c27291ebSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2497c27291ebSmrg  fi
2498c27291ebSmrgfi
2499c27291ebSmrg
2500c27291ebSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2501c27291ebSmrg]) # XORG_WITH_GLIB
2502c27291ebSmrg
2503c27291ebSmrg# XORG_LD_WRAP([required|optional])
2504c27291ebSmrg# ---------------------------------
2505c27291ebSmrg# Minimum version: 1.13.0
2506c27291ebSmrg#
2507c27291ebSmrg# Check if linker supports -wrap, passed via compiler flags
2508c27291ebSmrg#
2509c27291ebSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2510c27291ebSmrg# Otherwise the value of $enable_unit_tests is blank.
2511c27291ebSmrg#
2512c27291ebSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2513c27291ebSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2514c27291ebSmrg# available, an argument of "optional" allows use when some unit tests require
2515c27291ebSmrg# ld -wrap and others do not.
2516c27291ebSmrg#
2517c27291ebSmrgAC_DEFUN([XORG_LD_WRAP],[
2518c27291ebSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2519c27291ebSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2520c27291ebSmrg                      void __wrap_exit(int status) { return; }],
2521c27291ebSmrg                     [exit(0);])])
2522c27291ebSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2523c27291ebSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2524c27291ebSmrg  if test "x$have_ld_wrap" = x"no"; then
2525c27291ebSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2526c27291ebSmrg  fi
2527c27291ebSmrgfi
2528c27291ebSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2529c27291ebSmrg#
2530c27291ebSmrg]) # XORG_LD_WRAP
2531c27291ebSmrg
2532c27291ebSmrg# XORG_CHECK_LINKER_FLAGS
2533c27291ebSmrg# -----------------------
2534c27291ebSmrg# SYNOPSIS
2535c27291ebSmrg#
2536c27291ebSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2537c27291ebSmrg#
2538c27291ebSmrg# DESCRIPTION
2539c27291ebSmrg#
2540c27291ebSmrg#   Check whether the given linker FLAGS work with the current language's
2541c27291ebSmrg#   linker, or whether they give an error.
2542c27291ebSmrg#
2543c27291ebSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2544c27291ebSmrg#   success/failure.
2545c27291ebSmrg#
2546c27291ebSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2547c27291ebSmrg#
2548c27291ebSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2549c27291ebSmrg#
2550c27291ebSmrg# LICENSE
2551c27291ebSmrg#
2552c27291ebSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2553c27291ebSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2554c27291ebSmrg#   Copyright (c) 2009 Matteo Frigo
2555c27291ebSmrg#
2556c27291ebSmrg#   This program is free software: you can redistribute it and/or modify it
2557c27291ebSmrg#   under the terms of the GNU General Public License as published by the
2558c27291ebSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2559c27291ebSmrg#   option) any later version.
2560c27291ebSmrg#
2561c27291ebSmrg#   This program is distributed in the hope that it will be useful, but
2562c27291ebSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2563c27291ebSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2564c27291ebSmrg#   Public License for more details.
2565c27291ebSmrg#
2566c27291ebSmrg#   You should have received a copy of the GNU General Public License along
2567c27291ebSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2568c27291ebSmrg#
2569c27291ebSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2570c27291ebSmrg#   gives unlimited permission to copy, distribute and modify the configure
2571c27291ebSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2572c27291ebSmrg#   need not follow the terms of the GNU General Public License when using
2573c27291ebSmrg#   or distributing such scripts, even though portions of the text of the
2574c27291ebSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2575c27291ebSmrg#   all other use of the material that constitutes the Autoconf Macro.
2576c27291ebSmrg#
2577c27291ebSmrg#   This special exception to the GPL applies to versions of the Autoconf
2578c27291ebSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2579c27291ebSmrg#   modified version of the Autoconf Macro, you may extend this special
2580c27291ebSmrg#   exception to the GPL to apply to your modified version as well.#
2581c27291ebSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2582c27291ebSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2583c27291ebSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2584c27291ebSmrgAS_LITERAL_IF([$1],
2585c27291ebSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2586c27291ebSmrg      ax_save_FLAGS=$LDFLAGS
2587c27291ebSmrg      LDFLAGS="$1"
2588c27291ebSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2589c27291ebSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2590c27291ebSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2591c27291ebSmrg      LDFLAGS=$ax_save_FLAGS])],
2592c27291ebSmrg  [ax_save_FLAGS=$LDFLAGS
2593c27291ebSmrg   LDFLAGS="$1"
2594c27291ebSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2595c27291ebSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2596c27291ebSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2597c27291ebSmrg   LDFLAGS=$ax_save_FLAGS])
2598c27291ebSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2599c27291ebSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2600c27291ebSmrgif test "x$xorg_check_linker_flags" = xyes; then
2601c27291ebSmrg	m4_default([$2], :)
2602c27291ebSmrgelse
2603c27291ebSmrg	m4_default([$3], :)
2604c27291ebSmrgfi
2605c27291ebSmrg]) # XORG_CHECK_LINKER_FLAGS
2606c27291ebSmrg
2607c27291ebSmrg# XORG_MEMORY_CHECK_FLAGS
2608c27291ebSmrg# -----------------------
2609c27291ebSmrg# Minimum version: 1.16.0
2610c27291ebSmrg#
2611c27291ebSmrg# This macro attempts to find appropriate memory checking functionality
2612c27291ebSmrg# for various platforms which unit testing code may use to catch various
2613c27291ebSmrg# forms of memory allocation and access errors in testing.
2614c27291ebSmrg#
2615c27291ebSmrg# Interface to module:
2616c27291ebSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2617c27291ebSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2618c27291ebSmrg#
2619c27291ebSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2620c27291ebSmrg#
2621c27291ebSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2622c27291ebSmrg
2623c27291ebSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2624c27291ebSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2625c27291ebSmrg           [Environment variables to enable memory checking in tests])
2626c27291ebSmrg
2627c27291ebSmrg# Check for different types of support on different platforms
2628c27291ebSmrgcase $host_os in
2629c27291ebSmrg    solaris*)
2630c27291ebSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2631c27291ebSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2632c27291ebSmrg        ;;
2633c27291ebSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2634c27291ebSmrg        # both directly and inverted, so should not be 0 or 255.
2635c27291ebSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2636c27291ebSmrg        ;;
2637c27291ebSmrg    darwin*)
2638c27291ebSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2639c27291ebSmrg        ;;
2640c27291ebSmrg    *bsd*)
2641c27291ebSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2642c27291ebSmrg        ;;
2643c27291ebSmrgesac
2644c27291ebSmrg
2645c27291ebSmrg# User supplied flags override default flags
2646c27291ebSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2647c27291ebSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2648c27291ebSmrgfi
2649c27291ebSmrg
2650c27291ebSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2651c27291ebSmrg]) # XORG_WITH_LINT
2652c27291ebSmrg
2653d1333322Smrg# XORG_CHECK_MALLOC_ZERO
2654d1333322Smrg# ----------------------
2655d1333322Smrg# Minimum version: 1.0.0
2656d1333322Smrg#
2657d1333322Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2658d1333322Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2659d1333322Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2660d1333322SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2661d1333322SmrgAC_ARG_ENABLE(malloc0returnsnull,
26624f9ac78aSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2663d1333322Smrg		       [malloc(0) returns NULL (default: auto)]),
2664d1333322Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2665d1333322Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2666d1333322Smrg
2667d1333322SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2668d1333322Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
266969ef5f27SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
267069ef5f27Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2671c27291ebSmrg#include <stdlib.h>
2672c27291ebSmrg],[
2673d1333322Smrg    char *m0, *r0, *c0, *p;
2674d1333322Smrg    m0 = malloc(0);
2675d1333322Smrg    p = malloc(10);
2676d1333322Smrg    r0 = realloc(p,0);
2677c27291ebSmrg    c0 = calloc(0,10);
2678c27291ebSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2679c27291ebSmrg])],
268069ef5f27Smrg		[xorg_cv_malloc0_returns_null=yes],
268169ef5f27Smrg		[xorg_cv_malloc0_returns_null=no])])
268269ef5f27SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2683d1333322Smrgfi
2684d1333322SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2685d1333322Smrg
2686d1333322Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2687d1333322Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2688d1333322Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2689d1333322Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2690d1333322Smrgelse
2691d1333322Smrg	MALLOC_ZERO_CFLAGS=""
2692d1333322Smrg	XMALLOC_ZERO_CFLAGS=""
2693d1333322Smrg	XTMALLOC_ZERO_CFLAGS=""
2694d1333322Smrgfi
2695d1333322Smrg
2696d1333322SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2697d1333322SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2698d1333322SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2699d1333322Smrg]) # XORG_CHECK_MALLOC_ZERO
2700d1333322Smrg
2701d1333322Smrg# XORG_WITH_LINT()
2702d1333322Smrg# ----------------
2703d1333322Smrg# Minimum version: 1.1.0
2704d1333322Smrg#
27054f9ac78aSmrg# This macro enables the use of a tool that flags some suspicious and
27064f9ac78aSmrg# non-portable constructs (likely to be bugs) in C language source code.
27074f9ac78aSmrg# It will attempt to locate the tool and use appropriate options.
27084f9ac78aSmrg# There are various lint type tools on different platforms.
27094f9ac78aSmrg#
27104f9ac78aSmrg# Interface to module:
27114f9ac78aSmrg# LINT:		returns the path to the tool found on the platform
27124f9ac78aSmrg#		or the value set to LINT on the configure cmd line
27134f9ac78aSmrg#		also an Automake conditional
27144f9ac78aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
27154f9ac78aSmrg#
27164f9ac78aSmrg# --with-lint:	'yes' user instructs the module to use lint
27174f9ac78aSmrg#		'no' user instructs the module not to use lint (default)
27184f9ac78aSmrg#
27194f9ac78aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
27204f9ac78aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2721d1333322Smrg#
2722d1333322SmrgAC_DEFUN([XORG_WITH_LINT],[
2723d1333322Smrg
27244f9ac78aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
27254f9ac78aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
27264f9ac78aSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2727d1333322Smrg		[Use a lint-style source code checker (default: disabled)])],
2728d1333322Smrg		[use_lint=$withval], [use_lint=no])
27294f9ac78aSmrg
27304f9ac78aSmrg# Obtain platform specific info like program name and options
27314f9ac78aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
27324f9ac78aSmrgcase $host_os in
27334f9ac78aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
27344f9ac78aSmrg	lint_name=splint
27354f9ac78aSmrg	lint_options="-badflag"
27364f9ac78aSmrg	;;
27374f9ac78aSmrg  *freebsd* | *netbsd*)
27384f9ac78aSmrg	lint_name=lint
27394f9ac78aSmrg	lint_options="-u -b"
27404f9ac78aSmrg	;;
27414f9ac78aSmrg  *solaris*)
27424f9ac78aSmrg	lint_name=lint
27434f9ac78aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
27444f9ac78aSmrg	;;
27454f9ac78aSmrgesac
27464f9ac78aSmrg
27474f9ac78aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
27484f9ac78aSmrgif test "x$use_lint" = x"yes" ; then
27494f9ac78aSmrg   AC_PATH_PROG([LINT], [$lint_name])
27504f9ac78aSmrg   if test "x$LINT" = "x"; then
27514f9ac78aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
27524f9ac78aSmrg   fi
27534f9ac78aSmrgelif test "x$use_lint" = x"no" ; then
27544f9ac78aSmrg   if test "x$LINT" != "x"; then
27554f9ac78aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
27564f9ac78aSmrg   fi
2757d1333322Smrgelse
27584f9ac78aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2759d1333322Smrgfi
27604f9ac78aSmrg
27614f9ac78aSmrg# User supplied flags override default flags
27624f9ac78aSmrgif test "x$LINT_FLAGS" != "x"; then
27634f9ac78aSmrg   lint_options=$LINT_FLAGS
2764d1333322Smrgfi
2765d1333322Smrg
27664f9ac78aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
27674f9ac78aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2768d1333322Smrg
2769d1333322Smrg]) # XORG_WITH_LINT
2770d1333322Smrg
2771d1333322Smrg# XORG_LINT_LIBRARY(LIBNAME)
2772d1333322Smrg# --------------------------
2773d1333322Smrg# Minimum version: 1.1.0
2774d1333322Smrg#
2775d1333322Smrg# Sets up flags for building lint libraries for checking programs that call
2776d1333322Smrg# functions in the library.
2777d1333322Smrg#
27784f9ac78aSmrg# Interface to module:
27794f9ac78aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
27804f9ac78aSmrg# MAKE_LINT_LIB		- Automake conditional
27814f9ac78aSmrg#
27824f9ac78aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
27834f9ac78aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2784d1333322Smrg
2785d1333322SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2786d1333322SmrgAC_REQUIRE([XORG_WITH_LINT])
27874f9ac78aSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2788d1333322Smrg	[Create lint library (default: disabled)])],
2789d1333322Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
27904f9ac78aSmrg
27914f9ac78aSmrgif test "x$make_lint_lib" = x"yes" ; then
27924f9ac78aSmrg   LINTLIB=llib-l$1.ln
27934f9ac78aSmrg   if test "x$LINT" = "x"; then
27944f9ac78aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
27954f9ac78aSmrg   fi
27964f9ac78aSmrgelif test "x$make_lint_lib" != x"no" ; then
27974f9ac78aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2798d1333322Smrgfi
27994f9ac78aSmrg
2800d1333322SmrgAC_SUBST(LINTLIB)
2801d1333322SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2802d1333322Smrg
2803d1333322Smrg]) # XORG_LINT_LIBRARY
2804d1333322Smrg
2805c27291ebSmrg# XORG_COMPILER_BRAND
2806c27291ebSmrg# -------------------
2807c27291ebSmrg# Minimum version: 1.14.0
2808c27291ebSmrg#
2809c27291ebSmrg# Checks for various brands of compilers and sets flags as appropriate:
2810c27291ebSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2811c27291ebSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2812c27291ebSmrg#   clang compiler - sets CLANGCC to "yes"
2813c27291ebSmrg#   Intel compiler - sets INTELCC to "yes"
2814c27291ebSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2815c27291ebSmrg#
2816c27291ebSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2817c27291ebSmrgAC_LANG_CASE(
2818c27291ebSmrg	[C], [
2819c27291ebSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2820c27291ebSmrg	],
2821c27291ebSmrg	[C++], [
2822c27291ebSmrg		AC_REQUIRE([AC_PROG_CXX])
2823c27291ebSmrg	]
2824c27291ebSmrg)
2825c27291ebSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2826c27291ebSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2827c27291ebSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2828c27291ebSmrg]) # XORG_COMPILER_BRAND
2829c27291ebSmrg
2830c27291ebSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2831c27291ebSmrg# ---------------
2832c27291ebSmrg# Minimum version: 1.16.0
2833c27291ebSmrg#
2834c27291ebSmrg# Test if the compiler works when passed the given flag as a command line argument.
2835c27291ebSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2836c27291ebSmrg# next flag in the list until there are no more options.
2837c27291ebSmrg#
2838c27291ebSmrg# Note that this does not guarantee that the compiler supports the flag as some
2839c27291ebSmrg# compilers will simply ignore arguments that they do not understand, but we do
2840c27291ebSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2841c27291ebSmrg# -Werror=unused-command-line-argument
2842c27291ebSmrg#
2843c27291ebSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2844c27291ebSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2845c27291ebSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2846c27291ebSmrg
2847c27291ebSmrgAC_LANG_COMPILER_REQUIRE
2848c27291ebSmrg
2849c27291ebSmrgAC_LANG_CASE(
2850c27291ebSmrg	[C], [
2851c27291ebSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2852c27291ebSmrg		define([PREFIX], [C])
2853c27291ebSmrg		define([CACHE_PREFIX], [cc])
2854c27291ebSmrg		define([COMPILER], [$CC])
2855c27291ebSmrg	],
2856c27291ebSmrg	[C++], [
2857c27291ebSmrg		define([PREFIX], [CXX])
2858c27291ebSmrg		define([CACHE_PREFIX], [cxx])
2859c27291ebSmrg		define([COMPILER], [$CXX])
2860c27291ebSmrg	]
2861c27291ebSmrg)
2862c27291ebSmrg
2863c27291ebSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2864c27291ebSmrg
2865c27291ebSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2866c27291ebSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2867c27291ebSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2868c27291ebSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2869c27291ebSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2870c27291ebSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2871c27291ebSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2872c27291ebSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2873c27291ebSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2874c27291ebSmrgfi
2875c27291ebSmrg
2876c27291ebSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2877c27291ebSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2878c27291ebSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2879c27291ebSmrg	fi
2880c27291ebSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2881c27291ebSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2882c27291ebSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2883c27291ebSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2884c27291ebSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2885c27291ebSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2886c27291ebSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2887c27291ebSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2888c27291ebSmrgfi
2889c27291ebSmrg
2890c27291ebSmrgfound="no"
2891c27291ebSmrgm4_foreach([flag], m4_cdr($@), [
2892c27291ebSmrg	if test $found = "no" ; then
289369ef5f27Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
2894c27291ebSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2895c27291ebSmrg		fi
2896c27291ebSmrg
289769ef5f27Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
2898c27291ebSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2899c27291ebSmrg		fi
2900c27291ebSmrg
2901c27291ebSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2902c27291ebSmrg
2903c27291ebSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2904c27291ebSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2905c27291ebSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2906c27291ebSmrg		AC_CACHE_VAL($cacheid,
2907c27291ebSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2908c27291ebSmrg					     [eval $cacheid=yes],
2909c27291ebSmrg					     [eval $cacheid=no])])
2910c27291ebSmrg
2911c27291ebSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2912c27291ebSmrg
2913c27291ebSmrg		eval supported=\$$cacheid
2914c27291ebSmrg		AC_MSG_RESULT([$supported])
2915c27291ebSmrg		if test "$supported" = "yes" ; then
2916c27291ebSmrg			$1="$$1 ]flag["
2917c27291ebSmrg			found="yes"
2918c27291ebSmrg		fi
2919c27291ebSmrg	fi
2920c27291ebSmrg])
2921c27291ebSmrg]) # XORG_TESTSET_CFLAG
2922c27291ebSmrg
2923c27291ebSmrg# XORG_COMPILER_FLAGS
2924c27291ebSmrg# ---------------
2925c27291ebSmrg# Minimum version: 1.16.0
2926c27291ebSmrg#
2927c27291ebSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2928c27291ebSmrg# arguments supported by the selected compiler which do NOT alter the generated
2929c27291ebSmrg# code.  These arguments will cause the compiler to print various warnings
2930c27291ebSmrg# during compilation AND turn a conservative set of warnings into errors.
2931c27291ebSmrg#
2932c27291ebSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2933c27291ebSmrg# future versions of util-macros as options are added to new compilers.
2934c27291ebSmrg#
2935c27291ebSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2936c27291ebSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2937c27291ebSmrg
2938c27291ebSmrgAC_ARG_ENABLE(selective-werror,
2939c27291ebSmrg              AS_HELP_STRING([--disable-selective-werror],
2940c27291ebSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2941c27291ebSmrg              [SELECTIVE_WERROR=$enableval],
2942c27291ebSmrg              [SELECTIVE_WERROR=yes])
2943c27291ebSmrg
2944c27291ebSmrgAC_LANG_CASE(
2945c27291ebSmrg        [C], [
2946c27291ebSmrg                define([PREFIX], [C])
2947c27291ebSmrg        ],
2948c27291ebSmrg        [C++], [
2949c27291ebSmrg                define([PREFIX], [CXX])
2950c27291ebSmrg        ]
2951c27291ebSmrg)
2952c27291ebSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2953c27291ebSmrgif test "x$SUNCC" = "xyes"; then
2954c27291ebSmrg    [BASE_]PREFIX[FLAGS]="-v"
2955c27291ebSmrgelse
2956c27291ebSmrg    [BASE_]PREFIX[FLAGS]=""
2957c27291ebSmrgfi
2958c27291ebSmrg
2959c27291ebSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2960c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2961c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2962c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2963c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2964c27291ebSmrg
2965c27291ebSmrgAC_LANG_CASE(
2966c27291ebSmrg	[C], [
2967c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2968c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2969c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2970c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
297169ef5f27Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
2972c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2973c27291ebSmrg	]
2974c27291ebSmrg)
2975c27291ebSmrg
2976c27291ebSmrg# This chunk adds additional warnings that could catch undesired effects.
2977c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2978c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2979c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2980c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2981c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2982c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
298369ef5f27SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2984c27291ebSmrg
2985c27291ebSmrg# These are currently disabled because they are noisy.  They will be enabled
2986c27291ebSmrg# in the future once the codebase is sufficiently modernized to silence
2987c27291ebSmrg# them.  For now, I don't want them to drown out the other warnings.
2988c27291ebSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2989c27291ebSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
299069ef5f27Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2991c27291ebSmrg
2992c27291ebSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2993c27291ebSmrg# when there are problems that should be fixed.
2994c27291ebSmrg
2995c27291ebSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2996c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2997c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2998c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2999c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3000c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3001c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3002c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3003c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3004c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3005c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3006c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3007c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3008c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3009c27291ebSmrgelse
3010c27291ebSmrgAC_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])
3011c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3012c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3013c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3014c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3015c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3016c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3017c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3018c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3019c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3020c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3021c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3022c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3023c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3024c27291ebSmrgfi
3025c27291ebSmrg
3026c27291ebSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3027c27291ebSmrg]) # XORG_COMPILER_FLAGS
3028c27291ebSmrg
30294f9ac78aSmrg# XORG_CWARNFLAGS
30304f9ac78aSmrg# ---------------
30314f9ac78aSmrg# Minimum version: 1.2.0
3032c27291ebSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
30334f9ac78aSmrg#
30344f9ac78aSmrg# Defines CWARNFLAGS to enable C compiler warnings.
30354f9ac78aSmrg#
3036c27291ebSmrg# This function is deprecated because it defines -fno-strict-aliasing
3037c27291ebSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3038c27291ebSmrg# is needed, then it should be added explicitly in the module when
3039c27291ebSmrg# it is updated to use BASE_CFLAGS.
3040c27291ebSmrg#
30414f9ac78aSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3042c27291ebSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3043c27291ebSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3044c27291ebSmrgAC_LANG_CASE(
3045c27291ebSmrg	[C], [
3046c27291ebSmrg		CWARNFLAGS="$BASE_CFLAGS"
3047c27291ebSmrg		if  test "x$GCC" = xyes ; then
3048c27291ebSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3049c27291ebSmrg		fi
3050c27291ebSmrg		AC_SUBST(CWARNFLAGS)
3051c27291ebSmrg	]
3052c27291ebSmrg)
30534f9ac78aSmrg]) # XORG_CWARNFLAGS
30544f9ac78aSmrg
30554f9ac78aSmrg# XORG_STRICT_OPTION
30564f9ac78aSmrg# -----------------------
30574f9ac78aSmrg# Minimum version: 1.3.0
30584f9ac78aSmrg#
3059c27291ebSmrg# Add configure option to enable strict compilation flags, such as treating
3060c27291ebSmrg# warnings as fatal errors.
3061c27291ebSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3062c27291ebSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3063c27291ebSmrg#
3064c27291ebSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3065c27291ebSmrg# when strict compilation is unconditionally desired.
30664f9ac78aSmrgAC_DEFUN([XORG_STRICT_OPTION], [
30674f9ac78aSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3068c27291ebSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30694f9ac78aSmrg
30704f9ac78aSmrgAC_ARG_ENABLE(strict-compilation,
30714f9ac78aSmrg			  AS_HELP_STRING([--enable-strict-compilation],
30724f9ac78aSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
30734f9ac78aSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3074c27291ebSmrg
3075c27291ebSmrgAC_LANG_CASE(
3076c27291ebSmrg        [C], [
3077c27291ebSmrg                define([PREFIX], [C])
3078c27291ebSmrg        ],
3079c27291ebSmrg        [C++], [
3080c27291ebSmrg                define([PREFIX], [CXX])
3081c27291ebSmrg        ]
3082c27291ebSmrg)
3083c27291ebSmrg
3084c27291ebSmrg[STRICT_]PREFIX[FLAGS]=""
3085c27291ebSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3086c27291ebSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3087c27291ebSmrg
3088c27291ebSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3089c27291ebSmrg# activate it with -Werror, so we add it here explicitly.
3090c27291ebSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3091c27291ebSmrg
30924f9ac78aSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3093c27291ebSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3094c27291ebSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
30954f9ac78aSmrgfi
3096c27291ebSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3097c27291ebSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3098c27291ebSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
30994f9ac78aSmrg]) # XORG_STRICT_OPTION
31004f9ac78aSmrg
31014f9ac78aSmrg# XORG_DEFAULT_OPTIONS
31024f9ac78aSmrg# --------------------
31034f9ac78aSmrg# Minimum version: 1.3.0
31044f9ac78aSmrg#
31054f9ac78aSmrg# Defines default options for X.Org modules.
31064f9ac78aSmrg#
31074f9ac78aSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
31084f9ac78aSmrgAC_REQUIRE([AC_PROG_INSTALL])
3109c27291ebSmrgXORG_COMPILER_FLAGS
31104f9ac78aSmrgXORG_CWARNFLAGS
31114f9ac78aSmrgXORG_STRICT_OPTION
31124f9ac78aSmrgXORG_RELEASE_VERSION
31134f9ac78aSmrgXORG_CHANGELOG
31144f9ac78aSmrgXORG_INSTALL
31154f9ac78aSmrgXORG_MANPAGE_SECTIONS
31164f9ac78aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
31174f9ac78aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
31184f9ac78aSmrg]) # XORG_DEFAULT_OPTIONS
31194f9ac78aSmrg
31204f9ac78aSmrg# XORG_INSTALL()
31214f9ac78aSmrg# ----------------
31224f9ac78aSmrg# Minimum version: 1.4.0
31234f9ac78aSmrg#
31244f9ac78aSmrg# Defines the variable INSTALL_CMD as the command to copy
31254f9ac78aSmrg# INSTALL from $prefix/share/util-macros.
31264f9ac78aSmrg#
31274f9ac78aSmrgAC_DEFUN([XORG_INSTALL], [
31284f9ac78aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
31294f9ac78aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
31304f9ac78aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
31314f9ac78aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
31324f9ac78aSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
31334f9ac78aSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
31344f9ac78aSmrgAC_SUBST([INSTALL_CMD])
31354f9ac78aSmrg]) # XORG_INSTALL
3136d1333322Smrgdnl Copyright 2005 Red Hat, Inc
3137d1333322Smrgdnl
3138d1333322Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3139d1333322Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3140d1333322Smrgdnl the above copyright notice appear in all copies and that both that
3141d1333322Smrgdnl copyright notice and this permission notice appear in supporting
3142d1333322Smrgdnl documentation.
3143d1333322Smrgdnl
3144d1333322Smrgdnl The above copyright notice and this permission notice shall be included
3145d1333322Smrgdnl in all copies or substantial portions of the Software.
3146d1333322Smrgdnl
3147d1333322Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3148d1333322Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3149d1333322Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3150d1333322Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3151d1333322Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3152d1333322Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3153d1333322Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3154d1333322Smrgdnl
3155d1333322Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3156d1333322Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3157d1333322Smrgdnl other dealings in this Software without prior written authorization
3158d1333322Smrgdnl from the copyright holders.
3159d1333322Smrgdnl
3160d1333322Smrg
3161d1333322Smrg# XORG_RELEASE_VERSION
3162d1333322Smrg# --------------------
31634f9ac78aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
316469ef5f27Smrg
3165d1333322SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3166d1333322Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3167d1333322Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3168d1333322Smrg		[Major version of this package])
3169d1333322Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3170d1333322Smrg	if test "x$PVM" = "x"; then
3171d1333322Smrg		PVM="0"
3172d1333322Smrg	fi
3173d1333322Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3174d1333322Smrg		[$PVM],
3175d1333322Smrg		[Minor version of this package])
3176d1333322Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3177d1333322Smrg	if test "x$PVP" = "x"; then
3178d1333322Smrg		PVP="0"
3179d1333322Smrg	fi
3180d1333322Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3181d1333322Smrg		[$PVP],
3182d1333322Smrg		[Patch version of this package])
3183d1333322Smrg])
3184d1333322Smrg
31854f9ac78aSmrg# XORG_CHANGELOG()
31864f9ac78aSmrg# ----------------
31874f9ac78aSmrg# Minimum version: 1.2.0
31884f9ac78aSmrg#
31894f9ac78aSmrg# Defines the variable CHANGELOG_CMD as the command to generate
31904f9ac78aSmrg# ChangeLog from git.
31914f9ac78aSmrg#
31924f9ac78aSmrg#
31934f9ac78aSmrgAC_DEFUN([XORG_CHANGELOG], [
31944f9ac78aSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
31954f9ac78aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
31964f9ac78aSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
31974f9ac78aSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
31984f9ac78aSmrgAC_SUBST([CHANGELOG_CMD])
31994f9ac78aSmrg]) # XORG_CHANGELOG
32004f9ac78aSmrg
3201