aclocal.m4 revision cbc4e2be
1cbc4e2beSmrg# generated automatically by aclocal 1.13.2 -*- Autoconf -*-
2cbc4e2beSmrg
3cbc4e2beSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4eaef79e5Smrg
5eaef79e5Smrg# This file is free software; the Free Software Foundation
6eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
7eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
8eaef79e5Smrg
9eaef79e5Smrg# This program is distributed in the hope that it will be useful,
10eaef79e5Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11eaef79e5Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12eaef79e5Smrg# PARTICULAR PURPOSE.
13eaef79e5Smrg
14cbc4e2beSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
152b32c8f7Smrgm4_ifndef([AC_AUTOCONF_VERSION],
162b32c8f7Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1795e0246bSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1895e0246bSmrg[m4_warning([this file was generated for autoconf 2.68.
192b32c8f7SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
202b32c8f7SmrgIf you have problems, you may need to regenerate the build system entirely.
21cbc4e2beSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
222b32c8f7Smrg
23cbc4e2beSmrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
24eaef79e5Smrg#
25eaef79e5Smrg# This file is free software; the Free Software Foundation
26eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
27eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
28eaef79e5Smrg
29eaef79e5Smrg# AM_AUTOMAKE_VERSION(VERSION)
30eaef79e5Smrg# ----------------------------
31eaef79e5Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32eaef79e5Smrg# generated from the m4 files accompanying Automake X.Y.
332b32c8f7Smrg# (This private macro should not be called outside this file.)
342b32c8f7SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35cbc4e2beSmrg[am__api_version='1.13'
362b32c8f7Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
372b32c8f7Smrgdnl require some minimum version.  Point them to the right macro.
38cbc4e2beSmrgm4_if([$1], [1.13.2], [],
392b32c8f7Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
402b32c8f7Smrg])
412b32c8f7Smrg
422b32c8f7Smrg# _AM_AUTOCONF_VERSION(VERSION)
432b32c8f7Smrg# -----------------------------
442b32c8f7Smrg# aclocal traces this macro to find the Autoconf version.
452b32c8f7Smrg# This is a private macro too.  Using m4_define simplifies
462b32c8f7Smrg# the logic in aclocal, which can simply ignore this definition.
472b32c8f7Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48eaef79e5Smrg
49eaef79e5Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50eaef79e5Smrg# -------------------------------
512b32c8f7Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
522b32c8f7Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53eaef79e5SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54cbc4e2beSmrg[AM_AUTOMAKE_VERSION([1.13.2])dnl
552b32c8f7Smrgm4_ifndef([AC_AUTOCONF_VERSION],
562b32c8f7Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
572b32c8f7Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58eaef79e5Smrg
59eaef79e5Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60eaef79e5Smrg
61cbc4e2beSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
62eaef79e5Smrg#
63eaef79e5Smrg# This file is free software; the Free Software Foundation
64eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
65eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
66eaef79e5Smrg
67eaef79e5Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68cbc4e2beSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69cbc4e2beSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70eaef79e5Smrg#
71eaef79e5Smrg# Of course, Automake must honor this variable whenever it calls a
72eaef79e5Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73eaef79e5Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74eaef79e5Smrg# depending on how configure is run.  This is pretty annoying, since
75eaef79e5Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76eaef79e5Smrg# source directory, any form will work fine, but in subdirectories a
77eaef79e5Smrg# relative path needs to be adjusted first.
78eaef79e5Smrg#
79eaef79e5Smrg# $ac_aux_dir/missing
80eaef79e5Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81eaef79e5Smrg# $top_srcdir/$ac_aux_dir/missing
82eaef79e5Smrg#    fails if $ac_aux_dir is absolute,
83eaef79e5Smrg#    fails when called from a subdirectory in a VPATH build with
84eaef79e5Smrg#          a relative $ac_aux_dir
85eaef79e5Smrg#
86eaef79e5Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87eaef79e5Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88cbc4e2beSmrg# harmless because $srcdir is '.', but things will broke when you
89eaef79e5Smrg# start a VPATH build or use an absolute $srcdir.
90eaef79e5Smrg#
91eaef79e5Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92eaef79e5Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93eaef79e5Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94eaef79e5Smrg# and then we would define $MISSING as
95eaef79e5Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96eaef79e5Smrg# This will work as long as MISSING is not called from configure, because
97eaef79e5Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98eaef79e5Smrg# However there are other variables, like CC, which are often used in
99eaef79e5Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100eaef79e5Smrg#
101eaef79e5Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102eaef79e5Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103eaef79e5Smrg# configured tree to be moved without reconfiguration.
104eaef79e5Smrg
105eaef79e5SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106eaef79e5Smrg[dnl Rely on autoconf to set up CDPATH properly.
107eaef79e5SmrgAC_PREREQ([2.50])dnl
108eaef79e5Smrg# expand $ac_aux_dir to an absolute path
109eaef79e5Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
110eaef79e5Smrg])
111eaef79e5Smrg
112eaef79e5Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
113eaef79e5Smrg
114cbc4e2beSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
115eaef79e5Smrg#
116eaef79e5Smrg# This file is free software; the Free Software Foundation
117eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
118eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
119eaef79e5Smrg
120eaef79e5Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
121eaef79e5Smrg# -------------------------------------
122eaef79e5Smrg# Define a conditional.
123eaef79e5SmrgAC_DEFUN([AM_CONDITIONAL],
124cbc4e2beSmrg[AC_PREREQ([2.52])dnl
125cbc4e2beSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
126cbc4e2beSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1272b32c8f7SmrgAC_SUBST([$1_TRUE])dnl
1282b32c8f7SmrgAC_SUBST([$1_FALSE])dnl
1292b32c8f7Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1302b32c8f7Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1312b32c8f7Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
132eaef79e5Smrgif $2; then
133eaef79e5Smrg  $1_TRUE=
134eaef79e5Smrg  $1_FALSE='#'
135eaef79e5Smrgelse
136eaef79e5Smrg  $1_TRUE='#'
137eaef79e5Smrg  $1_FALSE=
138eaef79e5Smrgfi
139eaef79e5SmrgAC_CONFIG_COMMANDS_PRE(
140eaef79e5Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
141eaef79e5Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
142eaef79e5SmrgUsually this means the macro was only invoked conditionally.]])
143eaef79e5Smrgfi])])
144eaef79e5Smrg
145cbc4e2beSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
146eaef79e5Smrg#
147eaef79e5Smrg# This file is free software; the Free Software Foundation
148eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
149eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
150eaef79e5Smrg
151eaef79e5Smrg
152cbc4e2beSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
153eaef79e5Smrg# written in clear, in which case automake, when reading aclocal.m4,
154eaef79e5Smrg# will think it sees a *use*, and therefore will trigger all it's
155eaef79e5Smrg# C support machinery.  Also note that it means that autoscan, seeing
156eaef79e5Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
157eaef79e5Smrg
158eaef79e5Smrg
159eaef79e5Smrg# _AM_DEPENDENCIES(NAME)
160eaef79e5Smrg# ----------------------
161eaef79e5Smrg# See how the compiler implements dependency checking.
162cbc4e2beSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
163eaef79e5Smrg# We try a few techniques and use that to set a single cache variable.
164eaef79e5Smrg#
165eaef79e5Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
166eaef79e5Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
167eaef79e5Smrg# dependency, and given that the user is not expected to run this macro,
168eaef79e5Smrg# just rely on AC_PROG_CC.
169eaef79e5SmrgAC_DEFUN([_AM_DEPENDENCIES],
170eaef79e5Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
171eaef79e5SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
172eaef79e5SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
173eaef79e5SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
174eaef79e5Smrg
175cbc4e2beSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
176cbc4e2beSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
177cbc4e2beSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
178cbc4e2beSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
179cbc4e2beSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
180cbc4e2beSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
181cbc4e2beSmrg                    [depcc="$$1"   am_compiler_list=])
182eaef79e5Smrg
183eaef79e5SmrgAC_CACHE_CHECK([dependency style of $depcc],
184eaef79e5Smrg               [am_cv_$1_dependencies_compiler_type],
185eaef79e5Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
186eaef79e5Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
187eaef79e5Smrg  # making bogus files that we don't know about and never remove.  For
188eaef79e5Smrg  # instance it was reported that on HP-UX the gcc test will end up
189cbc4e2beSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
190cbc4e2beSmrg  # in D".
191cbc4e2beSmrg  rm -rf conftest.dir
192eaef79e5Smrg  mkdir conftest.dir
193eaef79e5Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
194eaef79e5Smrg  # using a relative directory.
195eaef79e5Smrg  cp "$am_depcomp" conftest.dir
196eaef79e5Smrg  cd conftest.dir
197eaef79e5Smrg  # We will build objects and dependencies in a subdirectory because
198eaef79e5Smrg  # it helps to detect inapplicable dependency modes.  For instance
199eaef79e5Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
200eaef79e5Smrg  # side effect of compilation, but ICC will put the dependencies in
201eaef79e5Smrg  # the current directory while Tru64 will put them in the object
202eaef79e5Smrg  # directory.
203eaef79e5Smrg  mkdir sub
204eaef79e5Smrg
205eaef79e5Smrg  am_cv_$1_dependencies_compiler_type=none
206eaef79e5Smrg  if test "$am_compiler_list" = ""; then
207eaef79e5Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
208eaef79e5Smrg  fi
2092b32c8f7Smrg  am__universal=false
2102b32c8f7Smrg  m4_case([$1], [CC],
2112b32c8f7Smrg    [case " $depcc " in #(
2122b32c8f7Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2132b32c8f7Smrg     esac],
2142b32c8f7Smrg    [CXX],
2152b32c8f7Smrg    [case " $depcc " in #(
2162b32c8f7Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2172b32c8f7Smrg     esac])
2182b32c8f7Smrg
219eaef79e5Smrg  for depmode in $am_compiler_list; do
220eaef79e5Smrg    # Setup a source with many dependencies, because some compilers
221eaef79e5Smrg    # like to wrap large dependency lists on column 80 (with \), and
222eaef79e5Smrg    # we should not choose a depcomp mode which is confused by this.
223eaef79e5Smrg    #
224eaef79e5Smrg    # We need to recreate these files for each test, as the compiler may
225eaef79e5Smrg    # overwrite some of them when testing with obscure command lines.
226eaef79e5Smrg    # This happens at least with the AIX C compiler.
227eaef79e5Smrg    : > sub/conftest.c
228eaef79e5Smrg    for i in 1 2 3 4 5 6; do
229eaef79e5Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
230cbc4e2beSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
231cbc4e2beSmrg      # Solaris 10 /bin/sh.
232cbc4e2beSmrg      echo '/* dummy */' > sub/conftst$i.h
233eaef79e5Smrg    done
234eaef79e5Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
235eaef79e5Smrg
236cbc4e2beSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2372b32c8f7Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
238cbc4e2beSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
239cbc4e2beSmrg    # versions had trouble with output in subdirs.
2402b32c8f7Smrg    am__obj=sub/conftest.${OBJEXT-o}
2412b32c8f7Smrg    am__minus_obj="-o $am__obj"
242eaef79e5Smrg    case $depmode in
2432b32c8f7Smrg    gcc)
2442b32c8f7Smrg      # This depmode causes a compiler race in universal mode.
2452b32c8f7Smrg      test "$am__universal" = false || continue
2462b32c8f7Smrg      ;;
247eaef79e5Smrg    nosideeffect)
248cbc4e2beSmrg      # After this tag, mechanisms are not by side-effect, so they'll
249cbc4e2beSmrg      # only be used when explicitly requested.
250eaef79e5Smrg      if test "x$enable_dependency_tracking" = xyes; then
251eaef79e5Smrg	continue
252eaef79e5Smrg      else
253eaef79e5Smrg	break
254eaef79e5Smrg      fi
255eaef79e5Smrg      ;;
256cbc4e2beSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
257cbc4e2beSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
2582b32c8f7Smrg      # not run yet.  These depmodes are late enough in the game, and
2592b32c8f7Smrg      # so weak that their functioning should not be impacted.
2602b32c8f7Smrg      am__obj=conftest.${OBJEXT-o}
2612b32c8f7Smrg      am__minus_obj=
2622b32c8f7Smrg      ;;
263eaef79e5Smrg    none) break ;;
264eaef79e5Smrg    esac
265eaef79e5Smrg    if depmode=$depmode \
2662b32c8f7Smrg       source=sub/conftest.c object=$am__obj \
267eaef79e5Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2682b32c8f7Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
269eaef79e5Smrg         >/dev/null 2>conftest.err &&
2702b32c8f7Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
271eaef79e5Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2722b32c8f7Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
273eaef79e5Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
274eaef79e5Smrg      # icc doesn't choke on unknown options, it will just issue warnings
275eaef79e5Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
276eaef79e5Smrg      # that says an option was ignored or not supported.
277eaef79e5Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
278eaef79e5Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
279eaef79e5Smrg      # The diagnosis changed in icc 8.0:
280eaef79e5Smrg      #   icc: Command line remark: option '-MP' not supported
281eaef79e5Smrg      if (grep 'ignoring option' conftest.err ||
282eaef79e5Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
283eaef79e5Smrg        am_cv_$1_dependencies_compiler_type=$depmode
284eaef79e5Smrg        break
285eaef79e5Smrg      fi
286eaef79e5Smrg    fi
287eaef79e5Smrg  done
288eaef79e5Smrg
289eaef79e5Smrg  cd ..
290eaef79e5Smrg  rm -rf conftest.dir
291eaef79e5Smrgelse
292eaef79e5Smrg  am_cv_$1_dependencies_compiler_type=none
293eaef79e5Smrgfi
294eaef79e5Smrg])
295eaef79e5SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
296eaef79e5SmrgAM_CONDITIONAL([am__fastdep$1], [
297eaef79e5Smrg  test "x$enable_dependency_tracking" != xno \
298eaef79e5Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
299eaef79e5Smrg])
300eaef79e5Smrg
301eaef79e5Smrg
302eaef79e5Smrg# AM_SET_DEPDIR
303eaef79e5Smrg# -------------
304eaef79e5Smrg# Choose a directory name for dependency files.
305cbc4e2beSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
306eaef79e5SmrgAC_DEFUN([AM_SET_DEPDIR],
307eaef79e5Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
308eaef79e5SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
309eaef79e5Smrg])
310eaef79e5Smrg
311eaef79e5Smrg
312eaef79e5Smrg# AM_DEP_TRACK
313eaef79e5Smrg# ------------
314eaef79e5SmrgAC_DEFUN([AM_DEP_TRACK],
315cbc4e2beSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
316cbc4e2beSmrgAS_HELP_STRING(
317cbc4e2beSmrg  [--enable-dependency-tracking],
318cbc4e2beSmrg  [do not reject slow dependency extractors])
319cbc4e2beSmrgAS_HELP_STRING(
320cbc4e2beSmrg  [--disable-dependency-tracking],
321cbc4e2beSmrg  [speeds up one-time build])])
322eaef79e5Smrgif test "x$enable_dependency_tracking" != xno; then
323eaef79e5Smrg  am_depcomp="$ac_aux_dir/depcomp"
324eaef79e5Smrg  AMDEPBACKSLASH='\'
325cbc4e2beSmrg  am__nodep='_no'
326eaef79e5Smrgfi
327eaef79e5SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3282b32c8f7SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3292b32c8f7Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
330cbc4e2beSmrgAC_SUBST([am__nodep])dnl
331cbc4e2beSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
332eaef79e5Smrg])
333eaef79e5Smrg
334eaef79e5Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
335eaef79e5Smrg
336cbc4e2beSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
337eaef79e5Smrg#
338eaef79e5Smrg# This file is free software; the Free Software Foundation
339eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
340eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
341eaef79e5Smrg
342eaef79e5Smrg
343eaef79e5Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
344eaef79e5Smrg# ------------------------------
345eaef79e5SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3462b32c8f7Smrg[{
347cbc4e2beSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
3482b32c8f7Smrg  # are listed without --file.  Let's play safe and only enable the eval
3492b32c8f7Smrg  # if we detect the quoting.
3502b32c8f7Smrg  case $CONFIG_FILES in
3512b32c8f7Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
3522b32c8f7Smrg  *)   set x $CONFIG_FILES ;;
3532b32c8f7Smrg  esac
3542b32c8f7Smrg  shift
3552b32c8f7Smrg  for mf
3562b32c8f7Smrg  do
3572b32c8f7Smrg    # Strip MF so we end up with the name of the file.
3582b32c8f7Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3592b32c8f7Smrg    # Check whether this is an Automake generated Makefile or not.
360cbc4e2beSmrg    # We used to match only the files named 'Makefile.in', but
3612b32c8f7Smrg    # some people rename them; so instead we look at the file content.
3622b32c8f7Smrg    # Grep'ing the first line is not enough: some people post-process
3632b32c8f7Smrg    # each Makefile.in and add a new line on top of each file to say so.
3642b32c8f7Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
3652b32c8f7Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3662b32c8f7Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3672b32c8f7Smrg      dirpart=`AS_DIRNAME("$mf")`
3682b32c8f7Smrg    else
3692b32c8f7Smrg      continue
3702b32c8f7Smrg    fi
3712b32c8f7Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
372cbc4e2beSmrg    # from the Makefile without running 'make'.
3732b32c8f7Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3742b32c8f7Smrg    test -z "$DEPDIR" && continue
3752b32c8f7Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
376cbc4e2beSmrg    test -z "$am__include" && continue
3772b32c8f7Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3782b32c8f7Smrg    # Find all dependency output files, they are included files with
3792b32c8f7Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3802b32c8f7Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3812b32c8f7Smrg    # expansion.
3822b32c8f7Smrg    for file in `sed -n "
3832b32c8f7Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
384cbc4e2beSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
3852b32c8f7Smrg      # Make sure the directory exists.
3862b32c8f7Smrg      test -f "$dirpart/$file" && continue
3872b32c8f7Smrg      fdir=`AS_DIRNAME(["$file"])`
3882b32c8f7Smrg      AS_MKDIR_P([$dirpart/$fdir])
3892b32c8f7Smrg      # echo "creating $dirpart/$file"
3902b32c8f7Smrg      echo '# dummy' > "$dirpart/$file"
3912b32c8f7Smrg    done
392eaef79e5Smrg  done
3932b32c8f7Smrg}
394eaef79e5Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
395eaef79e5Smrg
396eaef79e5Smrg
397eaef79e5Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
398eaef79e5Smrg# -----------------------------
399eaef79e5Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
400eaef79e5Smrg#
401eaef79e5Smrg# This code is only required when automatic dependency tracking
402cbc4e2beSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
403eaef79e5Smrg# need in order to bootstrap the dependency handling code.
404eaef79e5SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
405eaef79e5Smrg[AC_CONFIG_COMMANDS([depfiles],
406eaef79e5Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
407eaef79e5Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
408eaef79e5Smrg])
409eaef79e5Smrg
410eaef79e5Smrg# Do all the work for Automake.                             -*- Autoconf -*-
411eaef79e5Smrg
412cbc4e2beSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
413eaef79e5Smrg#
414eaef79e5Smrg# This file is free software; the Free Software Foundation
415eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
416eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
417eaef79e5Smrg
418eaef79e5Smrg# This macro actually does too much.  Some checks are only needed if
419eaef79e5Smrg# your package does certain things.  But this isn't really a big deal.
420eaef79e5Smrg
421eaef79e5Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
422eaef79e5Smrg# AM_INIT_AUTOMAKE([OPTIONS])
423eaef79e5Smrg# -----------------------------------------------
424eaef79e5Smrg# The call with PACKAGE and VERSION arguments is the old style
425eaef79e5Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
426eaef79e5Smrg# and VERSION should now be passed to AC_INIT and removed from
427eaef79e5Smrg# the call to AM_INIT_AUTOMAKE.
428eaef79e5Smrg# We support both call styles for the transition.  After
429eaef79e5Smrg# the next Automake release, Autoconf can make the AC_INIT
430eaef79e5Smrg# arguments mandatory, and then we can depend on a new Autoconf
431eaef79e5Smrg# release and drop the old call support.
432eaef79e5SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
433cbc4e2beSmrg[AC_PREREQ([2.65])dnl
434eaef79e5Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
435eaef79e5Smrgdnl the ones we care about.
436eaef79e5Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
437eaef79e5SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
438eaef79e5SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4392b32c8f7Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4402b32c8f7Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4412b32c8f7Smrg  # is not polluted with repeated "-I."
4422b32c8f7Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4432b32c8f7Smrg  # test to see if srcdir already configured
4442b32c8f7Smrg  if test -f $srcdir/config.status; then
4452b32c8f7Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4462b32c8f7Smrg  fi
447eaef79e5Smrgfi
448eaef79e5Smrg
449eaef79e5Smrg# test whether we have cygpath
450eaef79e5Smrgif test -z "$CYGPATH_W"; then
451eaef79e5Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
452eaef79e5Smrg    CYGPATH_W='cygpath -w'
453eaef79e5Smrg  else
454eaef79e5Smrg    CYGPATH_W=echo
455eaef79e5Smrg  fi
456eaef79e5Smrgfi
457eaef79e5SmrgAC_SUBST([CYGPATH_W])
458eaef79e5Smrg
459eaef79e5Smrg# Define the identity of the package.
460eaef79e5Smrgdnl Distinguish between old-style and new-style calls.
461eaef79e5Smrgm4_ifval([$2],
462cbc4e2beSmrg[AC_DIAGNOSE([obsolete],
463cbc4e2beSmrg             [$0: two- and three-arguments forms are deprecated.])
464cbc4e2beSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
465eaef79e5Smrg AC_SUBST([PACKAGE], [$1])dnl
466eaef79e5Smrg AC_SUBST([VERSION], [$2])],
467eaef79e5Smrg[_AM_SET_OPTIONS([$1])dnl
4682b32c8f7Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
469cbc4e2beSmrgm4_if(
470cbc4e2beSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
471cbc4e2beSmrg  [ok:ok],,
4722b32c8f7Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
473eaef79e5Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
474eaef79e5Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
475eaef79e5Smrg
476eaef79e5Smrg_AM_IF_OPTION([no-define],,
477cbc4e2beSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
478cbc4e2beSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
479eaef79e5Smrg
480eaef79e5Smrg# Some tools Automake needs.
481eaef79e5SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
482eaef79e5SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
483cbc4e2beSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
484cbc4e2beSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
485cbc4e2beSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
486cbc4e2beSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
487cbc4e2beSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4882b32c8f7SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4892b32c8f7SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
490cbc4e2beSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
491cbc4e2beSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
492cbc4e2beSmrg# dies out for good.  For more background, see:
493cbc4e2beSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
494cbc4e2beSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
495cbc4e2beSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
496eaef79e5Smrg# We need awk for the "check" target.  The system "awk" is bad on
497eaef79e5Smrg# some platforms.
498eaef79e5SmrgAC_REQUIRE([AC_PROG_AWK])dnl
499eaef79e5SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
500eaef79e5SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
501eaef79e5Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5022b32c8f7Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5032b32c8f7Smrg			     [_AM_PROG_TAR([v7])])])
504eaef79e5Smrg_AM_IF_OPTION([no-dependencies],,
505eaef79e5Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
506cbc4e2beSmrg		  [_AM_DEPENDENCIES([CC])],
507cbc4e2beSmrg		  [m4_define([AC_PROG_CC],
508cbc4e2beSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
509eaef79e5SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
510cbc4e2beSmrg		  [_AM_DEPENDENCIES([CXX])],
511cbc4e2beSmrg		  [m4_define([AC_PROG_CXX],
512cbc4e2beSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5132b32c8f7SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
514cbc4e2beSmrg		  [_AM_DEPENDENCIES([OBJC])],
515cbc4e2beSmrg		  [m4_define([AC_PROG_OBJC],
516cbc4e2beSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
517cbc4e2beSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
518cbc4e2beSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
519cbc4e2beSmrg		  [m4_define([AC_PROG_OBJCXX],
520cbc4e2beSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
521eaef79e5Smrg])
522cbc4e2beSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
523cbc4e2beSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
524cbc4e2beSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
525cbc4e2beSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5262b32c8f7SmrgAC_CONFIG_COMMANDS_PRE(dnl
5272b32c8f7Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5282b32c8f7Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
529eaef79e5Smrg])
530eaef79e5Smrg
531cbc4e2beSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5322b32c8f7Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5332b32c8f7Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5342b32c8f7Smrgm4_define([_AC_COMPILER_EXEEXT],
5352b32c8f7Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5362b32c8f7Smrg
537eaef79e5Smrg
538eaef79e5Smrg# When config.status generates a header, we must update the stamp-h file.
539eaef79e5Smrg# This file resides in the same directory as the config header
540eaef79e5Smrg# that is generated.  The stamp files are numbered to have different names.
541eaef79e5Smrg
542eaef79e5Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
543eaef79e5Smrg# loop where config.status creates the headers, so we can generate
544eaef79e5Smrg# our stamp files there.
545eaef79e5SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
546eaef79e5Smrg[# Compute $1's index in $config_headers.
5472b32c8f7Smrg_am_arg=$1
548eaef79e5Smrg_am_stamp_count=1
549eaef79e5Smrgfor _am_header in $config_headers :; do
550eaef79e5Smrg  case $_am_header in
5512b32c8f7Smrg    $_am_arg | $_am_arg:* )
552eaef79e5Smrg      break ;;
553eaef79e5Smrg    * )
554eaef79e5Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
555eaef79e5Smrg  esac
556eaef79e5Smrgdone
5572b32c8f7Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
558eaef79e5Smrg
559cbc4e2beSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
560eaef79e5Smrg#
561eaef79e5Smrg# This file is free software; the Free Software Foundation
562eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
563eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
564eaef79e5Smrg
565eaef79e5Smrg# AM_PROG_INSTALL_SH
566eaef79e5Smrg# ------------------
567eaef79e5Smrg# Define $install_sh.
568eaef79e5SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
569eaef79e5Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5702b32c8f7Smrgif test x"${install_sh}" != xset; then
5712b32c8f7Smrg  case $am_aux_dir in
5722b32c8f7Smrg  *\ * | *\	*)
5732b32c8f7Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5742b32c8f7Smrg  *)
5752b32c8f7Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5762b32c8f7Smrg  esac
5772b32c8f7Smrgfi
578cbc4e2beSmrgAC_SUBST([install_sh])])
579eaef79e5Smrg
580cbc4e2beSmrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
581eaef79e5Smrg#
582eaef79e5Smrg# This file is free software; the Free Software Foundation
583eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
584eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
585eaef79e5Smrg
586eaef79e5Smrg# Check whether the underlying file-system supports filenames
587eaef79e5Smrg# with a leading dot.  For instance MS-DOS doesn't.
588eaef79e5SmrgAC_DEFUN([AM_SET_LEADING_DOT],
589eaef79e5Smrg[rm -rf .tst 2>/dev/null
590eaef79e5Smrgmkdir .tst 2>/dev/null
591eaef79e5Smrgif test -d .tst; then
592eaef79e5Smrg  am__leading_dot=.
593eaef79e5Smrgelse
594eaef79e5Smrg  am__leading_dot=_
595eaef79e5Smrgfi
596eaef79e5Smrgrmdir .tst 2>/dev/null
597eaef79e5SmrgAC_SUBST([am__leading_dot])])
598eaef79e5Smrg
599eaef79e5Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
600eaef79e5Smrg# From Jim Meyering
601eaef79e5Smrg
602cbc4e2beSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
603eaef79e5Smrg#
604eaef79e5Smrg# This file is free software; the Free Software Foundation
605eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
606eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
607eaef79e5Smrg
6082b32c8f7Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6092b32c8f7Smrg# ----------------------------------
6102b32c8f7Smrg# Control maintainer-specific portions of Makefiles.
611cbc4e2beSmrg# Default is to disable them, unless 'enable' is passed literally.
612cbc4e2beSmrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
6132b32c8f7Smrg# can override the default with the --enable/--disable switch.
614eaef79e5SmrgAC_DEFUN([AM_MAINTAINER_MODE],
6152b32c8f7Smrg[m4_case(m4_default([$1], [disable]),
6162b32c8f7Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
6172b32c8f7Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
6182b32c8f7Smrg       [m4_define([am_maintainer_other], [enable])
6192b32c8f7Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
620cbc4e2beSmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
6212b32c8f7Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6222b32c8f7Smrg  AC_ARG_ENABLE([maintainer-mode],
623cbc4e2beSmrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
624cbc4e2beSmrg      am_maintainer_other[ make rules and dependencies not useful
625cbc4e2beSmrg      (and sometimes confusing) to the casual installer])],
626cbc4e2beSmrg    [USE_MAINTAINER_MODE=$enableval],
627cbc4e2beSmrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
628eaef79e5Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6292b32c8f7Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
630eaef79e5Smrg  MAINT=$MAINTAINER_MODE_TRUE
6312b32c8f7Smrg  AC_SUBST([MAINT])dnl
632eaef79e5Smrg]
633eaef79e5Smrg)
634eaef79e5Smrg
635eaef79e5Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
636eaef79e5Smrg
637cbc4e2beSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
638eaef79e5Smrg#
639eaef79e5Smrg# This file is free software; the Free Software Foundation
640eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
641eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
642eaef79e5Smrg
643eaef79e5Smrg# AM_MAKE_INCLUDE()
644eaef79e5Smrg# -----------------
645eaef79e5Smrg# Check to see how make treats includes.
646eaef79e5SmrgAC_DEFUN([AM_MAKE_INCLUDE],
647eaef79e5Smrg[am_make=${MAKE-make}
648eaef79e5Smrgcat > confinc << 'END'
649eaef79e5Smrgam__doit:
6502b32c8f7Smrg	@echo this is the am__doit target
651eaef79e5Smrg.PHONY: am__doit
652eaef79e5SmrgEND
653eaef79e5Smrg# If we don't find an include directive, just comment out the code.
654eaef79e5SmrgAC_MSG_CHECKING([for style of include used by $am_make])
655eaef79e5Smrgam__include="#"
656eaef79e5Smrgam__quote=
657eaef79e5Smrg_am_result=none
658eaef79e5Smrg# First try GNU make style include.
659eaef79e5Smrgecho "include confinc" > confmf
660cbc4e2beSmrg# Ignore all kinds of additional output from 'make'.
6612b32c8f7Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
6622b32c8f7Smrg*the\ am__doit\ target*)
6632b32c8f7Smrg  am__include=include
6642b32c8f7Smrg  am__quote=
6652b32c8f7Smrg  _am_result=GNU
6662b32c8f7Smrg  ;;
6672b32c8f7Smrgesac
668eaef79e5Smrg# Now try BSD make style include.
669eaef79e5Smrgif test "$am__include" = "#"; then
670eaef79e5Smrg   echo '.include "confinc"' > confmf
6712b32c8f7Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
6722b32c8f7Smrg   *the\ am__doit\ target*)
6732b32c8f7Smrg     am__include=.include
6742b32c8f7Smrg     am__quote="\""
6752b32c8f7Smrg     _am_result=BSD
6762b32c8f7Smrg     ;;
6772b32c8f7Smrg   esac
678eaef79e5Smrgfi
679eaef79e5SmrgAC_SUBST([am__include])
680eaef79e5SmrgAC_SUBST([am__quote])
681eaef79e5SmrgAC_MSG_RESULT([$_am_result])
682eaef79e5Smrgrm -f confinc confmf
683eaef79e5Smrg])
684eaef79e5Smrg
685cbc4e2beSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
6862b32c8f7Smrg#
6872b32c8f7Smrg# This file is free software; the Free Software Foundation
6882b32c8f7Smrg# gives unlimited permission to copy and/or distribute it,
6892b32c8f7Smrg# with or without modifications, as long as this notice is preserved.
6902b32c8f7Smrg
6912b32c8f7Smrg# AM_PROG_CC_C_O
6922b32c8f7Smrg# --------------
6932b32c8f7Smrg# Like AC_PROG_CC_C_O, but changed for automake.
6942b32c8f7SmrgAC_DEFUN([AM_PROG_CC_C_O],
6952b32c8f7Smrg[AC_REQUIRE([AC_PROG_CC_C_O])dnl
6962b32c8f7SmrgAC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6972b32c8f7SmrgAC_REQUIRE_AUX_FILE([compile])dnl
6982b32c8f7Smrg# FIXME: we rely on the cache variable name because
6992b32c8f7Smrg# there is no other way.
7002b32c8f7Smrgset dummy $CC
7012b32c8f7Smrgam_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
7022b32c8f7Smrgeval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
7032b32c8f7Smrgif test "$am_t" != yes; then
7042b32c8f7Smrg   # Losing compiler, so override with the script.
7052b32c8f7Smrg   # FIXME: It is wrong to rewrite CC.
7062b32c8f7Smrg   # But if we don't then we get into trouble of one sort or another.
7072b32c8f7Smrg   # A longer-term fix would be to have automake use am__CC in this case,
7082b32c8f7Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
7092b32c8f7Smrg   CC="$am_aux_dir/compile $CC"
7102b32c8f7Smrgfi
7112b32c8f7Smrgdnl Make sure AC_PROG_CC is never called again, or it will override our
7122b32c8f7Smrgdnl setting of CC.
7132b32c8f7Smrgm4_define([AC_PROG_CC],
7142b32c8f7Smrg          [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
7152b32c8f7Smrg])
7162b32c8f7Smrg
717eaef79e5Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
718eaef79e5Smrg
719cbc4e2beSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
720eaef79e5Smrg#
721eaef79e5Smrg# This file is free software; the Free Software Foundation
722eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
723eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
724eaef79e5Smrg
725eaef79e5Smrg# AM_MISSING_PROG(NAME, PROGRAM)
726eaef79e5Smrg# ------------------------------
727eaef79e5SmrgAC_DEFUN([AM_MISSING_PROG],
728eaef79e5Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
729eaef79e5Smrg$1=${$1-"${am_missing_run}$2"}
730eaef79e5SmrgAC_SUBST($1)])
731eaef79e5Smrg
732eaef79e5Smrg# AM_MISSING_HAS_RUN
733eaef79e5Smrg# ------------------
734cbc4e2beSmrg# Define MISSING if not defined so far and test if it is modern enough.
735cbc4e2beSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
736eaef79e5SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
737eaef79e5Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7382b32c8f7SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7392b32c8f7Smrgif test x"${MISSING+set}" != xset; then
7402b32c8f7Smrg  case $am_aux_dir in
7412b32c8f7Smrg  *\ * | *\	*)
7422b32c8f7Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7432b32c8f7Smrg  *)
7442b32c8f7Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7452b32c8f7Smrg  esac
7462b32c8f7Smrgfi
747eaef79e5Smrg# Use eval to expand $SHELL
748cbc4e2beSmrgif eval "$MISSING --is-lightweight"; then
749cbc4e2beSmrg  am_missing_run="$MISSING "
750eaef79e5Smrgelse
751eaef79e5Smrg  am_missing_run=
752cbc4e2beSmrg  AC_MSG_WARN(['missing' script is too old or missing])
753eaef79e5Smrgfi
754eaef79e5Smrg])
755eaef79e5Smrg
756eaef79e5Smrg# Helper functions for option handling.                     -*- Autoconf -*-
757eaef79e5Smrg
758cbc4e2beSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
759eaef79e5Smrg#
760eaef79e5Smrg# This file is free software; the Free Software Foundation
761eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
762eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
763eaef79e5Smrg
764eaef79e5Smrg# _AM_MANGLE_OPTION(NAME)
765eaef79e5Smrg# -----------------------
766eaef79e5SmrgAC_DEFUN([_AM_MANGLE_OPTION],
767eaef79e5Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
768eaef79e5Smrg
769eaef79e5Smrg# _AM_SET_OPTION(NAME)
770cbc4e2beSmrg# --------------------
771eaef79e5Smrg# Set option NAME.  Presently that only means defining a flag for this option.
772eaef79e5SmrgAC_DEFUN([_AM_SET_OPTION],
773cbc4e2beSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
774eaef79e5Smrg
775eaef79e5Smrg# _AM_SET_OPTIONS(OPTIONS)
776cbc4e2beSmrg# ------------------------
777eaef79e5Smrg# OPTIONS is a space-separated list of Automake options.
778eaef79e5SmrgAC_DEFUN([_AM_SET_OPTIONS],
7792b32c8f7Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
780eaef79e5Smrg
781eaef79e5Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
782eaef79e5Smrg# -------------------------------------------
783eaef79e5Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
784eaef79e5SmrgAC_DEFUN([_AM_IF_OPTION],
785eaef79e5Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
786eaef79e5Smrg
787eaef79e5Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
788eaef79e5Smrg
789cbc4e2beSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
790eaef79e5Smrg#
791eaef79e5Smrg# This file is free software; the Free Software Foundation
792eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
793eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
794eaef79e5Smrg
795eaef79e5Smrg# AM_SANITY_CHECK
796eaef79e5Smrg# ---------------
797eaef79e5SmrgAC_DEFUN([AM_SANITY_CHECK],
798eaef79e5Smrg[AC_MSG_CHECKING([whether build environment is sane])
7992b32c8f7Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8002b32c8f7Smrg# name.  Accept space and tab only in the latter.
8012b32c8f7Smrgam_lf='
8022b32c8f7Smrg'
8032b32c8f7Smrgcase `pwd` in
8042b32c8f7Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8052b32c8f7Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8062b32c8f7Smrgesac
8072b32c8f7Smrgcase $srcdir in
8082b32c8f7Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
809cbc4e2beSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8102b32c8f7Smrgesac
8112b32c8f7Smrg
812cbc4e2beSmrg# Do 'set' in a subshell so we don't clobber the current shell's
813eaef79e5Smrg# arguments.  Must try -L first in case configure is actually a
814eaef79e5Smrg# symlink; some systems play weird games with the mod time of symlinks
815eaef79e5Smrg# (eg FreeBSD returns the mod time of the symlink's containing
816eaef79e5Smrg# directory).
817eaef79e5Smrgif (
818cbc4e2beSmrg   am_has_slept=no
819cbc4e2beSmrg   for am_try in 1 2; do
820cbc4e2beSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
821cbc4e2beSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
822cbc4e2beSmrg     if test "$[*]" = "X"; then
823cbc4e2beSmrg	# -L didn't work.
824cbc4e2beSmrg	set X `ls -t "$srcdir/configure" conftest.file`
825cbc4e2beSmrg     fi
826cbc4e2beSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
827cbc4e2beSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
828cbc4e2beSmrg
829cbc4e2beSmrg	# If neither matched, then we have a broken ls.  This can happen
830cbc4e2beSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
831cbc4e2beSmrg	# broken ls alias from the environment.  This has actually
832cbc4e2beSmrg	# happened.  Such a system could not be considered "sane".
833cbc4e2beSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
834cbc4e2beSmrg  alias in your environment])
835cbc4e2beSmrg     fi
836cbc4e2beSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
837cbc4e2beSmrg       break
838cbc4e2beSmrg     fi
839cbc4e2beSmrg     # Just in case.
840cbc4e2beSmrg     sleep 1
841cbc4e2beSmrg     am_has_slept=yes
842cbc4e2beSmrg   done
843eaef79e5Smrg   test "$[2]" = conftest.file
844eaef79e5Smrg   )
845eaef79e5Smrgthen
846eaef79e5Smrg   # Ok.
847eaef79e5Smrg   :
848eaef79e5Smrgelse
849eaef79e5Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
850eaef79e5SmrgCheck your system clock])
851eaef79e5Smrgfi
852cbc4e2beSmrgAC_MSG_RESULT([yes])
853cbc4e2beSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
854cbc4e2beSmrg# generated files are strictly newer.
855cbc4e2beSmrgam_sleep_pid=
856cbc4e2beSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
857cbc4e2beSmrg  ( sleep 1 ) &
858cbc4e2beSmrg  am_sleep_pid=$!
859cbc4e2beSmrgfi
860cbc4e2beSmrgAC_CONFIG_COMMANDS_PRE(
861cbc4e2beSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
862cbc4e2beSmrg   if test -n "$am_sleep_pid"; then
863cbc4e2beSmrg     # Hide warnings about reused PIDs.
864cbc4e2beSmrg     wait $am_sleep_pid 2>/dev/null
865cbc4e2beSmrg   fi
866cbc4e2beSmrg   AC_MSG_RESULT([done])])
867cbc4e2beSmrgrm -f conftest.file
868cbc4e2beSmrg])
869eaef79e5Smrg
870cbc4e2beSmrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
8712b32c8f7Smrg#
8722b32c8f7Smrg# This file is free software; the Free Software Foundation
8732b32c8f7Smrg# gives unlimited permission to copy and/or distribute it,
8742b32c8f7Smrg# with or without modifications, as long as this notice is preserved.
8752b32c8f7Smrg
8762b32c8f7Smrg# AM_SILENT_RULES([DEFAULT])
8772b32c8f7Smrg# --------------------------
8782b32c8f7Smrg# Enable less verbose build rules; with the default set to DEFAULT
879cbc4e2beSmrg# ("yes" being less verbose, "no" or empty being verbose).
8802b32c8f7SmrgAC_DEFUN([AM_SILENT_RULES],
881cbc4e2beSmrg[AC_ARG_ENABLE([silent-rules], [dnl
882cbc4e2beSmrgAS_HELP_STRING(
883cbc4e2beSmrg  [--enable-silent-rules],
884cbc4e2beSmrg  [less verbose build output (undo: "make V=1")])
885cbc4e2beSmrgAS_HELP_STRING(
886cbc4e2beSmrg  [--disable-silent-rules],
887cbc4e2beSmrg  [verbose build output (undo: "make V=0")])dnl
888cbc4e2beSmrg])
889cbc4e2beSmrgcase $enable_silent_rules in @%:@ (((
890cbc4e2beSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
891cbc4e2beSmrg   no) AM_DEFAULT_VERBOSITY=1;;
892cbc4e2beSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
8932b32c8f7Smrgesac
894cbc4e2beSmrgdnl
895cbc4e2beSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
896cbc4e2beSmrgdnl do not support nested variable expansions.
897cbc4e2beSmrgdnl See automake bug#9928 and bug#10237.
898cbc4e2beSmrgam_make=${MAKE-make}
899cbc4e2beSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
900cbc4e2beSmrg   [am_cv_make_support_nested_variables],
901cbc4e2beSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
902cbc4e2beSmrgBAR0=false
903cbc4e2beSmrgBAR1=true
904cbc4e2beSmrgV=1
905cbc4e2beSmrgam__doit:
906cbc4e2beSmrg	@$(TRUE)
907cbc4e2beSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
908cbc4e2beSmrg  am_cv_make_support_nested_variables=yes
909cbc4e2beSmrgelse
910cbc4e2beSmrg  am_cv_make_support_nested_variables=no
911cbc4e2beSmrgfi])
912cbc4e2beSmrgif test $am_cv_make_support_nested_variables = yes; then
913cbc4e2beSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
914cbc4e2beSmrg  AM_V='$(V)'
915cbc4e2beSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
916cbc4e2beSmrgelse
917cbc4e2beSmrg  AM_V=$AM_DEFAULT_VERBOSITY
918cbc4e2beSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
919cbc4e2beSmrgfi
920cbc4e2beSmrgAC_SUBST([AM_V])dnl
921cbc4e2beSmrgAM_SUBST_NOTMAKE([AM_V])dnl
922cbc4e2beSmrgAC_SUBST([AM_DEFAULT_V])dnl
923cbc4e2beSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9242b32c8f7SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9252b32c8f7SmrgAM_BACKSLASH='\'
9262b32c8f7SmrgAC_SUBST([AM_BACKSLASH])dnl
9272b32c8f7Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9282b32c8f7Smrg])
9292b32c8f7Smrg
930cbc4e2beSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
931eaef79e5Smrg#
932eaef79e5Smrg# This file is free software; the Free Software Foundation
933eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
934eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
935eaef79e5Smrg
936eaef79e5Smrg# AM_PROG_INSTALL_STRIP
937eaef79e5Smrg# ---------------------
938cbc4e2beSmrg# One issue with vendor 'install' (even GNU) is that you can't
939eaef79e5Smrg# specify the program used to strip binaries.  This is especially
940eaef79e5Smrg# annoying in cross-compiling environments, where the build's strip
941eaef79e5Smrg# is unlikely to handle the host's binaries.
942eaef79e5Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
943cbc4e2beSmrg# always use install-sh in "make install-strip", and initialize
944eaef79e5Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
945eaef79e5SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
946eaef79e5Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
947cbc4e2beSmrg# Installed binaries are usually stripped using 'strip' when the user
948cbc4e2beSmrg# run "make install-strip".  However 'strip' might not be the right
949eaef79e5Smrg# tool to use in cross-compilation environments, therefore Automake
950cbc4e2beSmrg# will honor the 'STRIP' environment variable to overrule this program.
951cbc4e2beSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
952eaef79e5Smrgif test "$cross_compiling" != no; then
953eaef79e5Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
954eaef79e5Smrgfi
9552b32c8f7SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
956eaef79e5SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
957eaef79e5Smrg
958cbc4e2beSmrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
9592b32c8f7Smrg#
9602b32c8f7Smrg# This file is free software; the Free Software Foundation
9612b32c8f7Smrg# gives unlimited permission to copy and/or distribute it,
9622b32c8f7Smrg# with or without modifications, as long as this notice is preserved.
9632b32c8f7Smrg
9642b32c8f7Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
9652b32c8f7Smrg# ---------------------------
9662b32c8f7Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
9672b32c8f7Smrg# This macro is traced by Automake.
9682b32c8f7SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
9692b32c8f7Smrg
9702b32c8f7Smrg# AM_SUBST_NOTMAKE(VARIABLE)
971cbc4e2beSmrg# --------------------------
9722b32c8f7Smrg# Public sister of _AM_SUBST_NOTMAKE.
9732b32c8f7SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
9742b32c8f7Smrg
975eaef79e5Smrg# Check how to create a tarball.                            -*- Autoconf -*-
976eaef79e5Smrg
977cbc4e2beSmrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
978eaef79e5Smrg#
979eaef79e5Smrg# This file is free software; the Free Software Foundation
980eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
981eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
982eaef79e5Smrg
983eaef79e5Smrg# _AM_PROG_TAR(FORMAT)
984eaef79e5Smrg# --------------------
985eaef79e5Smrg# Check how to create a tarball in format FORMAT.
986cbc4e2beSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
987eaef79e5Smrg#
988eaef79e5Smrg# Substitute a variable $(am__tar) that is a command
989eaef79e5Smrg# writing to stdout a FORMAT-tarball containing the directory
990eaef79e5Smrg# $tardir.
991eaef79e5Smrg#     tardir=directory && $(am__tar) > result.tar
992eaef79e5Smrg#
993eaef79e5Smrg# Substitute a variable $(am__untar) that extract such
994eaef79e5Smrg# a tarball read from stdin.
995eaef79e5Smrg#     $(am__untar) < result.tar
996cbc4e2beSmrg#
997eaef79e5SmrgAC_DEFUN([_AM_PROG_TAR],
998cbc4e2beSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
999cbc4e2beSmrg# in the wild :-(  We should find a proper way to deprecate it ...
1000cbc4e2beSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1001cbc4e2beSmrg
1002cbc4e2beSmrg# We'll loop over all known methods to create a tar archive until one works.
1003eaef79e5Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1004eaef79e5Smrg
1005cbc4e2beSmrgm4_if([$1], [v7],
1006cbc4e2beSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1007cbc4e2beSmrg
1008cbc4e2beSmrg  [m4_case([$1],
1009cbc4e2beSmrg    [ustar],
1010cbc4e2beSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1011cbc4e2beSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1012cbc4e2beSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1013cbc4e2beSmrg      # and bug#13588).
1014cbc4e2beSmrg      am_max_uid=2097151 # 2^21 - 1
1015cbc4e2beSmrg      am_max_gid=$am_max_uid
1016cbc4e2beSmrg      # The $UID and $GID variables are not portable, so we need to resort
1017cbc4e2beSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1018cbc4e2beSmrg      # below are definitely unexpected, so allow the users to see them
1019cbc4e2beSmrg      # (that is, avoid stderr redirection).
1020cbc4e2beSmrg      am_uid=`id -u || echo unknown`
1021cbc4e2beSmrg      am_gid=`id -g || echo unknown`
1022cbc4e2beSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1023cbc4e2beSmrg      if test $am_uid -le $am_max_uid; then
1024cbc4e2beSmrg         AC_MSG_RESULT([yes])
1025cbc4e2beSmrg      else
1026cbc4e2beSmrg         AC_MSG_RESULT([no])
1027cbc4e2beSmrg         _am_tools=none
1028cbc4e2beSmrg      fi
1029cbc4e2beSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1030cbc4e2beSmrg      if test $am_gid -le $am_max_gid; then
1031cbc4e2beSmrg         AC_MSG_RESULT([yes])
1032cbc4e2beSmrg      else
1033cbc4e2beSmrg        AC_MSG_RESULT([no])
1034cbc4e2beSmrg        _am_tools=none
1035cbc4e2beSmrg      fi],
1036cbc4e2beSmrg
1037cbc4e2beSmrg  [pax],
1038cbc4e2beSmrg    [],
1039cbc4e2beSmrg
1040cbc4e2beSmrg  [m4_fatal([Unknown tar format])])
1041cbc4e2beSmrg
1042cbc4e2beSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1043cbc4e2beSmrg
1044cbc4e2beSmrg  # Go ahead even if we have the value already cached.  We do so because we
1045cbc4e2beSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1046cbc4e2beSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1047cbc4e2beSmrg
1048cbc4e2beSmrg  for _am_tool in $_am_tools; do
1049cbc4e2beSmrg    case $_am_tool in
1050cbc4e2beSmrg    gnutar)
1051cbc4e2beSmrg      for _am_tar in tar gnutar gtar; do
1052cbc4e2beSmrg        AM_RUN_LOG([$_am_tar --version]) && break
1053cbc4e2beSmrg      done
1054cbc4e2beSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1055cbc4e2beSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1056cbc4e2beSmrg      am__untar="$_am_tar -xf -"
1057cbc4e2beSmrg      ;;
1058cbc4e2beSmrg    plaintar)
1059cbc4e2beSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1060cbc4e2beSmrg      # ustar tarball either.
1061cbc4e2beSmrg      (tar --version) >/dev/null 2>&1 && continue
1062cbc4e2beSmrg      am__tar='tar chf - "$$tardir"'
1063cbc4e2beSmrg      am__tar_='tar chf - "$tardir"'
1064cbc4e2beSmrg      am__untar='tar xf -'
1065cbc4e2beSmrg      ;;
1066cbc4e2beSmrg    pax)
1067cbc4e2beSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
1068cbc4e2beSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
1069cbc4e2beSmrg      am__untar='pax -r'
1070cbc4e2beSmrg      ;;
1071cbc4e2beSmrg    cpio)
1072cbc4e2beSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1073cbc4e2beSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1074cbc4e2beSmrg      am__untar='cpio -i -H $1 -d'
1075cbc4e2beSmrg      ;;
1076cbc4e2beSmrg    none)
1077cbc4e2beSmrg      am__tar=false
1078cbc4e2beSmrg      am__tar_=false
1079cbc4e2beSmrg      am__untar=false
1080cbc4e2beSmrg      ;;
1081cbc4e2beSmrg    esac
1082eaef79e5Smrg
1083cbc4e2beSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
1084cbc4e2beSmrg    # and am__untar set.
1085cbc4e2beSmrg    test -n "${am_cv_prog_tar_$1}" && break
1086cbc4e2beSmrg
1087cbc4e2beSmrg    # tar/untar a dummy directory, and stop if the command works.
1088cbc4e2beSmrg    rm -rf conftest.dir
1089cbc4e2beSmrg    mkdir conftest.dir
1090cbc4e2beSmrg    echo GrepMe > conftest.dir/file
1091cbc4e2beSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1092cbc4e2beSmrg    rm -rf conftest.dir
1093cbc4e2beSmrg    if test -s conftest.tar; then
1094cbc4e2beSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
1095cbc4e2beSmrg      AM_RUN_LOG([cat conftest.dir/file])
1096cbc4e2beSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1097cbc4e2beSmrg    fi
1098cbc4e2beSmrg  done
1099eaef79e5Smrg  rm -rf conftest.dir
1100eaef79e5Smrg
1101cbc4e2beSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1102cbc4e2beSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1103cbc4e2beSmrg
1104eaef79e5SmrgAC_SUBST([am__tar])
1105eaef79e5SmrgAC_SUBST([am__untar])
1106eaef79e5Smrg]) # _AM_PROG_TAR
1107eaef79e5Smrg
1108cbc4e2beSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1109cbc4e2beSmrg# 
1110cbc4e2beSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1111cbc4e2beSmrg#
1112cbc4e2beSmrg# This program is free software; you can redistribute it and/or modify
1113cbc4e2beSmrg# it under the terms of the GNU General Public License as published by
1114cbc4e2beSmrg# the Free Software Foundation; either version 2 of the License, or
1115cbc4e2beSmrg# (at your option) any later version.
1116cbc4e2beSmrg#
1117cbc4e2beSmrg# This program is distributed in the hope that it will be useful, but
1118cbc4e2beSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1119cbc4e2beSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1120cbc4e2beSmrg# General Public License for more details.
1121cbc4e2beSmrg#
1122cbc4e2beSmrg# You should have received a copy of the GNU General Public License
1123cbc4e2beSmrg# along with this program; if not, write to the Free Software
1124cbc4e2beSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1125cbc4e2beSmrg#
1126cbc4e2beSmrg# As a special exception to the GNU General Public License, if you
1127cbc4e2beSmrg# distribute this file as part of a program that contains a
1128cbc4e2beSmrg# configuration script generated by Autoconf, you may include it under
1129cbc4e2beSmrg# the same distribution terms that you use for the rest of that program.
1130cbc4e2beSmrg
1131cbc4e2beSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1132cbc4e2beSmrg# ----------------------------------
1133cbc4e2beSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1134cbc4e2beSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1135cbc4e2beSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1136cbc4e2beSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1137cbc4e2beSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1138cbc4e2beSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1139cbc4e2beSmrgfi
1140cbc4e2beSmrgif test -n "$PKG_CONFIG"; then
1141cbc4e2beSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1142cbc4e2beSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1143cbc4e2beSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1144cbc4e2beSmrg		AC_MSG_RESULT([yes])
1145cbc4e2beSmrg	else
1146cbc4e2beSmrg		AC_MSG_RESULT([no])
1147cbc4e2beSmrg		PKG_CONFIG=""
1148cbc4e2beSmrg	fi
1149cbc4e2beSmrg		
1150cbc4e2beSmrgfi[]dnl
1151cbc4e2beSmrg])# PKG_PROG_PKG_CONFIG
1152cbc4e2beSmrg
1153cbc4e2beSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1154cbc4e2beSmrg#
1155cbc4e2beSmrg# Check to see whether a particular set of modules exists.  Similar
1156cbc4e2beSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1157cbc4e2beSmrg#
1158cbc4e2beSmrg#
1159cbc4e2beSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1160cbc4e2beSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
1161cbc4e2beSmrg# PKG_CHECK_EXISTS manually
1162cbc4e2beSmrg# --------------------------------------------------------------
1163cbc4e2beSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1164cbc4e2beSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1165cbc4e2beSmrgif test -n "$PKG_CONFIG" && \
1166cbc4e2beSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1167cbc4e2beSmrg  m4_ifval([$2], [$2], [:])
1168cbc4e2beSmrgm4_ifvaln([$3], [else
1169cbc4e2beSmrg  $3])dnl
1170cbc4e2beSmrgfi])
1171cbc4e2beSmrg
1172cbc4e2beSmrg
1173cbc4e2beSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1174cbc4e2beSmrg# ---------------------------------------------
1175cbc4e2beSmrgm4_define([_PKG_CONFIG],
1176cbc4e2beSmrg[if test -n "$$1"; then
1177cbc4e2beSmrg    pkg_cv_[]$1="$$1"
1178cbc4e2beSmrg elif test -n "$PKG_CONFIG"; then
1179cbc4e2beSmrg    PKG_CHECK_EXISTS([$3],
1180cbc4e2beSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1181cbc4e2beSmrg		     [pkg_failed=yes])
1182cbc4e2beSmrg else
1183cbc4e2beSmrg    pkg_failed=untried
1184cbc4e2beSmrgfi[]dnl
1185cbc4e2beSmrg])# _PKG_CONFIG
1186cbc4e2beSmrg
1187cbc4e2beSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1188cbc4e2beSmrg# -----------------------------
1189cbc4e2beSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1190cbc4e2beSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1191cbc4e2beSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1192cbc4e2beSmrg        _pkg_short_errors_supported=yes
1193cbc4e2beSmrgelse
1194cbc4e2beSmrg        _pkg_short_errors_supported=no
1195cbc4e2beSmrgfi[]dnl
1196cbc4e2beSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1197cbc4e2beSmrg
1198cbc4e2beSmrg
1199cbc4e2beSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1200cbc4e2beSmrg# [ACTION-IF-NOT-FOUND])
1201cbc4e2beSmrg#
1202cbc4e2beSmrg#
1203cbc4e2beSmrg# Note that if there is a possibility the first call to
1204cbc4e2beSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1205cbc4e2beSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1206cbc4e2beSmrg#
1207cbc4e2beSmrg#
1208cbc4e2beSmrg# --------------------------------------------------------------
1209cbc4e2beSmrgAC_DEFUN([PKG_CHECK_MODULES],
1210cbc4e2beSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1211cbc4e2beSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1212cbc4e2beSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1213cbc4e2beSmrg
1214cbc4e2beSmrgpkg_failed=no
1215cbc4e2beSmrgAC_MSG_CHECKING([for $1])
1216cbc4e2beSmrg
1217cbc4e2beSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1218cbc4e2beSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1219cbc4e2beSmrg
1220cbc4e2beSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1221cbc4e2beSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1222cbc4e2beSmrgSee the pkg-config man page for more details.])
1223cbc4e2beSmrg
1224cbc4e2beSmrgif test $pkg_failed = yes; then
1225cbc4e2beSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1226cbc4e2beSmrg        if test $_pkg_short_errors_supported = yes; then
1227cbc4e2beSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1228cbc4e2beSmrg        else 
1229cbc4e2beSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1230cbc4e2beSmrg        fi
1231cbc4e2beSmrg	# Put the nasty error message in config.log where it belongs
1232cbc4e2beSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1233cbc4e2beSmrg
1234cbc4e2beSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1235cbc4e2beSmrg[Package requirements ($2) were not met:
1236cbc4e2beSmrg
1237cbc4e2beSmrg$$1_PKG_ERRORS
1238cbc4e2beSmrg
1239cbc4e2beSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1240cbc4e2beSmrginstalled software in a non-standard prefix.
1241cbc4e2beSmrg
1242cbc4e2beSmrg_PKG_TEXT
1243cbc4e2beSmrg])],
1244cbc4e2beSmrg		[AC_MSG_RESULT([no])
1245cbc4e2beSmrg                $4])
1246cbc4e2beSmrgelif test $pkg_failed = untried; then
1247cbc4e2beSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1248cbc4e2beSmrg[The pkg-config script could not be found or is too old.  Make sure it
1249cbc4e2beSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1250cbc4e2beSmrgpath to pkg-config.
1251cbc4e2beSmrg
1252cbc4e2beSmrg_PKG_TEXT
1253cbc4e2beSmrg
1254cbc4e2beSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1255cbc4e2beSmrg		[$4])
1256cbc4e2beSmrgelse
1257cbc4e2beSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1258cbc4e2beSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1259cbc4e2beSmrg        AC_MSG_RESULT([yes])
1260cbc4e2beSmrg	ifelse([$3], , :, [$3])
1261cbc4e2beSmrgfi[]dnl
1262cbc4e2beSmrg])# PKG_CHECK_MODULES
1263cbc4e2beSmrg
12642b32c8f7Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1265eaef79e5Smrgdnl
126695e0246bSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1267eaef79e5Smrgdnl 
1268eaef79e5Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
126995e0246bSmrgdnl copy of this software and associated documentation files (the "Software"),
127095e0246bSmrgdnl to deal in the Software without restriction, including without limitation
127195e0246bSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
127295e0246bSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
127395e0246bSmrgdnl Software is furnished to do so, subject to the following conditions:
1274eaef79e5Smrgdnl
127595e0246bSmrgdnl The above copyright notice and this permission notice (including the next
127695e0246bSmrgdnl paragraph) shall be included in all copies or substantial portions of the
127795e0246bSmrgdnl Software.
1278eaef79e5Smrgdnl
127995e0246bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
128095e0246bSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
128195e0246bSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
128295e0246bSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
128395e0246bSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
128495e0246bSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
128595e0246bSmrgdnl DEALINGS IN THE SOFTWARE.
1286eaef79e5Smrg
1287eaef79e5Smrg# XORG_MACROS_VERSION(required-version)
1288eaef79e5Smrg# -------------------------------------
1289eaef79e5Smrg# Minimum version: 1.1.0
1290eaef79e5Smrg#
1291eaef79e5Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1292eaef79e5Smrg# your configure.ac with the minimum required version, such as:
1293eaef79e5Smrg# XORG_MACROS_VERSION(1.1)
1294eaef79e5Smrg#
12952b32c8f7Smrg# To ensure that this macro is defined, also add:
12962b32c8f7Smrg# m4_ifndef([XORG_MACROS_VERSION],
12972b32c8f7Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1298eaef79e5Smrg#
1299eaef79e5Smrg#
1300eaef79e5Smrg# See the "minimum version" comment for each macro you use to see what 
1301eaef79e5Smrg# version you require.
13022b32c8f7Smrgm4_defun([XORG_MACROS_VERSION],[
1303cbc4e2beSmrgm4_define([vers_have], [1.17])
13042b32c8f7Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
13052b32c8f7Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
13062b32c8f7Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
13072b32c8f7Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
13082b32c8f7Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
13092b32c8f7Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
13102b32c8f7Smrgm4_undefine([vers_have])
13112b32c8f7Smrgm4_undefine([maj_have])
13122b32c8f7Smrgm4_undefine([maj_needed])
1313eaef79e5Smrg]) # XORG_MACROS_VERSION
1314eaef79e5Smrg
1315eaef79e5Smrg# XORG_PROG_RAWCPP()
1316eaef79e5Smrg# ------------------
1317eaef79e5Smrg# Minimum version: 1.0.0
1318eaef79e5Smrg#
1319eaef79e5Smrg# Find cpp program and necessary flags for use in pre-processing text files
1320eaef79e5Smrg# such as man pages and config files
1321eaef79e5SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1322eaef79e5SmrgAC_REQUIRE([AC_PROG_CPP])
1323eaef79e5SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1324eaef79e5Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1325eaef79e5Smrg
1326eaef79e5Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1327eaef79e5Smrg# which is not the best choice for supporting other OS'es, but covers most
1328eaef79e5Smrg# of the ones we need for now.
1329eaef79e5SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1330cbc4e2beSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1331eaef79e5Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1332eaef79e5Smrg	AC_MSG_RESULT([no])
1333eaef79e5Smrgelse
1334eaef79e5Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1335eaef79e5Smrg		RAWCPPFLAGS=-undef
1336eaef79e5Smrg		AC_MSG_RESULT([yes])
13372b32c8f7Smrg	# under Cygwin unix is still defined even with -undef
13382b32c8f7Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13392b32c8f7Smrg		RAWCPPFLAGS="-undef -ansi"
13402b32c8f7Smrg		AC_MSG_RESULT([yes, with -ansi])
1341eaef79e5Smrg	else
1342eaef79e5Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1343eaef79e5Smrg	fi
1344eaef79e5Smrgfi
1345eaef79e5Smrgrm -f conftest.$ac_ext
1346eaef79e5Smrg
1347eaef79e5SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1348cbc4e2beSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1349eaef79e5Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1350eaef79e5Smrg	AC_MSG_RESULT([no])
1351eaef79e5Smrgelse
1352eaef79e5Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1353eaef79e5Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1354eaef79e5Smrg		AC_MSG_RESULT([yes])
1355eaef79e5Smrg	else
1356eaef79e5Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1357eaef79e5Smrg	fi
1358eaef79e5Smrgfi
1359eaef79e5Smrgrm -f conftest.$ac_ext
1360eaef79e5SmrgAC_SUBST(RAWCPPFLAGS)
1361eaef79e5Smrg]) # XORG_PROG_RAWCPP
1362eaef79e5Smrg
1363eaef79e5Smrg# XORG_MANPAGE_SECTIONS()
1364eaef79e5Smrg# -----------------------
1365eaef79e5Smrg# Minimum version: 1.0.0
1366eaef79e5Smrg#
1367eaef79e5Smrg# Determine which sections man pages go in for the different man page types
1368eaef79e5Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1369eaef79e5Smrg# Not sure if there's any better way than just hardcoding by OS name.
1370eaef79e5Smrg# Override default settings by setting environment variables
137195e0246bSmrg# Added MAN_SUBSTS in version 1.8
137295e0246bSmrg# Added AC_PROG_SED in version 1.8
1373eaef79e5Smrg
1374eaef79e5SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1375eaef79e5SmrgAC_REQUIRE([AC_CANONICAL_HOST])
137695e0246bSmrgAC_REQUIRE([AC_PROG_SED])
1377eaef79e5Smrg
1378eaef79e5Smrgif test x$APP_MAN_SUFFIX = x    ; then
1379eaef79e5Smrg    APP_MAN_SUFFIX=1
1380eaef79e5Smrgfi
1381eaef79e5Smrgif test x$APP_MAN_DIR = x    ; then
1382eaef79e5Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1383eaef79e5Smrgfi
1384eaef79e5Smrg
1385eaef79e5Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1386eaef79e5Smrg    LIB_MAN_SUFFIX=3
1387eaef79e5Smrgfi
1388eaef79e5Smrgif test x$LIB_MAN_DIR = x    ; then
1389eaef79e5Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1390eaef79e5Smrgfi
1391eaef79e5Smrg
1392eaef79e5Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1393eaef79e5Smrg    case $host_os in
1394eaef79e5Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1395eaef79e5Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1396eaef79e5Smrg    esac
1397eaef79e5Smrgfi
1398eaef79e5Smrgif test x$FILE_MAN_DIR = x    ; then
1399eaef79e5Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1400eaef79e5Smrgfi
1401eaef79e5Smrg
1402eaef79e5Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1403eaef79e5Smrg    case $host_os in
1404eaef79e5Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1405eaef79e5Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1406eaef79e5Smrg    esac
1407eaef79e5Smrgfi
1408eaef79e5Smrgif test x$MISC_MAN_DIR = x    ; then
1409eaef79e5Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1410eaef79e5Smrgfi
1411eaef79e5Smrg
1412eaef79e5Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1413eaef79e5Smrg    case $host_os in
1414eaef79e5Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1415eaef79e5Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1416eaef79e5Smrg    esac
1417eaef79e5Smrgfi
1418eaef79e5Smrgif test x$DRIVER_MAN_DIR = x    ; then
1419eaef79e5Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1420eaef79e5Smrgfi
1421eaef79e5Smrg
1422eaef79e5Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1423eaef79e5Smrg    case $host_os in
1424eaef79e5Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1425eaef79e5Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1426eaef79e5Smrg    esac
1427eaef79e5Smrgfi
1428eaef79e5Smrgif test x$ADMIN_MAN_DIR = x    ; then
1429eaef79e5Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1430eaef79e5Smrgfi
1431eaef79e5Smrg
1432eaef79e5Smrg
1433eaef79e5SmrgAC_SUBST([APP_MAN_SUFFIX])
1434eaef79e5SmrgAC_SUBST([LIB_MAN_SUFFIX])
1435eaef79e5SmrgAC_SUBST([FILE_MAN_SUFFIX])
1436eaef79e5SmrgAC_SUBST([MISC_MAN_SUFFIX])
1437eaef79e5SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1438eaef79e5SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1439eaef79e5SmrgAC_SUBST([APP_MAN_DIR])
1440eaef79e5SmrgAC_SUBST([LIB_MAN_DIR])
1441eaef79e5SmrgAC_SUBST([FILE_MAN_DIR])
1442eaef79e5SmrgAC_SUBST([MISC_MAN_DIR])
1443eaef79e5SmrgAC_SUBST([DRIVER_MAN_DIR])
1444eaef79e5SmrgAC_SUBST([ADMIN_MAN_DIR])
144595e0246bSmrg
144695e0246bSmrgXORG_MAN_PAGE="X Version 11"
144795e0246bSmrgAC_SUBST([XORG_MAN_PAGE])
144895e0246bSmrgMAN_SUBSTS="\
144995e0246bSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
145095e0246bSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
145195e0246bSmrg	-e 's|__xservername__|Xorg|g' \
145295e0246bSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
145395e0246bSmrg	-e 's|__projectroot__|\$(prefix)|g' \
145495e0246bSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
145595e0246bSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
145695e0246bSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
145795e0246bSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
145895e0246bSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
145995e0246bSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
146095e0246bSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
146195e0246bSmrgAC_SUBST([MAN_SUBSTS])
146295e0246bSmrg
1463eaef79e5Smrg]) # XORG_MANPAGE_SECTIONS
1464eaef79e5Smrg
146595e0246bSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
146695e0246bSmrg# ------------------------
146795e0246bSmrg# Minimum version: 1.7.0
146895e0246bSmrg#
146995e0246bSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
147095e0246bSmrg# provided by xorg-sgml-doctools, if installed.
147195e0246bSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
147295e0246bSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
147395e0246bSmrgXORG_SGML_PATH=
147495e0246bSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
147595e0246bSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
147695e0246bSmrg    [m4_ifval([$1],[:],
147795e0246bSmrg        [if test x"$cross_compiling" != x"yes" ; then
147895e0246bSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
147995e0246bSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
148095e0246bSmrg         fi])
148195e0246bSmrg    ])
148295e0246bSmrg
148395e0246bSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
148495e0246bSmrg# the path and the name of the doc stylesheet
148595e0246bSmrgif test "x$XORG_SGML_PATH" != "x" ; then
148695e0246bSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
148795e0246bSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
148895e0246bSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
148995e0246bSmrgelse
149095e0246bSmrg   AC_MSG_RESULT([no])
149195e0246bSmrgfi
149295e0246bSmrg
149395e0246bSmrgAC_SUBST(XORG_SGML_PATH)
149495e0246bSmrgAC_SUBST(STYLESHEET_SRCDIR)
149595e0246bSmrgAC_SUBST(XSL_STYLESHEET)
149695e0246bSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
149795e0246bSmrg]) # XORG_CHECK_SGML_DOCTOOLS
149895e0246bSmrg
1499eaef79e5Smrg# XORG_CHECK_LINUXDOC
1500eaef79e5Smrg# -------------------
1501eaef79e5Smrg# Minimum version: 1.0.0
1502eaef79e5Smrg#
1503eaef79e5Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1504eaef79e5Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1505eaef79e5Smrg# Whether or not the necessary tools and files are found can be checked
1506eaef79e5Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1507eaef79e5SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
150895e0246bSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
150995e0246bSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1510eaef79e5Smrg
1511eaef79e5SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1512eaef79e5Smrg
151395e0246bSmrgAC_MSG_CHECKING([whether to build documentation])
1514eaef79e5Smrg
151595e0246bSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1516eaef79e5Smrg   BUILDDOC=yes
1517eaef79e5Smrgelse
1518eaef79e5Smrg   BUILDDOC=no
1519eaef79e5Smrgfi
1520eaef79e5Smrg
1521eaef79e5SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1522eaef79e5Smrg
1523eaef79e5SmrgAC_MSG_RESULT([$BUILDDOC])
1524eaef79e5Smrg
152595e0246bSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1526eaef79e5Smrg
152795e0246bSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1528eaef79e5Smrg   BUILDPDFDOC=yes
1529eaef79e5Smrgelse
1530eaef79e5Smrg   BUILDPDFDOC=no
1531eaef79e5Smrgfi
1532eaef79e5Smrg
1533eaef79e5SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1534eaef79e5Smrg
1535eaef79e5SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1536eaef79e5Smrg
153795e0246bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1538eaef79e5SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1539eaef79e5SmrgMAKE_PDF="$PS2PDF"
1540eaef79e5SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1541eaef79e5Smrg
1542eaef79e5SmrgAC_SUBST(MAKE_TEXT)
1543eaef79e5SmrgAC_SUBST(MAKE_PS)
1544eaef79e5SmrgAC_SUBST(MAKE_PDF)
1545eaef79e5SmrgAC_SUBST(MAKE_HTML)
1546eaef79e5Smrg]) # XORG_CHECK_LINUXDOC
1547eaef79e5Smrg
1548eaef79e5Smrg# XORG_CHECK_DOCBOOK
1549eaef79e5Smrg# -------------------
1550eaef79e5Smrg# Minimum version: 1.0.0
1551eaef79e5Smrg#
1552eaef79e5Smrg# Checks for the ability to build output formats from SGML DocBook source.
1553eaef79e5Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1554eaef79e5Smrg# indicates whether the necessary tools and files are found and, if set,
1555eaef79e5Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1556eaef79e5SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
155795e0246bSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
155895e0246bSmrg
1559eaef79e5SmrgBUILDTXTDOC=no
1560eaef79e5SmrgBUILDPDFDOC=no
1561eaef79e5SmrgBUILDPSDOC=no
1562eaef79e5SmrgBUILDHTMLDOC=no
1563eaef79e5Smrg
1564eaef79e5SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1565eaef79e5SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1566eaef79e5SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1567eaef79e5SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1568eaef79e5Smrg
156995e0246bSmrgAC_MSG_CHECKING([whether to build text documentation])
157095e0246bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1571eaef79e5Smrg   test x$BUILD_TXTDOC != xno; then
1572eaef79e5Smrg	BUILDTXTDOC=yes
1573eaef79e5Smrgfi
1574eaef79e5SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1575eaef79e5SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1576eaef79e5Smrg
157795e0246bSmrgAC_MSG_CHECKING([whether to build PDF documentation])
157895e0246bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1579eaef79e5Smrg   test x$BUILD_PDFDOC != xno; then
1580eaef79e5Smrg	BUILDPDFDOC=yes
1581eaef79e5Smrgfi
1582eaef79e5SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1583eaef79e5SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1584eaef79e5Smrg
158595e0246bSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
158695e0246bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1587eaef79e5Smrg   test x$BUILD_PSDOC != xno; then
1588eaef79e5Smrg	BUILDPSDOC=yes
1589eaef79e5Smrgfi
1590eaef79e5SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1591eaef79e5SmrgAC_MSG_RESULT([$BUILDPSDOC])
1592eaef79e5Smrg
159395e0246bSmrgAC_MSG_CHECKING([whether to build HTML documentation])
159495e0246bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1595eaef79e5Smrg   test x$BUILD_HTMLDOC != xno; then
1596eaef79e5Smrg	BUILDHTMLDOC=yes
1597eaef79e5Smrgfi
1598eaef79e5SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1599eaef79e5SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1600eaef79e5Smrg
1601eaef79e5SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1602eaef79e5SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1603eaef79e5SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1604eaef79e5SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1605eaef79e5Smrg
1606eaef79e5SmrgAC_SUBST(MAKE_TEXT)
1607eaef79e5SmrgAC_SUBST(MAKE_PS)
1608eaef79e5SmrgAC_SUBST(MAKE_PDF)
1609eaef79e5SmrgAC_SUBST(MAKE_HTML)
1610eaef79e5Smrg]) # XORG_CHECK_DOCBOOK
1611eaef79e5Smrg
1612cbc4e2beSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
161395e0246bSmrg# ----------------
161495e0246bSmrg# Minimum version: 1.5.0
1615cbc4e2beSmrg# Minimum version for optional DEFAULT argument: 1.11.0
161695e0246bSmrg#
161795e0246bSmrg# Documentation tools are not always available on all platforms and sometimes
161895e0246bSmrg# not at the appropriate level. This macro enables a module to test for the
161995e0246bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
162095e0246bSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1621cbc4e2beSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1622cbc4e2beSmrg# --with-xmlto assumes 'auto'.
162395e0246bSmrg#
162495e0246bSmrg# Interface to module:
162595e0246bSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
162695e0246bSmrg# XMLTO:	returns the path of the xmlto program found
162795e0246bSmrg#		returns the path set by the user in the environment
162895e0246bSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
162995e0246bSmrg#		'no' user instructs the module not to use xmlto
163095e0246bSmrg#
163195e0246bSmrg# Added in version 1.10.0
163295e0246bSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
163395e0246bSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
163495e0246bSmrg#
163595e0246bSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
163695e0246bSmrg#
163795e0246bSmrgAC_DEFUN([XORG_WITH_XMLTO],[
163895e0246bSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1639cbc4e2beSmrgm4_define([_defopt], m4_default([$2], [auto]))
164095e0246bSmrgAC_ARG_WITH(xmlto,
164195e0246bSmrg	AS_HELP_STRING([--with-xmlto],
1642cbc4e2beSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1643cbc4e2beSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1644cbc4e2beSmrgm4_undefine([_defopt])
164595e0246bSmrg
164695e0246bSmrgif test "x$use_xmlto" = x"auto"; then
164795e0246bSmrg   AC_PATH_PROG([XMLTO], [xmlto])
164895e0246bSmrg   if test "x$XMLTO" = "x"; then
164995e0246bSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
165095e0246bSmrg	have_xmlto=no
165195e0246bSmrg   else
165295e0246bSmrg        have_xmlto=yes
165395e0246bSmrg   fi
165495e0246bSmrgelif test "x$use_xmlto" = x"yes" ; then
165595e0246bSmrg   AC_PATH_PROG([XMLTO], [xmlto])
165695e0246bSmrg   if test "x$XMLTO" = "x"; then
165795e0246bSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
165895e0246bSmrg   fi
165995e0246bSmrg   have_xmlto=yes
166095e0246bSmrgelif test "x$use_xmlto" = x"no" ; then
166195e0246bSmrg   if test "x$XMLTO" != "x"; then
166295e0246bSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
166395e0246bSmrg   fi
166495e0246bSmrg   have_xmlto=no
166595e0246bSmrgelse
166695e0246bSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
166795e0246bSmrgfi
166895e0246bSmrg
166995e0246bSmrg# Test for a minimum version of xmlto, if provided.
167095e0246bSmrgm4_ifval([$1],
167195e0246bSmrg[if test "$have_xmlto" = yes; then
167295e0246bSmrg    # scrape the xmlto version
167395e0246bSmrg    AC_MSG_CHECKING([the xmlto version])
167495e0246bSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
167595e0246bSmrg    AC_MSG_RESULT([$xmlto_version])
167695e0246bSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
167795e0246bSmrg        [if test "x$use_xmlto" = xauto; then
167895e0246bSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
167995e0246bSmrg            have_xmlto=no
168095e0246bSmrg        else
168195e0246bSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
168295e0246bSmrg        fi])
168395e0246bSmrgfi])
168495e0246bSmrg
168595e0246bSmrg# Test for the ability of xmlto to generate a text target
168695e0246bSmrghave_xmlto_text=no
168795e0246bSmrgcat > conftest.xml << "EOF"
168895e0246bSmrgEOF
168995e0246bSmrgAS_IF([test "$have_xmlto" = yes],
169095e0246bSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
169195e0246bSmrg             [have_xmlto_text=yes],
169295e0246bSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
169395e0246bSmrgrm -f conftest.xml
169495e0246bSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
169595e0246bSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
169695e0246bSmrg]) # XORG_WITH_XMLTO
169795e0246bSmrg
1698cbc4e2beSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1699cbc4e2beSmrg# --------------------------------------------
1700cbc4e2beSmrg# Minimum version: 1.12.0
1701cbc4e2beSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1702cbc4e2beSmrg#
1703cbc4e2beSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1704cbc4e2beSmrg# XML-based language used for the transformation of XML documents.
1705cbc4e2beSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1706cbc4e2beSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1707cbc4e2beSmrg# The XSLT processor is often used as a standalone tool for transformations.
1708cbc4e2beSmrg# It should not be assumed that this tool is used only to work with documnetation.
1709cbc4e2beSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1710cbc4e2beSmrg#
1711cbc4e2beSmrg# Interface to module:
1712cbc4e2beSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1713cbc4e2beSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1714cbc4e2beSmrg#		 returns the path set by the user in the environment
1715cbc4e2beSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1716cbc4e2beSmrg#		  'no' user instructs the module not to use xsltproc
1717cbc4e2beSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1718cbc4e2beSmrg#
1719cbc4e2beSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1720cbc4e2beSmrg#
1721cbc4e2beSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1722cbc4e2beSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1723cbc4e2beSmrg# Preserves the interface, should it be implemented later
1724cbc4e2beSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1725cbc4e2beSmrgm4_define([_defopt], m4_default([$2], [auto]))
1726cbc4e2beSmrgAC_ARG_WITH(xsltproc,
1727cbc4e2beSmrg	AS_HELP_STRING([--with-xsltproc],
1728cbc4e2beSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1729cbc4e2beSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1730cbc4e2beSmrgm4_undefine([_defopt])
1731cbc4e2beSmrg
1732cbc4e2beSmrgif test "x$use_xsltproc" = x"auto"; then
1733cbc4e2beSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1734cbc4e2beSmrg   if test "x$XSLTPROC" = "x"; then
1735cbc4e2beSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1736cbc4e2beSmrg	have_xsltproc=no
1737cbc4e2beSmrg   else
1738cbc4e2beSmrg        have_xsltproc=yes
1739cbc4e2beSmrg   fi
1740cbc4e2beSmrgelif test "x$use_xsltproc" = x"yes" ; then
1741cbc4e2beSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1742cbc4e2beSmrg   if test "x$XSLTPROC" = "x"; then
1743cbc4e2beSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1744cbc4e2beSmrg   fi
1745cbc4e2beSmrg   have_xsltproc=yes
1746cbc4e2beSmrgelif test "x$use_xsltproc" = x"no" ; then
1747cbc4e2beSmrg   if test "x$XSLTPROC" != "x"; then
1748cbc4e2beSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1749cbc4e2beSmrg   fi
1750cbc4e2beSmrg   have_xsltproc=no
1751cbc4e2beSmrgelse
1752cbc4e2beSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1753cbc4e2beSmrgfi
1754cbc4e2beSmrg
1755cbc4e2beSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1756cbc4e2beSmrg]) # XORG_WITH_XSLTPROC
1757cbc4e2beSmrg
1758cbc4e2beSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1759cbc4e2beSmrg# ----------------------------------------
1760cbc4e2beSmrg# Minimum version: 1.15.0
1761cbc4e2beSmrg#
1762cbc4e2beSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1763cbc4e2beSmrg# scanning arbitrary text files, extracting information from those text files,
1764cbc4e2beSmrg# and printing reports based on that information.
1765cbc4e2beSmrg#
1766cbc4e2beSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1767cbc4e2beSmrg#
1768cbc4e2beSmrg# Interface to module:
1769cbc4e2beSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1770cbc4e2beSmrg# PERL:	     returns the path of the perl program found
1771cbc4e2beSmrg#	     returns the path set by the user in the environment
1772cbc4e2beSmrg# --with-perl: 'yes' user instructs the module to use perl
1773cbc4e2beSmrg#	       'no' user instructs the module not to use perl
1774cbc4e2beSmrg# have_perl: returns yes if perl found in PATH or no
1775cbc4e2beSmrg#
1776cbc4e2beSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1777cbc4e2beSmrg#
1778cbc4e2beSmrgAC_DEFUN([XORG_WITH_PERL],[
1779cbc4e2beSmrgAC_ARG_VAR([PERL], [Path to perl command])
1780cbc4e2beSmrg# Preserves the interface, should it be implemented later
1781cbc4e2beSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1782cbc4e2beSmrgm4_define([_defopt], m4_default([$2], [auto]))
1783cbc4e2beSmrgAC_ARG_WITH(perl,
1784cbc4e2beSmrg	AS_HELP_STRING([--with-perl],
1785cbc4e2beSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1786cbc4e2beSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1787cbc4e2beSmrgm4_undefine([_defopt])
1788cbc4e2beSmrg
1789cbc4e2beSmrgif test "x$use_perl" = x"auto"; then
1790cbc4e2beSmrg   AC_PATH_PROG([PERL], [perl])
1791cbc4e2beSmrg   if test "x$PERL" = "x"; then
1792cbc4e2beSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1793cbc4e2beSmrg	have_perl=no
1794cbc4e2beSmrg   else
1795cbc4e2beSmrg        have_perl=yes
1796cbc4e2beSmrg   fi
1797cbc4e2beSmrgelif test "x$use_perl" = x"yes" ; then
1798cbc4e2beSmrg   AC_PATH_PROG([PERL], [perl])
1799cbc4e2beSmrg   if test "x$PERL" = "x"; then
1800cbc4e2beSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1801cbc4e2beSmrg   fi
1802cbc4e2beSmrg   have_perl=yes
1803cbc4e2beSmrgelif test "x$use_perl" = x"no" ; then
1804cbc4e2beSmrg   if test "x$PERL" != "x"; then
1805cbc4e2beSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1806cbc4e2beSmrg   fi
1807cbc4e2beSmrg   have_perl=no
1808cbc4e2beSmrgelse
1809cbc4e2beSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1810cbc4e2beSmrgfi
1811cbc4e2beSmrg
1812cbc4e2beSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1813cbc4e2beSmrg]) # XORG_WITH_PERL
1814cbc4e2beSmrg
1815cbc4e2beSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
181695e0246bSmrg# ----------------
181795e0246bSmrg# Minimum version: 1.5.0
1818cbc4e2beSmrg# Minimum version for optional DEFAULT argument: 1.11.0
181995e0246bSmrg#
182095e0246bSmrg# Documentation tools are not always available on all platforms and sometimes
182195e0246bSmrg# not at the appropriate level. This macro enables a module to test for the
182295e0246bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
182395e0246bSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1824cbc4e2beSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1825cbc4e2beSmrg# --with-asciidoc assumes 'auto'.
182695e0246bSmrg#
182795e0246bSmrg# Interface to module:
182895e0246bSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
182995e0246bSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
183095e0246bSmrg#		 returns the path set by the user in the environment
183195e0246bSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
183295e0246bSmrg#		  'no' user instructs the module not to use asciidoc
183395e0246bSmrg#
183495e0246bSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
183595e0246bSmrg#
183695e0246bSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
183795e0246bSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1838cbc4e2beSmrgm4_define([_defopt], m4_default([$2], [auto]))
183995e0246bSmrgAC_ARG_WITH(asciidoc,
184095e0246bSmrg	AS_HELP_STRING([--with-asciidoc],
1841cbc4e2beSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1842cbc4e2beSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1843cbc4e2beSmrgm4_undefine([_defopt])
184495e0246bSmrg
184595e0246bSmrgif test "x$use_asciidoc" = x"auto"; then
184695e0246bSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
184795e0246bSmrg   if test "x$ASCIIDOC" = "x"; then
184895e0246bSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
184995e0246bSmrg	have_asciidoc=no
185095e0246bSmrg   else
185195e0246bSmrg        have_asciidoc=yes
185295e0246bSmrg   fi
185395e0246bSmrgelif test "x$use_asciidoc" = x"yes" ; then
185495e0246bSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
185595e0246bSmrg   if test "x$ASCIIDOC" = "x"; then
185695e0246bSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
185795e0246bSmrg   fi
185895e0246bSmrg   have_asciidoc=yes
185995e0246bSmrgelif test "x$use_asciidoc" = x"no" ; then
186095e0246bSmrg   if test "x$ASCIIDOC" != "x"; then
186195e0246bSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
186295e0246bSmrg   fi
186395e0246bSmrg   have_asciidoc=no
186495e0246bSmrgelse
186595e0246bSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
186695e0246bSmrgfi
186795e0246bSmrgm4_ifval([$1],
186895e0246bSmrg[if test "$have_asciidoc" = yes; then
186995e0246bSmrg    # scrape the asciidoc version
187095e0246bSmrg    AC_MSG_CHECKING([the asciidoc version])
187195e0246bSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
187295e0246bSmrg    AC_MSG_RESULT([$asciidoc_version])
187395e0246bSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
187495e0246bSmrg        [if test "x$use_asciidoc" = xauto; then
187595e0246bSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
187695e0246bSmrg            have_asciidoc=no
187795e0246bSmrg        else
187895e0246bSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
187995e0246bSmrg        fi])
188095e0246bSmrgfi])
188195e0246bSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
188295e0246bSmrg]) # XORG_WITH_ASCIIDOC
188395e0246bSmrg
1884cbc4e2beSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
188595e0246bSmrg# --------------------------------
188695e0246bSmrg# Minimum version: 1.5.0
1887cbc4e2beSmrg# Minimum version for optional DEFAULT argument: 1.11.0
188895e0246bSmrg#
188995e0246bSmrg# Documentation tools are not always available on all platforms and sometimes
189095e0246bSmrg# not at the appropriate level. This macro enables a module to test for the
189195e0246bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
189295e0246bSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1893cbc4e2beSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1894cbc4e2beSmrg# --with-doxygen assumes 'auto'.
189595e0246bSmrg#
189695e0246bSmrg# Interface to module:
189795e0246bSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
189895e0246bSmrg# DOXYGEN:	 returns the path of the doxygen program found
189995e0246bSmrg#		 returns the path set by the user in the environment
190095e0246bSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
190195e0246bSmrg#		  'no' user instructs the module not to use doxygen
190295e0246bSmrg#
190395e0246bSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
190495e0246bSmrg#
190595e0246bSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
190695e0246bSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1907cbc4e2beSmrgm4_define([_defopt], m4_default([$2], [auto]))
190895e0246bSmrgAC_ARG_WITH(doxygen,
190995e0246bSmrg	AS_HELP_STRING([--with-doxygen],
1910cbc4e2beSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1911cbc4e2beSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1912cbc4e2beSmrgm4_undefine([_defopt])
191395e0246bSmrg
191495e0246bSmrgif test "x$use_doxygen" = x"auto"; then
191595e0246bSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
191695e0246bSmrg   if test "x$DOXYGEN" = "x"; then
191795e0246bSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
191895e0246bSmrg	have_doxygen=no
191995e0246bSmrg   else
192095e0246bSmrg        have_doxygen=yes
192195e0246bSmrg   fi
192295e0246bSmrgelif test "x$use_doxygen" = x"yes" ; then
192395e0246bSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
192495e0246bSmrg   if test "x$DOXYGEN" = "x"; then
192595e0246bSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
192695e0246bSmrg   fi
192795e0246bSmrg   have_doxygen=yes
192895e0246bSmrgelif test "x$use_doxygen" = x"no" ; then
192995e0246bSmrg   if test "x$DOXYGEN" != "x"; then
193095e0246bSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
193195e0246bSmrg   fi
193295e0246bSmrg   have_doxygen=no
193395e0246bSmrgelse
193495e0246bSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
193595e0246bSmrgfi
193695e0246bSmrgm4_ifval([$1],
193795e0246bSmrg[if test "$have_doxygen" = yes; then
193895e0246bSmrg    # scrape the doxygen version
193995e0246bSmrg    AC_MSG_CHECKING([the doxygen version])
194095e0246bSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
194195e0246bSmrg    AC_MSG_RESULT([$doxygen_version])
194295e0246bSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
194395e0246bSmrg        [if test "x$use_doxygen" = xauto; then
194495e0246bSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
194595e0246bSmrg            have_doxygen=no
194695e0246bSmrg        else
194795e0246bSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
194895e0246bSmrg        fi])
194995e0246bSmrgfi])
195095e0246bSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
195195e0246bSmrg]) # XORG_WITH_DOXYGEN
195295e0246bSmrg
1953cbc4e2beSmrg# XORG_WITH_GROFF([DEFAULT])
195495e0246bSmrg# ----------------
195595e0246bSmrg# Minimum version: 1.6.0
1956cbc4e2beSmrg# Minimum version for optional DEFAULT argument: 1.11.0
195795e0246bSmrg#
195895e0246bSmrg# Documentation tools are not always available on all platforms and sometimes
195995e0246bSmrg# not at the appropriate level. This macro enables a module to test for the
196095e0246bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
196195e0246bSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
1962cbc4e2beSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
1963cbc4e2beSmrg# --with-groff assumes 'auto'.
196495e0246bSmrg#
196595e0246bSmrg# Interface to module:
196695e0246bSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
196795e0246bSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
196895e0246bSmrg# HAVE_GROFF_MS: the -ms macros package
196995e0246bSmrg# GROFF:	 returns the path of the groff program found
197095e0246bSmrg#		 returns the path set by the user in the environment
197195e0246bSmrg# --with-groff:	 'yes' user instructs the module to use groff
197295e0246bSmrg#		 'no' user instructs the module not to use groff
197395e0246bSmrg#
197495e0246bSmrg# Added in version 1.9.0:
197595e0246bSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
197695e0246bSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
197795e0246bSmrg#		   psselect from the psutils package.
197895e0246bSmrg#		   the ghostcript package. Refer to the grohtml man pages
197995e0246bSmrg#
198095e0246bSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
198195e0246bSmrg#
198295e0246bSmrg# OS and distros often splits groff in a basic and full package, the former
198395e0246bSmrg# having the groff program and the later having devices, fonts and macros
198495e0246bSmrg# Checking for the groff executable is not enough.
198595e0246bSmrg#
198695e0246bSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
198795e0246bSmrg# unset HAVE_GROFF or GROFF env variables.
198895e0246bSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
198995e0246bSmrg#
199095e0246bSmrgAC_DEFUN([XORG_WITH_GROFF],[
199195e0246bSmrgAC_ARG_VAR([GROFF], [Path to groff command])
1992cbc4e2beSmrgm4_define([_defopt], m4_default([$1], [auto]))
199395e0246bSmrgAC_ARG_WITH(groff,
199495e0246bSmrg	AS_HELP_STRING([--with-groff],
1995cbc4e2beSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1996cbc4e2beSmrg	   [use_groff=$withval], [use_groff=]_defopt)
1997cbc4e2beSmrgm4_undefine([_defopt])
199895e0246bSmrg
199995e0246bSmrgif test "x$use_groff" = x"auto"; then
200095e0246bSmrg   AC_PATH_PROG([GROFF], [groff])
200195e0246bSmrg   if test "x$GROFF" = "x"; then
200295e0246bSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
200395e0246bSmrg	have_groff=no
200495e0246bSmrg   else
200595e0246bSmrg        have_groff=yes
200695e0246bSmrg   fi
200795e0246bSmrgelif test "x$use_groff" = x"yes" ; then
200895e0246bSmrg   AC_PATH_PROG([GROFF], [groff])
200995e0246bSmrg   if test "x$GROFF" = "x"; then
201095e0246bSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
201195e0246bSmrg   fi
201295e0246bSmrg   have_groff=yes
201395e0246bSmrgelif test "x$use_groff" = x"no" ; then
201495e0246bSmrg   if test "x$GROFF" != "x"; then
201595e0246bSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
201695e0246bSmrg   fi
201795e0246bSmrg   have_groff=no
201895e0246bSmrgelse
201995e0246bSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
202095e0246bSmrgfi
202195e0246bSmrg
202295e0246bSmrg# We have groff, test for the presence of the macro packages
202395e0246bSmrgif test "x$have_groff" = x"yes"; then
202495e0246bSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
202595e0246bSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
202695e0246bSmrg        groff_ms_works=yes
202795e0246bSmrg    else
202895e0246bSmrg        groff_ms_works=no
202995e0246bSmrg    fi
203095e0246bSmrg    AC_MSG_RESULT([$groff_ms_works])
203195e0246bSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
203295e0246bSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
203395e0246bSmrg        groff_mm_works=yes
203495e0246bSmrg    else
203595e0246bSmrg        groff_mm_works=no
203695e0246bSmrg    fi
203795e0246bSmrg    AC_MSG_RESULT([$groff_mm_works])
203895e0246bSmrgfi
203995e0246bSmrg
204095e0246bSmrg# We have groff, test for HTML dependencies, one command per package
204195e0246bSmrgif test "x$have_groff" = x"yes"; then
204295e0246bSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
204395e0246bSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
204495e0246bSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
204595e0246bSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
204695e0246bSmrg      have_groff_html=yes
204795e0246bSmrg   else
204895e0246bSmrg      have_groff_html=no
204995e0246bSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
205095e0246bSmrg   fi
205195e0246bSmrgfi
205295e0246bSmrg
205395e0246bSmrg# Set Automake conditionals for Makefiles
205495e0246bSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
205595e0246bSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
205695e0246bSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
205795e0246bSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
205895e0246bSmrg]) # XORG_WITH_GROFF
205995e0246bSmrg
2060cbc4e2beSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2061cbc4e2beSmrg# ---------------------------------------
206295e0246bSmrg# Minimum version: 1.6.0
2063cbc4e2beSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2064cbc4e2beSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
206595e0246bSmrg#
206695e0246bSmrg# Documentation tools are not always available on all platforms and sometimes
206795e0246bSmrg# not at the appropriate level. This macro enables a module to test for the
206895e0246bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
206995e0246bSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2070cbc4e2beSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2071cbc4e2beSmrg# --with-fop assumes 'auto'.
207295e0246bSmrg#
207395e0246bSmrg# Interface to module:
207495e0246bSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
207595e0246bSmrg# FOP:	 	returns the path of the fop program found
207695e0246bSmrg#		returns the path set by the user in the environment
207795e0246bSmrg# --with-fop: 	'yes' user instructs the module to use fop
207895e0246bSmrg#		'no' user instructs the module not to use fop
207995e0246bSmrg#
208095e0246bSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
208195e0246bSmrg#
208295e0246bSmrgAC_DEFUN([XORG_WITH_FOP],[
208395e0246bSmrgAC_ARG_VAR([FOP], [Path to fop command])
2084cbc4e2beSmrgm4_define([_defopt], m4_default([$2], [auto]))
208595e0246bSmrgAC_ARG_WITH(fop,
208695e0246bSmrg	AS_HELP_STRING([--with-fop],
2087cbc4e2beSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2088cbc4e2beSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2089cbc4e2beSmrgm4_undefine([_defopt])
209095e0246bSmrg
209195e0246bSmrgif test "x$use_fop" = x"auto"; then
209295e0246bSmrg   AC_PATH_PROG([FOP], [fop])
209395e0246bSmrg   if test "x$FOP" = "x"; then
209495e0246bSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
209595e0246bSmrg	have_fop=no
209695e0246bSmrg   else
209795e0246bSmrg        have_fop=yes
209895e0246bSmrg   fi
209995e0246bSmrgelif test "x$use_fop" = x"yes" ; then
210095e0246bSmrg   AC_PATH_PROG([FOP], [fop])
210195e0246bSmrg   if test "x$FOP" = "x"; then
210295e0246bSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
210395e0246bSmrg   fi
210495e0246bSmrg   have_fop=yes
210595e0246bSmrgelif test "x$use_fop" = x"no" ; then
210695e0246bSmrg   if test "x$FOP" != "x"; then
210795e0246bSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
210895e0246bSmrg   fi
210995e0246bSmrg   have_fop=no
211095e0246bSmrgelse
211195e0246bSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
211295e0246bSmrgfi
2113cbc4e2beSmrg
2114cbc4e2beSmrg# Test for a minimum version of fop, if provided.
2115cbc4e2beSmrgm4_ifval([$1],
2116cbc4e2beSmrg[if test "$have_fop" = yes; then
2117cbc4e2beSmrg    # scrape the fop version
2118cbc4e2beSmrg    AC_MSG_CHECKING([for fop minimum version])
2119cbc4e2beSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2120cbc4e2beSmrg    AC_MSG_RESULT([$fop_version])
2121cbc4e2beSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2122cbc4e2beSmrg        [if test "x$use_fop" = xauto; then
2123cbc4e2beSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2124cbc4e2beSmrg            have_fop=no
2125cbc4e2beSmrg        else
2126cbc4e2beSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2127cbc4e2beSmrg        fi])
2128cbc4e2beSmrgfi])
212995e0246bSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
213095e0246bSmrg]) # XORG_WITH_FOP
213195e0246bSmrg
2132cbc4e2beSmrg# XORG_WITH_PS2PDF([DEFAULT])
213395e0246bSmrg# ----------------
213495e0246bSmrg# Minimum version: 1.6.0
2135cbc4e2beSmrg# Minimum version for optional DEFAULT argument: 1.11.0
213695e0246bSmrg#
213795e0246bSmrg# Documentation tools are not always available on all platforms and sometimes
213895e0246bSmrg# not at the appropriate level. This macro enables a module to test for the
213995e0246bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
214095e0246bSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2141cbc4e2beSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2142cbc4e2beSmrg# --with-ps2pdf assumes 'auto'.
214395e0246bSmrg#
214495e0246bSmrg# Interface to module:
214595e0246bSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
214695e0246bSmrg# PS2PDF:	returns the path of the ps2pdf program found
214795e0246bSmrg#		returns the path set by the user in the environment
214895e0246bSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
214995e0246bSmrg#		 'no' user instructs the module not to use ps2pdf
215095e0246bSmrg#
215195e0246bSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
215295e0246bSmrg#
215395e0246bSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
215495e0246bSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2155cbc4e2beSmrgm4_define([_defopt], m4_default([$1], [auto]))
215695e0246bSmrgAC_ARG_WITH(ps2pdf,
215795e0246bSmrg	AS_HELP_STRING([--with-ps2pdf],
2158cbc4e2beSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2159cbc4e2beSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2160cbc4e2beSmrgm4_undefine([_defopt])
216195e0246bSmrg
216295e0246bSmrgif test "x$use_ps2pdf" = x"auto"; then
216395e0246bSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
216495e0246bSmrg   if test "x$PS2PDF" = "x"; then
216595e0246bSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
216695e0246bSmrg	have_ps2pdf=no
216795e0246bSmrg   else
216895e0246bSmrg        have_ps2pdf=yes
216995e0246bSmrg   fi
217095e0246bSmrgelif test "x$use_ps2pdf" = x"yes" ; then
217195e0246bSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
217295e0246bSmrg   if test "x$PS2PDF" = "x"; then
217395e0246bSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
217495e0246bSmrg   fi
217595e0246bSmrg   have_ps2pdf=yes
217695e0246bSmrgelif test "x$use_ps2pdf" = x"no" ; then
217795e0246bSmrg   if test "x$PS2PDF" != "x"; then
217895e0246bSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
217995e0246bSmrg   fi
218095e0246bSmrg   have_ps2pdf=no
218195e0246bSmrgelse
218295e0246bSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
218395e0246bSmrgfi
218495e0246bSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
218595e0246bSmrg]) # XORG_WITH_PS2PDF
218695e0246bSmrg
218795e0246bSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
218895e0246bSmrg# ----------------
218995e0246bSmrg# Minimum version: 1.6.0
219095e0246bSmrg#
219195e0246bSmrg# Documentation tools are not always available on all platforms and sometimes
219295e0246bSmrg# not at the appropriate level. This macro enables a builder to skip all
219395e0246bSmrg# documentation targets except traditional man pages.
219495e0246bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
219595e0246bSmrg# maximum flexibilty in controlling documentation building.
219695e0246bSmrg# Refer to:
219795e0246bSmrg# XORG_WITH_XMLTO         --with-xmlto
219895e0246bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
219995e0246bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
220095e0246bSmrg# XORG_WITH_FOP           --with-fop
220195e0246bSmrg# XORG_WITH_GROFF         --with-groff
220295e0246bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
220395e0246bSmrg#
220495e0246bSmrg# Interface to module:
220595e0246bSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
220695e0246bSmrg# --enable-docs: 'yes' user instructs the module to generate docs
220795e0246bSmrg#		 'no' user instructs the module not to generate docs
220895e0246bSmrg# parm1:	specify the default value, yes or no.
220995e0246bSmrg#
221095e0246bSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2211cbc4e2beSmrgm4_define([docs_default], m4_default([$1], [yes]))
221295e0246bSmrgAC_ARG_ENABLE(docs,
221395e0246bSmrg	AS_HELP_STRING([--enable-docs],
2214cbc4e2beSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2215cbc4e2beSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2216cbc4e2beSmrgm4_undefine([docs_default])
221795e0246bSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
221895e0246bSmrgAC_MSG_CHECKING([whether to build documentation])
221995e0246bSmrgAC_MSG_RESULT([$build_docs])
222095e0246bSmrg]) # XORG_ENABLE_DOCS
222195e0246bSmrg
222295e0246bSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
222395e0246bSmrg# ----------------
222495e0246bSmrg# Minimum version: 1.6.0
222595e0246bSmrg#
222695e0246bSmrg# This macro enables a builder to skip all developer documentation.
222795e0246bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
222895e0246bSmrg# maximum flexibilty in controlling documentation building.
222995e0246bSmrg# Refer to:
223095e0246bSmrg# XORG_WITH_XMLTO         --with-xmlto
223195e0246bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
223295e0246bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
223395e0246bSmrg# XORG_WITH_FOP           --with-fop
223495e0246bSmrg# XORG_WITH_GROFF         --with-groff
223595e0246bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
223695e0246bSmrg#
223795e0246bSmrg# Interface to module:
223895e0246bSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
223995e0246bSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
224095e0246bSmrg#			'no' user instructs the module not to generate developer docs
224195e0246bSmrg# parm1:		specify the default value, yes or no.
224295e0246bSmrg#
224395e0246bSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2244cbc4e2beSmrgm4_define([devel_default], m4_default([$1], [yes]))
224595e0246bSmrgAC_ARG_ENABLE(devel-docs,
224695e0246bSmrg	AS_HELP_STRING([--enable-devel-docs],
2247cbc4e2beSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2248cbc4e2beSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2249cbc4e2beSmrgm4_undefine([devel_default])
225095e0246bSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
225195e0246bSmrgAC_MSG_CHECKING([whether to build developer documentation])
225295e0246bSmrgAC_MSG_RESULT([$build_devel_docs])
225395e0246bSmrg]) # XORG_ENABLE_DEVEL_DOCS
225495e0246bSmrg
225595e0246bSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
225695e0246bSmrg# ----------------
225795e0246bSmrg# Minimum version: 1.6.0
225895e0246bSmrg#
225995e0246bSmrg# This macro enables a builder to skip all functional specification targets.
226095e0246bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
226195e0246bSmrg# maximum flexibilty in controlling documentation building.
226295e0246bSmrg# Refer to:
226395e0246bSmrg# XORG_WITH_XMLTO         --with-xmlto
226495e0246bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
226595e0246bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
226695e0246bSmrg# XORG_WITH_FOP           --with-fop
226795e0246bSmrg# XORG_WITH_GROFF         --with-groff
226895e0246bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
226995e0246bSmrg#
227095e0246bSmrg# Interface to module:
227195e0246bSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
227295e0246bSmrg# --enable-specs:	'yes' user instructs the module to generate specs
227395e0246bSmrg#			'no' user instructs the module not to generate specs
227495e0246bSmrg# parm1:		specify the default value, yes or no.
227595e0246bSmrg#
227695e0246bSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2277cbc4e2beSmrgm4_define([spec_default], m4_default([$1], [yes]))
227895e0246bSmrgAC_ARG_ENABLE(specs,
227995e0246bSmrg	AS_HELP_STRING([--enable-specs],
2280cbc4e2beSmrg	   [Enable building the specs (default: ]spec_default[)]),
2281cbc4e2beSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2282cbc4e2beSmrgm4_undefine([spec_default])
228395e0246bSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
228495e0246bSmrgAC_MSG_CHECKING([whether to build functional specifications])
228595e0246bSmrgAC_MSG_RESULT([$build_specs])
228695e0246bSmrg]) # XORG_ENABLE_SPECS
228795e0246bSmrg
2288cbc4e2beSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2289cbc4e2beSmrg# ----------------------------------------------
2290cbc4e2beSmrg# Minimum version: 1.13.0
2291cbc4e2beSmrg#
2292cbc4e2beSmrg# This macro enables a builder to enable/disable unit testing
2293cbc4e2beSmrg# It makes no assumption about the test cases implementation
2294cbc4e2beSmrg# Test cases may or may not use Automake "Support for test suites"
2295cbc4e2beSmrg# They may or may not use the software utility library GLib
2296cbc4e2beSmrg#
2297cbc4e2beSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2298cbc4e2beSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2299cbc4e2beSmrg# The variable enable_unit_tests is used by other macros in this file.
2300cbc4e2beSmrg#
2301cbc4e2beSmrg# Interface to module:
2302cbc4e2beSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2303cbc4e2beSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2304cbc4e2beSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2305cbc4e2beSmrg#			'no' user instructs the module not to build tests
2306cbc4e2beSmrg# parm1:		specify the default value, yes or no.
2307cbc4e2beSmrg#
2308cbc4e2beSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2309cbc4e2beSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2310cbc4e2beSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2311cbc4e2beSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2312cbc4e2beSmrgm4_define([_defopt], m4_default([$1], [auto]))
2313cbc4e2beSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2314cbc4e2beSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2315cbc4e2beSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2316cbc4e2beSmrgm4_undefine([_defopt])
2317cbc4e2beSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2318cbc4e2beSmrgAC_MSG_CHECKING([whether to build unit test cases])
2319cbc4e2beSmrgAC_MSG_RESULT([$enable_unit_tests])
2320cbc4e2beSmrg]) # XORG_ENABLE_UNIT_TESTS
2321cbc4e2beSmrg
2322cbc4e2beSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2323cbc4e2beSmrg# ------------------------------------------------------
2324cbc4e2beSmrg# Minimum version: 1.17.0
2325cbc4e2beSmrg#
2326cbc4e2beSmrg# This macro enables a builder to enable/disable integration testing
2327cbc4e2beSmrg# It makes no assumption about the test cases' implementation
2328cbc4e2beSmrg# Test cases may or may not use Automake "Support for test suites"
2329cbc4e2beSmrg#
2330cbc4e2beSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2331cbc4e2beSmrg# usually requires less dependencies and may be built and run under less
2332cbc4e2beSmrg# stringent environments than integration tests.
2333cbc4e2beSmrg#
2334cbc4e2beSmrg# Interface to module:
2335cbc4e2beSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2336cbc4e2beSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2337cbc4e2beSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2338cbc4e2beSmrg#                             'no' user instructs the module not to build tests
2339cbc4e2beSmrg# parm1:                      specify the default value, yes or no.
2340cbc4e2beSmrg#
2341cbc4e2beSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2342cbc4e2beSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2343cbc4e2beSmrgm4_define([_defopt], m4_default([$1], [auto]))
2344cbc4e2beSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2345cbc4e2beSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2346cbc4e2beSmrg	[enable_integration_tests=$enableval],
2347cbc4e2beSmrg	[enable_integration_tests=]_defopt)
2348cbc4e2beSmrgm4_undefine([_defopt])
2349cbc4e2beSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2350cbc4e2beSmrg	[test "x$enable_integration_tests" != xno])
2351cbc4e2beSmrgAC_MSG_CHECKING([whether to build unit test cases])
2352cbc4e2beSmrgAC_MSG_RESULT([$enable_integration_tests])
2353cbc4e2beSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2354cbc4e2beSmrg
2355cbc4e2beSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2356cbc4e2beSmrg# ----------------------------------------
2357cbc4e2beSmrg# Minimum version: 1.13.0
2358cbc4e2beSmrg#
2359cbc4e2beSmrg# GLib is a library which provides advanced data structures and functions.
2360cbc4e2beSmrg# This macro enables a module to test for the presence of Glib.
2361cbc4e2beSmrg#
2362cbc4e2beSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2363cbc4e2beSmrg# Otherwise the value of $enable_unit_tests is blank.
2364cbc4e2beSmrg#
2365cbc4e2beSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2366cbc4e2beSmrg# test support usually requires less dependencies and may be built and run under
2367cbc4e2beSmrg# less stringent environments than integration tests.
2368cbc4e2beSmrg#
2369cbc4e2beSmrg# Interface to module:
2370cbc4e2beSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2371cbc4e2beSmrg# with_glib: used in configure.ac to know if GLib has been found
2372cbc4e2beSmrg# --with-glib:	'yes' user instructs the module to use glib
2373cbc4e2beSmrg#		'no' user instructs the module not to use glib
2374cbc4e2beSmrg#
2375cbc4e2beSmrgAC_DEFUN([XORG_WITH_GLIB],[
2376cbc4e2beSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2377cbc4e2beSmrgm4_define([_defopt], m4_default([$2], [auto]))
2378cbc4e2beSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2379cbc4e2beSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2380cbc4e2beSmrg	[with_glib=$withval], [with_glib=]_defopt)
2381cbc4e2beSmrgm4_undefine([_defopt])
2382cbc4e2beSmrg
2383cbc4e2beSmrghave_glib=no
2384cbc4e2beSmrg# Do not probe GLib if user explicitly disabled unit testing
2385cbc4e2beSmrgif test "x$enable_unit_tests" != x"no"; then
2386cbc4e2beSmrg  # Do not probe GLib if user explicitly disabled it
2387cbc4e2beSmrg  if test "x$with_glib" != x"no"; then
2388cbc4e2beSmrg    m4_ifval(
2389cbc4e2beSmrg      [$1],
2390cbc4e2beSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2391cbc4e2beSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2392cbc4e2beSmrg    )
2393cbc4e2beSmrg  fi
2394cbc4e2beSmrgfi
2395cbc4e2beSmrg
2396cbc4e2beSmrg# Not having GLib when unit testing has been explicitly requested is an error
2397cbc4e2beSmrgif test "x$enable_unit_tests" = x"yes"; then
2398cbc4e2beSmrg  if test "x$have_glib" = x"no"; then
2399cbc4e2beSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2400cbc4e2beSmrg  fi
2401cbc4e2beSmrgfi
2402cbc4e2beSmrg
2403cbc4e2beSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2404cbc4e2beSmrgif test "x$enable_unit_tests" = x"no"; then
2405cbc4e2beSmrg  if test "x$with_glib" = x"yes"; then
2406cbc4e2beSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2407cbc4e2beSmrg  fi
2408cbc4e2beSmrgfi
2409cbc4e2beSmrg
2410cbc4e2beSmrg# Not having GLib when it has been explicitly requested is an error
2411cbc4e2beSmrgif test "x$with_glib" = x"yes"; then
2412cbc4e2beSmrg  if test "x$have_glib" = x"no"; then
2413cbc4e2beSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2414cbc4e2beSmrg  fi
2415cbc4e2beSmrgfi
2416cbc4e2beSmrg
2417cbc4e2beSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2418cbc4e2beSmrg]) # XORG_WITH_GLIB
2419cbc4e2beSmrg
2420cbc4e2beSmrg# XORG_LD_WRAP([required|optional])
2421cbc4e2beSmrg# ---------------------------------
2422cbc4e2beSmrg# Minimum version: 1.13.0
2423cbc4e2beSmrg#
2424cbc4e2beSmrg# Check if linker supports -wrap, passed via compiler flags
2425cbc4e2beSmrg#
2426cbc4e2beSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2427cbc4e2beSmrg# Otherwise the value of $enable_unit_tests is blank.
2428cbc4e2beSmrg#
2429cbc4e2beSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2430cbc4e2beSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2431cbc4e2beSmrg# available, an argument of "optional" allows use when some unit tests require
2432cbc4e2beSmrg# ld -wrap and others do not.
2433cbc4e2beSmrg#
2434cbc4e2beSmrgAC_DEFUN([XORG_LD_WRAP],[
2435cbc4e2beSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2436cbc4e2beSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2437cbc4e2beSmrg                      void __wrap_exit(int status) { return; }],
2438cbc4e2beSmrg                     [exit(0);])])
2439cbc4e2beSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2440cbc4e2beSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2441cbc4e2beSmrg  if test "x$have_ld_wrap" = x"no"; then
2442cbc4e2beSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2443cbc4e2beSmrg  fi
2444cbc4e2beSmrgfi
2445cbc4e2beSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2446cbc4e2beSmrg#
2447cbc4e2beSmrg]) # XORG_LD_WRAP
2448cbc4e2beSmrg
2449cbc4e2beSmrg# XORG_CHECK_LINKER_FLAGS
2450cbc4e2beSmrg# -----------------------
2451cbc4e2beSmrg# SYNOPSIS
2452cbc4e2beSmrg#
2453cbc4e2beSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2454cbc4e2beSmrg#
2455cbc4e2beSmrg# DESCRIPTION
2456cbc4e2beSmrg#
2457cbc4e2beSmrg#   Check whether the given linker FLAGS work with the current language's
2458cbc4e2beSmrg#   linker, or whether they give an error.
2459cbc4e2beSmrg#
2460cbc4e2beSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2461cbc4e2beSmrg#   success/failure.
2462cbc4e2beSmrg#
2463cbc4e2beSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2464cbc4e2beSmrg#
2465cbc4e2beSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2466cbc4e2beSmrg#
2467cbc4e2beSmrg# LICENSE
2468cbc4e2beSmrg#
2469cbc4e2beSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2470cbc4e2beSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2471cbc4e2beSmrg#   Copyright (c) 2009 Matteo Frigo
2472cbc4e2beSmrg#
2473cbc4e2beSmrg#   This program is free software: you can redistribute it and/or modify it
2474cbc4e2beSmrg#   under the terms of the GNU General Public License as published by the
2475cbc4e2beSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2476cbc4e2beSmrg#   option) any later version.
2477cbc4e2beSmrg#
2478cbc4e2beSmrg#   This program is distributed in the hope that it will be useful, but
2479cbc4e2beSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2480cbc4e2beSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2481cbc4e2beSmrg#   Public License for more details.
2482cbc4e2beSmrg#
2483cbc4e2beSmrg#   You should have received a copy of the GNU General Public License along
2484cbc4e2beSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2485cbc4e2beSmrg#
2486cbc4e2beSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2487cbc4e2beSmrg#   gives unlimited permission to copy, distribute and modify the configure
2488cbc4e2beSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2489cbc4e2beSmrg#   need not follow the terms of the GNU General Public License when using
2490cbc4e2beSmrg#   or distributing such scripts, even though portions of the text of the
2491cbc4e2beSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2492cbc4e2beSmrg#   all other use of the material that constitutes the Autoconf Macro.
2493cbc4e2beSmrg#
2494cbc4e2beSmrg#   This special exception to the GPL applies to versions of the Autoconf
2495cbc4e2beSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2496cbc4e2beSmrg#   modified version of the Autoconf Macro, you may extend this special
2497cbc4e2beSmrg#   exception to the GPL to apply to your modified version as well.#
2498cbc4e2beSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2499cbc4e2beSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2500cbc4e2beSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2501cbc4e2beSmrgAS_LITERAL_IF([$1],
2502cbc4e2beSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2503cbc4e2beSmrg      ax_save_FLAGS=$LDFLAGS
2504cbc4e2beSmrg      LDFLAGS="$1"
2505cbc4e2beSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2506cbc4e2beSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2507cbc4e2beSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2508cbc4e2beSmrg      LDFLAGS=$ax_save_FLAGS])],
2509cbc4e2beSmrg  [ax_save_FLAGS=$LDFLAGS
2510cbc4e2beSmrg   LDFLAGS="$1"
2511cbc4e2beSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2512cbc4e2beSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2513cbc4e2beSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2514cbc4e2beSmrg   LDFLAGS=$ax_save_FLAGS])
2515cbc4e2beSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2516cbc4e2beSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2517cbc4e2beSmrgif test "x$xorg_check_linker_flags" = xyes; then
2518cbc4e2beSmrg	m4_default([$2], :)
2519cbc4e2beSmrgelse
2520cbc4e2beSmrg	m4_default([$3], :)
2521cbc4e2beSmrgfi
2522cbc4e2beSmrg]) # XORG_CHECK_LINKER_FLAGS
2523cbc4e2beSmrg
2524cbc4e2beSmrg# XORG_MEMORY_CHECK_FLAGS
2525cbc4e2beSmrg# -----------------------
2526cbc4e2beSmrg# Minimum version: 1.16.0
2527cbc4e2beSmrg#
2528cbc4e2beSmrg# This macro attempts to find appropriate memory checking functionality
2529cbc4e2beSmrg# for various platforms which unit testing code may use to catch various
2530cbc4e2beSmrg# forms of memory allocation and access errors in testing.
2531cbc4e2beSmrg#
2532cbc4e2beSmrg# Interface to module:
2533cbc4e2beSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2534cbc4e2beSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2535cbc4e2beSmrg#
2536cbc4e2beSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2537cbc4e2beSmrg#
2538cbc4e2beSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2539cbc4e2beSmrg
2540cbc4e2beSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2541cbc4e2beSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2542cbc4e2beSmrg           [Environment variables to enable memory checking in tests])
2543cbc4e2beSmrg
2544cbc4e2beSmrg# Check for different types of support on different platforms
2545cbc4e2beSmrgcase $host_os in
2546cbc4e2beSmrg    solaris*)
2547cbc4e2beSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2548cbc4e2beSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2549cbc4e2beSmrg        ;;
2550cbc4e2beSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2551cbc4e2beSmrg        # both directly and inverted, so should not be 0 or 255.
2552cbc4e2beSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2553cbc4e2beSmrg        ;;
2554cbc4e2beSmrg    darwin*)
2555cbc4e2beSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2556cbc4e2beSmrg        ;;
2557cbc4e2beSmrg    *bsd*)
2558cbc4e2beSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2559cbc4e2beSmrg        ;;
2560cbc4e2beSmrgesac
2561cbc4e2beSmrg
2562cbc4e2beSmrg# User supplied flags override default flags
2563cbc4e2beSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2564cbc4e2beSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2565cbc4e2beSmrgfi
2566cbc4e2beSmrg
2567cbc4e2beSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2568cbc4e2beSmrg]) # XORG_WITH_LINT
2569cbc4e2beSmrg
2570eaef79e5Smrg# XORG_CHECK_MALLOC_ZERO
2571eaef79e5Smrg# ----------------------
2572eaef79e5Smrg# Minimum version: 1.0.0
2573eaef79e5Smrg#
2574eaef79e5Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2575eaef79e5Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2576eaef79e5Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2577eaef79e5SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2578eaef79e5SmrgAC_ARG_ENABLE(malloc0returnsnull,
25792b32c8f7Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2580eaef79e5Smrg		       [malloc(0) returns NULL (default: auto)]),
2581eaef79e5Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2582eaef79e5Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2583eaef79e5Smrg
2584eaef79e5SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2585eaef79e5Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2586cbc4e2beSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2587cbc4e2beSmrg#include <stdlib.h>
2588cbc4e2beSmrg],[
2589eaef79e5Smrg    char *m0, *r0, *c0, *p;
2590eaef79e5Smrg    m0 = malloc(0);
2591eaef79e5Smrg    p = malloc(10);
2592eaef79e5Smrg    r0 = realloc(p,0);
2593cbc4e2beSmrg    c0 = calloc(0,10);
2594cbc4e2beSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2595cbc4e2beSmrg])],
2596eaef79e5Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
259795e0246bSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
259895e0246bSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2599eaef79e5Smrgfi
2600eaef79e5SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2601eaef79e5Smrg
2602eaef79e5Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2603eaef79e5Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2604eaef79e5Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2605eaef79e5Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2606eaef79e5Smrgelse
2607eaef79e5Smrg	MALLOC_ZERO_CFLAGS=""
2608eaef79e5Smrg	XMALLOC_ZERO_CFLAGS=""
2609eaef79e5Smrg	XTMALLOC_ZERO_CFLAGS=""
2610eaef79e5Smrgfi
2611eaef79e5Smrg
2612eaef79e5SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2613eaef79e5SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2614eaef79e5SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2615eaef79e5Smrg]) # XORG_CHECK_MALLOC_ZERO
2616eaef79e5Smrg
2617eaef79e5Smrg# XORG_WITH_LINT()
2618eaef79e5Smrg# ----------------
2619eaef79e5Smrg# Minimum version: 1.1.0
2620eaef79e5Smrg#
262195e0246bSmrg# This macro enables the use of a tool that flags some suspicious and
262295e0246bSmrg# non-portable constructs (likely to be bugs) in C language source code.
262395e0246bSmrg# It will attempt to locate the tool and use appropriate options.
262495e0246bSmrg# There are various lint type tools on different platforms.
262595e0246bSmrg#
262695e0246bSmrg# Interface to module:
262795e0246bSmrg# LINT:		returns the path to the tool found on the platform
262895e0246bSmrg#		or the value set to LINT on the configure cmd line
262995e0246bSmrg#		also an Automake conditional
263095e0246bSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
263195e0246bSmrg#
263295e0246bSmrg# --with-lint:	'yes' user instructs the module to use lint
263395e0246bSmrg#		'no' user instructs the module not to use lint (default)
263495e0246bSmrg#
263595e0246bSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
263695e0246bSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2637eaef79e5Smrg#
2638eaef79e5SmrgAC_DEFUN([XORG_WITH_LINT],[
2639eaef79e5Smrg
264095e0246bSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
264195e0246bSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
26422b32c8f7SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2643eaef79e5Smrg		[Use a lint-style source code checker (default: disabled)])],
2644eaef79e5Smrg		[use_lint=$withval], [use_lint=no])
264595e0246bSmrg
264695e0246bSmrg# Obtain platform specific info like program name and options
264795e0246bSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
264895e0246bSmrgcase $host_os in
264995e0246bSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
265095e0246bSmrg	lint_name=splint
265195e0246bSmrg	lint_options="-badflag"
265295e0246bSmrg	;;
265395e0246bSmrg  *freebsd* | *netbsd*)
265495e0246bSmrg	lint_name=lint
265595e0246bSmrg	lint_options="-u -b"
265695e0246bSmrg	;;
265795e0246bSmrg  *solaris*)
265895e0246bSmrg	lint_name=lint
265995e0246bSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
266095e0246bSmrg	;;
266195e0246bSmrgesac
266295e0246bSmrg
266395e0246bSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
266495e0246bSmrgif test "x$use_lint" = x"yes" ; then
266595e0246bSmrg   AC_PATH_PROG([LINT], [$lint_name])
266695e0246bSmrg   if test "x$LINT" = "x"; then
266795e0246bSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
266895e0246bSmrg   fi
266995e0246bSmrgelif test "x$use_lint" = x"no" ; then
267095e0246bSmrg   if test "x$LINT" != "x"; then
267195e0246bSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
267295e0246bSmrg   fi
2673eaef79e5Smrgelse
267495e0246bSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2675eaef79e5Smrgfi
267695e0246bSmrg
267795e0246bSmrg# User supplied flags override default flags
267895e0246bSmrgif test "x$LINT_FLAGS" != "x"; then
267995e0246bSmrg   lint_options=$LINT_FLAGS
2680eaef79e5Smrgfi
2681eaef79e5Smrg
268295e0246bSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
268395e0246bSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2684eaef79e5Smrg
2685eaef79e5Smrg]) # XORG_WITH_LINT
2686eaef79e5Smrg
2687eaef79e5Smrg# XORG_LINT_LIBRARY(LIBNAME)
2688eaef79e5Smrg# --------------------------
2689eaef79e5Smrg# Minimum version: 1.1.0
2690eaef79e5Smrg#
2691eaef79e5Smrg# Sets up flags for building lint libraries for checking programs that call
2692eaef79e5Smrg# functions in the library.
2693eaef79e5Smrg#
269495e0246bSmrg# Interface to module:
269595e0246bSmrg# LINTLIB		- Automake variable with the name of lint library file to make
269695e0246bSmrg# MAKE_LINT_LIB		- Automake conditional
269795e0246bSmrg#
269895e0246bSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
269995e0246bSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2700eaef79e5Smrg
2701eaef79e5SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2702eaef79e5SmrgAC_REQUIRE([XORG_WITH_LINT])
27032b32c8f7SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2704eaef79e5Smrg	[Create lint library (default: disabled)])],
2705eaef79e5Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
270695e0246bSmrg
270795e0246bSmrgif test "x$make_lint_lib" = x"yes" ; then
270895e0246bSmrg   LINTLIB=llib-l$1.ln
270995e0246bSmrg   if test "x$LINT" = "x"; then
271095e0246bSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
271195e0246bSmrg   fi
271295e0246bSmrgelif test "x$make_lint_lib" != x"no" ; then
271395e0246bSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2714eaef79e5Smrgfi
271595e0246bSmrg
2716eaef79e5SmrgAC_SUBST(LINTLIB)
2717eaef79e5SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2718eaef79e5Smrg
2719eaef79e5Smrg]) # XORG_LINT_LIBRARY
2720eaef79e5Smrg
2721cbc4e2beSmrg# XORG_COMPILER_BRAND
2722cbc4e2beSmrg# -------------------
2723cbc4e2beSmrg# Minimum version: 1.14.0
2724cbc4e2beSmrg#
2725cbc4e2beSmrg# Checks for various brands of compilers and sets flags as appropriate:
2726cbc4e2beSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2727cbc4e2beSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2728cbc4e2beSmrg#   clang compiler - sets CLANGCC to "yes"
2729cbc4e2beSmrg#   Intel compiler - sets INTELCC to "yes"
2730cbc4e2beSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2731cbc4e2beSmrg#
2732cbc4e2beSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2733cbc4e2beSmrgAC_LANG_CASE(
2734cbc4e2beSmrg	[C], [
2735cbc4e2beSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2736cbc4e2beSmrg	],
2737cbc4e2beSmrg	[C++], [
2738cbc4e2beSmrg		AC_REQUIRE([AC_PROG_CXX])
2739cbc4e2beSmrg	]
2740cbc4e2beSmrg)
2741cbc4e2beSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2742cbc4e2beSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2743cbc4e2beSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2744cbc4e2beSmrg]) # XORG_COMPILER_BRAND
2745cbc4e2beSmrg
2746cbc4e2beSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2747cbc4e2beSmrg# ---------------
2748cbc4e2beSmrg# Minimum version: 1.16.0
2749cbc4e2beSmrg#
2750cbc4e2beSmrg# Test if the compiler works when passed the given flag as a command line argument.
2751cbc4e2beSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2752cbc4e2beSmrg# next flag in the list until there are no more options.
2753cbc4e2beSmrg#
2754cbc4e2beSmrg# Note that this does not guarantee that the compiler supports the flag as some
2755cbc4e2beSmrg# compilers will simply ignore arguments that they do not understand, but we do
2756cbc4e2beSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2757cbc4e2beSmrg# -Werror=unused-command-line-argument
2758cbc4e2beSmrg#
2759cbc4e2beSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2760cbc4e2beSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2761cbc4e2beSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2762cbc4e2beSmrg
2763cbc4e2beSmrgAC_LANG_COMPILER_REQUIRE
2764cbc4e2beSmrg
2765cbc4e2beSmrgAC_LANG_CASE(
2766cbc4e2beSmrg	[C], [
2767cbc4e2beSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2768cbc4e2beSmrg		define([PREFIX], [C])
2769cbc4e2beSmrg		define([CACHE_PREFIX], [cc])
2770cbc4e2beSmrg		define([COMPILER], [$CC])
2771cbc4e2beSmrg	],
2772cbc4e2beSmrg	[C++], [
2773cbc4e2beSmrg		define([PREFIX], [CXX])
2774cbc4e2beSmrg		define([CACHE_PREFIX], [cxx])
2775cbc4e2beSmrg		define([COMPILER], [$CXX])
2776cbc4e2beSmrg	]
2777cbc4e2beSmrg)
2778cbc4e2beSmrg
2779cbc4e2beSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2780cbc4e2beSmrg
2781cbc4e2beSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2782cbc4e2beSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2783cbc4e2beSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2784cbc4e2beSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2785cbc4e2beSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2786cbc4e2beSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2787cbc4e2beSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2788cbc4e2beSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2789cbc4e2beSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2790cbc4e2beSmrgfi
2791cbc4e2beSmrg
2792cbc4e2beSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2793cbc4e2beSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2794cbc4e2beSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2795cbc4e2beSmrg	fi
2796cbc4e2beSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2797cbc4e2beSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2798cbc4e2beSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2799cbc4e2beSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2800cbc4e2beSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2801cbc4e2beSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2802cbc4e2beSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2803cbc4e2beSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2804cbc4e2beSmrgfi
2805cbc4e2beSmrg
2806cbc4e2beSmrgfound="no"
2807cbc4e2beSmrgm4_foreach([flag], m4_cdr($@), [
2808cbc4e2beSmrg	if test $found = "no" ; then
2809cbc4e2beSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2810cbc4e2beSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2811cbc4e2beSmrg		fi
2812cbc4e2beSmrg
2813cbc4e2beSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2814cbc4e2beSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2815cbc4e2beSmrg		fi
2816cbc4e2beSmrg
2817cbc4e2beSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2818cbc4e2beSmrg
2819cbc4e2beSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2820cbc4e2beSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2821cbc4e2beSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2822cbc4e2beSmrg		AC_CACHE_VAL($cacheid,
2823cbc4e2beSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2824cbc4e2beSmrg					     [eval $cacheid=yes],
2825cbc4e2beSmrg					     [eval $cacheid=no])])
2826cbc4e2beSmrg
2827cbc4e2beSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2828cbc4e2beSmrg
2829cbc4e2beSmrg		eval supported=\$$cacheid
2830cbc4e2beSmrg		AC_MSG_RESULT([$supported])
2831cbc4e2beSmrg		if test "$supported" = "yes" ; then
2832cbc4e2beSmrg			$1="$$1 ]flag["
2833cbc4e2beSmrg			found="yes"
2834cbc4e2beSmrg		fi
2835cbc4e2beSmrg	fi
2836cbc4e2beSmrg])
2837cbc4e2beSmrg]) # XORG_TESTSET_CFLAG
2838cbc4e2beSmrg
2839cbc4e2beSmrg# XORG_COMPILER_FLAGS
2840cbc4e2beSmrg# ---------------
2841cbc4e2beSmrg# Minimum version: 1.16.0
2842cbc4e2beSmrg#
2843cbc4e2beSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2844cbc4e2beSmrg# arguments supported by the selected compiler which do NOT alter the generated
2845cbc4e2beSmrg# code.  These arguments will cause the compiler to print various warnings
2846cbc4e2beSmrg# during compilation AND turn a conservative set of warnings into errors.
2847cbc4e2beSmrg#
2848cbc4e2beSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2849cbc4e2beSmrg# future versions of util-macros as options are added to new compilers.
2850cbc4e2beSmrg#
2851cbc4e2beSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2852cbc4e2beSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2853cbc4e2beSmrg
2854cbc4e2beSmrgAC_ARG_ENABLE(selective-werror,
2855cbc4e2beSmrg              AS_HELP_STRING([--disable-selective-werror],
2856cbc4e2beSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2857cbc4e2beSmrg              [SELECTIVE_WERROR=$enableval],
2858cbc4e2beSmrg              [SELECTIVE_WERROR=yes])
2859cbc4e2beSmrg
2860cbc4e2beSmrgAC_LANG_CASE(
2861cbc4e2beSmrg        [C], [
2862cbc4e2beSmrg                define([PREFIX], [C])
2863cbc4e2beSmrg        ],
2864cbc4e2beSmrg        [C++], [
2865cbc4e2beSmrg                define([PREFIX], [CXX])
2866cbc4e2beSmrg        ]
2867cbc4e2beSmrg)
2868cbc4e2beSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2869cbc4e2beSmrgif test "x$SUNCC" = "xyes"; then
2870cbc4e2beSmrg    [BASE_]PREFIX[FLAGS]="-v"
2871cbc4e2beSmrgelse
2872cbc4e2beSmrg    [BASE_]PREFIX[FLAGS]=""
2873cbc4e2beSmrgfi
2874cbc4e2beSmrg
2875cbc4e2beSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2876cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2877cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2878cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2879cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2880cbc4e2beSmrg
2881cbc4e2beSmrgAC_LANG_CASE(
2882cbc4e2beSmrg	[C], [
2883cbc4e2beSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2884cbc4e2beSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2885cbc4e2beSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2886cbc4e2beSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2887cbc4e2beSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2888cbc4e2beSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2889cbc4e2beSmrg	]
2890cbc4e2beSmrg)
2891cbc4e2beSmrg
2892cbc4e2beSmrg# This chunk adds additional warnings that could catch undesired effects.
2893cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2894cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2895cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2896cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2897cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2898cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2899cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2900cbc4e2beSmrg
2901cbc4e2beSmrg# These are currently disabled because they are noisy.  They will be enabled
2902cbc4e2beSmrg# in the future once the codebase is sufficiently modernized to silence
2903cbc4e2beSmrg# them.  For now, I don't want them to drown out the other warnings.
2904cbc4e2beSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2905cbc4e2beSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2906cbc4e2beSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2907cbc4e2beSmrg
2908cbc4e2beSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2909cbc4e2beSmrg# when there are problems that should be fixed.
2910cbc4e2beSmrg
2911cbc4e2beSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2912cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2913cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2914cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2915cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2916cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2917cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2918cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2919cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2920cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2921cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2922cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2923cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2924cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2925cbc4e2beSmrgelse
2926cbc4e2beSmrgAC_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])
2927cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2928cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2929cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2930cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2931cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2932cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2933cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2934cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2935cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2936cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2937cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2938cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2939cbc4e2beSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2940cbc4e2beSmrgfi
2941cbc4e2beSmrg
2942cbc4e2beSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2943cbc4e2beSmrg]) # XORG_COMPILER_FLAGS
2944cbc4e2beSmrg
29452b32c8f7Smrg# XORG_CWARNFLAGS
29462b32c8f7Smrg# ---------------
29472b32c8f7Smrg# Minimum version: 1.2.0
2948cbc4e2beSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
29492b32c8f7Smrg#
29502b32c8f7Smrg# Defines CWARNFLAGS to enable C compiler warnings.
29512b32c8f7Smrg#
2952cbc4e2beSmrg# This function is deprecated because it defines -fno-strict-aliasing
2953cbc4e2beSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2954cbc4e2beSmrg# is needed, then it should be added explicitly in the module when
2955cbc4e2beSmrg# it is updated to use BASE_CFLAGS.
2956cbc4e2beSmrg#
29572b32c8f7SmrgAC_DEFUN([XORG_CWARNFLAGS], [
2958cbc4e2beSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2959cbc4e2beSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2960cbc4e2beSmrgAC_LANG_CASE(
2961cbc4e2beSmrg	[C], [
2962cbc4e2beSmrg		CWARNFLAGS="$BASE_CFLAGS"
2963cbc4e2beSmrg		if  test "x$GCC" = xyes ; then
2964cbc4e2beSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2965cbc4e2beSmrg		fi
2966cbc4e2beSmrg		AC_SUBST(CWARNFLAGS)
2967cbc4e2beSmrg	]
2968cbc4e2beSmrg)
29692b32c8f7Smrg]) # XORG_CWARNFLAGS
29702b32c8f7Smrg
29712b32c8f7Smrg# XORG_STRICT_OPTION
29722b32c8f7Smrg# -----------------------
29732b32c8f7Smrg# Minimum version: 1.3.0
29742b32c8f7Smrg#
2975cbc4e2beSmrg# Add configure option to enable strict compilation flags, such as treating
2976cbc4e2beSmrg# warnings as fatal errors.
2977cbc4e2beSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2978cbc4e2beSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2979cbc4e2beSmrg#
2980cbc4e2beSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2981cbc4e2beSmrg# when strict compilation is unconditionally desired.
29822b32c8f7SmrgAC_DEFUN([XORG_STRICT_OPTION], [
29832b32c8f7SmrgAC_REQUIRE([XORG_CWARNFLAGS])
2984cbc4e2beSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
29852b32c8f7Smrg
29862b32c8f7SmrgAC_ARG_ENABLE(strict-compilation,
29872b32c8f7Smrg			  AS_HELP_STRING([--enable-strict-compilation],
29882b32c8f7Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
29892b32c8f7Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2990cbc4e2beSmrg
2991cbc4e2beSmrgAC_LANG_CASE(
2992cbc4e2beSmrg        [C], [
2993cbc4e2beSmrg                define([PREFIX], [C])
2994cbc4e2beSmrg        ],
2995cbc4e2beSmrg        [C++], [
2996cbc4e2beSmrg                define([PREFIX], [CXX])
2997cbc4e2beSmrg        ]
2998cbc4e2beSmrg)
2999cbc4e2beSmrg
3000cbc4e2beSmrg[STRICT_]PREFIX[FLAGS]=""
3001cbc4e2beSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3002cbc4e2beSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3003cbc4e2beSmrg
3004cbc4e2beSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3005cbc4e2beSmrg# activate it with -Werror, so we add it here explicitly.
3006cbc4e2beSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3007cbc4e2beSmrg
30082b32c8f7Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3009cbc4e2beSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3010cbc4e2beSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
30112b32c8f7Smrgfi
3012cbc4e2beSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3013cbc4e2beSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3014cbc4e2beSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
30152b32c8f7Smrg]) # XORG_STRICT_OPTION
30162b32c8f7Smrg
30172b32c8f7Smrg# XORG_DEFAULT_OPTIONS
30182b32c8f7Smrg# --------------------
30192b32c8f7Smrg# Minimum version: 1.3.0
30202b32c8f7Smrg#
30212b32c8f7Smrg# Defines default options for X.Org modules.
30222b32c8f7Smrg#
30232b32c8f7SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
302495e0246bSmrgAC_REQUIRE([AC_PROG_INSTALL])
3025cbc4e2beSmrgXORG_COMPILER_FLAGS
30262b32c8f7SmrgXORG_CWARNFLAGS
30272b32c8f7SmrgXORG_STRICT_OPTION
30282b32c8f7SmrgXORG_RELEASE_VERSION
30292b32c8f7SmrgXORG_CHANGELOG
303095e0246bSmrgXORG_INSTALL
30312b32c8f7SmrgXORG_MANPAGE_SECTIONS
303295e0246bSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
303395e0246bSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
30342b32c8f7Smrg]) # XORG_DEFAULT_OPTIONS
303595e0246bSmrg
303695e0246bSmrg# XORG_INSTALL()
303795e0246bSmrg# ----------------
303895e0246bSmrg# Minimum version: 1.4.0
303995e0246bSmrg#
304095e0246bSmrg# Defines the variable INSTALL_CMD as the command to copy
304195e0246bSmrg# INSTALL from $prefix/share/util-macros.
304295e0246bSmrg#
304395e0246bSmrgAC_DEFUN([XORG_INSTALL], [
304495e0246bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
304595e0246bSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
304695e0246bSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
304795e0246bSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
304895e0246bSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
304995e0246bSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
305095e0246bSmrgAC_SUBST([INSTALL_CMD])
305195e0246bSmrg]) # XORG_INSTALL
3052eaef79e5Smrgdnl Copyright 2005 Red Hat, Inc
3053eaef79e5Smrgdnl
3054eaef79e5Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3055eaef79e5Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3056eaef79e5Smrgdnl the above copyright notice appear in all copies and that both that
3057eaef79e5Smrgdnl copyright notice and this permission notice appear in supporting
3058eaef79e5Smrgdnl documentation.
3059eaef79e5Smrgdnl
3060eaef79e5Smrgdnl The above copyright notice and this permission notice shall be included
3061eaef79e5Smrgdnl in all copies or substantial portions of the Software.
3062eaef79e5Smrgdnl
3063eaef79e5Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3064eaef79e5Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3065eaef79e5Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3066eaef79e5Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3067eaef79e5Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3068eaef79e5Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3069eaef79e5Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3070eaef79e5Smrgdnl
3071eaef79e5Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3072eaef79e5Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3073eaef79e5Smrgdnl other dealings in this Software without prior written authorization
3074eaef79e5Smrgdnl from the copyright holders.
3075eaef79e5Smrgdnl
3076eaef79e5Smrg
3077eaef79e5Smrg# XORG_RELEASE_VERSION
3078eaef79e5Smrg# --------------------
307995e0246bSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3080eaef79e5Smrg 
3081eaef79e5SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3082eaef79e5Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3083eaef79e5Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3084eaef79e5Smrg		[Major version of this package])
30852b32c8f7Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3086eaef79e5Smrg	if test "x$PVM" = "x"; then
3087eaef79e5Smrg		PVM="0"
3088eaef79e5Smrg	fi
3089eaef79e5Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3090eaef79e5Smrg		[$PVM],
3091eaef79e5Smrg		[Minor version of this package])
30922b32c8f7Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3093eaef79e5Smrg	if test "x$PVP" = "x"; then
3094eaef79e5Smrg		PVP="0"
3095eaef79e5Smrg	fi
3096eaef79e5Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3097eaef79e5Smrg		[$PVP],
3098eaef79e5Smrg		[Patch version of this package])
3099eaef79e5Smrg])
3100eaef79e5Smrg
31012b32c8f7Smrg# XORG_CHANGELOG()
31022b32c8f7Smrg# ----------------
31032b32c8f7Smrg# Minimum version: 1.2.0
31042b32c8f7Smrg#
31052b32c8f7Smrg# Defines the variable CHANGELOG_CMD as the command to generate
31062b32c8f7Smrg# ChangeLog from git.
31072b32c8f7Smrg#
31082b32c8f7Smrg#
31092b32c8f7SmrgAC_DEFUN([XORG_CHANGELOG], [
311095e0246bSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
311195e0246bSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
311295e0246bSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
31132b32c8f7Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
31142b32c8f7SmrgAC_SUBST([CHANGELOG_CMD])
31152b32c8f7Smrg]) # XORG_CHANGELOG
31162b32c8f7Smrg
3117