aclocal.m4 revision c6a6acfb
1c6a6acfbSmrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2c6a6acfbSmrg
3c6a6acfbSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
466fe65f6Smrg
566fe65f6Smrg# This file is free software; the Free Software Foundation
666fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
766fe65f6Smrg# with or without modifications, as long as this notice is preserved.
866fe65f6Smrg
966fe65f6Smrg# This program is distributed in the hope that it will be useful,
1066fe65f6Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1166fe65f6Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1266fe65f6Smrg# PARTICULAR PURPOSE.
1366fe65f6Smrg
14c6a6acfbSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1589d09728Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1689d09728Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17c6a6acfbSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18c6a6acfbSmrg[m4_warning([this file was generated for autoconf 2.69.
1989d09728SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2089d09728SmrgIf you have problems, you may need to regenerate the build system entirely.
21c6a6acfbSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2289d09728Smrg
23c6a6acfbSmrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
24a9274bcdSmrg#
25a9274bcdSmrg# This file is free software; the Free Software Foundation
26a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
27a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
2889d09728Smrg
29a9274bcdSmrg# AM_AUTOMAKE_VERSION(VERSION)
30a9274bcdSmrg# ----------------------------
31a9274bcdSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32a9274bcdSmrg# generated from the m4 files accompanying Automake X.Y.
33a9274bcdSmrg# (This private macro should not be called outside this file.)
34a9274bcdSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35c6a6acfbSmrg[am__api_version='1.15'
36a9274bcdSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37a9274bcdSmrgdnl require some minimum version.  Point them to the right macro.
38c6a6acfbSmrgm4_if([$1], [1.15], [],
39a9274bcdSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40a9274bcdSmrg])
41a9274bcdSmrg
42a9274bcdSmrg# _AM_AUTOCONF_VERSION(VERSION)
43a9274bcdSmrg# -----------------------------
44a9274bcdSmrg# aclocal traces this macro to find the Autoconf version.
45a9274bcdSmrg# This is a private macro too.  Using m4_define simplifies
46a9274bcdSmrg# the logic in aclocal, which can simply ignore this definition.
47a9274bcdSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48a9274bcdSmrg
49a9274bcdSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50a9274bcdSmrg# -------------------------------
51a9274bcdSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52a9274bcdSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53a9274bcdSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54c6a6acfbSmrg[AM_AUTOMAKE_VERSION([1.15])dnl
55a9274bcdSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56a9274bcdSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57a9274bcdSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58a9274bcdSmrg
59a9274bcdSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60a9274bcdSmrg
61c6a6acfbSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6289d09728Smrg#
63a9274bcdSmrg# This file is free software; the Free Software Foundation
64a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
65a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
66a9274bcdSmrg
67a9274bcdSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68c6a6acfbSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69c6a6acfbSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7089d09728Smrg#
71a9274bcdSmrg# Of course, Automake must honor this variable whenever it calls a
72a9274bcdSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73a9274bcdSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74a9274bcdSmrg# depending on how configure is run.  This is pretty annoying, since
75a9274bcdSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76a9274bcdSmrg# source directory, any form will work fine, but in subdirectories a
77a9274bcdSmrg# relative path needs to be adjusted first.
7889d09728Smrg#
79a9274bcdSmrg# $ac_aux_dir/missing
80a9274bcdSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81a9274bcdSmrg# $top_srcdir/$ac_aux_dir/missing
82a9274bcdSmrg#    fails if $ac_aux_dir is absolute,
83a9274bcdSmrg#    fails when called from a subdirectory in a VPATH build with
84a9274bcdSmrg#          a relative $ac_aux_dir
8589d09728Smrg#
86a9274bcdSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87a9274bcdSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
88c6a6acfbSmrg# harmless because $srcdir is '.', but things will broke when you
89a9274bcdSmrg# start a VPATH build or use an absolute $srcdir.
9089d09728Smrg#
91a9274bcdSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92a9274bcdSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93a9274bcdSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94a9274bcdSmrg# and then we would define $MISSING as
95a9274bcdSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96a9274bcdSmrg# This will work as long as MISSING is not called from configure, because
97a9274bcdSmrg# unfortunately $(top_srcdir) has no meaning in configure.
98a9274bcdSmrg# However there are other variables, like CC, which are often used in
99a9274bcdSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100a9274bcdSmrg#
101a9274bcdSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
102a9274bcdSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
103a9274bcdSmrg# configured tree to be moved without reconfiguration.
10466fe65f6Smrg
105a9274bcdSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106c6a6acfbSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107c6a6acfbSmrg# Expand $ac_aux_dir to an absolute path.
108c6a6acfbSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109a9274bcdSmrg])
11066fe65f6Smrg
111a9274bcdSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11266fe65f6Smrg
113c6a6acfbSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
11489d09728Smrg#
115a9274bcdSmrg# This file is free software; the Free Software Foundation
116a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
117a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
11866fe65f6Smrg
119a9274bcdSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120a9274bcdSmrg# -------------------------------------
121a9274bcdSmrg# Define a conditional.
122a9274bcdSmrgAC_DEFUN([AM_CONDITIONAL],
123c6a6acfbSmrg[AC_PREREQ([2.52])dnl
124c6a6acfbSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125c6a6acfbSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126a9274bcdSmrgAC_SUBST([$1_TRUE])dnl
127a9274bcdSmrgAC_SUBST([$1_FALSE])dnl
128a9274bcdSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129a9274bcdSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130a9274bcdSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131a9274bcdSmrgif $2; then
132a9274bcdSmrg  $1_TRUE=
133a9274bcdSmrg  $1_FALSE='#'
134a9274bcdSmrgelse
135a9274bcdSmrg  $1_TRUE='#'
136a9274bcdSmrg  $1_FALSE=
13766fe65f6Smrgfi
138a9274bcdSmrgAC_CONFIG_COMMANDS_PRE(
139a9274bcdSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140a9274bcdSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141a9274bcdSmrgUsually this means the macro was only invoked conditionally.]])
142a9274bcdSmrgfi])])
14366fe65f6Smrg
144c6a6acfbSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
145a9274bcdSmrg#
146a9274bcdSmrg# This file is free software; the Free Software Foundation
147a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
148a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
14966fe65f6Smrg
15066fe65f6Smrg
151c6a6acfbSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152a9274bcdSmrg# written in clear, in which case automake, when reading aclocal.m4,
153a9274bcdSmrg# will think it sees a *use*, and therefore will trigger all it's
154a9274bcdSmrg# C support machinery.  Also note that it means that autoscan, seeing
155a9274bcdSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15666fe65f6Smrg
15766fe65f6Smrg
158a9274bcdSmrg# _AM_DEPENDENCIES(NAME)
159a9274bcdSmrg# ----------------------
160a9274bcdSmrg# See how the compiler implements dependency checking.
161c6a6acfbSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162a9274bcdSmrg# We try a few techniques and use that to set a single cache variable.
163a9274bcdSmrg#
164a9274bcdSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165a9274bcdSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166a9274bcdSmrg# dependency, and given that the user is not expected to run this macro,
167a9274bcdSmrg# just rely on AC_PROG_CC.
168a9274bcdSmrgAC_DEFUN([_AM_DEPENDENCIES],
169a9274bcdSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170a9274bcdSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171a9274bcdSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172a9274bcdSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17366fe65f6Smrg
174c6a6acfbSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175c6a6acfbSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176c6a6acfbSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177c6a6acfbSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178c6a6acfbSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179c6a6acfbSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180c6a6acfbSmrg                    [depcc="$$1"   am_compiler_list=])
18166fe65f6Smrg
182a9274bcdSmrgAC_CACHE_CHECK([dependency style of $depcc],
183a9274bcdSmrg               [am_cv_$1_dependencies_compiler_type],
184a9274bcdSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185a9274bcdSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
186a9274bcdSmrg  # making bogus files that we don't know about and never remove.  For
187a9274bcdSmrg  # instance it was reported that on HP-UX the gcc test will end up
188c6a6acfbSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189c6a6acfbSmrg  # in D".
190c6a6acfbSmrg  rm -rf conftest.dir
191a9274bcdSmrg  mkdir conftest.dir
192a9274bcdSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193a9274bcdSmrg  # using a relative directory.
194a9274bcdSmrg  cp "$am_depcomp" conftest.dir
195a9274bcdSmrg  cd conftest.dir
196a9274bcdSmrg  # We will build objects and dependencies in a subdirectory because
197a9274bcdSmrg  # it helps to detect inapplicable dependency modes.  For instance
198a9274bcdSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199a9274bcdSmrg  # side effect of compilation, but ICC will put the dependencies in
200a9274bcdSmrg  # the current directory while Tru64 will put them in the object
201a9274bcdSmrg  # directory.
202a9274bcdSmrg  mkdir sub
20389d09728Smrg
204a9274bcdSmrg  am_cv_$1_dependencies_compiler_type=none
205a9274bcdSmrg  if test "$am_compiler_list" = ""; then
206a9274bcdSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207a9274bcdSmrg  fi
208a9274bcdSmrg  am__universal=false
209a9274bcdSmrg  m4_case([$1], [CC],
210a9274bcdSmrg    [case " $depcc " in #(
211a9274bcdSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212a9274bcdSmrg     esac],
213a9274bcdSmrg    [CXX],
214a9274bcdSmrg    [case " $depcc " in #(
215a9274bcdSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216a9274bcdSmrg     esac])
21766fe65f6Smrg
218a9274bcdSmrg  for depmode in $am_compiler_list; do
219a9274bcdSmrg    # Setup a source with many dependencies, because some compilers
220a9274bcdSmrg    # like to wrap large dependency lists on column 80 (with \), and
221a9274bcdSmrg    # we should not choose a depcomp mode which is confused by this.
222a9274bcdSmrg    #
223a9274bcdSmrg    # We need to recreate these files for each test, as the compiler may
224a9274bcdSmrg    # overwrite some of them when testing with obscure command lines.
225a9274bcdSmrg    # This happens at least with the AIX C compiler.
226a9274bcdSmrg    : > sub/conftest.c
227a9274bcdSmrg    for i in 1 2 3 4 5 6; do
228a9274bcdSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229c6a6acfbSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230c6a6acfbSmrg      # Solaris 10 /bin/sh.
231c6a6acfbSmrg      echo '/* dummy */' > sub/conftst$i.h
232a9274bcdSmrg    done
233a9274bcdSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23466fe65f6Smrg
235c6a6acfbSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236a9274bcdSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237c6a6acfbSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238c6a6acfbSmrg    # versions had trouble with output in subdirs.
239a9274bcdSmrg    am__obj=sub/conftest.${OBJEXT-o}
240a9274bcdSmrg    am__minus_obj="-o $am__obj"
241a9274bcdSmrg    case $depmode in
242a9274bcdSmrg    gcc)
243a9274bcdSmrg      # This depmode causes a compiler race in universal mode.
244a9274bcdSmrg      test "$am__universal" = false || continue
245a9274bcdSmrg      ;;
246a9274bcdSmrg    nosideeffect)
247c6a6acfbSmrg      # After this tag, mechanisms are not by side-effect, so they'll
248c6a6acfbSmrg      # only be used when explicitly requested.
249a9274bcdSmrg      if test "x$enable_dependency_tracking" = xyes; then
250a9274bcdSmrg	continue
251a9274bcdSmrg      else
252a9274bcdSmrg	break
253a9274bcdSmrg      fi
254a9274bcdSmrg      ;;
255c6a6acfbSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256c6a6acfbSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
257a9274bcdSmrg      # not run yet.  These depmodes are late enough in the game, and
258a9274bcdSmrg      # so weak that their functioning should not be impacted.
259a9274bcdSmrg      am__obj=conftest.${OBJEXT-o}
260a9274bcdSmrg      am__minus_obj=
261a9274bcdSmrg      ;;
262a9274bcdSmrg    none) break ;;
263a9274bcdSmrg    esac
264a9274bcdSmrg    if depmode=$depmode \
265a9274bcdSmrg       source=sub/conftest.c object=$am__obj \
266a9274bcdSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267a9274bcdSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268a9274bcdSmrg         >/dev/null 2>conftest.err &&
269a9274bcdSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270a9274bcdSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271a9274bcdSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272a9274bcdSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273a9274bcdSmrg      # icc doesn't choke on unknown options, it will just issue warnings
274a9274bcdSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
275a9274bcdSmrg      # that says an option was ignored or not supported.
276a9274bcdSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277a9274bcdSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278a9274bcdSmrg      # The diagnosis changed in icc 8.0:
279a9274bcdSmrg      #   icc: Command line remark: option '-MP' not supported
280a9274bcdSmrg      if (grep 'ignoring option' conftest.err ||
281a9274bcdSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282a9274bcdSmrg        am_cv_$1_dependencies_compiler_type=$depmode
283a9274bcdSmrg        break
284a9274bcdSmrg      fi
285a9274bcdSmrg    fi
286a9274bcdSmrg  done
28766fe65f6Smrg
288a9274bcdSmrg  cd ..
289a9274bcdSmrg  rm -rf conftest.dir
29066fe65f6Smrgelse
291a9274bcdSmrg  am_cv_$1_dependencies_compiler_type=none
29266fe65f6Smrgfi
293a9274bcdSmrg])
294a9274bcdSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295a9274bcdSmrgAM_CONDITIONAL([am__fastdep$1], [
296a9274bcdSmrg  test "x$enable_dependency_tracking" != xno \
297a9274bcdSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298a9274bcdSmrg])
29966fe65f6Smrg
30066fe65f6Smrg
301a9274bcdSmrg# AM_SET_DEPDIR
302a9274bcdSmrg# -------------
303a9274bcdSmrg# Choose a directory name for dependency files.
304c6a6acfbSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305a9274bcdSmrgAC_DEFUN([AM_SET_DEPDIR],
306a9274bcdSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307a9274bcdSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308a9274bcdSmrg])
30966fe65f6Smrg
31066fe65f6Smrg
311a9274bcdSmrg# AM_DEP_TRACK
312a9274bcdSmrg# ------------
313a9274bcdSmrgAC_DEFUN([AM_DEP_TRACK],
314c6a6acfbSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315c6a6acfbSmrgAS_HELP_STRING(
316c6a6acfbSmrg  [--enable-dependency-tracking],
317c6a6acfbSmrg  [do not reject slow dependency extractors])
318c6a6acfbSmrgAS_HELP_STRING(
319c6a6acfbSmrg  [--disable-dependency-tracking],
320c6a6acfbSmrg  [speeds up one-time build])])
321a9274bcdSmrgif test "x$enable_dependency_tracking" != xno; then
322a9274bcdSmrg  am_depcomp="$ac_aux_dir/depcomp"
323a9274bcdSmrg  AMDEPBACKSLASH='\'
324c6a6acfbSmrg  am__nodep='_no'
32566fe65f6Smrgfi
326a9274bcdSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327a9274bcdSmrgAC_SUBST([AMDEPBACKSLASH])dnl
328a9274bcdSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329c6a6acfbSmrgAC_SUBST([am__nodep])dnl
330c6a6acfbSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331a9274bcdSmrg])
33266fe65f6Smrg
333a9274bcdSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33466fe65f6Smrg
335c6a6acfbSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
336a9274bcdSmrg#
337a9274bcdSmrg# This file is free software; the Free Software Foundation
338a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
339a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
34066fe65f6Smrg
34166fe65f6Smrg
342a9274bcdSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
343a9274bcdSmrg# ------------------------------
344a9274bcdSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
345a9274bcdSmrg[{
346c6a6acfbSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
347a9274bcdSmrg  # are listed without --file.  Let's play safe and only enable the eval
348a9274bcdSmrg  # if we detect the quoting.
349a9274bcdSmrg  case $CONFIG_FILES in
350a9274bcdSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
351a9274bcdSmrg  *)   set x $CONFIG_FILES ;;
352a9274bcdSmrg  esac
353a9274bcdSmrg  shift
354a9274bcdSmrg  for mf
355a9274bcdSmrg  do
356a9274bcdSmrg    # Strip MF so we end up with the name of the file.
357a9274bcdSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
358a9274bcdSmrg    # Check whether this is an Automake generated Makefile or not.
359c6a6acfbSmrg    # We used to match only the files named 'Makefile.in', but
360a9274bcdSmrg    # some people rename them; so instead we look at the file content.
361a9274bcdSmrg    # Grep'ing the first line is not enough: some people post-process
362a9274bcdSmrg    # each Makefile.in and add a new line on top of each file to say so.
363a9274bcdSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
364a9274bcdSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
365a9274bcdSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
366a9274bcdSmrg      dirpart=`AS_DIRNAME("$mf")`
367a9274bcdSmrg    else
368a9274bcdSmrg      continue
369a9274bcdSmrg    fi
370a9274bcdSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
371c6a6acfbSmrg    # from the Makefile without running 'make'.
372a9274bcdSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
373a9274bcdSmrg    test -z "$DEPDIR" && continue
374a9274bcdSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
375c6a6acfbSmrg    test -z "$am__include" && continue
376a9274bcdSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
377a9274bcdSmrg    # Find all dependency output files, they are included files with
378a9274bcdSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379a9274bcdSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380a9274bcdSmrg    # expansion.
381a9274bcdSmrg    for file in `sed -n "
382a9274bcdSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383c6a6acfbSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
384a9274bcdSmrg      # Make sure the directory exists.
385a9274bcdSmrg      test -f "$dirpart/$file" && continue
386a9274bcdSmrg      fdir=`AS_DIRNAME(["$file"])`
387a9274bcdSmrg      AS_MKDIR_P([$dirpart/$fdir])
388a9274bcdSmrg      # echo "creating $dirpart/$file"
389a9274bcdSmrg      echo '# dummy' > "$dirpart/$file"
390a9274bcdSmrg    done
391a9274bcdSmrg  done
392a9274bcdSmrg}
393a9274bcdSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
39466fe65f6Smrg
395a9274bcdSmrg
396a9274bcdSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
397a9274bcdSmrg# -----------------------------
398a9274bcdSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
39989d09728Smrg#
400a9274bcdSmrg# This code is only required when automatic dependency tracking
401c6a6acfbSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
402a9274bcdSmrg# need in order to bootstrap the dependency handling code.
403a9274bcdSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
404a9274bcdSmrg[AC_CONFIG_COMMANDS([depfiles],
405a9274bcdSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
406a9274bcdSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
407a9274bcdSmrg])
40889d09728Smrg
409a9274bcdSmrg# Do all the work for Automake.                             -*- Autoconf -*-
41089d09728Smrg
411c6a6acfbSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
412a9274bcdSmrg#
413a9274bcdSmrg# This file is free software; the Free Software Foundation
414a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
415a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
416a9274bcdSmrg
417a9274bcdSmrg# This macro actually does too much.  Some checks are only needed if
418a9274bcdSmrg# your package does certain things.  But this isn't really a big deal.
419a9274bcdSmrg
420c6a6acfbSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
421c6a6acfbSmrgm4_define([AC_PROG_CC],
422c6a6acfbSmrgm4_defn([AC_PROG_CC])
423c6a6acfbSmrg[_AM_PROG_CC_C_O
424c6a6acfbSmrg])
425c6a6acfbSmrg
426a9274bcdSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
427a9274bcdSmrg# AM_INIT_AUTOMAKE([OPTIONS])
428a9274bcdSmrg# -----------------------------------------------
429a9274bcdSmrg# The call with PACKAGE and VERSION arguments is the old style
430a9274bcdSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
431a9274bcdSmrg# and VERSION should now be passed to AC_INIT and removed from
432a9274bcdSmrg# the call to AM_INIT_AUTOMAKE.
433a9274bcdSmrg# We support both call styles for the transition.  After
434a9274bcdSmrg# the next Automake release, Autoconf can make the AC_INIT
435a9274bcdSmrg# arguments mandatory, and then we can depend on a new Autoconf
436a9274bcdSmrg# release and drop the old call support.
437a9274bcdSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
438c6a6acfbSmrg[AC_PREREQ([2.65])dnl
439a9274bcdSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
440a9274bcdSmrgdnl the ones we care about.
441a9274bcdSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
442a9274bcdSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
443a9274bcdSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
444a9274bcdSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
445a9274bcdSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
446a9274bcdSmrg  # is not polluted with repeated "-I."
447a9274bcdSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
448a9274bcdSmrg  # test to see if srcdir already configured
449a9274bcdSmrg  if test -f $srcdir/config.status; then
450a9274bcdSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
451a9274bcdSmrg  fi
45289d09728Smrgfi
45389d09728Smrg
454a9274bcdSmrg# test whether we have cygpath
455a9274bcdSmrgif test -z "$CYGPATH_W"; then
456a9274bcdSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
457a9274bcdSmrg    CYGPATH_W='cygpath -w'
458a9274bcdSmrg  else
459a9274bcdSmrg    CYGPATH_W=echo
460a9274bcdSmrg  fi
46189d09728Smrgfi
462a9274bcdSmrgAC_SUBST([CYGPATH_W])
46389d09728Smrg
464a9274bcdSmrg# Define the identity of the package.
465a9274bcdSmrgdnl Distinguish between old-style and new-style calls.
466a9274bcdSmrgm4_ifval([$2],
467c6a6acfbSmrg[AC_DIAGNOSE([obsolete],
468c6a6acfbSmrg             [$0: two- and three-arguments forms are deprecated.])
469c6a6acfbSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
470a9274bcdSmrg AC_SUBST([PACKAGE], [$1])dnl
471a9274bcdSmrg AC_SUBST([VERSION], [$2])],
472a9274bcdSmrg[_AM_SET_OPTIONS([$1])dnl
473a9274bcdSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
474c6a6acfbSmrgm4_if(
475c6a6acfbSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
476c6a6acfbSmrg  [ok:ok],,
477a9274bcdSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
478a9274bcdSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
479a9274bcdSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
48089d09728Smrg
481a9274bcdSmrg_AM_IF_OPTION([no-define],,
482c6a6acfbSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
483c6a6acfbSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48489d09728Smrg
485a9274bcdSmrg# Some tools Automake needs.
486a9274bcdSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
487a9274bcdSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
488c6a6acfbSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
489c6a6acfbSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
490c6a6acfbSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
491c6a6acfbSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
492c6a6acfbSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
493a9274bcdSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
494a9274bcdSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
495c6a6acfbSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
496c6a6acfbSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
497c6a6acfbSmrg# dies out for good.  For more background, see:
498c6a6acfbSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
499c6a6acfbSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
500c6a6acfbSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
501c6a6acfbSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
502c6a6acfbSmrg# system "awk" is bad on some platforms.
503a9274bcdSmrgAC_REQUIRE([AC_PROG_AWK])dnl
504a9274bcdSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
505a9274bcdSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
506a9274bcdSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
507a9274bcdSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
508a9274bcdSmrg			     [_AM_PROG_TAR([v7])])])
509a9274bcdSmrg_AM_IF_OPTION([no-dependencies],,
510a9274bcdSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
511c6a6acfbSmrg		  [_AM_DEPENDENCIES([CC])],
512c6a6acfbSmrg		  [m4_define([AC_PROG_CC],
513c6a6acfbSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
514a9274bcdSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
515c6a6acfbSmrg		  [_AM_DEPENDENCIES([CXX])],
516c6a6acfbSmrg		  [m4_define([AC_PROG_CXX],
517c6a6acfbSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
518a9274bcdSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
519c6a6acfbSmrg		  [_AM_DEPENDENCIES([OBJC])],
520c6a6acfbSmrg		  [m4_define([AC_PROG_OBJC],
521c6a6acfbSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
522c6a6acfbSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
523c6a6acfbSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
524c6a6acfbSmrg		  [m4_define([AC_PROG_OBJCXX],
525c6a6acfbSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
526a9274bcdSmrg])
527c6a6acfbSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
528c6a6acfbSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
529c6a6acfbSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
530c6a6acfbSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
531a9274bcdSmrgAC_CONFIG_COMMANDS_PRE(dnl
532a9274bcdSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
533a9274bcdSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
534c6a6acfbSmrg
535c6a6acfbSmrg# POSIX will say in a future version that running "rm -f" with no argument
536c6a6acfbSmrg# is OK; and we want to be able to make that assumption in our Makefile
537c6a6acfbSmrg# recipes.  So use an aggressive probe to check that the usage we want is
538c6a6acfbSmrg# actually supported "in the wild" to an acceptable degree.
539c6a6acfbSmrg# See automake bug#10828.
540c6a6acfbSmrg# To make any issue more visible, cause the running configure to be aborted
541c6a6acfbSmrg# by default if the 'rm' program in use doesn't match our expectations; the
542c6a6acfbSmrg# user can still override this though.
543c6a6acfbSmrgif rm -f && rm -fr && rm -rf; then : OK; else
544c6a6acfbSmrg  cat >&2 <<'END'
545c6a6acfbSmrgOops!
546c6a6acfbSmrg
547c6a6acfbSmrgYour 'rm' program seems unable to run without file operands specified
548c6a6acfbSmrgon the command line, even when the '-f' option is present.  This is contrary
549c6a6acfbSmrgto the behaviour of most rm programs out there, and not conforming with
550c6a6acfbSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
551c6a6acfbSmrg
552c6a6acfbSmrgPlease tell bug-automake@gnu.org about your system, including the value
553c6a6acfbSmrgof your $PATH and any error possibly output before this message.  This
554c6a6acfbSmrgcan help us improve future automake versions.
555c6a6acfbSmrg
556c6a6acfbSmrgEND
557c6a6acfbSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
558c6a6acfbSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
559c6a6acfbSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
560c6a6acfbSmrg    echo >&2
561c6a6acfbSmrg  else
562c6a6acfbSmrg    cat >&2 <<'END'
563c6a6acfbSmrgAborting the configuration process, to ensure you take notice of the issue.
564c6a6acfbSmrg
565c6a6acfbSmrgYou can download and install GNU coreutils to get an 'rm' implementation
566c6a6acfbSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
567c6a6acfbSmrg
568c6a6acfbSmrgIf you want to complete the configuration process using your problematic
569c6a6acfbSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
570c6a6acfbSmrgto "yes", and re-run configure.
571c6a6acfbSmrg
572c6a6acfbSmrgEND
573c6a6acfbSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
574c6a6acfbSmrg  fi
575c6a6acfbSmrgfi
576c6a6acfbSmrgdnl The trailing newline in this macro's definition is deliberate, for
577c6a6acfbSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
578c6a6acfbSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
579a9274bcdSmrg])
580a9274bcdSmrg
581c6a6acfbSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
582a9274bcdSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
583a9274bcdSmrgdnl mangled by Autoconf and run in a shell conditional statement.
584a9274bcdSmrgm4_define([_AC_COMPILER_EXEEXT],
585a9274bcdSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
586a9274bcdSmrg
587a9274bcdSmrg# When config.status generates a header, we must update the stamp-h file.
588a9274bcdSmrg# This file resides in the same directory as the config header
589a9274bcdSmrg# that is generated.  The stamp files are numbered to have different names.
590a9274bcdSmrg
591a9274bcdSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
592a9274bcdSmrg# loop where config.status creates the headers, so we can generate
593a9274bcdSmrg# our stamp files there.
594a9274bcdSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
595a9274bcdSmrg[# Compute $1's index in $config_headers.
596a9274bcdSmrg_am_arg=$1
597a9274bcdSmrg_am_stamp_count=1
598a9274bcdSmrgfor _am_header in $config_headers :; do
599a9274bcdSmrg  case $_am_header in
600a9274bcdSmrg    $_am_arg | $_am_arg:* )
601a9274bcdSmrg      break ;;
602a9274bcdSmrg    * )
603a9274bcdSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
604a9274bcdSmrg  esac
605a9274bcdSmrgdone
606a9274bcdSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
607a9274bcdSmrg
608c6a6acfbSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
60989d09728Smrg#
610a9274bcdSmrg# This file is free software; the Free Software Foundation
611a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
612a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
61366fe65f6Smrg
614a9274bcdSmrg# AM_PROG_INSTALL_SH
615a9274bcdSmrg# ------------------
616a9274bcdSmrg# Define $install_sh.
617a9274bcdSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
618a9274bcdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
619c6a6acfbSmrgif test x"${install_sh+set}" != xset; then
620a9274bcdSmrg  case $am_aux_dir in
621a9274bcdSmrg  *\ * | *\	*)
622a9274bcdSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
623a9274bcdSmrg  *)
624a9274bcdSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
625a9274bcdSmrg  esac
62666fe65f6Smrgfi
627c6a6acfbSmrgAC_SUBST([install_sh])])
62866fe65f6Smrg
629c6a6acfbSmrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
630a9274bcdSmrg#
631a9274bcdSmrg# This file is free software; the Free Software Foundation
632a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
633a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
634a9274bcdSmrg
635a9274bcdSmrg# Check whether the underlying file-system supports filenames
636a9274bcdSmrg# with a leading dot.  For instance MS-DOS doesn't.
637a9274bcdSmrgAC_DEFUN([AM_SET_LEADING_DOT],
638a9274bcdSmrg[rm -rf .tst 2>/dev/null
639a9274bcdSmrgmkdir .tst 2>/dev/null
640a9274bcdSmrgif test -d .tst; then
641a9274bcdSmrg  am__leading_dot=.
64266fe65f6Smrgelse
643a9274bcdSmrg  am__leading_dot=_
64466fe65f6Smrgfi
645a9274bcdSmrgrmdir .tst 2>/dev/null
646a9274bcdSmrgAC_SUBST([am__leading_dot])])
64766fe65f6Smrg
648a9274bcdSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
649a9274bcdSmrg
650c6a6acfbSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
65189d09728Smrg#
652a9274bcdSmrg# This file is free software; the Free Software Foundation
653a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
654a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
65589d09728Smrg
656a9274bcdSmrg# AM_MAKE_INCLUDE()
657a9274bcdSmrg# -----------------
658a9274bcdSmrg# Check to see how make treats includes.
659a9274bcdSmrgAC_DEFUN([AM_MAKE_INCLUDE],
660a9274bcdSmrg[am_make=${MAKE-make}
661a9274bcdSmrgcat > confinc << 'END'
662a9274bcdSmrgam__doit:
663a9274bcdSmrg	@echo this is the am__doit target
664a9274bcdSmrg.PHONY: am__doit
665a9274bcdSmrgEND
666a9274bcdSmrg# If we don't find an include directive, just comment out the code.
667a9274bcdSmrgAC_MSG_CHECKING([for style of include used by $am_make])
668a9274bcdSmrgam__include="#"
669a9274bcdSmrgam__quote=
670a9274bcdSmrg_am_result=none
671a9274bcdSmrg# First try GNU make style include.
672a9274bcdSmrgecho "include confinc" > confmf
673c6a6acfbSmrg# Ignore all kinds of additional output from 'make'.
674a9274bcdSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
675a9274bcdSmrg*the\ am__doit\ target*)
676a9274bcdSmrg  am__include=include
677a9274bcdSmrg  am__quote=
678a9274bcdSmrg  _am_result=GNU
679a9274bcdSmrg  ;;
680a9274bcdSmrgesac
681a9274bcdSmrg# Now try BSD make style include.
682a9274bcdSmrgif test "$am__include" = "#"; then
683a9274bcdSmrg   echo '.include "confinc"' > confmf
684a9274bcdSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
685a9274bcdSmrg   *the\ am__doit\ target*)
686a9274bcdSmrg     am__include=.include
687a9274bcdSmrg     am__quote="\""
688a9274bcdSmrg     _am_result=BSD
689a9274bcdSmrg     ;;
690a9274bcdSmrg   esac
69189d09728Smrgfi
692a9274bcdSmrgAC_SUBST([am__include])
693a9274bcdSmrgAC_SUBST([am__quote])
694a9274bcdSmrgAC_MSG_RESULT([$_am_result])
695a9274bcdSmrgrm -f confinc confmf
69666fe65f6Smrg])
69766fe65f6Smrg
698a9274bcdSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
69989d09728Smrg
700c6a6acfbSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
70166fe65f6Smrg#
70266fe65f6Smrg# This file is free software; the Free Software Foundation
70366fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
70466fe65f6Smrg# with or without modifications, as long as this notice is preserved.
70566fe65f6Smrg
706a9274bcdSmrg# AM_MISSING_PROG(NAME, PROGRAM)
707a9274bcdSmrg# ------------------------------
708a9274bcdSmrgAC_DEFUN([AM_MISSING_PROG],
709a9274bcdSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
710a9274bcdSmrg$1=${$1-"${am_missing_run}$2"}
711a9274bcdSmrgAC_SUBST($1)])
71266fe65f6Smrg
713a9274bcdSmrg# AM_MISSING_HAS_RUN
714a9274bcdSmrg# ------------------
715c6a6acfbSmrg# Define MISSING if not defined so far and test if it is modern enough.
716c6a6acfbSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
717a9274bcdSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
718a9274bcdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
719a9274bcdSmrgAC_REQUIRE_AUX_FILE([missing])dnl
720a9274bcdSmrgif test x"${MISSING+set}" != xset; then
721a9274bcdSmrg  case $am_aux_dir in
722a9274bcdSmrg  *\ * | *\	*)
723a9274bcdSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
724a9274bcdSmrg  *)
725a9274bcdSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
726a9274bcdSmrg  esac
727a9274bcdSmrgfi
728a9274bcdSmrg# Use eval to expand $SHELL
729c6a6acfbSmrgif eval "$MISSING --is-lightweight"; then
730c6a6acfbSmrg  am_missing_run="$MISSING "
731a9274bcdSmrgelse
732a9274bcdSmrg  am_missing_run=
733c6a6acfbSmrg  AC_MSG_WARN(['missing' script is too old or missing])
734a9274bcdSmrgfi
735a9274bcdSmrg])
73666fe65f6Smrg
737a9274bcdSmrg# Helper functions for option handling.                     -*- Autoconf -*-
73866fe65f6Smrg
739c6a6acfbSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
74066fe65f6Smrg#
74166fe65f6Smrg# This file is free software; the Free Software Foundation
74266fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
74366fe65f6Smrg# with or without modifications, as long as this notice is preserved.
74466fe65f6Smrg
745a9274bcdSmrg# _AM_MANGLE_OPTION(NAME)
746a9274bcdSmrg# -----------------------
747a9274bcdSmrgAC_DEFUN([_AM_MANGLE_OPTION],
748a9274bcdSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
74966fe65f6Smrg
750a9274bcdSmrg# _AM_SET_OPTION(NAME)
751c6a6acfbSmrg# --------------------
752a9274bcdSmrg# Set option NAME.  Presently that only means defining a flag for this option.
753a9274bcdSmrgAC_DEFUN([_AM_SET_OPTION],
754c6a6acfbSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
75566fe65f6Smrg
756a9274bcdSmrg# _AM_SET_OPTIONS(OPTIONS)
757c6a6acfbSmrg# ------------------------
758a9274bcdSmrg# OPTIONS is a space-separated list of Automake options.
759a9274bcdSmrgAC_DEFUN([_AM_SET_OPTIONS],
760a9274bcdSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
76166fe65f6Smrg
762a9274bcdSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
763a9274bcdSmrg# -------------------------------------------
764a9274bcdSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
765a9274bcdSmrgAC_DEFUN([_AM_IF_OPTION],
766a9274bcdSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76766fe65f6Smrg
768c6a6acfbSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
769c6a6acfbSmrg#
770c6a6acfbSmrg# This file is free software; the Free Software Foundation
771c6a6acfbSmrg# gives unlimited permission to copy and/or distribute it,
772c6a6acfbSmrg# with or without modifications, as long as this notice is preserved.
77366fe65f6Smrg
774c6a6acfbSmrg# _AM_PROG_CC_C_O
775c6a6acfbSmrg# ---------------
776c6a6acfbSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
777c6a6acfbSmrg# to automatically call this.
778c6a6acfbSmrgAC_DEFUN([_AM_PROG_CC_C_O],
779c6a6acfbSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
780c6a6acfbSmrgAC_REQUIRE_AUX_FILE([compile])dnl
781c6a6acfbSmrgAC_LANG_PUSH([C])dnl
782c6a6acfbSmrgAC_CACHE_CHECK(
783c6a6acfbSmrg  [whether $CC understands -c and -o together],
784c6a6acfbSmrg  [am_cv_prog_cc_c_o],
785c6a6acfbSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
786c6a6acfbSmrg  # Make sure it works both with $CC and with simple cc.
787c6a6acfbSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
788c6a6acfbSmrg  # compilers refuse to overwrite an existing .o file with -o,
789c6a6acfbSmrg  # though they will create one.
790c6a6acfbSmrg  am_cv_prog_cc_c_o=yes
791c6a6acfbSmrg  for am_i in 1 2; do
792c6a6acfbSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
793c6a6acfbSmrg         && test -f conftest2.$ac_objext; then
794c6a6acfbSmrg      : OK
795c6a6acfbSmrg    else
796c6a6acfbSmrg      am_cv_prog_cc_c_o=no
797c6a6acfbSmrg      break
798c6a6acfbSmrg    fi
799c6a6acfbSmrg  done
800c6a6acfbSmrg  rm -f core conftest*
801c6a6acfbSmrg  unset am_i])
802c6a6acfbSmrgif test "$am_cv_prog_cc_c_o" != yes; then
803c6a6acfbSmrg   # Losing compiler, so override with the script.
804c6a6acfbSmrg   # FIXME: It is wrong to rewrite CC.
805c6a6acfbSmrg   # But if we don't then we get into trouble of one sort or another.
806c6a6acfbSmrg   # A longer-term fix would be to have automake use am__CC in this case,
807c6a6acfbSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
808c6a6acfbSmrg   CC="$am_aux_dir/compile $CC"
809c6a6acfbSmrgfi
810c6a6acfbSmrgAC_LANG_POP([C])])
811c6a6acfbSmrg
812c6a6acfbSmrg# For backward compatibility.
813c6a6acfbSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
814c6a6acfbSmrg
815c6a6acfbSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
81666fe65f6Smrg#
817a9274bcdSmrg# This file is free software; the Free Software Foundation
818a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
819a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
82066fe65f6Smrg
821c6a6acfbSmrg# AM_RUN_LOG(COMMAND)
822c6a6acfbSmrg# -------------------
823c6a6acfbSmrg# Run COMMAND, save the exit status in ac_status, and log it.
824c6a6acfbSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
825c6a6acfbSmrgAC_DEFUN([AM_RUN_LOG],
826c6a6acfbSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
827c6a6acfbSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
828c6a6acfbSmrg   ac_status=$?
829c6a6acfbSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
830c6a6acfbSmrg   (exit $ac_status); }])
831c6a6acfbSmrg
832c6a6acfbSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
833c6a6acfbSmrg
834c6a6acfbSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
835c6a6acfbSmrg#
836c6a6acfbSmrg# This file is free software; the Free Software Foundation
837c6a6acfbSmrg# gives unlimited permission to copy and/or distribute it,
838c6a6acfbSmrg# with or without modifications, as long as this notice is preserved.
83966fe65f6Smrg
840a9274bcdSmrg# AM_SANITY_CHECK
841a9274bcdSmrg# ---------------
842a9274bcdSmrgAC_DEFUN([AM_SANITY_CHECK],
843a9274bcdSmrg[AC_MSG_CHECKING([whether build environment is sane])
844a9274bcdSmrg# Reject unsafe characters in $srcdir or the absolute working directory
845a9274bcdSmrg# name.  Accept space and tab only in the latter.
846a9274bcdSmrgam_lf='
847a9274bcdSmrg'
848a9274bcdSmrgcase `pwd` in
849a9274bcdSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
850a9274bcdSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
851a9274bcdSmrgesac
852a9274bcdSmrgcase $srcdir in
853a9274bcdSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
854c6a6acfbSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
855a9274bcdSmrgesac
85666fe65f6Smrg
857c6a6acfbSmrg# Do 'set' in a subshell so we don't clobber the current shell's
858a9274bcdSmrg# arguments.  Must try -L first in case configure is actually a
859a9274bcdSmrg# symlink; some systems play weird games with the mod time of symlinks
860a9274bcdSmrg# (eg FreeBSD returns the mod time of the symlink's containing
861a9274bcdSmrg# directory).
862a9274bcdSmrgif (
863c6a6acfbSmrg   am_has_slept=no
864c6a6acfbSmrg   for am_try in 1 2; do
865c6a6acfbSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
866c6a6acfbSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
867c6a6acfbSmrg     if test "$[*]" = "X"; then
868c6a6acfbSmrg	# -L didn't work.
869c6a6acfbSmrg	set X `ls -t "$srcdir/configure" conftest.file`
870c6a6acfbSmrg     fi
871c6a6acfbSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
872c6a6acfbSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
873c6a6acfbSmrg
874c6a6acfbSmrg	# If neither matched, then we have a broken ls.  This can happen
875c6a6acfbSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
876c6a6acfbSmrg	# broken ls alias from the environment.  This has actually
877c6a6acfbSmrg	# happened.  Such a system could not be considered "sane".
878c6a6acfbSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
879c6a6acfbSmrg  alias in your environment])
880c6a6acfbSmrg     fi
881c6a6acfbSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
882c6a6acfbSmrg       break
883c6a6acfbSmrg     fi
884c6a6acfbSmrg     # Just in case.
885c6a6acfbSmrg     sleep 1
886c6a6acfbSmrg     am_has_slept=yes
887c6a6acfbSmrg   done
888a9274bcdSmrg   test "$[2]" = conftest.file
889a9274bcdSmrg   )
890a9274bcdSmrgthen
891a9274bcdSmrg   # Ok.
892a9274bcdSmrg   :
89366fe65f6Smrgelse
894a9274bcdSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
895a9274bcdSmrgCheck your system clock])
89666fe65f6Smrgfi
897c6a6acfbSmrgAC_MSG_RESULT([yes])
898c6a6acfbSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
899c6a6acfbSmrg# generated files are strictly newer.
900c6a6acfbSmrgam_sleep_pid=
901c6a6acfbSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
902c6a6acfbSmrg  ( sleep 1 ) &
903c6a6acfbSmrg  am_sleep_pid=$!
904c6a6acfbSmrgfi
905c6a6acfbSmrgAC_CONFIG_COMMANDS_PRE(
906c6a6acfbSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
907c6a6acfbSmrg   if test -n "$am_sleep_pid"; then
908c6a6acfbSmrg     # Hide warnings about reused PIDs.
909c6a6acfbSmrg     wait $am_sleep_pid 2>/dev/null
910c6a6acfbSmrg   fi
911c6a6acfbSmrg   AC_MSG_RESULT([done])])
912c6a6acfbSmrgrm -f conftest.file
913c6a6acfbSmrg])
91466fe65f6Smrg
915c6a6acfbSmrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
91666fe65f6Smrg#
91766fe65f6Smrg# This file is free software; the Free Software Foundation
91866fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
91966fe65f6Smrg# with or without modifications, as long as this notice is preserved.
92066fe65f6Smrg
921a9274bcdSmrg# AM_SILENT_RULES([DEFAULT])
922a9274bcdSmrg# --------------------------
923a9274bcdSmrg# Enable less verbose build rules; with the default set to DEFAULT
924c6a6acfbSmrg# ("yes" being less verbose, "no" or empty being verbose).
925a9274bcdSmrgAC_DEFUN([AM_SILENT_RULES],
926c6a6acfbSmrg[AC_ARG_ENABLE([silent-rules], [dnl
927c6a6acfbSmrgAS_HELP_STRING(
928c6a6acfbSmrg  [--enable-silent-rules],
929c6a6acfbSmrg  [less verbose build output (undo: "make V=1")])
930c6a6acfbSmrgAS_HELP_STRING(
931c6a6acfbSmrg  [--disable-silent-rules],
932c6a6acfbSmrg  [verbose build output (undo: "make V=0")])dnl
933c6a6acfbSmrg])
934c6a6acfbSmrgcase $enable_silent_rules in @%:@ (((
935c6a6acfbSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
936c6a6acfbSmrg   no) AM_DEFAULT_VERBOSITY=1;;
937c6a6acfbSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93889d09728Smrgesac
939c6a6acfbSmrgdnl
940c6a6acfbSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
941c6a6acfbSmrgdnl do not support nested variable expansions.
942c6a6acfbSmrgdnl See automake bug#9928 and bug#10237.
943c6a6acfbSmrgam_make=${MAKE-make}
944c6a6acfbSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
945c6a6acfbSmrg   [am_cv_make_support_nested_variables],
946c6a6acfbSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
947c6a6acfbSmrgBAR0=false
948c6a6acfbSmrgBAR1=true
949c6a6acfbSmrgV=1
950c6a6acfbSmrgam__doit:
951c6a6acfbSmrg	@$(TRUE)
952c6a6acfbSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
953c6a6acfbSmrg  am_cv_make_support_nested_variables=yes
954c6a6acfbSmrgelse
955c6a6acfbSmrg  am_cv_make_support_nested_variables=no
956c6a6acfbSmrgfi])
957c6a6acfbSmrgif test $am_cv_make_support_nested_variables = yes; then
958c6a6acfbSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
959c6a6acfbSmrg  AM_V='$(V)'
960c6a6acfbSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
961c6a6acfbSmrgelse
962c6a6acfbSmrg  AM_V=$AM_DEFAULT_VERBOSITY
963c6a6acfbSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
964c6a6acfbSmrgfi
965c6a6acfbSmrgAC_SUBST([AM_V])dnl
966c6a6acfbSmrgAM_SUBST_NOTMAKE([AM_V])dnl
967c6a6acfbSmrgAC_SUBST([AM_DEFAULT_V])dnl
968c6a6acfbSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
969a9274bcdSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
970a9274bcdSmrgAM_BACKSLASH='\'
971a9274bcdSmrgAC_SUBST([AM_BACKSLASH])dnl
972a9274bcdSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97366fe65f6Smrg])
97466fe65f6Smrg
975c6a6acfbSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
97666fe65f6Smrg#
97766fe65f6Smrg# This file is free software; the Free Software Foundation
97866fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
97966fe65f6Smrg# with or without modifications, as long as this notice is preserved.
98066fe65f6Smrg
981a9274bcdSmrg# AM_PROG_INSTALL_STRIP
982a9274bcdSmrg# ---------------------
983c6a6acfbSmrg# One issue with vendor 'install' (even GNU) is that you can't
984a9274bcdSmrg# specify the program used to strip binaries.  This is especially
985a9274bcdSmrg# annoying in cross-compiling environments, where the build's strip
986a9274bcdSmrg# is unlikely to handle the host's binaries.
987a9274bcdSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
988c6a6acfbSmrg# always use install-sh in "make install-strip", and initialize
989a9274bcdSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
990a9274bcdSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
991a9274bcdSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
992c6a6acfbSmrg# Installed binaries are usually stripped using 'strip' when the user
993c6a6acfbSmrg# run "make install-strip".  However 'strip' might not be the right
994a9274bcdSmrg# tool to use in cross-compilation environments, therefore Automake
995c6a6acfbSmrg# will honor the 'STRIP' environment variable to overrule this program.
996c6a6acfbSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
997a9274bcdSmrgif test "$cross_compiling" != no; then
998a9274bcdSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
999a9274bcdSmrgfi
1000a9274bcdSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1001a9274bcdSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100266fe65f6Smrg
1003c6a6acfbSmrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
100466fe65f6Smrg#
100566fe65f6Smrg# This file is free software; the Free Software Foundation
100666fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
100766fe65f6Smrg# with or without modifications, as long as this notice is preserved.
100866fe65f6Smrg
1009a9274bcdSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
1010a9274bcdSmrg# ---------------------------
1011a9274bcdSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1012a9274bcdSmrg# This macro is traced by Automake.
1013a9274bcdSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101466fe65f6Smrg
1015a9274bcdSmrg# AM_SUBST_NOTMAKE(VARIABLE)
1016c6a6acfbSmrg# --------------------------
1017a9274bcdSmrg# Public sister of _AM_SUBST_NOTMAKE.
1018a9274bcdSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101966fe65f6Smrg
1020a9274bcdSmrg# Check how to create a tarball.                            -*- Autoconf -*-
102166fe65f6Smrg
1022c6a6acfbSmrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
102366fe65f6Smrg#
102466fe65f6Smrg# This file is free software; the Free Software Foundation
102566fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
102666fe65f6Smrg# with or without modifications, as long as this notice is preserved.
102766fe65f6Smrg
1028a9274bcdSmrg# _AM_PROG_TAR(FORMAT)
1029a9274bcdSmrg# --------------------
1030a9274bcdSmrg# Check how to create a tarball in format FORMAT.
1031c6a6acfbSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
103266fe65f6Smrg#
1033a9274bcdSmrg# Substitute a variable $(am__tar) that is a command
1034a9274bcdSmrg# writing to stdout a FORMAT-tarball containing the directory
1035a9274bcdSmrg# $tardir.
1036a9274bcdSmrg#     tardir=directory && $(am__tar) > result.tar
103766fe65f6Smrg#
1038a9274bcdSmrg# Substitute a variable $(am__untar) that extract such
1039a9274bcdSmrg# a tarball read from stdin.
1040a9274bcdSmrg#     $(am__untar) < result.tar
1041c6a6acfbSmrg#
1042a9274bcdSmrgAC_DEFUN([_AM_PROG_TAR],
1043c6a6acfbSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1044c6a6acfbSmrg# in the wild :-(  We should find a proper way to deprecate it ...
1045c6a6acfbSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1046c6a6acfbSmrg
1047c6a6acfbSmrg# We'll loop over all known methods to create a tar archive until one works.
1048a9274bcdSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
104966fe65f6Smrg
1050c6a6acfbSmrgm4_if([$1], [v7],
1051c6a6acfbSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1052c6a6acfbSmrg
1053c6a6acfbSmrg  [m4_case([$1],
1054c6a6acfbSmrg    [ustar],
1055c6a6acfbSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1056c6a6acfbSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1057c6a6acfbSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1058c6a6acfbSmrg      # and bug#13588).
1059c6a6acfbSmrg      am_max_uid=2097151 # 2^21 - 1
1060c6a6acfbSmrg      am_max_gid=$am_max_uid
1061c6a6acfbSmrg      # The $UID and $GID variables are not portable, so we need to resort
1062c6a6acfbSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1063c6a6acfbSmrg      # below are definitely unexpected, so allow the users to see them
1064c6a6acfbSmrg      # (that is, avoid stderr redirection).
1065c6a6acfbSmrg      am_uid=`id -u || echo unknown`
1066c6a6acfbSmrg      am_gid=`id -g || echo unknown`
1067c6a6acfbSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1068c6a6acfbSmrg      if test $am_uid -le $am_max_uid; then
1069c6a6acfbSmrg         AC_MSG_RESULT([yes])
1070c6a6acfbSmrg      else
1071c6a6acfbSmrg         AC_MSG_RESULT([no])
1072c6a6acfbSmrg         _am_tools=none
1073c6a6acfbSmrg      fi
1074c6a6acfbSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1075c6a6acfbSmrg      if test $am_gid -le $am_max_gid; then
1076c6a6acfbSmrg         AC_MSG_RESULT([yes])
1077c6a6acfbSmrg      else
1078c6a6acfbSmrg        AC_MSG_RESULT([no])
1079c6a6acfbSmrg        _am_tools=none
1080c6a6acfbSmrg      fi],
1081c6a6acfbSmrg
1082c6a6acfbSmrg  [pax],
1083c6a6acfbSmrg    [],
1084c6a6acfbSmrg
1085c6a6acfbSmrg  [m4_fatal([Unknown tar format])])
1086c6a6acfbSmrg
1087c6a6acfbSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1088c6a6acfbSmrg
1089c6a6acfbSmrg  # Go ahead even if we have the value already cached.  We do so because we
1090c6a6acfbSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1091c6a6acfbSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1092c6a6acfbSmrg
1093c6a6acfbSmrg  for _am_tool in $_am_tools; do
1094c6a6acfbSmrg    case $_am_tool in
1095c6a6acfbSmrg    gnutar)
1096c6a6acfbSmrg      for _am_tar in tar gnutar gtar; do
1097c6a6acfbSmrg        AM_RUN_LOG([$_am_tar --version]) && break
1098c6a6acfbSmrg      done
1099c6a6acfbSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1100c6a6acfbSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1101c6a6acfbSmrg      am__untar="$_am_tar -xf -"
1102c6a6acfbSmrg      ;;
1103c6a6acfbSmrg    plaintar)
1104c6a6acfbSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1105c6a6acfbSmrg      # ustar tarball either.
1106c6a6acfbSmrg      (tar --version) >/dev/null 2>&1 && continue
1107c6a6acfbSmrg      am__tar='tar chf - "$$tardir"'
1108c6a6acfbSmrg      am__tar_='tar chf - "$tardir"'
1109c6a6acfbSmrg      am__untar='tar xf -'
1110c6a6acfbSmrg      ;;
1111c6a6acfbSmrg    pax)
1112c6a6acfbSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
1113c6a6acfbSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
1114c6a6acfbSmrg      am__untar='pax -r'
1115c6a6acfbSmrg      ;;
1116c6a6acfbSmrg    cpio)
1117c6a6acfbSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1118c6a6acfbSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1119c6a6acfbSmrg      am__untar='cpio -i -H $1 -d'
1120c6a6acfbSmrg      ;;
1121c6a6acfbSmrg    none)
1122c6a6acfbSmrg      am__tar=false
1123c6a6acfbSmrg      am__tar_=false
1124c6a6acfbSmrg      am__untar=false
1125c6a6acfbSmrg      ;;
1126c6a6acfbSmrg    esac
112766fe65f6Smrg
1128c6a6acfbSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
1129c6a6acfbSmrg    # and am__untar set.
1130c6a6acfbSmrg    test -n "${am_cv_prog_tar_$1}" && break
1131c6a6acfbSmrg
1132c6a6acfbSmrg    # tar/untar a dummy directory, and stop if the command works.
1133c6a6acfbSmrg    rm -rf conftest.dir
1134c6a6acfbSmrg    mkdir conftest.dir
1135c6a6acfbSmrg    echo GrepMe > conftest.dir/file
1136c6a6acfbSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1137c6a6acfbSmrg    rm -rf conftest.dir
1138c6a6acfbSmrg    if test -s conftest.tar; then
1139c6a6acfbSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
1140c6a6acfbSmrg      AM_RUN_LOG([cat conftest.dir/file])
1141c6a6acfbSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1142c6a6acfbSmrg    fi
1143c6a6acfbSmrg  done
1144a9274bcdSmrg  rm -rf conftest.dir
114566fe65f6Smrg
1146c6a6acfbSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1147c6a6acfbSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1148c6a6acfbSmrg
1149a9274bcdSmrgAC_SUBST([am__tar])
1150a9274bcdSmrgAC_SUBST([am__untar])
1151a9274bcdSmrg]) # _AM_PROG_TAR
115266fe65f6Smrg
1153f931275dSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1154f931275dSmrg# 
1155f931275dSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1156f931275dSmrg#
1157f931275dSmrg# This program is free software; you can redistribute it and/or modify
1158f931275dSmrg# it under the terms of the GNU General Public License as published by
1159f931275dSmrg# the Free Software Foundation; either version 2 of the License, or
1160f931275dSmrg# (at your option) any later version.
1161f931275dSmrg#
1162f931275dSmrg# This program is distributed in the hope that it will be useful, but
1163f931275dSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1164f931275dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1165f931275dSmrg# General Public License for more details.
1166f931275dSmrg#
1167f931275dSmrg# You should have received a copy of the GNU General Public License
1168f931275dSmrg# along with this program; if not, write to the Free Software
1169f931275dSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1170f931275dSmrg#
1171f931275dSmrg# As a special exception to the GNU General Public License, if you
1172f931275dSmrg# distribute this file as part of a program that contains a
1173f931275dSmrg# configuration script generated by Autoconf, you may include it under
1174f931275dSmrg# the same distribution terms that you use for the rest of that program.
1175f931275dSmrg
1176f931275dSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1177f931275dSmrg# ----------------------------------
1178f931275dSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1179f931275dSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1180f931275dSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1181f931275dSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1182f931275dSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1183f931275dSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1184f931275dSmrgfi
1185f931275dSmrgif test -n "$PKG_CONFIG"; then
1186f931275dSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1187f931275dSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1188f931275dSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1189f931275dSmrg		AC_MSG_RESULT([yes])
1190f931275dSmrg	else
1191f931275dSmrg		AC_MSG_RESULT([no])
1192f931275dSmrg		PKG_CONFIG=""
1193f931275dSmrg	fi
1194f931275dSmrg		
1195f931275dSmrgfi[]dnl
1196f931275dSmrg])# PKG_PROG_PKG_CONFIG
1197f931275dSmrg
1198f931275dSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1199f931275dSmrg#
1200f931275dSmrg# Check to see whether a particular set of modules exists.  Similar
1201f931275dSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1202f931275dSmrg#
1203f931275dSmrg#
1204f931275dSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1205f931275dSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
1206f931275dSmrg# PKG_CHECK_EXISTS manually
1207f931275dSmrg# --------------------------------------------------------------
1208f931275dSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1209f931275dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1210f931275dSmrgif test -n "$PKG_CONFIG" && \
1211f931275dSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1212f931275dSmrg  m4_ifval([$2], [$2], [:])
1213f931275dSmrgm4_ifvaln([$3], [else
1214f931275dSmrg  $3])dnl
1215f931275dSmrgfi])
1216f931275dSmrg
1217f931275dSmrg
1218f931275dSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1219f931275dSmrg# ---------------------------------------------
1220f931275dSmrgm4_define([_PKG_CONFIG],
1221f931275dSmrg[if test -n "$$1"; then
1222f931275dSmrg    pkg_cv_[]$1="$$1"
1223f931275dSmrg elif test -n "$PKG_CONFIG"; then
1224f931275dSmrg    PKG_CHECK_EXISTS([$3],
1225f931275dSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1226f931275dSmrg		     [pkg_failed=yes])
1227f931275dSmrg else
1228f931275dSmrg    pkg_failed=untried
1229f931275dSmrgfi[]dnl
1230f931275dSmrg])# _PKG_CONFIG
1231f931275dSmrg
1232f931275dSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1233f931275dSmrg# -----------------------------
1234f931275dSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1235f931275dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1236f931275dSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1237f931275dSmrg        _pkg_short_errors_supported=yes
1238f931275dSmrgelse
1239f931275dSmrg        _pkg_short_errors_supported=no
1240f931275dSmrgfi[]dnl
1241f931275dSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1242f931275dSmrg
1243f931275dSmrg
1244f931275dSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1245f931275dSmrg# [ACTION-IF-NOT-FOUND])
1246f931275dSmrg#
1247f931275dSmrg#
1248f931275dSmrg# Note that if there is a possibility the first call to
1249f931275dSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1250f931275dSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1251f931275dSmrg#
1252f931275dSmrg#
1253f931275dSmrg# --------------------------------------------------------------
1254f931275dSmrgAC_DEFUN([PKG_CHECK_MODULES],
1255f931275dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1256f931275dSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1257f931275dSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1258f931275dSmrg
1259f931275dSmrgpkg_failed=no
1260f931275dSmrgAC_MSG_CHECKING([for $1])
1261f931275dSmrg
1262f931275dSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1263f931275dSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1264f931275dSmrg
1265f931275dSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1266f931275dSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1267f931275dSmrgSee the pkg-config man page for more details.])
1268f931275dSmrg
1269f931275dSmrgif test $pkg_failed = yes; then
1270f931275dSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1271f931275dSmrg        if test $_pkg_short_errors_supported = yes; then
1272f931275dSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1273f931275dSmrg        else 
1274f931275dSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1275f931275dSmrg        fi
1276f931275dSmrg	# Put the nasty error message in config.log where it belongs
1277f931275dSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1278f931275dSmrg
1279f931275dSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1280f931275dSmrg[Package requirements ($2) were not met:
1281f931275dSmrg
1282f931275dSmrg$$1_PKG_ERRORS
1283f931275dSmrg
1284f931275dSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1285f931275dSmrginstalled software in a non-standard prefix.
1286f931275dSmrg
1287f931275dSmrg_PKG_TEXT
1288f931275dSmrg])],
1289f931275dSmrg		[AC_MSG_RESULT([no])
1290f931275dSmrg                $4])
1291f931275dSmrgelif test $pkg_failed = untried; then
1292f931275dSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1293f931275dSmrg[The pkg-config script could not be found or is too old.  Make sure it
1294f931275dSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1295f931275dSmrgpath to pkg-config.
1296f931275dSmrg
1297f931275dSmrg_PKG_TEXT
1298f931275dSmrg
1299f931275dSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1300f931275dSmrg		[$4])
1301f931275dSmrgelse
1302f931275dSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1303f931275dSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1304f931275dSmrg        AC_MSG_RESULT([yes])
1305f931275dSmrg	ifelse([$3], , :, [$3])
1306f931275dSmrgfi[]dnl
1307f931275dSmrg])# PKG_CHECK_MODULES
1308f931275dSmrg
1309a9274bcdSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1310a9274bcdSmrgdnl
131148af84faSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1312c6a6acfbSmrgdnl
1313a9274bcdSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
131448af84faSmrgdnl copy of this software and associated documentation files (the "Software"),
131548af84faSmrgdnl to deal in the Software without restriction, including without limitation
131648af84faSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
131748af84faSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
131848af84faSmrgdnl Software is furnished to do so, subject to the following conditions:
1319a9274bcdSmrgdnl
132048af84faSmrgdnl The above copyright notice and this permission notice (including the next
132148af84faSmrgdnl paragraph) shall be included in all copies or substantial portions of the
132248af84faSmrgdnl Software.
1323a9274bcdSmrgdnl
132448af84faSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
132548af84faSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
132648af84faSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
132748af84faSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
132848af84faSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
132948af84faSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
133048af84faSmrgdnl DEALINGS IN THE SOFTWARE.
133166fe65f6Smrg
1332a9274bcdSmrg# XORG_MACROS_VERSION(required-version)
1333a9274bcdSmrg# -------------------------------------
1334a9274bcdSmrg# Minimum version: 1.1.0
1335a9274bcdSmrg#
1336a9274bcdSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1337a9274bcdSmrg# your configure.ac with the minimum required version, such as:
1338a9274bcdSmrg# XORG_MACROS_VERSION(1.1)
1339a9274bcdSmrg#
1340a9274bcdSmrg# To ensure that this macro is defined, also add:
1341a9274bcdSmrg# m4_ifndef([XORG_MACROS_VERSION],
1342a9274bcdSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1343a9274bcdSmrg#
1344a9274bcdSmrg#
1345c6a6acfbSmrg# See the "minimum version" comment for each macro you use to see what
1346a9274bcdSmrg# version you require.
1347a9274bcdSmrgm4_defun([XORG_MACROS_VERSION],[
1348c6a6acfbSmrgm4_define([vers_have], [1.19.0])
1349a9274bcdSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1350a9274bcdSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1351a9274bcdSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1352a9274bcdSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1353a9274bcdSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1354a9274bcdSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1355a9274bcdSmrgm4_undefine([vers_have])
1356a9274bcdSmrgm4_undefine([maj_have])
1357a9274bcdSmrgm4_undefine([maj_needed])
1358a9274bcdSmrg]) # XORG_MACROS_VERSION
135966fe65f6Smrg
1360a9274bcdSmrg# XORG_PROG_RAWCPP()
1361a9274bcdSmrg# ------------------
1362a9274bcdSmrg# Minimum version: 1.0.0
1363a9274bcdSmrg#
1364a9274bcdSmrg# Find cpp program and necessary flags for use in pre-processing text files
1365a9274bcdSmrg# such as man pages and config files
1366a9274bcdSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1367a9274bcdSmrgAC_REQUIRE([AC_PROG_CPP])
1368c6a6acfbSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
1369a9274bcdSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
137066fe65f6Smrg
1371a9274bcdSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1372a9274bcdSmrg# which is not the best choice for supporting other OS'es, but covers most
1373a9274bcdSmrg# of the ones we need for now.
1374a9274bcdSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1375f931275dSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1376a9274bcdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1377a9274bcdSmrg	AC_MSG_RESULT([no])
1378a9274bcdSmrgelse
1379a9274bcdSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1380a9274bcdSmrg		RAWCPPFLAGS=-undef
1381a9274bcdSmrg		AC_MSG_RESULT([yes])
1382a9274bcdSmrg	# under Cygwin unix is still defined even with -undef
1383a9274bcdSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1384a9274bcdSmrg		RAWCPPFLAGS="-undef -ansi"
1385a9274bcdSmrg		AC_MSG_RESULT([yes, with -ansi])
1386a9274bcdSmrg	else
1387a9274bcdSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1388a9274bcdSmrg	fi
1389a9274bcdSmrgfi
1390a9274bcdSmrgrm -f conftest.$ac_ext
139166fe65f6Smrg
1392a9274bcdSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1393f931275dSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1394a9274bcdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1395a9274bcdSmrg	AC_MSG_RESULT([no])
139666fe65f6Smrgelse
1397a9274bcdSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1398c6a6acfbSmrg		TRADITIONALCPPFLAGS="-traditional"
1399a9274bcdSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1400a9274bcdSmrg		AC_MSG_RESULT([yes])
1401a9274bcdSmrg	else
1402a9274bcdSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1403a9274bcdSmrg	fi
140466fe65f6Smrgfi
1405a9274bcdSmrgrm -f conftest.$ac_ext
1406a9274bcdSmrgAC_SUBST(RAWCPPFLAGS)
1407c6a6acfbSmrgAC_SUBST(TRADITIONALCPPFLAGS)
1408a9274bcdSmrg]) # XORG_PROG_RAWCPP
140966fe65f6Smrg
1410a9274bcdSmrg# XORG_MANPAGE_SECTIONS()
1411a9274bcdSmrg# -----------------------
1412a9274bcdSmrg# Minimum version: 1.0.0
141366fe65f6Smrg#
1414a9274bcdSmrg# Determine which sections man pages go in for the different man page types
1415a9274bcdSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1416a9274bcdSmrg# Not sure if there's any better way than just hardcoding by OS name.
1417a9274bcdSmrg# Override default settings by setting environment variables
141848af84faSmrg# Added MAN_SUBSTS in version 1.8
141948af84faSmrg# Added AC_PROG_SED in version 1.8
142066fe65f6Smrg
1421a9274bcdSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1422a9274bcdSmrgAC_REQUIRE([AC_CANONICAL_HOST])
142348af84faSmrgAC_REQUIRE([AC_PROG_SED])
142466fe65f6Smrg
1425a9274bcdSmrgif test x$APP_MAN_SUFFIX = x    ; then
1426a9274bcdSmrg    APP_MAN_SUFFIX=1
1427a9274bcdSmrgfi
1428a9274bcdSmrgif test x$APP_MAN_DIR = x    ; then
1429a9274bcdSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1430a9274bcdSmrgfi
143166fe65f6Smrg
1432a9274bcdSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1433a9274bcdSmrg    LIB_MAN_SUFFIX=3
1434a9274bcdSmrgfi
1435a9274bcdSmrgif test x$LIB_MAN_DIR = x    ; then
1436a9274bcdSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1437a9274bcdSmrgfi
143866fe65f6Smrg
1439a9274bcdSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1440a9274bcdSmrg    case $host_os in
1441a9274bcdSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1442a9274bcdSmrg	*)		FILE_MAN_SUFFIX=5  ;;
1443a9274bcdSmrg    esac
1444a9274bcdSmrgfi
1445a9274bcdSmrgif test x$FILE_MAN_DIR = x    ; then
1446a9274bcdSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1447a9274bcdSmrgfi
144866fe65f6Smrg
1449a9274bcdSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1450a9274bcdSmrg    case $host_os in
1451a9274bcdSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1452a9274bcdSmrg	*)		MISC_MAN_SUFFIX=7  ;;
1453a9274bcdSmrg    esac
1454a9274bcdSmrgfi
1455a9274bcdSmrgif test x$MISC_MAN_DIR = x    ; then
1456a9274bcdSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1457a9274bcdSmrgfi
145866fe65f6Smrg
1459a9274bcdSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1460a9274bcdSmrg    case $host_os in
1461a9274bcdSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1462a9274bcdSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1463a9274bcdSmrg    esac
1464a9274bcdSmrgfi
1465a9274bcdSmrgif test x$DRIVER_MAN_DIR = x    ; then
1466a9274bcdSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1467a9274bcdSmrgfi
146866fe65f6Smrg
1469a9274bcdSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1470a9274bcdSmrg    case $host_os in
1471a9274bcdSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1472a9274bcdSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1473a9274bcdSmrg    esac
1474a9274bcdSmrgfi
1475a9274bcdSmrgif test x$ADMIN_MAN_DIR = x    ; then
1476a9274bcdSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1477a9274bcdSmrgfi
147866fe65f6Smrg
147966fe65f6Smrg
1480a9274bcdSmrgAC_SUBST([APP_MAN_SUFFIX])
1481a9274bcdSmrgAC_SUBST([LIB_MAN_SUFFIX])
1482a9274bcdSmrgAC_SUBST([FILE_MAN_SUFFIX])
1483a9274bcdSmrgAC_SUBST([MISC_MAN_SUFFIX])
1484a9274bcdSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1485a9274bcdSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1486a9274bcdSmrgAC_SUBST([APP_MAN_DIR])
1487a9274bcdSmrgAC_SUBST([LIB_MAN_DIR])
1488a9274bcdSmrgAC_SUBST([FILE_MAN_DIR])
1489a9274bcdSmrgAC_SUBST([MISC_MAN_DIR])
1490a9274bcdSmrgAC_SUBST([DRIVER_MAN_DIR])
1491a9274bcdSmrgAC_SUBST([ADMIN_MAN_DIR])
149248af84faSmrg
149348af84faSmrgXORG_MAN_PAGE="X Version 11"
149448af84faSmrgAC_SUBST([XORG_MAN_PAGE])
149548af84faSmrgMAN_SUBSTS="\
149648af84faSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
149748af84faSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
149848af84faSmrg	-e 's|__xservername__|Xorg|g' \
149948af84faSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
150048af84faSmrg	-e 's|__projectroot__|\$(prefix)|g' \
150148af84faSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
150248af84faSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
150348af84faSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
150448af84faSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
150548af84faSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
150648af84faSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
150748af84faSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
150848af84faSmrgAC_SUBST([MAN_SUBSTS])
150948af84faSmrg
1510a9274bcdSmrg]) # XORG_MANPAGE_SECTIONS
1511a9274bcdSmrg
151248af84faSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
151348af84faSmrg# ------------------------
151448af84faSmrg# Minimum version: 1.7.0
151548af84faSmrg#
151648af84faSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
151748af84faSmrg# provided by xorg-sgml-doctools, if installed.
151848af84faSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
151948af84faSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
152048af84faSmrgXORG_SGML_PATH=
152148af84faSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
152248af84faSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
152348af84faSmrg    [m4_ifval([$1],[:],
152448af84faSmrg        [if test x"$cross_compiling" != x"yes" ; then
152548af84faSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
152648af84faSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
152748af84faSmrg         fi])
152848af84faSmrg    ])
152948af84faSmrg
153048af84faSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
153148af84faSmrg# the path and the name of the doc stylesheet
153248af84faSmrgif test "x$XORG_SGML_PATH" != "x" ; then
153348af84faSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
153448af84faSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
153548af84faSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
153648af84faSmrgelse
153748af84faSmrg   AC_MSG_RESULT([no])
153848af84faSmrgfi
153948af84faSmrg
154048af84faSmrgAC_SUBST(XORG_SGML_PATH)
154148af84faSmrgAC_SUBST(STYLESHEET_SRCDIR)
154248af84faSmrgAC_SUBST(XSL_STYLESHEET)
154348af84faSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
154448af84faSmrg]) # XORG_CHECK_SGML_DOCTOOLS
154548af84faSmrg
1546a9274bcdSmrg# XORG_CHECK_LINUXDOC
1547a9274bcdSmrg# -------------------
1548a9274bcdSmrg# Minimum version: 1.0.0
154966fe65f6Smrg#
1550a9274bcdSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1551a9274bcdSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1552a9274bcdSmrg# Whether or not the necessary tools and files are found can be checked
1553a9274bcdSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1554a9274bcdSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
155548af84faSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
155648af84faSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
155766fe65f6Smrg
1558a9274bcdSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
155966fe65f6Smrg
156048af84faSmrgAC_MSG_CHECKING([whether to build documentation])
156166fe65f6Smrg
156248af84faSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1563a9274bcdSmrg   BUILDDOC=yes
156466fe65f6Smrgelse
1565a9274bcdSmrg   BUILDDOC=no
156666fe65f6Smrgfi
156766fe65f6Smrg
1568a9274bcdSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1569a9274bcdSmrg
1570a9274bcdSmrgAC_MSG_RESULT([$BUILDDOC])
1571a9274bcdSmrg
157248af84faSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1573a9274bcdSmrg
157448af84faSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1575a9274bcdSmrg   BUILDPDFDOC=yes
1576a9274bcdSmrgelse
1577a9274bcdSmrg   BUILDPDFDOC=no
1578a9274bcdSmrgfi
1579a9274bcdSmrg
1580a9274bcdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1581a9274bcdSmrg
1582a9274bcdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1583a9274bcdSmrg
158448af84faSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1585a9274bcdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1586a9274bcdSmrgMAKE_PDF="$PS2PDF"
1587a9274bcdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1588a9274bcdSmrg
1589a9274bcdSmrgAC_SUBST(MAKE_TEXT)
1590a9274bcdSmrgAC_SUBST(MAKE_PS)
1591a9274bcdSmrgAC_SUBST(MAKE_PDF)
1592a9274bcdSmrgAC_SUBST(MAKE_HTML)
1593a9274bcdSmrg]) # XORG_CHECK_LINUXDOC
1594a9274bcdSmrg
1595a9274bcdSmrg# XORG_CHECK_DOCBOOK
1596a9274bcdSmrg# -------------------
1597a9274bcdSmrg# Minimum version: 1.0.0
159866fe65f6Smrg#
1599a9274bcdSmrg# Checks for the ability to build output formats from SGML DocBook source.
1600a9274bcdSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1601a9274bcdSmrg# indicates whether the necessary tools and files are found and, if set,
1602a9274bcdSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1603a9274bcdSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
160448af84faSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
160548af84faSmrg
1606a9274bcdSmrgBUILDTXTDOC=no
1607a9274bcdSmrgBUILDPDFDOC=no
1608a9274bcdSmrgBUILDPSDOC=no
1609a9274bcdSmrgBUILDHTMLDOC=no
161066fe65f6Smrg
1611a9274bcdSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1612a9274bcdSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1613a9274bcdSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1614a9274bcdSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1615a9274bcdSmrg
161648af84faSmrgAC_MSG_CHECKING([whether to build text documentation])
161748af84faSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1618a9274bcdSmrg   test x$BUILD_TXTDOC != xno; then
1619a9274bcdSmrg	BUILDTXTDOC=yes
162066fe65f6Smrgfi
1621a9274bcdSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1622a9274bcdSmrgAC_MSG_RESULT([$BUILDTXTDOC])
162366fe65f6Smrg
162448af84faSmrgAC_MSG_CHECKING([whether to build PDF documentation])
162548af84faSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1626a9274bcdSmrg   test x$BUILD_PDFDOC != xno; then
1627a9274bcdSmrg	BUILDPDFDOC=yes
1628a9274bcdSmrgfi
1629a9274bcdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1630a9274bcdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1631a9274bcdSmrg
163248af84faSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
163348af84faSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1634a9274bcdSmrg   test x$BUILD_PSDOC != xno; then
1635a9274bcdSmrg	BUILDPSDOC=yes
1636a9274bcdSmrgfi
1637a9274bcdSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1638a9274bcdSmrgAC_MSG_RESULT([$BUILDPSDOC])
1639a9274bcdSmrg
164048af84faSmrgAC_MSG_CHECKING([whether to build HTML documentation])
164148af84faSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1642a9274bcdSmrg   test x$BUILD_HTMLDOC != xno; then
1643a9274bcdSmrg	BUILDHTMLDOC=yes
1644a9274bcdSmrgfi
1645a9274bcdSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1646a9274bcdSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1647a9274bcdSmrg
1648a9274bcdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1649a9274bcdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1650a9274bcdSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1651a9274bcdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1652a9274bcdSmrg
1653a9274bcdSmrgAC_SUBST(MAKE_TEXT)
1654a9274bcdSmrgAC_SUBST(MAKE_PS)
1655a9274bcdSmrgAC_SUBST(MAKE_PDF)
1656a9274bcdSmrgAC_SUBST(MAKE_HTML)
1657a9274bcdSmrg]) # XORG_CHECK_DOCBOOK
1658a9274bcdSmrg
1659f931275dSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
166048af84faSmrg# ----------------
166148af84faSmrg# Minimum version: 1.5.0
1662f931275dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
166348af84faSmrg#
166448af84faSmrg# Documentation tools are not always available on all platforms and sometimes
166548af84faSmrg# not at the appropriate level. This macro enables a module to test for the
166648af84faSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
166748af84faSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1668f931275dSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1669f931275dSmrg# --with-xmlto assumes 'auto'.
167048af84faSmrg#
167148af84faSmrg# Interface to module:
167248af84faSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
167348af84faSmrg# XMLTO:	returns the path of the xmlto program found
167448af84faSmrg#		returns the path set by the user in the environment
167548af84faSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
167648af84faSmrg#		'no' user instructs the module not to use xmlto
167748af84faSmrg#
167848af84faSmrg# Added in version 1.10.0
167948af84faSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
168048af84faSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
168148af84faSmrg#
168248af84faSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
168348af84faSmrg#
168448af84faSmrgAC_DEFUN([XORG_WITH_XMLTO],[
168548af84faSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1686f931275dSmrgm4_define([_defopt], m4_default([$2], [auto]))
168748af84faSmrgAC_ARG_WITH(xmlto,
168848af84faSmrg	AS_HELP_STRING([--with-xmlto],
1689f931275dSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1690f931275dSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1691f931275dSmrgm4_undefine([_defopt])
169248af84faSmrg
169348af84faSmrgif test "x$use_xmlto" = x"auto"; then
169448af84faSmrg   AC_PATH_PROG([XMLTO], [xmlto])
169548af84faSmrg   if test "x$XMLTO" = "x"; then
169648af84faSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
169748af84faSmrg	have_xmlto=no
169848af84faSmrg   else
169948af84faSmrg        have_xmlto=yes
170048af84faSmrg   fi
170148af84faSmrgelif test "x$use_xmlto" = x"yes" ; then
170248af84faSmrg   AC_PATH_PROG([XMLTO], [xmlto])
170348af84faSmrg   if test "x$XMLTO" = "x"; then
170448af84faSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
170548af84faSmrg   fi
170648af84faSmrg   have_xmlto=yes
170748af84faSmrgelif test "x$use_xmlto" = x"no" ; then
170848af84faSmrg   if test "x$XMLTO" != "x"; then
170948af84faSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
171048af84faSmrg   fi
171148af84faSmrg   have_xmlto=no
171248af84faSmrgelse
171348af84faSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
171448af84faSmrgfi
171548af84faSmrg
171648af84faSmrg# Test for a minimum version of xmlto, if provided.
171748af84faSmrgm4_ifval([$1],
171848af84faSmrg[if test "$have_xmlto" = yes; then
171948af84faSmrg    # scrape the xmlto version
172048af84faSmrg    AC_MSG_CHECKING([the xmlto version])
172148af84faSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
172248af84faSmrg    AC_MSG_RESULT([$xmlto_version])
172348af84faSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
172448af84faSmrg        [if test "x$use_xmlto" = xauto; then
172548af84faSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
172648af84faSmrg            have_xmlto=no
172748af84faSmrg        else
172848af84faSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
172948af84faSmrg        fi])
173048af84faSmrgfi])
173148af84faSmrg
173248af84faSmrg# Test for the ability of xmlto to generate a text target
173348af84faSmrghave_xmlto_text=no
173448af84faSmrgcat > conftest.xml << "EOF"
173548af84faSmrgEOF
173648af84faSmrgAS_IF([test "$have_xmlto" = yes],
173748af84faSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
173848af84faSmrg             [have_xmlto_text=yes],
173948af84faSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
174048af84faSmrgrm -f conftest.xml
174148af84faSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
174248af84faSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
174348af84faSmrg]) # XORG_WITH_XMLTO
174448af84faSmrg
1745f931275dSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1746f931275dSmrg# --------------------------------------------
1747f931275dSmrg# Minimum version: 1.12.0
1748f931275dSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1749f931275dSmrg#
1750f931275dSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1751f931275dSmrg# XML-based language used for the transformation of XML documents.
1752f931275dSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1753f931275dSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1754f931275dSmrg# The XSLT processor is often used as a standalone tool for transformations.
1755f931275dSmrg# It should not be assumed that this tool is used only to work with documnetation.
1756f931275dSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1757f931275dSmrg#
1758f931275dSmrg# Interface to module:
1759f931275dSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1760f931275dSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1761f931275dSmrg#		 returns the path set by the user in the environment
1762f931275dSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1763f931275dSmrg#		  'no' user instructs the module not to use xsltproc
1764f931275dSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1765f931275dSmrg#
1766f931275dSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1767f931275dSmrg#
1768f931275dSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1769f931275dSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1770f931275dSmrg# Preserves the interface, should it be implemented later
1771f931275dSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1772f931275dSmrgm4_define([_defopt], m4_default([$2], [auto]))
1773f931275dSmrgAC_ARG_WITH(xsltproc,
1774f931275dSmrg	AS_HELP_STRING([--with-xsltproc],
1775f931275dSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1776f931275dSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1777f931275dSmrgm4_undefine([_defopt])
1778f931275dSmrg
1779f931275dSmrgif test "x$use_xsltproc" = x"auto"; then
1780f931275dSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1781f931275dSmrg   if test "x$XSLTPROC" = "x"; then
1782f931275dSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1783f931275dSmrg	have_xsltproc=no
1784f931275dSmrg   else
1785f931275dSmrg        have_xsltproc=yes
1786f931275dSmrg   fi
1787f931275dSmrgelif test "x$use_xsltproc" = x"yes" ; then
1788f931275dSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1789f931275dSmrg   if test "x$XSLTPROC" = "x"; then
1790f931275dSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1791f931275dSmrg   fi
1792f931275dSmrg   have_xsltproc=yes
1793f931275dSmrgelif test "x$use_xsltproc" = x"no" ; then
1794f931275dSmrg   if test "x$XSLTPROC" != "x"; then
1795f931275dSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1796f931275dSmrg   fi
1797f931275dSmrg   have_xsltproc=no
1798f931275dSmrgelse
1799f931275dSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1800f931275dSmrgfi
1801f931275dSmrg
1802f931275dSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1803f931275dSmrg]) # XORG_WITH_XSLTPROC
1804f931275dSmrg
1805f931275dSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1806f931275dSmrg# ----------------------------------------
1807f931275dSmrg# Minimum version: 1.15.0
1808f931275dSmrg#
1809f931275dSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1810f931275dSmrg# scanning arbitrary text files, extracting information from those text files,
1811f931275dSmrg# and printing reports based on that information.
1812f931275dSmrg#
1813f931275dSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1814f931275dSmrg#
1815f931275dSmrg# Interface to module:
1816f931275dSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1817f931275dSmrg# PERL:	     returns the path of the perl program found
1818f931275dSmrg#	     returns the path set by the user in the environment
1819f931275dSmrg# --with-perl: 'yes' user instructs the module to use perl
1820f931275dSmrg#	       'no' user instructs the module not to use perl
1821f931275dSmrg# have_perl: returns yes if perl found in PATH or no
1822f931275dSmrg#
1823f931275dSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1824f931275dSmrg#
1825f931275dSmrgAC_DEFUN([XORG_WITH_PERL],[
1826f931275dSmrgAC_ARG_VAR([PERL], [Path to perl command])
1827f931275dSmrg# Preserves the interface, should it be implemented later
1828f931275dSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1829f931275dSmrgm4_define([_defopt], m4_default([$2], [auto]))
1830f931275dSmrgAC_ARG_WITH(perl,
1831f931275dSmrg	AS_HELP_STRING([--with-perl],
1832f931275dSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1833f931275dSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1834f931275dSmrgm4_undefine([_defopt])
1835f931275dSmrg
1836f931275dSmrgif test "x$use_perl" = x"auto"; then
1837f931275dSmrg   AC_PATH_PROG([PERL], [perl])
1838f931275dSmrg   if test "x$PERL" = "x"; then
1839f931275dSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1840f931275dSmrg	have_perl=no
1841f931275dSmrg   else
1842f931275dSmrg        have_perl=yes
1843f931275dSmrg   fi
1844f931275dSmrgelif test "x$use_perl" = x"yes" ; then
1845f931275dSmrg   AC_PATH_PROG([PERL], [perl])
1846f931275dSmrg   if test "x$PERL" = "x"; then
1847f931275dSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1848f931275dSmrg   fi
1849f931275dSmrg   have_perl=yes
1850f931275dSmrgelif test "x$use_perl" = x"no" ; then
1851f931275dSmrg   if test "x$PERL" != "x"; then
1852f931275dSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1853f931275dSmrg   fi
1854f931275dSmrg   have_perl=no
1855f931275dSmrgelse
1856f931275dSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1857f931275dSmrgfi
1858f931275dSmrg
1859f931275dSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1860f931275dSmrg]) # XORG_WITH_PERL
1861f931275dSmrg
1862f931275dSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
186348af84faSmrg# ----------------
186448af84faSmrg# Minimum version: 1.5.0
1865f931275dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
186648af84faSmrg#
186748af84faSmrg# Documentation tools are not always available on all platforms and sometimes
186848af84faSmrg# not at the appropriate level. This macro enables a module to test for the
186948af84faSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
187048af84faSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1871f931275dSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1872f931275dSmrg# --with-asciidoc assumes 'auto'.
187348af84faSmrg#
187448af84faSmrg# Interface to module:
187548af84faSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
187648af84faSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
187748af84faSmrg#		 returns the path set by the user in the environment
187848af84faSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
187948af84faSmrg#		  'no' user instructs the module not to use asciidoc
188048af84faSmrg#
188148af84faSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
188248af84faSmrg#
188348af84faSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
188448af84faSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1885f931275dSmrgm4_define([_defopt], m4_default([$2], [auto]))
188648af84faSmrgAC_ARG_WITH(asciidoc,
188748af84faSmrg	AS_HELP_STRING([--with-asciidoc],
1888f931275dSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1889f931275dSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1890f931275dSmrgm4_undefine([_defopt])
189148af84faSmrg
189248af84faSmrgif test "x$use_asciidoc" = x"auto"; then
189348af84faSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
189448af84faSmrg   if test "x$ASCIIDOC" = "x"; then
189548af84faSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
189648af84faSmrg	have_asciidoc=no
189748af84faSmrg   else
189848af84faSmrg        have_asciidoc=yes
189948af84faSmrg   fi
190048af84faSmrgelif test "x$use_asciidoc" = x"yes" ; then
190148af84faSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
190248af84faSmrg   if test "x$ASCIIDOC" = "x"; then
190348af84faSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
190448af84faSmrg   fi
190548af84faSmrg   have_asciidoc=yes
190648af84faSmrgelif test "x$use_asciidoc" = x"no" ; then
190748af84faSmrg   if test "x$ASCIIDOC" != "x"; then
190848af84faSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
190948af84faSmrg   fi
191048af84faSmrg   have_asciidoc=no
191148af84faSmrgelse
191248af84faSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
191348af84faSmrgfi
191448af84faSmrgm4_ifval([$1],
191548af84faSmrg[if test "$have_asciidoc" = yes; then
191648af84faSmrg    # scrape the asciidoc version
191748af84faSmrg    AC_MSG_CHECKING([the asciidoc version])
191848af84faSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
191948af84faSmrg    AC_MSG_RESULT([$asciidoc_version])
192048af84faSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
192148af84faSmrg        [if test "x$use_asciidoc" = xauto; then
192248af84faSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
192348af84faSmrg            have_asciidoc=no
192448af84faSmrg        else
192548af84faSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
192648af84faSmrg        fi])
192748af84faSmrgfi])
192848af84faSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
192948af84faSmrg]) # XORG_WITH_ASCIIDOC
193048af84faSmrg
1931f931275dSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1932c6a6acfbSmrg# -------------------------------------------
193348af84faSmrg# Minimum version: 1.5.0
1934f931275dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1935c6a6acfbSmrg# Minimum version for optional DOT checking: 1.18.0
193648af84faSmrg#
193748af84faSmrg# Documentation tools are not always available on all platforms and sometimes
193848af84faSmrg# not at the appropriate level. This macro enables a module to test for the
193948af84faSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
194048af84faSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1941f931275dSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1942f931275dSmrg# --with-doxygen assumes 'auto'.
194348af84faSmrg#
194448af84faSmrg# Interface to module:
194548af84faSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
194648af84faSmrg# DOXYGEN:	 returns the path of the doxygen program found
194748af84faSmrg#		 returns the path set by the user in the environment
194848af84faSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
194948af84faSmrg#		  'no' user instructs the module not to use doxygen
195048af84faSmrg#
195148af84faSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
195248af84faSmrg#
195348af84faSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
195448af84faSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1955c6a6acfbSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
1956f931275dSmrgm4_define([_defopt], m4_default([$2], [auto]))
195748af84faSmrgAC_ARG_WITH(doxygen,
195848af84faSmrg	AS_HELP_STRING([--with-doxygen],
1959f931275dSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1960f931275dSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1961f931275dSmrgm4_undefine([_defopt])
196248af84faSmrg
196348af84faSmrgif test "x$use_doxygen" = x"auto"; then
196448af84faSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
196548af84faSmrg   if test "x$DOXYGEN" = "x"; then
196648af84faSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
196748af84faSmrg	have_doxygen=no
196848af84faSmrg   else
196948af84faSmrg        have_doxygen=yes
197048af84faSmrg   fi
197148af84faSmrgelif test "x$use_doxygen" = x"yes" ; then
197248af84faSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
197348af84faSmrg   if test "x$DOXYGEN" = "x"; then
197448af84faSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
197548af84faSmrg   fi
197648af84faSmrg   have_doxygen=yes
197748af84faSmrgelif test "x$use_doxygen" = x"no" ; then
197848af84faSmrg   if test "x$DOXYGEN" != "x"; then
197948af84faSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
198048af84faSmrg   fi
198148af84faSmrg   have_doxygen=no
198248af84faSmrgelse
198348af84faSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
198448af84faSmrgfi
198548af84faSmrgm4_ifval([$1],
198648af84faSmrg[if test "$have_doxygen" = yes; then
198748af84faSmrg    # scrape the doxygen version
198848af84faSmrg    AC_MSG_CHECKING([the doxygen version])
198948af84faSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
199048af84faSmrg    AC_MSG_RESULT([$doxygen_version])
199148af84faSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
199248af84faSmrg        [if test "x$use_doxygen" = xauto; then
199348af84faSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
199448af84faSmrg            have_doxygen=no
199548af84faSmrg        else
199648af84faSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
199748af84faSmrg        fi])
199848af84faSmrgfi])
1999c6a6acfbSmrg
2000c6a6acfbSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2001c6a6acfbSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2002c6a6acfbSmrgdnl 	HAVE_DOT = @HAVE_DOT@
2003c6a6acfbSmrgHAVE_DOT=no
2004c6a6acfbSmrgif test "x$have_doxygen" = "xyes"; then
2005c6a6acfbSmrg  AC_PATH_PROG([DOT], [dot])
2006c6a6acfbSmrg    if test "x$DOT" != "x"; then
2007c6a6acfbSmrg      HAVE_DOT=yes
2008c6a6acfbSmrg    fi
2009c6a6acfbSmrgfi
2010c6a6acfbSmrg
2011c6a6acfbSmrgAC_SUBST([HAVE_DOT])
2012c6a6acfbSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
201348af84faSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
201448af84faSmrg]) # XORG_WITH_DOXYGEN
201548af84faSmrg
2016f931275dSmrg# XORG_WITH_GROFF([DEFAULT])
201748af84faSmrg# ----------------
201848af84faSmrg# Minimum version: 1.6.0
2019f931275dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
202048af84faSmrg#
202148af84faSmrg# Documentation tools are not always available on all platforms and sometimes
202248af84faSmrg# not at the appropriate level. This macro enables a module to test for the
202348af84faSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
202448af84faSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2025f931275dSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2026f931275dSmrg# --with-groff assumes 'auto'.
202748af84faSmrg#
202848af84faSmrg# Interface to module:
202948af84faSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
203048af84faSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
203148af84faSmrg# HAVE_GROFF_MS: the -ms macros package
203248af84faSmrg# GROFF:	 returns the path of the groff program found
203348af84faSmrg#		 returns the path set by the user in the environment
203448af84faSmrg# --with-groff:	 'yes' user instructs the module to use groff
203548af84faSmrg#		 'no' user instructs the module not to use groff
203648af84faSmrg#
203748af84faSmrg# Added in version 1.9.0:
203848af84faSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
203948af84faSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
204048af84faSmrg#		   psselect from the psutils package.
204148af84faSmrg#		   the ghostcript package. Refer to the grohtml man pages
204248af84faSmrg#
204348af84faSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
204448af84faSmrg#
204548af84faSmrg# OS and distros often splits groff in a basic and full package, the former
204648af84faSmrg# having the groff program and the later having devices, fonts and macros
204748af84faSmrg# Checking for the groff executable is not enough.
204848af84faSmrg#
204948af84faSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
205048af84faSmrg# unset HAVE_GROFF or GROFF env variables.
205148af84faSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
205248af84faSmrg#
205348af84faSmrgAC_DEFUN([XORG_WITH_GROFF],[
205448af84faSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2055f931275dSmrgm4_define([_defopt], m4_default([$1], [auto]))
205648af84faSmrgAC_ARG_WITH(groff,
205748af84faSmrg	AS_HELP_STRING([--with-groff],
2058f931275dSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2059f931275dSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2060f931275dSmrgm4_undefine([_defopt])
206148af84faSmrg
206248af84faSmrgif test "x$use_groff" = x"auto"; then
206348af84faSmrg   AC_PATH_PROG([GROFF], [groff])
206448af84faSmrg   if test "x$GROFF" = "x"; then
206548af84faSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
206648af84faSmrg	have_groff=no
206748af84faSmrg   else
206848af84faSmrg        have_groff=yes
206948af84faSmrg   fi
207048af84faSmrgelif test "x$use_groff" = x"yes" ; then
207148af84faSmrg   AC_PATH_PROG([GROFF], [groff])
207248af84faSmrg   if test "x$GROFF" = "x"; then
207348af84faSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
207448af84faSmrg   fi
207548af84faSmrg   have_groff=yes
207648af84faSmrgelif test "x$use_groff" = x"no" ; then
207748af84faSmrg   if test "x$GROFF" != "x"; then
207848af84faSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
207948af84faSmrg   fi
208048af84faSmrg   have_groff=no
208148af84faSmrgelse
208248af84faSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
208348af84faSmrgfi
208448af84faSmrg
208548af84faSmrg# We have groff, test for the presence of the macro packages
208648af84faSmrgif test "x$have_groff" = x"yes"; then
208748af84faSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
208848af84faSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
208948af84faSmrg        groff_ms_works=yes
209048af84faSmrg    else
209148af84faSmrg        groff_ms_works=no
209248af84faSmrg    fi
209348af84faSmrg    AC_MSG_RESULT([$groff_ms_works])
209448af84faSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
209548af84faSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
209648af84faSmrg        groff_mm_works=yes
209748af84faSmrg    else
209848af84faSmrg        groff_mm_works=no
209948af84faSmrg    fi
210048af84faSmrg    AC_MSG_RESULT([$groff_mm_works])
210148af84faSmrgfi
210248af84faSmrg
210348af84faSmrg# We have groff, test for HTML dependencies, one command per package
210448af84faSmrgif test "x$have_groff" = x"yes"; then
210548af84faSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
210648af84faSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
210748af84faSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
210848af84faSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
210948af84faSmrg      have_groff_html=yes
211048af84faSmrg   else
211148af84faSmrg      have_groff_html=no
211248af84faSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
211348af84faSmrg   fi
211448af84faSmrgfi
211548af84faSmrg
211648af84faSmrg# Set Automake conditionals for Makefiles
211748af84faSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
211848af84faSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
211948af84faSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
212048af84faSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
212148af84faSmrg]) # XORG_WITH_GROFF
212248af84faSmrg
2123f931275dSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2124f931275dSmrg# ---------------------------------------
212548af84faSmrg# Minimum version: 1.6.0
2126f931275dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2127f931275dSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
212848af84faSmrg#
212948af84faSmrg# Documentation tools are not always available on all platforms and sometimes
213048af84faSmrg# not at the appropriate level. This macro enables a module to test for the
213148af84faSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
213248af84faSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2133f931275dSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2134f931275dSmrg# --with-fop assumes 'auto'.
213548af84faSmrg#
213648af84faSmrg# Interface to module:
213748af84faSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
213848af84faSmrg# FOP:	 	returns the path of the fop program found
213948af84faSmrg#		returns the path set by the user in the environment
214048af84faSmrg# --with-fop: 	'yes' user instructs the module to use fop
214148af84faSmrg#		'no' user instructs the module not to use fop
214248af84faSmrg#
214348af84faSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
214448af84faSmrg#
214548af84faSmrgAC_DEFUN([XORG_WITH_FOP],[
214648af84faSmrgAC_ARG_VAR([FOP], [Path to fop command])
2147f931275dSmrgm4_define([_defopt], m4_default([$2], [auto]))
214848af84faSmrgAC_ARG_WITH(fop,
214948af84faSmrg	AS_HELP_STRING([--with-fop],
2150f931275dSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2151f931275dSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2152f931275dSmrgm4_undefine([_defopt])
215348af84faSmrg
215448af84faSmrgif test "x$use_fop" = x"auto"; then
215548af84faSmrg   AC_PATH_PROG([FOP], [fop])
215648af84faSmrg   if test "x$FOP" = "x"; then
215748af84faSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
215848af84faSmrg	have_fop=no
215948af84faSmrg   else
216048af84faSmrg        have_fop=yes
216148af84faSmrg   fi
216248af84faSmrgelif test "x$use_fop" = x"yes" ; then
216348af84faSmrg   AC_PATH_PROG([FOP], [fop])
216448af84faSmrg   if test "x$FOP" = "x"; then
216548af84faSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
216648af84faSmrg   fi
216748af84faSmrg   have_fop=yes
216848af84faSmrgelif test "x$use_fop" = x"no" ; then
216948af84faSmrg   if test "x$FOP" != "x"; then
217048af84faSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
217148af84faSmrg   fi
217248af84faSmrg   have_fop=no
217348af84faSmrgelse
217448af84faSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
217548af84faSmrgfi
2176f931275dSmrg
2177f931275dSmrg# Test for a minimum version of fop, if provided.
2178f931275dSmrgm4_ifval([$1],
2179f931275dSmrg[if test "$have_fop" = yes; then
2180f931275dSmrg    # scrape the fop version
2181f931275dSmrg    AC_MSG_CHECKING([for fop minimum version])
2182f931275dSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2183f931275dSmrg    AC_MSG_RESULT([$fop_version])
2184f931275dSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2185f931275dSmrg        [if test "x$use_fop" = xauto; then
2186f931275dSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2187f931275dSmrg            have_fop=no
2188f931275dSmrg        else
2189f931275dSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2190f931275dSmrg        fi])
2191f931275dSmrgfi])
219248af84faSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
219348af84faSmrg]) # XORG_WITH_FOP
219448af84faSmrg
2195c6a6acfbSmrg# XORG_WITH_M4([MIN-VERSION])
2196c6a6acfbSmrg# ---------------------------
2197c6a6acfbSmrg# Minimum version: 1.19.0
2198c6a6acfbSmrg#
2199c6a6acfbSmrg# This macro attempts to locate an m4 macro processor which supports
2200c6a6acfbSmrg# -I option and is only useful for modules relying on M4 in order to
2201c6a6acfbSmrg# expand macros in source code files.
2202c6a6acfbSmrg#
2203c6a6acfbSmrg# Interface to module:
2204c6a6acfbSmrg# M4:	 	returns the path of the m4 program found
2205c6a6acfbSmrg#		returns the path set by the user in the environment
2206c6a6acfbSmrg#
2207c6a6acfbSmrgAC_DEFUN([XORG_WITH_M4], [
2208c6a6acfbSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2209c6a6acfbSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2210c6a6acfbSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2211c6a6acfbSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2212c6a6acfbSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2213c6a6acfbSmrg   [$PATH:/usr/gnu/bin])])
2214c6a6acfbSmrg
2215c6a6acfbSmrgAC_SUBST([M4], [$ac_cv_path_M4])
2216c6a6acfbSmrg]) # XORG_WITH_M4
2217c6a6acfbSmrg
2218f931275dSmrg# XORG_WITH_PS2PDF([DEFAULT])
221948af84faSmrg# ----------------
222048af84faSmrg# Minimum version: 1.6.0
2221f931275dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
222248af84faSmrg#
222348af84faSmrg# Documentation tools are not always available on all platforms and sometimes
222448af84faSmrg# not at the appropriate level. This macro enables a module to test for the
222548af84faSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
222648af84faSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2227f931275dSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2228f931275dSmrg# --with-ps2pdf assumes 'auto'.
222948af84faSmrg#
223048af84faSmrg# Interface to module:
223148af84faSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
223248af84faSmrg# PS2PDF:	returns the path of the ps2pdf program found
223348af84faSmrg#		returns the path set by the user in the environment
223448af84faSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
223548af84faSmrg#		 'no' user instructs the module not to use ps2pdf
223648af84faSmrg#
223748af84faSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
223848af84faSmrg#
223948af84faSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
224048af84faSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2241f931275dSmrgm4_define([_defopt], m4_default([$1], [auto]))
224248af84faSmrgAC_ARG_WITH(ps2pdf,
224348af84faSmrg	AS_HELP_STRING([--with-ps2pdf],
2244f931275dSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2245f931275dSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2246f931275dSmrgm4_undefine([_defopt])
224748af84faSmrg
224848af84faSmrgif test "x$use_ps2pdf" = x"auto"; then
224948af84faSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
225048af84faSmrg   if test "x$PS2PDF" = "x"; then
225148af84faSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
225248af84faSmrg	have_ps2pdf=no
225348af84faSmrg   else
225448af84faSmrg        have_ps2pdf=yes
225548af84faSmrg   fi
225648af84faSmrgelif test "x$use_ps2pdf" = x"yes" ; then
225748af84faSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
225848af84faSmrg   if test "x$PS2PDF" = "x"; then
225948af84faSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
226048af84faSmrg   fi
226148af84faSmrg   have_ps2pdf=yes
226248af84faSmrgelif test "x$use_ps2pdf" = x"no" ; then
226348af84faSmrg   if test "x$PS2PDF" != "x"; then
226448af84faSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
226548af84faSmrg   fi
226648af84faSmrg   have_ps2pdf=no
226748af84faSmrgelse
226848af84faSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
226948af84faSmrgfi
227048af84faSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
227148af84faSmrg]) # XORG_WITH_PS2PDF
227248af84faSmrg
227348af84faSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
227448af84faSmrg# ----------------
227548af84faSmrg# Minimum version: 1.6.0
227648af84faSmrg#
227748af84faSmrg# Documentation tools are not always available on all platforms and sometimes
227848af84faSmrg# not at the appropriate level. This macro enables a builder to skip all
227948af84faSmrg# documentation targets except traditional man pages.
228048af84faSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
228148af84faSmrg# maximum flexibilty in controlling documentation building.
228248af84faSmrg# Refer to:
228348af84faSmrg# XORG_WITH_XMLTO         --with-xmlto
228448af84faSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
228548af84faSmrg# XORG_WITH_DOXYGEN       --with-doxygen
228648af84faSmrg# XORG_WITH_FOP           --with-fop
228748af84faSmrg# XORG_WITH_GROFF         --with-groff
228848af84faSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
228948af84faSmrg#
229048af84faSmrg# Interface to module:
229148af84faSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
229248af84faSmrg# --enable-docs: 'yes' user instructs the module to generate docs
229348af84faSmrg#		 'no' user instructs the module not to generate docs
229448af84faSmrg# parm1:	specify the default value, yes or no.
229548af84faSmrg#
229648af84faSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2297f931275dSmrgm4_define([docs_default], m4_default([$1], [yes]))
229848af84faSmrgAC_ARG_ENABLE(docs,
229948af84faSmrg	AS_HELP_STRING([--enable-docs],
2300f931275dSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2301f931275dSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2302f931275dSmrgm4_undefine([docs_default])
230348af84faSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
230448af84faSmrgAC_MSG_CHECKING([whether to build documentation])
230548af84faSmrgAC_MSG_RESULT([$build_docs])
230648af84faSmrg]) # XORG_ENABLE_DOCS
230748af84faSmrg
230848af84faSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
230948af84faSmrg# ----------------
231048af84faSmrg# Minimum version: 1.6.0
231148af84faSmrg#
231248af84faSmrg# This macro enables a builder to skip all developer documentation.
231348af84faSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
231448af84faSmrg# maximum flexibilty in controlling documentation building.
231548af84faSmrg# Refer to:
231648af84faSmrg# XORG_WITH_XMLTO         --with-xmlto
231748af84faSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
231848af84faSmrg# XORG_WITH_DOXYGEN       --with-doxygen
231948af84faSmrg# XORG_WITH_FOP           --with-fop
232048af84faSmrg# XORG_WITH_GROFF         --with-groff
232148af84faSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
232248af84faSmrg#
232348af84faSmrg# Interface to module:
232448af84faSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
232548af84faSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
232648af84faSmrg#			'no' user instructs the module not to generate developer docs
232748af84faSmrg# parm1:		specify the default value, yes or no.
232848af84faSmrg#
232948af84faSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2330f931275dSmrgm4_define([devel_default], m4_default([$1], [yes]))
233148af84faSmrgAC_ARG_ENABLE(devel-docs,
233248af84faSmrg	AS_HELP_STRING([--enable-devel-docs],
2333f931275dSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2334f931275dSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2335f931275dSmrgm4_undefine([devel_default])
233648af84faSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
233748af84faSmrgAC_MSG_CHECKING([whether to build developer documentation])
233848af84faSmrgAC_MSG_RESULT([$build_devel_docs])
233948af84faSmrg]) # XORG_ENABLE_DEVEL_DOCS
234048af84faSmrg
234148af84faSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
234248af84faSmrg# ----------------
234348af84faSmrg# Minimum version: 1.6.0
234448af84faSmrg#
234548af84faSmrg# This macro enables a builder to skip all functional specification targets.
234648af84faSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
234748af84faSmrg# maximum flexibilty in controlling documentation building.
234848af84faSmrg# Refer to:
234948af84faSmrg# XORG_WITH_XMLTO         --with-xmlto
235048af84faSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
235148af84faSmrg# XORG_WITH_DOXYGEN       --with-doxygen
235248af84faSmrg# XORG_WITH_FOP           --with-fop
235348af84faSmrg# XORG_WITH_GROFF         --with-groff
235448af84faSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
235548af84faSmrg#
235648af84faSmrg# Interface to module:
235748af84faSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
235848af84faSmrg# --enable-specs:	'yes' user instructs the module to generate specs
235948af84faSmrg#			'no' user instructs the module not to generate specs
236048af84faSmrg# parm1:		specify the default value, yes or no.
236148af84faSmrg#
236248af84faSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2363f931275dSmrgm4_define([spec_default], m4_default([$1], [yes]))
236448af84faSmrgAC_ARG_ENABLE(specs,
236548af84faSmrg	AS_HELP_STRING([--enable-specs],
2366f931275dSmrg	   [Enable building the specs (default: ]spec_default[)]),
2367f931275dSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2368f931275dSmrgm4_undefine([spec_default])
236948af84faSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
237048af84faSmrgAC_MSG_CHECKING([whether to build functional specifications])
237148af84faSmrgAC_MSG_RESULT([$build_specs])
237248af84faSmrg]) # XORG_ENABLE_SPECS
237348af84faSmrg
2374f931275dSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2375f931275dSmrg# ----------------------------------------------
2376f931275dSmrg# Minimum version: 1.13.0
2377f931275dSmrg#
2378f931275dSmrg# This macro enables a builder to enable/disable unit testing
2379f931275dSmrg# It makes no assumption about the test cases implementation
2380f931275dSmrg# Test cases may or may not use Automake "Support for test suites"
2381f931275dSmrg# They may or may not use the software utility library GLib
2382f931275dSmrg#
2383f931275dSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2384f931275dSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2385f931275dSmrg# The variable enable_unit_tests is used by other macros in this file.
2386f931275dSmrg#
2387f931275dSmrg# Interface to module:
2388f931275dSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2389f931275dSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2390f931275dSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2391f931275dSmrg#			'no' user instructs the module not to build tests
2392f931275dSmrg# parm1:		specify the default value, yes or no.
2393f931275dSmrg#
2394f931275dSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2395f931275dSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2396f931275dSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2397f931275dSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2398f931275dSmrgm4_define([_defopt], m4_default([$1], [auto]))
2399f931275dSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2400f931275dSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2401f931275dSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2402f931275dSmrgm4_undefine([_defopt])
2403f931275dSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2404f931275dSmrgAC_MSG_CHECKING([whether to build unit test cases])
2405f931275dSmrgAC_MSG_RESULT([$enable_unit_tests])
2406f931275dSmrg]) # XORG_ENABLE_UNIT_TESTS
2407f931275dSmrg
2408c6a6acfbSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2409c6a6acfbSmrg# ------------------------------------------------------
2410c6a6acfbSmrg# Minimum version: 1.17.0
2411c6a6acfbSmrg#
2412c6a6acfbSmrg# This macro enables a builder to enable/disable integration testing
2413c6a6acfbSmrg# It makes no assumption about the test cases' implementation
2414c6a6acfbSmrg# Test cases may or may not use Automake "Support for test suites"
2415c6a6acfbSmrg#
2416c6a6acfbSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2417c6a6acfbSmrg# usually requires less dependencies and may be built and run under less
2418c6a6acfbSmrg# stringent environments than integration tests.
2419c6a6acfbSmrg#
2420c6a6acfbSmrg# Interface to module:
2421c6a6acfbSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2422c6a6acfbSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2423c6a6acfbSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2424c6a6acfbSmrg#                             'no' user instructs the module not to build tests
2425c6a6acfbSmrg# parm1:                      specify the default value, yes or no.
2426c6a6acfbSmrg#
2427c6a6acfbSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2428c6a6acfbSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2429c6a6acfbSmrgm4_define([_defopt], m4_default([$1], [auto]))
2430c6a6acfbSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2431c6a6acfbSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2432c6a6acfbSmrg	[enable_integration_tests=$enableval],
2433c6a6acfbSmrg	[enable_integration_tests=]_defopt)
2434c6a6acfbSmrgm4_undefine([_defopt])
2435c6a6acfbSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2436c6a6acfbSmrg	[test "x$enable_integration_tests" != xno])
2437c6a6acfbSmrgAC_MSG_CHECKING([whether to build unit test cases])
2438c6a6acfbSmrgAC_MSG_RESULT([$enable_integration_tests])
2439c6a6acfbSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2440c6a6acfbSmrg
2441f931275dSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2442f931275dSmrg# ----------------------------------------
2443f931275dSmrg# Minimum version: 1.13.0
2444f931275dSmrg#
2445f931275dSmrg# GLib is a library which provides advanced data structures and functions.
2446f931275dSmrg# This macro enables a module to test for the presence of Glib.
2447f931275dSmrg#
2448f931275dSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2449f931275dSmrg# Otherwise the value of $enable_unit_tests is blank.
2450f931275dSmrg#
2451c6a6acfbSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2452c6a6acfbSmrg# test support usually requires less dependencies and may be built and run under
2453c6a6acfbSmrg# less stringent environments than integration tests.
2454c6a6acfbSmrg#
2455f931275dSmrg# Interface to module:
2456f931275dSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2457f931275dSmrg# with_glib: used in configure.ac to know if GLib has been found
2458f931275dSmrg# --with-glib:	'yes' user instructs the module to use glib
2459f931275dSmrg#		'no' user instructs the module not to use glib
2460f931275dSmrg#
2461f931275dSmrgAC_DEFUN([XORG_WITH_GLIB],[
2462f931275dSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2463f931275dSmrgm4_define([_defopt], m4_default([$2], [auto]))
2464f931275dSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2465f931275dSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2466f931275dSmrg	[with_glib=$withval], [with_glib=]_defopt)
2467f931275dSmrgm4_undefine([_defopt])
2468f931275dSmrg
2469f931275dSmrghave_glib=no
2470f931275dSmrg# Do not probe GLib if user explicitly disabled unit testing
2471f931275dSmrgif test "x$enable_unit_tests" != x"no"; then
2472f931275dSmrg  # Do not probe GLib if user explicitly disabled it
2473f931275dSmrg  if test "x$with_glib" != x"no"; then
2474f931275dSmrg    m4_ifval(
2475f931275dSmrg      [$1],
2476f931275dSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2477f931275dSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2478f931275dSmrg    )
2479f931275dSmrg  fi
2480f931275dSmrgfi
2481f931275dSmrg
2482f931275dSmrg# Not having GLib when unit testing has been explicitly requested is an error
2483f931275dSmrgif test "x$enable_unit_tests" = x"yes"; then
2484f931275dSmrg  if test "x$have_glib" = x"no"; then
2485f931275dSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2486f931275dSmrg  fi
2487f931275dSmrgfi
2488f931275dSmrg
2489f931275dSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2490f931275dSmrgif test "x$enable_unit_tests" = x"no"; then
2491f931275dSmrg  if test "x$with_glib" = x"yes"; then
2492f931275dSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2493f931275dSmrg  fi
2494f931275dSmrgfi
2495f931275dSmrg
2496f931275dSmrg# Not having GLib when it has been explicitly requested is an error
2497f931275dSmrgif test "x$with_glib" = x"yes"; then
2498f931275dSmrg  if test "x$have_glib" = x"no"; then
2499f931275dSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2500f931275dSmrg  fi
2501f931275dSmrgfi
2502f931275dSmrg
2503f931275dSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2504f931275dSmrg]) # XORG_WITH_GLIB
2505f931275dSmrg
2506f931275dSmrg# XORG_LD_WRAP([required|optional])
2507f931275dSmrg# ---------------------------------
2508f931275dSmrg# Minimum version: 1.13.0
2509f931275dSmrg#
2510f931275dSmrg# Check if linker supports -wrap, passed via compiler flags
2511f931275dSmrg#
2512f931275dSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2513f931275dSmrg# Otherwise the value of $enable_unit_tests is blank.
2514f931275dSmrg#
2515f931275dSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2516f931275dSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2517f931275dSmrg# available, an argument of "optional" allows use when some unit tests require
2518f931275dSmrg# ld -wrap and others do not.
2519f931275dSmrg#
2520f931275dSmrgAC_DEFUN([XORG_LD_WRAP],[
2521f931275dSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2522f931275dSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2523f931275dSmrg                      void __wrap_exit(int status) { return; }],
2524f931275dSmrg                     [exit(0);])])
2525f931275dSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2526f931275dSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2527f931275dSmrg  if test "x$have_ld_wrap" = x"no"; then
2528f931275dSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2529f931275dSmrg  fi
2530f931275dSmrgfi
2531f931275dSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2532f931275dSmrg#
2533f931275dSmrg]) # XORG_LD_WRAP
2534f931275dSmrg
2535f931275dSmrg# XORG_CHECK_LINKER_FLAGS
2536f931275dSmrg# -----------------------
2537f931275dSmrg# SYNOPSIS
2538f931275dSmrg#
2539f931275dSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2540f931275dSmrg#
2541f931275dSmrg# DESCRIPTION
2542f931275dSmrg#
2543f931275dSmrg#   Check whether the given linker FLAGS work with the current language's
2544f931275dSmrg#   linker, or whether they give an error.
2545f931275dSmrg#
2546f931275dSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2547f931275dSmrg#   success/failure.
2548f931275dSmrg#
2549f931275dSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2550f931275dSmrg#
2551f931275dSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2552f931275dSmrg#
2553f931275dSmrg# LICENSE
2554f931275dSmrg#
2555f931275dSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2556f931275dSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2557f931275dSmrg#   Copyright (c) 2009 Matteo Frigo
2558f931275dSmrg#
2559f931275dSmrg#   This program is free software: you can redistribute it and/or modify it
2560f931275dSmrg#   under the terms of the GNU General Public License as published by the
2561f931275dSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2562f931275dSmrg#   option) any later version.
2563f931275dSmrg#
2564f931275dSmrg#   This program is distributed in the hope that it will be useful, but
2565f931275dSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2566f931275dSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2567f931275dSmrg#   Public License for more details.
2568f931275dSmrg#
2569f931275dSmrg#   You should have received a copy of the GNU General Public License along
2570f931275dSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2571f931275dSmrg#
2572f931275dSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2573f931275dSmrg#   gives unlimited permission to copy, distribute and modify the configure
2574f931275dSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2575f931275dSmrg#   need not follow the terms of the GNU General Public License when using
2576f931275dSmrg#   or distributing such scripts, even though portions of the text of the
2577f931275dSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2578f931275dSmrg#   all other use of the material that constitutes the Autoconf Macro.
2579f931275dSmrg#
2580f931275dSmrg#   This special exception to the GPL applies to versions of the Autoconf
2581f931275dSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2582f931275dSmrg#   modified version of the Autoconf Macro, you may extend this special
2583f931275dSmrg#   exception to the GPL to apply to your modified version as well.#
2584f931275dSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2585f931275dSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2586f931275dSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2587f931275dSmrgAS_LITERAL_IF([$1],
2588f931275dSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2589f931275dSmrg      ax_save_FLAGS=$LDFLAGS
2590f931275dSmrg      LDFLAGS="$1"
2591f931275dSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2592f931275dSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2593f931275dSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2594f931275dSmrg      LDFLAGS=$ax_save_FLAGS])],
2595f931275dSmrg  [ax_save_FLAGS=$LDFLAGS
2596f931275dSmrg   LDFLAGS="$1"
2597f931275dSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2598f931275dSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2599f931275dSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2600f931275dSmrg   LDFLAGS=$ax_save_FLAGS])
2601f931275dSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2602f931275dSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2603f931275dSmrgif test "x$xorg_check_linker_flags" = xyes; then
2604f931275dSmrg	m4_default([$2], :)
2605f931275dSmrgelse
2606f931275dSmrg	m4_default([$3], :)
2607f931275dSmrgfi
2608f931275dSmrg]) # XORG_CHECK_LINKER_FLAGS
2609f931275dSmrg
2610f931275dSmrg# XORG_MEMORY_CHECK_FLAGS
2611f931275dSmrg# -----------------------
2612f931275dSmrg# Minimum version: 1.16.0
2613f931275dSmrg#
2614f931275dSmrg# This macro attempts to find appropriate memory checking functionality
2615f931275dSmrg# for various platforms which unit testing code may use to catch various
2616f931275dSmrg# forms of memory allocation and access errors in testing.
2617f931275dSmrg#
2618f931275dSmrg# Interface to module:
2619f931275dSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2620f931275dSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2621f931275dSmrg#
2622f931275dSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2623f931275dSmrg#
2624f931275dSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2625f931275dSmrg
2626f931275dSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2627f931275dSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2628f931275dSmrg           [Environment variables to enable memory checking in tests])
2629f931275dSmrg
2630f931275dSmrg# Check for different types of support on different platforms
2631f931275dSmrgcase $host_os in
2632f931275dSmrg    solaris*)
2633f931275dSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2634f931275dSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2635f931275dSmrg        ;;
2636f931275dSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2637f931275dSmrg        # both directly and inverted, so should not be 0 or 255.
2638f931275dSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2639f931275dSmrg        ;;
2640f931275dSmrg    darwin*)
2641f931275dSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2642f931275dSmrg        ;;
2643f931275dSmrg    *bsd*)
2644f931275dSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2645f931275dSmrg        ;;
2646f931275dSmrgesac
2647f931275dSmrg
2648f931275dSmrg# User supplied flags override default flags
2649f931275dSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2650f931275dSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2651f931275dSmrgfi
2652f931275dSmrg
2653f931275dSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2654f931275dSmrg]) # XORG_WITH_LINT
2655f931275dSmrg
2656a9274bcdSmrg# XORG_CHECK_MALLOC_ZERO
2657a9274bcdSmrg# ----------------------
2658a9274bcdSmrg# Minimum version: 1.0.0
265989d09728Smrg#
2660a9274bcdSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2661a9274bcdSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2662a9274bcdSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2663a9274bcdSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2664a9274bcdSmrgAC_ARG_ENABLE(malloc0returnsnull,
2665a9274bcdSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2666a9274bcdSmrg		       [malloc(0) returns NULL (default: auto)]),
2667a9274bcdSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2668a9274bcdSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
266989d09728Smrg
2670a9274bcdSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2671a9274bcdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2672c6a6acfbSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2673c6a6acfbSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2674f931275dSmrg#include <stdlib.h>
2675f931275dSmrg],[
2676a9274bcdSmrg    char *m0, *r0, *c0, *p;
2677a9274bcdSmrg    m0 = malloc(0);
2678a9274bcdSmrg    p = malloc(10);
2679a9274bcdSmrg    r0 = realloc(p,0);
2680f931275dSmrg    c0 = calloc(0,10);
2681f931275dSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2682f931275dSmrg])],
2683c6a6acfbSmrg		[xorg_cv_malloc0_returns_null=yes],
2684c6a6acfbSmrg		[xorg_cv_malloc0_returns_null=no])])
2685c6a6acfbSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2686a9274bcdSmrgfi
2687a9274bcdSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
268889d09728Smrg
2689a9274bcdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2690a9274bcdSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2691a9274bcdSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2692a9274bcdSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2693a9274bcdSmrgelse
2694a9274bcdSmrg	MALLOC_ZERO_CFLAGS=""
2695a9274bcdSmrg	XMALLOC_ZERO_CFLAGS=""
2696a9274bcdSmrg	XTMALLOC_ZERO_CFLAGS=""
2697a9274bcdSmrgfi
269866fe65f6Smrg
2699a9274bcdSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2700a9274bcdSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2701a9274bcdSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2702a9274bcdSmrg]) # XORG_CHECK_MALLOC_ZERO
2703a9274bcdSmrg
2704a9274bcdSmrg# XORG_WITH_LINT()
2705a9274bcdSmrg# ----------------
2706a9274bcdSmrg# Minimum version: 1.1.0
270766fe65f6Smrg#
270848af84faSmrg# This macro enables the use of a tool that flags some suspicious and
270948af84faSmrg# non-portable constructs (likely to be bugs) in C language source code.
271048af84faSmrg# It will attempt to locate the tool and use appropriate options.
271148af84faSmrg# There are various lint type tools on different platforms.
271248af84faSmrg#
271348af84faSmrg# Interface to module:
271448af84faSmrg# LINT:		returns the path to the tool found on the platform
271548af84faSmrg#		or the value set to LINT on the configure cmd line
271648af84faSmrg#		also an Automake conditional
271748af84faSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
271848af84faSmrg#
271948af84faSmrg# --with-lint:	'yes' user instructs the module to use lint
272048af84faSmrg#		'no' user instructs the module not to use lint (default)
272148af84faSmrg#
272248af84faSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
272348af84faSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2724a9274bcdSmrg#
2725a9274bcdSmrgAC_DEFUN([XORG_WITH_LINT],[
272666fe65f6Smrg
272748af84faSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
272848af84faSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2729a9274bcdSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2730a9274bcdSmrg		[Use a lint-style source code checker (default: disabled)])],
2731a9274bcdSmrg		[use_lint=$withval], [use_lint=no])
273248af84faSmrg
273348af84faSmrg# Obtain platform specific info like program name and options
273448af84faSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
273548af84faSmrgcase $host_os in
273648af84faSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
273748af84faSmrg	lint_name=splint
273848af84faSmrg	lint_options="-badflag"
273948af84faSmrg	;;
274048af84faSmrg  *freebsd* | *netbsd*)
274148af84faSmrg	lint_name=lint
274248af84faSmrg	lint_options="-u -b"
274348af84faSmrg	;;
274448af84faSmrg  *solaris*)
274548af84faSmrg	lint_name=lint
274648af84faSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
274748af84faSmrg	;;
274848af84faSmrgesac
274948af84faSmrg
275048af84faSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
275148af84faSmrgif test "x$use_lint" = x"yes" ; then
275248af84faSmrg   AC_PATH_PROG([LINT], [$lint_name])
275348af84faSmrg   if test "x$LINT" = "x"; then
275448af84faSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
275548af84faSmrg   fi
275648af84faSmrgelif test "x$use_lint" = x"no" ; then
275748af84faSmrg   if test "x$LINT" != "x"; then
275848af84faSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
275948af84faSmrg   fi
2760a9274bcdSmrgelse
276148af84faSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2762a9274bcdSmrgfi
276348af84faSmrg
276448af84faSmrg# User supplied flags override default flags
276548af84faSmrgif test "x$LINT_FLAGS" != "x"; then
276648af84faSmrg   lint_options=$LINT_FLAGS
2767a9274bcdSmrgfi
276866fe65f6Smrg
276948af84faSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
277048af84faSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2771a9274bcdSmrg
2772a9274bcdSmrg]) # XORG_WITH_LINT
2773a9274bcdSmrg
2774a9274bcdSmrg# XORG_LINT_LIBRARY(LIBNAME)
2775a9274bcdSmrg# --------------------------
2776a9274bcdSmrg# Minimum version: 1.1.0
277766fe65f6Smrg#
2778a9274bcdSmrg# Sets up flags for building lint libraries for checking programs that call
2779a9274bcdSmrg# functions in the library.
278066fe65f6Smrg#
278148af84faSmrg# Interface to module:
278248af84faSmrg# LINTLIB		- Automake variable with the name of lint library file to make
278348af84faSmrg# MAKE_LINT_LIB		- Automake conditional
278448af84faSmrg#
278548af84faSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
278648af84faSmrg#			  - 'no' user instructs the module not to create a lint library (default)
278766fe65f6Smrg
2788a9274bcdSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2789a9274bcdSmrgAC_REQUIRE([XORG_WITH_LINT])
2790a9274bcdSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2791a9274bcdSmrg	[Create lint library (default: disabled)])],
2792a9274bcdSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
279348af84faSmrg
279448af84faSmrgif test "x$make_lint_lib" = x"yes" ; then
279548af84faSmrg   LINTLIB=llib-l$1.ln
279648af84faSmrg   if test "x$LINT" = "x"; then
279748af84faSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
279848af84faSmrg   fi
279948af84faSmrgelif test "x$make_lint_lib" != x"no" ; then
280048af84faSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2801a9274bcdSmrgfi
280248af84faSmrg
2803a9274bcdSmrgAC_SUBST(LINTLIB)
2804a9274bcdSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
280566fe65f6Smrg
2806a9274bcdSmrg]) # XORG_LINT_LIBRARY
280766fe65f6Smrg
2808f931275dSmrg# XORG_COMPILER_BRAND
2809f931275dSmrg# -------------------
2810f931275dSmrg# Minimum version: 1.14.0
2811f931275dSmrg#
2812f931275dSmrg# Checks for various brands of compilers and sets flags as appropriate:
2813f931275dSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2814c6a6acfbSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2815f931275dSmrg#   clang compiler - sets CLANGCC to "yes"
2816f931275dSmrg#   Intel compiler - sets INTELCC to "yes"
2817f931275dSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2818f931275dSmrg#
2819f931275dSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2820c6a6acfbSmrgAC_LANG_CASE(
2821c6a6acfbSmrg	[C], [
2822c6a6acfbSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2823c6a6acfbSmrg	],
2824c6a6acfbSmrg	[C++], [
2825c6a6acfbSmrg		AC_REQUIRE([AC_PROG_CXX])
2826c6a6acfbSmrg	]
2827c6a6acfbSmrg)
2828f931275dSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2829f931275dSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2830f931275dSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2831f931275dSmrg]) # XORG_COMPILER_BRAND
2832f931275dSmrg
2833f931275dSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2834f931275dSmrg# ---------------
2835f931275dSmrg# Minimum version: 1.16.0
2836f931275dSmrg#
2837f931275dSmrg# Test if the compiler works when passed the given flag as a command line argument.
2838f931275dSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2839f931275dSmrg# next flag in the list until there are no more options.
2840f931275dSmrg#
2841f931275dSmrg# Note that this does not guarantee that the compiler supports the flag as some
2842f931275dSmrg# compilers will simply ignore arguments that they do not understand, but we do
2843f931275dSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2844f931275dSmrg# -Werror=unused-command-line-argument
2845f931275dSmrg#
2846f931275dSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2847f931275dSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2848f931275dSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2849f931275dSmrg
2850c6a6acfbSmrgAC_LANG_COMPILER_REQUIRE
2851c6a6acfbSmrg
2852c6a6acfbSmrgAC_LANG_CASE(
2853c6a6acfbSmrg	[C], [
2854c6a6acfbSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2855c6a6acfbSmrg		define([PREFIX], [C])
2856c6a6acfbSmrg		define([CACHE_PREFIX], [cc])
2857c6a6acfbSmrg		define([COMPILER], [$CC])
2858c6a6acfbSmrg	],
2859c6a6acfbSmrg	[C++], [
2860c6a6acfbSmrg		define([PREFIX], [CXX])
2861c6a6acfbSmrg		define([CACHE_PREFIX], [cxx])
2862c6a6acfbSmrg		define([COMPILER], [$CXX])
2863c6a6acfbSmrg	]
2864c6a6acfbSmrg)
2865c6a6acfbSmrg
2866c6a6acfbSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2867f931275dSmrg
2868c6a6acfbSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2869c6a6acfbSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2870c6a6acfbSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2871c6a6acfbSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2872f931275dSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2873c6a6acfbSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2874c6a6acfbSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2875c6a6acfbSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2876c6a6acfbSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2877f931275dSmrgfi
2878f931275dSmrg
2879c6a6acfbSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2880c6a6acfbSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2881c6a6acfbSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2882f931275dSmrg	fi
2883c6a6acfbSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2884c6a6acfbSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2885c6a6acfbSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2886f931275dSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2887c6a6acfbSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2888c6a6acfbSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2889c6a6acfbSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2890c6a6acfbSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2891f931275dSmrgfi
2892f931275dSmrg
2893f931275dSmrgfound="no"
2894f931275dSmrgm4_foreach([flag], m4_cdr($@), [
2895f931275dSmrg	if test $found = "no" ; then
2896c6a6acfbSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
2897c6a6acfbSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2898f931275dSmrg		fi
2899f931275dSmrg
2900c6a6acfbSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
2901c6a6acfbSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2902f931275dSmrg		fi
2903f931275dSmrg
2904c6a6acfbSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2905f931275dSmrg
2906f931275dSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2907c6a6acfbSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2908c6a6acfbSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2909c6a6acfbSmrg		AC_CACHE_VAL($cacheid,
2910f931275dSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2911c6a6acfbSmrg					     [eval $cacheid=yes],
2912c6a6acfbSmrg					     [eval $cacheid=no])])
2913f931275dSmrg
2914c6a6acfbSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2915f931275dSmrg
2916c6a6acfbSmrg		eval supported=\$$cacheid
2917f931275dSmrg		AC_MSG_RESULT([$supported])
2918f931275dSmrg		if test "$supported" = "yes" ; then
2919f931275dSmrg			$1="$$1 ]flag["
2920f931275dSmrg			found="yes"
2921f931275dSmrg		fi
2922f931275dSmrg	fi
2923f931275dSmrg])
2924f931275dSmrg]) # XORG_TESTSET_CFLAG
2925f931275dSmrg
2926f931275dSmrg# XORG_COMPILER_FLAGS
2927f931275dSmrg# ---------------
2928f931275dSmrg# Minimum version: 1.16.0
2929f931275dSmrg#
2930c6a6acfbSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2931c6a6acfbSmrg# arguments supported by the selected compiler which do NOT alter the generated
2932c6a6acfbSmrg# code.  These arguments will cause the compiler to print various warnings
2933c6a6acfbSmrg# during compilation AND turn a conservative set of warnings into errors.
2934f931275dSmrg#
2935c6a6acfbSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2936c6a6acfbSmrg# future versions of util-macros as options are added to new compilers.
2937f931275dSmrg#
2938f931275dSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2939f931275dSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2940f931275dSmrg
2941f931275dSmrgAC_ARG_ENABLE(selective-werror,
2942f931275dSmrg              AS_HELP_STRING([--disable-selective-werror],
2943f931275dSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2944f931275dSmrg              [SELECTIVE_WERROR=$enableval],
2945f931275dSmrg              [SELECTIVE_WERROR=yes])
2946f931275dSmrg
2947c6a6acfbSmrgAC_LANG_CASE(
2948c6a6acfbSmrg        [C], [
2949c6a6acfbSmrg                define([PREFIX], [C])
2950c6a6acfbSmrg        ],
2951c6a6acfbSmrg        [C++], [
2952c6a6acfbSmrg                define([PREFIX], [CXX])
2953c6a6acfbSmrg        ]
2954c6a6acfbSmrg)
2955f931275dSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2956f931275dSmrgif test "x$SUNCC" = "xyes"; then
2957c6a6acfbSmrg    [BASE_]PREFIX[FLAGS]="-v"
2958f931275dSmrgelse
2959c6a6acfbSmrg    [BASE_]PREFIX[FLAGS]=""
2960f931275dSmrgfi
2961f931275dSmrg
2962f931275dSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2963c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2964c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2965c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2966c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2967c6a6acfbSmrg
2968c6a6acfbSmrgAC_LANG_CASE(
2969c6a6acfbSmrg	[C], [
2970c6a6acfbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2971c6a6acfbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2972c6a6acfbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2973c6a6acfbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2974c6a6acfbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
2975c6a6acfbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2976c6a6acfbSmrg	]
2977c6a6acfbSmrg)
2978f931275dSmrg
2979f931275dSmrg# This chunk adds additional warnings that could catch undesired effects.
2980c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2981c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2982c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2983c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2984c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2985c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2986c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2987f931275dSmrg
2988f931275dSmrg# These are currently disabled because they are noisy.  They will be enabled
2989f931275dSmrg# in the future once the codebase is sufficiently modernized to silence
2990f931275dSmrg# them.  For now, I don't want them to drown out the other warnings.
2991c6a6acfbSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2992c6a6acfbSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2993c6a6acfbSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2994f931275dSmrg
2995f931275dSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2996f931275dSmrg# when there are problems that should be fixed.
2997f931275dSmrg
2998f931275dSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2999c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3000c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3001c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3002c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3003c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3004c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3005c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3006c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3007c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3008c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3009c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3010c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3011c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3012f931275dSmrgelse
3013f931275dSmrgAC_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])
3014c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3015c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3016c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3017c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3018c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3019c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3020c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3021c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3022c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3023c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3024c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3025c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3026c6a6acfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3027c6a6acfbSmrgfi
3028c6a6acfbSmrg
3029c6a6acfbSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3030f931275dSmrg]) # XORG_COMPILER_FLAGS
3031f931275dSmrg
3032a9274bcdSmrg# XORG_CWARNFLAGS
3033a9274bcdSmrg# ---------------
3034a9274bcdSmrg# Minimum version: 1.2.0
3035f931275dSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3036a9274bcdSmrg#
3037a9274bcdSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3038a9274bcdSmrg#
3039f931275dSmrg# This function is deprecated because it defines -fno-strict-aliasing
3040f931275dSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3041f931275dSmrg# is needed, then it should be added explicitly in the module when
3042f931275dSmrg# it is updated to use BASE_CFLAGS.
3043f931275dSmrg#
3044a9274bcdSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3045f931275dSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3046f931275dSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3047c6a6acfbSmrgAC_LANG_CASE(
3048c6a6acfbSmrg	[C], [
3049c6a6acfbSmrg		CWARNFLAGS="$BASE_CFLAGS"
3050c6a6acfbSmrg		if  test "x$GCC" = xyes ; then
3051c6a6acfbSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3052c6a6acfbSmrg		fi
3053c6a6acfbSmrg		AC_SUBST(CWARNFLAGS)
3054c6a6acfbSmrg	]
3055c6a6acfbSmrg)
3056a9274bcdSmrg]) # XORG_CWARNFLAGS
3057a9274bcdSmrg
3058a9274bcdSmrg# XORG_STRICT_OPTION
3059a9274bcdSmrg# -----------------------
3060a9274bcdSmrg# Minimum version: 1.3.0
3061a9274bcdSmrg#
3062f931275dSmrg# Add configure option to enable strict compilation flags, such as treating
3063f931275dSmrg# warnings as fatal errors.
3064f931275dSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3065c6a6acfbSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3066f931275dSmrg#
3067f931275dSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3068f931275dSmrg# when strict compilation is unconditionally desired.
3069a9274bcdSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3070a9274bcdSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3071f931275dSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3072a9274bcdSmrg
3073a9274bcdSmrgAC_ARG_ENABLE(strict-compilation,
3074a9274bcdSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3075a9274bcdSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3076a9274bcdSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3077f931275dSmrg
3078c6a6acfbSmrgAC_LANG_CASE(
3079c6a6acfbSmrg        [C], [
3080c6a6acfbSmrg                define([PREFIX], [C])
3081c6a6acfbSmrg        ],
3082c6a6acfbSmrg        [C++], [
3083c6a6acfbSmrg                define([PREFIX], [CXX])
3084c6a6acfbSmrg        ]
3085c6a6acfbSmrg)
3086c6a6acfbSmrg
3087c6a6acfbSmrg[STRICT_]PREFIX[FLAGS]=""
3088c6a6acfbSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3089c6a6acfbSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3090f931275dSmrg
3091f931275dSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3092f931275dSmrg# activate it with -Werror, so we add it here explicitly.
3093c6a6acfbSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3094f931275dSmrg
3095a9274bcdSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3096c6a6acfbSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3097c6a6acfbSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3098a9274bcdSmrgfi
3099c6a6acfbSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3100c6a6acfbSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3101c6a6acfbSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3102a9274bcdSmrg]) # XORG_STRICT_OPTION
3103a9274bcdSmrg
3104a9274bcdSmrg# XORG_DEFAULT_OPTIONS
3105a9274bcdSmrg# --------------------
3106a9274bcdSmrg# Minimum version: 1.3.0
3107a9274bcdSmrg#
3108a9274bcdSmrg# Defines default options for X.Org modules.
3109a9274bcdSmrg#
3110a9274bcdSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
311148af84faSmrgAC_REQUIRE([AC_PROG_INSTALL])
3112f931275dSmrgXORG_COMPILER_FLAGS
3113a9274bcdSmrgXORG_CWARNFLAGS
3114a9274bcdSmrgXORG_STRICT_OPTION
3115a9274bcdSmrgXORG_RELEASE_VERSION
3116a9274bcdSmrgXORG_CHANGELOG
311748af84faSmrgXORG_INSTALL
3118a9274bcdSmrgXORG_MANPAGE_SECTIONS
311948af84faSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
312048af84faSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3121a9274bcdSmrg]) # XORG_DEFAULT_OPTIONS
312248af84faSmrg
312348af84faSmrg# XORG_INSTALL()
312448af84faSmrg# ----------------
312548af84faSmrg# Minimum version: 1.4.0
312648af84faSmrg#
312748af84faSmrg# Defines the variable INSTALL_CMD as the command to copy
312848af84faSmrg# INSTALL from $prefix/share/util-macros.
312948af84faSmrg#
313048af84faSmrgAC_DEFUN([XORG_INSTALL], [
313148af84faSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
313248af84faSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
313348af84faSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
313448af84faSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
313548af84faSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
313648af84faSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
313748af84faSmrgAC_SUBST([INSTALL_CMD])
313848af84faSmrg]) # XORG_INSTALL
3139a9274bcdSmrgdnl Copyright 2005 Red Hat, Inc
3140a9274bcdSmrgdnl
3141a9274bcdSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3142a9274bcdSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3143a9274bcdSmrgdnl the above copyright notice appear in all copies and that both that
3144a9274bcdSmrgdnl copyright notice and this permission notice appear in supporting
3145a9274bcdSmrgdnl documentation.
3146a9274bcdSmrgdnl
3147a9274bcdSmrgdnl The above copyright notice and this permission notice shall be included
3148a9274bcdSmrgdnl in all copies or substantial portions of the Software.
3149a9274bcdSmrgdnl
3150a9274bcdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3151a9274bcdSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3152a9274bcdSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3153a9274bcdSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3154a9274bcdSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3155a9274bcdSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3156a9274bcdSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3157a9274bcdSmrgdnl
3158a9274bcdSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3159a9274bcdSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3160a9274bcdSmrgdnl other dealings in this Software without prior written authorization
3161a9274bcdSmrgdnl from the copyright holders.
3162a9274bcdSmrgdnl
3163a9274bcdSmrg
3164a9274bcdSmrg# XORG_RELEASE_VERSION
3165a9274bcdSmrg# --------------------
316648af84faSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3167c6a6acfbSmrg
3168a9274bcdSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3169a9274bcdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3170a9274bcdSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3171a9274bcdSmrg		[Major version of this package])
3172a9274bcdSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3173a9274bcdSmrg	if test "x$PVM" = "x"; then
3174a9274bcdSmrg		PVM="0"
3175a9274bcdSmrg	fi
3176a9274bcdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3177a9274bcdSmrg		[$PVM],
3178a9274bcdSmrg		[Minor version of this package])
3179a9274bcdSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3180a9274bcdSmrg	if test "x$PVP" = "x"; then
3181a9274bcdSmrg		PVP="0"
3182a9274bcdSmrg	fi
3183a9274bcdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3184a9274bcdSmrg		[$PVP],
3185a9274bcdSmrg		[Patch version of this package])
3186a9274bcdSmrg])
3187a9274bcdSmrg
3188a9274bcdSmrg# XORG_CHANGELOG()
3189a9274bcdSmrg# ----------------
3190a9274bcdSmrg# Minimum version: 1.2.0
3191a9274bcdSmrg#
3192a9274bcdSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3193a9274bcdSmrg# ChangeLog from git.
3194a9274bcdSmrg#
3195a9274bcdSmrg#
3196a9274bcdSmrgAC_DEFUN([XORG_CHANGELOG], [
319748af84faSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
319848af84faSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
319948af84faSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3200a9274bcdSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3201a9274bcdSmrgAC_SUBST([CHANGELOG_CMD])
3202a9274bcdSmrg]) # XORG_CHANGELOG
320366fe65f6Smrg
3204