aclocal.m4 revision 8e4923e5
18e4923e5Smrg# generated automatically by aclocal 1.14 -*- Autoconf -*-
28e4923e5Smrg
38e4923e5Smrg# Copyright (C) 1996-2013 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
177e4fd55aSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
187e4fd55aSmrg[m4_warning([this file was generated for autoconf 2.68.
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
238e4923e5Smrg# Copyright (C) 2002-2013 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],
358e4923e5Smrg[am__api_version='1.14'
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.
388e4923e5Smrgm4_if([$1], [1.14], [],
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],
548e4923e5Smrg[AM_AUTOMAKE_VERSION([1.14])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
618e4923e5Smrg# Copyright (C) 2001-2013 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],
1067e4fd55aSmrg[dnl Rely on autoconf to set up CDPATH properly.
1077e4fd55aSmrgAC_PREREQ([2.50])dnl
108b8f75c19Smrg# expand $ac_aux_dir to an absolute path
109b8f75c19Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
110b8f75c19Smrg])
111b8f75c19Smrg
1127e4fd55aSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
113b8f75c19Smrg
1148e4923e5Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
1157e4fd55aSmrg#
1167e4fd55aSmrg# This file is free software; the Free Software Foundation
1177e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
1187e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
119b8f75c19Smrg
1207e4fd55aSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1217e4fd55aSmrg# -------------------------------------
1227e4fd55aSmrg# Define a conditional.
1237e4fd55aSmrgAC_DEFUN([AM_CONDITIONAL],
1248e4923e5Smrg[AC_PREREQ([2.52])dnl
1258e4923e5Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1268e4923e5Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1277e4fd55aSmrgAC_SUBST([$1_TRUE])dnl
1287e4fd55aSmrgAC_SUBST([$1_FALSE])dnl
1297e4fd55aSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1307e4fd55aSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1317e4fd55aSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1327e4fd55aSmrgif $2; then
1337e4fd55aSmrg  $1_TRUE=
1347e4fd55aSmrg  $1_FALSE='#'
135b8f75c19Smrgelse
1367e4fd55aSmrg  $1_TRUE='#'
1377e4fd55aSmrg  $1_FALSE=
138b8f75c19Smrgfi
1397e4fd55aSmrgAC_CONFIG_COMMANDS_PRE(
1407e4fd55aSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1417e4fd55aSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1427e4fd55aSmrgUsually this means the macro was only invoked conditionally.]])
1437e4fd55aSmrgfi])])
144b8f75c19Smrg
1458e4923e5Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
1467e4fd55aSmrg#
1477e4fd55aSmrg# This file is free software; the Free Software Foundation
1487e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
1497e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
150b8f75c19Smrg
151b8f75c19Smrg
1528e4923e5Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
153b8f75c19Smrg# written in clear, in which case automake, when reading aclocal.m4,
154b8f75c19Smrg# will think it sees a *use*, and therefore will trigger all it's
155b8f75c19Smrg# C support machinery.  Also note that it means that autoscan, seeing
156b8f75c19Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
157b8f75c19Smrg
158b8f75c19Smrg
159b8f75c19Smrg# _AM_DEPENDENCIES(NAME)
160b8f75c19Smrg# ----------------------
161b8f75c19Smrg# See how the compiler implements dependency checking.
1628e4923e5Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
163b8f75c19Smrg# We try a few techniques and use that to set a single cache variable.
164b8f75c19Smrg#
165b8f75c19Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
166b8f75c19Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
167b8f75c19Smrg# dependency, and given that the user is not expected to run this macro,
168b8f75c19Smrg# just rely on AC_PROG_CC.
169b8f75c19SmrgAC_DEFUN([_AM_DEPENDENCIES],
170b8f75c19Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
171b8f75c19SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
172b8f75c19SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
173b8f75c19SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
174b8f75c19Smrg
1758e4923e5Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1768e4923e5Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1778e4923e5Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1788e4923e5Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1798e4923e5Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1808e4923e5Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1818e4923e5Smrg                    [depcc="$$1"   am_compiler_list=])
182b8f75c19Smrg
183b8f75c19SmrgAC_CACHE_CHECK([dependency style of $depcc],
184b8f75c19Smrg               [am_cv_$1_dependencies_compiler_type],
185b8f75c19Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
186b8f75c19Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
187b8f75c19Smrg  # making bogus files that we don't know about and never remove.  For
188b8f75c19Smrg  # instance it was reported that on HP-UX the gcc test will end up
1898e4923e5Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1908e4923e5Smrg  # in D".
1918e4923e5Smrg  rm -rf conftest.dir
192b8f75c19Smrg  mkdir conftest.dir
193b8f75c19Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
194b8f75c19Smrg  # using a relative directory.
195b8f75c19Smrg  cp "$am_depcomp" conftest.dir
196b8f75c19Smrg  cd conftest.dir
197b8f75c19Smrg  # We will build objects and dependencies in a subdirectory because
198b8f75c19Smrg  # it helps to detect inapplicable dependency modes.  For instance
199b8f75c19Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
200b8f75c19Smrg  # side effect of compilation, but ICC will put the dependencies in
201b8f75c19Smrg  # the current directory while Tru64 will put them in the object
202b8f75c19Smrg  # directory.
203b8f75c19Smrg  mkdir sub
204b8f75c19Smrg
205b8f75c19Smrg  am_cv_$1_dependencies_compiler_type=none
206b8f75c19Smrg  if test "$am_compiler_list" = ""; then
207b8f75c19Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
208b8f75c19Smrg  fi
2097e4fd55aSmrg  am__universal=false
2107e4fd55aSmrg  m4_case([$1], [CC],
2117e4fd55aSmrg    [case " $depcc " in #(
2127e4fd55aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2137e4fd55aSmrg     esac],
2147e4fd55aSmrg    [CXX],
2157e4fd55aSmrg    [case " $depcc " in #(
2167e4fd55aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2177e4fd55aSmrg     esac])
2187e4fd55aSmrg
219b8f75c19Smrg  for depmode in $am_compiler_list; do
220b8f75c19Smrg    # Setup a source with many dependencies, because some compilers
221b8f75c19Smrg    # like to wrap large dependency lists on column 80 (with \), and
222b8f75c19Smrg    # we should not choose a depcomp mode which is confused by this.
223b8f75c19Smrg    #
224b8f75c19Smrg    # We need to recreate these files for each test, as the compiler may
225b8f75c19Smrg    # overwrite some of them when testing with obscure command lines.
226b8f75c19Smrg    # This happens at least with the AIX C compiler.
227b8f75c19Smrg    : > sub/conftest.c
228b8f75c19Smrg    for i in 1 2 3 4 5 6; do
229b8f75c19Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2308e4923e5Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2318e4923e5Smrg      # Solaris 10 /bin/sh.
2328e4923e5Smrg      echo '/* dummy */' > sub/conftst$i.h
233b8f75c19Smrg    done
234b8f75c19Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
235b8f75c19Smrg
2368e4923e5Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2377e4fd55aSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2388e4923e5Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2398e4923e5Smrg    # versions had trouble with output in subdirs.
2407e4fd55aSmrg    am__obj=sub/conftest.${OBJEXT-o}
2417e4fd55aSmrg    am__minus_obj="-o $am__obj"
242b8f75c19Smrg    case $depmode in
2437e4fd55aSmrg    gcc)
2447e4fd55aSmrg      # This depmode causes a compiler race in universal mode.
2457e4fd55aSmrg      test "$am__universal" = false || continue
2467e4fd55aSmrg      ;;
247b8f75c19Smrg    nosideeffect)
2488e4923e5Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2498e4923e5Smrg      # only be used when explicitly requested.
250b8f75c19Smrg      if test "x$enable_dependency_tracking" = xyes; then
251b8f75c19Smrg	continue
252b8f75c19Smrg      else
253b8f75c19Smrg	break
254b8f75c19Smrg      fi
255b8f75c19Smrg      ;;
2568e4923e5Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2578e4923e5Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2587e4fd55aSmrg      # not run yet.  These depmodes are late enough in the game, and
2597e4fd55aSmrg      # so weak that their functioning should not be impacted.
2607e4fd55aSmrg      am__obj=conftest.${OBJEXT-o}
2617e4fd55aSmrg      am__minus_obj=
2627e4fd55aSmrg      ;;
263b8f75c19Smrg    none) break ;;
264b8f75c19Smrg    esac
265b8f75c19Smrg    if depmode=$depmode \
2667e4fd55aSmrg       source=sub/conftest.c object=$am__obj \
267b8f75c19Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2687e4fd55aSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
269b8f75c19Smrg         >/dev/null 2>conftest.err &&
2707e4fd55aSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
271b8f75c19Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2727e4fd55aSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
273b8f75c19Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
274b8f75c19Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2757e4fd55aSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2767e4fd55aSmrg      # that says an option was ignored or not supported.
2777e4fd55aSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2787e4fd55aSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2797e4fd55aSmrg      # The diagnosis changed in icc 8.0:
2807e4fd55aSmrg      #   icc: Command line remark: option '-MP' not supported
2817e4fd55aSmrg      if (grep 'ignoring option' conftest.err ||
2827e4fd55aSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
283b8f75c19Smrg        am_cv_$1_dependencies_compiler_type=$depmode
284b8f75c19Smrg        break
285b8f75c19Smrg      fi
286b8f75c19Smrg    fi
287b8f75c19Smrg  done
288b8f75c19Smrg
289b8f75c19Smrg  cd ..
290b8f75c19Smrg  rm -rf conftest.dir
291b8f75c19Smrgelse
292b8f75c19Smrg  am_cv_$1_dependencies_compiler_type=none
293b8f75c19Smrgfi
294b8f75c19Smrg])
295b8f75c19SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
296b8f75c19SmrgAM_CONDITIONAL([am__fastdep$1], [
297b8f75c19Smrg  test "x$enable_dependency_tracking" != xno \
298b8f75c19Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
299b8f75c19Smrg])
300b8f75c19Smrg
301b8f75c19Smrg
302b8f75c19Smrg# AM_SET_DEPDIR
303b8f75c19Smrg# -------------
304b8f75c19Smrg# Choose a directory name for dependency files.
3058e4923e5Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
306b8f75c19SmrgAC_DEFUN([AM_SET_DEPDIR],
307b8f75c19Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
308b8f75c19SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
309b8f75c19Smrg])
310b8f75c19Smrg
311b8f75c19Smrg
312b8f75c19Smrg# AM_DEP_TRACK
313b8f75c19Smrg# ------------
314b8f75c19SmrgAC_DEFUN([AM_DEP_TRACK],
3158e4923e5Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3168e4923e5SmrgAS_HELP_STRING(
3178e4923e5Smrg  [--enable-dependency-tracking],
3188e4923e5Smrg  [do not reject slow dependency extractors])
3198e4923e5SmrgAS_HELP_STRING(
3208e4923e5Smrg  [--disable-dependency-tracking],
3218e4923e5Smrg  [speeds up one-time build])])
322b8f75c19Smrgif test "x$enable_dependency_tracking" != xno; then
323b8f75c19Smrg  am_depcomp="$ac_aux_dir/depcomp"
324b8f75c19Smrg  AMDEPBACKSLASH='\'
3258e4923e5Smrg  am__nodep='_no'
326b8f75c19Smrgfi
327b8f75c19SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3287e4fd55aSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3297e4fd55aSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3308e4923e5SmrgAC_SUBST([am__nodep])dnl
3318e4923e5Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
332b8f75c19Smrg])
333b8f75c19Smrg
3347e4fd55aSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
335b8f75c19Smrg
3368e4923e5Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
3377e4fd55aSmrg#
3387e4fd55aSmrg# This file is free software; the Free Software Foundation
3397e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
3407e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
341b8f75c19Smrg
342b8f75c19Smrg
343b8f75c19Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
344b8f75c19Smrg# ------------------------------
345b8f75c19SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3467e4fd55aSmrg[{
3478e4923e5Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3487e4fd55aSmrg  # are listed without --file.  Let's play safe and only enable the eval
3497e4fd55aSmrg  # if we detect the quoting.
3507e4fd55aSmrg  case $CONFIG_FILES in
3517e4fd55aSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
3527e4fd55aSmrg  *)   set x $CONFIG_FILES ;;
3537e4fd55aSmrg  esac
3547e4fd55aSmrg  shift
3557e4fd55aSmrg  for mf
3567e4fd55aSmrg  do
3577e4fd55aSmrg    # Strip MF so we end up with the name of the file.
3587e4fd55aSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3597e4fd55aSmrg    # Check whether this is an Automake generated Makefile or not.
3608e4923e5Smrg    # We used to match only the files named 'Makefile.in', but
3617e4fd55aSmrg    # some people rename them; so instead we look at the file content.
3627e4fd55aSmrg    # Grep'ing the first line is not enough: some people post-process
3637e4fd55aSmrg    # each Makefile.in and add a new line on top of each file to say so.
3647e4fd55aSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
3657e4fd55aSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3667e4fd55aSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3677e4fd55aSmrg      dirpart=`AS_DIRNAME("$mf")`
3687e4fd55aSmrg    else
3697e4fd55aSmrg      continue
3707e4fd55aSmrg    fi
3717e4fd55aSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
3728e4923e5Smrg    # from the Makefile without running 'make'.
3737e4fd55aSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3747e4fd55aSmrg    test -z "$DEPDIR" && continue
3757e4fd55aSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3768e4923e5Smrg    test -z "$am__include" && continue
3777e4fd55aSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3787e4fd55aSmrg    # Find all dependency output files, they are included files with
3797e4fd55aSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3807e4fd55aSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3817e4fd55aSmrg    # expansion.
3827e4fd55aSmrg    for file in `sed -n "
3837e4fd55aSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3848e4923e5Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
3857e4fd55aSmrg      # Make sure the directory exists.
3867e4fd55aSmrg      test -f "$dirpart/$file" && continue
3877e4fd55aSmrg      fdir=`AS_DIRNAME(["$file"])`
3887e4fd55aSmrg      AS_MKDIR_P([$dirpart/$fdir])
3897e4fd55aSmrg      # echo "creating $dirpart/$file"
3907e4fd55aSmrg      echo '# dummy' > "$dirpart/$file"
3917e4fd55aSmrg    done
392b8f75c19Smrg  done
3937e4fd55aSmrg}
394b8f75c19Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
395b8f75c19Smrg
396b8f75c19Smrg
397b8f75c19Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
398b8f75c19Smrg# -----------------------------
399b8f75c19Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
400b8f75c19Smrg#
401b8f75c19Smrg# This code is only required when automatic dependency tracking
4028e4923e5Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
403b8f75c19Smrg# need in order to bootstrap the dependency handling code.
404b8f75c19SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
405b8f75c19Smrg[AC_CONFIG_COMMANDS([depfiles],
406b8f75c19Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
407b8f75c19Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
408b8f75c19Smrg])
409b8f75c19Smrg
4107e4fd55aSmrg# Do all the work for Automake.                             -*- Autoconf -*-
411b8f75c19Smrg
4128e4923e5Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4137e4fd55aSmrg#
4147e4fd55aSmrg# This file is free software; the Free Software Foundation
4157e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
4167e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
417b8f75c19Smrg
4187e4fd55aSmrg# This macro actually does too much.  Some checks are only needed if
4197e4fd55aSmrg# your package does certain things.  But this isn't really a big deal.
420b8f75c19Smrg
4218e4923e5Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4228e4923e5Smrgm4_define([AC_PROG_CC],
4238e4923e5Smrgm4_defn([AC_PROG_CC])
4248e4923e5Smrg[_AM_PROG_CC_C_O
4258e4923e5Smrg])
4268e4923e5Smrg
4277e4fd55aSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4287e4fd55aSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4297e4fd55aSmrg# -----------------------------------------------
4307e4fd55aSmrg# The call with PACKAGE and VERSION arguments is the old style
4317e4fd55aSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4327e4fd55aSmrg# and VERSION should now be passed to AC_INIT and removed from
4337e4fd55aSmrg# the call to AM_INIT_AUTOMAKE.
4347e4fd55aSmrg# We support both call styles for the transition.  After
4357e4fd55aSmrg# the next Automake release, Autoconf can make the AC_INIT
4367e4fd55aSmrg# arguments mandatory, and then we can depend on a new Autoconf
4377e4fd55aSmrg# release and drop the old call support.
4387e4fd55aSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4398e4923e5Smrg[AC_PREREQ([2.65])dnl
4407e4fd55aSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4417e4fd55aSmrgdnl the ones we care about.
4427e4fd55aSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4437e4fd55aSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4447e4fd55aSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4457e4fd55aSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4467e4fd55aSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4477e4fd55aSmrg  # is not polluted with repeated "-I."
4487e4fd55aSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4497e4fd55aSmrg  # test to see if srcdir already configured
4507e4fd55aSmrg  if test -f $srcdir/config.status; then
4517e4fd55aSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4527e4fd55aSmrg  fi
4537e4fd55aSmrgfi
4547e4fd55aSmrg
4557e4fd55aSmrg# test whether we have cygpath
4567e4fd55aSmrgif test -z "$CYGPATH_W"; then
4577e4fd55aSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4587e4fd55aSmrg    CYGPATH_W='cygpath -w'
4597e4fd55aSmrg  else
4607e4fd55aSmrg    CYGPATH_W=echo
4617e4fd55aSmrg  fi
4627e4fd55aSmrgfi
4637e4fd55aSmrgAC_SUBST([CYGPATH_W])
4647e4fd55aSmrg
4657e4fd55aSmrg# Define the identity of the package.
4667e4fd55aSmrgdnl Distinguish between old-style and new-style calls.
4677e4fd55aSmrgm4_ifval([$2],
4688e4923e5Smrg[AC_DIAGNOSE([obsolete],
4698e4923e5Smrg             [$0: two- and three-arguments forms are deprecated.])
4708e4923e5Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4717e4fd55aSmrg AC_SUBST([PACKAGE], [$1])dnl
4727e4fd55aSmrg AC_SUBST([VERSION], [$2])],
4737e4fd55aSmrg[_AM_SET_OPTIONS([$1])dnl
4747e4fd55aSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4758e4923e5Smrgm4_if(
4768e4923e5Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
4778e4923e5Smrg  [ok:ok],,
4787e4fd55aSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4797e4fd55aSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4807e4fd55aSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4817e4fd55aSmrg
4827e4fd55aSmrg_AM_IF_OPTION([no-define],,
4838e4923e5Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4848e4923e5Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4857e4fd55aSmrg
4867e4fd55aSmrg# Some tools Automake needs.
4877e4fd55aSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4887e4fd55aSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4898e4923e5SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4908e4923e5SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4918e4923e5SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4928e4923e5SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4938e4923e5SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4947e4fd55aSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4957e4fd55aSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4968e4923e5SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4978e4923e5Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4988e4923e5Smrg# dies out for good.  For more background, see:
4998e4923e5Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
5008e4923e5Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
5018e4923e5SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
5027e4fd55aSmrg# We need awk for the "check" target.  The system "awk" is bad on
5037e4fd55aSmrg# some platforms.
5047e4fd55aSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5057e4fd55aSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5067e4fd55aSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5077e4fd55aSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5087e4fd55aSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5097e4fd55aSmrg			     [_AM_PROG_TAR([v7])])])
5107e4fd55aSmrg_AM_IF_OPTION([no-dependencies],,
5117e4fd55aSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5128e4923e5Smrg		  [_AM_DEPENDENCIES([CC])],
5138e4923e5Smrg		  [m4_define([AC_PROG_CC],
5148e4923e5Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5157e4fd55aSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5168e4923e5Smrg		  [_AM_DEPENDENCIES([CXX])],
5178e4923e5Smrg		  [m4_define([AC_PROG_CXX],
5188e4923e5Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5197e4fd55aSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5208e4923e5Smrg		  [_AM_DEPENDENCIES([OBJC])],
5218e4923e5Smrg		  [m4_define([AC_PROG_OBJC],
5228e4923e5Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5238e4923e5SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5248e4923e5Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5258e4923e5Smrg		  [m4_define([AC_PROG_OBJCXX],
5268e4923e5Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5277e4fd55aSmrg])
5288e4923e5SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5298e4923e5Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5308e4923e5Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5318e4923e5Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5327e4fd55aSmrgAC_CONFIG_COMMANDS_PRE(dnl
5337e4fd55aSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5347e4fd55aSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5357e4fd55aSmrg
5368e4923e5Smrg# POSIX will say in a future version that running "rm -f" with no argument
5378e4923e5Smrg# is OK; and we want to be able to make that assumption in our Makefile
5388e4923e5Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5398e4923e5Smrg# actually supported "in the wild" to an acceptable degree.
5408e4923e5Smrg# See automake bug#10828.
5418e4923e5Smrg# To make any issue more visible, cause the running configure to be aborted
5428e4923e5Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5438e4923e5Smrg# user can still override this though.
5448e4923e5Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5458e4923e5Smrg  cat >&2 <<'END'
5468e4923e5SmrgOops!
5478e4923e5Smrg
5488e4923e5SmrgYour 'rm' program seems unable to run without file operands specified
5498e4923e5Smrgon the command line, even when the '-f' option is present.  This is contrary
5508e4923e5Smrgto the behaviour of most rm programs out there, and not conforming with
5518e4923e5Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5528e4923e5Smrg
5538e4923e5SmrgPlease tell bug-automake@gnu.org about your system, including the value
5548e4923e5Smrgof your $PATH and any error possibly output before this message.  This
5558e4923e5Smrgcan help us improve future automake versions.
5568e4923e5Smrg
5578e4923e5SmrgEND
5588e4923e5Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5598e4923e5Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5608e4923e5Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5618e4923e5Smrg    echo >&2
5628e4923e5Smrg  else
5638e4923e5Smrg    cat >&2 <<'END'
5648e4923e5SmrgAborting the configuration process, to ensure you take notice of the issue.
5658e4923e5Smrg
5668e4923e5SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5678e4923e5Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
5688e4923e5Smrg
5698e4923e5SmrgIf you want to complete the configuration process using your problematic
5708e4923e5Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5718e4923e5Smrgto "yes", and re-run configure.
5728e4923e5Smrg
5738e4923e5SmrgEND
5748e4923e5Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5758e4923e5Smrg  fi
5768e4923e5Smrgfi])
5778e4923e5Smrg
5788e4923e5Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5797e4fd55aSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5807e4fd55aSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5817e4fd55aSmrgm4_define([_AC_COMPILER_EXEEXT],
5827e4fd55aSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5837e4fd55aSmrg
5847e4fd55aSmrg# When config.status generates a header, we must update the stamp-h file.
5857e4fd55aSmrg# This file resides in the same directory as the config header
5867e4fd55aSmrg# that is generated.  The stamp files are numbered to have different names.
5877e4fd55aSmrg
5887e4fd55aSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5897e4fd55aSmrg# loop where config.status creates the headers, so we can generate
5907e4fd55aSmrg# our stamp files there.
5917e4fd55aSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5927e4fd55aSmrg[# Compute $1's index in $config_headers.
5937e4fd55aSmrg_am_arg=$1
5947e4fd55aSmrg_am_stamp_count=1
5957e4fd55aSmrgfor _am_header in $config_headers :; do
5967e4fd55aSmrg  case $_am_header in
5977e4fd55aSmrg    $_am_arg | $_am_arg:* )
5987e4fd55aSmrg      break ;;
5997e4fd55aSmrg    * )
6007e4fd55aSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6017e4fd55aSmrg  esac
6027e4fd55aSmrgdone
6037e4fd55aSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6047e4fd55aSmrg
6058e4923e5Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6067e4fd55aSmrg#
6077e4fd55aSmrg# This file is free software; the Free Software Foundation
6087e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
6097e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
6107e4fd55aSmrg
6117e4fd55aSmrg# AM_PROG_INSTALL_SH
6127e4fd55aSmrg# ------------------
6137e4fd55aSmrg# Define $install_sh.
6147e4fd55aSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6157e4fd55aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6167e4fd55aSmrgif test x"${install_sh}" != xset; then
6177e4fd55aSmrg  case $am_aux_dir in
6187e4fd55aSmrg  *\ * | *\	*)
6197e4fd55aSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6207e4fd55aSmrg  *)
6217e4fd55aSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6227e4fd55aSmrg  esac
6237e4fd55aSmrgfi
6248e4923e5SmrgAC_SUBST([install_sh])])
6257e4fd55aSmrg
6268e4923e5Smrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
6277e4fd55aSmrg#
6287e4fd55aSmrg# This file is free software; the Free Software Foundation
6297e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
6307e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
631b8f75c19Smrg
6327e4fd55aSmrg# Check whether the underlying file-system supports filenames
6337e4fd55aSmrg# with a leading dot.  For instance MS-DOS doesn't.
6347e4fd55aSmrgAC_DEFUN([AM_SET_LEADING_DOT],
6357e4fd55aSmrg[rm -rf .tst 2>/dev/null
6367e4fd55aSmrgmkdir .tst 2>/dev/null
6377e4fd55aSmrgif test -d .tst; then
6387e4fd55aSmrg  am__leading_dot=.
6397e4fd55aSmrgelse
6407e4fd55aSmrg  am__leading_dot=_
6417e4fd55aSmrgfi
6427e4fd55aSmrgrmdir .tst 2>/dev/null
6437e4fd55aSmrgAC_SUBST([am__leading_dot])])
6447e4fd55aSmrg
6457e4fd55aSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
6467e4fd55aSmrg# From Jim Meyering
6477e4fd55aSmrg
6488e4923e5Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
6497e4fd55aSmrg#
6507e4fd55aSmrg# This file is free software; the Free Software Foundation
6517e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
6527e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
6537e4fd55aSmrg
6547e4fd55aSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6557e4fd55aSmrg# ----------------------------------
6567e4fd55aSmrg# Control maintainer-specific portions of Makefiles.
6578e4923e5Smrg# Default is to disable them, unless 'enable' is passed literally.
6588e4923e5Smrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
6597e4fd55aSmrg# can override the default with the --enable/--disable switch.
6607e4fd55aSmrgAC_DEFUN([AM_MAINTAINER_MODE],
6617e4fd55aSmrg[m4_case(m4_default([$1], [disable]),
6627e4fd55aSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
6637e4fd55aSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
6647e4fd55aSmrg       [m4_define([am_maintainer_other], [enable])
6657e4fd55aSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
6668e4923e5SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
6677e4fd55aSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6687e4fd55aSmrg  AC_ARG_ENABLE([maintainer-mode],
6698e4923e5Smrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
6708e4923e5Smrg      am_maintainer_other[ make rules and dependencies not useful
6718e4923e5Smrg      (and sometimes confusing) to the casual installer])],
6728e4923e5Smrg    [USE_MAINTAINER_MODE=$enableval],
6738e4923e5Smrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6747e4fd55aSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6757e4fd55aSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6767e4fd55aSmrg  MAINT=$MAINTAINER_MODE_TRUE
6777e4fd55aSmrg  AC_SUBST([MAINT])dnl
6787e4fd55aSmrg]
6797e4fd55aSmrg)
6807e4fd55aSmrg
6817e4fd55aSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6827e4fd55aSmrg
6838e4923e5Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6847e4fd55aSmrg#
6857e4fd55aSmrg# This file is free software; the Free Software Foundation
6867e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
6877e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
6887e4fd55aSmrg
689b8f75c19Smrg# AM_MAKE_INCLUDE()
690b8f75c19Smrg# -----------------
691b8f75c19Smrg# Check to see how make treats includes.
692b8f75c19SmrgAC_DEFUN([AM_MAKE_INCLUDE],
693b8f75c19Smrg[am_make=${MAKE-make}
694b8f75c19Smrgcat > confinc << 'END'
695b8f75c19Smrgam__doit:
6967e4fd55aSmrg	@echo this is the am__doit target
697b8f75c19Smrg.PHONY: am__doit
698b8f75c19SmrgEND
699b8f75c19Smrg# If we don't find an include directive, just comment out the code.
700b8f75c19SmrgAC_MSG_CHECKING([for style of include used by $am_make])
701b8f75c19Smrgam__include="#"
702b8f75c19Smrgam__quote=
703b8f75c19Smrg_am_result=none
704b8f75c19Smrg# First try GNU make style include.
705b8f75c19Smrgecho "include confinc" > confmf
7068e4923e5Smrg# Ignore all kinds of additional output from 'make'.
7077e4fd55aSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
7087e4fd55aSmrg*the\ am__doit\ target*)
7097e4fd55aSmrg  am__include=include
7107e4fd55aSmrg  am__quote=
7117e4fd55aSmrg  _am_result=GNU
7127e4fd55aSmrg  ;;
7137e4fd55aSmrgesac
714b8f75c19Smrg# Now try BSD make style include.
715b8f75c19Smrgif test "$am__include" = "#"; then
716b8f75c19Smrg   echo '.include "confinc"' > confmf
7177e4fd55aSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
7187e4fd55aSmrg   *the\ am__doit\ target*)
7197e4fd55aSmrg     am__include=.include
7207e4fd55aSmrg     am__quote="\""
7217e4fd55aSmrg     _am_result=BSD
7227e4fd55aSmrg     ;;
7237e4fd55aSmrg   esac
724b8f75c19Smrgfi
725b8f75c19SmrgAC_SUBST([am__include])
726b8f75c19SmrgAC_SUBST([am__quote])
727b8f75c19SmrgAC_MSG_RESULT([$_am_result])
728b8f75c19Smrgrm -f confinc confmf
729b8f75c19Smrg])
730b8f75c19Smrg
7317e4fd55aSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
732b8f75c19Smrg
7338e4923e5Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
7347e4fd55aSmrg#
7357e4fd55aSmrg# This file is free software; the Free Software Foundation
7367e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
7377e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
738b8f75c19Smrg
7397e4fd55aSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7407e4fd55aSmrg# ------------------------------
7417e4fd55aSmrgAC_DEFUN([AM_MISSING_PROG],
7427e4fd55aSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7437e4fd55aSmrg$1=${$1-"${am_missing_run}$2"}
7447e4fd55aSmrgAC_SUBST($1)])
745b8f75c19Smrg
7467e4fd55aSmrg# AM_MISSING_HAS_RUN
7477e4fd55aSmrg# ------------------
7488e4923e5Smrg# Define MISSING if not defined so far and test if it is modern enough.
7498e4923e5Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7507e4fd55aSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7517e4fd55aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7527e4fd55aSmrgAC_REQUIRE_AUX_FILE([missing])dnl
7537e4fd55aSmrgif test x"${MISSING+set}" != xset; then
7547e4fd55aSmrg  case $am_aux_dir in
7557e4fd55aSmrg  *\ * | *\	*)
7567e4fd55aSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7577e4fd55aSmrg  *)
7587e4fd55aSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7597e4fd55aSmrg  esac
7607e4fd55aSmrgfi
7617e4fd55aSmrg# Use eval to expand $SHELL
7628e4923e5Smrgif eval "$MISSING --is-lightweight"; then
7638e4923e5Smrg  am_missing_run="$MISSING "
764b8f75c19Smrgelse
7657e4fd55aSmrg  am_missing_run=
7668e4923e5Smrg  AC_MSG_WARN(['missing' script is too old or missing])
767b8f75c19Smrgfi
7687e4fd55aSmrg])
769b8f75c19Smrg
7707e4fd55aSmrg# Helper functions for option handling.                     -*- Autoconf -*-
771b8f75c19Smrg
7728e4923e5Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
7737e4fd55aSmrg#
7747e4fd55aSmrg# This file is free software; the Free Software Foundation
7757e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
7767e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
777b8f75c19Smrg
7787e4fd55aSmrg# _AM_MANGLE_OPTION(NAME)
7797e4fd55aSmrg# -----------------------
7807e4fd55aSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7817e4fd55aSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
782b8f75c19Smrg
7837e4fd55aSmrg# _AM_SET_OPTION(NAME)
7848e4923e5Smrg# --------------------
7857e4fd55aSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7867e4fd55aSmrgAC_DEFUN([_AM_SET_OPTION],
7878e4923e5Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
788b8f75c19Smrg
7897e4fd55aSmrg# _AM_SET_OPTIONS(OPTIONS)
7908e4923e5Smrg# ------------------------
7917e4fd55aSmrg# OPTIONS is a space-separated list of Automake options.
7927e4fd55aSmrgAC_DEFUN([_AM_SET_OPTIONS],
7937e4fd55aSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
794b8f75c19Smrg
7957e4fd55aSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7967e4fd55aSmrg# -------------------------------------------
7977e4fd55aSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7987e4fd55aSmrgAC_DEFUN([_AM_IF_OPTION],
7997e4fd55aSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
800b8f75c19Smrg
8018e4923e5Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
8028e4923e5Smrg#
8038e4923e5Smrg# This file is free software; the Free Software Foundation
8048e4923e5Smrg# gives unlimited permission to copy and/or distribute it,
8058e4923e5Smrg# with or without modifications, as long as this notice is preserved.
8068e4923e5Smrg
8078e4923e5Smrg# _AM_PROG_CC_C_O
8088e4923e5Smrg# ---------------
8098e4923e5Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
8108e4923e5Smrg# to automatically call this.
8118e4923e5SmrgAC_DEFUN([_AM_PROG_CC_C_O],
8128e4923e5Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
8138e4923e5SmrgAC_REQUIRE_AUX_FILE([compile])dnl
8148e4923e5SmrgAC_LANG_PUSH([C])dnl
8158e4923e5SmrgAC_CACHE_CHECK(
8168e4923e5Smrg  [whether $CC understands -c and -o together],
8178e4923e5Smrg  [am_cv_prog_cc_c_o],
8188e4923e5Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
8198e4923e5Smrg  # Make sure it works both with $CC and with simple cc.
8208e4923e5Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
8218e4923e5Smrg  # compilers refuse to overwrite an existing .o file with -o,
8228e4923e5Smrg  # though they will create one.
8238e4923e5Smrg  am_cv_prog_cc_c_o=yes
8248e4923e5Smrg  for am_i in 1 2; do
8258e4923e5Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
8268e4923e5Smrg         && test -f conftest2.$ac_objext; then
8278e4923e5Smrg      : OK
8288e4923e5Smrg    else
8298e4923e5Smrg      am_cv_prog_cc_c_o=no
8308e4923e5Smrg      break
8318e4923e5Smrg    fi
8328e4923e5Smrg  done
8338e4923e5Smrg  rm -f core conftest*
8348e4923e5Smrg  unset am_i])
8358e4923e5Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8368e4923e5Smrg   # Losing compiler, so override with the script.
8378e4923e5Smrg   # FIXME: It is wrong to rewrite CC.
8388e4923e5Smrg   # But if we don't then we get into trouble of one sort or another.
8398e4923e5Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8408e4923e5Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8418e4923e5Smrg   CC="$am_aux_dir/compile $CC"
8428e4923e5Smrgfi
8438e4923e5SmrgAC_LANG_POP([C])])
844b8f75c19Smrg
8458e4923e5Smrg# For backward compatibility.
8468e4923e5SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8478e4923e5Smrg
8488e4923e5Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
849b8f75c19Smrg#
8507e4fd55aSmrg# This file is free software; the Free Software Foundation
8517e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
8527e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
853b8f75c19Smrg
8548e4923e5Smrg# AM_RUN_LOG(COMMAND)
8558e4923e5Smrg# -------------------
8568e4923e5Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8578e4923e5Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8588e4923e5SmrgAC_DEFUN([AM_RUN_LOG],
8598e4923e5Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8608e4923e5Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8618e4923e5Smrg   ac_status=$?
8628e4923e5Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8638e4923e5Smrg   (exit $ac_status); }])
8648e4923e5Smrg
8658e4923e5Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8668e4923e5Smrg
8678e4923e5Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
8688e4923e5Smrg#
8698e4923e5Smrg# This file is free software; the Free Software Foundation
8708e4923e5Smrg# gives unlimited permission to copy and/or distribute it,
8718e4923e5Smrg# with or without modifications, as long as this notice is preserved.
872b8f75c19Smrg
8737e4fd55aSmrg# AM_SANITY_CHECK
8747e4fd55aSmrg# ---------------
8757e4fd55aSmrgAC_DEFUN([AM_SANITY_CHECK],
8767e4fd55aSmrg[AC_MSG_CHECKING([whether build environment is sane])
8777e4fd55aSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8787e4fd55aSmrg# name.  Accept space and tab only in the latter.
8797e4fd55aSmrgam_lf='
8807e4fd55aSmrg'
8817e4fd55aSmrgcase `pwd` in
8827e4fd55aSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8837e4fd55aSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8847e4fd55aSmrgesac
8857e4fd55aSmrgcase $srcdir in
8867e4fd55aSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8878e4923e5Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8887e4fd55aSmrgesac
8897e4fd55aSmrg
8908e4923e5Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8917e4fd55aSmrg# arguments.  Must try -L first in case configure is actually a
8927e4fd55aSmrg# symlink; some systems play weird games with the mod time of symlinks
8937e4fd55aSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8947e4fd55aSmrg# directory).
8957e4fd55aSmrgif (
8968e4923e5Smrg   am_has_slept=no
8978e4923e5Smrg   for am_try in 1 2; do
8988e4923e5Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8998e4923e5Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
9008e4923e5Smrg     if test "$[*]" = "X"; then
9018e4923e5Smrg	# -L didn't work.
9028e4923e5Smrg	set X `ls -t "$srcdir/configure" conftest.file`
9038e4923e5Smrg     fi
9048e4923e5Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
9058e4923e5Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
9068e4923e5Smrg
9078e4923e5Smrg	# If neither matched, then we have a broken ls.  This can happen
9088e4923e5Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
9098e4923e5Smrg	# broken ls alias from the environment.  This has actually
9108e4923e5Smrg	# happened.  Such a system could not be considered "sane".
9118e4923e5Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
9128e4923e5Smrg  alias in your environment])
9138e4923e5Smrg     fi
9148e4923e5Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
9158e4923e5Smrg       break
9168e4923e5Smrg     fi
9178e4923e5Smrg     # Just in case.
9188e4923e5Smrg     sleep 1
9198e4923e5Smrg     am_has_slept=yes
9208e4923e5Smrg   done
9217e4fd55aSmrg   test "$[2]" = conftest.file
9227e4fd55aSmrg   )
9237e4fd55aSmrgthen
9247e4fd55aSmrg   # Ok.
9257e4fd55aSmrg   :
926b8f75c19Smrgelse
9277e4fd55aSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
9287e4fd55aSmrgCheck your system clock])
9297e4fd55aSmrgfi
9308e4923e5SmrgAC_MSG_RESULT([yes])
9318e4923e5Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
9328e4923e5Smrg# generated files are strictly newer.
9338e4923e5Smrgam_sleep_pid=
9348e4923e5Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9358e4923e5Smrg  ( sleep 1 ) &
9368e4923e5Smrg  am_sleep_pid=$!
9378e4923e5Smrgfi
9388e4923e5SmrgAC_CONFIG_COMMANDS_PRE(
9398e4923e5Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9408e4923e5Smrg   if test -n "$am_sleep_pid"; then
9418e4923e5Smrg     # Hide warnings about reused PIDs.
9428e4923e5Smrg     wait $am_sleep_pid 2>/dev/null
9438e4923e5Smrg   fi
9448e4923e5Smrg   AC_MSG_RESULT([done])])
9458e4923e5Smrgrm -f conftest.file
9468e4923e5Smrg])
947b8f75c19Smrg
9488e4923e5Smrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
9497e4fd55aSmrg#
9507e4fd55aSmrg# This file is free software; the Free Software Foundation
9517e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
9527e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
953b8f75c19Smrg
9547e4fd55aSmrg# AM_SILENT_RULES([DEFAULT])
9557e4fd55aSmrg# --------------------------
9567e4fd55aSmrg# Enable less verbose build rules; with the default set to DEFAULT
9578e4923e5Smrg# ("yes" being less verbose, "no" or empty being verbose).
9587e4fd55aSmrgAC_DEFUN([AM_SILENT_RULES],
9598e4923e5Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9608e4923e5SmrgAS_HELP_STRING(
9618e4923e5Smrg  [--enable-silent-rules],
9628e4923e5Smrg  [less verbose build output (undo: "make V=1")])
9638e4923e5SmrgAS_HELP_STRING(
9648e4923e5Smrg  [--disable-silent-rules],
9658e4923e5Smrg  [verbose build output (undo: "make V=0")])dnl
9668e4923e5Smrg])
9678e4923e5Smrgcase $enable_silent_rules in @%:@ (((
9688e4923e5Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9698e4923e5Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9708e4923e5Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9717e4fd55aSmrgesac
9728e4923e5Smrgdnl
9738e4923e5Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9748e4923e5Smrgdnl do not support nested variable expansions.
9758e4923e5Smrgdnl See automake bug#9928 and bug#10237.
9768e4923e5Smrgam_make=${MAKE-make}
9778e4923e5SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9788e4923e5Smrg   [am_cv_make_support_nested_variables],
9798e4923e5Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9808e4923e5SmrgBAR0=false
9818e4923e5SmrgBAR1=true
9828e4923e5SmrgV=1
9838e4923e5Smrgam__doit:
9848e4923e5Smrg	@$(TRUE)
9858e4923e5Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9868e4923e5Smrg  am_cv_make_support_nested_variables=yes
9878e4923e5Smrgelse
9888e4923e5Smrg  am_cv_make_support_nested_variables=no
9898e4923e5Smrgfi])
9908e4923e5Smrgif test $am_cv_make_support_nested_variables = yes; then
9918e4923e5Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9928e4923e5Smrg  AM_V='$(V)'
9938e4923e5Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9948e4923e5Smrgelse
9958e4923e5Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9968e4923e5Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9978e4923e5Smrgfi
9988e4923e5SmrgAC_SUBST([AM_V])dnl
9998e4923e5SmrgAM_SUBST_NOTMAKE([AM_V])dnl
10008e4923e5SmrgAC_SUBST([AM_DEFAULT_V])dnl
10018e4923e5SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
10027e4fd55aSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
10037e4fd55aSmrgAM_BACKSLASH='\'
10047e4fd55aSmrgAC_SUBST([AM_BACKSLASH])dnl
10057e4fd55aSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
10067e4fd55aSmrg])
10077e4fd55aSmrg
10088e4923e5Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
1009b8f75c19Smrg#
10107e4fd55aSmrg# This file is free software; the Free Software Foundation
10117e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
10127e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
10137e4fd55aSmrg
10147e4fd55aSmrg# AM_PROG_INSTALL_STRIP
10157e4fd55aSmrg# ---------------------
10168e4923e5Smrg# One issue with vendor 'install' (even GNU) is that you can't
10177e4fd55aSmrg# specify the program used to strip binaries.  This is especially
10187e4fd55aSmrg# annoying in cross-compiling environments, where the build's strip
10197e4fd55aSmrg# is unlikely to handle the host's binaries.
10207e4fd55aSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
10218e4923e5Smrg# always use install-sh in "make install-strip", and initialize
10227e4fd55aSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
10237e4fd55aSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
10247e4fd55aSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
10258e4923e5Smrg# Installed binaries are usually stripped using 'strip' when the user
10268e4923e5Smrg# run "make install-strip".  However 'strip' might not be the right
10277e4fd55aSmrg# tool to use in cross-compilation environments, therefore Automake
10288e4923e5Smrg# will honor the 'STRIP' environment variable to overrule this program.
10298e4923e5Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
10307e4fd55aSmrgif test "$cross_compiling" != no; then
10317e4fd55aSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
10327e4fd55aSmrgfi
10337e4fd55aSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
10347e4fd55aSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10357e4fd55aSmrg
10368e4923e5Smrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
1037b8f75c19Smrg#
10387e4fd55aSmrg# This file is free software; the Free Software Foundation
10397e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
10407e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
1041b8f75c19Smrg
10427e4fd55aSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10437e4fd55aSmrg# ---------------------------
10447e4fd55aSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10457e4fd55aSmrg# This macro is traced by Automake.
10467e4fd55aSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1047b8f75c19Smrg
10487e4fd55aSmrg# AM_SUBST_NOTMAKE(VARIABLE)
10498e4923e5Smrg# --------------------------
10507e4fd55aSmrg# Public sister of _AM_SUBST_NOTMAKE.
10517e4fd55aSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1052b8f75c19Smrg
10537e4fd55aSmrg# Check how to create a tarball.                            -*- Autoconf -*-
1054b8f75c19Smrg
10558e4923e5Smrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
10567e4fd55aSmrg#
10577e4fd55aSmrg# This file is free software; the Free Software Foundation
10587e4fd55aSmrg# gives unlimited permission to copy and/or distribute it,
10597e4fd55aSmrg# with or without modifications, as long as this notice is preserved.
1060b8f75c19Smrg
10617e4fd55aSmrg# _AM_PROG_TAR(FORMAT)
10627e4fd55aSmrg# --------------------
10637e4fd55aSmrg# Check how to create a tarball in format FORMAT.
10648e4923e5Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10657e4fd55aSmrg#
10667e4fd55aSmrg# Substitute a variable $(am__tar) that is a command
10677e4fd55aSmrg# writing to stdout a FORMAT-tarball containing the directory
10687e4fd55aSmrg# $tardir.
10697e4fd55aSmrg#     tardir=directory && $(am__tar) > result.tar
10707e4fd55aSmrg#
10717e4fd55aSmrg# Substitute a variable $(am__untar) that extract such
10727e4fd55aSmrg# a tarball read from stdin.
10737e4fd55aSmrg#     $(am__untar) < result.tar
10748e4923e5Smrg#
10757e4fd55aSmrgAC_DEFUN([_AM_PROG_TAR],
10768e4923e5Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10778e4923e5Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10788e4923e5SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10798e4923e5Smrg
10808e4923e5Smrg# We'll loop over all known methods to create a tar archive until one works.
10817e4fd55aSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1082b8f75c19Smrg
10838e4923e5Smrgm4_if([$1], [v7],
10848e4923e5Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10858e4923e5Smrg
10868e4923e5Smrg  [m4_case([$1],
10878e4923e5Smrg    [ustar],
10888e4923e5Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10898e4923e5Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10908e4923e5Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10918e4923e5Smrg      # and bug#13588).
10928e4923e5Smrg      am_max_uid=2097151 # 2^21 - 1
10938e4923e5Smrg      am_max_gid=$am_max_uid
10948e4923e5Smrg      # The $UID and $GID variables are not portable, so we need to resort
10958e4923e5Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10968e4923e5Smrg      # below are definitely unexpected, so allow the users to see them
10978e4923e5Smrg      # (that is, avoid stderr redirection).
10988e4923e5Smrg      am_uid=`id -u || echo unknown`
10998e4923e5Smrg      am_gid=`id -g || echo unknown`
11008e4923e5Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
11018e4923e5Smrg      if test $am_uid -le $am_max_uid; then
11028e4923e5Smrg         AC_MSG_RESULT([yes])
11038e4923e5Smrg      else
11048e4923e5Smrg         AC_MSG_RESULT([no])
11058e4923e5Smrg         _am_tools=none
11068e4923e5Smrg      fi
11078e4923e5Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
11088e4923e5Smrg      if test $am_gid -le $am_max_gid; then
11098e4923e5Smrg         AC_MSG_RESULT([yes])
11108e4923e5Smrg      else
11118e4923e5Smrg        AC_MSG_RESULT([no])
11128e4923e5Smrg        _am_tools=none
11138e4923e5Smrg      fi],
11148e4923e5Smrg
11158e4923e5Smrg  [pax],
11168e4923e5Smrg    [],
11178e4923e5Smrg
11188e4923e5Smrg  [m4_fatal([Unknown tar format])])
11198e4923e5Smrg
11208e4923e5Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
11218e4923e5Smrg
11228e4923e5Smrg  # Go ahead even if we have the value already cached.  We do so because we
11238e4923e5Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
11248e4923e5Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
11258e4923e5Smrg
11268e4923e5Smrg  for _am_tool in $_am_tools; do
11278e4923e5Smrg    case $_am_tool in
11288e4923e5Smrg    gnutar)
11298e4923e5Smrg      for _am_tar in tar gnutar gtar; do
11308e4923e5Smrg        AM_RUN_LOG([$_am_tar --version]) && break
11318e4923e5Smrg      done
11328e4923e5Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
11338e4923e5Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
11348e4923e5Smrg      am__untar="$_am_tar -xf -"
11358e4923e5Smrg      ;;
11368e4923e5Smrg    plaintar)
11378e4923e5Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11388e4923e5Smrg      # ustar tarball either.
11398e4923e5Smrg      (tar --version) >/dev/null 2>&1 && continue
11408e4923e5Smrg      am__tar='tar chf - "$$tardir"'
11418e4923e5Smrg      am__tar_='tar chf - "$tardir"'
11428e4923e5Smrg      am__untar='tar xf -'
11438e4923e5Smrg      ;;
11448e4923e5Smrg    pax)
11458e4923e5Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11468e4923e5Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11478e4923e5Smrg      am__untar='pax -r'
11488e4923e5Smrg      ;;
11498e4923e5Smrg    cpio)
11508e4923e5Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11518e4923e5Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11528e4923e5Smrg      am__untar='cpio -i -H $1 -d'
11538e4923e5Smrg      ;;
11548e4923e5Smrg    none)
11558e4923e5Smrg      am__tar=false
11568e4923e5Smrg      am__tar_=false
11578e4923e5Smrg      am__untar=false
11588e4923e5Smrg      ;;
11598e4923e5Smrg    esac
1160b8f75c19Smrg
11618e4923e5Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11628e4923e5Smrg    # and am__untar set.
11638e4923e5Smrg    test -n "${am_cv_prog_tar_$1}" && break
11648e4923e5Smrg
11658e4923e5Smrg    # tar/untar a dummy directory, and stop if the command works.
11668e4923e5Smrg    rm -rf conftest.dir
11678e4923e5Smrg    mkdir conftest.dir
11688e4923e5Smrg    echo GrepMe > conftest.dir/file
11698e4923e5Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11708e4923e5Smrg    rm -rf conftest.dir
11718e4923e5Smrg    if test -s conftest.tar; then
11728e4923e5Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11738e4923e5Smrg      AM_RUN_LOG([cat conftest.dir/file])
11748e4923e5Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11758e4923e5Smrg    fi
11768e4923e5Smrg  done
11777e4fd55aSmrg  rm -rf conftest.dir
1178b8f75c19Smrg
11798e4923e5Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11808e4923e5Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11818e4923e5Smrg
11827e4fd55aSmrgAC_SUBST([am__tar])
11837e4fd55aSmrgAC_SUBST([am__untar])
11847e4fd55aSmrg]) # _AM_PROG_TAR
1185b8f75c19Smrg
11868e4923e5Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
11878e4923e5Smrg# 
11888e4923e5Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11897e4fd55aSmrg#
11908e4923e5Smrg# This program is free software; you can redistribute it and/or modify
11918e4923e5Smrg# it under the terms of the GNU General Public License as published by
11928e4923e5Smrg# the Free Software Foundation; either version 2 of the License, or
11938e4923e5Smrg# (at your option) any later version.
11947e4fd55aSmrg#
11958e4923e5Smrg# This program is distributed in the hope that it will be useful, but
11968e4923e5Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
11978e4923e5Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11988e4923e5Smrg# General Public License for more details.
11997e4fd55aSmrg#
12008e4923e5Smrg# You should have received a copy of the GNU General Public License
12018e4923e5Smrg# along with this program; if not, write to the Free Software
12028e4923e5Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
12037e4fd55aSmrg#
12048e4923e5Smrg# As a special exception to the GNU General Public License, if you
12058e4923e5Smrg# distribute this file as part of a program that contains a
12068e4923e5Smrg# configuration script generated by Autoconf, you may include it under
12078e4923e5Smrg# the same distribution terms that you use for the rest of that program.
1208b8f75c19Smrg
12098e4923e5Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
12108e4923e5Smrg# ----------------------------------
12118e4923e5SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12128e4923e5Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12138e4923e5Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
12148e4923e5SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
12158e4923e5Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12168e4923e5Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1217b8f75c19Smrgfi
12188e4923e5Smrgif test -n "$PKG_CONFIG"; then
12198e4923e5Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
12208e4923e5Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12218e4923e5Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1222b8f75c19Smrg		AC_MSG_RESULT([yes])
1223b8f75c19Smrg	else
12248e4923e5Smrg		AC_MSG_RESULT([no])
12258e4923e5Smrg		PKG_CONFIG=""
1226b8f75c19Smrg	fi
12278e4923e5Smrg		
12288e4923e5Smrgfi[]dnl
12298e4923e5Smrg])# PKG_PROG_PKG_CONFIG
1230b8f75c19Smrg
12318e4923e5Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12327e4fd55aSmrg#
12338e4923e5Smrg# Check to see whether a particular set of modules exists.  Similar
12348e4923e5Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
12358e4923e5Smrg#
12368e4923e5Smrg#
12378e4923e5Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
12388e4923e5Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
12398e4923e5Smrg# PKG_CHECK_EXISTS manually
12408e4923e5Smrg# --------------------------------------------------------------
12418e4923e5SmrgAC_DEFUN([PKG_CHECK_EXISTS],
12428e4923e5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12438e4923e5Smrgif test -n "$PKG_CONFIG" && \
12448e4923e5Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12458e4923e5Smrg  m4_ifval([$2], [$2], [:])
12468e4923e5Smrgm4_ifvaln([$3], [else
12478e4923e5Smrg  $3])dnl
12488e4923e5Smrgfi])
1249b8f75c19Smrg
12508e4923e5Smrg
12518e4923e5Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12528e4923e5Smrg# ---------------------------------------------
12538e4923e5Smrgm4_define([_PKG_CONFIG],
12548e4923e5Smrg[if test -n "$$1"; then
12558e4923e5Smrg    pkg_cv_[]$1="$$1"
12568e4923e5Smrg elif test -n "$PKG_CONFIG"; then
12578e4923e5Smrg    PKG_CHECK_EXISTS([$3],
12588e4923e5Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
12598e4923e5Smrg		     [pkg_failed=yes])
12608e4923e5Smrg else
12618e4923e5Smrg    pkg_failed=untried
12628e4923e5Smrgfi[]dnl
12638e4923e5Smrg])# _PKG_CONFIG
12648e4923e5Smrg
12658e4923e5Smrg# _PKG_SHORT_ERRORS_SUPPORTED
12668e4923e5Smrg# -----------------------------
12678e4923e5SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12688e4923e5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12698e4923e5Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12708e4923e5Smrg        _pkg_short_errors_supported=yes
12718e4923e5Smrgelse
12728e4923e5Smrg        _pkg_short_errors_supported=no
12738e4923e5Smrgfi[]dnl
12748e4923e5Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
12758e4923e5Smrg
12768e4923e5Smrg
12778e4923e5Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12788e4923e5Smrg# [ACTION-IF-NOT-FOUND])
12798e4923e5Smrg#
12808e4923e5Smrg#
12818e4923e5Smrg# Note that if there is a possibility the first call to
12828e4923e5Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
12838e4923e5Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12848e4923e5Smrg#
12858e4923e5Smrg#
12868e4923e5Smrg# --------------------------------------------------------------
12878e4923e5SmrgAC_DEFUN([PKG_CHECK_MODULES],
12888e4923e5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12898e4923e5SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12908e4923e5SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12918e4923e5Smrg
12928e4923e5Smrgpkg_failed=no
12938e4923e5SmrgAC_MSG_CHECKING([for $1])
12948e4923e5Smrg
12958e4923e5Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12968e4923e5Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12978e4923e5Smrg
12988e4923e5Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
12998e4923e5Smrgand $1[]_LIBS to avoid the need to call pkg-config.
13008e4923e5SmrgSee the pkg-config man page for more details.])
13018e4923e5Smrg
13028e4923e5Smrgif test $pkg_failed = yes; then
13038e4923e5Smrg        _PKG_SHORT_ERRORS_SUPPORTED
13048e4923e5Smrg        if test $_pkg_short_errors_supported = yes; then
13058e4923e5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
13068e4923e5Smrg        else 
13078e4923e5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
13088e4923e5Smrg        fi
13098e4923e5Smrg	# Put the nasty error message in config.log where it belongs
13108e4923e5Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13118e4923e5Smrg
13128e4923e5Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
13138e4923e5Smrg[Package requirements ($2) were not met:
13148e4923e5Smrg
13158e4923e5Smrg$$1_PKG_ERRORS
13168e4923e5Smrg
13178e4923e5SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13188e4923e5Smrginstalled software in a non-standard prefix.
13198e4923e5Smrg
13208e4923e5Smrg_PKG_TEXT
13218e4923e5Smrg])],
13228e4923e5Smrg		[AC_MSG_RESULT([no])
13238e4923e5Smrg                $4])
13248e4923e5Smrgelif test $pkg_failed = untried; then
13258e4923e5Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
13268e4923e5Smrg[The pkg-config script could not be found or is too old.  Make sure it
13278e4923e5Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
13288e4923e5Smrgpath to pkg-config.
13298e4923e5Smrg
13308e4923e5Smrg_PKG_TEXT
13318e4923e5Smrg
13328e4923e5SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
13338e4923e5Smrg		[$4])
13348e4923e5Smrgelse
13358e4923e5Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13368e4923e5Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13378e4923e5Smrg        AC_MSG_RESULT([yes])
13388e4923e5Smrg	ifelse([$3], , :, [$3])
13398e4923e5Smrgfi[]dnl
13408e4923e5Smrg])# PKG_CHECK_MODULES
13418e4923e5Smrg
13428e4923e5Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
13438e4923e5Smrgdnl
13448e4923e5Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
13458e4923e5Smrgdnl
13468e4923e5Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
13478e4923e5Smrgdnl copy of this software and associated documentation files (the "Software"),
13488e4923e5Smrgdnl to deal in the Software without restriction, including without limitation
13498e4923e5Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
13508e4923e5Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
13518e4923e5Smrgdnl Software is furnished to do so, subject to the following conditions:
13528e4923e5Smrgdnl
13538e4923e5Smrgdnl The above copyright notice and this permission notice (including the next
13548e4923e5Smrgdnl paragraph) shall be included in all copies or substantial portions of the
13558e4923e5Smrgdnl Software.
13568e4923e5Smrgdnl
13578e4923e5Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13588e4923e5Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13598e4923e5Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
13608e4923e5Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13618e4923e5Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13628e4923e5Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
13638e4923e5Smrgdnl DEALINGS IN THE SOFTWARE.
13648e4923e5Smrg
13658e4923e5Smrg# XORG_MACROS_VERSION(required-version)
13668e4923e5Smrg# -------------------------------------
13678e4923e5Smrg# Minimum version: 1.1.0
13688e4923e5Smrg#
13698e4923e5Smrg# If you're using a macro added in Version 1.1 or newer, include this in
13708e4923e5Smrg# your configure.ac with the minimum required version, such as:
13718e4923e5Smrg# XORG_MACROS_VERSION(1.1)
13728e4923e5Smrg#
13738e4923e5Smrg# To ensure that this macro is defined, also add:
13748e4923e5Smrg# m4_ifndef([XORG_MACROS_VERSION],
13758e4923e5Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
13768e4923e5Smrg#
13778e4923e5Smrg#
13788e4923e5Smrg# See the "minimum version" comment for each macro you use to see what
13798e4923e5Smrg# version you require.
13808e4923e5Smrgm4_defun([XORG_MACROS_VERSION],[
13818e4923e5Smrgm4_define([vers_have], [1.17.1])
13828e4923e5Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
13838e4923e5Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
13848e4923e5Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
13858e4923e5Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
13868e4923e5Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
13878e4923e5Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
13888e4923e5Smrgm4_undefine([vers_have])
13898e4923e5Smrgm4_undefine([maj_have])
13908e4923e5Smrgm4_undefine([maj_needed])
13918e4923e5Smrg]) # XORG_MACROS_VERSION
13928e4923e5Smrg
13938e4923e5Smrg# XORG_PROG_RAWCPP()
13948e4923e5Smrg# ------------------
13958e4923e5Smrg# Minimum version: 1.0.0
13968e4923e5Smrg#
13978e4923e5Smrg# Find cpp program and necessary flags for use in pre-processing text files
13988e4923e5Smrg# such as man pages and config files
13998e4923e5SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14008e4923e5SmrgAC_REQUIRE([AC_PROG_CPP])
14018e4923e5SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
14028e4923e5Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14038e4923e5Smrg
14048e4923e5Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14058e4923e5Smrg# which is not the best choice for supporting other OS'es, but covers most
14068e4923e5Smrg# of the ones we need for now.
14078e4923e5SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14088e4923e5SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14098e4923e5Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14108e4923e5Smrg	AC_MSG_RESULT([no])
14118e4923e5Smrgelse
14128e4923e5Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14138e4923e5Smrg		RAWCPPFLAGS=-undef
14148e4923e5Smrg		AC_MSG_RESULT([yes])
14158e4923e5Smrg	# under Cygwin unix is still defined even with -undef
14168e4923e5Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14178e4923e5Smrg		RAWCPPFLAGS="-undef -ansi"
14188e4923e5Smrg		AC_MSG_RESULT([yes, with -ansi])
14198e4923e5Smrg	else
14208e4923e5Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
14218e4923e5Smrg	fi
14228e4923e5Smrgfi
14238e4923e5Smrgrm -f conftest.$ac_ext
14248e4923e5Smrg
14258e4923e5SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
14268e4923e5SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
14278e4923e5Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
14288e4923e5Smrg	AC_MSG_RESULT([no])
14298e4923e5Smrgelse
14308e4923e5Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
14318e4923e5Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
14328e4923e5Smrg		AC_MSG_RESULT([yes])
14338e4923e5Smrg	else
14348e4923e5Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
14358e4923e5Smrg	fi
14368e4923e5Smrgfi
14378e4923e5Smrgrm -f conftest.$ac_ext
14388e4923e5SmrgAC_SUBST(RAWCPPFLAGS)
14398e4923e5Smrg]) # XORG_PROG_RAWCPP
14408e4923e5Smrg
14418e4923e5Smrg# XORG_MANPAGE_SECTIONS()
14428e4923e5Smrg# -----------------------
14438e4923e5Smrg# Minimum version: 1.0.0
14448e4923e5Smrg#
14458e4923e5Smrg# Determine which sections man pages go in for the different man page types
14468e4923e5Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
14478e4923e5Smrg# Not sure if there's any better way than just hardcoding by OS name.
14488e4923e5Smrg# Override default settings by setting environment variables
14498e4923e5Smrg# Added MAN_SUBSTS in version 1.8
14508e4923e5Smrg# Added AC_PROG_SED in version 1.8
14518e4923e5Smrg
14528e4923e5SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
14538e4923e5SmrgAC_REQUIRE([AC_CANONICAL_HOST])
14548e4923e5SmrgAC_REQUIRE([AC_PROG_SED])
14558e4923e5Smrg
14568e4923e5Smrgif test x$APP_MAN_SUFFIX = x    ; then
14578e4923e5Smrg    APP_MAN_SUFFIX=1
14588e4923e5Smrgfi
14598e4923e5Smrgif test x$APP_MAN_DIR = x    ; then
14608e4923e5Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
14618e4923e5Smrgfi
1462b8f75c19Smrg
1463b8f75c19Smrgif test x$LIB_MAN_SUFFIX = x    ; then
14647e4fd55aSmrg    LIB_MAN_SUFFIX=3
1465b8f75c19Smrgfi
1466b8f75c19Smrgif test x$LIB_MAN_DIR = x    ; then
14677e4fd55aSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1468b8f75c19Smrgfi
1469b8f75c19Smrg
1470b8f75c19Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1471b8f75c19Smrg    case $host_os in
1472b8f75c19Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1473b8f75c19Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1474b8f75c19Smrg    esac
1475b8f75c19Smrgfi
1476b8f75c19Smrgif test x$FILE_MAN_DIR = x    ; then
14777e4fd55aSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1478b8f75c19Smrgfi
1479b8f75c19Smrg
1480b8f75c19Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1481b8f75c19Smrg    case $host_os in
1482b8f75c19Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1483b8f75c19Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1484b8f75c19Smrg    esac
1485b8f75c19Smrgfi
1486b8f75c19Smrgif test x$MISC_MAN_DIR = x    ; then
14877e4fd55aSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1488b8f75c19Smrgfi
1489b8f75c19Smrg
1490b8f75c19Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1491b8f75c19Smrg    case $host_os in
1492b8f75c19Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1493b8f75c19Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1494b8f75c19Smrg    esac
1495b8f75c19Smrgfi
1496b8f75c19Smrgif test x$DRIVER_MAN_DIR = x    ; then
14977e4fd55aSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1498b8f75c19Smrgfi
1499b8f75c19Smrg
1500b8f75c19Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1501b8f75c19Smrg    case $host_os in
1502b8f75c19Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1503b8f75c19Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1504b8f75c19Smrg    esac
1505b8f75c19Smrgfi
1506b8f75c19Smrgif test x$ADMIN_MAN_DIR = x    ; then
1507b8f75c19Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1508b8f75c19Smrgfi
1509b8f75c19Smrg
1510b8f75c19Smrg
1511b8f75c19SmrgAC_SUBST([APP_MAN_SUFFIX])
1512b8f75c19SmrgAC_SUBST([LIB_MAN_SUFFIX])
1513b8f75c19SmrgAC_SUBST([FILE_MAN_SUFFIX])
1514b8f75c19SmrgAC_SUBST([MISC_MAN_SUFFIX])
1515b8f75c19SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1516b8f75c19SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1517b8f75c19SmrgAC_SUBST([APP_MAN_DIR])
1518b8f75c19SmrgAC_SUBST([LIB_MAN_DIR])
1519b8f75c19SmrgAC_SUBST([FILE_MAN_DIR])
1520b8f75c19SmrgAC_SUBST([MISC_MAN_DIR])
1521b8f75c19SmrgAC_SUBST([DRIVER_MAN_DIR])
1522b8f75c19SmrgAC_SUBST([ADMIN_MAN_DIR])
15237e4fd55aSmrg
15247e4fd55aSmrgXORG_MAN_PAGE="X Version 11"
15257e4fd55aSmrgAC_SUBST([XORG_MAN_PAGE])
15267e4fd55aSmrgMAN_SUBSTS="\
15277e4fd55aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
15287e4fd55aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
15297e4fd55aSmrg	-e 's|__xservername__|Xorg|g' \
15307e4fd55aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
15317e4fd55aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
15327e4fd55aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
15337e4fd55aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
15347e4fd55aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
15357e4fd55aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
15367e4fd55aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
15377e4fd55aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
15387e4fd55aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
15397e4fd55aSmrgAC_SUBST([MAN_SUBSTS])
15407e4fd55aSmrg
1541b8f75c19Smrg]) # XORG_MANPAGE_SECTIONS
1542b8f75c19Smrg
15437e4fd55aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
15447e4fd55aSmrg# ------------------------
15457e4fd55aSmrg# Minimum version: 1.7.0
15467e4fd55aSmrg#
15477e4fd55aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
15487e4fd55aSmrg# provided by xorg-sgml-doctools, if installed.
15497e4fd55aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
15507e4fd55aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
15517e4fd55aSmrgXORG_SGML_PATH=
15527e4fd55aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
15537e4fd55aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
15547e4fd55aSmrg    [m4_ifval([$1],[:],
15557e4fd55aSmrg        [if test x"$cross_compiling" != x"yes" ; then
15567e4fd55aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
15577e4fd55aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
15587e4fd55aSmrg         fi])
15597e4fd55aSmrg    ])
15607e4fd55aSmrg
15617e4fd55aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
15627e4fd55aSmrg# the path and the name of the doc stylesheet
15637e4fd55aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
15647e4fd55aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
15657e4fd55aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
15667e4fd55aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
15677e4fd55aSmrgelse
15687e4fd55aSmrg   AC_MSG_RESULT([no])
15697e4fd55aSmrgfi
15707e4fd55aSmrg
15717e4fd55aSmrgAC_SUBST(XORG_SGML_PATH)
15727e4fd55aSmrgAC_SUBST(STYLESHEET_SRCDIR)
15737e4fd55aSmrgAC_SUBST(XSL_STYLESHEET)
15747e4fd55aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
15757e4fd55aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
15767e4fd55aSmrg
1577b8f75c19Smrg# XORG_CHECK_LINUXDOC
1578b8f75c19Smrg# -------------------
15797e4fd55aSmrg# Minimum version: 1.0.0
15807e4fd55aSmrg#
1581b8f75c19Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1582b8f75c19Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1583b8f75c19Smrg# Whether or not the necessary tools and files are found can be checked
1584b8f75c19Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1585b8f75c19SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
15867e4fd55aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
15877e4fd55aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1588b8f75c19Smrg
1589b8f75c19SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1590b8f75c19Smrg
15917e4fd55aSmrgAC_MSG_CHECKING([whether to build documentation])
1592b8f75c19Smrg
15937e4fd55aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1594b8f75c19Smrg   BUILDDOC=yes
1595b8f75c19Smrgelse
15967e4fd55aSmrg   BUILDDOC=no
15977e4fd55aSmrgfi
15987e4fd55aSmrg
15997e4fd55aSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16007e4fd55aSmrg
16017e4fd55aSmrgAC_MSG_RESULT([$BUILDDOC])
16027e4fd55aSmrg
16037e4fd55aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
16047e4fd55aSmrg
16057e4fd55aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
16067e4fd55aSmrg   BUILDPDFDOC=yes
16077e4fd55aSmrgelse
16087e4fd55aSmrg   BUILDPDFDOC=no
16097e4fd55aSmrgfi
16107e4fd55aSmrg
16117e4fd55aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16127e4fd55aSmrg
16137e4fd55aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
16147e4fd55aSmrg
16157e4fd55aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
16167e4fd55aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
16177e4fd55aSmrgMAKE_PDF="$PS2PDF"
16187e4fd55aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
16197e4fd55aSmrg
16207e4fd55aSmrgAC_SUBST(MAKE_TEXT)
16217e4fd55aSmrgAC_SUBST(MAKE_PS)
16227e4fd55aSmrgAC_SUBST(MAKE_PDF)
16237e4fd55aSmrgAC_SUBST(MAKE_HTML)
16247e4fd55aSmrg]) # XORG_CHECK_LINUXDOC
16257e4fd55aSmrg
16267e4fd55aSmrg# XORG_CHECK_DOCBOOK
16277e4fd55aSmrg# -------------------
16287e4fd55aSmrg# Minimum version: 1.0.0
16297e4fd55aSmrg#
16307e4fd55aSmrg# Checks for the ability to build output formats from SGML DocBook source.
16317e4fd55aSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16327e4fd55aSmrg# indicates whether the necessary tools and files are found and, if set,
16337e4fd55aSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16347e4fd55aSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
16357e4fd55aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16367e4fd55aSmrg
16377e4fd55aSmrgBUILDTXTDOC=no
16387e4fd55aSmrgBUILDPDFDOC=no
16397e4fd55aSmrgBUILDPSDOC=no
16407e4fd55aSmrgBUILDHTMLDOC=no
16417e4fd55aSmrg
16427e4fd55aSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16437e4fd55aSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16447e4fd55aSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16457e4fd55aSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
16467e4fd55aSmrg
16477e4fd55aSmrgAC_MSG_CHECKING([whether to build text documentation])
16487e4fd55aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16497e4fd55aSmrg   test x$BUILD_TXTDOC != xno; then
16507e4fd55aSmrg	BUILDTXTDOC=yes
16517e4fd55aSmrgfi
16527e4fd55aSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16537e4fd55aSmrgAC_MSG_RESULT([$BUILDTXTDOC])
16547e4fd55aSmrg
16557e4fd55aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
16567e4fd55aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16577e4fd55aSmrg   test x$BUILD_PDFDOC != xno; then
16587e4fd55aSmrg	BUILDPDFDOC=yes
16597e4fd55aSmrgfi
16607e4fd55aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16617e4fd55aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
16627e4fd55aSmrg
16637e4fd55aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
16647e4fd55aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
16657e4fd55aSmrg   test x$BUILD_PSDOC != xno; then
16667e4fd55aSmrg	BUILDPSDOC=yes
16677e4fd55aSmrgfi
16687e4fd55aSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
16697e4fd55aSmrgAC_MSG_RESULT([$BUILDPSDOC])
16707e4fd55aSmrg
16717e4fd55aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
16727e4fd55aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
16737e4fd55aSmrg   test x$BUILD_HTMLDOC != xno; then
16747e4fd55aSmrg	BUILDHTMLDOC=yes
16757e4fd55aSmrgfi
16767e4fd55aSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
16777e4fd55aSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
16787e4fd55aSmrg
16797e4fd55aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
16807e4fd55aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
16817e4fd55aSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
16827e4fd55aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
16837e4fd55aSmrg
16847e4fd55aSmrgAC_SUBST(MAKE_TEXT)
16857e4fd55aSmrgAC_SUBST(MAKE_PS)
16867e4fd55aSmrgAC_SUBST(MAKE_PDF)
16877e4fd55aSmrgAC_SUBST(MAKE_HTML)
16887e4fd55aSmrg]) # XORG_CHECK_DOCBOOK
16897e4fd55aSmrg
16907e4fd55aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
16917e4fd55aSmrg# ----------------
16927e4fd55aSmrg# Minimum version: 1.5.0
16937e4fd55aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
16947e4fd55aSmrg#
16957e4fd55aSmrg# Documentation tools are not always available on all platforms and sometimes
16967e4fd55aSmrg# not at the appropriate level. This macro enables a module to test for the
16977e4fd55aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
16987e4fd55aSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
16997e4fd55aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17007e4fd55aSmrg# --with-xmlto assumes 'auto'.
17017e4fd55aSmrg#
17027e4fd55aSmrg# Interface to module:
17037e4fd55aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
17047e4fd55aSmrg# XMLTO:	returns the path of the xmlto program found
17057e4fd55aSmrg#		returns the path set by the user in the environment
17067e4fd55aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
17077e4fd55aSmrg#		'no' user instructs the module not to use xmlto
17087e4fd55aSmrg#
17097e4fd55aSmrg# Added in version 1.10.0
17107e4fd55aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
17117e4fd55aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
17127e4fd55aSmrg#
17137e4fd55aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
17147e4fd55aSmrg#
17157e4fd55aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
17167e4fd55aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
17177e4fd55aSmrgm4_define([_defopt], m4_default([$2], [auto]))
17187e4fd55aSmrgAC_ARG_WITH(xmlto,
17197e4fd55aSmrg	AS_HELP_STRING([--with-xmlto],
17207e4fd55aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
17217e4fd55aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
17227e4fd55aSmrgm4_undefine([_defopt])
17237e4fd55aSmrg
17247e4fd55aSmrgif test "x$use_xmlto" = x"auto"; then
17257e4fd55aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
17267e4fd55aSmrg   if test "x$XMLTO" = "x"; then
17277e4fd55aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
17287e4fd55aSmrg	have_xmlto=no
17297e4fd55aSmrg   else
17307e4fd55aSmrg        have_xmlto=yes
17317e4fd55aSmrg   fi
17327e4fd55aSmrgelif test "x$use_xmlto" = x"yes" ; then
17337e4fd55aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
17347e4fd55aSmrg   if test "x$XMLTO" = "x"; then
17357e4fd55aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
17367e4fd55aSmrg   fi
17377e4fd55aSmrg   have_xmlto=yes
17387e4fd55aSmrgelif test "x$use_xmlto" = x"no" ; then
17397e4fd55aSmrg   if test "x$XMLTO" != "x"; then
17407e4fd55aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
17417e4fd55aSmrg   fi
17427e4fd55aSmrg   have_xmlto=no
17437e4fd55aSmrgelse
17447e4fd55aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
17457e4fd55aSmrgfi
17467e4fd55aSmrg
17477e4fd55aSmrg# Test for a minimum version of xmlto, if provided.
17487e4fd55aSmrgm4_ifval([$1],
17497e4fd55aSmrg[if test "$have_xmlto" = yes; then
17507e4fd55aSmrg    # scrape the xmlto version
17517e4fd55aSmrg    AC_MSG_CHECKING([the xmlto version])
17527e4fd55aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
17537e4fd55aSmrg    AC_MSG_RESULT([$xmlto_version])
17547e4fd55aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
17557e4fd55aSmrg        [if test "x$use_xmlto" = xauto; then
17567e4fd55aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
17577e4fd55aSmrg            have_xmlto=no
17587e4fd55aSmrg        else
17597e4fd55aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
17607e4fd55aSmrg        fi])
17617e4fd55aSmrgfi])
17627e4fd55aSmrg
17637e4fd55aSmrg# Test for the ability of xmlto to generate a text target
17647e4fd55aSmrghave_xmlto_text=no
17657e4fd55aSmrgcat > conftest.xml << "EOF"
17667e4fd55aSmrgEOF
17677e4fd55aSmrgAS_IF([test "$have_xmlto" = yes],
17687e4fd55aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
17697e4fd55aSmrg             [have_xmlto_text=yes],
17707e4fd55aSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
17717e4fd55aSmrgrm -f conftest.xml
17727e4fd55aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
17737e4fd55aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
17747e4fd55aSmrg]) # XORG_WITH_XMLTO
17757e4fd55aSmrg
17768e4923e5Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
17778e4923e5Smrg# --------------------------------------------
17788e4923e5Smrg# Minimum version: 1.12.0
17798e4923e5Smrg# Minimum version for optional DEFAULT argument: 1.12.0
17808e4923e5Smrg#
17818e4923e5Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
17828e4923e5Smrg# XML-based language used for the transformation of XML documents.
17838e4923e5Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
17848e4923e5Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
17858e4923e5Smrg# The XSLT processor is often used as a standalone tool for transformations.
17868e4923e5Smrg# It should not be assumed that this tool is used only to work with documnetation.
17878e4923e5Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
17888e4923e5Smrg#
17898e4923e5Smrg# Interface to module:
17908e4923e5Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
17918e4923e5Smrg# XSLTPROC:	 returns the path of the xsltproc program found
17928e4923e5Smrg#		 returns the path set by the user in the environment
17938e4923e5Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
17948e4923e5Smrg#		  'no' user instructs the module not to use xsltproc
17958e4923e5Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
17968e4923e5Smrg#
17978e4923e5Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
17988e4923e5Smrg#
17998e4923e5SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
18008e4923e5SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
18018e4923e5Smrg# Preserves the interface, should it be implemented later
18028e4923e5Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
18038e4923e5Smrgm4_define([_defopt], m4_default([$2], [auto]))
18048e4923e5SmrgAC_ARG_WITH(xsltproc,
18058e4923e5Smrg	AS_HELP_STRING([--with-xsltproc],
18068e4923e5Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
18078e4923e5Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
18088e4923e5Smrgm4_undefine([_defopt])
18098e4923e5Smrg
18108e4923e5Smrgif test "x$use_xsltproc" = x"auto"; then
18118e4923e5Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
18128e4923e5Smrg   if test "x$XSLTPROC" = "x"; then
18138e4923e5Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
18148e4923e5Smrg	have_xsltproc=no
18158e4923e5Smrg   else
18168e4923e5Smrg        have_xsltproc=yes
18178e4923e5Smrg   fi
18188e4923e5Smrgelif test "x$use_xsltproc" = x"yes" ; then
18198e4923e5Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
18208e4923e5Smrg   if test "x$XSLTPROC" = "x"; then
18218e4923e5Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
18228e4923e5Smrg   fi
18238e4923e5Smrg   have_xsltproc=yes
18248e4923e5Smrgelif test "x$use_xsltproc" = x"no" ; then
18258e4923e5Smrg   if test "x$XSLTPROC" != "x"; then
18268e4923e5Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
18278e4923e5Smrg   fi
18288e4923e5Smrg   have_xsltproc=no
18298e4923e5Smrgelse
18308e4923e5Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
18318e4923e5Smrgfi
18328e4923e5Smrg
18338e4923e5SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
18348e4923e5Smrg]) # XORG_WITH_XSLTPROC
18358e4923e5Smrg
18368e4923e5Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
18378e4923e5Smrg# ----------------------------------------
18388e4923e5Smrg# Minimum version: 1.15.0
18398e4923e5Smrg#
18408e4923e5Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
18418e4923e5Smrg# scanning arbitrary text files, extracting information from those text files,
18428e4923e5Smrg# and printing reports based on that information.
18438e4923e5Smrg#
18448e4923e5Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
18458e4923e5Smrg#
18468e4923e5Smrg# Interface to module:
18478e4923e5Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
18488e4923e5Smrg# PERL:	     returns the path of the perl program found
18498e4923e5Smrg#	     returns the path set by the user in the environment
18508e4923e5Smrg# --with-perl: 'yes' user instructs the module to use perl
18518e4923e5Smrg#	       'no' user instructs the module not to use perl
18528e4923e5Smrg# have_perl: returns yes if perl found in PATH or no
18538e4923e5Smrg#
18548e4923e5Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
18558e4923e5Smrg#
18568e4923e5SmrgAC_DEFUN([XORG_WITH_PERL],[
18578e4923e5SmrgAC_ARG_VAR([PERL], [Path to perl command])
18588e4923e5Smrg# Preserves the interface, should it be implemented later
18598e4923e5Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
18608e4923e5Smrgm4_define([_defopt], m4_default([$2], [auto]))
18618e4923e5SmrgAC_ARG_WITH(perl,
18628e4923e5Smrg	AS_HELP_STRING([--with-perl],
18638e4923e5Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
18648e4923e5Smrg	   [use_perl=$withval], [use_perl=]_defopt)
18658e4923e5Smrgm4_undefine([_defopt])
18668e4923e5Smrg
18678e4923e5Smrgif test "x$use_perl" = x"auto"; then
18688e4923e5Smrg   AC_PATH_PROG([PERL], [perl])
18698e4923e5Smrg   if test "x$PERL" = "x"; then
18708e4923e5Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
18718e4923e5Smrg	have_perl=no
18728e4923e5Smrg   else
18738e4923e5Smrg        have_perl=yes
18748e4923e5Smrg   fi
18758e4923e5Smrgelif test "x$use_perl" = x"yes" ; then
18768e4923e5Smrg   AC_PATH_PROG([PERL], [perl])
18778e4923e5Smrg   if test "x$PERL" = "x"; then
18788e4923e5Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
18798e4923e5Smrg   fi
18808e4923e5Smrg   have_perl=yes
18818e4923e5Smrgelif test "x$use_perl" = x"no" ; then
18828e4923e5Smrg   if test "x$PERL" != "x"; then
18838e4923e5Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
18848e4923e5Smrg   fi
18858e4923e5Smrg   have_perl=no
18868e4923e5Smrgelse
18878e4923e5Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
18888e4923e5Smrgfi
18898e4923e5Smrg
18908e4923e5SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
18918e4923e5Smrg]) # XORG_WITH_PERL
18928e4923e5Smrg
18937e4fd55aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
18947e4fd55aSmrg# ----------------
18957e4fd55aSmrg# Minimum version: 1.5.0
18967e4fd55aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
18977e4fd55aSmrg#
18987e4fd55aSmrg# Documentation tools are not always available on all platforms and sometimes
18997e4fd55aSmrg# not at the appropriate level. This macro enables a module to test for the
19007e4fd55aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
19017e4fd55aSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
19027e4fd55aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
19037e4fd55aSmrg# --with-asciidoc assumes 'auto'.
19047e4fd55aSmrg#
19057e4fd55aSmrg# Interface to module:
19067e4fd55aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
19077e4fd55aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
19087e4fd55aSmrg#		 returns the path set by the user in the environment
19097e4fd55aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
19107e4fd55aSmrg#		  'no' user instructs the module not to use asciidoc
19117e4fd55aSmrg#
19127e4fd55aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
19137e4fd55aSmrg#
19147e4fd55aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
19157e4fd55aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
19167e4fd55aSmrgm4_define([_defopt], m4_default([$2], [auto]))
19177e4fd55aSmrgAC_ARG_WITH(asciidoc,
19187e4fd55aSmrg	AS_HELP_STRING([--with-asciidoc],
19197e4fd55aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
19207e4fd55aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
19217e4fd55aSmrgm4_undefine([_defopt])
19227e4fd55aSmrg
19237e4fd55aSmrgif test "x$use_asciidoc" = x"auto"; then
19247e4fd55aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
19257e4fd55aSmrg   if test "x$ASCIIDOC" = "x"; then
19267e4fd55aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
19277e4fd55aSmrg	have_asciidoc=no
19287e4fd55aSmrg   else
19297e4fd55aSmrg        have_asciidoc=yes
19307e4fd55aSmrg   fi
19317e4fd55aSmrgelif test "x$use_asciidoc" = x"yes" ; then
19327e4fd55aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
19337e4fd55aSmrg   if test "x$ASCIIDOC" = "x"; then
19347e4fd55aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
19357e4fd55aSmrg   fi
19367e4fd55aSmrg   have_asciidoc=yes
19377e4fd55aSmrgelif test "x$use_asciidoc" = x"no" ; then
19387e4fd55aSmrg   if test "x$ASCIIDOC" != "x"; then
19397e4fd55aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
19407e4fd55aSmrg   fi
19417e4fd55aSmrg   have_asciidoc=no
19427e4fd55aSmrgelse
19437e4fd55aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
19447e4fd55aSmrgfi
19457e4fd55aSmrgm4_ifval([$1],
19467e4fd55aSmrg[if test "$have_asciidoc" = yes; then
19477e4fd55aSmrg    # scrape the asciidoc version
19487e4fd55aSmrg    AC_MSG_CHECKING([the asciidoc version])
19497e4fd55aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
19507e4fd55aSmrg    AC_MSG_RESULT([$asciidoc_version])
19517e4fd55aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
19527e4fd55aSmrg        [if test "x$use_asciidoc" = xauto; then
19537e4fd55aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
19547e4fd55aSmrg            have_asciidoc=no
19557e4fd55aSmrg        else
19567e4fd55aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
19577e4fd55aSmrg        fi])
19587e4fd55aSmrgfi])
19597e4fd55aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
19607e4fd55aSmrg]) # XORG_WITH_ASCIIDOC
19617e4fd55aSmrg
19627e4fd55aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
19637e4fd55aSmrg# --------------------------------
19647e4fd55aSmrg# Minimum version: 1.5.0
19657e4fd55aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
19667e4fd55aSmrg#
19677e4fd55aSmrg# Documentation tools are not always available on all platforms and sometimes
19687e4fd55aSmrg# not at the appropriate level. This macro enables a module to test for the
19697e4fd55aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
19707e4fd55aSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
19717e4fd55aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
19727e4fd55aSmrg# --with-doxygen assumes 'auto'.
19737e4fd55aSmrg#
19747e4fd55aSmrg# Interface to module:
19757e4fd55aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
19767e4fd55aSmrg# DOXYGEN:	 returns the path of the doxygen program found
19777e4fd55aSmrg#		 returns the path set by the user in the environment
19787e4fd55aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
19797e4fd55aSmrg#		  'no' user instructs the module not to use doxygen
19807e4fd55aSmrg#
19817e4fd55aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
19827e4fd55aSmrg#
19837e4fd55aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
19847e4fd55aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
19857e4fd55aSmrgm4_define([_defopt], m4_default([$2], [auto]))
19867e4fd55aSmrgAC_ARG_WITH(doxygen,
19877e4fd55aSmrg	AS_HELP_STRING([--with-doxygen],
19887e4fd55aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
19897e4fd55aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
19907e4fd55aSmrgm4_undefine([_defopt])
19917e4fd55aSmrg
19927e4fd55aSmrgif test "x$use_doxygen" = x"auto"; then
19937e4fd55aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
19947e4fd55aSmrg   if test "x$DOXYGEN" = "x"; then
19957e4fd55aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
19967e4fd55aSmrg	have_doxygen=no
19977e4fd55aSmrg   else
19987e4fd55aSmrg        have_doxygen=yes
19997e4fd55aSmrg   fi
20007e4fd55aSmrgelif test "x$use_doxygen" = x"yes" ; then
20017e4fd55aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
20027e4fd55aSmrg   if test "x$DOXYGEN" = "x"; then
20037e4fd55aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
20047e4fd55aSmrg   fi
20057e4fd55aSmrg   have_doxygen=yes
20067e4fd55aSmrgelif test "x$use_doxygen" = x"no" ; then
20077e4fd55aSmrg   if test "x$DOXYGEN" != "x"; then
20087e4fd55aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
20097e4fd55aSmrg   fi
20107e4fd55aSmrg   have_doxygen=no
20117e4fd55aSmrgelse
20127e4fd55aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2013b8f75c19Smrgfi
20147e4fd55aSmrgm4_ifval([$1],
20157e4fd55aSmrg[if test "$have_doxygen" = yes; then
20167e4fd55aSmrg    # scrape the doxygen version
20177e4fd55aSmrg    AC_MSG_CHECKING([the doxygen version])
20187e4fd55aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
20197e4fd55aSmrg    AC_MSG_RESULT([$doxygen_version])
20207e4fd55aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
20217e4fd55aSmrg        [if test "x$use_doxygen" = xauto; then
20227e4fd55aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
20237e4fd55aSmrg            have_doxygen=no
20247e4fd55aSmrg        else
20257e4fd55aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
20267e4fd55aSmrg        fi])
20277e4fd55aSmrgfi])
20287e4fd55aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
20297e4fd55aSmrg]) # XORG_WITH_DOXYGEN
2030b8f75c19Smrg
20317e4fd55aSmrg# XORG_WITH_GROFF([DEFAULT])
20327e4fd55aSmrg# ----------------
20337e4fd55aSmrg# Minimum version: 1.6.0
20347e4fd55aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20357e4fd55aSmrg#
20367e4fd55aSmrg# Documentation tools are not always available on all platforms and sometimes
20377e4fd55aSmrg# not at the appropriate level. This macro enables a module to test for the
20387e4fd55aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20397e4fd55aSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
20407e4fd55aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
20417e4fd55aSmrg# --with-groff assumes 'auto'.
20427e4fd55aSmrg#
20437e4fd55aSmrg# Interface to module:
20447e4fd55aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
20457e4fd55aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
20467e4fd55aSmrg# HAVE_GROFF_MS: the -ms macros package
20477e4fd55aSmrg# GROFF:	 returns the path of the groff program found
20487e4fd55aSmrg#		 returns the path set by the user in the environment
20497e4fd55aSmrg# --with-groff:	 'yes' user instructs the module to use groff
20507e4fd55aSmrg#		 'no' user instructs the module not to use groff
20517e4fd55aSmrg#
20527e4fd55aSmrg# Added in version 1.9.0:
20537e4fd55aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
20547e4fd55aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
20557e4fd55aSmrg#		   psselect from the psutils package.
20567e4fd55aSmrg#		   the ghostcript package. Refer to the grohtml man pages
20577e4fd55aSmrg#
20587e4fd55aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
20597e4fd55aSmrg#
20607e4fd55aSmrg# OS and distros often splits groff in a basic and full package, the former
20617e4fd55aSmrg# having the groff program and the later having devices, fonts and macros
20627e4fd55aSmrg# Checking for the groff executable is not enough.
20637e4fd55aSmrg#
20647e4fd55aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
20657e4fd55aSmrg# unset HAVE_GROFF or GROFF env variables.
20667e4fd55aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
20677e4fd55aSmrg#
20687e4fd55aSmrgAC_DEFUN([XORG_WITH_GROFF],[
20697e4fd55aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
20707e4fd55aSmrgm4_define([_defopt], m4_default([$1], [auto]))
20717e4fd55aSmrgAC_ARG_WITH(groff,
20727e4fd55aSmrg	AS_HELP_STRING([--with-groff],
20737e4fd55aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
20747e4fd55aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
20757e4fd55aSmrgm4_undefine([_defopt])
20767e4fd55aSmrg
20777e4fd55aSmrgif test "x$use_groff" = x"auto"; then
20787e4fd55aSmrg   AC_PATH_PROG([GROFF], [groff])
20797e4fd55aSmrg   if test "x$GROFF" = "x"; then
20807e4fd55aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
20817e4fd55aSmrg	have_groff=no
20827e4fd55aSmrg   else
20837e4fd55aSmrg        have_groff=yes
20847e4fd55aSmrg   fi
20857e4fd55aSmrgelif test "x$use_groff" = x"yes" ; then
20867e4fd55aSmrg   AC_PATH_PROG([GROFF], [groff])
20877e4fd55aSmrg   if test "x$GROFF" = "x"; then
20887e4fd55aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
20897e4fd55aSmrg   fi
20907e4fd55aSmrg   have_groff=yes
20917e4fd55aSmrgelif test "x$use_groff" = x"no" ; then
20927e4fd55aSmrg   if test "x$GROFF" != "x"; then
20937e4fd55aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
20947e4fd55aSmrg   fi
20957e4fd55aSmrg   have_groff=no
20967e4fd55aSmrgelse
20977e4fd55aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
20987e4fd55aSmrgfi
2099b8f75c19Smrg
21007e4fd55aSmrg# We have groff, test for the presence of the macro packages
21017e4fd55aSmrgif test "x$have_groff" = x"yes"; then
21027e4fd55aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
21037e4fd55aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
21047e4fd55aSmrg        groff_ms_works=yes
21057e4fd55aSmrg    else
21067e4fd55aSmrg        groff_ms_works=no
21077e4fd55aSmrg    fi
21087e4fd55aSmrg    AC_MSG_RESULT([$groff_ms_works])
21097e4fd55aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
21107e4fd55aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
21117e4fd55aSmrg        groff_mm_works=yes
21127e4fd55aSmrg    else
21137e4fd55aSmrg        groff_mm_works=no
21147e4fd55aSmrg    fi
21157e4fd55aSmrg    AC_MSG_RESULT([$groff_mm_works])
21167e4fd55aSmrgfi
2117b8f75c19Smrg
21187e4fd55aSmrg# We have groff, test for HTML dependencies, one command per package
21197e4fd55aSmrgif test "x$have_groff" = x"yes"; then
21207e4fd55aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
21217e4fd55aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
21227e4fd55aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
21237e4fd55aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
21247e4fd55aSmrg      have_groff_html=yes
21257e4fd55aSmrg   else
21267e4fd55aSmrg      have_groff_html=no
21277e4fd55aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
21287e4fd55aSmrg   fi
21297e4fd55aSmrgfi
2130b8f75c19Smrg
21317e4fd55aSmrg# Set Automake conditionals for Makefiles
21327e4fd55aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
21337e4fd55aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
21347e4fd55aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
21357e4fd55aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
21367e4fd55aSmrg]) # XORG_WITH_GROFF
21377e4fd55aSmrg
21388e4923e5Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
21398e4923e5Smrg# ---------------------------------------
21407e4fd55aSmrg# Minimum version: 1.6.0
21417e4fd55aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
21428e4923e5Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
21437e4fd55aSmrg#
21447e4fd55aSmrg# Documentation tools are not always available on all platforms and sometimes
21457e4fd55aSmrg# not at the appropriate level. This macro enables a module to test for the
21467e4fd55aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
21477e4fd55aSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
21487e4fd55aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
21497e4fd55aSmrg# --with-fop assumes 'auto'.
21507e4fd55aSmrg#
21517e4fd55aSmrg# Interface to module:
21527e4fd55aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
21537e4fd55aSmrg# FOP:	 	returns the path of the fop program found
21547e4fd55aSmrg#		returns the path set by the user in the environment
21557e4fd55aSmrg# --with-fop: 	'yes' user instructs the module to use fop
21567e4fd55aSmrg#		'no' user instructs the module not to use fop
21577e4fd55aSmrg#
21587e4fd55aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
21597e4fd55aSmrg#
21607e4fd55aSmrgAC_DEFUN([XORG_WITH_FOP],[
21617e4fd55aSmrgAC_ARG_VAR([FOP], [Path to fop command])
21628e4923e5Smrgm4_define([_defopt], m4_default([$2], [auto]))
21637e4fd55aSmrgAC_ARG_WITH(fop,
21647e4fd55aSmrg	AS_HELP_STRING([--with-fop],
21657e4fd55aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
21667e4fd55aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
21677e4fd55aSmrgm4_undefine([_defopt])
21687e4fd55aSmrg
21697e4fd55aSmrgif test "x$use_fop" = x"auto"; then
21707e4fd55aSmrg   AC_PATH_PROG([FOP], [fop])
21717e4fd55aSmrg   if test "x$FOP" = "x"; then
21727e4fd55aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
21737e4fd55aSmrg	have_fop=no
21747e4fd55aSmrg   else
21757e4fd55aSmrg        have_fop=yes
21767e4fd55aSmrg   fi
21777e4fd55aSmrgelif test "x$use_fop" = x"yes" ; then
21787e4fd55aSmrg   AC_PATH_PROG([FOP], [fop])
21797e4fd55aSmrg   if test "x$FOP" = "x"; then
21807e4fd55aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
21817e4fd55aSmrg   fi
21827e4fd55aSmrg   have_fop=yes
21837e4fd55aSmrgelif test "x$use_fop" = x"no" ; then
21847e4fd55aSmrg   if test "x$FOP" != "x"; then
21857e4fd55aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
21867e4fd55aSmrg   fi
21877e4fd55aSmrg   have_fop=no
2188b8f75c19Smrgelse
21897e4fd55aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2190b8f75c19Smrgfi
21918e4923e5Smrg
21928e4923e5Smrg# Test for a minimum version of fop, if provided.
21938e4923e5Smrgm4_ifval([$1],
21948e4923e5Smrg[if test "$have_fop" = yes; then
21958e4923e5Smrg    # scrape the fop version
21968e4923e5Smrg    AC_MSG_CHECKING([for fop minimum version])
21978e4923e5Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
21988e4923e5Smrg    AC_MSG_RESULT([$fop_version])
21998e4923e5Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
22008e4923e5Smrg        [if test "x$use_fop" = xauto; then
22018e4923e5Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
22028e4923e5Smrg            have_fop=no
22038e4923e5Smrg        else
22048e4923e5Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
22058e4923e5Smrg        fi])
22068e4923e5Smrgfi])
22077e4fd55aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
22087e4fd55aSmrg]) # XORG_WITH_FOP
2209b8f75c19Smrg
22107e4fd55aSmrg# XORG_WITH_PS2PDF([DEFAULT])
22117e4fd55aSmrg# ----------------
22127e4fd55aSmrg# Minimum version: 1.6.0
22137e4fd55aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
22147e4fd55aSmrg#
22157e4fd55aSmrg# Documentation tools are not always available on all platforms and sometimes
22167e4fd55aSmrg# not at the appropriate level. This macro enables a module to test for the
22177e4fd55aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
22187e4fd55aSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
22197e4fd55aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
22207e4fd55aSmrg# --with-ps2pdf assumes 'auto'.
22217e4fd55aSmrg#
22227e4fd55aSmrg# Interface to module:
22237e4fd55aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
22247e4fd55aSmrg# PS2PDF:	returns the path of the ps2pdf program found
22257e4fd55aSmrg#		returns the path set by the user in the environment
22267e4fd55aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
22277e4fd55aSmrg#		 'no' user instructs the module not to use ps2pdf
22287e4fd55aSmrg#
22297e4fd55aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
22307e4fd55aSmrg#
22317e4fd55aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
22327e4fd55aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
22337e4fd55aSmrgm4_define([_defopt], m4_default([$1], [auto]))
22347e4fd55aSmrgAC_ARG_WITH(ps2pdf,
22357e4fd55aSmrg	AS_HELP_STRING([--with-ps2pdf],
22367e4fd55aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
22377e4fd55aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
22387e4fd55aSmrgm4_undefine([_defopt])
22397e4fd55aSmrg
22407e4fd55aSmrgif test "x$use_ps2pdf" = x"auto"; then
22417e4fd55aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
22427e4fd55aSmrg   if test "x$PS2PDF" = "x"; then
22437e4fd55aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
22447e4fd55aSmrg	have_ps2pdf=no
22457e4fd55aSmrg   else
22467e4fd55aSmrg        have_ps2pdf=yes
22477e4fd55aSmrg   fi
22487e4fd55aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
22497e4fd55aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
22507e4fd55aSmrg   if test "x$PS2PDF" = "x"; then
22517e4fd55aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
22527e4fd55aSmrg   fi
22537e4fd55aSmrg   have_ps2pdf=yes
22547e4fd55aSmrgelif test "x$use_ps2pdf" = x"no" ; then
22557e4fd55aSmrg   if test "x$PS2PDF" != "x"; then
22567e4fd55aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
22577e4fd55aSmrg   fi
22587e4fd55aSmrg   have_ps2pdf=no
22597e4fd55aSmrgelse
22607e4fd55aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
22617e4fd55aSmrgfi
22627e4fd55aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
22637e4fd55aSmrg]) # XORG_WITH_PS2PDF
2264b8f75c19Smrg
22657e4fd55aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
22667e4fd55aSmrg# ----------------
22677e4fd55aSmrg# Minimum version: 1.6.0
22687e4fd55aSmrg#
22697e4fd55aSmrg# Documentation tools are not always available on all platforms and sometimes
22707e4fd55aSmrg# not at the appropriate level. This macro enables a builder to skip all
22717e4fd55aSmrg# documentation targets except traditional man pages.
22727e4fd55aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
22737e4fd55aSmrg# maximum flexibilty in controlling documentation building.
22747e4fd55aSmrg# Refer to:
22757e4fd55aSmrg# XORG_WITH_XMLTO         --with-xmlto
22767e4fd55aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
22777e4fd55aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
22787e4fd55aSmrg# XORG_WITH_FOP           --with-fop
22797e4fd55aSmrg# XORG_WITH_GROFF         --with-groff
22807e4fd55aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
22817e4fd55aSmrg#
22827e4fd55aSmrg# Interface to module:
22837e4fd55aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
22847e4fd55aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
22857e4fd55aSmrg#		 'no' user instructs the module not to generate docs
22867e4fd55aSmrg# parm1:	specify the default value, yes or no.
22877e4fd55aSmrg#
22887e4fd55aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
22897e4fd55aSmrgm4_define([docs_default], m4_default([$1], [yes]))
22907e4fd55aSmrgAC_ARG_ENABLE(docs,
22917e4fd55aSmrg	AS_HELP_STRING([--enable-docs],
22927e4fd55aSmrg	   [Enable building the documentation (default: ]docs_default[)]),
22937e4fd55aSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
22947e4fd55aSmrgm4_undefine([docs_default])
22957e4fd55aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
22967e4fd55aSmrgAC_MSG_CHECKING([whether to build documentation])
22977e4fd55aSmrgAC_MSG_RESULT([$build_docs])
22987e4fd55aSmrg]) # XORG_ENABLE_DOCS
22997e4fd55aSmrg
23007e4fd55aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
23017e4fd55aSmrg# ----------------
23027e4fd55aSmrg# Minimum version: 1.6.0
23037e4fd55aSmrg#
23047e4fd55aSmrg# This macro enables a builder to skip all developer documentation.
23057e4fd55aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23067e4fd55aSmrg# maximum flexibilty in controlling documentation building.
23077e4fd55aSmrg# Refer to:
23087e4fd55aSmrg# XORG_WITH_XMLTO         --with-xmlto
23097e4fd55aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23107e4fd55aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
23117e4fd55aSmrg# XORG_WITH_FOP           --with-fop
23127e4fd55aSmrg# XORG_WITH_GROFF         --with-groff
23137e4fd55aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
23147e4fd55aSmrg#
23157e4fd55aSmrg# Interface to module:
23167e4fd55aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
23177e4fd55aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
23187e4fd55aSmrg#			'no' user instructs the module not to generate developer docs
23197e4fd55aSmrg# parm1:		specify the default value, yes or no.
23207e4fd55aSmrg#
23217e4fd55aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
23227e4fd55aSmrgm4_define([devel_default], m4_default([$1], [yes]))
23237e4fd55aSmrgAC_ARG_ENABLE(devel-docs,
23247e4fd55aSmrg	AS_HELP_STRING([--enable-devel-docs],
23257e4fd55aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
23267e4fd55aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
23277e4fd55aSmrgm4_undefine([devel_default])
23287e4fd55aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
23297e4fd55aSmrgAC_MSG_CHECKING([whether to build developer documentation])
23307e4fd55aSmrgAC_MSG_RESULT([$build_devel_docs])
23317e4fd55aSmrg]) # XORG_ENABLE_DEVEL_DOCS
23327e4fd55aSmrg
23337e4fd55aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
23347e4fd55aSmrg# ----------------
23357e4fd55aSmrg# Minimum version: 1.6.0
23367e4fd55aSmrg#
23377e4fd55aSmrg# This macro enables a builder to skip all functional specification targets.
23387e4fd55aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23397e4fd55aSmrg# maximum flexibilty in controlling documentation building.
23407e4fd55aSmrg# Refer to:
23417e4fd55aSmrg# XORG_WITH_XMLTO         --with-xmlto
23427e4fd55aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23437e4fd55aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
23447e4fd55aSmrg# XORG_WITH_FOP           --with-fop
23457e4fd55aSmrg# XORG_WITH_GROFF         --with-groff
23467e4fd55aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
23477e4fd55aSmrg#
23487e4fd55aSmrg# Interface to module:
23497e4fd55aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
23507e4fd55aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
23517e4fd55aSmrg#			'no' user instructs the module not to generate specs
23527e4fd55aSmrg# parm1:		specify the default value, yes or no.
23537e4fd55aSmrg#
23547e4fd55aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
23557e4fd55aSmrgm4_define([spec_default], m4_default([$1], [yes]))
23567e4fd55aSmrgAC_ARG_ENABLE(specs,
23577e4fd55aSmrg	AS_HELP_STRING([--enable-specs],
23587e4fd55aSmrg	   [Enable building the specs (default: ]spec_default[)]),
23597e4fd55aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
23607e4fd55aSmrgm4_undefine([spec_default])
23617e4fd55aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
23627e4fd55aSmrgAC_MSG_CHECKING([whether to build functional specifications])
23637e4fd55aSmrgAC_MSG_RESULT([$build_specs])
23647e4fd55aSmrg]) # XORG_ENABLE_SPECS
2365b8f75c19Smrg
23668e4923e5Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
23678e4923e5Smrg# ----------------------------------------------
23688e4923e5Smrg# Minimum version: 1.13.0
23698e4923e5Smrg#
23708e4923e5Smrg# This macro enables a builder to enable/disable unit testing
23718e4923e5Smrg# It makes no assumption about the test cases implementation
23728e4923e5Smrg# Test cases may or may not use Automake "Support for test suites"
23738e4923e5Smrg# They may or may not use the software utility library GLib
23748e4923e5Smrg#
23758e4923e5Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
23768e4923e5Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
23778e4923e5Smrg# The variable enable_unit_tests is used by other macros in this file.
23788e4923e5Smrg#
23798e4923e5Smrg# Interface to module:
23808e4923e5Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
23818e4923e5Smrg# enable_unit_tests:    used in configure.ac for additional configuration
23828e4923e5Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
23838e4923e5Smrg#			'no' user instructs the module not to build tests
23848e4923e5Smrg# parm1:		specify the default value, yes or no.
23858e4923e5Smrg#
23868e4923e5SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
23878e4923e5SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
23888e4923e5SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
23898e4923e5SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
23908e4923e5Smrgm4_define([_defopt], m4_default([$1], [auto]))
23918e4923e5SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
23928e4923e5Smrg	[Enable building unit test cases (default: ]_defopt[)]),
23938e4923e5Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
23948e4923e5Smrgm4_undefine([_defopt])
23958e4923e5SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
23968e4923e5SmrgAC_MSG_CHECKING([whether to build unit test cases])
23978e4923e5SmrgAC_MSG_RESULT([$enable_unit_tests])
23988e4923e5Smrg]) # XORG_ENABLE_UNIT_TESTS
23998e4923e5Smrg
24008e4923e5Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
24018e4923e5Smrg# ------------------------------------------------------
24028e4923e5Smrg# Minimum version: 1.17.0
24038e4923e5Smrg#
24048e4923e5Smrg# This macro enables a builder to enable/disable integration testing
24058e4923e5Smrg# It makes no assumption about the test cases' implementation
24068e4923e5Smrg# Test cases may or may not use Automake "Support for test suites"
24078e4923e5Smrg#
24088e4923e5Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
24098e4923e5Smrg# usually requires less dependencies and may be built and run under less
24108e4923e5Smrg# stringent environments than integration tests.
24118e4923e5Smrg#
24128e4923e5Smrg# Interface to module:
24138e4923e5Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
24148e4923e5Smrg# enable_integration_tests:   used in configure.ac for additional configuration
24158e4923e5Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
24168e4923e5Smrg#                             'no' user instructs the module not to build tests
24178e4923e5Smrg# parm1:                      specify the default value, yes or no.
24188e4923e5Smrg#
24198e4923e5SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
24208e4923e5SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
24218e4923e5Smrgm4_define([_defopt], m4_default([$1], [auto]))
24228e4923e5SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
24238e4923e5Smrg	[Enable building integration test cases (default: ]_defopt[)]),
24248e4923e5Smrg	[enable_integration_tests=$enableval],
24258e4923e5Smrg	[enable_integration_tests=]_defopt)
24268e4923e5Smrgm4_undefine([_defopt])
24278e4923e5SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
24288e4923e5Smrg	[test "x$enable_integration_tests" != xno])
24298e4923e5SmrgAC_MSG_CHECKING([whether to build unit test cases])
24308e4923e5SmrgAC_MSG_RESULT([$enable_integration_tests])
24318e4923e5Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
24328e4923e5Smrg
24338e4923e5Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
24348e4923e5Smrg# ----------------------------------------
24358e4923e5Smrg# Minimum version: 1.13.0
24368e4923e5Smrg#
24378e4923e5Smrg# GLib is a library which provides advanced data structures and functions.
24388e4923e5Smrg# This macro enables a module to test for the presence of Glib.
24398e4923e5Smrg#
24408e4923e5Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
24418e4923e5Smrg# Otherwise the value of $enable_unit_tests is blank.
24428e4923e5Smrg#
24438e4923e5Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
24448e4923e5Smrg# test support usually requires less dependencies and may be built and run under
24458e4923e5Smrg# less stringent environments than integration tests.
24468e4923e5Smrg#
24478e4923e5Smrg# Interface to module:
24488e4923e5Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
24498e4923e5Smrg# with_glib: used in configure.ac to know if GLib has been found
24508e4923e5Smrg# --with-glib:	'yes' user instructs the module to use glib
24518e4923e5Smrg#		'no' user instructs the module not to use glib
24528e4923e5Smrg#
24538e4923e5SmrgAC_DEFUN([XORG_WITH_GLIB],[
24548e4923e5SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
24558e4923e5Smrgm4_define([_defopt], m4_default([$2], [auto]))
24568e4923e5SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
24578e4923e5Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
24588e4923e5Smrg	[with_glib=$withval], [with_glib=]_defopt)
24598e4923e5Smrgm4_undefine([_defopt])
24608e4923e5Smrg
24618e4923e5Smrghave_glib=no
24628e4923e5Smrg# Do not probe GLib if user explicitly disabled unit testing
24638e4923e5Smrgif test "x$enable_unit_tests" != x"no"; then
24648e4923e5Smrg  # Do not probe GLib if user explicitly disabled it
24658e4923e5Smrg  if test "x$with_glib" != x"no"; then
24668e4923e5Smrg    m4_ifval(
24678e4923e5Smrg      [$1],
24688e4923e5Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
24698e4923e5Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
24708e4923e5Smrg    )
24718e4923e5Smrg  fi
24728e4923e5Smrgfi
24738e4923e5Smrg
24748e4923e5Smrg# Not having GLib when unit testing has been explicitly requested is an error
24758e4923e5Smrgif test "x$enable_unit_tests" = x"yes"; then
24768e4923e5Smrg  if test "x$have_glib" = x"no"; then
24778e4923e5Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24788e4923e5Smrg  fi
24798e4923e5Smrgfi
24808e4923e5Smrg
24818e4923e5Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
24828e4923e5Smrgif test "x$enable_unit_tests" = x"no"; then
24838e4923e5Smrg  if test "x$with_glib" = x"yes"; then
24848e4923e5Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24858e4923e5Smrg  fi
24868e4923e5Smrgfi
24878e4923e5Smrg
24888e4923e5Smrg# Not having GLib when it has been explicitly requested is an error
24898e4923e5Smrgif test "x$with_glib" = x"yes"; then
24908e4923e5Smrg  if test "x$have_glib" = x"no"; then
24918e4923e5Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
24928e4923e5Smrg  fi
24938e4923e5Smrgfi
24948e4923e5Smrg
24958e4923e5SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
24968e4923e5Smrg]) # XORG_WITH_GLIB
24978e4923e5Smrg
24988e4923e5Smrg# XORG_LD_WRAP([required|optional])
24998e4923e5Smrg# ---------------------------------
25008e4923e5Smrg# Minimum version: 1.13.0
25018e4923e5Smrg#
25028e4923e5Smrg# Check if linker supports -wrap, passed via compiler flags
25038e4923e5Smrg#
25048e4923e5Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
25058e4923e5Smrg# Otherwise the value of $enable_unit_tests is blank.
25068e4923e5Smrg#
25078e4923e5Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
25088e4923e5Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
25098e4923e5Smrg# available, an argument of "optional" allows use when some unit tests require
25108e4923e5Smrg# ld -wrap and others do not.
25118e4923e5Smrg#
25128e4923e5SmrgAC_DEFUN([XORG_LD_WRAP],[
25138e4923e5SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
25148e4923e5Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
25158e4923e5Smrg                      void __wrap_exit(int status) { return; }],
25168e4923e5Smrg                     [exit(0);])])
25178e4923e5Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
25188e4923e5Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
25198e4923e5Smrg  if test "x$have_ld_wrap" = x"no"; then
25208e4923e5Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
25218e4923e5Smrg  fi
25228e4923e5Smrgfi
25238e4923e5SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
25248e4923e5Smrg#
25258e4923e5Smrg]) # XORG_LD_WRAP
25268e4923e5Smrg
25278e4923e5Smrg# XORG_CHECK_LINKER_FLAGS
25288e4923e5Smrg# -----------------------
25298e4923e5Smrg# SYNOPSIS
25308e4923e5Smrg#
25318e4923e5Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
25328e4923e5Smrg#
25338e4923e5Smrg# DESCRIPTION
25348e4923e5Smrg#
25358e4923e5Smrg#   Check whether the given linker FLAGS work with the current language's
25368e4923e5Smrg#   linker, or whether they give an error.
25378e4923e5Smrg#
25388e4923e5Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
25398e4923e5Smrg#   success/failure.
25408e4923e5Smrg#
25418e4923e5Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
25428e4923e5Smrg#
25438e4923e5Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
25448e4923e5Smrg#
25458e4923e5Smrg# LICENSE
25468e4923e5Smrg#
25478e4923e5Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
25488e4923e5Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
25498e4923e5Smrg#   Copyright (c) 2009 Matteo Frigo
25508e4923e5Smrg#
25518e4923e5Smrg#   This program is free software: you can redistribute it and/or modify it
25528e4923e5Smrg#   under the terms of the GNU General Public License as published by the
25538e4923e5Smrg#   Free Software Foundation, either version 3 of the License, or (at your
25548e4923e5Smrg#   option) any later version.
25558e4923e5Smrg#
25568e4923e5Smrg#   This program is distributed in the hope that it will be useful, but
25578e4923e5Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
25588e4923e5Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
25598e4923e5Smrg#   Public License for more details.
25608e4923e5Smrg#
25618e4923e5Smrg#   You should have received a copy of the GNU General Public License along
25628e4923e5Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
25638e4923e5Smrg#
25648e4923e5Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
25658e4923e5Smrg#   gives unlimited permission to copy, distribute and modify the configure
25668e4923e5Smrg#   scripts that are the output of Autoconf when processing the Macro. You
25678e4923e5Smrg#   need not follow the terms of the GNU General Public License when using
25688e4923e5Smrg#   or distributing such scripts, even though portions of the text of the
25698e4923e5Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
25708e4923e5Smrg#   all other use of the material that constitutes the Autoconf Macro.
25718e4923e5Smrg#
25728e4923e5Smrg#   This special exception to the GPL applies to versions of the Autoconf
25738e4923e5Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
25748e4923e5Smrg#   modified version of the Autoconf Macro, you may extend this special
25758e4923e5Smrg#   exception to the GPL to apply to your modified version as well.#
25768e4923e5SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
25778e4923e5Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
25788e4923e5Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
25798e4923e5SmrgAS_LITERAL_IF([$1],
25808e4923e5Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
25818e4923e5Smrg      ax_save_FLAGS=$LDFLAGS
25828e4923e5Smrg      LDFLAGS="$1"
25838e4923e5Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
25848e4923e5Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25858e4923e5Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
25868e4923e5Smrg      LDFLAGS=$ax_save_FLAGS])],
25878e4923e5Smrg  [ax_save_FLAGS=$LDFLAGS
25888e4923e5Smrg   LDFLAGS="$1"
25898e4923e5Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
25908e4923e5Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25918e4923e5Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
25928e4923e5Smrg   LDFLAGS=$ax_save_FLAGS])
25938e4923e5Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
25948e4923e5SmrgAC_MSG_RESULT($xorg_check_linker_flags)
25958e4923e5Smrgif test "x$xorg_check_linker_flags" = xyes; then
25968e4923e5Smrg	m4_default([$2], :)
25978e4923e5Smrgelse
25988e4923e5Smrg	m4_default([$3], :)
25998e4923e5Smrgfi
26008e4923e5Smrg]) # XORG_CHECK_LINKER_FLAGS
26018e4923e5Smrg
26028e4923e5Smrg# XORG_MEMORY_CHECK_FLAGS
26038e4923e5Smrg# -----------------------
26048e4923e5Smrg# Minimum version: 1.16.0
26058e4923e5Smrg#
26068e4923e5Smrg# This macro attempts to find appropriate memory checking functionality
26078e4923e5Smrg# for various platforms which unit testing code may use to catch various
26088e4923e5Smrg# forms of memory allocation and access errors in testing.
26098e4923e5Smrg#
26108e4923e5Smrg# Interface to module:
26118e4923e5Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
26128e4923e5Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
26138e4923e5Smrg#
26148e4923e5Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
26158e4923e5Smrg#
26168e4923e5SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
26178e4923e5Smrg
26188e4923e5SmrgAC_REQUIRE([AC_CANONICAL_HOST])
26198e4923e5SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
26208e4923e5Smrg           [Environment variables to enable memory checking in tests])
26218e4923e5Smrg
26228e4923e5Smrg# Check for different types of support on different platforms
26238e4923e5Smrgcase $host_os in
26248e4923e5Smrg    solaris*)
26258e4923e5Smrg        AC_CHECK_LIB([umem], [umem_alloc],
26268e4923e5Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
26278e4923e5Smrg        ;;
26288e4923e5Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
26298e4923e5Smrg        # both directly and inverted, so should not be 0 or 255.
26308e4923e5Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
26318e4923e5Smrg        ;;
26328e4923e5Smrg    darwin*)
26338e4923e5Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
26348e4923e5Smrg        ;;
26358e4923e5Smrg    *bsd*)
26368e4923e5Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
26378e4923e5Smrg        ;;
26388e4923e5Smrgesac
26398e4923e5Smrg
26408e4923e5Smrg# User supplied flags override default flags
26418e4923e5Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
26428e4923e5Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
26438e4923e5Smrgfi
26448e4923e5Smrg
26458e4923e5SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
26468e4923e5Smrg]) # XORG_WITH_LINT
26478e4923e5Smrg
2648b8f75c19Smrg# XORG_CHECK_MALLOC_ZERO
2649b8f75c19Smrg# ----------------------
26507e4fd55aSmrg# Minimum version: 1.0.0
26517e4fd55aSmrg#
2652b8f75c19Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2653b8f75c19Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2654b8f75c19Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2655b8f75c19SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2656b8f75c19SmrgAC_ARG_ENABLE(malloc0returnsnull,
26577e4fd55aSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2658b8f75c19Smrg		       [malloc(0) returns NULL (default: auto)]),
2659b8f75c19Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2660b8f75c19Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2661b8f75c19Smrg
2662b8f75c19SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2663b8f75c19Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
26647e4fd55aSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
26657e4fd55aSmrg#include <stdlib.h>
26667e4fd55aSmrg],[
2667b8f75c19Smrg    char *m0, *r0, *c0, *p;
2668b8f75c19Smrg    m0 = malloc(0);
2669b8f75c19Smrg    p = malloc(10);
2670b8f75c19Smrg    r0 = realloc(p,0);
26717e4fd55aSmrg    c0 = calloc(0,10);
26727e4fd55aSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
26737e4fd55aSmrg])],
2674b8f75c19Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
26757e4fd55aSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
26767e4fd55aSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2677b8f75c19Smrgfi
2678b8f75c19SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2679b8f75c19Smrg
2680b8f75c19Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2681b8f75c19Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2682b8f75c19Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2683b8f75c19Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2684b8f75c19Smrgelse
2685b8f75c19Smrg	MALLOC_ZERO_CFLAGS=""
2686b8f75c19Smrg	XMALLOC_ZERO_CFLAGS=""
2687b8f75c19Smrg	XTMALLOC_ZERO_CFLAGS=""
2688b8f75c19Smrgfi
2689b8f75c19Smrg
2690b8f75c19SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2691b8f75c19SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2692b8f75c19SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2693b8f75c19Smrg]) # XORG_CHECK_MALLOC_ZERO
2694b8f75c19Smrg
26957e4fd55aSmrg# XORG_WITH_LINT()
26967e4fd55aSmrg# ----------------
26977e4fd55aSmrg# Minimum version: 1.1.0
26987e4fd55aSmrg#
26997e4fd55aSmrg# This macro enables the use of a tool that flags some suspicious and
27007e4fd55aSmrg# non-portable constructs (likely to be bugs) in C language source code.
27017e4fd55aSmrg# It will attempt to locate the tool and use appropriate options.
27027e4fd55aSmrg# There are various lint type tools on different platforms.
27037e4fd55aSmrg#
27047e4fd55aSmrg# Interface to module:
27057e4fd55aSmrg# LINT:		returns the path to the tool found on the platform
27067e4fd55aSmrg#		or the value set to LINT on the configure cmd line
27077e4fd55aSmrg#		also an Automake conditional
27087e4fd55aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
27097e4fd55aSmrg#
27107e4fd55aSmrg# --with-lint:	'yes' user instructs the module to use lint
27117e4fd55aSmrg#		'no' user instructs the module not to use lint (default)
27127e4fd55aSmrg#
27137e4fd55aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
27147e4fd55aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
27157e4fd55aSmrg#
27167e4fd55aSmrgAC_DEFUN([XORG_WITH_LINT],[
27177e4fd55aSmrg
27187e4fd55aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
27197e4fd55aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
27207e4fd55aSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27217e4fd55aSmrg		[Use a lint-style source code checker (default: disabled)])],
27227e4fd55aSmrg		[use_lint=$withval], [use_lint=no])
27237e4fd55aSmrg
27247e4fd55aSmrg# Obtain platform specific info like program name and options
27257e4fd55aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
27267e4fd55aSmrgcase $host_os in
27277e4fd55aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
27287e4fd55aSmrg	lint_name=splint
27297e4fd55aSmrg	lint_options="-badflag"
27307e4fd55aSmrg	;;
27317e4fd55aSmrg  *freebsd* | *netbsd*)
27327e4fd55aSmrg	lint_name=lint
27337e4fd55aSmrg	lint_options="-u -b"
27347e4fd55aSmrg	;;
27357e4fd55aSmrg  *solaris*)
27367e4fd55aSmrg	lint_name=lint
27377e4fd55aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
27387e4fd55aSmrg	;;
27397e4fd55aSmrgesac
27407e4fd55aSmrg
27417e4fd55aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
27427e4fd55aSmrgif test "x$use_lint" = x"yes" ; then
27437e4fd55aSmrg   AC_PATH_PROG([LINT], [$lint_name])
27447e4fd55aSmrg   if test "x$LINT" = "x"; then
27457e4fd55aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
27467e4fd55aSmrg   fi
27477e4fd55aSmrgelif test "x$use_lint" = x"no" ; then
27487e4fd55aSmrg   if test "x$LINT" != "x"; then
27497e4fd55aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
27507e4fd55aSmrg   fi
27517e4fd55aSmrgelse
27527e4fd55aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
27537e4fd55aSmrgfi
27547e4fd55aSmrg
27557e4fd55aSmrg# User supplied flags override default flags
27567e4fd55aSmrgif test "x$LINT_FLAGS" != "x"; then
27577e4fd55aSmrg   lint_options=$LINT_FLAGS
27587e4fd55aSmrgfi
27597e4fd55aSmrg
27607e4fd55aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
27617e4fd55aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
27627e4fd55aSmrg
27637e4fd55aSmrg]) # XORG_WITH_LINT
27647e4fd55aSmrg
27657e4fd55aSmrg# XORG_LINT_LIBRARY(LIBNAME)
27667e4fd55aSmrg# --------------------------
27677e4fd55aSmrg# Minimum version: 1.1.0
27687e4fd55aSmrg#
27697e4fd55aSmrg# Sets up flags for building lint libraries for checking programs that call
27707e4fd55aSmrg# functions in the library.
27717e4fd55aSmrg#
27727e4fd55aSmrg# Interface to module:
27737e4fd55aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
27747e4fd55aSmrg# MAKE_LINT_LIB		- Automake conditional
27757e4fd55aSmrg#
27767e4fd55aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
27777e4fd55aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
27787e4fd55aSmrg
27797e4fd55aSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
27807e4fd55aSmrgAC_REQUIRE([XORG_WITH_LINT])
27817e4fd55aSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
27827e4fd55aSmrg	[Create lint library (default: disabled)])],
27837e4fd55aSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
27847e4fd55aSmrg
27857e4fd55aSmrgif test "x$make_lint_lib" = x"yes" ; then
27867e4fd55aSmrg   LINTLIB=llib-l$1.ln
27877e4fd55aSmrg   if test "x$LINT" = "x"; then
27887e4fd55aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
27897e4fd55aSmrg   fi
27907e4fd55aSmrgelif test "x$make_lint_lib" != x"no" ; then
27917e4fd55aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
27927e4fd55aSmrgfi
27937e4fd55aSmrg
27947e4fd55aSmrgAC_SUBST(LINTLIB)
27957e4fd55aSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
27967e4fd55aSmrg
27977e4fd55aSmrg]) # XORG_LINT_LIBRARY
27987e4fd55aSmrg
27998e4923e5Smrg# XORG_COMPILER_BRAND
28008e4923e5Smrg# -------------------
28018e4923e5Smrg# Minimum version: 1.14.0
28028e4923e5Smrg#
28038e4923e5Smrg# Checks for various brands of compilers and sets flags as appropriate:
28048e4923e5Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
28058e4923e5Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
28068e4923e5Smrg#   clang compiler - sets CLANGCC to "yes"
28078e4923e5Smrg#   Intel compiler - sets INTELCC to "yes"
28088e4923e5Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
28098e4923e5Smrg#
28108e4923e5SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
28118e4923e5SmrgAC_LANG_CASE(
28128e4923e5Smrg	[C], [
28138e4923e5Smrg		AC_REQUIRE([AC_PROG_CC_C99])
28148e4923e5Smrg	],
28158e4923e5Smrg	[C++], [
28168e4923e5Smrg		AC_REQUIRE([AC_PROG_CXX])
28178e4923e5Smrg	]
28188e4923e5Smrg)
28198e4923e5SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
28208e4923e5SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
28218e4923e5SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
28228e4923e5Smrg]) # XORG_COMPILER_BRAND
28238e4923e5Smrg
28248e4923e5Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
28258e4923e5Smrg# ---------------
28268e4923e5Smrg# Minimum version: 1.16.0
28278e4923e5Smrg#
28288e4923e5Smrg# Test if the compiler works when passed the given flag as a command line argument.
28298e4923e5Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
28308e4923e5Smrg# next flag in the list until there are no more options.
28318e4923e5Smrg#
28328e4923e5Smrg# Note that this does not guarantee that the compiler supports the flag as some
28338e4923e5Smrg# compilers will simply ignore arguments that they do not understand, but we do
28348e4923e5Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
28358e4923e5Smrg# -Werror=unused-command-line-argument
28368e4923e5Smrg#
28378e4923e5SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
28388e4923e5Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28398e4923e5Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28408e4923e5Smrg
28418e4923e5SmrgAC_LANG_COMPILER_REQUIRE
28428e4923e5Smrg
28438e4923e5SmrgAC_LANG_CASE(
28448e4923e5Smrg	[C], [
28458e4923e5Smrg		AC_REQUIRE([AC_PROG_CC_C99])
28468e4923e5Smrg		define([PREFIX], [C])
28478e4923e5Smrg		define([CACHE_PREFIX], [cc])
28488e4923e5Smrg		define([COMPILER], [$CC])
28498e4923e5Smrg	],
28508e4923e5Smrg	[C++], [
28518e4923e5Smrg		define([PREFIX], [CXX])
28528e4923e5Smrg		define([CACHE_PREFIX], [cxx])
28538e4923e5Smrg		define([COMPILER], [$CXX])
28548e4923e5Smrg	]
28558e4923e5Smrg)
28568e4923e5Smrg
28578e4923e5Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
28588e4923e5Smrg
28598e4923e5Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
28608e4923e5Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28618e4923e5Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
28628e4923e5Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
28638e4923e5Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28648e4923e5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
28658e4923e5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
28668e4923e5Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
28678e4923e5Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28688e4923e5Smrgfi
28698e4923e5Smrg
28708e4923e5Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
28718e4923e5Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
28728e4923e5Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28738e4923e5Smrg	fi
28748e4923e5Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
28758e4923e5Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
28768e4923e5Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
28778e4923e5Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28788e4923e5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
28798e4923e5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
28808e4923e5Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
28818e4923e5Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28828e4923e5Smrgfi
28838e4923e5Smrg
28848e4923e5Smrgfound="no"
28858e4923e5Smrgm4_foreach([flag], m4_cdr($@), [
28868e4923e5Smrg	if test $found = "no" ; then
28878e4923e5Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
28888e4923e5Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28898e4923e5Smrg		fi
28908e4923e5Smrg
28918e4923e5Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
28928e4923e5Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
28938e4923e5Smrg		fi
28948e4923e5Smrg
28958e4923e5Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
28968e4923e5Smrg
28978e4923e5Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
28988e4923e5Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
28998e4923e5Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
29008e4923e5Smrg		AC_CACHE_VAL($cacheid,
29018e4923e5Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
29028e4923e5Smrg					     [eval $cacheid=yes],
29038e4923e5Smrg					     [eval $cacheid=no])])
29048e4923e5Smrg
29058e4923e5Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
29068e4923e5Smrg
29078e4923e5Smrg		eval supported=\$$cacheid
29088e4923e5Smrg		AC_MSG_RESULT([$supported])
29098e4923e5Smrg		if test "$supported" = "yes" ; then
29108e4923e5Smrg			$1="$$1 ]flag["
29118e4923e5Smrg			found="yes"
29128e4923e5Smrg		fi
29138e4923e5Smrg	fi
29148e4923e5Smrg])
29158e4923e5Smrg]) # XORG_TESTSET_CFLAG
29168e4923e5Smrg
29178e4923e5Smrg# XORG_COMPILER_FLAGS
29188e4923e5Smrg# ---------------
29198e4923e5Smrg# Minimum version: 1.16.0
29208e4923e5Smrg#
29218e4923e5Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
29228e4923e5Smrg# arguments supported by the selected compiler which do NOT alter the generated
29238e4923e5Smrg# code.  These arguments will cause the compiler to print various warnings
29248e4923e5Smrg# during compilation AND turn a conservative set of warnings into errors.
29258e4923e5Smrg#
29268e4923e5Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
29278e4923e5Smrg# future versions of util-macros as options are added to new compilers.
29288e4923e5Smrg#
29298e4923e5SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
29308e4923e5SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
29318e4923e5Smrg
29328e4923e5SmrgAC_ARG_ENABLE(selective-werror,
29338e4923e5Smrg              AS_HELP_STRING([--disable-selective-werror],
29348e4923e5Smrg                             [Turn off selective compiler errors. (default: enabled)]),
29358e4923e5Smrg              [SELECTIVE_WERROR=$enableval],
29368e4923e5Smrg              [SELECTIVE_WERROR=yes])
29378e4923e5Smrg
29388e4923e5SmrgAC_LANG_CASE(
29398e4923e5Smrg        [C], [
29408e4923e5Smrg                define([PREFIX], [C])
29418e4923e5Smrg        ],
29428e4923e5Smrg        [C++], [
29438e4923e5Smrg                define([PREFIX], [CXX])
29448e4923e5Smrg        ]
29458e4923e5Smrg)
29468e4923e5Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
29478e4923e5Smrgif test "x$SUNCC" = "xyes"; then
29488e4923e5Smrg    [BASE_]PREFIX[FLAGS]="-v"
29498e4923e5Smrgelse
29508e4923e5Smrg    [BASE_]PREFIX[FLAGS]=""
29518e4923e5Smrgfi
29528e4923e5Smrg
29538e4923e5Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
29548e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
29558e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
29568e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
29578e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
29588e4923e5Smrg
29598e4923e5SmrgAC_LANG_CASE(
29608e4923e5Smrg	[C], [
29618e4923e5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
29628e4923e5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
29638e4923e5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
29648e4923e5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
29658e4923e5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
29668e4923e5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
29678e4923e5Smrg	]
29688e4923e5Smrg)
29698e4923e5Smrg
29708e4923e5Smrg# This chunk adds additional warnings that could catch undesired effects.
29718e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
29728e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
29738e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
29748e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
29758e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
29768e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
29778e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
29788e4923e5Smrg
29798e4923e5Smrg# These are currently disabled because they are noisy.  They will be enabled
29808e4923e5Smrg# in the future once the codebase is sufficiently modernized to silence
29818e4923e5Smrg# them.  For now, I don't want them to drown out the other warnings.
29828e4923e5Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
29838e4923e5Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
29848e4923e5Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
29858e4923e5Smrg
29868e4923e5Smrg# Turn some warnings into errors, so we don't accidently get successful builds
29878e4923e5Smrg# when there are problems that should be fixed.
29888e4923e5Smrg
29898e4923e5Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
29908e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
29918e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
29928e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
29938e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
29948e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
29958e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
29968e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
29978e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
29988e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
29998e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
30008e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
30018e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
30028e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
30038e4923e5Smrgelse
30048e4923e5SmrgAC_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])
30058e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
30068e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
30078e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
30088e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
30098e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
30108e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
30118e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
30128e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
30138e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
30148e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
30158e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
30168e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
30178e4923e5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
30188e4923e5Smrgfi
30198e4923e5Smrg
30208e4923e5SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
30218e4923e5Smrg]) # XORG_COMPILER_FLAGS
30228e4923e5Smrg
30237e4fd55aSmrg# XORG_CWARNFLAGS
30247e4fd55aSmrg# ---------------
30257e4fd55aSmrg# Minimum version: 1.2.0
30268e4923e5Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
30277e4fd55aSmrg#
30287e4fd55aSmrg# Defines CWARNFLAGS to enable C compiler warnings.
30297e4fd55aSmrg#
30308e4923e5Smrg# This function is deprecated because it defines -fno-strict-aliasing
30318e4923e5Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
30328e4923e5Smrg# is needed, then it should be added explicitly in the module when
30338e4923e5Smrg# it is updated to use BASE_CFLAGS.
30348e4923e5Smrg#
30357e4fd55aSmrgAC_DEFUN([XORG_CWARNFLAGS], [
30368e4923e5SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30378e4923e5SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30388e4923e5SmrgAC_LANG_CASE(
30398e4923e5Smrg	[C], [
30408e4923e5Smrg		CWARNFLAGS="$BASE_CFLAGS"
30418e4923e5Smrg		if  test "x$GCC" = xyes ; then
30428e4923e5Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
30438e4923e5Smrg		fi
30448e4923e5Smrg		AC_SUBST(CWARNFLAGS)
30458e4923e5Smrg	]
30468e4923e5Smrg)
30477e4fd55aSmrg]) # XORG_CWARNFLAGS
30487e4fd55aSmrg
30497e4fd55aSmrg# XORG_STRICT_OPTION
30507e4fd55aSmrg# -----------------------
30517e4fd55aSmrg# Minimum version: 1.3.0
30527e4fd55aSmrg#
30538e4923e5Smrg# Add configure option to enable strict compilation flags, such as treating
30548e4923e5Smrg# warnings as fatal errors.
30558e4923e5Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
30568e4923e5Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
30578e4923e5Smrg#
30588e4923e5Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
30598e4923e5Smrg# when strict compilation is unconditionally desired.
30607e4fd55aSmrgAC_DEFUN([XORG_STRICT_OPTION], [
30617e4fd55aSmrgAC_REQUIRE([XORG_CWARNFLAGS])
30628e4923e5SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30637e4fd55aSmrg
30647e4fd55aSmrgAC_ARG_ENABLE(strict-compilation,
30657e4fd55aSmrg			  AS_HELP_STRING([--enable-strict-compilation],
30667e4fd55aSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
30677e4fd55aSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
30688e4923e5Smrg
30698e4923e5SmrgAC_LANG_CASE(
30708e4923e5Smrg        [C], [
30718e4923e5Smrg                define([PREFIX], [C])
30728e4923e5Smrg        ],
30738e4923e5Smrg        [C++], [
30748e4923e5Smrg                define([PREFIX], [CXX])
30758e4923e5Smrg        ]
30768e4923e5Smrg)
30778e4923e5Smrg
30788e4923e5Smrg[STRICT_]PREFIX[FLAGS]=""
30798e4923e5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
30808e4923e5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
30818e4923e5Smrg
30828e4923e5Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
30838e4923e5Smrg# activate it with -Werror, so we add it here explicitly.
30848e4923e5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
30858e4923e5Smrg
30867e4fd55aSmrgif test "x$STRICT_COMPILE" = "xyes"; then
30878e4923e5Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
30888e4923e5Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
30897e4fd55aSmrgfi
30908e4923e5SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
30918e4923e5SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
30928e4923e5SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
30937e4fd55aSmrg]) # XORG_STRICT_OPTION
30947e4fd55aSmrg
30957e4fd55aSmrg# XORG_DEFAULT_OPTIONS
30967e4fd55aSmrg# --------------------
30977e4fd55aSmrg# Minimum version: 1.3.0
30987e4fd55aSmrg#
30997e4fd55aSmrg# Defines default options for X.Org modules.
31007e4fd55aSmrg#
31017e4fd55aSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
31027e4fd55aSmrgAC_REQUIRE([AC_PROG_INSTALL])
31038e4923e5SmrgXORG_COMPILER_FLAGS
31047e4fd55aSmrgXORG_CWARNFLAGS
31057e4fd55aSmrgXORG_STRICT_OPTION
31067e4fd55aSmrgXORG_RELEASE_VERSION
31077e4fd55aSmrgXORG_CHANGELOG
31087e4fd55aSmrgXORG_INSTALL
31097e4fd55aSmrgXORG_MANPAGE_SECTIONS
31107e4fd55aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
31117e4fd55aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
31127e4fd55aSmrg]) # XORG_DEFAULT_OPTIONS
31137e4fd55aSmrg
31147e4fd55aSmrg# XORG_INSTALL()
31157e4fd55aSmrg# ----------------
31167e4fd55aSmrg# Minimum version: 1.4.0
31177e4fd55aSmrg#
31187e4fd55aSmrg# Defines the variable INSTALL_CMD as the command to copy
31197e4fd55aSmrg# INSTALL from $prefix/share/util-macros.
31207e4fd55aSmrg#
31217e4fd55aSmrgAC_DEFUN([XORG_INSTALL], [
31227e4fd55aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
31237e4fd55aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
31247e4fd55aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
31257e4fd55aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
31267e4fd55aSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
31277e4fd55aSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
31287e4fd55aSmrgAC_SUBST([INSTALL_CMD])
31297e4fd55aSmrg]) # XORG_INSTALL
3130b8f75c19Smrgdnl Copyright 2005 Red Hat, Inc
3131b8f75c19Smrgdnl
3132b8f75c19Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3133b8f75c19Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3134b8f75c19Smrgdnl the above copyright notice appear in all copies and that both that
3135b8f75c19Smrgdnl copyright notice and this permission notice appear in supporting
3136b8f75c19Smrgdnl documentation.
3137b8f75c19Smrgdnl
3138b8f75c19Smrgdnl The above copyright notice and this permission notice shall be included
3139b8f75c19Smrgdnl in all copies or substantial portions of the Software.
3140b8f75c19Smrgdnl
3141b8f75c19Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3142b8f75c19Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3143b8f75c19Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3144b8f75c19Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3145b8f75c19Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3146b8f75c19Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3147b8f75c19Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3148b8f75c19Smrgdnl
3149b8f75c19Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3150b8f75c19Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3151b8f75c19Smrgdnl other dealings in this Software without prior written authorization
3152b8f75c19Smrgdnl from the copyright holders.
3153b8f75c19Smrgdnl
3154b8f75c19Smrg
3155b8f75c19Smrg# XORG_RELEASE_VERSION
3156b8f75c19Smrg# --------------------
31577e4fd55aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
31588e4923e5Smrg
3159b8f75c19SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
31607e4fd55aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
31617e4fd55aSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
31627e4fd55aSmrg		[Major version of this package])
31637e4fd55aSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
31647e4fd55aSmrg	if test "x$PVM" = "x"; then
31657e4fd55aSmrg		PVM="0"
3166b8f75c19Smrg	fi
31677e4fd55aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
31687e4fd55aSmrg		[$PVM],
31697e4fd55aSmrg		[Minor version of this package])
31707e4fd55aSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
31717e4fd55aSmrg	if test "x$PVP" = "x"; then
31727e4fd55aSmrg		PVP="0"
31737e4fd55aSmrg	fi
31747e4fd55aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
31757e4fd55aSmrg		[$PVP],
31767e4fd55aSmrg		[Patch version of this package])
3177b8f75c19Smrg])
3178b8f75c19Smrg
31797e4fd55aSmrg# XORG_CHANGELOG()
31807e4fd55aSmrg# ----------------
31817e4fd55aSmrg# Minimum version: 1.2.0
31827e4fd55aSmrg#
31837e4fd55aSmrg# Defines the variable CHANGELOG_CMD as the command to generate
31847e4fd55aSmrg# ChangeLog from git.
31857e4fd55aSmrg#
31867e4fd55aSmrg#
31877e4fd55aSmrgAC_DEFUN([XORG_CHANGELOG], [
31887e4fd55aSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
31897e4fd55aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
31907e4fd55aSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
31917e4fd55aSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
31927e4fd55aSmrgAC_SUBST([CHANGELOG_CMD])
31937e4fd55aSmrg]) # XORG_CHANGELOG
31947e4fd55aSmrg
3195