aclocal.m4 revision 8832ea4a
18832ea4aSmrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
28e4923e5Smrg
38832ea4aSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4b8f75c19Smrg
5b8f75c19Smrg# This file is free software; the Free Software Foundation
6b8f75c19Smrg# gives unlimited permission to copy and/or distribute it,
7b8f75c19Smrg# with or without modifications, as long as this notice is preserved.
8b8f75c19Smrg
9b8f75c19Smrg# This program is distributed in the hope that it will be useful,
10b8f75c19Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11b8f75c19Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12b8f75c19Smrg# PARTICULAR PURPOSE.
13b8f75c19Smrg
148e4923e5Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
157e4fd55aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
167e4fd55aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
178832ea4aSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
188832ea4aSmrg[m4_warning([this file was generated for autoconf 2.69.
197e4fd55aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
207e4fd55aSmrgIf you have problems, you may need to regenerate the build system entirely.
218e4923e5SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22b8f75c19Smrg
238832ea4aSmrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
247e4fd55aSmrg#
257e4fd55aSmrg# This file is free software; the Free Software Foundation
267e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
277e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
28b8f75c19Smrg
29b8f75c19Smrg# AM_AUTOMAKE_VERSION(VERSION)
30b8f75c19Smrg# ----------------------------
31b8f75c19Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32b8f75c19Smrg# generated from the m4 files accompanying Automake X.Y.
337e4fd55aSmrg# (This private macro should not be called outside this file.)
347e4fd55aSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
358832ea4aSmrg[am__api_version='1.15'
367e4fd55aSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
377e4fd55aSmrgdnl require some minimum version.  Point them to the right macro.
388832ea4aSmrgm4_if([$1], [1.15], [],
397e4fd55aSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
407e4fd55aSmrg])
417e4fd55aSmrg
427e4fd55aSmrg# _AM_AUTOCONF_VERSION(VERSION)
437e4fd55aSmrg# -----------------------------
447e4fd55aSmrg# aclocal traces this macro to find the Autoconf version.
457e4fd55aSmrg# This is a private macro too.  Using m4_define simplifies
467e4fd55aSmrg# the logic in aclocal, which can simply ignore this definition.
477e4fd55aSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48b8f75c19Smrg
49b8f75c19Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50b8f75c19Smrg# -------------------------------
517e4fd55aSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
527e4fd55aSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53b8f75c19SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
548832ea4aSmrg[AM_AUTOMAKE_VERSION([1.15])dnl
557e4fd55aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
567e4fd55aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
577e4fd55aSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58b8f75c19Smrg
597e4fd55aSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60b8f75c19Smrg
618832ea4aSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
62b8f75c19Smrg#
637e4fd55aSmrg# This file is free software; the Free Software Foundation
647e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
657e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
66b8f75c19Smrg
67b8f75c19Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
688e4923e5Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
698e4923e5Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70b8f75c19Smrg#
71b8f75c19Smrg# Of course, Automake must honor this variable whenever it calls a
72b8f75c19Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73b8f75c19Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74b8f75c19Smrg# depending on how configure is run.  This is pretty annoying, since
75b8f75c19Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76b8f75c19Smrg# source directory, any form will work fine, but in subdirectories a
77b8f75c19Smrg# relative path needs to be adjusted first.
78b8f75c19Smrg#
79b8f75c19Smrg# $ac_aux_dir/missing
80b8f75c19Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81b8f75c19Smrg# $top_srcdir/$ac_aux_dir/missing
82b8f75c19Smrg#    fails if $ac_aux_dir is absolute,
83b8f75c19Smrg#    fails when called from a subdirectory in a VPATH build with
84b8f75c19Smrg#          a relative $ac_aux_dir
85b8f75c19Smrg#
86b8f75c19Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87b8f75c19Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
888e4923e5Smrg# harmless because $srcdir is '.', but things will broke when you
89b8f75c19Smrg# start a VPATH build or use an absolute $srcdir.
90b8f75c19Smrg#
91b8f75c19Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92b8f75c19Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93b8f75c19Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94b8f75c19Smrg# and then we would define $MISSING as
95b8f75c19Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96b8f75c19Smrg# This will work as long as MISSING is not called from configure, because
97b8f75c19Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98b8f75c19Smrg# However there are other variables, like CC, which are often used in
99b8f75c19Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100b8f75c19Smrg#
101b8f75c19Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102b8f75c19Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103b8f75c19Smrg# configured tree to be moved without reconfiguration.
104b8f75c19Smrg
1057e4fd55aSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1068832ea4aSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1078832ea4aSmrg# Expand $ac_aux_dir to an absolute path.
1088832ea4aSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109b8f75c19Smrg])
110b8f75c19Smrg
1117e4fd55aSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112b8f75c19Smrg
1138832ea4aSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
1147e4fd55aSmrg#
1157e4fd55aSmrg# This file is free software; the Free Software Foundation
1167e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
1177e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
118b8f75c19Smrg
1197e4fd55aSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1207e4fd55aSmrg# -------------------------------------
1217e4fd55aSmrg# Define a conditional.
1227e4fd55aSmrgAC_DEFUN([AM_CONDITIONAL],
1238e4923e5Smrg[AC_PREREQ([2.52])dnl
1248e4923e5Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1258e4923e5Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1267e4fd55aSmrgAC_SUBST([$1_TRUE])dnl
1277e4fd55aSmrgAC_SUBST([$1_FALSE])dnl
1287e4fd55aSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1297e4fd55aSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1307e4fd55aSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1317e4fd55aSmrgif $2; then
1327e4fd55aSmrg  $1_TRUE=
1337e4fd55aSmrg  $1_FALSE='#'
134b8f75c19Smrgelse
1357e4fd55aSmrg  $1_TRUE='#'
1367e4fd55aSmrg  $1_FALSE=
137b8f75c19Smrgfi
1387e4fd55aSmrgAC_CONFIG_COMMANDS_PRE(
1397e4fd55aSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1407e4fd55aSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1417e4fd55aSmrgUsually this means the macro was only invoked conditionally.]])
1427e4fd55aSmrgfi])])
143b8f75c19Smrg
1448832ea4aSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
1457e4fd55aSmrg#
1467e4fd55aSmrg# This file is free software; the Free Software Foundation
1477e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
1487e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
149b8f75c19Smrg
150b8f75c19Smrg
1518e4923e5Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152b8f75c19Smrg# written in clear, in which case automake, when reading aclocal.m4,
153b8f75c19Smrg# will think it sees a *use*, and therefore will trigger all it's
154b8f75c19Smrg# C support machinery.  Also note that it means that autoscan, seeing
155b8f75c19Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156b8f75c19Smrg
157b8f75c19Smrg
158b8f75c19Smrg# _AM_DEPENDENCIES(NAME)
159b8f75c19Smrg# ----------------------
160b8f75c19Smrg# See how the compiler implements dependency checking.
1618e4923e5Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162b8f75c19Smrg# We try a few techniques and use that to set a single cache variable.
163b8f75c19Smrg#
164b8f75c19Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165b8f75c19Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166b8f75c19Smrg# dependency, and given that the user is not expected to run this macro,
167b8f75c19Smrg# just rely on AC_PROG_CC.
168b8f75c19SmrgAC_DEFUN([_AM_DEPENDENCIES],
169b8f75c19Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170b8f75c19SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171b8f75c19SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172b8f75c19SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173b8f75c19Smrg
1748e4923e5Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1758e4923e5Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1768e4923e5Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1778e4923e5Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1788e4923e5Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1798e4923e5Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1808e4923e5Smrg                    [depcc="$$1"   am_compiler_list=])
181b8f75c19Smrg
182b8f75c19SmrgAC_CACHE_CHECK([dependency style of $depcc],
183b8f75c19Smrg               [am_cv_$1_dependencies_compiler_type],
184b8f75c19Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185b8f75c19Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186b8f75c19Smrg  # making bogus files that we don't know about and never remove.  For
187b8f75c19Smrg  # instance it was reported that on HP-UX the gcc test will end up
1888e4923e5Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1898e4923e5Smrg  # in D".
1908e4923e5Smrg  rm -rf conftest.dir
191b8f75c19Smrg  mkdir conftest.dir
192b8f75c19Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193b8f75c19Smrg  # using a relative directory.
194b8f75c19Smrg  cp "$am_depcomp" conftest.dir
195b8f75c19Smrg  cd conftest.dir
196b8f75c19Smrg  # We will build objects and dependencies in a subdirectory because
197b8f75c19Smrg  # it helps to detect inapplicable dependency modes.  For instance
198b8f75c19Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199b8f75c19Smrg  # side effect of compilation, but ICC will put the dependencies in
200b8f75c19Smrg  # the current directory while Tru64 will put them in the object
201b8f75c19Smrg  # directory.
202b8f75c19Smrg  mkdir sub
203b8f75c19Smrg
204b8f75c19Smrg  am_cv_$1_dependencies_compiler_type=none
205b8f75c19Smrg  if test "$am_compiler_list" = ""; then
206b8f75c19Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207b8f75c19Smrg  fi
2087e4fd55aSmrg  am__universal=false
2097e4fd55aSmrg  m4_case([$1], [CC],
2107e4fd55aSmrg    [case " $depcc " in #(
2117e4fd55aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2127e4fd55aSmrg     esac],
2137e4fd55aSmrg    [CXX],
2147e4fd55aSmrg    [case " $depcc " in #(
2157e4fd55aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2167e4fd55aSmrg     esac])
2177e4fd55aSmrg
218b8f75c19Smrg  for depmode in $am_compiler_list; do
219b8f75c19Smrg    # Setup a source with many dependencies, because some compilers
220b8f75c19Smrg    # like to wrap large dependency lists on column 80 (with \), and
221b8f75c19Smrg    # we should not choose a depcomp mode which is confused by this.
222b8f75c19Smrg    #
223b8f75c19Smrg    # We need to recreate these files for each test, as the compiler may
224b8f75c19Smrg    # overwrite some of them when testing with obscure command lines.
225b8f75c19Smrg    # This happens at least with the AIX C compiler.
226b8f75c19Smrg    : > sub/conftest.c
227b8f75c19Smrg    for i in 1 2 3 4 5 6; do
228b8f75c19Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2298e4923e5Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2308e4923e5Smrg      # Solaris 10 /bin/sh.
2318e4923e5Smrg      echo '/* dummy */' > sub/conftst$i.h
232b8f75c19Smrg    done
233b8f75c19Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234b8f75c19Smrg
2358e4923e5Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2367e4fd55aSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2378e4923e5Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2388e4923e5Smrg    # versions had trouble with output in subdirs.
2397e4fd55aSmrg    am__obj=sub/conftest.${OBJEXT-o}
2407e4fd55aSmrg    am__minus_obj="-o $am__obj"
241b8f75c19Smrg    case $depmode in
2427e4fd55aSmrg    gcc)
2437e4fd55aSmrg      # This depmode causes a compiler race in universal mode.
2447e4fd55aSmrg      test "$am__universal" = false || continue
2457e4fd55aSmrg      ;;
246b8f75c19Smrg    nosideeffect)
2478e4923e5Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2488e4923e5Smrg      # only be used when explicitly requested.
249b8f75c19Smrg      if test "x$enable_dependency_tracking" = xyes; then
250b8f75c19Smrg	continue
251b8f75c19Smrg      else
252b8f75c19Smrg	break
253b8f75c19Smrg      fi
254b8f75c19Smrg      ;;
2558e4923e5Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2568e4923e5Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2577e4fd55aSmrg      # not run yet.  These depmodes are late enough in the game, and
2587e4fd55aSmrg      # so weak that their functioning should not be impacted.
2597e4fd55aSmrg      am__obj=conftest.${OBJEXT-o}
2607e4fd55aSmrg      am__minus_obj=
2617e4fd55aSmrg      ;;
262b8f75c19Smrg    none) break ;;
263b8f75c19Smrg    esac
264b8f75c19Smrg    if depmode=$depmode \
2657e4fd55aSmrg       source=sub/conftest.c object=$am__obj \
266b8f75c19Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2677e4fd55aSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268b8f75c19Smrg         >/dev/null 2>conftest.err &&
2697e4fd55aSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270b8f75c19Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2717e4fd55aSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272b8f75c19Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273b8f75c19Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2747e4fd55aSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2757e4fd55aSmrg      # that says an option was ignored or not supported.
2767e4fd55aSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2777e4fd55aSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2787e4fd55aSmrg      # The diagnosis changed in icc 8.0:
2797e4fd55aSmrg      #   icc: Command line remark: option '-MP' not supported
2807e4fd55aSmrg      if (grep 'ignoring option' conftest.err ||
2817e4fd55aSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282b8f75c19Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283b8f75c19Smrg        break
284b8f75c19Smrg      fi
285b8f75c19Smrg    fi
286b8f75c19Smrg  done
287b8f75c19Smrg
288b8f75c19Smrg  cd ..
289b8f75c19Smrg  rm -rf conftest.dir
290b8f75c19Smrgelse
291b8f75c19Smrg  am_cv_$1_dependencies_compiler_type=none
292b8f75c19Smrgfi
293b8f75c19Smrg])
294b8f75c19SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295b8f75c19SmrgAM_CONDITIONAL([am__fastdep$1], [
296b8f75c19Smrg  test "x$enable_dependency_tracking" != xno \
297b8f75c19Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298b8f75c19Smrg])
299b8f75c19Smrg
300b8f75c19Smrg
301b8f75c19Smrg# AM_SET_DEPDIR
302b8f75c19Smrg# -------------
303b8f75c19Smrg# Choose a directory name for dependency files.
3048e4923e5Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305b8f75c19SmrgAC_DEFUN([AM_SET_DEPDIR],
306b8f75c19Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307b8f75c19SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308b8f75c19Smrg])
309b8f75c19Smrg
310b8f75c19Smrg
311b8f75c19Smrg# AM_DEP_TRACK
312b8f75c19Smrg# ------------
313b8f75c19SmrgAC_DEFUN([AM_DEP_TRACK],
3148e4923e5Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3158e4923e5SmrgAS_HELP_STRING(
3168e4923e5Smrg  [--enable-dependency-tracking],
3178e4923e5Smrg  [do not reject slow dependency extractors])
3188e4923e5SmrgAS_HELP_STRING(
3198e4923e5Smrg  [--disable-dependency-tracking],
3208e4923e5Smrg  [speeds up one-time build])])
321b8f75c19Smrgif test "x$enable_dependency_tracking" != xno; then
322b8f75c19Smrg  am_depcomp="$ac_aux_dir/depcomp"
323b8f75c19Smrg  AMDEPBACKSLASH='\'
3248e4923e5Smrg  am__nodep='_no'
325b8f75c19Smrgfi
326b8f75c19SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3277e4fd55aSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3287e4fd55aSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3298e4923e5SmrgAC_SUBST([am__nodep])dnl
3308e4923e5Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331b8f75c19Smrg])
332b8f75c19Smrg
3337e4fd55aSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334b8f75c19Smrg
3358832ea4aSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
3367e4fd55aSmrg#
3377e4fd55aSmrg# This file is free software; the Free Software Foundation
3387e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
3397e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
340b8f75c19Smrg
341b8f75c19Smrg
342b8f75c19Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
343b8f75c19Smrg# ------------------------------
344b8f75c19SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3457e4fd55aSmrg[{
3468e4923e5Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3477e4fd55aSmrg  # are listed without --file.  Let's play safe and only enable the eval
3487e4fd55aSmrg  # if we detect the quoting.
3497e4fd55aSmrg  case $CONFIG_FILES in
3507e4fd55aSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
3517e4fd55aSmrg  *)   set x $CONFIG_FILES ;;
3527e4fd55aSmrg  esac
3537e4fd55aSmrg  shift
3547e4fd55aSmrg  for mf
3557e4fd55aSmrg  do
3567e4fd55aSmrg    # Strip MF so we end up with the name of the file.
3577e4fd55aSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3587e4fd55aSmrg    # Check whether this is an Automake generated Makefile or not.
3598e4923e5Smrg    # We used to match only the files named 'Makefile.in', but
3607e4fd55aSmrg    # some people rename them; so instead we look at the file content.
3617e4fd55aSmrg    # Grep'ing the first line is not enough: some people post-process
3627e4fd55aSmrg    # each Makefile.in and add a new line on top of each file to say so.
3637e4fd55aSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
3647e4fd55aSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3657e4fd55aSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3667e4fd55aSmrg      dirpart=`AS_DIRNAME("$mf")`
3677e4fd55aSmrg    else
3687e4fd55aSmrg      continue
3697e4fd55aSmrg    fi
3707e4fd55aSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
3718e4923e5Smrg    # from the Makefile without running 'make'.
3727e4fd55aSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3737e4fd55aSmrg    test -z "$DEPDIR" && continue
3747e4fd55aSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3758e4923e5Smrg    test -z "$am__include" && continue
3767e4fd55aSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3777e4fd55aSmrg    # Find all dependency output files, they are included files with
3787e4fd55aSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3797e4fd55aSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3807e4fd55aSmrg    # expansion.
3817e4fd55aSmrg    for file in `sed -n "
3827e4fd55aSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3838e4923e5Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
3847e4fd55aSmrg      # Make sure the directory exists.
3857e4fd55aSmrg      test -f "$dirpart/$file" && continue
3867e4fd55aSmrg      fdir=`AS_DIRNAME(["$file"])`
3877e4fd55aSmrg      AS_MKDIR_P([$dirpart/$fdir])
3887e4fd55aSmrg      # echo "creating $dirpart/$file"
3897e4fd55aSmrg      echo '# dummy' > "$dirpart/$file"
3907e4fd55aSmrg    done
391b8f75c19Smrg  done
3927e4fd55aSmrg}
393b8f75c19Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394b8f75c19Smrg
395b8f75c19Smrg
396b8f75c19Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
397b8f75c19Smrg# -----------------------------
398b8f75c19Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
399b8f75c19Smrg#
400b8f75c19Smrg# This code is only required when automatic dependency tracking
4018e4923e5Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
402b8f75c19Smrg# need in order to bootstrap the dependency handling code.
403b8f75c19SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
404b8f75c19Smrg[AC_CONFIG_COMMANDS([depfiles],
405b8f75c19Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
406b8f75c19Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
407b8f75c19Smrg])
408b8f75c19Smrg
4097e4fd55aSmrg# Do all the work for Automake.                             -*- Autoconf -*-
410b8f75c19Smrg
4118832ea4aSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4127e4fd55aSmrg#
4137e4fd55aSmrg# This file is free software; the Free Software Foundation
4147e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
4157e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
416b8f75c19Smrg
4177e4fd55aSmrg# This macro actually does too much.  Some checks are only needed if
4187e4fd55aSmrg# your package does certain things.  But this isn't really a big deal.
419b8f75c19Smrg
4208e4923e5Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4218e4923e5Smrgm4_define([AC_PROG_CC],
4228e4923e5Smrgm4_defn([AC_PROG_CC])
4238e4923e5Smrg[_AM_PROG_CC_C_O
4248e4923e5Smrg])
4258e4923e5Smrg
4267e4fd55aSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4277e4fd55aSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4287e4fd55aSmrg# -----------------------------------------------
4297e4fd55aSmrg# The call with PACKAGE and VERSION arguments is the old style
4307e4fd55aSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4317e4fd55aSmrg# and VERSION should now be passed to AC_INIT and removed from
4327e4fd55aSmrg# the call to AM_INIT_AUTOMAKE.
4337e4fd55aSmrg# We support both call styles for the transition.  After
4347e4fd55aSmrg# the next Automake release, Autoconf can make the AC_INIT
4357e4fd55aSmrg# arguments mandatory, and then we can depend on a new Autoconf
4367e4fd55aSmrg# release and drop the old call support.
4377e4fd55aSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4388e4923e5Smrg[AC_PREREQ([2.65])dnl
4397e4fd55aSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4407e4fd55aSmrgdnl the ones we care about.
4417e4fd55aSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4427e4fd55aSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4437e4fd55aSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4447e4fd55aSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4457e4fd55aSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4467e4fd55aSmrg  # is not polluted with repeated "-I."
4477e4fd55aSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4487e4fd55aSmrg  # test to see if srcdir already configured
4497e4fd55aSmrg  if test -f $srcdir/config.status; then
4507e4fd55aSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4517e4fd55aSmrg  fi
4527e4fd55aSmrgfi
4537e4fd55aSmrg
4547e4fd55aSmrg# test whether we have cygpath
4557e4fd55aSmrgif test -z "$CYGPATH_W"; then
4567e4fd55aSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4577e4fd55aSmrg    CYGPATH_W='cygpath -w'
4587e4fd55aSmrg  else
4597e4fd55aSmrg    CYGPATH_W=echo
4607e4fd55aSmrg  fi
4617e4fd55aSmrgfi
4627e4fd55aSmrgAC_SUBST([CYGPATH_W])
4637e4fd55aSmrg
4647e4fd55aSmrg# Define the identity of the package.
4657e4fd55aSmrgdnl Distinguish between old-style and new-style calls.
4667e4fd55aSmrgm4_ifval([$2],
4678e4923e5Smrg[AC_DIAGNOSE([obsolete],
4688e4923e5Smrg             [$0: two- and three-arguments forms are deprecated.])
4698e4923e5Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4707e4fd55aSmrg AC_SUBST([PACKAGE], [$1])dnl
4717e4fd55aSmrg AC_SUBST([VERSION], [$2])],
4727e4fd55aSmrg[_AM_SET_OPTIONS([$1])dnl
4737e4fd55aSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4748e4923e5Smrgm4_if(
4758e4923e5Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
4768e4923e5Smrg  [ok:ok],,
4777e4fd55aSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4787e4fd55aSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4797e4fd55aSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4807e4fd55aSmrg
4817e4fd55aSmrg_AM_IF_OPTION([no-define],,
4828e4923e5Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4838e4923e5Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4847e4fd55aSmrg
4857e4fd55aSmrg# Some tools Automake needs.
4867e4fd55aSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4877e4fd55aSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4888e4923e5SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4898e4923e5SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4908e4923e5SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4918e4923e5SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4928e4923e5SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4937e4fd55aSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4947e4fd55aSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4958e4923e5SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4968e4923e5Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4978e4923e5Smrg# dies out for good.  For more background, see:
4988e4923e5Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4998e4923e5Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
5008e4923e5SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
5018832ea4aSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
5028832ea4aSmrg# system "awk" is bad on some platforms.
5037e4fd55aSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5047e4fd55aSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5057e4fd55aSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5067e4fd55aSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5077e4fd55aSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5087e4fd55aSmrg			     [_AM_PROG_TAR([v7])])])
5097e4fd55aSmrg_AM_IF_OPTION([no-dependencies],,
5107e4fd55aSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5118e4923e5Smrg		  [_AM_DEPENDENCIES([CC])],
5128e4923e5Smrg		  [m4_define([AC_PROG_CC],
5138e4923e5Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5147e4fd55aSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5158e4923e5Smrg		  [_AM_DEPENDENCIES([CXX])],
5168e4923e5Smrg		  [m4_define([AC_PROG_CXX],
5178e4923e5Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5187e4fd55aSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5198e4923e5Smrg		  [_AM_DEPENDENCIES([OBJC])],
5208e4923e5Smrg		  [m4_define([AC_PROG_OBJC],
5218e4923e5Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5228e4923e5SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5238e4923e5Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5248e4923e5Smrg		  [m4_define([AC_PROG_OBJCXX],
5258e4923e5Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5267e4fd55aSmrg])
5278e4923e5SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5288e4923e5Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5298e4923e5Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5308e4923e5Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5317e4fd55aSmrgAC_CONFIG_COMMANDS_PRE(dnl
5327e4fd55aSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5337e4fd55aSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5347e4fd55aSmrg
5358e4923e5Smrg# POSIX will say in a future version that running "rm -f" with no argument
5368e4923e5Smrg# is OK; and we want to be able to make that assumption in our Makefile
5378e4923e5Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5388e4923e5Smrg# actually supported "in the wild" to an acceptable degree.
5398e4923e5Smrg# See automake bug#10828.
5408e4923e5Smrg# To make any issue more visible, cause the running configure to be aborted
5418e4923e5Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5428e4923e5Smrg# user can still override this though.
5438e4923e5Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5448e4923e5Smrg  cat >&2 <<'END'
5458e4923e5SmrgOops!
5468e4923e5Smrg
5478e4923e5SmrgYour 'rm' program seems unable to run without file operands specified
5488e4923e5Smrgon the command line, even when the '-f' option is present.  This is contrary
5498e4923e5Smrgto the behaviour of most rm programs out there, and not conforming with
5508e4923e5Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5518e4923e5Smrg
5528e4923e5SmrgPlease tell bug-automake@gnu.org about your system, including the value
5538e4923e5Smrgof your $PATH and any error possibly output before this message.  This
5548e4923e5Smrgcan help us improve future automake versions.
5558e4923e5Smrg
5568e4923e5SmrgEND
5578e4923e5Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5588e4923e5Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5598e4923e5Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5608e4923e5Smrg    echo >&2
5618e4923e5Smrg  else
5628e4923e5Smrg    cat >&2 <<'END'
5638e4923e5SmrgAborting the configuration process, to ensure you take notice of the issue.
5648e4923e5Smrg
5658e4923e5SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5668e4923e5Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
5678e4923e5Smrg
5688e4923e5SmrgIf you want to complete the configuration process using your problematic
5698e4923e5Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5708e4923e5Smrgto "yes", and re-run configure.
5718e4923e5Smrg
5728e4923e5SmrgEND
5738e4923e5Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5748e4923e5Smrg  fi
5758832ea4aSmrgfi
5768832ea4aSmrgdnl The trailing newline in this macro's definition is deliberate, for
5778832ea4aSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5788832ea4aSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5798832ea4aSmrg])
5808e4923e5Smrg
5818e4923e5Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5827e4fd55aSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5837e4fd55aSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5847e4fd55aSmrgm4_define([_AC_COMPILER_EXEEXT],
5857e4fd55aSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5867e4fd55aSmrg
5877e4fd55aSmrg# When config.status generates a header, we must update the stamp-h file.
5887e4fd55aSmrg# This file resides in the same directory as the config header
5897e4fd55aSmrg# that is generated.  The stamp files are numbered to have different names.
5907e4fd55aSmrg
5917e4fd55aSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5927e4fd55aSmrg# loop where config.status creates the headers, so we can generate
5937e4fd55aSmrg# our stamp files there.
5947e4fd55aSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5957e4fd55aSmrg[# Compute $1's index in $config_headers.
5967e4fd55aSmrg_am_arg=$1
5977e4fd55aSmrg_am_stamp_count=1
5987e4fd55aSmrgfor _am_header in $config_headers :; do
5997e4fd55aSmrg  case $_am_header in
6007e4fd55aSmrg    $_am_arg | $_am_arg:* )
6017e4fd55aSmrg      break ;;
6027e4fd55aSmrg    * )
6037e4fd55aSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6047e4fd55aSmrg  esac
6057e4fd55aSmrgdone
6067e4fd55aSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6077e4fd55aSmrg
6088832ea4aSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6097e4fd55aSmrg#
6107e4fd55aSmrg# This file is free software; the Free Software Foundation
6117e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
6127e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
6137e4fd55aSmrg
6147e4fd55aSmrg# AM_PROG_INSTALL_SH
6157e4fd55aSmrg# ------------------
6167e4fd55aSmrg# Define $install_sh.
6177e4fd55aSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6187e4fd55aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6198832ea4aSmrgif test x"${install_sh+set}" != xset; then
6207e4fd55aSmrg  case $am_aux_dir in
6217e4fd55aSmrg  *\ * | *\	*)
6227e4fd55aSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6237e4fd55aSmrg  *)
6247e4fd55aSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6257e4fd55aSmrg  esac
6267e4fd55aSmrgfi
6278e4923e5SmrgAC_SUBST([install_sh])])
6287e4fd55aSmrg
6298832ea4aSmrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
6307e4fd55aSmrg#
6317e4fd55aSmrg# This file is free software; the Free Software Foundation
6327e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
6337e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
634b8f75c19Smrg
6357e4fd55aSmrg# Check whether the underlying file-system supports filenames
6367e4fd55aSmrg# with a leading dot.  For instance MS-DOS doesn't.
6377e4fd55aSmrgAC_DEFUN([AM_SET_LEADING_DOT],
6387e4fd55aSmrg[rm -rf .tst 2>/dev/null
6397e4fd55aSmrgmkdir .tst 2>/dev/null
6407e4fd55aSmrgif test -d .tst; then
6417e4fd55aSmrg  am__leading_dot=.
6427e4fd55aSmrgelse
6437e4fd55aSmrg  am__leading_dot=_
6447e4fd55aSmrgfi
6457e4fd55aSmrgrmdir .tst 2>/dev/null
6467e4fd55aSmrgAC_SUBST([am__leading_dot])])
6477e4fd55aSmrg
6487e4fd55aSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6497e4fd55aSmrg
6508832ea4aSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6517e4fd55aSmrg#
6527e4fd55aSmrg# This file is free software; the Free Software Foundation
6537e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
6547e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
6557e4fd55aSmrg
656b8f75c19Smrg# AM_MAKE_INCLUDE()
657b8f75c19Smrg# -----------------
658b8f75c19Smrg# Check to see how make treats includes.
659b8f75c19SmrgAC_DEFUN([AM_MAKE_INCLUDE],
660b8f75c19Smrg[am_make=${MAKE-make}
661b8f75c19Smrgcat > confinc << 'END'
662b8f75c19Smrgam__doit:
6637e4fd55aSmrg	@echo this is the am__doit target
664b8f75c19Smrg.PHONY: am__doit
665b8f75c19SmrgEND
666b8f75c19Smrg# If we don't find an include directive, just comment out the code.
667b8f75c19SmrgAC_MSG_CHECKING([for style of include used by $am_make])
668b8f75c19Smrgam__include="#"
669b8f75c19Smrgam__quote=
670b8f75c19Smrg_am_result=none
671b8f75c19Smrg# First try GNU make style include.
672b8f75c19Smrgecho "include confinc" > confmf
6738e4923e5Smrg# Ignore all kinds of additional output from 'make'.
6747e4fd55aSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
6757e4fd55aSmrg*the\ am__doit\ target*)
6767e4fd55aSmrg  am__include=include
6777e4fd55aSmrg  am__quote=
6787e4fd55aSmrg  _am_result=GNU
6797e4fd55aSmrg  ;;
6807e4fd55aSmrgesac
681b8f75c19Smrg# Now try BSD make style include.
682b8f75c19Smrgif test "$am__include" = "#"; then
683b8f75c19Smrg   echo '.include "confinc"' > confmf
6847e4fd55aSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
6857e4fd55aSmrg   *the\ am__doit\ target*)
6867e4fd55aSmrg     am__include=.include
6877e4fd55aSmrg     am__quote="\""
6887e4fd55aSmrg     _am_result=BSD
6897e4fd55aSmrg     ;;
6907e4fd55aSmrg   esac
691b8f75c19Smrgfi
692b8f75c19SmrgAC_SUBST([am__include])
693b8f75c19SmrgAC_SUBST([am__quote])
694b8f75c19SmrgAC_MSG_RESULT([$_am_result])
695b8f75c19Smrgrm -f confinc confmf
696b8f75c19Smrg])
697b8f75c19Smrg
6987e4fd55aSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
699b8f75c19Smrg
7008832ea4aSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
7017e4fd55aSmrg#
7027e4fd55aSmrg# This file is free software; the Free Software Foundation
7037e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
7047e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
705b8f75c19Smrg
7067e4fd55aSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7077e4fd55aSmrg# ------------------------------
7087e4fd55aSmrgAC_DEFUN([AM_MISSING_PROG],
7097e4fd55aSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7107e4fd55aSmrg$1=${$1-"${am_missing_run}$2"}
7117e4fd55aSmrgAC_SUBST($1)])
712b8f75c19Smrg
7137e4fd55aSmrg# AM_MISSING_HAS_RUN
7147e4fd55aSmrg# ------------------
7158e4923e5Smrg# Define MISSING if not defined so far and test if it is modern enough.
7168e4923e5Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7177e4fd55aSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7187e4fd55aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7197e4fd55aSmrgAC_REQUIRE_AUX_FILE([missing])dnl
7207e4fd55aSmrgif test x"${MISSING+set}" != xset; then
7217e4fd55aSmrg  case $am_aux_dir in
7227e4fd55aSmrg  *\ * | *\	*)
7237e4fd55aSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7247e4fd55aSmrg  *)
7257e4fd55aSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7267e4fd55aSmrg  esac
7277e4fd55aSmrgfi
7287e4fd55aSmrg# Use eval to expand $SHELL
7298e4923e5Smrgif eval "$MISSING --is-lightweight"; then
7308e4923e5Smrg  am_missing_run="$MISSING "
731b8f75c19Smrgelse
7327e4fd55aSmrg  am_missing_run=
7338e4923e5Smrg  AC_MSG_WARN(['missing' script is too old or missing])
734b8f75c19Smrgfi
7357e4fd55aSmrg])
736b8f75c19Smrg
7377e4fd55aSmrg# Helper functions for option handling.                     -*- Autoconf -*-
738b8f75c19Smrg
7398832ea4aSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
7407e4fd55aSmrg#
7417e4fd55aSmrg# This file is free software; the Free Software Foundation
7427e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
7437e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
744b8f75c19Smrg
7457e4fd55aSmrg# _AM_MANGLE_OPTION(NAME)
7467e4fd55aSmrg# -----------------------
7477e4fd55aSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7487e4fd55aSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
749b8f75c19Smrg
7507e4fd55aSmrg# _AM_SET_OPTION(NAME)
7518e4923e5Smrg# --------------------
7527e4fd55aSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7537e4fd55aSmrgAC_DEFUN([_AM_SET_OPTION],
7548e4923e5Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
755b8f75c19Smrg
7567e4fd55aSmrg# _AM_SET_OPTIONS(OPTIONS)
7578e4923e5Smrg# ------------------------
7587e4fd55aSmrg# OPTIONS is a space-separated list of Automake options.
7597e4fd55aSmrgAC_DEFUN([_AM_SET_OPTIONS],
7607e4fd55aSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
761b8f75c19Smrg
7627e4fd55aSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7637e4fd55aSmrg# -------------------------------------------
7647e4fd55aSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7657e4fd55aSmrgAC_DEFUN([_AM_IF_OPTION],
7667e4fd55aSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
767b8f75c19Smrg
7688832ea4aSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
7698e4923e5Smrg#
7708e4923e5Smrg# This file is free software; the Free Software Foundation
7718e4923e5Smrg# gives unlimited permission to copy and/or distribute it,
7728e4923e5Smrg# with or without modifications, as long as this notice is preserved.
7738e4923e5Smrg
7748e4923e5Smrg# _AM_PROG_CC_C_O
7758e4923e5Smrg# ---------------
7768e4923e5Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7778e4923e5Smrg# to automatically call this.
7788e4923e5SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7798e4923e5Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7808e4923e5SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7818e4923e5SmrgAC_LANG_PUSH([C])dnl
7828e4923e5SmrgAC_CACHE_CHECK(
7838e4923e5Smrg  [whether $CC understands -c and -o together],
7848e4923e5Smrg  [am_cv_prog_cc_c_o],
7858e4923e5Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7868e4923e5Smrg  # Make sure it works both with $CC and with simple cc.
7878e4923e5Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7888e4923e5Smrg  # compilers refuse to overwrite an existing .o file with -o,
7898e4923e5Smrg  # though they will create one.
7908e4923e5Smrg  am_cv_prog_cc_c_o=yes
7918e4923e5Smrg  for am_i in 1 2; do
7928e4923e5Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7938e4923e5Smrg         && test -f conftest2.$ac_objext; then
7948e4923e5Smrg      : OK
7958e4923e5Smrg    else
7968e4923e5Smrg      am_cv_prog_cc_c_o=no
7978e4923e5Smrg      break
7988e4923e5Smrg    fi
7998e4923e5Smrg  done
8008e4923e5Smrg  rm -f core conftest*
8018e4923e5Smrg  unset am_i])
8028e4923e5Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8038e4923e5Smrg   # Losing compiler, so override with the script.
8048e4923e5Smrg   # FIXME: It is wrong to rewrite CC.
8058e4923e5Smrg   # But if we don't then we get into trouble of one sort or another.
8068e4923e5Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8078e4923e5Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8088e4923e5Smrg   CC="$am_aux_dir/compile $CC"
8098e4923e5Smrgfi
8108e4923e5SmrgAC_LANG_POP([C])])
811b8f75c19Smrg
8128e4923e5Smrg# For backward compatibility.
8138e4923e5SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8148e4923e5Smrg
8158832ea4aSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
816b8f75c19Smrg#
8177e4fd55aSmrg# This file is free software; the Free Software Foundation
8187e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
8197e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
820b8f75c19Smrg
8218e4923e5Smrg# AM_RUN_LOG(COMMAND)
8228e4923e5Smrg# -------------------
8238e4923e5Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8248e4923e5Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8258e4923e5SmrgAC_DEFUN([AM_RUN_LOG],
8268e4923e5Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8278e4923e5Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8288e4923e5Smrg   ac_status=$?
8298e4923e5Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8308e4923e5Smrg   (exit $ac_status); }])
8318e4923e5Smrg
8328e4923e5Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8338e4923e5Smrg
8348832ea4aSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
8358e4923e5Smrg#
8368e4923e5Smrg# This file is free software; the Free Software Foundation
8378e4923e5Smrg# gives unlimited permission to copy and/or distribute it,
8388e4923e5Smrg# with or without modifications, as long as this notice is preserved.
839b8f75c19Smrg
8407e4fd55aSmrg# AM_SANITY_CHECK
8417e4fd55aSmrg# ---------------
8427e4fd55aSmrgAC_DEFUN([AM_SANITY_CHECK],
8437e4fd55aSmrg[AC_MSG_CHECKING([whether build environment is sane])
8447e4fd55aSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8457e4fd55aSmrg# name.  Accept space and tab only in the latter.
8467e4fd55aSmrgam_lf='
8477e4fd55aSmrg'
8487e4fd55aSmrgcase `pwd` in
8497e4fd55aSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8507e4fd55aSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8517e4fd55aSmrgesac
8527e4fd55aSmrgcase $srcdir in
8537e4fd55aSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8548e4923e5Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8557e4fd55aSmrgesac
8567e4fd55aSmrg
8578e4923e5Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8587e4fd55aSmrg# arguments.  Must try -L first in case configure is actually a
8597e4fd55aSmrg# symlink; some systems play weird games with the mod time of symlinks
8607e4fd55aSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8617e4fd55aSmrg# directory).
8627e4fd55aSmrgif (
8638e4923e5Smrg   am_has_slept=no
8648e4923e5Smrg   for am_try in 1 2; do
8658e4923e5Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8668e4923e5Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8678e4923e5Smrg     if test "$[*]" = "X"; then
8688e4923e5Smrg	# -L didn't work.
8698e4923e5Smrg	set X `ls -t "$srcdir/configure" conftest.file`
8708e4923e5Smrg     fi
8718e4923e5Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8728e4923e5Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8738e4923e5Smrg
8748e4923e5Smrg	# If neither matched, then we have a broken ls.  This can happen
8758e4923e5Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8768e4923e5Smrg	# broken ls alias from the environment.  This has actually
8778e4923e5Smrg	# happened.  Such a system could not be considered "sane".
8788e4923e5Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8798e4923e5Smrg  alias in your environment])
8808e4923e5Smrg     fi
8818e4923e5Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8828e4923e5Smrg       break
8838e4923e5Smrg     fi
8848e4923e5Smrg     # Just in case.
8858e4923e5Smrg     sleep 1
8868e4923e5Smrg     am_has_slept=yes
8878e4923e5Smrg   done
8887e4fd55aSmrg   test "$[2]" = conftest.file
8897e4fd55aSmrg   )
8907e4fd55aSmrgthen
8917e4fd55aSmrg   # Ok.
8927e4fd55aSmrg   :
893b8f75c19Smrgelse
8947e4fd55aSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
8957e4fd55aSmrgCheck your system clock])
8967e4fd55aSmrgfi
8978e4923e5SmrgAC_MSG_RESULT([yes])
8988e4923e5Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8998e4923e5Smrg# generated files are strictly newer.
9008e4923e5Smrgam_sleep_pid=
9018e4923e5Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9028e4923e5Smrg  ( sleep 1 ) &
9038e4923e5Smrg  am_sleep_pid=$!
9048e4923e5Smrgfi
9058e4923e5SmrgAC_CONFIG_COMMANDS_PRE(
9068e4923e5Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9078e4923e5Smrg   if test -n "$am_sleep_pid"; then
9088e4923e5Smrg     # Hide warnings about reused PIDs.
9098e4923e5Smrg     wait $am_sleep_pid 2>/dev/null
9108e4923e5Smrg   fi
9118e4923e5Smrg   AC_MSG_RESULT([done])])
9128e4923e5Smrgrm -f conftest.file
9138e4923e5Smrg])
914b8f75c19Smrg
9158832ea4aSmrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
9167e4fd55aSmrg#
9177e4fd55aSmrg# This file is free software; the Free Software Foundation
9187e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
9197e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
920b8f75c19Smrg
9217e4fd55aSmrg# AM_SILENT_RULES([DEFAULT])
9227e4fd55aSmrg# --------------------------
9237e4fd55aSmrg# Enable less verbose build rules; with the default set to DEFAULT
9248e4923e5Smrg# ("yes" being less verbose, "no" or empty being verbose).
9257e4fd55aSmrgAC_DEFUN([AM_SILENT_RULES],
9268e4923e5Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9278e4923e5SmrgAS_HELP_STRING(
9288e4923e5Smrg  [--enable-silent-rules],
9298e4923e5Smrg  [less verbose build output (undo: "make V=1")])
9308e4923e5SmrgAS_HELP_STRING(
9318e4923e5Smrg  [--disable-silent-rules],
9328e4923e5Smrg  [verbose build output (undo: "make V=0")])dnl
9338e4923e5Smrg])
9348e4923e5Smrgcase $enable_silent_rules in @%:@ (((
9358e4923e5Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9368e4923e5Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9378e4923e5Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9387e4fd55aSmrgesac
9398e4923e5Smrgdnl
9408e4923e5Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9418e4923e5Smrgdnl do not support nested variable expansions.
9428e4923e5Smrgdnl See automake bug#9928 and bug#10237.
9438e4923e5Smrgam_make=${MAKE-make}
9448e4923e5SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9458e4923e5Smrg   [am_cv_make_support_nested_variables],
9468e4923e5Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9478e4923e5SmrgBAR0=false
9488e4923e5SmrgBAR1=true
9498e4923e5SmrgV=1
9508e4923e5Smrgam__doit:
9518e4923e5Smrg	@$(TRUE)
9528e4923e5Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9538e4923e5Smrg  am_cv_make_support_nested_variables=yes
9548e4923e5Smrgelse
9558e4923e5Smrg  am_cv_make_support_nested_variables=no
9568e4923e5Smrgfi])
9578e4923e5Smrgif test $am_cv_make_support_nested_variables = yes; then
9588e4923e5Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9598e4923e5Smrg  AM_V='$(V)'
9608e4923e5Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9618e4923e5Smrgelse
9628e4923e5Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9638e4923e5Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9648e4923e5Smrgfi
9658e4923e5SmrgAC_SUBST([AM_V])dnl
9668e4923e5SmrgAM_SUBST_NOTMAKE([AM_V])dnl
9678e4923e5SmrgAC_SUBST([AM_DEFAULT_V])dnl
9688e4923e5SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9697e4fd55aSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9707e4fd55aSmrgAM_BACKSLASH='\'
9717e4fd55aSmrgAC_SUBST([AM_BACKSLASH])dnl
9727e4fd55aSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9737e4fd55aSmrg])
9747e4fd55aSmrg
9758832ea4aSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
976b8f75c19Smrg#
9777e4fd55aSmrg# This file is free software; the Free Software Foundation
9787e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
9797e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
9807e4fd55aSmrg
9817e4fd55aSmrg# AM_PROG_INSTALL_STRIP
9827e4fd55aSmrg# ---------------------
9838e4923e5Smrg# One issue with vendor 'install' (even GNU) is that you can't
9847e4fd55aSmrg# specify the program used to strip binaries.  This is especially
9857e4fd55aSmrg# annoying in cross-compiling environments, where the build's strip
9867e4fd55aSmrg# is unlikely to handle the host's binaries.
9877e4fd55aSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9888e4923e5Smrg# always use install-sh in "make install-strip", and initialize
9897e4fd55aSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
9907e4fd55aSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9917e4fd55aSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9928e4923e5Smrg# Installed binaries are usually stripped using 'strip' when the user
9938e4923e5Smrg# run "make install-strip".  However 'strip' might not be the right
9947e4fd55aSmrg# tool to use in cross-compilation environments, therefore Automake
9958e4923e5Smrg# will honor the 'STRIP' environment variable to overrule this program.
9968e4923e5Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9977e4fd55aSmrgif test "$cross_compiling" != no; then
9987e4fd55aSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
9997e4fd55aSmrgfi
10007e4fd55aSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
10017e4fd55aSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10027e4fd55aSmrg
10038832ea4aSmrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
1004b8f75c19Smrg#
10057e4fd55aSmrg# This file is free software; the Free Software Foundation
10067e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
10077e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
1008b8f75c19Smrg
10097e4fd55aSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10107e4fd55aSmrg# ---------------------------
10117e4fd55aSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10127e4fd55aSmrg# This macro is traced by Automake.
10137e4fd55aSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1014b8f75c19Smrg
10157e4fd55aSmrg# AM_SUBST_NOTMAKE(VARIABLE)
10168e4923e5Smrg# --------------------------
10177e4fd55aSmrg# Public sister of _AM_SUBST_NOTMAKE.
10187e4fd55aSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1019b8f75c19Smrg
10207e4fd55aSmrg# Check how to create a tarball.                            -*- Autoconf -*-
1021b8f75c19Smrg
10228832ea4aSmrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
10237e4fd55aSmrg#
10247e4fd55aSmrg# This file is free software; the Free Software Foundation
10257e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
10267e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
1027b8f75c19Smrg
10287e4fd55aSmrg# _AM_PROG_TAR(FORMAT)
10297e4fd55aSmrg# --------------------
10307e4fd55aSmrg# Check how to create a tarball in format FORMAT.
10318e4923e5Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10327e4fd55aSmrg#
10337e4fd55aSmrg# Substitute a variable $(am__tar) that is a command
10347e4fd55aSmrg# writing to stdout a FORMAT-tarball containing the directory
10357e4fd55aSmrg# $tardir.
10367e4fd55aSmrg#     tardir=directory && $(am__tar) > result.tar
10377e4fd55aSmrg#
10387e4fd55aSmrg# Substitute a variable $(am__untar) that extract such
10397e4fd55aSmrg# a tarball read from stdin.
10407e4fd55aSmrg#     $(am__untar) < result.tar
10418e4923e5Smrg#
10427e4fd55aSmrgAC_DEFUN([_AM_PROG_TAR],
10438e4923e5Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10448e4923e5Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10458e4923e5SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10468e4923e5Smrg
10478e4923e5Smrg# We'll loop over all known methods to create a tar archive until one works.
10487e4fd55aSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1049b8f75c19Smrg
10508e4923e5Smrgm4_if([$1], [v7],
10518e4923e5Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10528e4923e5Smrg
10538e4923e5Smrg  [m4_case([$1],
10548e4923e5Smrg    [ustar],
10558e4923e5Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10568e4923e5Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10578e4923e5Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10588e4923e5Smrg      # and bug#13588).
10598e4923e5Smrg      am_max_uid=2097151 # 2^21 - 1
10608e4923e5Smrg      am_max_gid=$am_max_uid
10618e4923e5Smrg      # The $UID and $GID variables are not portable, so we need to resort
10628e4923e5Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10638e4923e5Smrg      # below are definitely unexpected, so allow the users to see them
10648e4923e5Smrg      # (that is, avoid stderr redirection).
10658e4923e5Smrg      am_uid=`id -u || echo unknown`
10668e4923e5Smrg      am_gid=`id -g || echo unknown`
10678e4923e5Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10688e4923e5Smrg      if test $am_uid -le $am_max_uid; then
10698e4923e5Smrg         AC_MSG_RESULT([yes])
10708e4923e5Smrg      else
10718e4923e5Smrg         AC_MSG_RESULT([no])
10728e4923e5Smrg         _am_tools=none
10738e4923e5Smrg      fi
10748e4923e5Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10758e4923e5Smrg      if test $am_gid -le $am_max_gid; then
10768e4923e5Smrg         AC_MSG_RESULT([yes])
10778e4923e5Smrg      else
10788e4923e5Smrg        AC_MSG_RESULT([no])
10798e4923e5Smrg        _am_tools=none
10808e4923e5Smrg      fi],
10818e4923e5Smrg
10828e4923e5Smrg  [pax],
10838e4923e5Smrg    [],
10848e4923e5Smrg
10858e4923e5Smrg  [m4_fatal([Unknown tar format])])
10868e4923e5Smrg
10878e4923e5Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
10888e4923e5Smrg
10898e4923e5Smrg  # Go ahead even if we have the value already cached.  We do so because we
10908e4923e5Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10918e4923e5Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10928e4923e5Smrg
10938e4923e5Smrg  for _am_tool in $_am_tools; do
10948e4923e5Smrg    case $_am_tool in
10958e4923e5Smrg    gnutar)
10968e4923e5Smrg      for _am_tar in tar gnutar gtar; do
10978e4923e5Smrg        AM_RUN_LOG([$_am_tar --version]) && break
10988e4923e5Smrg      done
10998e4923e5Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
11008e4923e5Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
11018e4923e5Smrg      am__untar="$_am_tar -xf -"
11028e4923e5Smrg      ;;
11038e4923e5Smrg    plaintar)
11048e4923e5Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11058e4923e5Smrg      # ustar tarball either.
11068e4923e5Smrg      (tar --version) >/dev/null 2>&1 && continue
11078e4923e5Smrg      am__tar='tar chf - "$$tardir"'
11088e4923e5Smrg      am__tar_='tar chf - "$tardir"'
11098e4923e5Smrg      am__untar='tar xf -'
11108e4923e5Smrg      ;;
11118e4923e5Smrg    pax)
11128e4923e5Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11138e4923e5Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11148e4923e5Smrg      am__untar='pax -r'
11158e4923e5Smrg      ;;
11168e4923e5Smrg    cpio)
11178e4923e5Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11188e4923e5Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11198e4923e5Smrg      am__untar='cpio -i -H $1 -d'
11208e4923e5Smrg      ;;
11218e4923e5Smrg    none)
11228e4923e5Smrg      am__tar=false
11238e4923e5Smrg      am__tar_=false
11248e4923e5Smrg      am__untar=false
11258e4923e5Smrg      ;;
11268e4923e5Smrg    esac
1127b8f75c19Smrg
11288e4923e5Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11298e4923e5Smrg    # and am__untar set.
11308e4923e5Smrg    test -n "${am_cv_prog_tar_$1}" && break
11318e4923e5Smrg
11328e4923e5Smrg    # tar/untar a dummy directory, and stop if the command works.
11338e4923e5Smrg    rm -rf conftest.dir
11348e4923e5Smrg    mkdir conftest.dir
11358e4923e5Smrg    echo GrepMe > conftest.dir/file
11368e4923e5Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11378e4923e5Smrg    rm -rf conftest.dir
11388e4923e5Smrg    if test -s conftest.tar; then
11398e4923e5Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11408e4923e5Smrg      AM_RUN_LOG([cat conftest.dir/file])
11418e4923e5Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11428e4923e5Smrg    fi
11438e4923e5Smrg  done
11447e4fd55aSmrg  rm -rf conftest.dir
1145b8f75c19Smrg
11468e4923e5Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11478e4923e5Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11488e4923e5Smrg
11497e4fd55aSmrgAC_SUBST([am__tar])
11507e4fd55aSmrgAC_SUBST([am__untar])
11517e4fd55aSmrg]) # _AM_PROG_TAR
1152b8f75c19Smrg
11538e4923e5Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
11548e4923e5Smrg# 
11558e4923e5Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11567e4fd55aSmrg#
11578e4923e5Smrg# This program is free software; you can redistribute it and/or modify
11588e4923e5Smrg# it under the terms of the GNU General Public License as published by
11598e4923e5Smrg# the Free Software Foundation; either version 2 of the License, or
11608e4923e5Smrg# (at your option) any later version.
11617e4fd55aSmrg#
11628e4923e5Smrg# This program is distributed in the hope that it will be useful, but
11638e4923e5Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
11648e4923e5Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11658e4923e5Smrg# General Public License for more details.
11667e4fd55aSmrg#
11678e4923e5Smrg# You should have received a copy of the GNU General Public License
11688e4923e5Smrg# along with this program; if not, write to the Free Software
11698e4923e5Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
11707e4fd55aSmrg#
11718e4923e5Smrg# As a special exception to the GNU General Public License, if you
11728e4923e5Smrg# distribute this file as part of a program that contains a
11738e4923e5Smrg# configuration script generated by Autoconf, you may include it under
11748e4923e5Smrg# the same distribution terms that you use for the rest of that program.
1175b8f75c19Smrg
11768e4923e5Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
11778e4923e5Smrg# ----------------------------------
11788e4923e5SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
11798e4923e5Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
11808e4923e5Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
11818e4923e5SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
11828e4923e5Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
11838e4923e5Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1184b8f75c19Smrgfi
11858e4923e5Smrgif test -n "$PKG_CONFIG"; then
11868e4923e5Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
11878e4923e5Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
11888e4923e5Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1189b8f75c19Smrg		AC_MSG_RESULT([yes])
1190b8f75c19Smrg	else
11918e4923e5Smrg		AC_MSG_RESULT([no])
11928e4923e5Smrg		PKG_CONFIG=""
1193b8f75c19Smrg	fi
11948e4923e5Smrg		
11958e4923e5Smrgfi[]dnl
11968e4923e5Smrg])# PKG_PROG_PKG_CONFIG
1197b8f75c19Smrg
11988e4923e5Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
11997e4fd55aSmrg#
12008e4923e5Smrg# Check to see whether a particular set of modules exists.  Similar
12018e4923e5Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
12028e4923e5Smrg#
12038e4923e5Smrg#
12048e4923e5Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
12058e4923e5Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
12068e4923e5Smrg# PKG_CHECK_EXISTS manually
12078e4923e5Smrg# --------------------------------------------------------------
12088e4923e5SmrgAC_DEFUN([PKG_CHECK_EXISTS],
12098e4923e5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12108e4923e5Smrgif test -n "$PKG_CONFIG" && \
12118e4923e5Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12128e4923e5Smrg  m4_ifval([$2], [$2], [:])
12138e4923e5Smrgm4_ifvaln([$3], [else
12148e4923e5Smrg  $3])dnl
12158e4923e5Smrgfi])
1216b8f75c19Smrg
12178e4923e5Smrg
12188e4923e5Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12198e4923e5Smrg# ---------------------------------------------
12208e4923e5Smrgm4_define([_PKG_CONFIG],
12218e4923e5Smrg[if test -n "$$1"; then
12228e4923e5Smrg    pkg_cv_[]$1="$$1"
12238e4923e5Smrg elif test -n "$PKG_CONFIG"; then
12248e4923e5Smrg    PKG_CHECK_EXISTS([$3],
12258e4923e5Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
12268e4923e5Smrg		     [pkg_failed=yes])
12278e4923e5Smrg else
12288e4923e5Smrg    pkg_failed=untried
12298e4923e5Smrgfi[]dnl
12308e4923e5Smrg])# _PKG_CONFIG
12318e4923e5Smrg
12328e4923e5Smrg# _PKG_SHORT_ERRORS_SUPPORTED
12338e4923e5Smrg# -----------------------------
12348e4923e5SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12358e4923e5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12368e4923e5Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12378e4923e5Smrg        _pkg_short_errors_supported=yes
12388e4923e5Smrgelse
12398e4923e5Smrg        _pkg_short_errors_supported=no
12408e4923e5Smrgfi[]dnl
12418e4923e5Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
12428e4923e5Smrg
12438e4923e5Smrg
12448e4923e5Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12458e4923e5Smrg# [ACTION-IF-NOT-FOUND])
12468e4923e5Smrg#
12478e4923e5Smrg#
12488e4923e5Smrg# Note that if there is a possibility the first call to
12498e4923e5Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
12508e4923e5Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12518e4923e5Smrg#
12528e4923e5Smrg#
12538e4923e5Smrg# --------------------------------------------------------------
12548e4923e5SmrgAC_DEFUN([PKG_CHECK_MODULES],
12558e4923e5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12568e4923e5SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12578e4923e5SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12588e4923e5Smrg
12598e4923e5Smrgpkg_failed=no
12608e4923e5SmrgAC_MSG_CHECKING([for $1])
12618e4923e5Smrg
12628e4923e5Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12638e4923e5Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12648e4923e5Smrg
12658e4923e5Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
12668e4923e5Smrgand $1[]_LIBS to avoid the need to call pkg-config.
12678e4923e5SmrgSee the pkg-config man page for more details.])
12688e4923e5Smrg
12698e4923e5Smrgif test $pkg_failed = yes; then
12708e4923e5Smrg        _PKG_SHORT_ERRORS_SUPPORTED
12718e4923e5Smrg        if test $_pkg_short_errors_supported = yes; then
12728e4923e5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
12738e4923e5Smrg        else 
12748e4923e5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
12758e4923e5Smrg        fi
12768e4923e5Smrg	# Put the nasty error message in config.log where it belongs
12778e4923e5Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
12788e4923e5Smrg
12798e4923e5Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
12808e4923e5Smrg[Package requirements ($2) were not met:
12818e4923e5Smrg
12828e4923e5Smrg$$1_PKG_ERRORS
12838e4923e5Smrg
12848e4923e5SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
12858e4923e5Smrginstalled software in a non-standard prefix.
12868e4923e5Smrg
12878e4923e5Smrg_PKG_TEXT
12888e4923e5Smrg])],
12898e4923e5Smrg		[AC_MSG_RESULT([no])
12908e4923e5Smrg                $4])
12918e4923e5Smrgelif test $pkg_failed = untried; then
12928e4923e5Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
12938e4923e5Smrg[The pkg-config script could not be found or is too old.  Make sure it
12948e4923e5Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
12958e4923e5Smrgpath to pkg-config.
12968e4923e5Smrg
12978e4923e5Smrg_PKG_TEXT
12988e4923e5Smrg
12998e4923e5SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
13008e4923e5Smrg		[$4])
13018e4923e5Smrgelse
13028e4923e5Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13038e4923e5Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13048e4923e5Smrg        AC_MSG_RESULT([yes])
13058e4923e5Smrg	ifelse([$3], , :, [$3])
13068e4923e5Smrgfi[]dnl
13078e4923e5Smrg])# PKG_CHECK_MODULES
13088e4923e5Smrg
13098e4923e5Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
13108e4923e5Smrgdnl
13118e4923e5Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
13128e4923e5Smrgdnl
13138e4923e5Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
13148e4923e5Smrgdnl copy of this software and associated documentation files (the "Software"),
13158e4923e5Smrgdnl to deal in the Software without restriction, including without limitation
13168e4923e5Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
13178e4923e5Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
13188e4923e5Smrgdnl Software is furnished to do so, subject to the following conditions:
13198e4923e5Smrgdnl
13208e4923e5Smrgdnl The above copyright notice and this permission notice (including the next
13218e4923e5Smrgdnl paragraph) shall be included in all copies or substantial portions of the
13228e4923e5Smrgdnl Software.
13238e4923e5Smrgdnl
13248e4923e5Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13258e4923e5Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13268e4923e5Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
13278e4923e5Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13288e4923e5Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13298e4923e5Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
13308e4923e5Smrgdnl DEALINGS IN THE SOFTWARE.
13318e4923e5Smrg
13328e4923e5Smrg# XORG_MACROS_VERSION(required-version)
13338e4923e5Smrg# -------------------------------------
13348e4923e5Smrg# Minimum version: 1.1.0
13358e4923e5Smrg#
13368e4923e5Smrg# If you're using a macro added in Version 1.1 or newer, include this in
13378e4923e5Smrg# your configure.ac with the minimum required version, such as:
13388e4923e5Smrg# XORG_MACROS_VERSION(1.1)
13398e4923e5Smrg#
13408e4923e5Smrg# To ensure that this macro is defined, also add:
13418e4923e5Smrg# m4_ifndef([XORG_MACROS_VERSION],
13428e4923e5Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
13438e4923e5Smrg#
13448e4923e5Smrg#
13458e4923e5Smrg# See the "minimum version" comment for each macro you use to see what
13468e4923e5Smrg# version you require.
13478e4923e5Smrgm4_defun([XORG_MACROS_VERSION],[
13488832ea4aSmrgm4_define([vers_have], [1.19.0])
13498e4923e5Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
13508e4923e5Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
13518e4923e5Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
13528e4923e5Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
13538e4923e5Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
13548e4923e5Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
13558e4923e5Smrgm4_undefine([vers_have])
13568e4923e5Smrgm4_undefine([maj_have])
13578e4923e5Smrgm4_undefine([maj_needed])
13588e4923e5Smrg]) # XORG_MACROS_VERSION
13598e4923e5Smrg
13608e4923e5Smrg# XORG_PROG_RAWCPP()
13618e4923e5Smrg# ------------------
13628e4923e5Smrg# Minimum version: 1.0.0
13638e4923e5Smrg#
13648e4923e5Smrg# Find cpp program and necessary flags for use in pre-processing text files
13658e4923e5Smrg# such as man pages and config files
13668e4923e5SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
13678e4923e5SmrgAC_REQUIRE([AC_PROG_CPP])
13688e4923e5SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
13698e4923e5Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
13708e4923e5Smrg
13718e4923e5Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
13728e4923e5Smrg# which is not the best choice for supporting other OS'es, but covers most
13738e4923e5Smrg# of the ones we need for now.
13748e4923e5SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
13758e4923e5SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
13768e4923e5Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13778e4923e5Smrg	AC_MSG_RESULT([no])
13788e4923e5Smrgelse
13798e4923e5Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13808e4923e5Smrg		RAWCPPFLAGS=-undef
13818e4923e5Smrg		AC_MSG_RESULT([yes])
13828e4923e5Smrg	# under Cygwin unix is still defined even with -undef
13838e4923e5Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13848e4923e5Smrg		RAWCPPFLAGS="-undef -ansi"
13858e4923e5Smrg		AC_MSG_RESULT([yes, with -ansi])
13868e4923e5Smrg	else
13878e4923e5Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
13888e4923e5Smrg	fi
13898e4923e5Smrgfi
13908e4923e5Smrgrm -f conftest.$ac_ext
13918e4923e5Smrg
13928e4923e5SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
13938e4923e5SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
13948e4923e5Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
13958e4923e5Smrg	AC_MSG_RESULT([no])
13968e4923e5Smrgelse
13978e4923e5Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
13988832ea4aSmrg		TRADITIONALCPPFLAGS="-traditional"
13998e4923e5Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
14008e4923e5Smrg		AC_MSG_RESULT([yes])
14018e4923e5Smrg	else
14028e4923e5Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
14038e4923e5Smrg	fi
14048e4923e5Smrgfi
14058e4923e5Smrgrm -f conftest.$ac_ext
14068e4923e5SmrgAC_SUBST(RAWCPPFLAGS)
14078832ea4aSmrgAC_SUBST(TRADITIONALCPPFLAGS)
14088e4923e5Smrg]) # XORG_PROG_RAWCPP
14098e4923e5Smrg
14108e4923e5Smrg# XORG_MANPAGE_SECTIONS()
14118e4923e5Smrg# -----------------------
14128e4923e5Smrg# Minimum version: 1.0.0
14138e4923e5Smrg#
14148e4923e5Smrg# Determine which sections man pages go in for the different man page types
14158e4923e5Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
14168e4923e5Smrg# Not sure if there's any better way than just hardcoding by OS name.
14178e4923e5Smrg# Override default settings by setting environment variables
14188e4923e5Smrg# Added MAN_SUBSTS in version 1.8
14198e4923e5Smrg# Added AC_PROG_SED in version 1.8
14208e4923e5Smrg
14218e4923e5SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
14228e4923e5SmrgAC_REQUIRE([AC_CANONICAL_HOST])
14238e4923e5SmrgAC_REQUIRE([AC_PROG_SED])
14248e4923e5Smrg
14258e4923e5Smrgif test x$APP_MAN_SUFFIX = x    ; then
14268e4923e5Smrg    APP_MAN_SUFFIX=1
14278e4923e5Smrgfi
14288e4923e5Smrgif test x$APP_MAN_DIR = x    ; then
14298e4923e5Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
14308e4923e5Smrgfi
1431b8f75c19Smrg
1432b8f75c19Smrgif test x$LIB_MAN_SUFFIX = x    ; then
14337e4fd55aSmrg    LIB_MAN_SUFFIX=3
1434b8f75c19Smrgfi
1435b8f75c19Smrgif test x$LIB_MAN_DIR = x    ; then
14367e4fd55aSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1437b8f75c19Smrgfi
1438b8f75c19Smrg
1439b8f75c19Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1440b8f75c19Smrg    case $host_os in
1441b8f75c19Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1442b8f75c19Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1443b8f75c19Smrg    esac
1444b8f75c19Smrgfi
1445b8f75c19Smrgif test x$FILE_MAN_DIR = x    ; then
14467e4fd55aSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1447b8f75c19Smrgfi
1448b8f75c19Smrg
1449b8f75c19Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1450b8f75c19Smrg    case $host_os in
1451b8f75c19Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1452b8f75c19Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1453b8f75c19Smrg    esac
1454b8f75c19Smrgfi
1455b8f75c19Smrgif test x$MISC_MAN_DIR = x    ; then
14567e4fd55aSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1457b8f75c19Smrgfi
1458b8f75c19Smrg
1459b8f75c19Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1460b8f75c19Smrg    case $host_os in
1461b8f75c19Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1462b8f75c19Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1463b8f75c19Smrg    esac
1464b8f75c19Smrgfi
1465b8f75c19Smrgif test x$DRIVER_MAN_DIR = x    ; then
14667e4fd55aSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1467b8f75c19Smrgfi
1468b8f75c19Smrg
1469b8f75c19Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1470b8f75c19Smrg    case $host_os in
1471b8f75c19Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1472b8f75c19Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1473b8f75c19Smrg    esac
1474b8f75c19Smrgfi
1475b8f75c19Smrgif test x$ADMIN_MAN_DIR = x    ; then
1476b8f75c19Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1477b8f75c19Smrgfi
1478b8f75c19Smrg
1479b8f75c19Smrg
1480b8f75c19SmrgAC_SUBST([APP_MAN_SUFFIX])
1481b8f75c19SmrgAC_SUBST([LIB_MAN_SUFFIX])
1482b8f75c19SmrgAC_SUBST([FILE_MAN_SUFFIX])
1483b8f75c19SmrgAC_SUBST([MISC_MAN_SUFFIX])
1484b8f75c19SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1485b8f75c19SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1486b8f75c19SmrgAC_SUBST([APP_MAN_DIR])
1487b8f75c19SmrgAC_SUBST([LIB_MAN_DIR])
1488b8f75c19SmrgAC_SUBST([FILE_MAN_DIR])
1489b8f75c19SmrgAC_SUBST([MISC_MAN_DIR])
1490b8f75c19SmrgAC_SUBST([DRIVER_MAN_DIR])
1491b8f75c19SmrgAC_SUBST([ADMIN_MAN_DIR])
14927e4fd55aSmrg
14937e4fd55aSmrgXORG_MAN_PAGE="X Version 11"
14947e4fd55aSmrgAC_SUBST([XORG_MAN_PAGE])
14957e4fd55aSmrgMAN_SUBSTS="\
14967e4fd55aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
14977e4fd55aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
14987e4fd55aSmrg	-e 's|__xservername__|Xorg|g' \
14997e4fd55aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
15007e4fd55aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
15017e4fd55aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
15027e4fd55aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
15037e4fd55aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
15047e4fd55aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
15057e4fd55aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
15067e4fd55aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
15077e4fd55aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
15087e4fd55aSmrgAC_SUBST([MAN_SUBSTS])
15097e4fd55aSmrg
1510b8f75c19Smrg]) # XORG_MANPAGE_SECTIONS
1511b8f75c19Smrg
15127e4fd55aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
15137e4fd55aSmrg# ------------------------
15147e4fd55aSmrg# Minimum version: 1.7.0
15157e4fd55aSmrg#
15167e4fd55aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
15177e4fd55aSmrg# provided by xorg-sgml-doctools, if installed.
15187e4fd55aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
15197e4fd55aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
15207e4fd55aSmrgXORG_SGML_PATH=
15217e4fd55aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
15227e4fd55aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
15237e4fd55aSmrg    [m4_ifval([$1],[:],
15247e4fd55aSmrg        [if test x"$cross_compiling" != x"yes" ; then
15257e4fd55aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
15267e4fd55aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
15277e4fd55aSmrg         fi])
15287e4fd55aSmrg    ])
15297e4fd55aSmrg
15307e4fd55aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
15317e4fd55aSmrg# the path and the name of the doc stylesheet
15327e4fd55aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
15337e4fd55aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
15347e4fd55aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
15357e4fd55aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
15367e4fd55aSmrgelse
15377e4fd55aSmrg   AC_MSG_RESULT([no])
15387e4fd55aSmrgfi
15397e4fd55aSmrg
15407e4fd55aSmrgAC_SUBST(XORG_SGML_PATH)
15417e4fd55aSmrgAC_SUBST(STYLESHEET_SRCDIR)
15427e4fd55aSmrgAC_SUBST(XSL_STYLESHEET)
15437e4fd55aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
15447e4fd55aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
15457e4fd55aSmrg
1546b8f75c19Smrg# XORG_CHECK_LINUXDOC
1547b8f75c19Smrg# -------------------
15487e4fd55aSmrg# Minimum version: 1.0.0
15497e4fd55aSmrg#
1550b8f75c19Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1551b8f75c19Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1552b8f75c19Smrg# Whether or not the necessary tools and files are found can be checked
1553b8f75c19Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1554b8f75c19SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
15557e4fd55aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
15567e4fd55aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1557b8f75c19Smrg
1558b8f75c19SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1559b8f75c19Smrg
15607e4fd55aSmrgAC_MSG_CHECKING([whether to build documentation])
1561b8f75c19Smrg
15627e4fd55aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1563b8f75c19Smrg   BUILDDOC=yes
1564b8f75c19Smrgelse
15657e4fd55aSmrg   BUILDDOC=no
15667e4fd55aSmrgfi
15677e4fd55aSmrg
15687e4fd55aSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
15697e4fd55aSmrg
15707e4fd55aSmrgAC_MSG_RESULT([$BUILDDOC])
15717e4fd55aSmrg
15727e4fd55aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
15737e4fd55aSmrg
15747e4fd55aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
15757e4fd55aSmrg   BUILDPDFDOC=yes
15767e4fd55aSmrgelse
15777e4fd55aSmrg   BUILDPDFDOC=no
15787e4fd55aSmrgfi
15797e4fd55aSmrg
15807e4fd55aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
15817e4fd55aSmrg
15827e4fd55aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
15837e4fd55aSmrg
15847e4fd55aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
15857e4fd55aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
15867e4fd55aSmrgMAKE_PDF="$PS2PDF"
15877e4fd55aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
15887e4fd55aSmrg
15897e4fd55aSmrgAC_SUBST(MAKE_TEXT)
15907e4fd55aSmrgAC_SUBST(MAKE_PS)
15917e4fd55aSmrgAC_SUBST(MAKE_PDF)
15927e4fd55aSmrgAC_SUBST(MAKE_HTML)
15937e4fd55aSmrg]) # XORG_CHECK_LINUXDOC
15947e4fd55aSmrg
15957e4fd55aSmrg# XORG_CHECK_DOCBOOK
15967e4fd55aSmrg# -------------------
15977e4fd55aSmrg# Minimum version: 1.0.0
15987e4fd55aSmrg#
15997e4fd55aSmrg# Checks for the ability to build output formats from SGML DocBook source.
16007e4fd55aSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16017e4fd55aSmrg# indicates whether the necessary tools and files are found and, if set,
16027e4fd55aSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16037e4fd55aSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
16047e4fd55aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16057e4fd55aSmrg
16067e4fd55aSmrgBUILDTXTDOC=no
16077e4fd55aSmrgBUILDPDFDOC=no
16087e4fd55aSmrgBUILDPSDOC=no
16097e4fd55aSmrgBUILDHTMLDOC=no
16107e4fd55aSmrg
16117e4fd55aSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16127e4fd55aSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16137e4fd55aSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16147e4fd55aSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
16157e4fd55aSmrg
16167e4fd55aSmrgAC_MSG_CHECKING([whether to build text documentation])
16177e4fd55aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16187e4fd55aSmrg   test x$BUILD_TXTDOC != xno; then
16197e4fd55aSmrg	BUILDTXTDOC=yes
16207e4fd55aSmrgfi
16217e4fd55aSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16227e4fd55aSmrgAC_MSG_RESULT([$BUILDTXTDOC])
16237e4fd55aSmrg
16247e4fd55aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
16257e4fd55aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16267e4fd55aSmrg   test x$BUILD_PDFDOC != xno; then
16277e4fd55aSmrg	BUILDPDFDOC=yes
16287e4fd55aSmrgfi
16297e4fd55aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16307e4fd55aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
16317e4fd55aSmrg
16327e4fd55aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
16337e4fd55aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
16347e4fd55aSmrg   test x$BUILD_PSDOC != xno; then
16357e4fd55aSmrg	BUILDPSDOC=yes
16367e4fd55aSmrgfi
16377e4fd55aSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
16387e4fd55aSmrgAC_MSG_RESULT([$BUILDPSDOC])
16397e4fd55aSmrg
16407e4fd55aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
16417e4fd55aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
16427e4fd55aSmrg   test x$BUILD_HTMLDOC != xno; then
16437e4fd55aSmrg	BUILDHTMLDOC=yes
16447e4fd55aSmrgfi
16457e4fd55aSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
16467e4fd55aSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
16477e4fd55aSmrg
16487e4fd55aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
16497e4fd55aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
16507e4fd55aSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
16517e4fd55aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
16527e4fd55aSmrg
16537e4fd55aSmrgAC_SUBST(MAKE_TEXT)
16547e4fd55aSmrgAC_SUBST(MAKE_PS)
16557e4fd55aSmrgAC_SUBST(MAKE_PDF)
16567e4fd55aSmrgAC_SUBST(MAKE_HTML)
16577e4fd55aSmrg]) # XORG_CHECK_DOCBOOK
16587e4fd55aSmrg
16597e4fd55aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
16607e4fd55aSmrg# ----------------
16617e4fd55aSmrg# Minimum version: 1.5.0
16627e4fd55aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
16637e4fd55aSmrg#
16647e4fd55aSmrg# Documentation tools are not always available on all platforms and sometimes
16657e4fd55aSmrg# not at the appropriate level. This macro enables a module to test for the
16667e4fd55aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
16677e4fd55aSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
16687e4fd55aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
16697e4fd55aSmrg# --with-xmlto assumes 'auto'.
16707e4fd55aSmrg#
16717e4fd55aSmrg# Interface to module:
16727e4fd55aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
16737e4fd55aSmrg# XMLTO:	returns the path of the xmlto program found
16747e4fd55aSmrg#		returns the path set by the user in the environment
16757e4fd55aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
16767e4fd55aSmrg#		'no' user instructs the module not to use xmlto
16777e4fd55aSmrg#
16787e4fd55aSmrg# Added in version 1.10.0
16797e4fd55aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
16807e4fd55aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
16817e4fd55aSmrg#
16827e4fd55aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
16837e4fd55aSmrg#
16847e4fd55aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
16857e4fd55aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
16867e4fd55aSmrgm4_define([_defopt], m4_default([$2], [auto]))
16877e4fd55aSmrgAC_ARG_WITH(xmlto,
16887e4fd55aSmrg	AS_HELP_STRING([--with-xmlto],
16897e4fd55aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
16907e4fd55aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
16917e4fd55aSmrgm4_undefine([_defopt])
16927e4fd55aSmrg
16937e4fd55aSmrgif test "x$use_xmlto" = x"auto"; then
16947e4fd55aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
16957e4fd55aSmrg   if test "x$XMLTO" = "x"; then
16967e4fd55aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
16977e4fd55aSmrg	have_xmlto=no
16987e4fd55aSmrg   else
16997e4fd55aSmrg        have_xmlto=yes
17007e4fd55aSmrg   fi
17017e4fd55aSmrgelif test "x$use_xmlto" = x"yes" ; then
17027e4fd55aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
17037e4fd55aSmrg   if test "x$XMLTO" = "x"; then
17047e4fd55aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
17057e4fd55aSmrg   fi
17067e4fd55aSmrg   have_xmlto=yes
17077e4fd55aSmrgelif test "x$use_xmlto" = x"no" ; then
17087e4fd55aSmrg   if test "x$XMLTO" != "x"; then
17097e4fd55aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
17107e4fd55aSmrg   fi
17117e4fd55aSmrg   have_xmlto=no
17127e4fd55aSmrgelse
17137e4fd55aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
17147e4fd55aSmrgfi
17157e4fd55aSmrg
17167e4fd55aSmrg# Test for a minimum version of xmlto, if provided.
17177e4fd55aSmrgm4_ifval([$1],
17187e4fd55aSmrg[if test "$have_xmlto" = yes; then
17197e4fd55aSmrg    # scrape the xmlto version
17207e4fd55aSmrg    AC_MSG_CHECKING([the xmlto version])
17217e4fd55aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
17227e4fd55aSmrg    AC_MSG_RESULT([$xmlto_version])
17237e4fd55aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
17247e4fd55aSmrg        [if test "x$use_xmlto" = xauto; then
17257e4fd55aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
17267e4fd55aSmrg            have_xmlto=no
17277e4fd55aSmrg        else
17287e4fd55aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
17297e4fd55aSmrg        fi])
17307e4fd55aSmrgfi])
17317e4fd55aSmrg
17327e4fd55aSmrg# Test for the ability of xmlto to generate a text target
17337e4fd55aSmrghave_xmlto_text=no
17347e4fd55aSmrgcat > conftest.xml << "EOF"
17357e4fd55aSmrgEOF
17367e4fd55aSmrgAS_IF([test "$have_xmlto" = yes],
17377e4fd55aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
17387e4fd55aSmrg             [have_xmlto_text=yes],
17397e4fd55aSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
17407e4fd55aSmrgrm -f conftest.xml
17417e4fd55aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
17427e4fd55aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
17437e4fd55aSmrg]) # XORG_WITH_XMLTO
17447e4fd55aSmrg
17458e4923e5Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
17468e4923e5Smrg# --------------------------------------------
17478e4923e5Smrg# Minimum version: 1.12.0
17488e4923e5Smrg# Minimum version for optional DEFAULT argument: 1.12.0
17498e4923e5Smrg#
17508e4923e5Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
17518e4923e5Smrg# XML-based language used for the transformation of XML documents.
17528e4923e5Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
17538e4923e5Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
17548e4923e5Smrg# The XSLT processor is often used as a standalone tool for transformations.
17558e4923e5Smrg# It should not be assumed that this tool is used only to work with documnetation.
17568e4923e5Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
17578e4923e5Smrg#
17588e4923e5Smrg# Interface to module:
17598e4923e5Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
17608e4923e5Smrg# XSLTPROC:	 returns the path of the xsltproc program found
17618e4923e5Smrg#		 returns the path set by the user in the environment
17628e4923e5Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
17638e4923e5Smrg#		  'no' user instructs the module not to use xsltproc
17648e4923e5Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
17658e4923e5Smrg#
17668e4923e5Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
17678e4923e5Smrg#
17688e4923e5SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
17698e4923e5SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
17708e4923e5Smrg# Preserves the interface, should it be implemented later
17718e4923e5Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
17728e4923e5Smrgm4_define([_defopt], m4_default([$2], [auto]))
17738e4923e5SmrgAC_ARG_WITH(xsltproc,
17748e4923e5Smrg	AS_HELP_STRING([--with-xsltproc],
17758e4923e5Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
17768e4923e5Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
17778e4923e5Smrgm4_undefine([_defopt])
17788e4923e5Smrg
17798e4923e5Smrgif test "x$use_xsltproc" = x"auto"; then
17808e4923e5Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
17818e4923e5Smrg   if test "x$XSLTPROC" = "x"; then
17828e4923e5Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
17838e4923e5Smrg	have_xsltproc=no
17848e4923e5Smrg   else
17858e4923e5Smrg        have_xsltproc=yes
17868e4923e5Smrg   fi
17878e4923e5Smrgelif test "x$use_xsltproc" = x"yes" ; then
17888e4923e5Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
17898e4923e5Smrg   if test "x$XSLTPROC" = "x"; then
17908e4923e5Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
17918e4923e5Smrg   fi
17928e4923e5Smrg   have_xsltproc=yes
17938e4923e5Smrgelif test "x$use_xsltproc" = x"no" ; then
17948e4923e5Smrg   if test "x$XSLTPROC" != "x"; then
17958e4923e5Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
17968e4923e5Smrg   fi
17978e4923e5Smrg   have_xsltproc=no
17988e4923e5Smrgelse
17998e4923e5Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
18008e4923e5Smrgfi
18018e4923e5Smrg
18028e4923e5SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
18038e4923e5Smrg]) # XORG_WITH_XSLTPROC
18048e4923e5Smrg
18058e4923e5Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
18068e4923e5Smrg# ----------------------------------------
18078e4923e5Smrg# Minimum version: 1.15.0
18088e4923e5Smrg#
18098e4923e5Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
18108e4923e5Smrg# scanning arbitrary text files, extracting information from those text files,
18118e4923e5Smrg# and printing reports based on that information.
18128e4923e5Smrg#
18138e4923e5Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
18148e4923e5Smrg#
18158e4923e5Smrg# Interface to module:
18168e4923e5Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
18178e4923e5Smrg# PERL:	     returns the path of the perl program found
18188e4923e5Smrg#	     returns the path set by the user in the environment
18198e4923e5Smrg# --with-perl: 'yes' user instructs the module to use perl
18208e4923e5Smrg#	       'no' user instructs the module not to use perl
18218e4923e5Smrg# have_perl: returns yes if perl found in PATH or no
18228e4923e5Smrg#
18238e4923e5Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
18248e4923e5Smrg#
18258e4923e5SmrgAC_DEFUN([XORG_WITH_PERL],[
18268e4923e5SmrgAC_ARG_VAR([PERL], [Path to perl command])
18278e4923e5Smrg# Preserves the interface, should it be implemented later
18288e4923e5Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
18298e4923e5Smrgm4_define([_defopt], m4_default([$2], [auto]))
18308e4923e5SmrgAC_ARG_WITH(perl,
18318e4923e5Smrg	AS_HELP_STRING([--with-perl],
18328e4923e5Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
18338e4923e5Smrg	   [use_perl=$withval], [use_perl=]_defopt)
18348e4923e5Smrgm4_undefine([_defopt])
18358e4923e5Smrg
18368e4923e5Smrgif test "x$use_perl" = x"auto"; then
18378e4923e5Smrg   AC_PATH_PROG([PERL], [perl])
18388e4923e5Smrg   if test "x$PERL" = "x"; then
18398e4923e5Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
18408e4923e5Smrg	have_perl=no
18418e4923e5Smrg   else
18428e4923e5Smrg        have_perl=yes
18438e4923e5Smrg   fi
18448e4923e5Smrgelif test "x$use_perl" = x"yes" ; then
18458e4923e5Smrg   AC_PATH_PROG([PERL], [perl])
18468e4923e5Smrg   if test "x$PERL" = "x"; then
18478e4923e5Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
18488e4923e5Smrg   fi
18498e4923e5Smrg   have_perl=yes
18508e4923e5Smrgelif test "x$use_perl" = x"no" ; then
18518e4923e5Smrg   if test "x$PERL" != "x"; then
18528e4923e5Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
18538e4923e5Smrg   fi
18548e4923e5Smrg   have_perl=no
18558e4923e5Smrgelse
18568e4923e5Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
18578e4923e5Smrgfi
18588e4923e5Smrg
18598e4923e5SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
18608e4923e5Smrg]) # XORG_WITH_PERL
18618e4923e5Smrg
18627e4fd55aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
18637e4fd55aSmrg# ----------------
18647e4fd55aSmrg# Minimum version: 1.5.0
18657e4fd55aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
18667e4fd55aSmrg#
18677e4fd55aSmrg# Documentation tools are not always available on all platforms and sometimes
18687e4fd55aSmrg# not at the appropriate level. This macro enables a module to test for the
18697e4fd55aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
18707e4fd55aSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
18717e4fd55aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
18727e4fd55aSmrg# --with-asciidoc assumes 'auto'.
18737e4fd55aSmrg#
18747e4fd55aSmrg# Interface to module:
18757e4fd55aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
18767e4fd55aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
18777e4fd55aSmrg#		 returns the path set by the user in the environment
18787e4fd55aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
18797e4fd55aSmrg#		  'no' user instructs the module not to use asciidoc
18807e4fd55aSmrg#
18817e4fd55aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
18827e4fd55aSmrg#
18837e4fd55aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
18847e4fd55aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
18857e4fd55aSmrgm4_define([_defopt], m4_default([$2], [auto]))
18867e4fd55aSmrgAC_ARG_WITH(asciidoc,
18877e4fd55aSmrg	AS_HELP_STRING([--with-asciidoc],
18887e4fd55aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
18897e4fd55aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
18907e4fd55aSmrgm4_undefine([_defopt])
18917e4fd55aSmrg
18927e4fd55aSmrgif test "x$use_asciidoc" = x"auto"; then
18937e4fd55aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
18947e4fd55aSmrg   if test "x$ASCIIDOC" = "x"; then
18957e4fd55aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
18967e4fd55aSmrg	have_asciidoc=no
18977e4fd55aSmrg   else
18987e4fd55aSmrg        have_asciidoc=yes
18997e4fd55aSmrg   fi
19007e4fd55aSmrgelif test "x$use_asciidoc" = x"yes" ; then
19017e4fd55aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
19027e4fd55aSmrg   if test "x$ASCIIDOC" = "x"; then
19037e4fd55aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
19047e4fd55aSmrg   fi
19057e4fd55aSmrg   have_asciidoc=yes
19067e4fd55aSmrgelif test "x$use_asciidoc" = x"no" ; then
19077e4fd55aSmrg   if test "x$ASCIIDOC" != "x"; then
19087e4fd55aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
19097e4fd55aSmrg   fi
19107e4fd55aSmrg   have_asciidoc=no
19117e4fd55aSmrgelse
19127e4fd55aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
19137e4fd55aSmrgfi
19147e4fd55aSmrgm4_ifval([$1],
19157e4fd55aSmrg[if test "$have_asciidoc" = yes; then
19167e4fd55aSmrg    # scrape the asciidoc version
19177e4fd55aSmrg    AC_MSG_CHECKING([the asciidoc version])
19187e4fd55aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
19197e4fd55aSmrg    AC_MSG_RESULT([$asciidoc_version])
19207e4fd55aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
19217e4fd55aSmrg        [if test "x$use_asciidoc" = xauto; then
19227e4fd55aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
19237e4fd55aSmrg            have_asciidoc=no
19247e4fd55aSmrg        else
19257e4fd55aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
19267e4fd55aSmrg        fi])
19277e4fd55aSmrgfi])
19287e4fd55aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
19297e4fd55aSmrg]) # XORG_WITH_ASCIIDOC
19307e4fd55aSmrg
19317e4fd55aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
19328832ea4aSmrg# -------------------------------------------
19337e4fd55aSmrg# Minimum version: 1.5.0
19347e4fd55aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
19358832ea4aSmrg# Minimum version for optional DOT checking: 1.18.0
19367e4fd55aSmrg#
19377e4fd55aSmrg# Documentation tools are not always available on all platforms and sometimes
19387e4fd55aSmrg# not at the appropriate level. This macro enables a module to test for the
19397e4fd55aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
19407e4fd55aSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
19417e4fd55aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
19427e4fd55aSmrg# --with-doxygen assumes 'auto'.
19437e4fd55aSmrg#
19447e4fd55aSmrg# Interface to module:
19457e4fd55aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
19467e4fd55aSmrg# DOXYGEN:	 returns the path of the doxygen program found
19477e4fd55aSmrg#		 returns the path set by the user in the environment
19487e4fd55aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
19497e4fd55aSmrg#		  'no' user instructs the module not to use doxygen
19507e4fd55aSmrg#
19517e4fd55aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
19527e4fd55aSmrg#
19537e4fd55aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
19547e4fd55aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
19558832ea4aSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
19567e4fd55aSmrgm4_define([_defopt], m4_default([$2], [auto]))
19577e4fd55aSmrgAC_ARG_WITH(doxygen,
19587e4fd55aSmrg	AS_HELP_STRING([--with-doxygen],
19597e4fd55aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
19607e4fd55aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
19617e4fd55aSmrgm4_undefine([_defopt])
19627e4fd55aSmrg
19637e4fd55aSmrgif test "x$use_doxygen" = x"auto"; then
19647e4fd55aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
19657e4fd55aSmrg   if test "x$DOXYGEN" = "x"; then
19667e4fd55aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
19677e4fd55aSmrg	have_doxygen=no
19687e4fd55aSmrg   else
19697e4fd55aSmrg        have_doxygen=yes
19707e4fd55aSmrg   fi
19717e4fd55aSmrgelif test "x$use_doxygen" = x"yes" ; then
19727e4fd55aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
19737e4fd55aSmrg   if test "x$DOXYGEN" = "x"; then
19747e4fd55aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
19757e4fd55aSmrg   fi
19767e4fd55aSmrg   have_doxygen=yes
19777e4fd55aSmrgelif test "x$use_doxygen" = x"no" ; then
19787e4fd55aSmrg   if test "x$DOXYGEN" != "x"; then
19797e4fd55aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
19807e4fd55aSmrg   fi
19817e4fd55aSmrg   have_doxygen=no
19827e4fd55aSmrgelse
19837e4fd55aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1984b8f75c19Smrgfi
19857e4fd55aSmrgm4_ifval([$1],
19867e4fd55aSmrg[if test "$have_doxygen" = yes; then
19877e4fd55aSmrg    # scrape the doxygen version
19887e4fd55aSmrg    AC_MSG_CHECKING([the doxygen version])
19897e4fd55aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
19907e4fd55aSmrg    AC_MSG_RESULT([$doxygen_version])
19917e4fd55aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
19927e4fd55aSmrg        [if test "x$use_doxygen" = xauto; then
19937e4fd55aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
19947e4fd55aSmrg            have_doxygen=no
19957e4fd55aSmrg        else
19967e4fd55aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
19977e4fd55aSmrg        fi])
19987e4fd55aSmrgfi])
19998832ea4aSmrg
20008832ea4aSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
20018832ea4aSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
20028832ea4aSmrgdnl 	HAVE_DOT = @HAVE_DOT@
20038832ea4aSmrgHAVE_DOT=no
20048832ea4aSmrgif test "x$have_doxygen" = "xyes"; then
20058832ea4aSmrg  AC_PATH_PROG([DOT], [dot])
20068832ea4aSmrg    if test "x$DOT" != "x"; then
20078832ea4aSmrg      HAVE_DOT=yes
20088832ea4aSmrg    fi
20098832ea4aSmrgfi
20108832ea4aSmrg
20118832ea4aSmrgAC_SUBST([HAVE_DOT])
20128832ea4aSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
20137e4fd55aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
20147e4fd55aSmrg]) # XORG_WITH_DOXYGEN
2015b8f75c19Smrg
20167e4fd55aSmrg# XORG_WITH_GROFF([DEFAULT])
20177e4fd55aSmrg# ----------------
20187e4fd55aSmrg# Minimum version: 1.6.0
20197e4fd55aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20207e4fd55aSmrg#
20217e4fd55aSmrg# Documentation tools are not always available on all platforms and sometimes
20227e4fd55aSmrg# not at the appropriate level. This macro enables a module to test for the
20237e4fd55aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20247e4fd55aSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
20257e4fd55aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
20267e4fd55aSmrg# --with-groff assumes 'auto'.
20277e4fd55aSmrg#
20287e4fd55aSmrg# Interface to module:
20297e4fd55aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
20307e4fd55aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
20317e4fd55aSmrg# HAVE_GROFF_MS: the -ms macros package
20327e4fd55aSmrg# GROFF:	 returns the path of the groff program found
20337e4fd55aSmrg#		 returns the path set by the user in the environment
20347e4fd55aSmrg# --with-groff:	 'yes' user instructs the module to use groff
20357e4fd55aSmrg#		 'no' user instructs the module not to use groff
20367e4fd55aSmrg#
20377e4fd55aSmrg# Added in version 1.9.0:
20387e4fd55aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
20397e4fd55aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
20407e4fd55aSmrg#		   psselect from the psutils package.
20417e4fd55aSmrg#		   the ghostcript package. Refer to the grohtml man pages
20427e4fd55aSmrg#
20437e4fd55aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
20447e4fd55aSmrg#
20457e4fd55aSmrg# OS and distros often splits groff in a basic and full package, the former
20467e4fd55aSmrg# having the groff program and the later having devices, fonts and macros
20477e4fd55aSmrg# Checking for the groff executable is not enough.
20487e4fd55aSmrg#
20497e4fd55aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
20507e4fd55aSmrg# unset HAVE_GROFF or GROFF env variables.
20517e4fd55aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
20527e4fd55aSmrg#
20537e4fd55aSmrgAC_DEFUN([XORG_WITH_GROFF],[
20547e4fd55aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
20557e4fd55aSmrgm4_define([_defopt], m4_default([$1], [auto]))
20567e4fd55aSmrgAC_ARG_WITH(groff,
20577e4fd55aSmrg	AS_HELP_STRING([--with-groff],
20587e4fd55aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
20597e4fd55aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
20607e4fd55aSmrgm4_undefine([_defopt])
20617e4fd55aSmrg
20627e4fd55aSmrgif test "x$use_groff" = x"auto"; then
20637e4fd55aSmrg   AC_PATH_PROG([GROFF], [groff])
20647e4fd55aSmrg   if test "x$GROFF" = "x"; then
20657e4fd55aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
20667e4fd55aSmrg	have_groff=no
20677e4fd55aSmrg   else
20687e4fd55aSmrg        have_groff=yes
20697e4fd55aSmrg   fi
20707e4fd55aSmrgelif test "x$use_groff" = x"yes" ; then
20717e4fd55aSmrg   AC_PATH_PROG([GROFF], [groff])
20727e4fd55aSmrg   if test "x$GROFF" = "x"; then
20737e4fd55aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
20747e4fd55aSmrg   fi
20757e4fd55aSmrg   have_groff=yes
20767e4fd55aSmrgelif test "x$use_groff" = x"no" ; then
20777e4fd55aSmrg   if test "x$GROFF" != "x"; then
20787e4fd55aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
20797e4fd55aSmrg   fi
20807e4fd55aSmrg   have_groff=no
20817e4fd55aSmrgelse
20827e4fd55aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
20837e4fd55aSmrgfi
2084b8f75c19Smrg
20857e4fd55aSmrg# We have groff, test for the presence of the macro packages
20867e4fd55aSmrgif test "x$have_groff" = x"yes"; then
20877e4fd55aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
20887e4fd55aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
20897e4fd55aSmrg        groff_ms_works=yes
20907e4fd55aSmrg    else
20917e4fd55aSmrg        groff_ms_works=no
20927e4fd55aSmrg    fi
20937e4fd55aSmrg    AC_MSG_RESULT([$groff_ms_works])
20947e4fd55aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
20957e4fd55aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
20967e4fd55aSmrg        groff_mm_works=yes
20977e4fd55aSmrg    else
20987e4fd55aSmrg        groff_mm_works=no
20997e4fd55aSmrg    fi
21007e4fd55aSmrg    AC_MSG_RESULT([$groff_mm_works])
21017e4fd55aSmrgfi
2102b8f75c19Smrg
21037e4fd55aSmrg# We have groff, test for HTML dependencies, one command per package
21047e4fd55aSmrgif test "x$have_groff" = x"yes"; then
21057e4fd55aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
21067e4fd55aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
21077e4fd55aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
21087e4fd55aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
21097e4fd55aSmrg      have_groff_html=yes
21107e4fd55aSmrg   else
21117e4fd55aSmrg      have_groff_html=no
21127e4fd55aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
21137e4fd55aSmrg   fi
21147e4fd55aSmrgfi
2115b8f75c19Smrg
21167e4fd55aSmrg# Set Automake conditionals for Makefiles
21177e4fd55aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
21187e4fd55aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
21197e4fd55aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
21207e4fd55aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
21217e4fd55aSmrg]) # XORG_WITH_GROFF
21227e4fd55aSmrg
21238e4923e5Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
21248e4923e5Smrg# ---------------------------------------
21257e4fd55aSmrg# Minimum version: 1.6.0
21267e4fd55aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
21278e4923e5Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
21287e4fd55aSmrg#
21297e4fd55aSmrg# Documentation tools are not always available on all platforms and sometimes
21307e4fd55aSmrg# not at the appropriate level. This macro enables a module to test for the
21317e4fd55aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
21327e4fd55aSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
21337e4fd55aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
21347e4fd55aSmrg# --with-fop assumes 'auto'.
21357e4fd55aSmrg#
21367e4fd55aSmrg# Interface to module:
21377e4fd55aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
21387e4fd55aSmrg# FOP:	 	returns the path of the fop program found
21397e4fd55aSmrg#		returns the path set by the user in the environment
21407e4fd55aSmrg# --with-fop: 	'yes' user instructs the module to use fop
21417e4fd55aSmrg#		'no' user instructs the module not to use fop
21427e4fd55aSmrg#
21437e4fd55aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
21447e4fd55aSmrg#
21457e4fd55aSmrgAC_DEFUN([XORG_WITH_FOP],[
21467e4fd55aSmrgAC_ARG_VAR([FOP], [Path to fop command])
21478e4923e5Smrgm4_define([_defopt], m4_default([$2], [auto]))
21487e4fd55aSmrgAC_ARG_WITH(fop,
21497e4fd55aSmrg	AS_HELP_STRING([--with-fop],
21507e4fd55aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
21517e4fd55aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
21527e4fd55aSmrgm4_undefine([_defopt])
21537e4fd55aSmrg
21547e4fd55aSmrgif test "x$use_fop" = x"auto"; then
21557e4fd55aSmrg   AC_PATH_PROG([FOP], [fop])
21567e4fd55aSmrg   if test "x$FOP" = "x"; then
21577e4fd55aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
21587e4fd55aSmrg	have_fop=no
21597e4fd55aSmrg   else
21607e4fd55aSmrg        have_fop=yes
21617e4fd55aSmrg   fi
21627e4fd55aSmrgelif test "x$use_fop" = x"yes" ; then
21637e4fd55aSmrg   AC_PATH_PROG([FOP], [fop])
21647e4fd55aSmrg   if test "x$FOP" = "x"; then
21657e4fd55aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
21667e4fd55aSmrg   fi
21677e4fd55aSmrg   have_fop=yes
21687e4fd55aSmrgelif test "x$use_fop" = x"no" ; then
21697e4fd55aSmrg   if test "x$FOP" != "x"; then
21707e4fd55aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
21717e4fd55aSmrg   fi
21727e4fd55aSmrg   have_fop=no
2173b8f75c19Smrgelse
21747e4fd55aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2175b8f75c19Smrgfi
21768e4923e5Smrg
21778e4923e5Smrg# Test for a minimum version of fop, if provided.
21788e4923e5Smrgm4_ifval([$1],
21798e4923e5Smrg[if test "$have_fop" = yes; then
21808e4923e5Smrg    # scrape the fop version
21818e4923e5Smrg    AC_MSG_CHECKING([for fop minimum version])
21828e4923e5Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
21838e4923e5Smrg    AC_MSG_RESULT([$fop_version])
21848e4923e5Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
21858e4923e5Smrg        [if test "x$use_fop" = xauto; then
21868e4923e5Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
21878e4923e5Smrg            have_fop=no
21888e4923e5Smrg        else
21898e4923e5Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
21908e4923e5Smrg        fi])
21918e4923e5Smrgfi])
21927e4fd55aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
21937e4fd55aSmrg]) # XORG_WITH_FOP
2194b8f75c19Smrg
21958832ea4aSmrg# XORG_WITH_M4([MIN-VERSION])
21968832ea4aSmrg# ---------------------------
21978832ea4aSmrg# Minimum version: 1.19.0
21988832ea4aSmrg#
21998832ea4aSmrg# This macro attempts to locate an m4 macro processor which supports
22008832ea4aSmrg# -I option and is only useful for modules relying on M4 in order to
22018832ea4aSmrg# expand macros in source code files.
22028832ea4aSmrg#
22038832ea4aSmrg# Interface to module:
22048832ea4aSmrg# M4:	 	returns the path of the m4 program found
22058832ea4aSmrg#		returns the path set by the user in the environment
22068832ea4aSmrg#
22078832ea4aSmrgAC_DEFUN([XORG_WITH_M4], [
22088832ea4aSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
22098832ea4aSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
22108832ea4aSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
22118832ea4aSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
22128832ea4aSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
22138832ea4aSmrg   [$PATH:/usr/gnu/bin])])
22148832ea4aSmrg
22158832ea4aSmrgAC_SUBST([M4], [$ac_cv_path_M4])
22168832ea4aSmrg]) # XORG_WITH_M4
22178832ea4aSmrg
22187e4fd55aSmrg# XORG_WITH_PS2PDF([DEFAULT])
22197e4fd55aSmrg# ----------------
22207e4fd55aSmrg# Minimum version: 1.6.0
22217e4fd55aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
22227e4fd55aSmrg#
22237e4fd55aSmrg# Documentation tools are not always available on all platforms and sometimes
22247e4fd55aSmrg# not at the appropriate level. This macro enables a module to test for the
22257e4fd55aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
22267e4fd55aSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
22277e4fd55aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
22287e4fd55aSmrg# --with-ps2pdf assumes 'auto'.
22297e4fd55aSmrg#
22307e4fd55aSmrg# Interface to module:
22317e4fd55aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
22327e4fd55aSmrg# PS2PDF:	returns the path of the ps2pdf program found
22337e4fd55aSmrg#		returns the path set by the user in the environment
22347e4fd55aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
22357e4fd55aSmrg#		 'no' user instructs the module not to use ps2pdf
22367e4fd55aSmrg#
22377e4fd55aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
22387e4fd55aSmrg#
22397e4fd55aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
22407e4fd55aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
22417e4fd55aSmrgm4_define([_defopt], m4_default([$1], [auto]))
22427e4fd55aSmrgAC_ARG_WITH(ps2pdf,
22437e4fd55aSmrg	AS_HELP_STRING([--with-ps2pdf],
22447e4fd55aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
22457e4fd55aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
22467e4fd55aSmrgm4_undefine([_defopt])
22477e4fd55aSmrg
22487e4fd55aSmrgif test "x$use_ps2pdf" = x"auto"; then
22497e4fd55aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
22507e4fd55aSmrg   if test "x$PS2PDF" = "x"; then
22517e4fd55aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
22527e4fd55aSmrg	have_ps2pdf=no
22537e4fd55aSmrg   else
22547e4fd55aSmrg        have_ps2pdf=yes
22557e4fd55aSmrg   fi
22567e4fd55aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
22577e4fd55aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
22587e4fd55aSmrg   if test "x$PS2PDF" = "x"; then
22597e4fd55aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
22607e4fd55aSmrg   fi
22617e4fd55aSmrg   have_ps2pdf=yes
22627e4fd55aSmrgelif test "x$use_ps2pdf" = x"no" ; then
22637e4fd55aSmrg   if test "x$PS2PDF" != "x"; then
22647e4fd55aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
22657e4fd55aSmrg   fi
22667e4fd55aSmrg   have_ps2pdf=no
22677e4fd55aSmrgelse
22687e4fd55aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
22697e4fd55aSmrgfi
22707e4fd55aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
22717e4fd55aSmrg]) # XORG_WITH_PS2PDF
2272b8f75c19Smrg
22737e4fd55aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
22747e4fd55aSmrg# ----------------
22757e4fd55aSmrg# Minimum version: 1.6.0
22767e4fd55aSmrg#
22777e4fd55aSmrg# Documentation tools are not always available on all platforms and sometimes
22787e4fd55aSmrg# not at the appropriate level. This macro enables a builder to skip all
22797e4fd55aSmrg# documentation targets except traditional man pages.
22807e4fd55aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
22817e4fd55aSmrg# maximum flexibilty in controlling documentation building.
22827e4fd55aSmrg# Refer to:
22837e4fd55aSmrg# XORG_WITH_XMLTO         --with-xmlto
22847e4fd55aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
22857e4fd55aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
22867e4fd55aSmrg# XORG_WITH_FOP           --with-fop
22877e4fd55aSmrg# XORG_WITH_GROFF         --with-groff
22887e4fd55aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
22897e4fd55aSmrg#
22907e4fd55aSmrg# Interface to module:
22917e4fd55aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
22927e4fd55aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
22937e4fd55aSmrg#		 'no' user instructs the module not to generate docs
22947e4fd55aSmrg# parm1:	specify the default value, yes or no.
22957e4fd55aSmrg#
22967e4fd55aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
22977e4fd55aSmrgm4_define([docs_default], m4_default([$1], [yes]))
22987e4fd55aSmrgAC_ARG_ENABLE(docs,
22997e4fd55aSmrg	AS_HELP_STRING([--enable-docs],
23007e4fd55aSmrg	   [Enable building the documentation (default: ]docs_default[)]),
23017e4fd55aSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
23027e4fd55aSmrgm4_undefine([docs_default])
23037e4fd55aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
23047e4fd55aSmrgAC_MSG_CHECKING([whether to build documentation])
23057e4fd55aSmrgAC_MSG_RESULT([$build_docs])
23067e4fd55aSmrg]) # XORG_ENABLE_DOCS
23077e4fd55aSmrg
23087e4fd55aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
23097e4fd55aSmrg# ----------------
23107e4fd55aSmrg# Minimum version: 1.6.0
23117e4fd55aSmrg#
23127e4fd55aSmrg# This macro enables a builder to skip all developer documentation.
23137e4fd55aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23147e4fd55aSmrg# maximum flexibilty in controlling documentation building.
23157e4fd55aSmrg# Refer to:
23167e4fd55aSmrg# XORG_WITH_XMLTO         --with-xmlto
23177e4fd55aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23187e4fd55aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
23197e4fd55aSmrg# XORG_WITH_FOP           --with-fop
23207e4fd55aSmrg# XORG_WITH_GROFF         --with-groff
23217e4fd55aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
23227e4fd55aSmrg#
23237e4fd55aSmrg# Interface to module:
23247e4fd55aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
23257e4fd55aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
23267e4fd55aSmrg#			'no' user instructs the module not to generate developer docs
23277e4fd55aSmrg# parm1:		specify the default value, yes or no.
23287e4fd55aSmrg#
23297e4fd55aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
23307e4fd55aSmrgm4_define([devel_default], m4_default([$1], [yes]))
23317e4fd55aSmrgAC_ARG_ENABLE(devel-docs,
23327e4fd55aSmrg	AS_HELP_STRING([--enable-devel-docs],
23337e4fd55aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
23347e4fd55aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
23357e4fd55aSmrgm4_undefine([devel_default])
23367e4fd55aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
23377e4fd55aSmrgAC_MSG_CHECKING([whether to build developer documentation])
23387e4fd55aSmrgAC_MSG_RESULT([$build_devel_docs])
23397e4fd55aSmrg]) # XORG_ENABLE_DEVEL_DOCS
23407e4fd55aSmrg
23417e4fd55aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
23427e4fd55aSmrg# ----------------
23437e4fd55aSmrg# Minimum version: 1.6.0
23447e4fd55aSmrg#
23457e4fd55aSmrg# This macro enables a builder to skip all functional specification targets.
23467e4fd55aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23477e4fd55aSmrg# maximum flexibilty in controlling documentation building.
23487e4fd55aSmrg# Refer to:
23497e4fd55aSmrg# XORG_WITH_XMLTO         --with-xmlto
23507e4fd55aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23517e4fd55aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
23527e4fd55aSmrg# XORG_WITH_FOP           --with-fop
23537e4fd55aSmrg# XORG_WITH_GROFF         --with-groff
23547e4fd55aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
23557e4fd55aSmrg#
23567e4fd55aSmrg# Interface to module:
23577e4fd55aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
23587e4fd55aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
23597e4fd55aSmrg#			'no' user instructs the module not to generate specs
23607e4fd55aSmrg# parm1:		specify the default value, yes or no.
23617e4fd55aSmrg#
23627e4fd55aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
23637e4fd55aSmrgm4_define([spec_default], m4_default([$1], [yes]))
23647e4fd55aSmrgAC_ARG_ENABLE(specs,
23657e4fd55aSmrg	AS_HELP_STRING([--enable-specs],
23667e4fd55aSmrg	   [Enable building the specs (default: ]spec_default[)]),
23677e4fd55aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
23687e4fd55aSmrgm4_undefine([spec_default])
23697e4fd55aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
23707e4fd55aSmrgAC_MSG_CHECKING([whether to build functional specifications])
23717e4fd55aSmrgAC_MSG_RESULT([$build_specs])
23727e4fd55aSmrg]) # XORG_ENABLE_SPECS
2373b8f75c19Smrg
23748e4923e5Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
23758e4923e5Smrg# ----------------------------------------------
23768e4923e5Smrg# Minimum version: 1.13.0
23778e4923e5Smrg#
23788e4923e5Smrg# This macro enables a builder to enable/disable unit testing
23798e4923e5Smrg# It makes no assumption about the test cases implementation
23808e4923e5Smrg# Test cases may or may not use Automake "Support for test suites"
23818e4923e5Smrg# They may or may not use the software utility library GLib
23828e4923e5Smrg#
23838e4923e5Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
23848e4923e5Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
23858e4923e5Smrg# The variable enable_unit_tests is used by other macros in this file.
23868e4923e5Smrg#
23878e4923e5Smrg# Interface to module:
23888e4923e5Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
23898e4923e5Smrg# enable_unit_tests:    used in configure.ac for additional configuration
23908e4923e5Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
23918e4923e5Smrg#			'no' user instructs the module not to build tests
23928e4923e5Smrg# parm1:		specify the default value, yes or no.
23938e4923e5Smrg#
23948e4923e5SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
23958e4923e5SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
23968e4923e5SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
23978e4923e5SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
23988e4923e5Smrgm4_define([_defopt], m4_default([$1], [auto]))
23998e4923e5SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
24008e4923e5Smrg	[Enable building unit test cases (default: ]_defopt[)]),
24018e4923e5Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
24028e4923e5Smrgm4_undefine([_defopt])
24038e4923e5SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
24048e4923e5SmrgAC_MSG_CHECKING([whether to build unit test cases])
24058e4923e5SmrgAC_MSG_RESULT([$enable_unit_tests])
24068e4923e5Smrg]) # XORG_ENABLE_UNIT_TESTS
24078e4923e5Smrg
24088e4923e5Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
24098e4923e5Smrg# ------------------------------------------------------
24108e4923e5Smrg# Minimum version: 1.17.0
24118e4923e5Smrg#
24128e4923e5Smrg# This macro enables a builder to enable/disable integration testing
24138e4923e5Smrg# It makes no assumption about the test cases' implementation
24148e4923e5Smrg# Test cases may or may not use Automake "Support for test suites"
24158e4923e5Smrg#
24168e4923e5Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
24178e4923e5Smrg# usually requires less dependencies and may be built and run under less
24188e4923e5Smrg# stringent environments than integration tests.
24198e4923e5Smrg#
24208e4923e5Smrg# Interface to module:
24218e4923e5Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
24228e4923e5Smrg# enable_integration_tests:   used in configure.ac for additional configuration
24238e4923e5Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
24248e4923e5Smrg#                             'no' user instructs the module not to build tests
24258e4923e5Smrg# parm1:                      specify the default value, yes or no.
24268e4923e5Smrg#
24278e4923e5SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
24288e4923e5SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
24298e4923e5Smrgm4_define([_defopt], m4_default([$1], [auto]))
24308e4923e5SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
24318e4923e5Smrg	[Enable building integration test cases (default: ]_defopt[)]),
24328e4923e5Smrg	[enable_integration_tests=$enableval],
24338e4923e5Smrg	[enable_integration_tests=]_defopt)
24348e4923e5Smrgm4_undefine([_defopt])
24358e4923e5SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
24368e4923e5Smrg	[test "x$enable_integration_tests" != xno])
24378e4923e5SmrgAC_MSG_CHECKING([whether to build unit test cases])
24388e4923e5SmrgAC_MSG_RESULT([$enable_integration_tests])
24398e4923e5Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
24408e4923e5Smrg
24418e4923e5Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
24428e4923e5Smrg# ----------------------------------------
24438e4923e5Smrg# Minimum version: 1.13.0
24448e4923e5Smrg#
24458e4923e5Smrg# GLib is a library which provides advanced data structures and functions.
24468e4923e5Smrg# This macro enables a module to test for the presence of Glib.
24478e4923e5Smrg#
24488e4923e5Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
24498e4923e5Smrg# Otherwise the value of $enable_unit_tests is blank.
24508e4923e5Smrg#
24518e4923e5Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
24528e4923e5Smrg# test support usually requires less dependencies and may be built and run under
24538e4923e5Smrg# less stringent environments than integration tests.
24548e4923e5Smrg#
24558e4923e5Smrg# Interface to module:
24568e4923e5Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
24578e4923e5Smrg# with_glib: used in configure.ac to know if GLib has been found
24588e4923e5Smrg# --with-glib:	'yes' user instructs the module to use glib
24598e4923e5Smrg#		'no' user instructs the module not to use glib
24608e4923e5Smrg#
24618e4923e5SmrgAC_DEFUN([XORG_WITH_GLIB],[
24628e4923e5SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
24638e4923e5Smrgm4_define([_defopt], m4_default([$2], [auto]))
24648e4923e5SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
24658e4923e5Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
24668e4923e5Smrg	[with_glib=$withval], [with_glib=]_defopt)
24678e4923e5Smrgm4_undefine([_defopt])
24688e4923e5Smrg
24698e4923e5Smrghave_glib=no
24708e4923e5Smrg# Do not probe GLib if user explicitly disabled unit testing
24718e4923e5Smrgif test "x$enable_unit_tests" != x"no"; then
24728e4923e5Smrg  # Do not probe GLib if user explicitly disabled it
24738e4923e5Smrg  if test "x$with_glib" != x"no"; then
24748e4923e5Smrg    m4_ifval(
24758e4923e5Smrg      [$1],
24768e4923e5Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
24778e4923e5Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
24788e4923e5Smrg    )
24798e4923e5Smrg  fi
24808e4923e5Smrgfi
24818e4923e5Smrg
24828e4923e5Smrg# Not having GLib when unit testing has been explicitly requested is an error
24838e4923e5Smrgif test "x$enable_unit_tests" = x"yes"; then
24848e4923e5Smrg  if test "x$have_glib" = x"no"; then
24858e4923e5Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24868e4923e5Smrg  fi
24878e4923e5Smrgfi
24888e4923e5Smrg
24898e4923e5Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
24908e4923e5Smrgif test "x$enable_unit_tests" = x"no"; then
24918e4923e5Smrg  if test "x$with_glib" = x"yes"; then
24928e4923e5Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24938e4923e5Smrg  fi
24948e4923e5Smrgfi
24958e4923e5Smrg
24968e4923e5Smrg# Not having GLib when it has been explicitly requested is an error
24978e4923e5Smrgif test "x$with_glib" = x"yes"; then
24988e4923e5Smrg  if test "x$have_glib" = x"no"; then
24998e4923e5Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
25008e4923e5Smrg  fi
25018e4923e5Smrgfi
25028e4923e5Smrg
25038e4923e5SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
25048e4923e5Smrg]) # XORG_WITH_GLIB
25058e4923e5Smrg
25068e4923e5Smrg# XORG_LD_WRAP([required|optional])
25078e4923e5Smrg# ---------------------------------
25088e4923e5Smrg# Minimum version: 1.13.0
25098e4923e5Smrg#
25108e4923e5Smrg# Check if linker supports -wrap, passed via compiler flags
25118e4923e5Smrg#
25128e4923e5Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
25138e4923e5Smrg# Otherwise the value of $enable_unit_tests is blank.
25148e4923e5Smrg#
25158e4923e5Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
25168e4923e5Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
25178e4923e5Smrg# available, an argument of "optional" allows use when some unit tests require
25188e4923e5Smrg# ld -wrap and others do not.
25198e4923e5Smrg#
25208e4923e5SmrgAC_DEFUN([XORG_LD_WRAP],[
25218e4923e5SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
25228e4923e5Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
25238e4923e5Smrg                      void __wrap_exit(int status) { return; }],
25248e4923e5Smrg                     [exit(0);])])
25258e4923e5Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
25268e4923e5Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
25278e4923e5Smrg  if test "x$have_ld_wrap" = x"no"; then
25288e4923e5Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
25298e4923e5Smrg  fi
25308e4923e5Smrgfi
25318e4923e5SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
25328e4923e5Smrg#
25338e4923e5Smrg]) # XORG_LD_WRAP
25348e4923e5Smrg
25358e4923e5Smrg# XORG_CHECK_LINKER_FLAGS
25368e4923e5Smrg# -----------------------
25378e4923e5Smrg# SYNOPSIS
25388e4923e5Smrg#
25398e4923e5Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
25408e4923e5Smrg#
25418e4923e5Smrg# DESCRIPTION
25428e4923e5Smrg#
25438e4923e5Smrg#   Check whether the given linker FLAGS work with the current language's
25448e4923e5Smrg#   linker, or whether they give an error.
25458e4923e5Smrg#
25468e4923e5Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
25478e4923e5Smrg#   success/failure.
25488e4923e5Smrg#
25498e4923e5Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
25508e4923e5Smrg#
25518e4923e5Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
25528e4923e5Smrg#
25538e4923e5Smrg# LICENSE
25548e4923e5Smrg#
25558e4923e5Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
25568e4923e5Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
25578e4923e5Smrg#   Copyright (c) 2009 Matteo Frigo
25588e4923e5Smrg#
25598e4923e5Smrg#   This program is free software: you can redistribute it and/or modify it
25608e4923e5Smrg#   under the terms of the GNU General Public License as published by the
25618e4923e5Smrg#   Free Software Foundation, either version 3 of the License, or (at your
25628e4923e5Smrg#   option) any later version.
25638e4923e5Smrg#
25648e4923e5Smrg#   This program is distributed in the hope that it will be useful, but
25658e4923e5Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
25668e4923e5Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
25678e4923e5Smrg#   Public License for more details.
25688e4923e5Smrg#
25698e4923e5Smrg#   You should have received a copy of the GNU General Public License along
25708e4923e5Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
25718e4923e5Smrg#
25728e4923e5Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
25738e4923e5Smrg#   gives unlimited permission to copy, distribute and modify the configure
25748e4923e5Smrg#   scripts that are the output of Autoconf when processing the Macro. You
25758e4923e5Smrg#   need not follow the terms of the GNU General Public License when using
25768e4923e5Smrg#   or distributing such scripts, even though portions of the text of the
25778e4923e5Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
25788e4923e5Smrg#   all other use of the material that constitutes the Autoconf Macro.
25798e4923e5Smrg#
25808e4923e5Smrg#   This special exception to the GPL applies to versions of the Autoconf
25818e4923e5Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
25828e4923e5Smrg#   modified version of the Autoconf Macro, you may extend this special
25838e4923e5Smrg#   exception to the GPL to apply to your modified version as well.#
25848e4923e5SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
25858e4923e5Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
25868e4923e5Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
25878e4923e5SmrgAS_LITERAL_IF([$1],
25888e4923e5Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
25898e4923e5Smrg      ax_save_FLAGS=$LDFLAGS
25908e4923e5Smrg      LDFLAGS="$1"
25918e4923e5Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
25928e4923e5Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25938e4923e5Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
25948e4923e5Smrg      LDFLAGS=$ax_save_FLAGS])],
25958e4923e5Smrg  [ax_save_FLAGS=$LDFLAGS
25968e4923e5Smrg   LDFLAGS="$1"
25978e4923e5Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
25988e4923e5Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25998e4923e5Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
26008e4923e5Smrg   LDFLAGS=$ax_save_FLAGS])
26018e4923e5Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
26028e4923e5SmrgAC_MSG_RESULT($xorg_check_linker_flags)
26038e4923e5Smrgif test "x$xorg_check_linker_flags" = xyes; then
26048e4923e5Smrg	m4_default([$2], :)
26058e4923e5Smrgelse
26068e4923e5Smrg	m4_default([$3], :)
26078e4923e5Smrgfi
26088e4923e5Smrg]) # XORG_CHECK_LINKER_FLAGS
26098e4923e5Smrg
26108e4923e5Smrg# XORG_MEMORY_CHECK_FLAGS
26118e4923e5Smrg# -----------------------
26128e4923e5Smrg# Minimum version: 1.16.0
26138e4923e5Smrg#
26148e4923e5Smrg# This macro attempts to find appropriate memory checking functionality
26158e4923e5Smrg# for various platforms which unit testing code may use to catch various
26168e4923e5Smrg# forms of memory allocation and access errors in testing.
26178e4923e5Smrg#
26188e4923e5Smrg# Interface to module:
26198e4923e5Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
26208e4923e5Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
26218e4923e5Smrg#
26228e4923e5Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
26238e4923e5Smrg#
26248e4923e5SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
26258e4923e5Smrg
26268e4923e5SmrgAC_REQUIRE([AC_CANONICAL_HOST])
26278e4923e5SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
26288e4923e5Smrg           [Environment variables to enable memory checking in tests])
26298e4923e5Smrg
26308e4923e5Smrg# Check for different types of support on different platforms
26318e4923e5Smrgcase $host_os in
26328e4923e5Smrg    solaris*)
26338e4923e5Smrg        AC_CHECK_LIB([umem], [umem_alloc],
26348e4923e5Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
26358e4923e5Smrg        ;;
26368e4923e5Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
26378e4923e5Smrg        # both directly and inverted, so should not be 0 or 255.
26388e4923e5Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
26398e4923e5Smrg        ;;
26408e4923e5Smrg    darwin*)
26418e4923e5Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
26428e4923e5Smrg        ;;
26438e4923e5Smrg    *bsd*)
26448e4923e5Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
26458e4923e5Smrg        ;;
26468e4923e5Smrgesac
26478e4923e5Smrg
26488e4923e5Smrg# User supplied flags override default flags
26498e4923e5Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
26508e4923e5Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
26518e4923e5Smrgfi
26528e4923e5Smrg
26538e4923e5SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
26548e4923e5Smrg]) # XORG_WITH_LINT
26558e4923e5Smrg
2656b8f75c19Smrg# XORG_CHECK_MALLOC_ZERO
2657b8f75c19Smrg# ----------------------
26587e4fd55aSmrg# Minimum version: 1.0.0
26597e4fd55aSmrg#
2660b8f75c19Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2661b8f75c19Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2662b8f75c19Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2663b8f75c19SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2664b8f75c19SmrgAC_ARG_ENABLE(malloc0returnsnull,
26657e4fd55aSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2666b8f75c19Smrg		       [malloc(0) returns NULL (default: auto)]),
2667b8f75c19Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2668b8f75c19Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2669b8f75c19Smrg
2670b8f75c19SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2671b8f75c19Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
26728832ea4aSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
26738832ea4aSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
26747e4fd55aSmrg#include <stdlib.h>
26757e4fd55aSmrg],[
2676b8f75c19Smrg    char *m0, *r0, *c0, *p;
2677b8f75c19Smrg    m0 = malloc(0);
2678b8f75c19Smrg    p = malloc(10);
2679b8f75c19Smrg    r0 = realloc(p,0);
26807e4fd55aSmrg    c0 = calloc(0,10);
26817e4fd55aSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
26827e4fd55aSmrg])],
26838832ea4aSmrg		[xorg_cv_malloc0_returns_null=yes],
26848832ea4aSmrg		[xorg_cv_malloc0_returns_null=no])])
26858832ea4aSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2686b8f75c19Smrgfi
2687b8f75c19SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2688b8f75c19Smrg
2689b8f75c19Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2690b8f75c19Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2691b8f75c19Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2692b8f75c19Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2693b8f75c19Smrgelse
2694b8f75c19Smrg	MALLOC_ZERO_CFLAGS=""
2695b8f75c19Smrg	XMALLOC_ZERO_CFLAGS=""
2696b8f75c19Smrg	XTMALLOC_ZERO_CFLAGS=""
2697b8f75c19Smrgfi
2698b8f75c19Smrg
2699b8f75c19SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2700b8f75c19SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2701b8f75c19SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2702b8f75c19Smrg]) # XORG_CHECK_MALLOC_ZERO
2703b8f75c19Smrg
27047e4fd55aSmrg# XORG_WITH_LINT()
27057e4fd55aSmrg# ----------------
27067e4fd55aSmrg# Minimum version: 1.1.0
27077e4fd55aSmrg#
27087e4fd55aSmrg# This macro enables the use of a tool that flags some suspicious and
27097e4fd55aSmrg# non-portable constructs (likely to be bugs) in C language source code.
27107e4fd55aSmrg# It will attempt to locate the tool and use appropriate options.
27117e4fd55aSmrg# There are various lint type tools on different platforms.
27127e4fd55aSmrg#
27137e4fd55aSmrg# Interface to module:
27147e4fd55aSmrg# LINT:		returns the path to the tool found on the platform
27157e4fd55aSmrg#		or the value set to LINT on the configure cmd line
27167e4fd55aSmrg#		also an Automake conditional
27177e4fd55aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
27187e4fd55aSmrg#
27197e4fd55aSmrg# --with-lint:	'yes' user instructs the module to use lint
27207e4fd55aSmrg#		'no' user instructs the module not to use lint (default)
27217e4fd55aSmrg#
27227e4fd55aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
27237e4fd55aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
27247e4fd55aSmrg#
27257e4fd55aSmrgAC_DEFUN([XORG_WITH_LINT],[
27267e4fd55aSmrg
27277e4fd55aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
27287e4fd55aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
27297e4fd55aSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27307e4fd55aSmrg		[Use a lint-style source code checker (default: disabled)])],
27317e4fd55aSmrg		[use_lint=$withval], [use_lint=no])
27327e4fd55aSmrg
27337e4fd55aSmrg# Obtain platform specific info like program name and options
27347e4fd55aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
27357e4fd55aSmrgcase $host_os in
27367e4fd55aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
27377e4fd55aSmrg	lint_name=splint
27387e4fd55aSmrg	lint_options="-badflag"
27397e4fd55aSmrg	;;
27407e4fd55aSmrg  *freebsd* | *netbsd*)
27417e4fd55aSmrg	lint_name=lint
27427e4fd55aSmrg	lint_options="-u -b"
27437e4fd55aSmrg	;;
27447e4fd55aSmrg  *solaris*)
27457e4fd55aSmrg	lint_name=lint
27467e4fd55aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
27477e4fd55aSmrg	;;
27487e4fd55aSmrgesac
27497e4fd55aSmrg
27507e4fd55aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
27517e4fd55aSmrgif test "x$use_lint" = x"yes" ; then
27527e4fd55aSmrg   AC_PATH_PROG([LINT], [$lint_name])
27537e4fd55aSmrg   if test "x$LINT" = "x"; then
27547e4fd55aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
27557e4fd55aSmrg   fi
27567e4fd55aSmrgelif test "x$use_lint" = x"no" ; then
27577e4fd55aSmrg   if test "x$LINT" != "x"; then
27587e4fd55aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
27597e4fd55aSmrg   fi
27607e4fd55aSmrgelse
27617e4fd55aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
27627e4fd55aSmrgfi
27637e4fd55aSmrg
27647e4fd55aSmrg# User supplied flags override default flags
27657e4fd55aSmrgif test "x$LINT_FLAGS" != "x"; then
27667e4fd55aSmrg   lint_options=$LINT_FLAGS
27677e4fd55aSmrgfi
27687e4fd55aSmrg
27697e4fd55aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
27707e4fd55aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
27717e4fd55aSmrg
27727e4fd55aSmrg]) # XORG_WITH_LINT
27737e4fd55aSmrg
27747e4fd55aSmrg# XORG_LINT_LIBRARY(LIBNAME)
27757e4fd55aSmrg# --------------------------
27767e4fd55aSmrg# Minimum version: 1.1.0
27777e4fd55aSmrg#
27787e4fd55aSmrg# Sets up flags for building lint libraries for checking programs that call
27797e4fd55aSmrg# functions in the library.
27807e4fd55aSmrg#
27817e4fd55aSmrg# Interface to module:
27827e4fd55aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
27837e4fd55aSmrg# MAKE_LINT_LIB		- Automake conditional
27847e4fd55aSmrg#
27857e4fd55aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
27867e4fd55aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
27877e4fd55aSmrg
27887e4fd55aSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
27897e4fd55aSmrgAC_REQUIRE([XORG_WITH_LINT])
27907e4fd55aSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
27917e4fd55aSmrg	[Create lint library (default: disabled)])],
27927e4fd55aSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
27937e4fd55aSmrg
27947e4fd55aSmrgif test "x$make_lint_lib" = x"yes" ; then
27957e4fd55aSmrg   LINTLIB=llib-l$1.ln
27967e4fd55aSmrg   if test "x$LINT" = "x"; then
27977e4fd55aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
27987e4fd55aSmrg   fi
27997e4fd55aSmrgelif test "x$make_lint_lib" != x"no" ; then
28007e4fd55aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
28017e4fd55aSmrgfi
28027e4fd55aSmrg
28037e4fd55aSmrgAC_SUBST(LINTLIB)
28047e4fd55aSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
28057e4fd55aSmrg
28067e4fd55aSmrg]) # XORG_LINT_LIBRARY
28077e4fd55aSmrg
28088e4923e5Smrg# XORG_COMPILER_BRAND
28098e4923e5Smrg# -------------------
28108e4923e5Smrg# Minimum version: 1.14.0
28118e4923e5Smrg#
28128e4923e5Smrg# Checks for various brands of compilers and sets flags as appropriate:
28138e4923e5Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
28148e4923e5Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
28158e4923e5Smrg#   clang compiler - sets CLANGCC to "yes"
28168e4923e5Smrg#   Intel compiler - sets INTELCC to "yes"
28178e4923e5Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
28188e4923e5Smrg#
28198e4923e5SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
28208e4923e5SmrgAC_LANG_CASE(
28218e4923e5Smrg	[C], [
28228e4923e5Smrg		AC_REQUIRE([AC_PROG_CC_C99])
28238e4923e5Smrg	],
28248e4923e5Smrg	[C++], [
28258e4923e5Smrg		AC_REQUIRE([AC_PROG_CXX])
28268e4923e5Smrg	]
28278e4923e5Smrg)
28288e4923e5SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
28298e4923e5SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
28308e4923e5SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
28318e4923e5Smrg]) # XORG_COMPILER_BRAND
28328e4923e5Smrg
28338e4923e5Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
28348e4923e5Smrg# ---------------
28358e4923e5Smrg# Minimum version: 1.16.0
28368e4923e5Smrg#
28378e4923e5Smrg# Test if the compiler works when passed the given flag as a command line argument.
28388e4923e5Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
28398e4923e5Smrg# next flag in the list until there are no more options.
28408e4923e5Smrg#
28418e4923e5Smrg# Note that this does not guarantee that the compiler supports the flag as some
28428e4923e5Smrg# compilers will simply ignore arguments that they do not understand, but we do
28438e4923e5Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
28448e4923e5Smrg# -Werror=unused-command-line-argument
28458e4923e5Smrg#
28468e4923e5SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
28478e4923e5Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28488e4923e5Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28498e4923e5Smrg
28508e4923e5SmrgAC_LANG_COMPILER_REQUIRE
28518e4923e5Smrg
28528e4923e5SmrgAC_LANG_CASE(
28538e4923e5Smrg	[C], [
28548e4923e5Smrg		AC_REQUIRE([AC_PROG_CC_C99])
28558e4923e5Smrg		define([PREFIX], [C])
28568e4923e5Smrg		define([CACHE_PREFIX], [cc])
28578e4923e5Smrg		define([COMPILER], [$CC])
28588e4923e5Smrg	],
28598e4923e5Smrg	[C++], [
28608e4923e5Smrg		define([PREFIX], [CXX])
28618e4923e5Smrg		define([CACHE_PREFIX], [cxx])
28628e4923e5Smrg		define([COMPILER], [$CXX])
28638e4923e5Smrg	]
28648e4923e5Smrg)
28658e4923e5Smrg
28668e4923e5Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
28678e4923e5Smrg
28688e4923e5Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
28698e4923e5Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28708e4923e5Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
28718e4923e5Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
28728e4923e5Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28738e4923e5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
28748e4923e5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
28758e4923e5Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
28768e4923e5Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28778e4923e5Smrgfi
28788e4923e5Smrg
28798e4923e5Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
28808e4923e5Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
28818e4923e5Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28828e4923e5Smrg	fi
28838e4923e5Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
28848e4923e5Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
28858e4923e5Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
28868e4923e5Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28878e4923e5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
28888e4923e5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
28898e4923e5Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
28908e4923e5Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28918e4923e5Smrgfi
28928e4923e5Smrg
28938e4923e5Smrgfound="no"
28948e4923e5Smrgm4_foreach([flag], m4_cdr($@), [
28958e4923e5Smrg	if test $found = "no" ; then
28968e4923e5Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
28978e4923e5Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28988e4923e5Smrg		fi
28998e4923e5Smrg
29008e4923e5Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
29018e4923e5Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
29028e4923e5Smrg		fi
29038e4923e5Smrg
29048e4923e5Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
29058e4923e5Smrg
29068e4923e5Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
29078e4923e5Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
29088e4923e5Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
29098e4923e5Smrg		AC_CACHE_VAL($cacheid,
29108e4923e5Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
29118e4923e5Smrg					     [eval $cacheid=yes],
29128e4923e5Smrg					     [eval $cacheid=no])])
29138e4923e5Smrg
29148e4923e5Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
29158e4923e5Smrg
29168e4923e5Smrg		eval supported=\$$cacheid
29178e4923e5Smrg		AC_MSG_RESULT([$supported])
29188e4923e5Smrg		if test "$supported" = "yes" ; then
29198e4923e5Smrg			$1="$$1 ]flag["
29208e4923e5Smrg			found="yes"
29218e4923e5Smrg		fi
29228e4923e5Smrg	fi
29238e4923e5Smrg])
29248e4923e5Smrg]) # XORG_TESTSET_CFLAG
29258e4923e5Smrg
29268e4923e5Smrg# XORG_COMPILER_FLAGS
29278e4923e5Smrg# ---------------
29288e4923e5Smrg# Minimum version: 1.16.0
29298e4923e5Smrg#
29308e4923e5Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
29318e4923e5Smrg# arguments supported by the selected compiler which do NOT alter the generated
29328e4923e5Smrg# code.  These arguments will cause the compiler to print various warnings
29338e4923e5Smrg# during compilation AND turn a conservative set of warnings into errors.
29348e4923e5Smrg#
29358e4923e5Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
29368e4923e5Smrg# future versions of util-macros as options are added to new compilers.
29378e4923e5Smrg#
29388e4923e5SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
29398e4923e5SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
29408e4923e5Smrg
29418e4923e5SmrgAC_ARG_ENABLE(selective-werror,
29428e4923e5Smrg              AS_HELP_STRING([--disable-selective-werror],
29438e4923e5Smrg                             [Turn off selective compiler errors. (default: enabled)]),
29448e4923e5Smrg              [SELECTIVE_WERROR=$enableval],
29458e4923e5Smrg              [SELECTIVE_WERROR=yes])
29468e4923e5Smrg
29478e4923e5SmrgAC_LANG_CASE(
29488e4923e5Smrg        [C], [
29498e4923e5Smrg                define([PREFIX], [C])
29508e4923e5Smrg        ],
29518e4923e5Smrg        [C++], [
29528e4923e5Smrg                define([PREFIX], [CXX])
29538e4923e5Smrg        ]
29548e4923e5Smrg)
29558e4923e5Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
29568e4923e5Smrgif test "x$SUNCC" = "xyes"; then
29578e4923e5Smrg    [BASE_]PREFIX[FLAGS]="-v"
29588e4923e5Smrgelse
29598e4923e5Smrg    [BASE_]PREFIX[FLAGS]=""
29608e4923e5Smrgfi
29618e4923e5Smrg
29628e4923e5Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
29638e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
29648e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
29658e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
29668e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
29678e4923e5Smrg
29688e4923e5SmrgAC_LANG_CASE(
29698e4923e5Smrg	[C], [
29708e4923e5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
29718e4923e5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
29728e4923e5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
29738e4923e5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
29748832ea4aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
29758e4923e5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
29768e4923e5Smrg	]
29778e4923e5Smrg)
29788e4923e5Smrg
29798e4923e5Smrg# This chunk adds additional warnings that could catch undesired effects.
29808e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
29818e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
29828e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
29838e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
29848e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
29858e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
29868832ea4aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
29878e4923e5Smrg
29888e4923e5Smrg# These are currently disabled because they are noisy.  They will be enabled
29898e4923e5Smrg# in the future once the codebase is sufficiently modernized to silence
29908e4923e5Smrg# them.  For now, I don't want them to drown out the other warnings.
29918e4923e5Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
29928e4923e5Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
29938832ea4aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
29948e4923e5Smrg
29958e4923e5Smrg# Turn some warnings into errors, so we don't accidently get successful builds
29968e4923e5Smrg# when there are problems that should be fixed.
29978e4923e5Smrg
29988e4923e5Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
29998e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
30008e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
30018e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
30028e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
30038e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
30048e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
30058e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
30068e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
30078e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
30088e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
30098e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
30108e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
30118e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
30128e4923e5Smrgelse
30138e4923e5SmrgAC_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])
30148e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
30158e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
30168e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
30178e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
30188e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
30198e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
30208e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
30218e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
30228e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
30238e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
30248e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
30258e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
30268e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
30278e4923e5Smrgfi
30288e4923e5Smrg
30298e4923e5SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
30308e4923e5Smrg]) # XORG_COMPILER_FLAGS
30318e4923e5Smrg
30327e4fd55aSmrg# XORG_CWARNFLAGS
30337e4fd55aSmrg# ---------------
30347e4fd55aSmrg# Minimum version: 1.2.0
30358e4923e5Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
30367e4fd55aSmrg#
30377e4fd55aSmrg# Defines CWARNFLAGS to enable C compiler warnings.
30387e4fd55aSmrg#
30398e4923e5Smrg# This function is deprecated because it defines -fno-strict-aliasing
30408e4923e5Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
30418e4923e5Smrg# is needed, then it should be added explicitly in the module when
30428e4923e5Smrg# it is updated to use BASE_CFLAGS.
30438e4923e5Smrg#
30447e4fd55aSmrgAC_DEFUN([XORG_CWARNFLAGS], [
30458e4923e5SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30468e4923e5SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30478e4923e5SmrgAC_LANG_CASE(
30488e4923e5Smrg	[C], [
30498e4923e5Smrg		CWARNFLAGS="$BASE_CFLAGS"
30508e4923e5Smrg		if  test "x$GCC" = xyes ; then
30518e4923e5Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
30528e4923e5Smrg		fi
30538e4923e5Smrg		AC_SUBST(CWARNFLAGS)
30548e4923e5Smrg	]
30558e4923e5Smrg)
30567e4fd55aSmrg]) # XORG_CWARNFLAGS
30577e4fd55aSmrg
30587e4fd55aSmrg# XORG_STRICT_OPTION
30597e4fd55aSmrg# -----------------------
30607e4fd55aSmrg# Minimum version: 1.3.0
30617e4fd55aSmrg#
30628e4923e5Smrg# Add configure option to enable strict compilation flags, such as treating
30638e4923e5Smrg# warnings as fatal errors.
30648e4923e5Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
30658e4923e5Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
30668e4923e5Smrg#
30678e4923e5Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
30688e4923e5Smrg# when strict compilation is unconditionally desired.
30697e4fd55aSmrgAC_DEFUN([XORG_STRICT_OPTION], [
30707e4fd55aSmrgAC_REQUIRE([XORG_CWARNFLAGS])
30718e4923e5SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30727e4fd55aSmrg
30737e4fd55aSmrgAC_ARG_ENABLE(strict-compilation,
30747e4fd55aSmrg			  AS_HELP_STRING([--enable-strict-compilation],
30757e4fd55aSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
30767e4fd55aSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
30778e4923e5Smrg
30788e4923e5SmrgAC_LANG_CASE(
30798e4923e5Smrg        [C], [
30808e4923e5Smrg                define([PREFIX], [C])
30818e4923e5Smrg        ],
30828e4923e5Smrg        [C++], [
30838e4923e5Smrg                define([PREFIX], [CXX])
30848e4923e5Smrg        ]
30858e4923e5Smrg)
30868e4923e5Smrg
30878e4923e5Smrg[STRICT_]PREFIX[FLAGS]=""
30888e4923e5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
30898e4923e5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
30908e4923e5Smrg
30918e4923e5Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
30928e4923e5Smrg# activate it with -Werror, so we add it here explicitly.
30938e4923e5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
30948e4923e5Smrg
30957e4fd55aSmrgif test "x$STRICT_COMPILE" = "xyes"; then
30968e4923e5Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
30978e4923e5Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
30987e4fd55aSmrgfi
30998e4923e5SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
31008e4923e5SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31018e4923e5SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
31027e4fd55aSmrg]) # XORG_STRICT_OPTION
31037e4fd55aSmrg
31047e4fd55aSmrg# XORG_DEFAULT_OPTIONS
31057e4fd55aSmrg# --------------------
31067e4fd55aSmrg# Minimum version: 1.3.0
31077e4fd55aSmrg#
31087e4fd55aSmrg# Defines default options for X.Org modules.
31097e4fd55aSmrg#
31107e4fd55aSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
31117e4fd55aSmrgAC_REQUIRE([AC_PROG_INSTALL])
31128e4923e5SmrgXORG_COMPILER_FLAGS
31137e4fd55aSmrgXORG_CWARNFLAGS
31147e4fd55aSmrgXORG_STRICT_OPTION
31157e4fd55aSmrgXORG_RELEASE_VERSION
31167e4fd55aSmrgXORG_CHANGELOG
31177e4fd55aSmrgXORG_INSTALL
31187e4fd55aSmrgXORG_MANPAGE_SECTIONS
31197e4fd55aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
31207e4fd55aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
31217e4fd55aSmrg]) # XORG_DEFAULT_OPTIONS
31227e4fd55aSmrg
31237e4fd55aSmrg# XORG_INSTALL()
31247e4fd55aSmrg# ----------------
31257e4fd55aSmrg# Minimum version: 1.4.0
31267e4fd55aSmrg#
31277e4fd55aSmrg# Defines the variable INSTALL_CMD as the command to copy
31287e4fd55aSmrg# INSTALL from $prefix/share/util-macros.
31297e4fd55aSmrg#
31307e4fd55aSmrgAC_DEFUN([XORG_INSTALL], [
31317e4fd55aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
31327e4fd55aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
31337e4fd55aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
31347e4fd55aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
31357e4fd55aSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
31367e4fd55aSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
31377e4fd55aSmrgAC_SUBST([INSTALL_CMD])
31387e4fd55aSmrg]) # XORG_INSTALL
3139b8f75c19Smrgdnl Copyright 2005 Red Hat, Inc
3140b8f75c19Smrgdnl
3141b8f75c19Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3142b8f75c19Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3143b8f75c19Smrgdnl the above copyright notice appear in all copies and that both that
3144b8f75c19Smrgdnl copyright notice and this permission notice appear in supporting
3145b8f75c19Smrgdnl documentation.
3146b8f75c19Smrgdnl
3147b8f75c19Smrgdnl The above copyright notice and this permission notice shall be included
3148b8f75c19Smrgdnl in all copies or substantial portions of the Software.
3149b8f75c19Smrgdnl
3150b8f75c19Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3151b8f75c19Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3152b8f75c19Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3153b8f75c19Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3154b8f75c19Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3155b8f75c19Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3156b8f75c19Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3157b8f75c19Smrgdnl
3158b8f75c19Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3159b8f75c19Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3160b8f75c19Smrgdnl other dealings in this Software without prior written authorization
3161b8f75c19Smrgdnl from the copyright holders.
3162b8f75c19Smrgdnl
3163b8f75c19Smrg
3164b8f75c19Smrg# XORG_RELEASE_VERSION
3165b8f75c19Smrg# --------------------
31667e4fd55aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
31678e4923e5Smrg
3168b8f75c19SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
31697e4fd55aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
31707e4fd55aSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
31717e4fd55aSmrg		[Major version of this package])
31727e4fd55aSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
31737e4fd55aSmrg	if test "x$PVM" = "x"; then
31747e4fd55aSmrg		PVM="0"
3175b8f75c19Smrg	fi
31767e4fd55aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
31777e4fd55aSmrg		[$PVM],
31787e4fd55aSmrg		[Minor version of this package])
31797e4fd55aSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
31807e4fd55aSmrg	if test "x$PVP" = "x"; then
31817e4fd55aSmrg		PVP="0"
31827e4fd55aSmrg	fi
31837e4fd55aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
31847e4fd55aSmrg		[$PVP],
31857e4fd55aSmrg		[Patch version of this package])
3186b8f75c19Smrg])
3187b8f75c19Smrg
31887e4fd55aSmrg# XORG_CHANGELOG()
31897e4fd55aSmrg# ----------------
31907e4fd55aSmrg# Minimum version: 1.2.0
31917e4fd55aSmrg#
31927e4fd55aSmrg# Defines the variable CHANGELOG_CMD as the command to generate
31937e4fd55aSmrg# ChangeLog from git.
31947e4fd55aSmrg#
31957e4fd55aSmrg#
31967e4fd55aSmrgAC_DEFUN([XORG_CHANGELOG], [
31977e4fd55aSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
31987e4fd55aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
31997e4fd55aSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
32007e4fd55aSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
32017e4fd55aSmrgAC_SUBST([CHANGELOG_CMD])
32027e4fd55aSmrg]) # XORG_CHANGELOG
32037e4fd55aSmrg
3204