aclocal.m4 revision 24047306
124047306Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
224047306Smrg
324047306Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
414c0a534Smrg
514c0a534Smrg# This file is free software; the Free Software Foundation
614c0a534Smrg# gives unlimited permission to copy and/or distribute it,
714c0a534Smrg# with or without modifications, as long as this notice is preserved.
814c0a534Smrg
914c0a534Smrg# This program is distributed in the hope that it will be useful,
1014c0a534Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1114c0a534Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1214c0a534Smrg# PARTICULAR PURPOSE.
1314c0a534Smrg
1424047306Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15bf2eeab3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16bf2eeab3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1724047306Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1824047306Smrg[m4_warning([this file was generated for autoconf 2.69.
19bf2eeab3SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20bf2eeab3SmrgIf you have problems, you may need to regenerate the build system entirely.
2124047306SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2214c0a534Smrg
2324047306Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
2414c0a534Smrg#
25bf2eeab3Smrg# This file is free software; the Free Software Foundation
26bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
27bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
2814c0a534Smrg
29bf2eeab3Smrg# AM_AUTOMAKE_VERSION(VERSION)
30bf2eeab3Smrg# ----------------------------
31bf2eeab3Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32bf2eeab3Smrg# generated from the m4 files accompanying Automake X.Y.
33bf2eeab3Smrg# (This private macro should not be called outside this file.)
34bf2eeab3SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3524047306Smrg[am__api_version='1.15'
36bf2eeab3Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37bf2eeab3Smrgdnl require some minimum version.  Point them to the right macro.
3824047306Smrgm4_if([$1], [1.15], [],
39bf2eeab3Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40bf2eeab3Smrg])
4114c0a534Smrg
42bf2eeab3Smrg# _AM_AUTOCONF_VERSION(VERSION)
4314c0a534Smrg# -----------------------------
44bf2eeab3Smrg# aclocal traces this macro to find the Autoconf version.
45bf2eeab3Smrg# This is a private macro too.  Using m4_define simplifies
46bf2eeab3Smrg# the logic in aclocal, which can simply ignore this definition.
47bf2eeab3Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48bf2eeab3Smrg
49bf2eeab3Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50bf2eeab3Smrg# -------------------------------
51bf2eeab3Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52bf2eeab3Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53bf2eeab3SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5424047306Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
55bf2eeab3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56bf2eeab3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57bf2eeab3Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5814c0a534Smrg
59bf2eeab3Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6014c0a534Smrg
6124047306Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
62bf2eeab3Smrg#
63bf2eeab3Smrg# This file is free software; the Free Software Foundation
64bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
65bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
66bf2eeab3Smrg
67bf2eeab3Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6824047306Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6924047306Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7014c0a534Smrg#
71bf2eeab3Smrg# Of course, Automake must honor this variable whenever it calls a
72bf2eeab3Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73bf2eeab3Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74bf2eeab3Smrg# depending on how configure is run.  This is pretty annoying, since
75bf2eeab3Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76bf2eeab3Smrg# source directory, any form will work fine, but in subdirectories a
77bf2eeab3Smrg# relative path needs to be adjusted first.
7814c0a534Smrg#
79bf2eeab3Smrg# $ac_aux_dir/missing
80bf2eeab3Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81bf2eeab3Smrg# $top_srcdir/$ac_aux_dir/missing
82bf2eeab3Smrg#    fails if $ac_aux_dir is absolute,
83bf2eeab3Smrg#    fails when called from a subdirectory in a VPATH build with
84bf2eeab3Smrg#          a relative $ac_aux_dir
8514c0a534Smrg#
86bf2eeab3Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87bf2eeab3Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8824047306Smrg# harmless because $srcdir is '.', but things will broke when you
89bf2eeab3Smrg# start a VPATH build or use an absolute $srcdir.
9014c0a534Smrg#
91bf2eeab3Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92bf2eeab3Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93bf2eeab3Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94bf2eeab3Smrg# and then we would define $MISSING as
95bf2eeab3Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96bf2eeab3Smrg# This will work as long as MISSING is not called from configure, because
97bf2eeab3Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98bf2eeab3Smrg# However there are other variables, like CC, which are often used in
99bf2eeab3Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100bf2eeab3Smrg#
101bf2eeab3Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102bf2eeab3Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103bf2eeab3Smrg# configured tree to be moved without reconfiguration.
10414c0a534Smrg
105bf2eeab3SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10624047306Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10724047306Smrg# Expand $ac_aux_dir to an absolute path.
10824047306Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109bf2eeab3Smrg])
11014c0a534Smrg
111bf2eeab3Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11214c0a534Smrg
11324047306Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
114bf2eeab3Smrg#
115bf2eeab3Smrg# This file is free software; the Free Software Foundation
116bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
117bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
11814c0a534Smrg
119bf2eeab3Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120bf2eeab3Smrg# -------------------------------------
121bf2eeab3Smrg# Define a conditional.
122bf2eeab3SmrgAC_DEFUN([AM_CONDITIONAL],
12324047306Smrg[AC_PREREQ([2.52])dnl
12424047306Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12524047306Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126bf2eeab3SmrgAC_SUBST([$1_TRUE])dnl
127bf2eeab3SmrgAC_SUBST([$1_FALSE])dnl
128bf2eeab3Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129bf2eeab3Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130bf2eeab3Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131bf2eeab3Smrgif $2; then
132bf2eeab3Smrg  $1_TRUE=
133bf2eeab3Smrg  $1_FALSE='#'
134bf2eeab3Smrgelse
135bf2eeab3Smrg  $1_TRUE='#'
136bf2eeab3Smrg  $1_FALSE=
137bf2eeab3Smrgfi
138bf2eeab3SmrgAC_CONFIG_COMMANDS_PRE(
139bf2eeab3Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140bf2eeab3Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141bf2eeab3SmrgUsually this means the macro was only invoked conditionally.]])
142bf2eeab3Smrgfi])])
14314c0a534Smrg
14424047306Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
145bf2eeab3Smrg#
146bf2eeab3Smrg# This file is free software; the Free Software Foundation
147bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
148bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
14914c0a534Smrg
15014c0a534Smrg
15124047306Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152bf2eeab3Smrg# written in clear, in which case automake, when reading aclocal.m4,
153bf2eeab3Smrg# will think it sees a *use*, and therefore will trigger all it's
154bf2eeab3Smrg# C support machinery.  Also note that it means that autoscan, seeing
155bf2eeab3Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15614c0a534Smrg
15714c0a534Smrg
158bf2eeab3Smrg# _AM_DEPENDENCIES(NAME)
159bf2eeab3Smrg# ----------------------
160bf2eeab3Smrg# See how the compiler implements dependency checking.
16124047306Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162bf2eeab3Smrg# We try a few techniques and use that to set a single cache variable.
163bf2eeab3Smrg#
164bf2eeab3Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165bf2eeab3Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166bf2eeab3Smrg# dependency, and given that the user is not expected to run this macro,
167bf2eeab3Smrg# just rely on AC_PROG_CC.
168bf2eeab3SmrgAC_DEFUN([_AM_DEPENDENCIES],
169bf2eeab3Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170bf2eeab3SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171bf2eeab3SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172bf2eeab3SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17314c0a534Smrg
17424047306Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17524047306Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17624047306Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17724047306Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17824047306Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17924047306Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18024047306Smrg                    [depcc="$$1"   am_compiler_list=])
18114c0a534Smrg
182bf2eeab3SmrgAC_CACHE_CHECK([dependency style of $depcc],
183bf2eeab3Smrg               [am_cv_$1_dependencies_compiler_type],
184bf2eeab3Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185bf2eeab3Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186bf2eeab3Smrg  # making bogus files that we don't know about and never remove.  For
187bf2eeab3Smrg  # instance it was reported that on HP-UX the gcc test will end up
18824047306Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18924047306Smrg  # in D".
19024047306Smrg  rm -rf conftest.dir
191bf2eeab3Smrg  mkdir conftest.dir
192bf2eeab3Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193bf2eeab3Smrg  # using a relative directory.
194bf2eeab3Smrg  cp "$am_depcomp" conftest.dir
195bf2eeab3Smrg  cd conftest.dir
196bf2eeab3Smrg  # We will build objects and dependencies in a subdirectory because
197bf2eeab3Smrg  # it helps to detect inapplicable dependency modes.  For instance
198bf2eeab3Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199bf2eeab3Smrg  # side effect of compilation, but ICC will put the dependencies in
200bf2eeab3Smrg  # the current directory while Tru64 will put them in the object
201bf2eeab3Smrg  # directory.
202bf2eeab3Smrg  mkdir sub
20314c0a534Smrg
204bf2eeab3Smrg  am_cv_$1_dependencies_compiler_type=none
205bf2eeab3Smrg  if test "$am_compiler_list" = ""; then
206bf2eeab3Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207bf2eeab3Smrg  fi
208bf2eeab3Smrg  am__universal=false
209bf2eeab3Smrg  m4_case([$1], [CC],
210bf2eeab3Smrg    [case " $depcc " in #(
211bf2eeab3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212bf2eeab3Smrg     esac],
213bf2eeab3Smrg    [CXX],
214bf2eeab3Smrg    [case " $depcc " in #(
215bf2eeab3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216bf2eeab3Smrg     esac])
21714c0a534Smrg
218bf2eeab3Smrg  for depmode in $am_compiler_list; do
219bf2eeab3Smrg    # Setup a source with many dependencies, because some compilers
220bf2eeab3Smrg    # like to wrap large dependency lists on column 80 (with \), and
221bf2eeab3Smrg    # we should not choose a depcomp mode which is confused by this.
222bf2eeab3Smrg    #
223bf2eeab3Smrg    # We need to recreate these files for each test, as the compiler may
224bf2eeab3Smrg    # overwrite some of them when testing with obscure command lines.
225bf2eeab3Smrg    # This happens at least with the AIX C compiler.
226bf2eeab3Smrg    : > sub/conftest.c
227bf2eeab3Smrg    for i in 1 2 3 4 5 6; do
228bf2eeab3Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22924047306Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23024047306Smrg      # Solaris 10 /bin/sh.
23124047306Smrg      echo '/* dummy */' > sub/conftst$i.h
232bf2eeab3Smrg    done
233bf2eeab3Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234bf2eeab3Smrg
23524047306Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236bf2eeab3Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23724047306Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23824047306Smrg    # versions had trouble with output in subdirs.
239bf2eeab3Smrg    am__obj=sub/conftest.${OBJEXT-o}
240bf2eeab3Smrg    am__minus_obj="-o $am__obj"
241bf2eeab3Smrg    case $depmode in
242bf2eeab3Smrg    gcc)
243bf2eeab3Smrg      # This depmode causes a compiler race in universal mode.
244bf2eeab3Smrg      test "$am__universal" = false || continue
245bf2eeab3Smrg      ;;
246bf2eeab3Smrg    nosideeffect)
24724047306Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24824047306Smrg      # only be used when explicitly requested.
249bf2eeab3Smrg      if test "x$enable_dependency_tracking" = xyes; then
250bf2eeab3Smrg	continue
251bf2eeab3Smrg      else
252bf2eeab3Smrg	break
253bf2eeab3Smrg      fi
254bf2eeab3Smrg      ;;
25524047306Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25624047306Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257bf2eeab3Smrg      # not run yet.  These depmodes are late enough in the game, and
258bf2eeab3Smrg      # so weak that their functioning should not be impacted.
259bf2eeab3Smrg      am__obj=conftest.${OBJEXT-o}
260bf2eeab3Smrg      am__minus_obj=
261bf2eeab3Smrg      ;;
262bf2eeab3Smrg    none) break ;;
263bf2eeab3Smrg    esac
264bf2eeab3Smrg    if depmode=$depmode \
265bf2eeab3Smrg       source=sub/conftest.c object=$am__obj \
266bf2eeab3Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267bf2eeab3Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268bf2eeab3Smrg         >/dev/null 2>conftest.err &&
269bf2eeab3Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270bf2eeab3Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271bf2eeab3Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272bf2eeab3Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273bf2eeab3Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274bf2eeab3Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275bf2eeab3Smrg      # that says an option was ignored or not supported.
276bf2eeab3Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277bf2eeab3Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278bf2eeab3Smrg      # The diagnosis changed in icc 8.0:
279bf2eeab3Smrg      #   icc: Command line remark: option '-MP' not supported
280bf2eeab3Smrg      if (grep 'ignoring option' conftest.err ||
281bf2eeab3Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282bf2eeab3Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283bf2eeab3Smrg        break
284bf2eeab3Smrg      fi
285bf2eeab3Smrg    fi
286bf2eeab3Smrg  done
287bf2eeab3Smrg
288bf2eeab3Smrg  cd ..
289bf2eeab3Smrg  rm -rf conftest.dir
29014c0a534Smrgelse
291bf2eeab3Smrg  am_cv_$1_dependencies_compiler_type=none
29214c0a534Smrgfi
293bf2eeab3Smrg])
294bf2eeab3SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295bf2eeab3SmrgAM_CONDITIONAL([am__fastdep$1], [
296bf2eeab3Smrg  test "x$enable_dependency_tracking" != xno \
297bf2eeab3Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298bf2eeab3Smrg])
29914c0a534Smrg
30014c0a534Smrg
301bf2eeab3Smrg# AM_SET_DEPDIR
302bf2eeab3Smrg# -------------
303bf2eeab3Smrg# Choose a directory name for dependency files.
30424047306Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305bf2eeab3SmrgAC_DEFUN([AM_SET_DEPDIR],
306bf2eeab3Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307bf2eeab3SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308bf2eeab3Smrg])
30914c0a534Smrg
31014c0a534Smrg
311bf2eeab3Smrg# AM_DEP_TRACK
312bf2eeab3Smrg# ------------
313bf2eeab3SmrgAC_DEFUN([AM_DEP_TRACK],
31424047306Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31524047306SmrgAS_HELP_STRING(
31624047306Smrg  [--enable-dependency-tracking],
31724047306Smrg  [do not reject slow dependency extractors])
31824047306SmrgAS_HELP_STRING(
31924047306Smrg  [--disable-dependency-tracking],
32024047306Smrg  [speeds up one-time build])])
321bf2eeab3Smrgif test "x$enable_dependency_tracking" != xno; then
322bf2eeab3Smrg  am_depcomp="$ac_aux_dir/depcomp"
323bf2eeab3Smrg  AMDEPBACKSLASH='\'
32424047306Smrg  am__nodep='_no'
32514c0a534Smrgfi
326bf2eeab3SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327bf2eeab3SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328bf2eeab3Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32924047306SmrgAC_SUBST([am__nodep])dnl
33024047306Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331bf2eeab3Smrg])
33214c0a534Smrg
333bf2eeab3Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334bf2eeab3Smrg
33524047306Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
336bf2eeab3Smrg#
337bf2eeab3Smrg# This file is free software; the Free Software Foundation
338bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
339bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
340bf2eeab3Smrg
341bf2eeab3Smrg
342bf2eeab3Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
343bf2eeab3Smrg# ------------------------------
344bf2eeab3SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
345bf2eeab3Smrg[{
34624047306Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
347bf2eeab3Smrg  # are listed without --file.  Let's play safe and only enable the eval
348bf2eeab3Smrg  # if we detect the quoting.
349bf2eeab3Smrg  case $CONFIG_FILES in
350bf2eeab3Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
351bf2eeab3Smrg  *)   set x $CONFIG_FILES ;;
352bf2eeab3Smrg  esac
353bf2eeab3Smrg  shift
354bf2eeab3Smrg  for mf
355bf2eeab3Smrg  do
356bf2eeab3Smrg    # Strip MF so we end up with the name of the file.
357bf2eeab3Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
358bf2eeab3Smrg    # Check whether this is an Automake generated Makefile or not.
35924047306Smrg    # We used to match only the files named 'Makefile.in', but
360bf2eeab3Smrg    # some people rename them; so instead we look at the file content.
361bf2eeab3Smrg    # Grep'ing the first line is not enough: some people post-process
362bf2eeab3Smrg    # each Makefile.in and add a new line on top of each file to say so.
363bf2eeab3Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
364bf2eeab3Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
365bf2eeab3Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
366bf2eeab3Smrg      dirpart=`AS_DIRNAME("$mf")`
367bf2eeab3Smrg    else
368bf2eeab3Smrg      continue
369bf2eeab3Smrg    fi
370bf2eeab3Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
37124047306Smrg    # from the Makefile without running 'make'.
372bf2eeab3Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
373bf2eeab3Smrg    test -z "$DEPDIR" && continue
374bf2eeab3Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
37524047306Smrg    test -z "$am__include" && continue
376bf2eeab3Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
377bf2eeab3Smrg    # Find all dependency output files, they are included files with
378bf2eeab3Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379bf2eeab3Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380bf2eeab3Smrg    # expansion.
381bf2eeab3Smrg    for file in `sed -n "
382bf2eeab3Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
38324047306Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
384bf2eeab3Smrg      # Make sure the directory exists.
385bf2eeab3Smrg      test -f "$dirpart/$file" && continue
386bf2eeab3Smrg      fdir=`AS_DIRNAME(["$file"])`
387bf2eeab3Smrg      AS_MKDIR_P([$dirpart/$fdir])
388bf2eeab3Smrg      # echo "creating $dirpart/$file"
389bf2eeab3Smrg      echo '# dummy' > "$dirpart/$file"
390bf2eeab3Smrg    done
391bf2eeab3Smrg  done
392bf2eeab3Smrg}
393bf2eeab3Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394bf2eeab3Smrg
395bf2eeab3Smrg
396bf2eeab3Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
397bf2eeab3Smrg# -----------------------------
398bf2eeab3Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
399bf2eeab3Smrg#
400bf2eeab3Smrg# This code is only required when automatic dependency tracking
40124047306Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
402bf2eeab3Smrg# need in order to bootstrap the dependency handling code.
403bf2eeab3SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
404bf2eeab3Smrg[AC_CONFIG_COMMANDS([depfiles],
405bf2eeab3Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
406bf2eeab3Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
407bf2eeab3Smrg])
408bf2eeab3Smrg
409bf2eeab3Smrg# Do all the work for Automake.                             -*- Autoconf -*-
410bf2eeab3Smrg
41124047306Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
412bf2eeab3Smrg#
413bf2eeab3Smrg# This file is free software; the Free Software Foundation
414bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
415bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
416bf2eeab3Smrg
417bf2eeab3Smrg# This macro actually does too much.  Some checks are only needed if
418bf2eeab3Smrg# your package does certain things.  But this isn't really a big deal.
419bf2eeab3Smrg
42024047306Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
42124047306Smrgm4_define([AC_PROG_CC],
42224047306Smrgm4_defn([AC_PROG_CC])
42324047306Smrg[_AM_PROG_CC_C_O
42424047306Smrg])
42524047306Smrg
426bf2eeab3Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
427bf2eeab3Smrg# AM_INIT_AUTOMAKE([OPTIONS])
428bf2eeab3Smrg# -----------------------------------------------
429bf2eeab3Smrg# The call with PACKAGE and VERSION arguments is the old style
430bf2eeab3Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
431bf2eeab3Smrg# and VERSION should now be passed to AC_INIT and removed from
432bf2eeab3Smrg# the call to AM_INIT_AUTOMAKE.
433bf2eeab3Smrg# We support both call styles for the transition.  After
434bf2eeab3Smrg# the next Automake release, Autoconf can make the AC_INIT
435bf2eeab3Smrg# arguments mandatory, and then we can depend on a new Autoconf
436bf2eeab3Smrg# release and drop the old call support.
437bf2eeab3SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43824047306Smrg[AC_PREREQ([2.65])dnl
439bf2eeab3Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
440bf2eeab3Smrgdnl the ones we care about.
441bf2eeab3Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
442bf2eeab3SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
443bf2eeab3SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
444bf2eeab3Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
445bf2eeab3Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
446bf2eeab3Smrg  # is not polluted with repeated "-I."
447bf2eeab3Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
448bf2eeab3Smrg  # test to see if srcdir already configured
449bf2eeab3Smrg  if test -f $srcdir/config.status; then
450bf2eeab3Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
451bf2eeab3Smrg  fi
45214c0a534Smrgfi
45314c0a534Smrg
454bf2eeab3Smrg# test whether we have cygpath
455bf2eeab3Smrgif test -z "$CYGPATH_W"; then
456bf2eeab3Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
457bf2eeab3Smrg    CYGPATH_W='cygpath -w'
458bf2eeab3Smrg  else
459bf2eeab3Smrg    CYGPATH_W=echo
460bf2eeab3Smrg  fi
46114c0a534Smrgfi
462bf2eeab3SmrgAC_SUBST([CYGPATH_W])
463bf2eeab3Smrg
464bf2eeab3Smrg# Define the identity of the package.
465bf2eeab3Smrgdnl Distinguish between old-style and new-style calls.
466bf2eeab3Smrgm4_ifval([$2],
46724047306Smrg[AC_DIAGNOSE([obsolete],
46824047306Smrg             [$0: two- and three-arguments forms are deprecated.])
46924047306Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
470bf2eeab3Smrg AC_SUBST([PACKAGE], [$1])dnl
471bf2eeab3Smrg AC_SUBST([VERSION], [$2])],
472bf2eeab3Smrg[_AM_SET_OPTIONS([$1])dnl
473bf2eeab3Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47424047306Smrgm4_if(
47524047306Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
47624047306Smrg  [ok:ok],,
477bf2eeab3Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
478bf2eeab3Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
479bf2eeab3Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
480bf2eeab3Smrg
481bf2eeab3Smrg_AM_IF_OPTION([no-define],,
48224047306Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
48324047306Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
484bf2eeab3Smrg
485bf2eeab3Smrg# Some tools Automake needs.
486bf2eeab3SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
487bf2eeab3SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48824047306SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48924047306SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
49024047306SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
49124047306SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
49224047306SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
493bf2eeab3SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
494bf2eeab3SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49524047306SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49624047306Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49724047306Smrg# dies out for good.  For more background, see:
49824047306Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49924047306Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
50024047306SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
50124047306Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
50224047306Smrg# system "awk" is bad on some platforms.
503bf2eeab3SmrgAC_REQUIRE([AC_PROG_AWK])dnl
504bf2eeab3SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
505bf2eeab3SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
506bf2eeab3Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
507bf2eeab3Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
508bf2eeab3Smrg			     [_AM_PROG_TAR([v7])])])
509bf2eeab3Smrg_AM_IF_OPTION([no-dependencies],,
510bf2eeab3Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
51124047306Smrg		  [_AM_DEPENDENCIES([CC])],
51224047306Smrg		  [m4_define([AC_PROG_CC],
51324047306Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
514bf2eeab3SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51524047306Smrg		  [_AM_DEPENDENCIES([CXX])],
51624047306Smrg		  [m4_define([AC_PROG_CXX],
51724047306Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
518bf2eeab3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51924047306Smrg		  [_AM_DEPENDENCIES([OBJC])],
52024047306Smrg		  [m4_define([AC_PROG_OBJC],
52124047306Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
52224047306SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
52324047306Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52424047306Smrg		  [m4_define([AC_PROG_OBJCXX],
52524047306Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
526bf2eeab3Smrg])
52724047306SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
52824047306Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
52924047306Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
53024047306Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
531bf2eeab3SmrgAC_CONFIG_COMMANDS_PRE(dnl
532bf2eeab3Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
533bf2eeab3Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
53424047306Smrg
53524047306Smrg# POSIX will say in a future version that running "rm -f" with no argument
53624047306Smrg# is OK; and we want to be able to make that assumption in our Makefile
53724047306Smrg# recipes.  So use an aggressive probe to check that the usage we want is
53824047306Smrg# actually supported "in the wild" to an acceptable degree.
53924047306Smrg# See automake bug#10828.
54024047306Smrg# To make any issue more visible, cause the running configure to be aborted
54124047306Smrg# by default if the 'rm' program in use doesn't match our expectations; the
54224047306Smrg# user can still override this though.
54324047306Smrgif rm -f && rm -fr && rm -rf; then : OK; else
54424047306Smrg  cat >&2 <<'END'
54524047306SmrgOops!
54624047306Smrg
54724047306SmrgYour 'rm' program seems unable to run without file operands specified
54824047306Smrgon the command line, even when the '-f' option is present.  This is contrary
54924047306Smrgto the behaviour of most rm programs out there, and not conforming with
55024047306Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
55124047306Smrg
55224047306SmrgPlease tell bug-automake@gnu.org about your system, including the value
55324047306Smrgof your $PATH and any error possibly output before this message.  This
55424047306Smrgcan help us improve future automake versions.
55524047306Smrg
55624047306SmrgEND
55724047306Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
55824047306Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
55924047306Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
56024047306Smrg    echo >&2
56124047306Smrg  else
56224047306Smrg    cat >&2 <<'END'
56324047306SmrgAborting the configuration process, to ensure you take notice of the issue.
56424047306Smrg
56524047306SmrgYou can download and install GNU coreutils to get an 'rm' implementation
56624047306Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
56724047306Smrg
56824047306SmrgIf you want to complete the configuration process using your problematic
56924047306Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
57024047306Smrgto "yes", and re-run configure.
57124047306Smrg
57224047306SmrgEND
57324047306Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
57424047306Smrg  fi
57524047306Smrgfi
57624047306Smrgdnl The trailing newline in this macro's definition is deliberate, for
57724047306Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
57824047306Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
579bf2eeab3Smrg])
580bf2eeab3Smrg
58124047306Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
582bf2eeab3Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
583bf2eeab3Smrgdnl mangled by Autoconf and run in a shell conditional statement.
584bf2eeab3Smrgm4_define([_AC_COMPILER_EXEEXT],
585bf2eeab3Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
586bf2eeab3Smrg
587bf2eeab3Smrg# When config.status generates a header, we must update the stamp-h file.
588bf2eeab3Smrg# This file resides in the same directory as the config header
589bf2eeab3Smrg# that is generated.  The stamp files are numbered to have different names.
590bf2eeab3Smrg
591bf2eeab3Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
592bf2eeab3Smrg# loop where config.status creates the headers, so we can generate
593bf2eeab3Smrg# our stamp files there.
594bf2eeab3SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
595bf2eeab3Smrg[# Compute $1's index in $config_headers.
596bf2eeab3Smrg_am_arg=$1
597bf2eeab3Smrg_am_stamp_count=1
598bf2eeab3Smrgfor _am_header in $config_headers :; do
599bf2eeab3Smrg  case $_am_header in
600bf2eeab3Smrg    $_am_arg | $_am_arg:* )
601bf2eeab3Smrg      break ;;
602bf2eeab3Smrg    * )
603bf2eeab3Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
604bf2eeab3Smrg  esac
605bf2eeab3Smrgdone
606bf2eeab3Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
607bf2eeab3Smrg
60824047306Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
609bf2eeab3Smrg#
610bf2eeab3Smrg# This file is free software; the Free Software Foundation
611bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
612bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
613bf2eeab3Smrg
614bf2eeab3Smrg# AM_PROG_INSTALL_SH
615bf2eeab3Smrg# ------------------
616bf2eeab3Smrg# Define $install_sh.
617bf2eeab3SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
618bf2eeab3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
61924047306Smrgif test x"${install_sh+set}" != xset; then
620bf2eeab3Smrg  case $am_aux_dir in
621bf2eeab3Smrg  *\ * | *\	*)
622bf2eeab3Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
623bf2eeab3Smrg  *)
624bf2eeab3Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
625bf2eeab3Smrg  esac
62614c0a534Smrgfi
62724047306SmrgAC_SUBST([install_sh])])
62814c0a534Smrg
62924047306Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
630bf2eeab3Smrg#
631bf2eeab3Smrg# This file is free software; the Free Software Foundation
632bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
633bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
634bf2eeab3Smrg
635bf2eeab3Smrg# Check whether the underlying file-system supports filenames
636bf2eeab3Smrg# with a leading dot.  For instance MS-DOS doesn't.
637bf2eeab3SmrgAC_DEFUN([AM_SET_LEADING_DOT],
638bf2eeab3Smrg[rm -rf .tst 2>/dev/null
639bf2eeab3Smrgmkdir .tst 2>/dev/null
640bf2eeab3Smrgif test -d .tst; then
641bf2eeab3Smrg  am__leading_dot=.
642bf2eeab3Smrgelse
643bf2eeab3Smrg  am__leading_dot=_
64414c0a534Smrgfi
645bf2eeab3Smrgrmdir .tst 2>/dev/null
646bf2eeab3SmrgAC_SUBST([am__leading_dot])])
647bf2eeab3Smrg
648bf2eeab3Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
649bf2eeab3Smrg
65024047306Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
651bf2eeab3Smrg#
652bf2eeab3Smrg# This file is free software; the Free Software Foundation
653bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
654bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
655bf2eeab3Smrg
656bf2eeab3Smrg# AM_MAKE_INCLUDE()
657bf2eeab3Smrg# -----------------
658bf2eeab3Smrg# Check to see how make treats includes.
659bf2eeab3SmrgAC_DEFUN([AM_MAKE_INCLUDE],
660bf2eeab3Smrg[am_make=${MAKE-make}
661bf2eeab3Smrgcat > confinc << 'END'
662bf2eeab3Smrgam__doit:
663bf2eeab3Smrg	@echo this is the am__doit target
664bf2eeab3Smrg.PHONY: am__doit
665bf2eeab3SmrgEND
666bf2eeab3Smrg# If we don't find an include directive, just comment out the code.
667bf2eeab3SmrgAC_MSG_CHECKING([for style of include used by $am_make])
668bf2eeab3Smrgam__include="#"
669bf2eeab3Smrgam__quote=
670bf2eeab3Smrg_am_result=none
671bf2eeab3Smrg# First try GNU make style include.
672bf2eeab3Smrgecho "include confinc" > confmf
67324047306Smrg# Ignore all kinds of additional output from 'make'.
674bf2eeab3Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
675bf2eeab3Smrg*the\ am__doit\ target*)
676bf2eeab3Smrg  am__include=include
677bf2eeab3Smrg  am__quote=
678bf2eeab3Smrg  _am_result=GNU
679bf2eeab3Smrg  ;;
680bf2eeab3Smrgesac
681bf2eeab3Smrg# Now try BSD make style include.
682bf2eeab3Smrgif test "$am__include" = "#"; then
683bf2eeab3Smrg   echo '.include "confinc"' > confmf
684bf2eeab3Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
685bf2eeab3Smrg   *the\ am__doit\ target*)
686bf2eeab3Smrg     am__include=.include
687bf2eeab3Smrg     am__quote="\""
688bf2eeab3Smrg     _am_result=BSD
689bf2eeab3Smrg     ;;
690bf2eeab3Smrg   esac
69114c0a534Smrgfi
692bf2eeab3SmrgAC_SUBST([am__include])
693bf2eeab3SmrgAC_SUBST([am__quote])
694bf2eeab3SmrgAC_MSG_RESULT([$_am_result])
695bf2eeab3Smrgrm -f confinc confmf
696bf2eeab3Smrg])
69714c0a534Smrg
698bf2eeab3Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
699bf2eeab3Smrg
70024047306Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
701bf2eeab3Smrg#
702bf2eeab3Smrg# This file is free software; the Free Software Foundation
703bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
704bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
705bf2eeab3Smrg
706bf2eeab3Smrg# AM_MISSING_PROG(NAME, PROGRAM)
707bf2eeab3Smrg# ------------------------------
708bf2eeab3SmrgAC_DEFUN([AM_MISSING_PROG],
709bf2eeab3Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
710bf2eeab3Smrg$1=${$1-"${am_missing_run}$2"}
711bf2eeab3SmrgAC_SUBST($1)])
712bf2eeab3Smrg
713bf2eeab3Smrg# AM_MISSING_HAS_RUN
714bf2eeab3Smrg# ------------------
71524047306Smrg# Define MISSING if not defined so far and test if it is modern enough.
71624047306Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
717bf2eeab3SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
718bf2eeab3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
719bf2eeab3SmrgAC_REQUIRE_AUX_FILE([missing])dnl
720bf2eeab3Smrgif test x"${MISSING+set}" != xset; then
721bf2eeab3Smrg  case $am_aux_dir in
722bf2eeab3Smrg  *\ * | *\	*)
723bf2eeab3Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
724bf2eeab3Smrg  *)
725bf2eeab3Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
726bf2eeab3Smrg  esac
72714c0a534Smrgfi
728bf2eeab3Smrg# Use eval to expand $SHELL
72924047306Smrgif eval "$MISSING --is-lightweight"; then
73024047306Smrg  am_missing_run="$MISSING "
731bf2eeab3Smrgelse
732bf2eeab3Smrg  am_missing_run=
73324047306Smrg  AC_MSG_WARN(['missing' script is too old or missing])
73414c0a534Smrgfi
735bf2eeab3Smrg])
73614c0a534Smrg
737bf2eeab3Smrg# Helper functions for option handling.                     -*- Autoconf -*-
738bf2eeab3Smrg
73924047306Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
740bf2eeab3Smrg#
741bf2eeab3Smrg# This file is free software; the Free Software Foundation
742bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
743bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
744bf2eeab3Smrg
745bf2eeab3Smrg# _AM_MANGLE_OPTION(NAME)
746bf2eeab3Smrg# -----------------------
747bf2eeab3SmrgAC_DEFUN([_AM_MANGLE_OPTION],
748bf2eeab3Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
749bf2eeab3Smrg
750bf2eeab3Smrg# _AM_SET_OPTION(NAME)
75124047306Smrg# --------------------
752bf2eeab3Smrg# Set option NAME.  Presently that only means defining a flag for this option.
753bf2eeab3SmrgAC_DEFUN([_AM_SET_OPTION],
75424047306Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
755bf2eeab3Smrg
756bf2eeab3Smrg# _AM_SET_OPTIONS(OPTIONS)
75724047306Smrg# ------------------------
758bf2eeab3Smrg# OPTIONS is a space-separated list of Automake options.
759bf2eeab3SmrgAC_DEFUN([_AM_SET_OPTIONS],
760bf2eeab3Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
76114c0a534Smrg
762bf2eeab3Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
763bf2eeab3Smrg# -------------------------------------------
764bf2eeab3Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
765bf2eeab3SmrgAC_DEFUN([_AM_IF_OPTION],
766bf2eeab3Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76714c0a534Smrg
76824047306Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
76924047306Smrg#
77024047306Smrg# This file is free software; the Free Software Foundation
77124047306Smrg# gives unlimited permission to copy and/or distribute it,
77224047306Smrg# with or without modifications, as long as this notice is preserved.
77324047306Smrg
77424047306Smrg# _AM_PROG_CC_C_O
77524047306Smrg# ---------------
77624047306Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77724047306Smrg# to automatically call this.
77824047306SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77924047306Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
78024047306SmrgAC_REQUIRE_AUX_FILE([compile])dnl
78124047306SmrgAC_LANG_PUSH([C])dnl
78224047306SmrgAC_CACHE_CHECK(
78324047306Smrg  [whether $CC understands -c and -o together],
78424047306Smrg  [am_cv_prog_cc_c_o],
78524047306Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78624047306Smrg  # Make sure it works both with $CC and with simple cc.
78724047306Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78824047306Smrg  # compilers refuse to overwrite an existing .o file with -o,
78924047306Smrg  # though they will create one.
79024047306Smrg  am_cv_prog_cc_c_o=yes
79124047306Smrg  for am_i in 1 2; do
79224047306Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79324047306Smrg         && test -f conftest2.$ac_objext; then
79424047306Smrg      : OK
79524047306Smrg    else
79624047306Smrg      am_cv_prog_cc_c_o=no
79724047306Smrg      break
79824047306Smrg    fi
79924047306Smrg  done
80024047306Smrg  rm -f core conftest*
80124047306Smrg  unset am_i])
80224047306Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80324047306Smrg   # Losing compiler, so override with the script.
80424047306Smrg   # FIXME: It is wrong to rewrite CC.
80524047306Smrg   # But if we don't then we get into trouble of one sort or another.
80624047306Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80724047306Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80824047306Smrg   CC="$am_aux_dir/compile $CC"
80924047306Smrgfi
81024047306SmrgAC_LANG_POP([C])])
81114c0a534Smrg
81224047306Smrg# For backward compatibility.
81324047306SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
81424047306Smrg
81524047306Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
816bf2eeab3Smrg#
817bf2eeab3Smrg# This file is free software; the Free Software Foundation
818bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
819bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
82014c0a534Smrg
82124047306Smrg# AM_RUN_LOG(COMMAND)
82224047306Smrg# -------------------
82324047306Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82424047306Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82524047306SmrgAC_DEFUN([AM_RUN_LOG],
82624047306Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82724047306Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82824047306Smrg   ac_status=$?
82924047306Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
83024047306Smrg   (exit $ac_status); }])
83124047306Smrg
83224047306Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83324047306Smrg
83424047306Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
83524047306Smrg#
83624047306Smrg# This file is free software; the Free Software Foundation
83724047306Smrg# gives unlimited permission to copy and/or distribute it,
83824047306Smrg# with or without modifications, as long as this notice is preserved.
83914c0a534Smrg
840bf2eeab3Smrg# AM_SANITY_CHECK
841bf2eeab3Smrg# ---------------
842bf2eeab3SmrgAC_DEFUN([AM_SANITY_CHECK],
843bf2eeab3Smrg[AC_MSG_CHECKING([whether build environment is sane])
844bf2eeab3Smrg# Reject unsafe characters in $srcdir or the absolute working directory
845bf2eeab3Smrg# name.  Accept space and tab only in the latter.
846bf2eeab3Smrgam_lf='
847bf2eeab3Smrg'
848bf2eeab3Smrgcase `pwd` in
849bf2eeab3Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
850bf2eeab3Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
851bf2eeab3Smrgesac
852bf2eeab3Smrgcase $srcdir in
853bf2eeab3Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85424047306Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
855bf2eeab3Smrgesac
85614c0a534Smrg
85724047306Smrg# Do 'set' in a subshell so we don't clobber the current shell's
858bf2eeab3Smrg# arguments.  Must try -L first in case configure is actually a
859bf2eeab3Smrg# symlink; some systems play weird games with the mod time of symlinks
860bf2eeab3Smrg# (eg FreeBSD returns the mod time of the symlink's containing
861bf2eeab3Smrg# directory).
862bf2eeab3Smrgif (
86324047306Smrg   am_has_slept=no
86424047306Smrg   for am_try in 1 2; do
86524047306Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86624047306Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86724047306Smrg     if test "$[*]" = "X"; then
86824047306Smrg	# -L didn't work.
86924047306Smrg	set X `ls -t "$srcdir/configure" conftest.file`
87024047306Smrg     fi
87124047306Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87224047306Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87324047306Smrg
87424047306Smrg	# If neither matched, then we have a broken ls.  This can happen
87524047306Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87624047306Smrg	# broken ls alias from the environment.  This has actually
87724047306Smrg	# happened.  Such a system could not be considered "sane".
87824047306Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87924047306Smrg  alias in your environment])
88024047306Smrg     fi
88124047306Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88224047306Smrg       break
88324047306Smrg     fi
88424047306Smrg     # Just in case.
88524047306Smrg     sleep 1
88624047306Smrg     am_has_slept=yes
88724047306Smrg   done
888bf2eeab3Smrg   test "$[2]" = conftest.file
889bf2eeab3Smrg   )
890bf2eeab3Smrgthen
891bf2eeab3Smrg   # Ok.
892bf2eeab3Smrg   :
89314c0a534Smrgelse
894bf2eeab3Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
895bf2eeab3SmrgCheck your system clock])
89614c0a534Smrgfi
89724047306SmrgAC_MSG_RESULT([yes])
89824047306Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89924047306Smrg# generated files are strictly newer.
90024047306Smrgam_sleep_pid=
90124047306Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90224047306Smrg  ( sleep 1 ) &
90324047306Smrg  am_sleep_pid=$!
90424047306Smrgfi
90524047306SmrgAC_CONFIG_COMMANDS_PRE(
90624047306Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90724047306Smrg   if test -n "$am_sleep_pid"; then
90824047306Smrg     # Hide warnings about reused PIDs.
90924047306Smrg     wait $am_sleep_pid 2>/dev/null
91024047306Smrg   fi
91124047306Smrg   AC_MSG_RESULT([done])])
91224047306Smrgrm -f conftest.file
91324047306Smrg])
91414c0a534Smrg
91524047306Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
916bf2eeab3Smrg#
917bf2eeab3Smrg# This file is free software; the Free Software Foundation
918bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
919bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
92014c0a534Smrg
921bf2eeab3Smrg# AM_SILENT_RULES([DEFAULT])
922bf2eeab3Smrg# --------------------------
923bf2eeab3Smrg# Enable less verbose build rules; with the default set to DEFAULT
92424047306Smrg# ("yes" being less verbose, "no" or empty being verbose).
925bf2eeab3SmrgAC_DEFUN([AM_SILENT_RULES],
92624047306Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92724047306SmrgAS_HELP_STRING(
92824047306Smrg  [--enable-silent-rules],
92924047306Smrg  [less verbose build output (undo: "make V=1")])
93024047306SmrgAS_HELP_STRING(
93124047306Smrg  [--disable-silent-rules],
93224047306Smrg  [verbose build output (undo: "make V=0")])dnl
93324047306Smrg])
93424047306Smrgcase $enable_silent_rules in @%:@ (((
93524047306Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93624047306Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93724047306Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
938bf2eeab3Smrgesac
93924047306Smrgdnl
94024047306Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
94124047306Smrgdnl do not support nested variable expansions.
94224047306Smrgdnl See automake bug#9928 and bug#10237.
94324047306Smrgam_make=${MAKE-make}
94424047306SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94524047306Smrg   [am_cv_make_support_nested_variables],
94624047306Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94724047306SmrgBAR0=false
94824047306SmrgBAR1=true
94924047306SmrgV=1
95024047306Smrgam__doit:
95124047306Smrg	@$(TRUE)
95224047306Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95324047306Smrg  am_cv_make_support_nested_variables=yes
95424047306Smrgelse
95524047306Smrg  am_cv_make_support_nested_variables=no
95624047306Smrgfi])
95724047306Smrgif test $am_cv_make_support_nested_variables = yes; then
95824047306Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95924047306Smrg  AM_V='$(V)'
96024047306Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
96124047306Smrgelse
96224047306Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96324047306Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
96424047306Smrgfi
96524047306SmrgAC_SUBST([AM_V])dnl
96624047306SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96724047306SmrgAC_SUBST([AM_DEFAULT_V])dnl
96824047306SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
969bf2eeab3SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
970bf2eeab3SmrgAM_BACKSLASH='\'
971bf2eeab3SmrgAC_SUBST([AM_BACKSLASH])dnl
972bf2eeab3Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
973bf2eeab3Smrg])
97414c0a534Smrg
97524047306Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
976bf2eeab3Smrg#
977bf2eeab3Smrg# This file is free software; the Free Software Foundation
978bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
979bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
98014c0a534Smrg
981bf2eeab3Smrg# AM_PROG_INSTALL_STRIP
982bf2eeab3Smrg# ---------------------
98324047306Smrg# One issue with vendor 'install' (even GNU) is that you can't
984bf2eeab3Smrg# specify the program used to strip binaries.  This is especially
985bf2eeab3Smrg# annoying in cross-compiling environments, where the build's strip
986bf2eeab3Smrg# is unlikely to handle the host's binaries.
987bf2eeab3Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98824047306Smrg# always use install-sh in "make install-strip", and initialize
989bf2eeab3Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
990bf2eeab3SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
991bf2eeab3Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99224047306Smrg# Installed binaries are usually stripped using 'strip' when the user
99324047306Smrg# run "make install-strip".  However 'strip' might not be the right
994bf2eeab3Smrg# tool to use in cross-compilation environments, therefore Automake
99524047306Smrg# will honor the 'STRIP' environment variable to overrule this program.
99624047306Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
997bf2eeab3Smrgif test "$cross_compiling" != no; then
998bf2eeab3Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
99914c0a534Smrgfi
1000bf2eeab3SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1001bf2eeab3SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100214c0a534Smrg
100324047306Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
1004bf2eeab3Smrg#
1005bf2eeab3Smrg# This file is free software; the Free Software Foundation
1006bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
1007bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
100814c0a534Smrg
1009bf2eeab3Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1010bf2eeab3Smrg# ---------------------------
1011bf2eeab3Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1012bf2eeab3Smrg# This macro is traced by Automake.
1013bf2eeab3SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101414c0a534Smrg
1015bf2eeab3Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101624047306Smrg# --------------------------
1017bf2eeab3Smrg# Public sister of _AM_SUBST_NOTMAKE.
1018bf2eeab3SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101914c0a534Smrg
1020bf2eeab3Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1021bf2eeab3Smrg
102224047306Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
102314c0a534Smrg#
102414c0a534Smrg# This file is free software; the Free Software Foundation
102514c0a534Smrg# gives unlimited permission to copy and/or distribute it,
102614c0a534Smrg# with or without modifications, as long as this notice is preserved.
102714c0a534Smrg
1028bf2eeab3Smrg# _AM_PROG_TAR(FORMAT)
1029bf2eeab3Smrg# --------------------
1030bf2eeab3Smrg# Check how to create a tarball in format FORMAT.
103124047306Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1032bf2eeab3Smrg#
1033bf2eeab3Smrg# Substitute a variable $(am__tar) that is a command
1034bf2eeab3Smrg# writing to stdout a FORMAT-tarball containing the directory
1035bf2eeab3Smrg# $tardir.
1036bf2eeab3Smrg#     tardir=directory && $(am__tar) > result.tar
1037bf2eeab3Smrg#
1038bf2eeab3Smrg# Substitute a variable $(am__untar) that extract such
1039bf2eeab3Smrg# a tarball read from stdin.
1040bf2eeab3Smrg#     $(am__untar) < result.tar
104124047306Smrg#
1042bf2eeab3SmrgAC_DEFUN([_AM_PROG_TAR],
104324047306Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104424047306Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104524047306SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
104624047306Smrg
104724047306Smrg# We'll loop over all known methods to create a tar archive until one works.
1048bf2eeab3Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1049bf2eeab3Smrg
105024047306Smrgm4_if([$1], [v7],
105124047306Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
105224047306Smrg
105324047306Smrg  [m4_case([$1],
105424047306Smrg    [ustar],
105524047306Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105624047306Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105724047306Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105824047306Smrg      # and bug#13588).
105924047306Smrg      am_max_uid=2097151 # 2^21 - 1
106024047306Smrg      am_max_gid=$am_max_uid
106124047306Smrg      # The $UID and $GID variables are not portable, so we need to resort
106224047306Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106324047306Smrg      # below are definitely unexpected, so allow the users to see them
106424047306Smrg      # (that is, avoid stderr redirection).
106524047306Smrg      am_uid=`id -u || echo unknown`
106624047306Smrg      am_gid=`id -g || echo unknown`
106724047306Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106824047306Smrg      if test $am_uid -le $am_max_uid; then
106924047306Smrg         AC_MSG_RESULT([yes])
107024047306Smrg      else
107124047306Smrg         AC_MSG_RESULT([no])
107224047306Smrg         _am_tools=none
107324047306Smrg      fi
107424047306Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107524047306Smrg      if test $am_gid -le $am_max_gid; then
107624047306Smrg         AC_MSG_RESULT([yes])
107724047306Smrg      else
107824047306Smrg        AC_MSG_RESULT([no])
107924047306Smrg        _am_tools=none
108024047306Smrg      fi],
108124047306Smrg
108224047306Smrg  [pax],
108324047306Smrg    [],
108424047306Smrg
108524047306Smrg  [m4_fatal([Unknown tar format])])
108624047306Smrg
108724047306Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108824047306Smrg
108924047306Smrg  # Go ahead even if we have the value already cached.  We do so because we
109024047306Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
109124047306Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
109224047306Smrg
109324047306Smrg  for _am_tool in $_am_tools; do
109424047306Smrg    case $_am_tool in
109524047306Smrg    gnutar)
109624047306Smrg      for _am_tar in tar gnutar gtar; do
109724047306Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109824047306Smrg      done
109924047306Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
110024047306Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
110124047306Smrg      am__untar="$_am_tar -xf -"
110224047306Smrg      ;;
110324047306Smrg    plaintar)
110424047306Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110524047306Smrg      # ustar tarball either.
110624047306Smrg      (tar --version) >/dev/null 2>&1 && continue
110724047306Smrg      am__tar='tar chf - "$$tardir"'
110824047306Smrg      am__tar_='tar chf - "$tardir"'
110924047306Smrg      am__untar='tar xf -'
111024047306Smrg      ;;
111124047306Smrg    pax)
111224047306Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111324047306Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111424047306Smrg      am__untar='pax -r'
111524047306Smrg      ;;
111624047306Smrg    cpio)
111724047306Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111824047306Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111924047306Smrg      am__untar='cpio -i -H $1 -d'
112024047306Smrg      ;;
112124047306Smrg    none)
112224047306Smrg      am__tar=false
112324047306Smrg      am__tar_=false
112424047306Smrg      am__untar=false
112524047306Smrg      ;;
112624047306Smrg    esac
112714c0a534Smrg
112824047306Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112924047306Smrg    # and am__untar set.
113024047306Smrg    test -n "${am_cv_prog_tar_$1}" && break
113124047306Smrg
113224047306Smrg    # tar/untar a dummy directory, and stop if the command works.
113324047306Smrg    rm -rf conftest.dir
113424047306Smrg    mkdir conftest.dir
113524047306Smrg    echo GrepMe > conftest.dir/file
113624047306Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113724047306Smrg    rm -rf conftest.dir
113824047306Smrg    if test -s conftest.tar; then
113924047306Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
114024047306Smrg      AM_RUN_LOG([cat conftest.dir/file])
114124047306Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114224047306Smrg    fi
114324047306Smrg  done
1144bf2eeab3Smrg  rm -rf conftest.dir
114514c0a534Smrg
114624047306Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114724047306Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
114824047306Smrg
1149bf2eeab3SmrgAC_SUBST([am__tar])
1150bf2eeab3SmrgAC_SUBST([am__untar])
1151bf2eeab3Smrg]) # _AM_PROG_TAR
115214c0a534Smrg
115324047306Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
115424047306Smrg# 
115524047306Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115624047306Smrg#
115724047306Smrg# This program is free software; you can redistribute it and/or modify
115824047306Smrg# it under the terms of the GNU General Public License as published by
115924047306Smrg# the Free Software Foundation; either version 2 of the License, or
116024047306Smrg# (at your option) any later version.
116124047306Smrg#
116224047306Smrg# This program is distributed in the hope that it will be useful, but
116324047306Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
116424047306Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
116524047306Smrg# General Public License for more details.
116624047306Smrg#
116724047306Smrg# You should have received a copy of the GNU General Public License
116824047306Smrg# along with this program; if not, write to the Free Software
116924047306Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
117024047306Smrg#
117124047306Smrg# As a special exception to the GNU General Public License, if you
117224047306Smrg# distribute this file as part of a program that contains a
117324047306Smrg# configuration script generated by Autoconf, you may include it under
117424047306Smrg# the same distribution terms that you use for the rest of that program.
117524047306Smrg
117624047306Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
117724047306Smrg# ----------------------------------
117824047306SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
117924047306Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
118024047306Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
118124047306SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
118224047306Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
118324047306Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
118424047306Smrgfi
118524047306Smrgif test -n "$PKG_CONFIG"; then
118624047306Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
118724047306Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
118824047306Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
118924047306Smrg		AC_MSG_RESULT([yes])
119024047306Smrg	else
119124047306Smrg		AC_MSG_RESULT([no])
119224047306Smrg		PKG_CONFIG=""
119324047306Smrg	fi
119424047306Smrg		
119524047306Smrgfi[]dnl
119624047306Smrg])# PKG_PROG_PKG_CONFIG
119724047306Smrg
119824047306Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
119924047306Smrg#
120024047306Smrg# Check to see whether a particular set of modules exists.  Similar
120124047306Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
120224047306Smrg#
120324047306Smrg#
120424047306Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
120524047306Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
120624047306Smrg# PKG_CHECK_EXISTS manually
120724047306Smrg# --------------------------------------------------------------
120824047306SmrgAC_DEFUN([PKG_CHECK_EXISTS],
120924047306Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
121024047306Smrgif test -n "$PKG_CONFIG" && \
121124047306Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
121224047306Smrg  m4_ifval([$2], [$2], [:])
121324047306Smrgm4_ifvaln([$3], [else
121424047306Smrg  $3])dnl
121524047306Smrgfi])
121624047306Smrg
121724047306Smrg
121824047306Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
121924047306Smrg# ---------------------------------------------
122024047306Smrgm4_define([_PKG_CONFIG],
122124047306Smrg[if test -n "$$1"; then
122224047306Smrg    pkg_cv_[]$1="$$1"
122324047306Smrg elif test -n "$PKG_CONFIG"; then
122424047306Smrg    PKG_CHECK_EXISTS([$3],
122524047306Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
122624047306Smrg		     [pkg_failed=yes])
122724047306Smrg else
122824047306Smrg    pkg_failed=untried
122924047306Smrgfi[]dnl
123024047306Smrg])# _PKG_CONFIG
123124047306Smrg
123224047306Smrg# _PKG_SHORT_ERRORS_SUPPORTED
123324047306Smrg# -----------------------------
123424047306SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
123524047306Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123624047306Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
123724047306Smrg        _pkg_short_errors_supported=yes
123824047306Smrgelse
123924047306Smrg        _pkg_short_errors_supported=no
124024047306Smrgfi[]dnl
124124047306Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
124224047306Smrg
124324047306Smrg
124424047306Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
124524047306Smrg# [ACTION-IF-NOT-FOUND])
124624047306Smrg#
124724047306Smrg#
124824047306Smrg# Note that if there is a possibility the first call to
124924047306Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
125024047306Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
125124047306Smrg#
125224047306Smrg#
125324047306Smrg# --------------------------------------------------------------
125424047306SmrgAC_DEFUN([PKG_CHECK_MODULES],
125524047306Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
125624047306SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
125724047306SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
125824047306Smrg
125924047306Smrgpkg_failed=no
126024047306SmrgAC_MSG_CHECKING([for $1])
126124047306Smrg
126224047306Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
126324047306Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
126424047306Smrg
126524047306Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
126624047306Smrgand $1[]_LIBS to avoid the need to call pkg-config.
126724047306SmrgSee the pkg-config man page for more details.])
126824047306Smrg
126924047306Smrgif test $pkg_failed = yes; then
127024047306Smrg        _PKG_SHORT_ERRORS_SUPPORTED
127124047306Smrg        if test $_pkg_short_errors_supported = yes; then
127224047306Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
127324047306Smrg        else 
127424047306Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
127524047306Smrg        fi
127624047306Smrg	# Put the nasty error message in config.log where it belongs
127724047306Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
127824047306Smrg
127924047306Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
128024047306Smrg[Package requirements ($2) were not met:
128124047306Smrg
128224047306Smrg$$1_PKG_ERRORS
128324047306Smrg
128424047306SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
128524047306Smrginstalled software in a non-standard prefix.
128624047306Smrg
128724047306Smrg_PKG_TEXT
128824047306Smrg])],
128924047306Smrg		[AC_MSG_RESULT([no])
129024047306Smrg                $4])
129124047306Smrgelif test $pkg_failed = untried; then
129224047306Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
129324047306Smrg[The pkg-config script could not be found or is too old.  Make sure it
129424047306Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
129524047306Smrgpath to pkg-config.
129624047306Smrg
129724047306Smrg_PKG_TEXT
129824047306Smrg
129924047306SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
130024047306Smrg		[$4])
130124047306Smrgelse
130224047306Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
130324047306Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
130424047306Smrg        AC_MSG_RESULT([yes])
130524047306Smrg	ifelse([$3], , :, [$3])
130624047306Smrgfi[]dnl
130724047306Smrg])# PKG_CHECK_MODULES
130824047306Smrg
1309bf2eeab3Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1310bf2eeab3Smrgdnl
1311576bae58Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
131224047306Smrgdnl
1313bf2eeab3Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1314576bae58Smrgdnl copy of this software and associated documentation files (the "Software"),
1315576bae58Smrgdnl to deal in the Software without restriction, including without limitation
1316576bae58Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1317576bae58Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1318576bae58Smrgdnl Software is furnished to do so, subject to the following conditions:
1319bf2eeab3Smrgdnl
1320576bae58Smrgdnl The above copyright notice and this permission notice (including the next
1321576bae58Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1322576bae58Smrgdnl Software.
1323bf2eeab3Smrgdnl
1324576bae58Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1325576bae58Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1326576bae58Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1327576bae58Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1328576bae58Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1329576bae58Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1330576bae58Smrgdnl DEALINGS IN THE SOFTWARE.
133114c0a534Smrg
1332bf2eeab3Smrg# XORG_MACROS_VERSION(required-version)
1333bf2eeab3Smrg# -------------------------------------
1334bf2eeab3Smrg# Minimum version: 1.1.0
133514c0a534Smrg#
1336bf2eeab3Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1337bf2eeab3Smrg# your configure.ac with the minimum required version, such as:
1338bf2eeab3Smrg# XORG_MACROS_VERSION(1.1)
133914c0a534Smrg#
1340bf2eeab3Smrg# To ensure that this macro is defined, also add:
1341bf2eeab3Smrg# m4_ifndef([XORG_MACROS_VERSION],
1342bf2eeab3Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
134314c0a534Smrg#
134414c0a534Smrg#
134524047306Smrg# See the "minimum version" comment for each macro you use to see what
1346bf2eeab3Smrg# version you require.
1347bf2eeab3Smrgm4_defun([XORG_MACROS_VERSION],[
134824047306Smrgm4_define([vers_have], [1.19.0])
1349bf2eeab3Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1350bf2eeab3Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1351bf2eeab3Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1352bf2eeab3Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1353bf2eeab3Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1354bf2eeab3Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1355bf2eeab3Smrgm4_undefine([vers_have])
1356bf2eeab3Smrgm4_undefine([maj_have])
1357bf2eeab3Smrgm4_undefine([maj_needed])
1358bf2eeab3Smrg]) # XORG_MACROS_VERSION
135914c0a534Smrg
1360bf2eeab3Smrg# XORG_PROG_RAWCPP()
1361bf2eeab3Smrg# ------------------
1362bf2eeab3Smrg# Minimum version: 1.0.0
136314c0a534Smrg#
1364bf2eeab3Smrg# Find cpp program and necessary flags for use in pre-processing text files
1365bf2eeab3Smrg# such as man pages and config files
1366bf2eeab3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1367bf2eeab3SmrgAC_REQUIRE([AC_PROG_CPP])
136824047306SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
1369bf2eeab3Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
137014c0a534Smrg
1371bf2eeab3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1372bf2eeab3Smrg# which is not the best choice for supporting other OS'es, but covers most
1373bf2eeab3Smrg# of the ones we need for now.
1374bf2eeab3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
13751a054510SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1376bf2eeab3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1377bf2eeab3Smrg	AC_MSG_RESULT([no])
137814c0a534Smrgelse
1379bf2eeab3Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1380bf2eeab3Smrg		RAWCPPFLAGS=-undef
1381bf2eeab3Smrg		AC_MSG_RESULT([yes])
1382bf2eeab3Smrg	# under Cygwin unix is still defined even with -undef
1383bf2eeab3Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1384bf2eeab3Smrg		RAWCPPFLAGS="-undef -ansi"
1385bf2eeab3Smrg		AC_MSG_RESULT([yes, with -ansi])
1386bf2eeab3Smrg	else
1387bf2eeab3Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1388bf2eeab3Smrg	fi
138914c0a534Smrgfi
1390bf2eeab3Smrgrm -f conftest.$ac_ext
139114c0a534Smrg
1392bf2eeab3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
13931a054510SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1394bf2eeab3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1395bf2eeab3Smrg	AC_MSG_RESULT([no])
1396bf2eeab3Smrgelse
1397bf2eeab3Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
139824047306Smrg		TRADITIONALCPPFLAGS="-traditional"
1399bf2eeab3Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1400bf2eeab3Smrg		AC_MSG_RESULT([yes])
1401bf2eeab3Smrg	else
1402bf2eeab3Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1403bf2eeab3Smrg	fi
1404bf2eeab3Smrgfi
1405bf2eeab3Smrgrm -f conftest.$ac_ext
1406bf2eeab3SmrgAC_SUBST(RAWCPPFLAGS)
140724047306SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1408bf2eeab3Smrg]) # XORG_PROG_RAWCPP
140914c0a534Smrg
1410bf2eeab3Smrg# XORG_MANPAGE_SECTIONS()
1411bf2eeab3Smrg# -----------------------
1412bf2eeab3Smrg# Minimum version: 1.0.0
141314c0a534Smrg#
1414bf2eeab3Smrg# Determine which sections man pages go in for the different man page types
1415bf2eeab3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1416bf2eeab3Smrg# Not sure if there's any better way than just hardcoding by OS name.
1417bf2eeab3Smrg# Override default settings by setting environment variables
1418576bae58Smrg# Added MAN_SUBSTS in version 1.8
1419576bae58Smrg# Added AC_PROG_SED in version 1.8
142014c0a534Smrg
1421bf2eeab3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1422bf2eeab3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1423576bae58SmrgAC_REQUIRE([AC_PROG_SED])
142414c0a534Smrg
1425bf2eeab3Smrgif test x$APP_MAN_SUFFIX = x    ; then
1426bf2eeab3Smrg    APP_MAN_SUFFIX=1
1427bf2eeab3Smrgfi
1428bf2eeab3Smrgif test x$APP_MAN_DIR = x    ; then
1429bf2eeab3Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1430bf2eeab3Smrgfi
143114c0a534Smrg
1432bf2eeab3Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1433bf2eeab3Smrg    LIB_MAN_SUFFIX=3
1434bf2eeab3Smrgfi
1435bf2eeab3Smrgif test x$LIB_MAN_DIR = x    ; then
1436bf2eeab3Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
143714c0a534Smrgfi
143814c0a534Smrg
1439bf2eeab3Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1440bf2eeab3Smrg    case $host_os in
1441bf2eeab3Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1442bf2eeab3Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1443bf2eeab3Smrg    esac
1444bf2eeab3Smrgfi
1445bf2eeab3Smrgif test x$FILE_MAN_DIR = x    ; then
1446bf2eeab3Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1447bf2eeab3Smrgfi
144814c0a534Smrg
1449bf2eeab3Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1450bf2eeab3Smrg    case $host_os in
1451bf2eeab3Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1452bf2eeab3Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1453bf2eeab3Smrg    esac
1454bf2eeab3Smrgfi
1455bf2eeab3Smrgif test x$MISC_MAN_DIR = x    ; then
1456bf2eeab3Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1457bf2eeab3Smrgfi
145814c0a534Smrg
1459bf2eeab3Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1460bf2eeab3Smrg    case $host_os in
1461bf2eeab3Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1462bf2eeab3Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1463bf2eeab3Smrg    esac
1464bf2eeab3Smrgfi
1465bf2eeab3Smrgif test x$DRIVER_MAN_DIR = x    ; then
1466bf2eeab3Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1467bf2eeab3Smrgfi
146814c0a534Smrg
1469bf2eeab3Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1470bf2eeab3Smrg    case $host_os in
1471bf2eeab3Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1472bf2eeab3Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1473bf2eeab3Smrg    esac
1474bf2eeab3Smrgfi
1475bf2eeab3Smrgif test x$ADMIN_MAN_DIR = x    ; then
1476bf2eeab3Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
147714c0a534Smrgfi
147814c0a534Smrg
147914c0a534Smrg
1480bf2eeab3SmrgAC_SUBST([APP_MAN_SUFFIX])
1481bf2eeab3SmrgAC_SUBST([LIB_MAN_SUFFIX])
1482bf2eeab3SmrgAC_SUBST([FILE_MAN_SUFFIX])
1483bf2eeab3SmrgAC_SUBST([MISC_MAN_SUFFIX])
1484bf2eeab3SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1485bf2eeab3SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1486bf2eeab3SmrgAC_SUBST([APP_MAN_DIR])
1487bf2eeab3SmrgAC_SUBST([LIB_MAN_DIR])
1488bf2eeab3SmrgAC_SUBST([FILE_MAN_DIR])
1489bf2eeab3SmrgAC_SUBST([MISC_MAN_DIR])
1490bf2eeab3SmrgAC_SUBST([DRIVER_MAN_DIR])
1491bf2eeab3SmrgAC_SUBST([ADMIN_MAN_DIR])
1492576bae58Smrg
1493576bae58SmrgXORG_MAN_PAGE="X Version 11"
1494576bae58SmrgAC_SUBST([XORG_MAN_PAGE])
1495576bae58SmrgMAN_SUBSTS="\
1496576bae58Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1497576bae58Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1498576bae58Smrg	-e 's|__xservername__|Xorg|g' \
1499576bae58Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1500576bae58Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1501576bae58Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1502576bae58Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1503576bae58Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1504576bae58Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1505576bae58Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1506576bae58Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1507576bae58Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1508576bae58SmrgAC_SUBST([MAN_SUBSTS])
1509576bae58Smrg
1510bf2eeab3Smrg]) # XORG_MANPAGE_SECTIONS
1511bf2eeab3Smrg
1512576bae58Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1513576bae58Smrg# ------------------------
1514576bae58Smrg# Minimum version: 1.7.0
1515576bae58Smrg#
1516576bae58Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1517576bae58Smrg# provided by xorg-sgml-doctools, if installed.
1518576bae58SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1519576bae58SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1520576bae58SmrgXORG_SGML_PATH=
1521576bae58SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1522576bae58Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1523576bae58Smrg    [m4_ifval([$1],[:],
1524576bae58Smrg        [if test x"$cross_compiling" != x"yes" ; then
1525576bae58Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1526576bae58Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1527576bae58Smrg         fi])
1528576bae58Smrg    ])
1529576bae58Smrg
1530576bae58Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1531576bae58Smrg# the path and the name of the doc stylesheet
1532576bae58Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1533576bae58Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1534576bae58Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1535576bae58Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1536576bae58Smrgelse
1537576bae58Smrg   AC_MSG_RESULT([no])
1538576bae58Smrgfi
1539576bae58Smrg
1540576bae58SmrgAC_SUBST(XORG_SGML_PATH)
1541576bae58SmrgAC_SUBST(STYLESHEET_SRCDIR)
1542576bae58SmrgAC_SUBST(XSL_STYLESHEET)
1543576bae58SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1544576bae58Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1545576bae58Smrg
1546bf2eeab3Smrg# XORG_CHECK_LINUXDOC
1547bf2eeab3Smrg# -------------------
1548bf2eeab3Smrg# Minimum version: 1.0.0
154914c0a534Smrg#
1550bf2eeab3Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1551bf2eeab3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1552bf2eeab3Smrg# Whether or not the necessary tools and files are found can be checked
1553bf2eeab3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1554bf2eeab3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1555576bae58SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1556576bae58SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
155714c0a534Smrg
1558bf2eeab3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
155914c0a534Smrg
1560576bae58SmrgAC_MSG_CHECKING([whether to build documentation])
156114c0a534Smrg
1562576bae58Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1563bf2eeab3Smrg   BUILDDOC=yes
1564bf2eeab3Smrgelse
1565bf2eeab3Smrg   BUILDDOC=no
1566bf2eeab3Smrgfi
156714c0a534Smrg
1568bf2eeab3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
156914c0a534Smrg
1570bf2eeab3SmrgAC_MSG_RESULT([$BUILDDOC])
157114c0a534Smrg
1572576bae58SmrgAC_MSG_CHECKING([whether to build pdf documentation])
157314c0a534Smrg
1574576bae58Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1575bf2eeab3Smrg   BUILDPDFDOC=yes
1576bf2eeab3Smrgelse
1577bf2eeab3Smrg   BUILDPDFDOC=no
1578bf2eeab3Smrgfi
157914c0a534Smrg
1580bf2eeab3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
158114c0a534Smrg
1582bf2eeab3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
158314c0a534Smrg
1584576bae58SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1585bf2eeab3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1586bf2eeab3SmrgMAKE_PDF="$PS2PDF"
1587bf2eeab3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
158814c0a534Smrg
1589bf2eeab3SmrgAC_SUBST(MAKE_TEXT)
1590bf2eeab3SmrgAC_SUBST(MAKE_PS)
1591bf2eeab3SmrgAC_SUBST(MAKE_PDF)
1592bf2eeab3SmrgAC_SUBST(MAKE_HTML)
1593bf2eeab3Smrg]) # XORG_CHECK_LINUXDOC
1594bf2eeab3Smrg
1595bf2eeab3Smrg# XORG_CHECK_DOCBOOK
1596bf2eeab3Smrg# -------------------
1597bf2eeab3Smrg# Minimum version: 1.0.0
1598bf2eeab3Smrg#
1599bf2eeab3Smrg# Checks for the ability to build output formats from SGML DocBook source.
1600bf2eeab3Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1601bf2eeab3Smrg# indicates whether the necessary tools and files are found and, if set,
1602bf2eeab3Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1603bf2eeab3SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1604576bae58SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1605576bae58Smrg
1606bf2eeab3SmrgBUILDTXTDOC=no
1607bf2eeab3SmrgBUILDPDFDOC=no
1608bf2eeab3SmrgBUILDPSDOC=no
1609bf2eeab3SmrgBUILDHTMLDOC=no
1610bf2eeab3Smrg
1611bf2eeab3SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1612bf2eeab3SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1613bf2eeab3SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1614bf2eeab3SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1615bf2eeab3Smrg
1616576bae58SmrgAC_MSG_CHECKING([whether to build text documentation])
1617576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1618bf2eeab3Smrg   test x$BUILD_TXTDOC != xno; then
1619bf2eeab3Smrg	BUILDTXTDOC=yes
1620bf2eeab3Smrgfi
1621bf2eeab3SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1622bf2eeab3SmrgAC_MSG_RESULT([$BUILDTXTDOC])
162314c0a534Smrg
1624576bae58SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1625576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1626bf2eeab3Smrg   test x$BUILD_PDFDOC != xno; then
1627bf2eeab3Smrg	BUILDPDFDOC=yes
162814c0a534Smrgfi
1629bf2eeab3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1630bf2eeab3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
163114c0a534Smrg
1632576bae58SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1633576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1634bf2eeab3Smrg   test x$BUILD_PSDOC != xno; then
1635bf2eeab3Smrg	BUILDPSDOC=yes
1636bf2eeab3Smrgfi
1637bf2eeab3SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1638bf2eeab3SmrgAC_MSG_RESULT([$BUILDPSDOC])
163914c0a534Smrg
1640576bae58SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1641576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1642bf2eeab3Smrg   test x$BUILD_HTMLDOC != xno; then
1643bf2eeab3Smrg	BUILDHTMLDOC=yes
1644bf2eeab3Smrgfi
1645bf2eeab3SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1646bf2eeab3SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
164714c0a534Smrg
1648bf2eeab3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1649bf2eeab3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1650bf2eeab3SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1651bf2eeab3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
165214c0a534Smrg
1653bf2eeab3SmrgAC_SUBST(MAKE_TEXT)
1654bf2eeab3SmrgAC_SUBST(MAKE_PS)
1655bf2eeab3SmrgAC_SUBST(MAKE_PDF)
1656bf2eeab3SmrgAC_SUBST(MAKE_HTML)
1657bf2eeab3Smrg]) # XORG_CHECK_DOCBOOK
165814c0a534Smrg
16591a054510Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1660576bae58Smrg# ----------------
1661576bae58Smrg# Minimum version: 1.5.0
16621a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1663576bae58Smrg#
1664576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
1665576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
1666576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1667576bae58Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
16681a054510Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
16691a054510Smrg# --with-xmlto assumes 'auto'.
1670576bae58Smrg#
1671576bae58Smrg# Interface to module:
1672576bae58Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1673576bae58Smrg# XMLTO:	returns the path of the xmlto program found
1674576bae58Smrg#		returns the path set by the user in the environment
1675576bae58Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1676576bae58Smrg#		'no' user instructs the module not to use xmlto
1677576bae58Smrg#
1678576bae58Smrg# Added in version 1.10.0
1679576bae58Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1680576bae58Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1681576bae58Smrg#
1682576bae58Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1683576bae58Smrg#
1684576bae58SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1685576bae58SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
16861a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
1687576bae58SmrgAC_ARG_WITH(xmlto,
1688576bae58Smrg	AS_HELP_STRING([--with-xmlto],
16891a054510Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
16901a054510Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
16911a054510Smrgm4_undefine([_defopt])
1692576bae58Smrg
1693576bae58Smrgif test "x$use_xmlto" = x"auto"; then
1694576bae58Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1695576bae58Smrg   if test "x$XMLTO" = "x"; then
1696576bae58Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1697576bae58Smrg	have_xmlto=no
1698576bae58Smrg   else
1699576bae58Smrg        have_xmlto=yes
1700576bae58Smrg   fi
1701576bae58Smrgelif test "x$use_xmlto" = x"yes" ; then
1702576bae58Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1703576bae58Smrg   if test "x$XMLTO" = "x"; then
1704576bae58Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1705576bae58Smrg   fi
1706576bae58Smrg   have_xmlto=yes
1707576bae58Smrgelif test "x$use_xmlto" = x"no" ; then
1708576bae58Smrg   if test "x$XMLTO" != "x"; then
1709576bae58Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1710576bae58Smrg   fi
1711576bae58Smrg   have_xmlto=no
1712576bae58Smrgelse
1713576bae58Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1714576bae58Smrgfi
1715576bae58Smrg
1716576bae58Smrg# Test for a minimum version of xmlto, if provided.
1717576bae58Smrgm4_ifval([$1],
1718576bae58Smrg[if test "$have_xmlto" = yes; then
1719576bae58Smrg    # scrape the xmlto version
1720576bae58Smrg    AC_MSG_CHECKING([the xmlto version])
1721576bae58Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1722576bae58Smrg    AC_MSG_RESULT([$xmlto_version])
1723576bae58Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1724576bae58Smrg        [if test "x$use_xmlto" = xauto; then
1725576bae58Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1726576bae58Smrg            have_xmlto=no
1727576bae58Smrg        else
1728576bae58Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1729576bae58Smrg        fi])
1730576bae58Smrgfi])
1731576bae58Smrg
1732576bae58Smrg# Test for the ability of xmlto to generate a text target
1733576bae58Smrghave_xmlto_text=no
1734576bae58Smrgcat > conftest.xml << "EOF"
1735576bae58SmrgEOF
1736576bae58SmrgAS_IF([test "$have_xmlto" = yes],
1737576bae58Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1738576bae58Smrg             [have_xmlto_text=yes],
1739576bae58Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1740576bae58Smrgrm -f conftest.xml
1741576bae58SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1742576bae58SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1743576bae58Smrg]) # XORG_WITH_XMLTO
1744576bae58Smrg
17451a054510Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
17461a054510Smrg# --------------------------------------------
17471a054510Smrg# Minimum version: 1.12.0
17481a054510Smrg# Minimum version for optional DEFAULT argument: 1.12.0
17491a054510Smrg#
17501a054510Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
17511a054510Smrg# XML-based language used for the transformation of XML documents.
17521a054510Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
17531a054510Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
17541a054510Smrg# The XSLT processor is often used as a standalone tool for transformations.
17551a054510Smrg# It should not be assumed that this tool is used only to work with documnetation.
17561a054510Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
17571a054510Smrg#
17581a054510Smrg# Interface to module:
17591a054510Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
17601a054510Smrg# XSLTPROC:	 returns the path of the xsltproc program found
17611a054510Smrg#		 returns the path set by the user in the environment
17621a054510Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
17631a054510Smrg#		  'no' user instructs the module not to use xsltproc
17641a054510Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
17651a054510Smrg#
17661a054510Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
17671a054510Smrg#
17681a054510SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
17691a054510SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
17701a054510Smrg# Preserves the interface, should it be implemented later
17711a054510Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
17721a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
17731a054510SmrgAC_ARG_WITH(xsltproc,
17741a054510Smrg	AS_HELP_STRING([--with-xsltproc],
17751a054510Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
17761a054510Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
17771a054510Smrgm4_undefine([_defopt])
17781a054510Smrg
17791a054510Smrgif test "x$use_xsltproc" = x"auto"; then
17801a054510Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
17811a054510Smrg   if test "x$XSLTPROC" = "x"; then
17821a054510Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
17831a054510Smrg	have_xsltproc=no
17841a054510Smrg   else
17851a054510Smrg        have_xsltproc=yes
17861a054510Smrg   fi
17871a054510Smrgelif test "x$use_xsltproc" = x"yes" ; then
17881a054510Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
17891a054510Smrg   if test "x$XSLTPROC" = "x"; then
17901a054510Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
17911a054510Smrg   fi
17921a054510Smrg   have_xsltproc=yes
17931a054510Smrgelif test "x$use_xsltproc" = x"no" ; then
17941a054510Smrg   if test "x$XSLTPROC" != "x"; then
17951a054510Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
17961a054510Smrg   fi
17971a054510Smrg   have_xsltproc=no
17981a054510Smrgelse
17991a054510Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
18001a054510Smrgfi
18011a054510Smrg
18021a054510SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
18031a054510Smrg]) # XORG_WITH_XSLTPROC
18041a054510Smrg
18051a054510Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
18061a054510Smrg# ----------------------------------------
18071a054510Smrg# Minimum version: 1.15.0
18081a054510Smrg#
18091a054510Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
18101a054510Smrg# scanning arbitrary text files, extracting information from those text files,
18111a054510Smrg# and printing reports based on that information.
18121a054510Smrg#
18131a054510Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
18141a054510Smrg#
18151a054510Smrg# Interface to module:
18161a054510Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
18171a054510Smrg# PERL:	     returns the path of the perl program found
18181a054510Smrg#	     returns the path set by the user in the environment
18191a054510Smrg# --with-perl: 'yes' user instructs the module to use perl
18201a054510Smrg#	       'no' user instructs the module not to use perl
18211a054510Smrg# have_perl: returns yes if perl found in PATH or no
18221a054510Smrg#
18231a054510Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
18241a054510Smrg#
18251a054510SmrgAC_DEFUN([XORG_WITH_PERL],[
18261a054510SmrgAC_ARG_VAR([PERL], [Path to perl command])
18271a054510Smrg# Preserves the interface, should it be implemented later
18281a054510Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
18291a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
18301a054510SmrgAC_ARG_WITH(perl,
18311a054510Smrg	AS_HELP_STRING([--with-perl],
18321a054510Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
18331a054510Smrg	   [use_perl=$withval], [use_perl=]_defopt)
18341a054510Smrgm4_undefine([_defopt])
18351a054510Smrg
18361a054510Smrgif test "x$use_perl" = x"auto"; then
18371a054510Smrg   AC_PATH_PROG([PERL], [perl])
18381a054510Smrg   if test "x$PERL" = "x"; then
18391a054510Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
18401a054510Smrg	have_perl=no
18411a054510Smrg   else
18421a054510Smrg        have_perl=yes
18431a054510Smrg   fi
18441a054510Smrgelif test "x$use_perl" = x"yes" ; then
18451a054510Smrg   AC_PATH_PROG([PERL], [perl])
18461a054510Smrg   if test "x$PERL" = "x"; then
18471a054510Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
18481a054510Smrg   fi
18491a054510Smrg   have_perl=yes
18501a054510Smrgelif test "x$use_perl" = x"no" ; then
18511a054510Smrg   if test "x$PERL" != "x"; then
18521a054510Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
18531a054510Smrg   fi
18541a054510Smrg   have_perl=no
18551a054510Smrgelse
18561a054510Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
18571a054510Smrgfi
18581a054510Smrg
18591a054510SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
18601a054510Smrg]) # XORG_WITH_PERL
18611a054510Smrg
18621a054510Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1863576bae58Smrg# ----------------
1864576bae58Smrg# Minimum version: 1.5.0
18651a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1866576bae58Smrg#
1867576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
1868576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
1869576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1870576bae58Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
18711a054510Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
18721a054510Smrg# --with-asciidoc assumes 'auto'.
1873576bae58Smrg#
1874576bae58Smrg# Interface to module:
1875576bae58Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1876576bae58Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
1877576bae58Smrg#		 returns the path set by the user in the environment
1878576bae58Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1879576bae58Smrg#		  'no' user instructs the module not to use asciidoc
1880576bae58Smrg#
1881576bae58Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1882576bae58Smrg#
1883576bae58SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1884576bae58SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
18851a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
1886576bae58SmrgAC_ARG_WITH(asciidoc,
1887576bae58Smrg	AS_HELP_STRING([--with-asciidoc],
18881a054510Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
18891a054510Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
18901a054510Smrgm4_undefine([_defopt])
1891576bae58Smrg
1892576bae58Smrgif test "x$use_asciidoc" = x"auto"; then
1893576bae58Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1894576bae58Smrg   if test "x$ASCIIDOC" = "x"; then
1895576bae58Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1896576bae58Smrg	have_asciidoc=no
1897576bae58Smrg   else
1898576bae58Smrg        have_asciidoc=yes
1899576bae58Smrg   fi
1900576bae58Smrgelif test "x$use_asciidoc" = x"yes" ; then
1901576bae58Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1902576bae58Smrg   if test "x$ASCIIDOC" = "x"; then
1903576bae58Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1904576bae58Smrg   fi
1905576bae58Smrg   have_asciidoc=yes
1906576bae58Smrgelif test "x$use_asciidoc" = x"no" ; then
1907576bae58Smrg   if test "x$ASCIIDOC" != "x"; then
1908576bae58Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1909576bae58Smrg   fi
1910576bae58Smrg   have_asciidoc=no
1911576bae58Smrgelse
1912576bae58Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1913576bae58Smrgfi
1914576bae58Smrgm4_ifval([$1],
1915576bae58Smrg[if test "$have_asciidoc" = yes; then
1916576bae58Smrg    # scrape the asciidoc version
1917576bae58Smrg    AC_MSG_CHECKING([the asciidoc version])
1918576bae58Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1919576bae58Smrg    AC_MSG_RESULT([$asciidoc_version])
1920576bae58Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1921576bae58Smrg        [if test "x$use_asciidoc" = xauto; then
1922576bae58Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1923576bae58Smrg            have_asciidoc=no
1924576bae58Smrg        else
1925576bae58Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1926576bae58Smrg        fi])
1927576bae58Smrgfi])
1928576bae58SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1929576bae58Smrg]) # XORG_WITH_ASCIIDOC
1930576bae58Smrg
19311a054510Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
193224047306Smrg# -------------------------------------------
1933576bae58Smrg# Minimum version: 1.5.0
19341a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
193524047306Smrg# Minimum version for optional DOT checking: 1.18.0
1936576bae58Smrg#
1937576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
1938576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
1939576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1940576bae58Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
19411a054510Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
19421a054510Smrg# --with-doxygen assumes 'auto'.
1943576bae58Smrg#
1944576bae58Smrg# Interface to module:
1945576bae58Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1946576bae58Smrg# DOXYGEN:	 returns the path of the doxygen program found
1947576bae58Smrg#		 returns the path set by the user in the environment
1948576bae58Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1949576bae58Smrg#		  'no' user instructs the module not to use doxygen
1950576bae58Smrg#
1951576bae58Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1952576bae58Smrg#
1953576bae58SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1954576bae58SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
195524047306SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
19561a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
1957576bae58SmrgAC_ARG_WITH(doxygen,
1958576bae58Smrg	AS_HELP_STRING([--with-doxygen],
19591a054510Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
19601a054510Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
19611a054510Smrgm4_undefine([_defopt])
1962576bae58Smrg
1963576bae58Smrgif test "x$use_doxygen" = x"auto"; then
1964576bae58Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1965576bae58Smrg   if test "x$DOXYGEN" = "x"; then
1966576bae58Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1967576bae58Smrg	have_doxygen=no
1968576bae58Smrg   else
1969576bae58Smrg        have_doxygen=yes
1970576bae58Smrg   fi
1971576bae58Smrgelif test "x$use_doxygen" = x"yes" ; then
1972576bae58Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1973576bae58Smrg   if test "x$DOXYGEN" = "x"; then
1974576bae58Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1975576bae58Smrg   fi
1976576bae58Smrg   have_doxygen=yes
1977576bae58Smrgelif test "x$use_doxygen" = x"no" ; then
1978576bae58Smrg   if test "x$DOXYGEN" != "x"; then
1979576bae58Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1980576bae58Smrg   fi
1981576bae58Smrg   have_doxygen=no
1982576bae58Smrgelse
1983576bae58Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1984576bae58Smrgfi
1985576bae58Smrgm4_ifval([$1],
1986576bae58Smrg[if test "$have_doxygen" = yes; then
1987576bae58Smrg    # scrape the doxygen version
1988576bae58Smrg    AC_MSG_CHECKING([the doxygen version])
1989576bae58Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1990576bae58Smrg    AC_MSG_RESULT([$doxygen_version])
1991576bae58Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1992576bae58Smrg        [if test "x$use_doxygen" = xauto; then
1993576bae58Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1994576bae58Smrg            have_doxygen=no
1995576bae58Smrg        else
1996576bae58Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1997576bae58Smrg        fi])
1998576bae58Smrgfi])
199924047306Smrg
200024047306Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
200124047306Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
200224047306Smrgdnl 	HAVE_DOT = @HAVE_DOT@
200324047306SmrgHAVE_DOT=no
200424047306Smrgif test "x$have_doxygen" = "xyes"; then
200524047306Smrg  AC_PATH_PROG([DOT], [dot])
200624047306Smrg    if test "x$DOT" != "x"; then
200724047306Smrg      HAVE_DOT=yes
200824047306Smrg    fi
200924047306Smrgfi
201024047306Smrg
201124047306SmrgAC_SUBST([HAVE_DOT])
201224047306SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2013576bae58SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2014576bae58Smrg]) # XORG_WITH_DOXYGEN
2015576bae58Smrg
20161a054510Smrg# XORG_WITH_GROFF([DEFAULT])
2017576bae58Smrg# ----------------
2018576bae58Smrg# Minimum version: 1.6.0
20191a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2020576bae58Smrg#
2021576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2022576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
2023576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2024576bae58Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
20251a054510Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
20261a054510Smrg# --with-groff assumes 'auto'.
2027576bae58Smrg#
2028576bae58Smrg# Interface to module:
2029576bae58Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2030576bae58Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2031576bae58Smrg# HAVE_GROFF_MS: the -ms macros package
2032576bae58Smrg# GROFF:	 returns the path of the groff program found
2033576bae58Smrg#		 returns the path set by the user in the environment
2034576bae58Smrg# --with-groff:	 'yes' user instructs the module to use groff
2035576bae58Smrg#		 'no' user instructs the module not to use groff
2036576bae58Smrg#
2037576bae58Smrg# Added in version 1.9.0:
2038576bae58Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2039576bae58Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2040576bae58Smrg#		   psselect from the psutils package.
2041576bae58Smrg#		   the ghostcript package. Refer to the grohtml man pages
2042576bae58Smrg#
2043576bae58Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2044576bae58Smrg#
2045576bae58Smrg# OS and distros often splits groff in a basic and full package, the former
2046576bae58Smrg# having the groff program and the later having devices, fonts and macros
2047576bae58Smrg# Checking for the groff executable is not enough.
2048576bae58Smrg#
2049576bae58Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2050576bae58Smrg# unset HAVE_GROFF or GROFF env variables.
2051576bae58Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2052576bae58Smrg#
2053576bae58SmrgAC_DEFUN([XORG_WITH_GROFF],[
2054576bae58SmrgAC_ARG_VAR([GROFF], [Path to groff command])
20551a054510Smrgm4_define([_defopt], m4_default([$1], [auto]))
2056576bae58SmrgAC_ARG_WITH(groff,
2057576bae58Smrg	AS_HELP_STRING([--with-groff],
20581a054510Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
20591a054510Smrg	   [use_groff=$withval], [use_groff=]_defopt)
20601a054510Smrgm4_undefine([_defopt])
2061576bae58Smrg
2062576bae58Smrgif test "x$use_groff" = x"auto"; then
2063576bae58Smrg   AC_PATH_PROG([GROFF], [groff])
2064576bae58Smrg   if test "x$GROFF" = "x"; then
2065576bae58Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2066576bae58Smrg	have_groff=no
2067576bae58Smrg   else
2068576bae58Smrg        have_groff=yes
2069576bae58Smrg   fi
2070576bae58Smrgelif test "x$use_groff" = x"yes" ; then
2071576bae58Smrg   AC_PATH_PROG([GROFF], [groff])
2072576bae58Smrg   if test "x$GROFF" = "x"; then
2073576bae58Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2074576bae58Smrg   fi
2075576bae58Smrg   have_groff=yes
2076576bae58Smrgelif test "x$use_groff" = x"no" ; then
2077576bae58Smrg   if test "x$GROFF" != "x"; then
2078576bae58Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2079576bae58Smrg   fi
2080576bae58Smrg   have_groff=no
2081576bae58Smrgelse
2082576bae58Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2083576bae58Smrgfi
2084576bae58Smrg
2085576bae58Smrg# We have groff, test for the presence of the macro packages
2086576bae58Smrgif test "x$have_groff" = x"yes"; then
2087576bae58Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2088576bae58Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2089576bae58Smrg        groff_ms_works=yes
2090576bae58Smrg    else
2091576bae58Smrg        groff_ms_works=no
2092576bae58Smrg    fi
2093576bae58Smrg    AC_MSG_RESULT([$groff_ms_works])
2094576bae58Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2095576bae58Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2096576bae58Smrg        groff_mm_works=yes
2097576bae58Smrg    else
2098576bae58Smrg        groff_mm_works=no
2099576bae58Smrg    fi
2100576bae58Smrg    AC_MSG_RESULT([$groff_mm_works])
2101576bae58Smrgfi
2102576bae58Smrg
2103576bae58Smrg# We have groff, test for HTML dependencies, one command per package
2104576bae58Smrgif test "x$have_groff" = x"yes"; then
2105576bae58Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2106576bae58Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2107576bae58Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2108576bae58Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2109576bae58Smrg      have_groff_html=yes
2110576bae58Smrg   else
2111576bae58Smrg      have_groff_html=no
2112576bae58Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2113576bae58Smrg   fi
2114576bae58Smrgfi
2115576bae58Smrg
2116576bae58Smrg# Set Automake conditionals for Makefiles
2117576bae58SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2118576bae58SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2119576bae58SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2120576bae58SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2121576bae58Smrg]) # XORG_WITH_GROFF
2122576bae58Smrg
21231a054510Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
21241a054510Smrg# ---------------------------------------
2125576bae58Smrg# Minimum version: 1.6.0
21261a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21271a054510Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2128576bae58Smrg#
2129576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2130576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
2131576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2132576bae58Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
21331a054510Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
21341a054510Smrg# --with-fop assumes 'auto'.
2135576bae58Smrg#
2136576bae58Smrg# Interface to module:
2137576bae58Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2138576bae58Smrg# FOP:	 	returns the path of the fop program found
2139576bae58Smrg#		returns the path set by the user in the environment
2140576bae58Smrg# --with-fop: 	'yes' user instructs the module to use fop
2141576bae58Smrg#		'no' user instructs the module not to use fop
2142576bae58Smrg#
2143576bae58Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2144576bae58Smrg#
2145576bae58SmrgAC_DEFUN([XORG_WITH_FOP],[
2146576bae58SmrgAC_ARG_VAR([FOP], [Path to fop command])
21471a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
2148576bae58SmrgAC_ARG_WITH(fop,
2149576bae58Smrg	AS_HELP_STRING([--with-fop],
21501a054510Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
21511a054510Smrg	   [use_fop=$withval], [use_fop=]_defopt)
21521a054510Smrgm4_undefine([_defopt])
2153576bae58Smrg
2154576bae58Smrgif test "x$use_fop" = x"auto"; then
2155576bae58Smrg   AC_PATH_PROG([FOP], [fop])
2156576bae58Smrg   if test "x$FOP" = "x"; then
2157576bae58Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2158576bae58Smrg	have_fop=no
2159576bae58Smrg   else
2160576bae58Smrg        have_fop=yes
2161576bae58Smrg   fi
2162576bae58Smrgelif test "x$use_fop" = x"yes" ; then
2163576bae58Smrg   AC_PATH_PROG([FOP], [fop])
2164576bae58Smrg   if test "x$FOP" = "x"; then
2165576bae58Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2166576bae58Smrg   fi
2167576bae58Smrg   have_fop=yes
2168576bae58Smrgelif test "x$use_fop" = x"no" ; then
2169576bae58Smrg   if test "x$FOP" != "x"; then
2170576bae58Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2171576bae58Smrg   fi
2172576bae58Smrg   have_fop=no
2173576bae58Smrgelse
2174576bae58Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2175576bae58Smrgfi
21761a054510Smrg
21771a054510Smrg# Test for a minimum version of fop, if provided.
21781a054510Smrgm4_ifval([$1],
21791a054510Smrg[if test "$have_fop" = yes; then
21801a054510Smrg    # scrape the fop version
21811a054510Smrg    AC_MSG_CHECKING([for fop minimum version])
21821a054510Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
21831a054510Smrg    AC_MSG_RESULT([$fop_version])
21841a054510Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
21851a054510Smrg        [if test "x$use_fop" = xauto; then
21861a054510Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
21871a054510Smrg            have_fop=no
21881a054510Smrg        else
21891a054510Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
21901a054510Smrg        fi])
21911a054510Smrgfi])
2192576bae58SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2193576bae58Smrg]) # XORG_WITH_FOP
2194576bae58Smrg
219524047306Smrg# XORG_WITH_M4([MIN-VERSION])
219624047306Smrg# ---------------------------
219724047306Smrg# Minimum version: 1.19.0
219824047306Smrg#
219924047306Smrg# This macro attempts to locate an m4 macro processor which supports
220024047306Smrg# -I option and is only useful for modules relying on M4 in order to
220124047306Smrg# expand macros in source code files.
220224047306Smrg#
220324047306Smrg# Interface to module:
220424047306Smrg# M4:	 	returns the path of the m4 program found
220524047306Smrg#		returns the path set by the user in the environment
220624047306Smrg#
220724047306SmrgAC_DEFUN([XORG_WITH_M4], [
220824047306SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
220924047306Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
221024047306Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
221124047306Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
221224047306Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
221324047306Smrg   [$PATH:/usr/gnu/bin])])
221424047306Smrg
221524047306SmrgAC_SUBST([M4], [$ac_cv_path_M4])
221624047306Smrg]) # XORG_WITH_M4
221724047306Smrg
22181a054510Smrg# XORG_WITH_PS2PDF([DEFAULT])
2219576bae58Smrg# ----------------
2220576bae58Smrg# Minimum version: 1.6.0
22211a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2222576bae58Smrg#
2223576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2224576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
2225576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2226576bae58Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
22271a054510Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
22281a054510Smrg# --with-ps2pdf assumes 'auto'.
2229576bae58Smrg#
2230576bae58Smrg# Interface to module:
2231576bae58Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2232576bae58Smrg# PS2PDF:	returns the path of the ps2pdf program found
2233576bae58Smrg#		returns the path set by the user in the environment
2234576bae58Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2235576bae58Smrg#		 'no' user instructs the module not to use ps2pdf
2236576bae58Smrg#
2237576bae58Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2238576bae58Smrg#
2239576bae58SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2240576bae58SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
22411a054510Smrgm4_define([_defopt], m4_default([$1], [auto]))
2242576bae58SmrgAC_ARG_WITH(ps2pdf,
2243576bae58Smrg	AS_HELP_STRING([--with-ps2pdf],
22441a054510Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
22451a054510Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
22461a054510Smrgm4_undefine([_defopt])
2247576bae58Smrg
2248576bae58Smrgif test "x$use_ps2pdf" = x"auto"; then
2249576bae58Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2250576bae58Smrg   if test "x$PS2PDF" = "x"; then
2251576bae58Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2252576bae58Smrg	have_ps2pdf=no
2253576bae58Smrg   else
2254576bae58Smrg        have_ps2pdf=yes
2255576bae58Smrg   fi
2256576bae58Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2257576bae58Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2258576bae58Smrg   if test "x$PS2PDF" = "x"; then
2259576bae58Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2260576bae58Smrg   fi
2261576bae58Smrg   have_ps2pdf=yes
2262576bae58Smrgelif test "x$use_ps2pdf" = x"no" ; then
2263576bae58Smrg   if test "x$PS2PDF" != "x"; then
2264576bae58Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2265576bae58Smrg   fi
2266576bae58Smrg   have_ps2pdf=no
2267576bae58Smrgelse
2268576bae58Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2269576bae58Smrgfi
2270576bae58SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2271576bae58Smrg]) # XORG_WITH_PS2PDF
2272576bae58Smrg
2273576bae58Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2274576bae58Smrg# ----------------
2275576bae58Smrg# Minimum version: 1.6.0
2276576bae58Smrg#
2277576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2278576bae58Smrg# not at the appropriate level. This macro enables a builder to skip all
2279576bae58Smrg# documentation targets except traditional man pages.
2280576bae58Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2281576bae58Smrg# maximum flexibilty in controlling documentation building.
2282576bae58Smrg# Refer to:
2283576bae58Smrg# XORG_WITH_XMLTO         --with-xmlto
2284576bae58Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2285576bae58Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2286576bae58Smrg# XORG_WITH_FOP           --with-fop
2287576bae58Smrg# XORG_WITH_GROFF         --with-groff
2288576bae58Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2289576bae58Smrg#
2290576bae58Smrg# Interface to module:
2291576bae58Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2292576bae58Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2293576bae58Smrg#		 'no' user instructs the module not to generate docs
2294576bae58Smrg# parm1:	specify the default value, yes or no.
2295576bae58Smrg#
2296576bae58SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
22971a054510Smrgm4_define([docs_default], m4_default([$1], [yes]))
2298576bae58SmrgAC_ARG_ENABLE(docs,
2299576bae58Smrg	AS_HELP_STRING([--enable-docs],
23001a054510Smrg	   [Enable building the documentation (default: ]docs_default[)]),
23011a054510Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
23021a054510Smrgm4_undefine([docs_default])
2303576bae58SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2304576bae58SmrgAC_MSG_CHECKING([whether to build documentation])
2305576bae58SmrgAC_MSG_RESULT([$build_docs])
2306576bae58Smrg]) # XORG_ENABLE_DOCS
2307576bae58Smrg
2308576bae58Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2309576bae58Smrg# ----------------
2310576bae58Smrg# Minimum version: 1.6.0
2311576bae58Smrg#
2312576bae58Smrg# This macro enables a builder to skip all developer documentation.
2313576bae58Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2314576bae58Smrg# maximum flexibilty in controlling documentation building.
2315576bae58Smrg# Refer to:
2316576bae58Smrg# XORG_WITH_XMLTO         --with-xmlto
2317576bae58Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2318576bae58Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2319576bae58Smrg# XORG_WITH_FOP           --with-fop
2320576bae58Smrg# XORG_WITH_GROFF         --with-groff
2321576bae58Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2322576bae58Smrg#
2323576bae58Smrg# Interface to module:
2324576bae58Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2325576bae58Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2326576bae58Smrg#			'no' user instructs the module not to generate developer docs
2327576bae58Smrg# parm1:		specify the default value, yes or no.
2328576bae58Smrg#
2329576bae58SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
23301a054510Smrgm4_define([devel_default], m4_default([$1], [yes]))
2331576bae58SmrgAC_ARG_ENABLE(devel-docs,
2332576bae58Smrg	AS_HELP_STRING([--enable-devel-docs],
23331a054510Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
23341a054510Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
23351a054510Smrgm4_undefine([devel_default])
2336576bae58SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2337576bae58SmrgAC_MSG_CHECKING([whether to build developer documentation])
2338576bae58SmrgAC_MSG_RESULT([$build_devel_docs])
2339576bae58Smrg]) # XORG_ENABLE_DEVEL_DOCS
2340576bae58Smrg
2341576bae58Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2342576bae58Smrg# ----------------
2343576bae58Smrg# Minimum version: 1.6.0
2344576bae58Smrg#
2345576bae58Smrg# This macro enables a builder to skip all functional specification targets.
2346576bae58Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2347576bae58Smrg# maximum flexibilty in controlling documentation building.
2348576bae58Smrg# Refer to:
2349576bae58Smrg# XORG_WITH_XMLTO         --with-xmlto
2350576bae58Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2351576bae58Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2352576bae58Smrg# XORG_WITH_FOP           --with-fop
2353576bae58Smrg# XORG_WITH_GROFF         --with-groff
2354576bae58Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2355576bae58Smrg#
2356576bae58Smrg# Interface to module:
2357576bae58Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2358576bae58Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2359576bae58Smrg#			'no' user instructs the module not to generate specs
2360576bae58Smrg# parm1:		specify the default value, yes or no.
2361576bae58Smrg#
2362576bae58SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
23631a054510Smrgm4_define([spec_default], m4_default([$1], [yes]))
2364576bae58SmrgAC_ARG_ENABLE(specs,
2365576bae58Smrg	AS_HELP_STRING([--enable-specs],
23661a054510Smrg	   [Enable building the specs (default: ]spec_default[)]),
23671a054510Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
23681a054510Smrgm4_undefine([spec_default])
2369576bae58SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2370576bae58SmrgAC_MSG_CHECKING([whether to build functional specifications])
2371576bae58SmrgAC_MSG_RESULT([$build_specs])
2372576bae58Smrg]) # XORG_ENABLE_SPECS
2373576bae58Smrg
23741a054510Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
23751a054510Smrg# ----------------------------------------------
23761a054510Smrg# Minimum version: 1.13.0
23771a054510Smrg#
23781a054510Smrg# This macro enables a builder to enable/disable unit testing
23791a054510Smrg# It makes no assumption about the test cases implementation
23801a054510Smrg# Test cases may or may not use Automake "Support for test suites"
23811a054510Smrg# They may or may not use the software utility library GLib
23821a054510Smrg#
23831a054510Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
23841a054510Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
23851a054510Smrg# The variable enable_unit_tests is used by other macros in this file.
23861a054510Smrg#
23871a054510Smrg# Interface to module:
23881a054510Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
23891a054510Smrg# enable_unit_tests:    used in configure.ac for additional configuration
23901a054510Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
23911a054510Smrg#			'no' user instructs the module not to build tests
23921a054510Smrg# parm1:		specify the default value, yes or no.
23931a054510Smrg#
23941a054510SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
23951a054510SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
23961a054510SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
239724047306SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
23981a054510Smrgm4_define([_defopt], m4_default([$1], [auto]))
23991a054510SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
24001a054510Smrg	[Enable building unit test cases (default: ]_defopt[)]),
24011a054510Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
24021a054510Smrgm4_undefine([_defopt])
24031a054510SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
24041a054510SmrgAC_MSG_CHECKING([whether to build unit test cases])
24051a054510SmrgAC_MSG_RESULT([$enable_unit_tests])
24061a054510Smrg]) # XORG_ENABLE_UNIT_TESTS
24071a054510Smrg
240824047306Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
240924047306Smrg# ------------------------------------------------------
241024047306Smrg# Minimum version: 1.17.0
241124047306Smrg#
241224047306Smrg# This macro enables a builder to enable/disable integration testing
241324047306Smrg# It makes no assumption about the test cases' implementation
241424047306Smrg# Test cases may or may not use Automake "Support for test suites"
241524047306Smrg#
241624047306Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
241724047306Smrg# usually requires less dependencies and may be built and run under less
241824047306Smrg# stringent environments than integration tests.
241924047306Smrg#
242024047306Smrg# Interface to module:
242124047306Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
242224047306Smrg# enable_integration_tests:   used in configure.ac for additional configuration
242324047306Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
242424047306Smrg#                             'no' user instructs the module not to build tests
242524047306Smrg# parm1:                      specify the default value, yes or no.
242624047306Smrg#
242724047306SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
242824047306SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
242924047306Smrgm4_define([_defopt], m4_default([$1], [auto]))
243024047306SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
243124047306Smrg	[Enable building integration test cases (default: ]_defopt[)]),
243224047306Smrg	[enable_integration_tests=$enableval],
243324047306Smrg	[enable_integration_tests=]_defopt)
243424047306Smrgm4_undefine([_defopt])
243524047306SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
243624047306Smrg	[test "x$enable_integration_tests" != xno])
243724047306SmrgAC_MSG_CHECKING([whether to build unit test cases])
243824047306SmrgAC_MSG_RESULT([$enable_integration_tests])
243924047306Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
244024047306Smrg
24411a054510Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
24421a054510Smrg# ----------------------------------------
24431a054510Smrg# Minimum version: 1.13.0
24441a054510Smrg#
24451a054510Smrg# GLib is a library which provides advanced data structures and functions.
24461a054510Smrg# This macro enables a module to test for the presence of Glib.
24471a054510Smrg#
24481a054510Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
24491a054510Smrg# Otherwise the value of $enable_unit_tests is blank.
24501a054510Smrg#
245124047306Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
245224047306Smrg# test support usually requires less dependencies and may be built and run under
245324047306Smrg# less stringent environments than integration tests.
245424047306Smrg#
24551a054510Smrg# Interface to module:
24561a054510Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
24571a054510Smrg# with_glib: used in configure.ac to know if GLib has been found
24581a054510Smrg# --with-glib:	'yes' user instructs the module to use glib
24591a054510Smrg#		'no' user instructs the module not to use glib
24601a054510Smrg#
24611a054510SmrgAC_DEFUN([XORG_WITH_GLIB],[
24621a054510SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
24631a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
24641a054510SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
24651a054510Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
24661a054510Smrg	[with_glib=$withval], [with_glib=]_defopt)
24671a054510Smrgm4_undefine([_defopt])
24681a054510Smrg
24691a054510Smrghave_glib=no
24701a054510Smrg# Do not probe GLib if user explicitly disabled unit testing
24711a054510Smrgif test "x$enable_unit_tests" != x"no"; then
24721a054510Smrg  # Do not probe GLib if user explicitly disabled it
24731a054510Smrg  if test "x$with_glib" != x"no"; then
24741a054510Smrg    m4_ifval(
24751a054510Smrg      [$1],
24761a054510Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
24771a054510Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
24781a054510Smrg    )
24791a054510Smrg  fi
24801a054510Smrgfi
24811a054510Smrg
24821a054510Smrg# Not having GLib when unit testing has been explicitly requested is an error
24831a054510Smrgif test "x$enable_unit_tests" = x"yes"; then
24841a054510Smrg  if test "x$have_glib" = x"no"; then
24851a054510Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24861a054510Smrg  fi
24871a054510Smrgfi
24881a054510Smrg
24891a054510Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
24901a054510Smrgif test "x$enable_unit_tests" = x"no"; then
24911a054510Smrg  if test "x$with_glib" = x"yes"; then
24921a054510Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24931a054510Smrg  fi
24941a054510Smrgfi
24951a054510Smrg
24961a054510Smrg# Not having GLib when it has been explicitly requested is an error
24971a054510Smrgif test "x$with_glib" = x"yes"; then
24981a054510Smrg  if test "x$have_glib" = x"no"; then
24991a054510Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
25001a054510Smrg  fi
25011a054510Smrgfi
25021a054510Smrg
25031a054510SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
25041a054510Smrg]) # XORG_WITH_GLIB
25051a054510Smrg
250624047306Smrg# XORG_LD_WRAP([required|optional])
250724047306Smrg# ---------------------------------
25081a054510Smrg# Minimum version: 1.13.0
25091a054510Smrg#
25101a054510Smrg# Check if linker supports -wrap, passed via compiler flags
25111a054510Smrg#
25121a054510Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
25131a054510Smrg# Otherwise the value of $enable_unit_tests is blank.
25141a054510Smrg#
251524047306Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
251624047306Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
251724047306Smrg# available, an argument of "optional" allows use when some unit tests require
251824047306Smrg# ld -wrap and others do not.
251924047306Smrg#
25201a054510SmrgAC_DEFUN([XORG_LD_WRAP],[
252124047306SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
252224047306Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
252324047306Smrg                      void __wrap_exit(int status) { return; }],
252424047306Smrg                     [exit(0);])])
25251a054510Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
252624047306Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
25271a054510Smrg  if test "x$have_ld_wrap" = x"no"; then
25281a054510Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
25291a054510Smrg  fi
25301a054510Smrgfi
25311a054510SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
25321a054510Smrg#
25331a054510Smrg]) # XORG_LD_WRAP
25341a054510Smrg
25351a054510Smrg# XORG_CHECK_LINKER_FLAGS
25361a054510Smrg# -----------------------
25371a054510Smrg# SYNOPSIS
25381a054510Smrg#
253924047306Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
25401a054510Smrg#
25411a054510Smrg# DESCRIPTION
25421a054510Smrg#
25431a054510Smrg#   Check whether the given linker FLAGS work with the current language's
25441a054510Smrg#   linker, or whether they give an error.
25451a054510Smrg#
25461a054510Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
25471a054510Smrg#   success/failure.
25481a054510Smrg#
254924047306Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
255024047306Smrg#
25511a054510Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
25521a054510Smrg#
25531a054510Smrg# LICENSE
25541a054510Smrg#
25551a054510Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
25561a054510Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
25571a054510Smrg#   Copyright (c) 2009 Matteo Frigo
25581a054510Smrg#
25591a054510Smrg#   This program is free software: you can redistribute it and/or modify it
25601a054510Smrg#   under the terms of the GNU General Public License as published by the
25611a054510Smrg#   Free Software Foundation, either version 3 of the License, or (at your
25621a054510Smrg#   option) any later version.
25631a054510Smrg#
25641a054510Smrg#   This program is distributed in the hope that it will be useful, but
25651a054510Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
25661a054510Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
25671a054510Smrg#   Public License for more details.
25681a054510Smrg#
25691a054510Smrg#   You should have received a copy of the GNU General Public License along
25701a054510Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
25711a054510Smrg#
25721a054510Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
25731a054510Smrg#   gives unlimited permission to copy, distribute and modify the configure
25741a054510Smrg#   scripts that are the output of Autoconf when processing the Macro. You
25751a054510Smrg#   need not follow the terms of the GNU General Public License when using
25761a054510Smrg#   or distributing such scripts, even though portions of the text of the
25771a054510Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
25781a054510Smrg#   all other use of the material that constitutes the Autoconf Macro.
25791a054510Smrg#
25801a054510Smrg#   This special exception to the GPL applies to versions of the Autoconf
25811a054510Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
25821a054510Smrg#   modified version of the Autoconf Macro, you may extend this special
25831a054510Smrg#   exception to the GPL to apply to your modified version as well.#
25841a054510SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
25851a054510Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
25861a054510Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
25871a054510SmrgAS_LITERAL_IF([$1],
25881a054510Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
25891a054510Smrg      ax_save_FLAGS=$LDFLAGS
25901a054510Smrg      LDFLAGS="$1"
259124047306Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
25921a054510Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25931a054510Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
25941a054510Smrg      LDFLAGS=$ax_save_FLAGS])],
25951a054510Smrg  [ax_save_FLAGS=$LDFLAGS
25961a054510Smrg   LDFLAGS="$1"
25971a054510Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
25981a054510Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25991a054510Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
26001a054510Smrg   LDFLAGS=$ax_save_FLAGS])
26011a054510Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
26021a054510SmrgAC_MSG_RESULT($xorg_check_linker_flags)
26031a054510Smrgif test "x$xorg_check_linker_flags" = xyes; then
26041a054510Smrg	m4_default([$2], :)
26051a054510Smrgelse
26061a054510Smrg	m4_default([$3], :)
26071a054510Smrgfi
26081a054510Smrg]) # XORG_CHECK_LINKER_FLAGS
26091a054510Smrg
261024047306Smrg# XORG_MEMORY_CHECK_FLAGS
261124047306Smrg# -----------------------
261224047306Smrg# Minimum version: 1.16.0
261324047306Smrg#
261424047306Smrg# This macro attempts to find appropriate memory checking functionality
261524047306Smrg# for various platforms which unit testing code may use to catch various
261624047306Smrg# forms of memory allocation and access errors in testing.
261724047306Smrg#
261824047306Smrg# Interface to module:
261924047306Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
262024047306Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
262124047306Smrg#
262224047306Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
262324047306Smrg#
262424047306SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
262524047306Smrg
262624047306SmrgAC_REQUIRE([AC_CANONICAL_HOST])
262724047306SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
262824047306Smrg           [Environment variables to enable memory checking in tests])
262924047306Smrg
263024047306Smrg# Check for different types of support on different platforms
263124047306Smrgcase $host_os in
263224047306Smrg    solaris*)
263324047306Smrg        AC_CHECK_LIB([umem], [umem_alloc],
263424047306Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
263524047306Smrg        ;;
263624047306Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
263724047306Smrg        # both directly and inverted, so should not be 0 or 255.
263824047306Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
263924047306Smrg        ;;
264024047306Smrg    darwin*)
264124047306Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
264224047306Smrg        ;;
264324047306Smrg    *bsd*)
264424047306Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
264524047306Smrg        ;;
264624047306Smrgesac
264724047306Smrg
264824047306Smrg# User supplied flags override default flags
264924047306Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
265024047306Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
265124047306Smrgfi
265224047306Smrg
265324047306SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
265424047306Smrg]) # XORG_WITH_LINT
265524047306Smrg
2656bf2eeab3Smrg# XORG_CHECK_MALLOC_ZERO
2657bf2eeab3Smrg# ----------------------
2658bf2eeab3Smrg# Minimum version: 1.0.0
2659bf2eeab3Smrg#
2660bf2eeab3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2661bf2eeab3Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2662bf2eeab3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2663bf2eeab3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2664bf2eeab3SmrgAC_ARG_ENABLE(malloc0returnsnull,
2665bf2eeab3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2666bf2eeab3Smrg		       [malloc(0) returns NULL (default: auto)]),
2667bf2eeab3Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2668bf2eeab3Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
266914c0a534Smrg
2670bf2eeab3SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2671bf2eeab3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
267224047306SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
267324047306Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
26741a054510Smrg#include <stdlib.h>
26751a054510Smrg],[
2676bf2eeab3Smrg    char *m0, *r0, *c0, *p;
2677bf2eeab3Smrg    m0 = malloc(0);
2678bf2eeab3Smrg    p = malloc(10);
2679bf2eeab3Smrg    r0 = realloc(p,0);
26801a054510Smrg    c0 = calloc(0,10);
26811a054510Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
26821a054510Smrg])],
268324047306Smrg		[xorg_cv_malloc0_returns_null=yes],
268424047306Smrg		[xorg_cv_malloc0_returns_null=no])])
268524047306SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2686bf2eeab3Smrgfi
2687bf2eeab3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
268814c0a534Smrg
2689bf2eeab3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2690bf2eeab3Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2691bf2eeab3Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2692bf2eeab3Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2693bf2eeab3Smrgelse
2694bf2eeab3Smrg	MALLOC_ZERO_CFLAGS=""
2695bf2eeab3Smrg	XMALLOC_ZERO_CFLAGS=""
2696bf2eeab3Smrg	XTMALLOC_ZERO_CFLAGS=""
2697bf2eeab3Smrgfi
269814c0a534Smrg
2699bf2eeab3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2700bf2eeab3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2701bf2eeab3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2702bf2eeab3Smrg]) # XORG_CHECK_MALLOC_ZERO
270314c0a534Smrg
2704bf2eeab3Smrg# XORG_WITH_LINT()
2705bf2eeab3Smrg# ----------------
2706bf2eeab3Smrg# Minimum version: 1.1.0
270714c0a534Smrg#
2708576bae58Smrg# This macro enables the use of a tool that flags some suspicious and
2709576bae58Smrg# non-portable constructs (likely to be bugs) in C language source code.
2710576bae58Smrg# It will attempt to locate the tool and use appropriate options.
2711576bae58Smrg# There are various lint type tools on different platforms.
2712576bae58Smrg#
2713576bae58Smrg# Interface to module:
2714576bae58Smrg# LINT:		returns the path to the tool found on the platform
2715576bae58Smrg#		or the value set to LINT on the configure cmd line
2716576bae58Smrg#		also an Automake conditional
2717576bae58Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2718576bae58Smrg#
2719576bae58Smrg# --with-lint:	'yes' user instructs the module to use lint
2720576bae58Smrg#		'no' user instructs the module not to use lint (default)
2721576bae58Smrg#
2722576bae58Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2723576bae58Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2724bf2eeab3Smrg#
2725bf2eeab3SmrgAC_DEFUN([XORG_WITH_LINT],[
2726bf2eeab3Smrg
2727576bae58SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2728576bae58SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2729bf2eeab3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2730bf2eeab3Smrg		[Use a lint-style source code checker (default: disabled)])],
2731bf2eeab3Smrg		[use_lint=$withval], [use_lint=no])
2732576bae58Smrg
2733576bae58Smrg# Obtain platform specific info like program name and options
2734576bae58Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2735576bae58Smrgcase $host_os in
2736576bae58Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2737576bae58Smrg	lint_name=splint
2738576bae58Smrg	lint_options="-badflag"
2739576bae58Smrg	;;
2740576bae58Smrg  *freebsd* | *netbsd*)
2741576bae58Smrg	lint_name=lint
2742576bae58Smrg	lint_options="-u -b"
2743576bae58Smrg	;;
2744576bae58Smrg  *solaris*)
2745576bae58Smrg	lint_name=lint
2746576bae58Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2747576bae58Smrg	;;
2748576bae58Smrgesac
2749576bae58Smrg
2750576bae58Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2751576bae58Smrgif test "x$use_lint" = x"yes" ; then
2752576bae58Smrg   AC_PATH_PROG([LINT], [$lint_name])
2753576bae58Smrg   if test "x$LINT" = "x"; then
2754576bae58Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2755576bae58Smrg   fi
2756576bae58Smrgelif test "x$use_lint" = x"no" ; then
2757576bae58Smrg   if test "x$LINT" != "x"; then
2758576bae58Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2759576bae58Smrg   fi
276014c0a534Smrgelse
2761576bae58Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2762bf2eeab3Smrgfi
2763576bae58Smrg
2764576bae58Smrg# User supplied flags override default flags
2765576bae58Smrgif test "x$LINT_FLAGS" != "x"; then
2766576bae58Smrg   lint_options=$LINT_FLAGS
276714c0a534Smrgfi
276814c0a534Smrg
2769576bae58SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2770576bae58SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
277114c0a534Smrg
2772bf2eeab3Smrg]) # XORG_WITH_LINT
277314c0a534Smrg
2774bf2eeab3Smrg# XORG_LINT_LIBRARY(LIBNAME)
2775bf2eeab3Smrg# --------------------------
2776bf2eeab3Smrg# Minimum version: 1.1.0
2777bf2eeab3Smrg#
2778bf2eeab3Smrg# Sets up flags for building lint libraries for checking programs that call
2779bf2eeab3Smrg# functions in the library.
2780bf2eeab3Smrg#
2781576bae58Smrg# Interface to module:
2782576bae58Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2783576bae58Smrg# MAKE_LINT_LIB		- Automake conditional
2784576bae58Smrg#
2785576bae58Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2786576bae58Smrg#			  - 'no' user instructs the module not to create a lint library (default)
278714c0a534Smrg
2788bf2eeab3SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2789bf2eeab3SmrgAC_REQUIRE([XORG_WITH_LINT])
2790bf2eeab3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2791bf2eeab3Smrg	[Create lint library (default: disabled)])],
2792bf2eeab3Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2793576bae58Smrg
2794576bae58Smrgif test "x$make_lint_lib" = x"yes" ; then
2795576bae58Smrg   LINTLIB=llib-l$1.ln
2796576bae58Smrg   if test "x$LINT" = "x"; then
2797576bae58Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2798576bae58Smrg   fi
2799576bae58Smrgelif test "x$make_lint_lib" != x"no" ; then
2800576bae58Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2801bf2eeab3Smrgfi
2802576bae58Smrg
2803bf2eeab3SmrgAC_SUBST(LINTLIB)
2804bf2eeab3SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
280514c0a534Smrg
2806bf2eeab3Smrg]) # XORG_LINT_LIBRARY
280714c0a534Smrg
28081a054510Smrg# XORG_COMPILER_BRAND
28091a054510Smrg# -------------------
28101a054510Smrg# Minimum version: 1.14.0
28111a054510Smrg#
28121a054510Smrg# Checks for various brands of compilers and sets flags as appropriate:
28131a054510Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
281424047306Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
28151a054510Smrg#   clang compiler - sets CLANGCC to "yes"
28161a054510Smrg#   Intel compiler - sets INTELCC to "yes"
28171a054510Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
28181a054510Smrg#
28191a054510SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
282024047306SmrgAC_LANG_CASE(
282124047306Smrg	[C], [
282224047306Smrg		AC_REQUIRE([AC_PROG_CC_C99])
282324047306Smrg	],
282424047306Smrg	[C++], [
282524047306Smrg		AC_REQUIRE([AC_PROG_CXX])
282624047306Smrg	]
282724047306Smrg)
28281a054510SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
28291a054510SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
28301a054510SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
28311a054510Smrg]) # XORG_COMPILER_BRAND
28321a054510Smrg
283324047306Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
283424047306Smrg# ---------------
283524047306Smrg# Minimum version: 1.16.0
283624047306Smrg#
283724047306Smrg# Test if the compiler works when passed the given flag as a command line argument.
283824047306Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
283924047306Smrg# next flag in the list until there are no more options.
284024047306Smrg#
284124047306Smrg# Note that this does not guarantee that the compiler supports the flag as some
284224047306Smrg# compilers will simply ignore arguments that they do not understand, but we do
284324047306Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
284424047306Smrg# -Werror=unused-command-line-argument
284524047306Smrg#
284624047306SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
284724047306Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
284824047306Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
284924047306Smrg
285024047306SmrgAC_LANG_COMPILER_REQUIRE
285124047306Smrg
285224047306SmrgAC_LANG_CASE(
285324047306Smrg	[C], [
285424047306Smrg		AC_REQUIRE([AC_PROG_CC_C99])
285524047306Smrg		define([PREFIX], [C])
285624047306Smrg		define([CACHE_PREFIX], [cc])
285724047306Smrg		define([COMPILER], [$CC])
285824047306Smrg	],
285924047306Smrg	[C++], [
286024047306Smrg		define([PREFIX], [CXX])
286124047306Smrg		define([CACHE_PREFIX], [cxx])
286224047306Smrg		define([COMPILER], [$CXX])
286324047306Smrg	]
286424047306Smrg)
286524047306Smrg
286624047306Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
286724047306Smrg
286824047306Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
286924047306Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
287024047306Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
287124047306Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
287224047306Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
287324047306Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
287424047306Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
287524047306Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
287624047306Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
287724047306Smrgfi
287824047306Smrg
287924047306Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
288024047306Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
288124047306Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
288224047306Smrg	fi
288324047306Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
288424047306Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
288524047306Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
288624047306Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
288724047306Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
288824047306Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
288924047306Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
289024047306Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
289124047306Smrgfi
289224047306Smrg
289324047306Smrgfound="no"
289424047306Smrgm4_foreach([flag], m4_cdr($@), [
289524047306Smrg	if test $found = "no" ; then
289624047306Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
289724047306Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
289824047306Smrg		fi
289924047306Smrg
290024047306Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
290124047306Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
290224047306Smrg		fi
290324047306Smrg
290424047306Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
290524047306Smrg
290624047306Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
290724047306Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
290824047306Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
290924047306Smrg		AC_CACHE_VAL($cacheid,
291024047306Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
291124047306Smrg					     [eval $cacheid=yes],
291224047306Smrg					     [eval $cacheid=no])])
291324047306Smrg
291424047306Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
291524047306Smrg
291624047306Smrg		eval supported=\$$cacheid
291724047306Smrg		AC_MSG_RESULT([$supported])
291824047306Smrg		if test "$supported" = "yes" ; then
291924047306Smrg			$1="$$1 ]flag["
292024047306Smrg			found="yes"
292124047306Smrg		fi
292224047306Smrg	fi
292324047306Smrg])
292424047306Smrg]) # XORG_TESTSET_CFLAG
292524047306Smrg
292624047306Smrg# XORG_COMPILER_FLAGS
292724047306Smrg# ---------------
292824047306Smrg# Minimum version: 1.16.0
292924047306Smrg#
293024047306Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
293124047306Smrg# arguments supported by the selected compiler which do NOT alter the generated
293224047306Smrg# code.  These arguments will cause the compiler to print various warnings
293324047306Smrg# during compilation AND turn a conservative set of warnings into errors.
293424047306Smrg#
293524047306Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
293624047306Smrg# future versions of util-macros as options are added to new compilers.
293724047306Smrg#
293824047306SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
293924047306SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
294024047306Smrg
294124047306SmrgAC_ARG_ENABLE(selective-werror,
294224047306Smrg              AS_HELP_STRING([--disable-selective-werror],
294324047306Smrg                             [Turn off selective compiler errors. (default: enabled)]),
294424047306Smrg              [SELECTIVE_WERROR=$enableval],
294524047306Smrg              [SELECTIVE_WERROR=yes])
294624047306Smrg
294724047306SmrgAC_LANG_CASE(
294824047306Smrg        [C], [
294924047306Smrg                define([PREFIX], [C])
295024047306Smrg        ],
295124047306Smrg        [C++], [
295224047306Smrg                define([PREFIX], [CXX])
295324047306Smrg        ]
295424047306Smrg)
295524047306Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
295624047306Smrgif test "x$SUNCC" = "xyes"; then
295724047306Smrg    [BASE_]PREFIX[FLAGS]="-v"
295824047306Smrgelse
295924047306Smrg    [BASE_]PREFIX[FLAGS]=""
296024047306Smrgfi
296124047306Smrg
296224047306Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
296324047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
296424047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
296524047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
296624047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
296724047306Smrg
296824047306SmrgAC_LANG_CASE(
296924047306Smrg	[C], [
297024047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
297124047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
297224047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
297324047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
297424047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
297524047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
297624047306Smrg	]
297724047306Smrg)
297824047306Smrg
297924047306Smrg# This chunk adds additional warnings that could catch undesired effects.
298024047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
298124047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
298224047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
298324047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
298424047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
298524047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
298624047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
298724047306Smrg
298824047306Smrg# These are currently disabled because they are noisy.  They will be enabled
298924047306Smrg# in the future once the codebase is sufficiently modernized to silence
299024047306Smrg# them.  For now, I don't want them to drown out the other warnings.
299124047306Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
299224047306Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
299324047306Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
299424047306Smrg
299524047306Smrg# Turn some warnings into errors, so we don't accidently get successful builds
299624047306Smrg# when there are problems that should be fixed.
299724047306Smrg
299824047306Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
299924047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
300024047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
300124047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
300224047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
300324047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
300424047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
300524047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
300624047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
300724047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
300824047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
300924047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
301024047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
301124047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
301224047306Smrgelse
301324047306SmrgAC_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])
301424047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
301524047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
301624047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
301724047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
301824047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
301924047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
302024047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
302124047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
302224047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
302324047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
302424047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
302524047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
302624047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
302724047306Smrgfi
302824047306Smrg
302924047306SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
303024047306Smrg]) # XORG_COMPILER_FLAGS
303124047306Smrg
3032bf2eeab3Smrg# XORG_CWARNFLAGS
3033bf2eeab3Smrg# ---------------
3034bf2eeab3Smrg# Minimum version: 1.2.0
303524047306Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3036bf2eeab3Smrg#
3037bf2eeab3Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3038bf2eeab3Smrg#
303924047306Smrg# This function is deprecated because it defines -fno-strict-aliasing
304024047306Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
304124047306Smrg# is needed, then it should be added explicitly in the module when
304224047306Smrg# it is updated to use BASE_CFLAGS.
304324047306Smrg#
3044bf2eeab3SmrgAC_DEFUN([XORG_CWARNFLAGS], [
304524047306SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30461a054510SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
304724047306SmrgAC_LANG_CASE(
304824047306Smrg	[C], [
304924047306Smrg		CWARNFLAGS="$BASE_CFLAGS"
305024047306Smrg		if  test "x$GCC" = xyes ; then
305124047306Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
305224047306Smrg		fi
305324047306Smrg		AC_SUBST(CWARNFLAGS)
305424047306Smrg	]
305524047306Smrg)
3056bf2eeab3Smrg]) # XORG_CWARNFLAGS
305714c0a534Smrg
3058bf2eeab3Smrg# XORG_STRICT_OPTION
3059bf2eeab3Smrg# -----------------------
3060bf2eeab3Smrg# Minimum version: 1.3.0
306114c0a534Smrg#
30621a054510Smrg# Add configure option to enable strict compilation flags, such as treating
30631a054510Smrg# warnings as fatal errors.
30641a054510Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
306524047306Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
30661a054510Smrg#
30671a054510Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
30681a054510Smrg# when strict compilation is unconditionally desired.
3069bf2eeab3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3070bf2eeab3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
307124047306SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3072bf2eeab3Smrg
3073bf2eeab3SmrgAC_ARG_ENABLE(strict-compilation,
3074bf2eeab3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3075bf2eeab3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3076bf2eeab3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
307724047306Smrg
307824047306SmrgAC_LANG_CASE(
307924047306Smrg        [C], [
308024047306Smrg                define([PREFIX], [C])
308124047306Smrg        ],
308224047306Smrg        [C++], [
308324047306Smrg                define([PREFIX], [CXX])
308424047306Smrg        ]
308524047306Smrg)
308624047306Smrg
308724047306Smrg[STRICT_]PREFIX[FLAGS]=""
308824047306SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
308924047306SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
309024047306Smrg
309124047306Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
309224047306Smrg# activate it with -Werror, so we add it here explicitly.
309324047306SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
309424047306Smrg
3095bf2eeab3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
309624047306Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
309724047306Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3098bf2eeab3Smrgfi
309924047306SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
310024047306SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
310124047306SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3102bf2eeab3Smrg]) # XORG_STRICT_OPTION
310314c0a534Smrg
3104bf2eeab3Smrg# XORG_DEFAULT_OPTIONS
3105bf2eeab3Smrg# --------------------
3106bf2eeab3Smrg# Minimum version: 1.3.0
3107bf2eeab3Smrg#
3108bf2eeab3Smrg# Defines default options for X.Org modules.
3109bf2eeab3Smrg#
3110bf2eeab3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3111576bae58SmrgAC_REQUIRE([AC_PROG_INSTALL])
311224047306SmrgXORG_COMPILER_FLAGS
3113bf2eeab3SmrgXORG_CWARNFLAGS
3114bf2eeab3SmrgXORG_STRICT_OPTION
3115bf2eeab3SmrgXORG_RELEASE_VERSION
3116bf2eeab3SmrgXORG_CHANGELOG
3117576bae58SmrgXORG_INSTALL
3118bf2eeab3SmrgXORG_MANPAGE_SECTIONS
3119576bae58Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3120576bae58Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3121bf2eeab3Smrg]) # XORG_DEFAULT_OPTIONS
3122576bae58Smrg
3123576bae58Smrg# XORG_INSTALL()
3124576bae58Smrg# ----------------
3125576bae58Smrg# Minimum version: 1.4.0
3126576bae58Smrg#
3127576bae58Smrg# Defines the variable INSTALL_CMD as the command to copy
3128576bae58Smrg# INSTALL from $prefix/share/util-macros.
3129576bae58Smrg#
3130576bae58SmrgAC_DEFUN([XORG_INSTALL], [
3131576bae58SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3132576bae58Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3133576bae58SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3134576bae58Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3135576bae58Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3136576bae58Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3137576bae58SmrgAC_SUBST([INSTALL_CMD])
3138576bae58Smrg]) # XORG_INSTALL
3139bf2eeab3Smrgdnl Copyright 2005 Red Hat, Inc
3140bf2eeab3Smrgdnl
3141bf2eeab3Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3142bf2eeab3Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3143bf2eeab3Smrgdnl the above copyright notice appear in all copies and that both that
3144bf2eeab3Smrgdnl copyright notice and this permission notice appear in supporting
3145bf2eeab3Smrgdnl documentation.
3146bf2eeab3Smrgdnl
3147bf2eeab3Smrgdnl The above copyright notice and this permission notice shall be included
3148bf2eeab3Smrgdnl in all copies or substantial portions of the Software.
3149bf2eeab3Smrgdnl
3150bf2eeab3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3151bf2eeab3Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3152bf2eeab3Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3153bf2eeab3Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3154bf2eeab3Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3155bf2eeab3Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3156bf2eeab3Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3157bf2eeab3Smrgdnl
3158bf2eeab3Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3159bf2eeab3Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3160bf2eeab3Smrgdnl other dealings in this Software without prior written authorization
3161bf2eeab3Smrgdnl from the copyright holders.
3162bf2eeab3Smrgdnl
316314c0a534Smrg
3164bf2eeab3Smrg# XORG_RELEASE_VERSION
3165bf2eeab3Smrg# --------------------
3166576bae58Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
316724047306Smrg
3168bf2eeab3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3169bf2eeab3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3170bf2eeab3Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3171bf2eeab3Smrg		[Major version of this package])
3172bf2eeab3Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3173bf2eeab3Smrg	if test "x$PVM" = "x"; then
3174bf2eeab3Smrg		PVM="0"
3175bf2eeab3Smrg	fi
3176bf2eeab3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3177bf2eeab3Smrg		[$PVM],
3178bf2eeab3Smrg		[Minor version of this package])
3179bf2eeab3Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3180bf2eeab3Smrg	if test "x$PVP" = "x"; then
3181bf2eeab3Smrg		PVP="0"
3182bf2eeab3Smrg	fi
3183bf2eeab3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3184bf2eeab3Smrg		[$PVP],
3185bf2eeab3Smrg		[Patch version of this package])
318614c0a534Smrg])
318714c0a534Smrg
3188bf2eeab3Smrg# XORG_CHANGELOG()
3189bf2eeab3Smrg# ----------------
3190bf2eeab3Smrg# Minimum version: 1.2.0
3191bf2eeab3Smrg#
3192bf2eeab3Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3193bf2eeab3Smrg# ChangeLog from git.
3194bf2eeab3Smrg#
3195bf2eeab3Smrg#
3196bf2eeab3SmrgAC_DEFUN([XORG_CHANGELOG], [
3197576bae58SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3198576bae58Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3199576bae58Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3200bf2eeab3Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3201bf2eeab3SmrgAC_SUBST([CHANGELOG_CMD])
3202bf2eeab3Smrg]) # XORG_CHANGELOG
320314c0a534Smrg
3204